@swifty.js/larky 0.0.10 → 0.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/PROTOCOL.md DELETED
@@ -1,2451 +0,0 @@
1
- # Wire Protocol
2
-
3
- > Generated by `scripts/gen-protocol-doc.ts`. **Do not edit manually.**
4
-
5
- ## Transport
6
-
7
- - TCP loopback `127.0.0.1:5520` (override via `LARKY_HOST` / `LARKY_PORT`)
8
- - Each message is one `\n`-terminated JSON line (NDJSON)
9
- - Commands use JSON-RPC 2.0 (client → server); Events use `kind=event` envelope (server → client)
10
- - Interaction requests (`permission.requested`, `ask_user.requested`, `plan.requested`) carry an `id` that the client answers via the matching `*.respond` RPC
11
-
12
- ## Commands
13
-
14
- All commands are sent as JSON-RPC 2.0 requests; `method` selects the handler.
15
-
16
- ## `core.ping`
17
-
18
- ### Request params
19
-
20
- | Field | Type | Required |
21
- | -------- | -------- | -------- |
22
- | `type` | `string` | yes |
23
- | `client` | `string` | yes |
24
-
25
- ```json
26
- {
27
- "$schema": "https://json-schema.org/draft/2020-12/schema",
28
- "type": "object",
29
- "properties": {
30
- "type": {
31
- "default": "core.ping",
32
- "type": "string",
33
- "const": "core.ping"
34
- },
35
- "client": {
36
- "type": "string"
37
- }
38
- },
39
- "required": ["type", "client"],
40
- "additionalProperties": false
41
- }
42
- ```
43
-
44
- ### Result
45
-
46
- | Field | Type | Required |
47
- | ---------------- | --------- | -------- |
48
- | `server_version` | `string` | yes |
49
- | `uptime_ms` | `integer` | yes |
50
- | `received_at` | `string` | yes |
51
-
52
- ```json
53
- {
54
- "$schema": "https://json-schema.org/draft/2020-12/schema",
55
- "type": "object",
56
- "properties": {
57
- "server_version": {
58
- "type": "string"
59
- },
60
- "uptime_ms": {
61
- "type": "integer",
62
- "minimum": -9007199254740991,
63
- "maximum": 9007199254740991
64
- },
65
- "received_at": {
66
- "type": "string"
67
- }
68
- },
69
- "required": ["server_version", "uptime_ms", "received_at"],
70
- "additionalProperties": false
71
- }
72
- ```
73
-
74
- ## `core.status`
75
-
76
- ### Request params
77
-
78
- | Field | Type | Required |
79
- | ------ | -------- | -------- |
80
- | `type` | `string` | yes |
81
-
82
- ```json
83
- {
84
- "$schema": "https://json-schema.org/draft/2020-12/schema",
85
- "type": "object",
86
- "properties": {
87
- "type": {
88
- "default": "core.status",
89
- "type": "string",
90
- "const": "core.status"
91
- }
92
- },
93
- "required": ["type"],
94
- "additionalProperties": false
95
- }
96
- ```
97
-
98
- ### Result
99
-
100
- | Field | Type | Required |
101
- | ----------------- | --------- | -------- |
102
- | `server_version` | `string` | yes |
103
- | `uptime_ms` | `integer` | yes |
104
- | `cwd` | `string` | yes |
105
- | `active_sessions` | `integer` | yes |
106
-
107
- ```json
108
- {
109
- "$schema": "https://json-schema.org/draft/2020-12/schema",
110
- "type": "object",
111
- "properties": {
112
- "server_version": {
113
- "type": "string"
114
- },
115
- "uptime_ms": {
116
- "type": "integer",
117
- "minimum": -9007199254740991,
118
- "maximum": 9007199254740991
119
- },
120
- "cwd": {
121
- "type": "string"
122
- },
123
- "active_sessions": {
124
- "type": "integer",
125
- "minimum": -9007199254740991,
126
- "maximum": 9007199254740991
127
- }
128
- },
129
- "required": ["server_version", "uptime_ms", "cwd", "active_sessions"],
130
- "additionalProperties": false
131
- }
132
- ```
133
-
134
- ## `event.subscribe`
135
-
136
- ### Request params
137
-
138
- | Field | Type | Required |
139
- | ----------------- | --------- | -------- | --- |
140
- | `type` | `string` | yes |
141
- | `topics` | `array` | yes |
142
- | `scope` | `string` | yes |
143
- | `replay_from_run` | `string | null` | yes |
144
- | `replay_offset` | `integer` | yes |
145
-
146
- ```json
147
- {
148
- "$schema": "https://json-schema.org/draft/2020-12/schema",
149
- "type": "object",
150
- "properties": {
151
- "type": {
152
- "default": "event.subscribe",
153
- "type": "string",
154
- "const": "event.subscribe"
155
- },
156
- "topics": {
157
- "type": "array",
158
- "items": {
159
- "type": "string"
160
- }
161
- },
162
- "scope": {
163
- "default": "global",
164
- "type": "string"
165
- },
166
- "replay_from_run": {
167
- "default": null,
168
- "anyOf": [
169
- {
170
- "type": "string"
171
- },
172
- {
173
- "type": "null"
174
- }
175
- ]
176
- },
177
- "replay_offset": {
178
- "default": 0,
179
- "type": "integer",
180
- "minimum": 0,
181
- "maximum": 9007199254740991
182
- }
183
- },
184
- "required": ["type", "topics", "scope", "replay_from_run", "replay_offset"],
185
- "additionalProperties": false
186
- }
187
- ```
188
-
189
- ### Result
190
-
191
- | Field | Type | Required |
192
- | ----------------- | --------- | -------- |
193
- | `subscription_id` | `string` | yes |
194
- | `replayed_count` | `integer` | yes |
195
-
196
- ```json
197
- {
198
- "$schema": "https://json-schema.org/draft/2020-12/schema",
199
- "type": "object",
200
- "properties": {
201
- "subscription_id": {
202
- "type": "string"
203
- },
204
- "replayed_count": {
205
- "default": 0,
206
- "type": "integer",
207
- "minimum": -9007199254740991,
208
- "maximum": 9007199254740991
209
- }
210
- },
211
- "required": ["subscription_id", "replayed_count"],
212
- "additionalProperties": false
213
- }
214
- ```
215
-
216
- ## `session.create`
217
-
218
- ### Request params
219
-
220
- | Field | Type | Required |
221
- | ----------------- | --------- | -------- | --- |
222
- | `type` | `string` | yes |
223
- | `permission_mode` | `string | null` | yes |
224
- | `persist` | `boolean` | yes |
225
-
226
- ```json
227
- {
228
- "$schema": "https://json-schema.org/draft/2020-12/schema",
229
- "type": "object",
230
- "properties": {
231
- "type": {
232
- "default": "session.create",
233
- "type": "string",
234
- "const": "session.create"
235
- },
236
- "permission_mode": {
237
- "default": null,
238
- "anyOf": [
239
- {
240
- "type": "string",
241
- "enum": ["default", "acceptEdits", "plan", "bypassPermissions"]
242
- },
243
- {
244
- "type": "null"
245
- }
246
- ]
247
- },
248
- "persist": {
249
- "default": true,
250
- "type": "boolean"
251
- }
252
- },
253
- "required": ["type", "permission_mode", "persist"],
254
- "additionalProperties": false
255
- }
256
- ```
257
-
258
- ### Result
259
-
260
- | Field | Type | Required |
261
- | ----------------- | -------- | -------- |
262
- | `session_id` | `string` | yes |
263
- | `cwd` | `string` | yes |
264
- | `permission_mode` | `string` | yes |
265
- | `commands` | `array` | yes |
266
-
267
- ```json
268
- {
269
- "$schema": "https://json-schema.org/draft/2020-12/schema",
270
- "type": "object",
271
- "properties": {
272
- "session_id": {
273
- "type": "string"
274
- },
275
- "cwd": {
276
- "type": "string"
277
- },
278
- "permission_mode": {
279
- "type": "string",
280
- "enum": ["default", "acceptEdits", "plan", "bypassPermissions"]
281
- },
282
- "commands": {
283
- "default": [],
284
- "type": "array",
285
- "items": {
286
- "type": "object",
287
- "properties": {
288
- "name": {
289
- "type": "string"
290
- },
291
- "description": {
292
- "default": "",
293
- "type": "string"
294
- },
295
- "aliases": {
296
- "default": [],
297
- "type": "array",
298
- "items": {
299
- "type": "string"
300
- }
301
- }
302
- },
303
- "required": ["name", "description", "aliases"],
304
- "additionalProperties": false
305
- }
306
- }
307
- },
308
- "required": ["session_id", "cwd", "permission_mode", "commands"],
309
- "additionalProperties": false
310
- }
311
- ```
312
-
313
- ## `session.list`
314
-
315
- ### Request params
316
-
317
- | Field | Type | Required |
318
- | ------ | -------- | -------- |
319
- | `type` | `string` | yes |
320
-
321
- ```json
322
- {
323
- "$schema": "https://json-schema.org/draft/2020-12/schema",
324
- "type": "object",
325
- "properties": {
326
- "type": {
327
- "default": "session.list",
328
- "type": "string",
329
- "const": "session.list"
330
- }
331
- },
332
- "required": ["type"],
333
- "additionalProperties": false
334
- }
335
- ```
336
-
337
- ### Result
338
-
339
- | Field | Type | Required |
340
- | ---------- | ------- | -------- |
341
- | `sessions` | `array` | yes |
342
-
343
- ```json
344
- {
345
- "$schema": "https://json-schema.org/draft/2020-12/schema",
346
- "type": "object",
347
- "properties": {
348
- "sessions": {
349
- "type": "array",
350
- "items": {
351
- "type": "object",
352
- "properties": {
353
- "id": {
354
- "type": "string"
355
- },
356
- "first_message": {
357
- "type": "string"
358
- },
359
- "message_count": {
360
- "type": "integer",
361
- "minimum": -9007199254740991,
362
- "maximum": 9007199254740991
363
- },
364
- "mod_time": {
365
- "type": "string"
366
- }
367
- },
368
- "required": ["id", "first_message", "message_count", "mod_time"],
369
- "additionalProperties": false
370
- }
371
- }
372
- },
373
- "required": ["sessions"],
374
- "additionalProperties": false
375
- }
376
- ```
377
-
378
- ## `session.resume`
379
-
380
- ### Request params
381
-
382
- | Field | Type | Required |
383
- | ------------ | -------- | -------- |
384
- | `type` | `string` | yes |
385
- | `session_id` | `string` | yes |
386
- | `resume_id` | `string` | yes |
387
-
388
- ```json
389
- {
390
- "$schema": "https://json-schema.org/draft/2020-12/schema",
391
- "type": "object",
392
- "properties": {
393
- "type": {
394
- "default": "session.resume",
395
- "type": "string",
396
- "const": "session.resume"
397
- },
398
- "session_id": {
399
- "type": "string"
400
- },
401
- "resume_id": {
402
- "type": "string"
403
- }
404
- },
405
- "required": ["type", "session_id", "resume_id"],
406
- "additionalProperties": false
407
- }
408
- ```
409
-
410
- ### Result
411
-
412
- | Field | Type | Required |
413
- | ---------- | ------- | -------- |
414
- | `messages` | `array` | yes |
415
-
416
- ```json
417
- {
418
- "$schema": "https://json-schema.org/draft/2020-12/schema",
419
- "type": "object",
420
- "properties": {
421
- "messages": {
422
- "type": "array",
423
- "items": {
424
- "type": "object",
425
- "properties": {
426
- "role": {
427
- "type": "string"
428
- },
429
- "content": {
430
- "type": "string"
431
- }
432
- },
433
- "required": ["role", "content"],
434
- "additionalProperties": false
435
- }
436
- }
437
- },
438
- "required": ["messages"],
439
- "additionalProperties": false
440
- }
441
- ```
442
-
443
- ## `session.send_message`
444
-
445
- ### Request params
446
-
447
- | Field | Type | Required |
448
- | ------------ | -------- | -------- |
449
- | `type` | `string` | yes |
450
- | `session_id` | `string` | yes |
451
- | `content` | `string` | yes |
452
-
453
- ```json
454
- {
455
- "$schema": "https://json-schema.org/draft/2020-12/schema",
456
- "type": "object",
457
- "properties": {
458
- "type": {
459
- "default": "session.send_message",
460
- "type": "string",
461
- "const": "session.send_message"
462
- },
463
- "session_id": {
464
- "type": "string"
465
- },
466
- "content": {
467
- "type": "string"
468
- }
469
- },
470
- "required": ["type", "session_id", "content"],
471
- "additionalProperties": false
472
- }
473
- ```
474
-
475
- ### Result
476
-
477
- | Field | Type | Required |
478
- | -------- | -------- | -------- |
479
- | `run_id` | `string` | yes |
480
-
481
- ```json
482
- {
483
- "$schema": "https://json-schema.org/draft/2020-12/schema",
484
- "type": "object",
485
- "properties": {
486
- "run_id": {
487
- "type": "string"
488
- }
489
- },
490
- "required": ["run_id"],
491
- "additionalProperties": false
492
- }
493
- ```
494
-
495
- ## `session.close`
496
-
497
- ### Request params
498
-
499
- | Field | Type | Required |
500
- | ------------ | -------- | -------- |
501
- | `type` | `string` | yes |
502
- | `session_id` | `string` | yes |
503
-
504
- ```json
505
- {
506
- "$schema": "https://json-schema.org/draft/2020-12/schema",
507
- "type": "object",
508
- "properties": {
509
- "type": {
510
- "default": "session.close",
511
- "type": "string",
512
- "const": "session.close"
513
- },
514
- "session_id": {
515
- "type": "string"
516
- }
517
- },
518
- "required": ["type", "session_id"],
519
- "additionalProperties": false
520
- }
521
- ```
522
-
523
- ### Result
524
-
525
- | Field | Type | Required |
526
- | ----- | --------- | -------- |
527
- | `ok` | `boolean` | yes |
528
-
529
- ```json
530
- {
531
- "$schema": "https://json-schema.org/draft/2020-12/schema",
532
- "type": "object",
533
- "properties": {
534
- "ok": {
535
- "default": true,
536
- "type": "boolean"
537
- }
538
- },
539
- "required": ["ok"],
540
- "additionalProperties": false
541
- }
542
- ```
543
-
544
- ## `run.cancel`
545
-
546
- ### Request params
547
-
548
- | Field | Type | Required |
549
- | ------------ | -------- | -------- |
550
- | `type` | `string` | yes |
551
- | `session_id` | `string` | yes |
552
-
553
- ```json
554
- {
555
- "$schema": "https://json-schema.org/draft/2020-12/schema",
556
- "type": "object",
557
- "properties": {
558
- "type": {
559
- "default": "run.cancel",
560
- "type": "string",
561
- "const": "run.cancel"
562
- },
563
- "session_id": {
564
- "type": "string"
565
- }
566
- },
567
- "required": ["type", "session_id"],
568
- "additionalProperties": false
569
- }
570
- ```
571
-
572
- ### Result
573
-
574
- | Field | Type | Required |
575
- | ----------- | --------- | -------- |
576
- | `ok` | `boolean` | yes |
577
- | `cancelled` | `boolean` | yes |
578
-
579
- ```json
580
- {
581
- "$schema": "https://json-schema.org/draft/2020-12/schema",
582
- "type": "object",
583
- "properties": {
584
- "ok": {
585
- "default": true,
586
- "type": "boolean"
587
- },
588
- "cancelled": {
589
- "default": false,
590
- "type": "boolean"
591
- }
592
- },
593
- "required": ["ok", "cancelled"],
594
- "additionalProperties": false
595
- }
596
- ```
597
-
598
- ## `permission.respond`
599
-
600
- ### Request params
601
-
602
- | Field | Type | Required |
603
- | ---------- | -------- | -------- |
604
- | `type` | `string` | yes |
605
- | `id` | `string` | yes |
606
- | `response` | `string` | yes |
607
-
608
- ```json
609
- {
610
- "$schema": "https://json-schema.org/draft/2020-12/schema",
611
- "type": "object",
612
- "properties": {
613
- "type": {
614
- "default": "permission.respond",
615
- "type": "string",
616
- "const": "permission.respond"
617
- },
618
- "id": {
619
- "type": "string"
620
- },
621
- "response": {
622
- "type": "string",
623
- "enum": ["allow", "deny", "allowAlways"]
624
- }
625
- },
626
- "required": ["type", "id", "response"],
627
- "additionalProperties": false
628
- }
629
- ```
630
-
631
- ### Result
632
-
633
- | Field | Type | Required |
634
- | ----- | --------- | -------- |
635
- | `ok` | `boolean` | yes |
636
-
637
- ```json
638
- {
639
- "$schema": "https://json-schema.org/draft/2020-12/schema",
640
- "type": "object",
641
- "properties": {
642
- "ok": {
643
- "default": true,
644
- "type": "boolean"
645
- }
646
- },
647
- "required": ["ok"],
648
- "additionalProperties": false
649
- }
650
- ```
651
-
652
- ## `ask_user.respond`
653
-
654
- ### Request params
655
-
656
- | Field | Type | Required |
657
- | --------- | -------- | -------- |
658
- | `type` | `string` | yes |
659
- | `id` | `string` | yes |
660
- | `answers` | `object` | yes |
661
-
662
- ```json
663
- {
664
- "$schema": "https://json-schema.org/draft/2020-12/schema",
665
- "type": "object",
666
- "properties": {
667
- "type": {
668
- "default": "ask_user.respond",
669
- "type": "string",
670
- "const": "ask_user.respond"
671
- },
672
- "id": {
673
- "type": "string"
674
- },
675
- "answers": {
676
- "type": "object",
677
- "propertyNames": {
678
- "type": "string"
679
- },
680
- "additionalProperties": {
681
- "type": "string"
682
- }
683
- }
684
- },
685
- "required": ["type", "id", "answers"],
686
- "additionalProperties": false
687
- }
688
- ```
689
-
690
- ### Result
691
-
692
- | Field | Type | Required |
693
- | ----- | --------- | -------- |
694
- | `ok` | `boolean` | yes |
695
-
696
- ```json
697
- {
698
- "$schema": "https://json-schema.org/draft/2020-12/schema",
699
- "type": "object",
700
- "properties": {
701
- "ok": {
702
- "default": true,
703
- "type": "boolean"
704
- }
705
- },
706
- "required": ["ok"],
707
- "additionalProperties": false
708
- }
709
- ```
710
-
711
- ## `plan.respond`
712
-
713
- ### Request params
714
-
715
- | Field | Type | Required |
716
- | ---------- | -------- | -------- |
717
- | `type` | `string` | yes |
718
- | `id` | `string` | yes |
719
- | `choice` | `string` | yes |
720
- | `feedback` | `string` | yes |
721
-
722
- ```json
723
- {
724
- "$schema": "https://json-schema.org/draft/2020-12/schema",
725
- "type": "object",
726
- "properties": {
727
- "type": {
728
- "default": "plan.respond",
729
- "type": "string",
730
- "const": "plan.respond"
731
- },
732
- "id": {
733
- "type": "string"
734
- },
735
- "choice": {
736
- "type": "string",
737
- "enum": ["yolo", "manual", "feedback"]
738
- },
739
- "feedback": {
740
- "default": "",
741
- "type": "string"
742
- }
743
- },
744
- "required": ["type", "id", "choice", "feedback"],
745
- "additionalProperties": false
746
- }
747
- ```
748
-
749
- ### Result
750
-
751
- | Field | Type | Required |
752
- | ----- | --------- | -------- |
753
- | `ok` | `boolean` | yes |
754
-
755
- ```json
756
- {
757
- "$schema": "https://json-schema.org/draft/2020-12/schema",
758
- "type": "object",
759
- "properties": {
760
- "ok": {
761
- "default": true,
762
- "type": "boolean"
763
- }
764
- },
765
- "required": ["ok"],
766
- "additionalProperties": false
767
- }
768
- ```
769
-
770
- ## `mode.set`
771
-
772
- ### Request params
773
-
774
- | Field | Type | Required |
775
- | ------------ | -------- | -------- |
776
- | `type` | `string` | yes |
777
- | `session_id` | `string` | yes |
778
- | `mode` | `string` | yes |
779
-
780
- ```json
781
- {
782
- "$schema": "https://json-schema.org/draft/2020-12/schema",
783
- "type": "object",
784
- "properties": {
785
- "type": {
786
- "default": "mode.set",
787
- "type": "string",
788
- "const": "mode.set"
789
- },
790
- "session_id": {
791
- "type": "string"
792
- },
793
- "mode": {
794
- "type": "string",
795
- "enum": ["default", "acceptEdits", "plan", "bypassPermissions"]
796
- }
797
- },
798
- "required": ["type", "session_id", "mode"],
799
- "additionalProperties": false
800
- }
801
- ```
802
-
803
- ### Result
804
-
805
- | Field | Type | Required |
806
- | ------ | --------- | -------- |
807
- | `ok` | `boolean` | yes |
808
- | `mode` | `string` | yes |
809
-
810
- ```json
811
- {
812
- "$schema": "https://json-schema.org/draft/2020-12/schema",
813
- "type": "object",
814
- "properties": {
815
- "ok": {
816
- "default": true,
817
- "type": "boolean"
818
- },
819
- "mode": {
820
- "type": "string",
821
- "enum": ["default", "acceptEdits", "plan", "bypassPermissions"]
822
- }
823
- },
824
- "required": ["ok", "mode"],
825
- "additionalProperties": false
826
- }
827
- ```
828
-
829
- ## `command.run`
830
-
831
- ### Request params
832
-
833
- | Field | Type | Required |
834
- | ------------ | -------- | -------- |
835
- | `type` | `string` | yes |
836
- | `session_id` | `string` | yes |
837
- | `input` | `string` | yes |
838
-
839
- ```json
840
- {
841
- "$schema": "https://json-schema.org/draft/2020-12/schema",
842
- "type": "object",
843
- "properties": {
844
- "type": {
845
- "default": "command.run",
846
- "type": "string",
847
- "const": "command.run"
848
- },
849
- "session_id": {
850
- "type": "string"
851
- },
852
- "input": {
853
- "type": "string"
854
- }
855
- },
856
- "required": ["type", "session_id", "input"],
857
- "additionalProperties": false
858
- }
859
- ```
860
-
861
- ### Result
862
-
863
- | Field | Type | Required |
864
- | ---------- | --------- | -------- |
865
- | `accepted` | `boolean` | yes |
866
-
867
- ```json
868
- {
869
- "$schema": "https://json-schema.org/draft/2020-12/schema",
870
- "type": "object",
871
- "properties": {
872
- "accepted": {
873
- "default": true,
874
- "type": "boolean"
875
- }
876
- },
877
- "required": ["accepted"],
878
- "additionalProperties": false
879
- }
880
- ```
881
-
882
- ## `command.list`
883
-
884
- ### Request params
885
-
886
- | Field | Type | Required |
887
- | ------------ | -------- | -------- |
888
- | `type` | `string` | yes |
889
- | `session_id` | `string` | yes |
890
-
891
- ```json
892
- {
893
- "$schema": "https://json-schema.org/draft/2020-12/schema",
894
- "type": "object",
895
- "properties": {
896
- "type": {
897
- "default": "command.list",
898
- "type": "string",
899
- "const": "command.list"
900
- },
901
- "session_id": {
902
- "type": "string"
903
- }
904
- },
905
- "required": ["type", "session_id"],
906
- "additionalProperties": false
907
- }
908
- ```
909
-
910
- ### Result
911
-
912
- | Field | Type | Required |
913
- | ---------- | ------- | -------- |
914
- | `commands` | `array` | yes |
915
-
916
- ```json
917
- {
918
- "$schema": "https://json-schema.org/draft/2020-12/schema",
919
- "type": "object",
920
- "properties": {
921
- "commands": {
922
- "type": "array",
923
- "items": {
924
- "type": "object",
925
- "properties": {
926
- "name": {
927
- "type": "string"
928
- },
929
- "description": {
930
- "default": "",
931
- "type": "string"
932
- },
933
- "aliases": {
934
- "default": [],
935
- "type": "array",
936
- "items": {
937
- "type": "string"
938
- }
939
- }
940
- },
941
- "required": ["name", "description", "aliases"],
942
- "additionalProperties": false
943
- }
944
- }
945
- },
946
- "required": ["commands"],
947
- "additionalProperties": false
948
- }
949
- ```
950
-
951
- ## `rewind.list`
952
-
953
- ### Request params
954
-
955
- | Field | Type | Required |
956
- | ------------ | -------- | -------- |
957
- | `type` | `string` | yes |
958
- | `session_id` | `string` | yes |
959
-
960
- ```json
961
- {
962
- "$schema": "https://json-schema.org/draft/2020-12/schema",
963
- "type": "object",
964
- "properties": {
965
- "type": {
966
- "default": "rewind.list",
967
- "type": "string",
968
- "const": "rewind.list"
969
- },
970
- "session_id": {
971
- "type": "string"
972
- }
973
- },
974
- "required": ["type", "session_id"],
975
- "additionalProperties": false
976
- }
977
- ```
978
-
979
- ### Result
980
-
981
- | Field | Type | Required |
982
- | ----------- | ------- | -------- |
983
- | `snapshots` | `array` | yes |
984
-
985
- ```json
986
- {
987
- "$schema": "https://json-schema.org/draft/2020-12/schema",
988
- "type": "object",
989
- "properties": {
990
- "snapshots": {
991
- "type": "array",
992
- "items": {
993
- "type": "object",
994
- "properties": {
995
- "index": {
996
- "type": "integer",
997
- "minimum": -9007199254740991,
998
- "maximum": 9007199254740991
999
- },
1000
- "message_index": {
1001
- "type": "integer",
1002
- "minimum": -9007199254740991,
1003
- "maximum": 9007199254740991
1004
- },
1005
- "user_text": {
1006
- "type": "string"
1007
- },
1008
- "file_count": {
1009
- "type": "integer",
1010
- "minimum": -9007199254740991,
1011
- "maximum": 9007199254740991
1012
- },
1013
- "timestamp": {
1014
- "type": "string"
1015
- }
1016
- },
1017
- "required": ["index", "message_index", "user_text", "file_count", "timestamp"],
1018
- "additionalProperties": false
1019
- }
1020
- }
1021
- },
1022
- "required": ["snapshots"],
1023
- "additionalProperties": false
1024
- }
1025
- ```
1026
-
1027
- ## `rewind.apply`
1028
-
1029
- ### Request params
1030
-
1031
- | Field | Type | Required |
1032
- | ------------ | --------- | -------- |
1033
- | `type` | `string` | yes |
1034
- | `session_id` | `string` | yes |
1035
- | `index` | `integer` | yes |
1036
- | `mode` | `string` | yes |
1037
-
1038
- ```json
1039
- {
1040
- "$schema": "https://json-schema.org/draft/2020-12/schema",
1041
- "type": "object",
1042
- "properties": {
1043
- "type": {
1044
- "default": "rewind.apply",
1045
- "type": "string",
1046
- "const": "rewind.apply"
1047
- },
1048
- "session_id": {
1049
- "type": "string"
1050
- },
1051
- "index": {
1052
- "type": "integer",
1053
- "minimum": -9007199254740991,
1054
- "maximum": 9007199254740991
1055
- },
1056
- "mode": {
1057
- "default": "both",
1058
- "type": "string",
1059
- "enum": ["both", "files", "conversation"]
1060
- }
1061
- },
1062
- "required": ["type", "session_id", "index", "mode"],
1063
- "additionalProperties": false
1064
- }
1065
- ```
1066
-
1067
- ### Result
1068
-
1069
- | Field | Type | Required |
1070
- | --------- | --------- | -------- |
1071
- | `ok` | `boolean` | yes |
1072
- | `message` | `string` | yes |
1073
-
1074
- ```json
1075
- {
1076
- "$schema": "https://json-schema.org/draft/2020-12/schema",
1077
- "type": "object",
1078
- "properties": {
1079
- "ok": {
1080
- "default": true,
1081
- "type": "boolean"
1082
- },
1083
- "message": {
1084
- "default": "",
1085
- "type": "string"
1086
- }
1087
- },
1088
- "required": ["ok", "message"],
1089
- "additionalProperties": false
1090
- }
1091
- ```
1092
-
1093
- ## Server Push
1094
-
1095
- Events pushed from daemon to subscribed clients over the same TCP connection.
1096
-
1097
- ### EventPushEnvelope
1098
-
1099
- | Field | Type | Required |
1100
- | ------- | -------- | -------- |
1101
- | `kind` | `string` | yes |
1102
- | `event` | `object` | yes |
1103
-
1104
- ```json
1105
- {
1106
- "$schema": "https://json-schema.org/draft/2020-12/schema",
1107
- "type": "object",
1108
- "properties": {
1109
- "kind": {
1110
- "default": "event",
1111
- "type": "string",
1112
- "const": "event"
1113
- },
1114
- "event": {
1115
- "type": "object",
1116
- "propertyNames": {
1117
- "type": "string"
1118
- },
1119
- "additionalProperties": {}
1120
- }
1121
- },
1122
- "required": ["kind", "event"],
1123
- "additionalProperties": false
1124
- }
1125
- ```
1126
-
1127
- ## Events
1128
-
1129
- Events are written to the run's `events.jsonl` and forwarded over IPC to matching subscribers (topic globs via picomatch; scope `global`, `session:<id>`, or `run:<id>`).
1130
-
1131
- ### `core.started`
1132
-
1133
- | Field | Type | Required |
1134
- | ------------- | -------- | -------- |
1135
- | `type` | `string` | yes |
1136
- | `listen_addr` | `string` | yes |
1137
- | `version` | `string` | yes |
1138
- | `timestamp` | `string` | yes |
1139
-
1140
- ```json
1141
- {
1142
- "$schema": "https://json-schema.org/draft/2020-12/schema",
1143
- "type": "object",
1144
- "properties": {
1145
- "type": {
1146
- "default": "core.started",
1147
- "type": "string",
1148
- "const": "core.started"
1149
- },
1150
- "listen_addr": {
1151
- "type": "string"
1152
- },
1153
- "version": {
1154
- "type": "string"
1155
- },
1156
- "timestamp": {
1157
- "type": "string"
1158
- }
1159
- },
1160
- "required": ["type", "listen_addr", "version", "timestamp"],
1161
- "additionalProperties": false
1162
- }
1163
- ```
1164
-
1165
- ### `log.line`
1166
-
1167
- | Field | Type | Required |
1168
- | ------------ | -------- | -------- |
1169
- | `type` | `string` | yes |
1170
- | `session_id` | `string` | yes |
1171
- | `run_id` | `string` | yes |
1172
- | `level` | `string` | yes |
1173
- | `source` | `string` | yes |
1174
- | `message` | `string` | yes |
1175
- | `timestamp` | `string` | yes |
1176
-
1177
- ```json
1178
- {
1179
- "$schema": "https://json-schema.org/draft/2020-12/schema",
1180
- "type": "object",
1181
- "properties": {
1182
- "type": {
1183
- "default": "log.line",
1184
- "type": "string",
1185
- "const": "log.line"
1186
- },
1187
- "session_id": {
1188
- "default": "",
1189
- "type": "string"
1190
- },
1191
- "run_id": {
1192
- "default": "",
1193
- "type": "string"
1194
- },
1195
- "level": {
1196
- "type": "string"
1197
- },
1198
- "source": {
1199
- "type": "string"
1200
- },
1201
- "message": {
1202
- "type": "string"
1203
- },
1204
- "timestamp": {
1205
- "type": "string"
1206
- }
1207
- },
1208
- "required": ["type", "session_id", "run_id", "level", "source", "message", "timestamp"],
1209
- "additionalProperties": false
1210
- }
1211
- ```
1212
-
1213
- ### `session.created`
1214
-
1215
- | Field | Type | Required |
1216
- | ------------ | -------- | -------- |
1217
- | `type` | `string` | yes |
1218
- | `session_id` | `string` | yes |
1219
- | `cwd` | `string` | yes |
1220
- | `timestamp` | `string` | yes |
1221
-
1222
- ```json
1223
- {
1224
- "$schema": "https://json-schema.org/draft/2020-12/schema",
1225
- "type": "object",
1226
- "properties": {
1227
- "type": {
1228
- "default": "session.created",
1229
- "type": "string",
1230
- "const": "session.created"
1231
- },
1232
- "session_id": {
1233
- "type": "string"
1234
- },
1235
- "cwd": {
1236
- "type": "string"
1237
- },
1238
- "timestamp": {
1239
- "type": "string"
1240
- }
1241
- },
1242
- "required": ["type", "session_id", "cwd", "timestamp"],
1243
- "additionalProperties": false
1244
- }
1245
- ```
1246
-
1247
- ### `session.closed`
1248
-
1249
- | Field | Type | Required |
1250
- | ------------ | -------- | -------- |
1251
- | `type` | `string` | yes |
1252
- | `session_id` | `string` | yes |
1253
- | `timestamp` | `string` | yes |
1254
-
1255
- ```json
1256
- {
1257
- "$schema": "https://json-schema.org/draft/2020-12/schema",
1258
- "type": "object",
1259
- "properties": {
1260
- "type": {
1261
- "default": "session.closed",
1262
- "type": "string",
1263
- "const": "session.closed"
1264
- },
1265
- "session_id": {
1266
- "type": "string"
1267
- },
1268
- "timestamp": {
1269
- "type": "string"
1270
- }
1271
- },
1272
- "required": ["type", "session_id", "timestamp"],
1273
- "additionalProperties": false
1274
- }
1275
- ```
1276
-
1277
- ### `run.started`
1278
-
1279
- | Field | Type | Required |
1280
- | ------------ | -------- | -------- |
1281
- | `type` | `string` | yes |
1282
- | `session_id` | `string` | yes |
1283
- | `run_id` | `string` | yes |
1284
- | `content` | `string` | yes |
1285
- | `origin` | `string` | yes |
1286
- | `timestamp` | `string` | yes |
1287
-
1288
- ```json
1289
- {
1290
- "$schema": "https://json-schema.org/draft/2020-12/schema",
1291
- "type": "object",
1292
- "properties": {
1293
- "type": {
1294
- "default": "run.started",
1295
- "type": "string",
1296
- "const": "run.started"
1297
- },
1298
- "session_id": {
1299
- "type": "string"
1300
- },
1301
- "run_id": {
1302
- "type": "string"
1303
- },
1304
- "content": {
1305
- "type": "string"
1306
- },
1307
- "origin": {
1308
- "default": "client",
1309
- "type": "string",
1310
- "enum": ["client", "daemon"]
1311
- },
1312
- "timestamp": {
1313
- "type": "string"
1314
- }
1315
- },
1316
- "required": ["type", "session_id", "run_id", "content", "origin", "timestamp"],
1317
- "additionalProperties": false
1318
- }
1319
- ```
1320
-
1321
- ### `agent.stream_text`
1322
-
1323
- | Field | Type | Required |
1324
- | ------------ | -------- | -------- |
1325
- | `type` | `string` | yes |
1326
- | `session_id` | `string` | yes |
1327
- | `run_id` | `string` | yes |
1328
- | `text` | `string` | yes |
1329
- | `timestamp` | `string` | yes |
1330
-
1331
- ```json
1332
- {
1333
- "$schema": "https://json-schema.org/draft/2020-12/schema",
1334
- "type": "object",
1335
- "properties": {
1336
- "type": {
1337
- "default": "agent.stream_text",
1338
- "type": "string",
1339
- "const": "agent.stream_text"
1340
- },
1341
- "session_id": {
1342
- "type": "string"
1343
- },
1344
- "run_id": {
1345
- "type": "string"
1346
- },
1347
- "text": {
1348
- "type": "string"
1349
- },
1350
- "timestamp": {
1351
- "type": "string"
1352
- }
1353
- },
1354
- "required": ["type", "session_id", "run_id", "text", "timestamp"],
1355
- "additionalProperties": false
1356
- }
1357
- ```
1358
-
1359
- ### `agent.thinking_text`
1360
-
1361
- | Field | Type | Required |
1362
- | ------------ | -------- | -------- |
1363
- | `type` | `string` | yes |
1364
- | `session_id` | `string` | yes |
1365
- | `run_id` | `string` | yes |
1366
- | `text` | `string` | yes |
1367
- | `timestamp` | `string` | yes |
1368
-
1369
- ```json
1370
- {
1371
- "$schema": "https://json-schema.org/draft/2020-12/schema",
1372
- "type": "object",
1373
- "properties": {
1374
- "type": {
1375
- "default": "agent.thinking_text",
1376
- "type": "string",
1377
- "const": "agent.thinking_text"
1378
- },
1379
- "session_id": {
1380
- "type": "string"
1381
- },
1382
- "run_id": {
1383
- "type": "string"
1384
- },
1385
- "text": {
1386
- "type": "string"
1387
- },
1388
- "timestamp": {
1389
- "type": "string"
1390
- }
1391
- },
1392
- "required": ["type", "session_id", "run_id", "text", "timestamp"],
1393
- "additionalProperties": false
1394
- }
1395
- ```
1396
-
1397
- ### `agent.thinking_complete`
1398
-
1399
- | Field | Type | Required |
1400
- | ------------ | -------- | -------- |
1401
- | `type` | `string` | yes |
1402
- | `session_id` | `string` | yes |
1403
- | `run_id` | `string` | yes |
1404
- | `thinking` | `string` | yes |
1405
- | `timestamp` | `string` | yes |
1406
-
1407
- ```json
1408
- {
1409
- "$schema": "https://json-schema.org/draft/2020-12/schema",
1410
- "type": "object",
1411
- "properties": {
1412
- "type": {
1413
- "default": "agent.thinking_complete",
1414
- "type": "string",
1415
- "const": "agent.thinking_complete"
1416
- },
1417
- "session_id": {
1418
- "type": "string"
1419
- },
1420
- "run_id": {
1421
- "type": "string"
1422
- },
1423
- "thinking": {
1424
- "type": "string"
1425
- },
1426
- "timestamp": {
1427
- "type": "string"
1428
- }
1429
- },
1430
- "required": ["type", "session_id", "run_id", "thinking", "timestamp"],
1431
- "additionalProperties": false
1432
- }
1433
- ```
1434
-
1435
- ### `agent.tool_use`
1436
-
1437
- | Field | Type | Required |
1438
- | ------------ | -------- | -------- |
1439
- | `type` | `string` | yes |
1440
- | `session_id` | `string` | yes |
1441
- | `run_id` | `string` | yes |
1442
- | `tool_id` | `string` | yes |
1443
- | `tool_name` | `string` | yes |
1444
- | `args` | `object` | yes |
1445
- | `timestamp` | `string` | yes |
1446
-
1447
- ```json
1448
- {
1449
- "$schema": "https://json-schema.org/draft/2020-12/schema",
1450
- "type": "object",
1451
- "properties": {
1452
- "type": {
1453
- "default": "agent.tool_use",
1454
- "type": "string",
1455
- "const": "agent.tool_use"
1456
- },
1457
- "session_id": {
1458
- "type": "string"
1459
- },
1460
- "run_id": {
1461
- "type": "string"
1462
- },
1463
- "tool_id": {
1464
- "type": "string"
1465
- },
1466
- "tool_name": {
1467
- "type": "string"
1468
- },
1469
- "args": {
1470
- "type": "object",
1471
- "propertyNames": {
1472
- "type": "string"
1473
- },
1474
- "additionalProperties": {}
1475
- },
1476
- "timestamp": {
1477
- "type": "string"
1478
- }
1479
- },
1480
- "required": ["type", "session_id", "run_id", "tool_id", "tool_name", "args", "timestamp"],
1481
- "additionalProperties": false
1482
- }
1483
- ```
1484
-
1485
- ### `agent.tool_result`
1486
-
1487
- | Field | Type | Required |
1488
- | ------------ | --------- | -------- |
1489
- | `type` | `string` | yes |
1490
- | `session_id` | `string` | yes |
1491
- | `run_id` | `string` | yes |
1492
- | `tool_id` | `string` | yes |
1493
- | `tool_name` | `string` | yes |
1494
- | `output` | `string` | yes |
1495
- | `is_error` | `boolean` | yes |
1496
- | `elapsed_ms` | `integer` | yes |
1497
- | `timestamp` | `string` | yes |
1498
-
1499
- ```json
1500
- {
1501
- "$schema": "https://json-schema.org/draft/2020-12/schema",
1502
- "type": "object",
1503
- "properties": {
1504
- "type": {
1505
- "default": "agent.tool_result",
1506
- "type": "string",
1507
- "const": "agent.tool_result"
1508
- },
1509
- "session_id": {
1510
- "type": "string"
1511
- },
1512
- "run_id": {
1513
- "type": "string"
1514
- },
1515
- "tool_id": {
1516
- "type": "string"
1517
- },
1518
- "tool_name": {
1519
- "type": "string"
1520
- },
1521
- "output": {
1522
- "type": "string"
1523
- },
1524
- "is_error": {
1525
- "default": false,
1526
- "type": "boolean"
1527
- },
1528
- "elapsed_ms": {
1529
- "type": "integer",
1530
- "minimum": -9007199254740991,
1531
- "maximum": 9007199254740991
1532
- },
1533
- "timestamp": {
1534
- "type": "string"
1535
- }
1536
- },
1537
- "required": [
1538
- "type",
1539
- "session_id",
1540
- "run_id",
1541
- "tool_id",
1542
- "tool_name",
1543
- "output",
1544
- "is_error",
1545
- "elapsed_ms",
1546
- "timestamp"
1547
- ],
1548
- "additionalProperties": false
1549
- }
1550
- ```
1551
-
1552
- ### `agent.turn_complete`
1553
-
1554
- | Field | Type | Required |
1555
- | ------------ | --------- | -------- |
1556
- | `type` | `string` | yes |
1557
- | `session_id` | `string` | yes |
1558
- | `run_id` | `string` | yes |
1559
- | `turn` | `integer` | yes |
1560
- | `timestamp` | `string` | yes |
1561
-
1562
- ```json
1563
- {
1564
- "$schema": "https://json-schema.org/draft/2020-12/schema",
1565
- "type": "object",
1566
- "properties": {
1567
- "type": {
1568
- "default": "agent.turn_complete",
1569
- "type": "string",
1570
- "const": "agent.turn_complete"
1571
- },
1572
- "session_id": {
1573
- "type": "string"
1574
- },
1575
- "run_id": {
1576
- "type": "string"
1577
- },
1578
- "turn": {
1579
- "type": "integer",
1580
- "minimum": -9007199254740991,
1581
- "maximum": 9007199254740991
1582
- },
1583
- "timestamp": {
1584
- "type": "string"
1585
- }
1586
- },
1587
- "required": ["type", "session_id", "run_id", "turn", "timestamp"],
1588
- "additionalProperties": false
1589
- }
1590
- ```
1591
-
1592
- ### `agent.loop_complete`
1593
-
1594
- | Field | Type | Required |
1595
- | ------------- | --------- | -------- |
1596
- | `type` | `string` | yes |
1597
- | `session_id` | `string` | yes |
1598
- | `run_id` | `string` | yes |
1599
- | `stop_reason` | `string` | yes |
1600
- | `total_turns` | `integer` | yes |
1601
- | `elapsed_ms` | `integer` | yes |
1602
- | `timestamp` | `string` | yes |
1603
-
1604
- ```json
1605
- {
1606
- "$schema": "https://json-schema.org/draft/2020-12/schema",
1607
- "type": "object",
1608
- "properties": {
1609
- "type": {
1610
- "default": "agent.loop_complete",
1611
- "type": "string",
1612
- "const": "agent.loop_complete"
1613
- },
1614
- "session_id": {
1615
- "type": "string"
1616
- },
1617
- "run_id": {
1618
- "type": "string"
1619
- },
1620
- "stop_reason": {
1621
- "type": "string"
1622
- },
1623
- "total_turns": {
1624
- "type": "integer",
1625
- "minimum": -9007199254740991,
1626
- "maximum": 9007199254740991
1627
- },
1628
- "elapsed_ms": {
1629
- "type": "integer",
1630
- "minimum": -9007199254740991,
1631
- "maximum": 9007199254740991
1632
- },
1633
- "timestamp": {
1634
- "type": "string"
1635
- }
1636
- },
1637
- "required": [
1638
- "type",
1639
- "session_id",
1640
- "run_id",
1641
- "stop_reason",
1642
- "total_turns",
1643
- "elapsed_ms",
1644
- "timestamp"
1645
- ],
1646
- "additionalProperties": false
1647
- }
1648
- ```
1649
-
1650
- ### `agent.usage`
1651
-
1652
- | Field | Type | Required |
1653
- | ----------------------------- | --------- | -------- |
1654
- | `type` | `string` | yes |
1655
- | `session_id` | `string` | yes |
1656
- | `run_id` | `string` | yes |
1657
- | `input_tokens` | `integer` | yes |
1658
- | `output_tokens` | `integer` | yes |
1659
- | `cache_read_input_tokens` | `integer` | yes |
1660
- | `cache_creation_input_tokens` | `integer` | yes |
1661
- | `timestamp` | `string` | yes |
1662
-
1663
- ```json
1664
- {
1665
- "$schema": "https://json-schema.org/draft/2020-12/schema",
1666
- "type": "object",
1667
- "properties": {
1668
- "type": {
1669
- "default": "agent.usage",
1670
- "type": "string",
1671
- "const": "agent.usage"
1672
- },
1673
- "session_id": {
1674
- "type": "string"
1675
- },
1676
- "run_id": {
1677
- "type": "string"
1678
- },
1679
- "input_tokens": {
1680
- "type": "integer",
1681
- "minimum": -9007199254740991,
1682
- "maximum": 9007199254740991
1683
- },
1684
- "output_tokens": {
1685
- "type": "integer",
1686
- "minimum": -9007199254740991,
1687
- "maximum": 9007199254740991
1688
- },
1689
- "cache_read_input_tokens": {
1690
- "default": 0,
1691
- "type": "integer",
1692
- "minimum": -9007199254740991,
1693
- "maximum": 9007199254740991
1694
- },
1695
- "cache_creation_input_tokens": {
1696
- "default": 0,
1697
- "type": "integer",
1698
- "minimum": -9007199254740991,
1699
- "maximum": 9007199254740991
1700
- },
1701
- "timestamp": {
1702
- "type": "string"
1703
- }
1704
- },
1705
- "required": [
1706
- "type",
1707
- "session_id",
1708
- "run_id",
1709
- "input_tokens",
1710
- "output_tokens",
1711
- "cache_read_input_tokens",
1712
- "cache_creation_input_tokens",
1713
- "timestamp"
1714
- ],
1715
- "additionalProperties": false
1716
- }
1717
- ```
1718
-
1719
- ### `agent.retry`
1720
-
1721
- | Field | Type | Required |
1722
- | ------------ | --------- | -------- |
1723
- | `type` | `string` | yes |
1724
- | `session_id` | `string` | yes |
1725
- | `run_id` | `string` | yes |
1726
- | `reason` | `string` | yes |
1727
- | `delay_ms` | `integer` | yes |
1728
- | `timestamp` | `string` | yes |
1729
-
1730
- ```json
1731
- {
1732
- "$schema": "https://json-schema.org/draft/2020-12/schema",
1733
- "type": "object",
1734
- "properties": {
1735
- "type": {
1736
- "default": "agent.retry",
1737
- "type": "string",
1738
- "const": "agent.retry"
1739
- },
1740
- "session_id": {
1741
- "type": "string"
1742
- },
1743
- "run_id": {
1744
- "type": "string"
1745
- },
1746
- "reason": {
1747
- "type": "string"
1748
- },
1749
- "delay_ms": {
1750
- "type": "integer",
1751
- "minimum": -9007199254740991,
1752
- "maximum": 9007199254740991
1753
- },
1754
- "timestamp": {
1755
- "type": "string"
1756
- }
1757
- },
1758
- "required": ["type", "session_id", "run_id", "reason", "delay_ms", "timestamp"],
1759
- "additionalProperties": false
1760
- }
1761
- ```
1762
-
1763
- ### `agent.compact`
1764
-
1765
- | Field | Type | Required |
1766
- | ------------ | -------- | -------- |
1767
- | `type` | `string` | yes |
1768
- | `session_id` | `string` | yes |
1769
- | `run_id` | `string` | yes |
1770
- | `message` | `string` | yes |
1771
- | `timestamp` | `string` | yes |
1772
-
1773
- ```json
1774
- {
1775
- "$schema": "https://json-schema.org/draft/2020-12/schema",
1776
- "type": "object",
1777
- "properties": {
1778
- "type": {
1779
- "default": "agent.compact",
1780
- "type": "string",
1781
- "const": "agent.compact"
1782
- },
1783
- "session_id": {
1784
- "type": "string"
1785
- },
1786
- "run_id": {
1787
- "type": "string"
1788
- },
1789
- "message": {
1790
- "type": "string"
1791
- },
1792
- "timestamp": {
1793
- "type": "string"
1794
- }
1795
- },
1796
- "required": ["type", "session_id", "run_id", "message", "timestamp"],
1797
- "additionalProperties": false
1798
- }
1799
- ```
1800
-
1801
- ### `agent.error`
1802
-
1803
- | Field | Type | Required |
1804
- | ------------ | -------- | -------- |
1805
- | `type` | `string` | yes |
1806
- | `session_id` | `string` | yes |
1807
- | `run_id` | `string` | yes |
1808
- | `message` | `string` | yes |
1809
- | `timestamp` | `string` | yes |
1810
-
1811
- ```json
1812
- {
1813
- "$schema": "https://json-schema.org/draft/2020-12/schema",
1814
- "type": "object",
1815
- "properties": {
1816
- "type": {
1817
- "default": "agent.error",
1818
- "type": "string",
1819
- "const": "agent.error"
1820
- },
1821
- "session_id": {
1822
- "type": "string"
1823
- },
1824
- "run_id": {
1825
- "type": "string"
1826
- },
1827
- "message": {
1828
- "type": "string"
1829
- },
1830
- "timestamp": {
1831
- "type": "string"
1832
- }
1833
- },
1834
- "required": ["type", "session_id", "run_id", "message", "timestamp"],
1835
- "additionalProperties": false
1836
- }
1837
- ```
1838
-
1839
- ### `permission.requested`
1840
-
1841
- | Field | Type | Required |
1842
- | ------------ | -------- | -------- |
1843
- | `type` | `string` | yes |
1844
- | `id` | `string` | yes |
1845
- | `session_id` | `string` | yes |
1846
- | `run_id` | `string` | yes |
1847
- | `tool_name` | `string` | yes |
1848
- | `args` | `object` | yes |
1849
- | `reason` | `string` | yes |
1850
- | `timestamp` | `string` | yes |
1851
-
1852
- ```json
1853
- {
1854
- "$schema": "https://json-schema.org/draft/2020-12/schema",
1855
- "type": "object",
1856
- "properties": {
1857
- "type": {
1858
- "default": "permission.requested",
1859
- "type": "string",
1860
- "const": "permission.requested"
1861
- },
1862
- "id": {
1863
- "type": "string"
1864
- },
1865
- "session_id": {
1866
- "type": "string"
1867
- },
1868
- "run_id": {
1869
- "default": "",
1870
- "type": "string"
1871
- },
1872
- "tool_name": {
1873
- "type": "string"
1874
- },
1875
- "args": {
1876
- "type": "object",
1877
- "propertyNames": {
1878
- "type": "string"
1879
- },
1880
- "additionalProperties": {}
1881
- },
1882
- "reason": {
1883
- "default": "",
1884
- "type": "string"
1885
- },
1886
- "timestamp": {
1887
- "type": "string"
1888
- }
1889
- },
1890
- "required": ["type", "id", "session_id", "run_id", "tool_name", "args", "reason", "timestamp"],
1891
- "additionalProperties": false
1892
- }
1893
- ```
1894
-
1895
- ### `permission.resolved`
1896
-
1897
- | Field | Type | Required |
1898
- | ------------ | -------- | -------- |
1899
- | `type` | `string` | yes |
1900
- | `id` | `string` | yes |
1901
- | `session_id` | `string` | yes |
1902
- | `run_id` | `string` | yes |
1903
- | `response` | `string` | yes |
1904
- | `source` | `string` | yes |
1905
- | `timestamp` | `string` | yes |
1906
-
1907
- ```json
1908
- {
1909
- "$schema": "https://json-schema.org/draft/2020-12/schema",
1910
- "type": "object",
1911
- "properties": {
1912
- "type": {
1913
- "default": "permission.resolved",
1914
- "type": "string",
1915
- "const": "permission.resolved"
1916
- },
1917
- "id": {
1918
- "type": "string"
1919
- },
1920
- "session_id": {
1921
- "type": "string"
1922
- },
1923
- "run_id": {
1924
- "default": "",
1925
- "type": "string"
1926
- },
1927
- "response": {
1928
- "type": "string"
1929
- },
1930
- "source": {
1931
- "default": "client",
1932
- "type": "string",
1933
- "enum": ["client", "timeout", "disconnect", "abort", "session_closed"]
1934
- },
1935
- "timestamp": {
1936
- "type": "string"
1937
- }
1938
- },
1939
- "required": ["type", "id", "session_id", "run_id", "response", "source", "timestamp"],
1940
- "additionalProperties": false
1941
- }
1942
- ```
1943
-
1944
- ### `ask_user.requested`
1945
-
1946
- | Field | Type | Required |
1947
- | ------------ | -------- | -------- |
1948
- | `type` | `string` | yes |
1949
- | `id` | `string` | yes |
1950
- | `session_id` | `string` | yes |
1951
- | `run_id` | `string` | yes |
1952
- | `questions` | `array` | yes |
1953
- | `timestamp` | `string` | yes |
1954
-
1955
- ```json
1956
- {
1957
- "$schema": "https://json-schema.org/draft/2020-12/schema",
1958
- "type": "object",
1959
- "properties": {
1960
- "type": {
1961
- "default": "ask_user.requested",
1962
- "type": "string",
1963
- "const": "ask_user.requested"
1964
- },
1965
- "id": {
1966
- "type": "string"
1967
- },
1968
- "session_id": {
1969
- "type": "string"
1970
- },
1971
- "run_id": {
1972
- "default": "",
1973
- "type": "string"
1974
- },
1975
- "questions": {
1976
- "type": "array",
1977
- "items": {
1978
- "type": "object",
1979
- "properties": {
1980
- "question": {
1981
- "type": "string"
1982
- },
1983
- "header": {
1984
- "type": "string"
1985
- },
1986
- "options": {
1987
- "type": "array",
1988
- "items": {
1989
- "type": "object",
1990
- "properties": {
1991
- "label": {
1992
- "type": "string"
1993
- },
1994
- "description": {
1995
- "type": "string"
1996
- }
1997
- },
1998
- "required": ["label"],
1999
- "additionalProperties": false
2000
- }
2001
- },
2002
- "multiSelect": {
2003
- "default": false,
2004
- "type": "boolean"
2005
- }
2006
- },
2007
- "required": ["question", "header", "options", "multiSelect"],
2008
- "additionalProperties": false
2009
- }
2010
- },
2011
- "timestamp": {
2012
- "type": "string"
2013
- }
2014
- },
2015
- "required": ["type", "id", "session_id", "run_id", "questions", "timestamp"],
2016
- "additionalProperties": false
2017
- }
2018
- ```
2019
-
2020
- ### `ask_user.resolved`
2021
-
2022
- | Field | Type | Required |
2023
- | ------------ | -------- | -------- |
2024
- | `type` | `string` | yes |
2025
- | `id` | `string` | yes |
2026
- | `session_id` | `string` | yes |
2027
- | `run_id` | `string` | yes |
2028
- | `timestamp` | `string` | yes |
2029
-
2030
- ```json
2031
- {
2032
- "$schema": "https://json-schema.org/draft/2020-12/schema",
2033
- "type": "object",
2034
- "properties": {
2035
- "type": {
2036
- "default": "ask_user.resolved",
2037
- "type": "string",
2038
- "const": "ask_user.resolved"
2039
- },
2040
- "id": {
2041
- "type": "string"
2042
- },
2043
- "session_id": {
2044
- "type": "string"
2045
- },
2046
- "run_id": {
2047
- "default": "",
2048
- "type": "string"
2049
- },
2050
- "timestamp": {
2051
- "type": "string"
2052
- }
2053
- },
2054
- "required": ["type", "id", "session_id", "run_id", "timestamp"],
2055
- "additionalProperties": false
2056
- }
2057
- ```
2058
-
2059
- ### `plan.requested`
2060
-
2061
- | Field | Type | Required |
2062
- | ------------ | -------- | -------- |
2063
- | `type` | `string` | yes |
2064
- | `id` | `string` | yes |
2065
- | `session_id` | `string` | yes |
2066
- | `run_id` | `string` | yes |
2067
- | `plan_text` | `string` | yes |
2068
- | `timestamp` | `string` | yes |
2069
-
2070
- ```json
2071
- {
2072
- "$schema": "https://json-schema.org/draft/2020-12/schema",
2073
- "type": "object",
2074
- "properties": {
2075
- "type": {
2076
- "default": "plan.requested",
2077
- "type": "string",
2078
- "const": "plan.requested"
2079
- },
2080
- "id": {
2081
- "type": "string"
2082
- },
2083
- "session_id": {
2084
- "type": "string"
2085
- },
2086
- "run_id": {
2087
- "default": "",
2088
- "type": "string"
2089
- },
2090
- "plan_text": {
2091
- "default": "",
2092
- "type": "string"
2093
- },
2094
- "timestamp": {
2095
- "type": "string"
2096
- }
2097
- },
2098
- "required": ["type", "id", "session_id", "run_id", "plan_text", "timestamp"],
2099
- "additionalProperties": false
2100
- }
2101
- ```
2102
-
2103
- ### `plan.resolved`
2104
-
2105
- | Field | Type | Required |
2106
- | ------------ | -------- | -------- |
2107
- | `type` | `string` | yes |
2108
- | `id` | `string` | yes |
2109
- | `session_id` | `string` | yes |
2110
- | `run_id` | `string` | yes |
2111
- | `choice` | `string` | yes |
2112
- | `timestamp` | `string` | yes |
2113
-
2114
- ```json
2115
- {
2116
- "$schema": "https://json-schema.org/draft/2020-12/schema",
2117
- "type": "object",
2118
- "properties": {
2119
- "type": {
2120
- "default": "plan.resolved",
2121
- "type": "string",
2122
- "const": "plan.resolved"
2123
- },
2124
- "id": {
2125
- "type": "string"
2126
- },
2127
- "session_id": {
2128
- "type": "string"
2129
- },
2130
- "run_id": {
2131
- "default": "",
2132
- "type": "string"
2133
- },
2134
- "choice": {
2135
- "type": "string"
2136
- },
2137
- "timestamp": {
2138
- "type": "string"
2139
- }
2140
- },
2141
- "required": ["type", "id", "session_id", "run_id", "choice", "timestamp"],
2142
- "additionalProperties": false
2143
- }
2144
- ```
2145
-
2146
- ### `mode.changed`
2147
-
2148
- | Field | Type | Required |
2149
- | ------------ | -------- | -------- |
2150
- | `type` | `string` | yes |
2151
- | `session_id` | `string` | yes |
2152
- | `mode` | `string` | yes |
2153
- | `timestamp` | `string` | yes |
2154
-
2155
- ```json
2156
- {
2157
- "$schema": "https://json-schema.org/draft/2020-12/schema",
2158
- "type": "object",
2159
- "properties": {
2160
- "type": {
2161
- "default": "mode.changed",
2162
- "type": "string",
2163
- "const": "mode.changed"
2164
- },
2165
- "session_id": {
2166
- "type": "string"
2167
- },
2168
- "mode": {
2169
- "type": "string"
2170
- },
2171
- "timestamp": {
2172
- "type": "string"
2173
- }
2174
- },
2175
- "required": ["type", "session_id", "mode", "timestamp"],
2176
- "additionalProperties": false
2177
- }
2178
- ```
2179
-
2180
- ### `todo.updated`
2181
-
2182
- | Field | Type | Required |
2183
- | ------------ | -------- | -------- |
2184
- | `type` | `string` | yes |
2185
- | `session_id` | `string` | yes |
2186
- | `todos` | `array` | yes |
2187
- | `timestamp` | `string` | yes |
2188
-
2189
- ```json
2190
- {
2191
- "$schema": "https://json-schema.org/draft/2020-12/schema",
2192
- "type": "object",
2193
- "properties": {
2194
- "type": {
2195
- "default": "todo.updated",
2196
- "type": "string",
2197
- "const": "todo.updated"
2198
- },
2199
- "session_id": {
2200
- "type": "string"
2201
- },
2202
- "todos": {
2203
- "type": "array",
2204
- "items": {
2205
- "type": "object",
2206
- "propertyNames": {
2207
- "type": "string"
2208
- },
2209
- "additionalProperties": {}
2210
- }
2211
- },
2212
- "timestamp": {
2213
- "type": "string"
2214
- }
2215
- },
2216
- "required": ["type", "session_id", "todos", "timestamp"],
2217
- "additionalProperties": false
2218
- }
2219
- ```
2220
-
2221
- ### `teammate.state`
2222
-
2223
- | Field | Type | Required |
2224
- | ------------ | -------- | -------- |
2225
- | `type` | `string` | yes |
2226
- | `session_id` | `string` | yes |
2227
- | `states` | `array` | yes |
2228
- | `timestamp` | `string` | yes |
2229
-
2230
- ```json
2231
- {
2232
- "$schema": "https://json-schema.org/draft/2020-12/schema",
2233
- "type": "object",
2234
- "properties": {
2235
- "type": {
2236
- "default": "teammate.state",
2237
- "type": "string",
2238
- "const": "teammate.state"
2239
- },
2240
- "session_id": {
2241
- "type": "string"
2242
- },
2243
- "states": {
2244
- "type": "array",
2245
- "items": {
2246
- "type": "object",
2247
- "propertyNames": {
2248
- "type": "string"
2249
- },
2250
- "additionalProperties": {}
2251
- }
2252
- },
2253
- "timestamp": {
2254
- "type": "string"
2255
- }
2256
- },
2257
- "required": ["type", "session_id", "states", "timestamp"],
2258
- "additionalProperties": false
2259
- }
2260
- ```
2261
-
2262
- ### `subagent.progress`
2263
-
2264
- | Field | Type | Required |
2265
- | ------------- | -------- | -------- |
2266
- | `type` | `string` | yes |
2267
- | `session_id` | `string` | yes |
2268
- | `task_id` | `string` | yes |
2269
- | `description` | `string` | yes |
2270
- | `status` | `string` | yes |
2271
- | `detail` | `string` | yes |
2272
- | `timestamp` | `string` | yes |
2273
-
2274
- ```json
2275
- {
2276
- "$schema": "https://json-schema.org/draft/2020-12/schema",
2277
- "type": "object",
2278
- "properties": {
2279
- "type": {
2280
- "default": "subagent.progress",
2281
- "type": "string",
2282
- "const": "subagent.progress"
2283
- },
2284
- "session_id": {
2285
- "type": "string"
2286
- },
2287
- "task_id": {
2288
- "type": "string"
2289
- },
2290
- "description": {
2291
- "type": "string"
2292
- },
2293
- "status": {
2294
- "type": "string"
2295
- },
2296
- "detail": {
2297
- "default": "",
2298
- "type": "string"
2299
- },
2300
- "timestamp": {
2301
- "type": "string"
2302
- }
2303
- },
2304
- "required": ["type", "session_id", "task_id", "description", "status", "detail", "timestamp"],
2305
- "additionalProperties": false
2306
- }
2307
- ```
2308
-
2309
- ### `system.message`
2310
-
2311
- | Field | Type | Required |
2312
- | ------------ | -------- | -------- |
2313
- | `type` | `string` | yes |
2314
- | `session_id` | `string` | yes |
2315
- | `message` | `string` | yes |
2316
- | `timestamp` | `string` | yes |
2317
-
2318
- ```json
2319
- {
2320
- "$schema": "https://json-schema.org/draft/2020-12/schema",
2321
- "type": "object",
2322
- "properties": {
2323
- "type": {
2324
- "default": "system.message",
2325
- "type": "string",
2326
- "const": "system.message"
2327
- },
2328
- "session_id": {
2329
- "type": "string"
2330
- },
2331
- "message": {
2332
- "type": "string"
2333
- },
2334
- "timestamp": {
2335
- "type": "string"
2336
- }
2337
- },
2338
- "required": ["type", "session_id", "message", "timestamp"],
2339
- "additionalProperties": false
2340
- }
2341
- ```
2342
-
2343
- ### `command.done`
2344
-
2345
- | Field | Type | Required |
2346
- | ------------ | -------- | -------- |
2347
- | `type` | `string` | yes |
2348
- | `session_id` | `string` | yes |
2349
- | `timestamp` | `string` | yes |
2350
-
2351
- ```json
2352
- {
2353
- "$schema": "https://json-schema.org/draft/2020-12/schema",
2354
- "type": "object",
2355
- "properties": {
2356
- "type": {
2357
- "default": "command.done",
2358
- "type": "string",
2359
- "const": "command.done"
2360
- },
2361
- "session_id": {
2362
- "type": "string"
2363
- },
2364
- "timestamp": {
2365
- "type": "string"
2366
- }
2367
- },
2368
- "required": ["type", "session_id", "timestamp"],
2369
- "additionalProperties": false
2370
- }
2371
- ```
2372
-
2373
- ### `ui.clear`
2374
-
2375
- | Field | Type | Required |
2376
- | ------------ | -------- | -------- |
2377
- | `type` | `string` | yes |
2378
- | `session_id` | `string` | yes |
2379
- | `timestamp` | `string` | yes |
2380
-
2381
- ```json
2382
- {
2383
- "$schema": "https://json-schema.org/draft/2020-12/schema",
2384
- "type": "object",
2385
- "properties": {
2386
- "type": {
2387
- "default": "ui.clear",
2388
- "type": "string",
2389
- "const": "ui.clear"
2390
- },
2391
- "session_id": {
2392
- "type": "string"
2393
- },
2394
- "timestamp": {
2395
- "type": "string"
2396
- }
2397
- },
2398
- "required": ["type", "session_id", "timestamp"],
2399
- "additionalProperties": false
2400
- }
2401
- ```
2402
-
2403
- ### `replay.message`
2404
-
2405
- | Field | Type | Required |
2406
- | ------------ | -------- | -------- |
2407
- | `type` | `string` | yes |
2408
- | `session_id` | `string` | yes |
2409
- | `role` | `string` | yes |
2410
- | `content` | `string` | yes |
2411
- | `timestamp` | `string` | yes |
2412
-
2413
- ```json
2414
- {
2415
- "$schema": "https://json-schema.org/draft/2020-12/schema",
2416
- "type": "object",
2417
- "properties": {
2418
- "type": {
2419
- "default": "replay.message",
2420
- "type": "string",
2421
- "const": "replay.message"
2422
- },
2423
- "session_id": {
2424
- "type": "string"
2425
- },
2426
- "role": {
2427
- "type": "string"
2428
- },
2429
- "content": {
2430
- "type": "string"
2431
- },
2432
- "timestamp": {
2433
- "type": "string"
2434
- }
2435
- },
2436
- "required": ["type", "session_id", "role", "content", "timestamp"],
2437
- "additionalProperties": false
2438
- }
2439
- ```
2440
-
2441
- ## Error Codes
2442
-
2443
- | Code | Name | Meaning |
2444
- | ------ | ----------------- | --------------------------------------------- |
2445
- | -32700 | Parse Error | Invalid JSON received |
2446
- | -32600 | Invalid Request | Missing required JSON-RPC fields |
2447
- | -32601 | Method Not Found | Unknown method |
2448
- | -32602 | Invalid Params | Parameter validation failed |
2449
- | -32603 | Internal Error | Handler raised an unhandled exception |
2450
- | -32010 | Session Not Found | Unknown session_id |
2451
- | -32012 | Session Busy | A run is already in progress for this session |