@mhome/conversation-protocol 0.11.1

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