-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Expand file tree
/
Copy pathgenerated_session_events.go
More file actions
2346 lines (2100 loc) · 96.1 KB
/
generated_session_events.go
File metadata and controls
2346 lines (2100 loc) · 96.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// AUTO-GENERATED FILE - DO NOT EDIT
// Generated from: session-events.schema.json
package copilot
import (
"encoding/json"
"time"
)
// SessionEventData is the interface implemented by all per-event data types.
type SessionEventData interface {
sessionEventData()
}
// RawSessionEventData holds unparsed JSON data for unrecognized event types.
type RawSessionEventData struct {
Raw json.RawMessage
}
func (RawSessionEventData) sessionEventData() {}
// MarshalJSON returns the original raw JSON so round-tripping preserves the payload.
func (r RawSessionEventData) MarshalJSON() ([]byte, error) { return r.Raw, nil }
// SessionEvent represents a single session event with a typed data payload.
type SessionEvent struct {
// Unique event identifier (UUID v4), generated when the event is emitted.
ID string `json:"id"`
// ISO 8601 timestamp when the event was created.
Timestamp time.Time `json:"timestamp"`
// ID of the preceding event in the session. Null for the first event.
ParentID *string `json:"parentId"`
// When true, the event is transient and not persisted.
Ephemeral *bool `json:"ephemeral,omitempty"`
// The event type discriminator.
Type SessionEventType `json:"type"`
// Typed event payload. Use a type switch to access per-event fields.
Data SessionEventData `json:"-"`
}
// UnmarshalSessionEvent parses JSON bytes into a SessionEvent.
func UnmarshalSessionEvent(data []byte) (SessionEvent, error) {
var r SessionEvent
err := json.Unmarshal(data, &r)
return r, err
}
// Marshal serializes the SessionEvent to JSON.
func (r *SessionEvent) Marshal() ([]byte, error) {
return json.Marshal(r)
}
func (e *SessionEvent) UnmarshalJSON(data []byte) error {
type rawEvent struct {
ID string `json:"id"`
Timestamp time.Time `json:"timestamp"`
ParentID *string `json:"parentId"`
Ephemeral *bool `json:"ephemeral,omitempty"`
Type SessionEventType `json:"type"`
Data json.RawMessage `json:"data"`
}
var raw rawEvent
if err := json.Unmarshal(data, &raw); err != nil {
return err
}
e.ID = raw.ID
e.Timestamp = raw.Timestamp
e.ParentID = raw.ParentID
e.Ephemeral = raw.Ephemeral
e.Type = raw.Type
switch raw.Type {
case SessionEventTypeSessionStart:
var d SessionStartData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeSessionResume:
var d SessionResumeData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeSessionRemoteSteerableChanged:
var d SessionRemoteSteerableChangedData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeSessionError:
var d SessionErrorData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeSessionIdle:
var d SessionIdleData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeSessionTitleChanged:
var d SessionTitleChangedData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeSessionInfo:
var d SessionInfoData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeSessionWarning:
var d SessionWarningData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeSessionModelChange:
var d SessionModelChangeData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeSessionModeChanged:
var d SessionModeChangedData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeSessionPlanChanged:
var d SessionPlanChangedData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeSessionWorkspaceFileChanged:
var d SessionWorkspaceFileChangedData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeSessionHandoff:
var d SessionHandoffData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeSessionTruncation:
var d SessionTruncationData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeSessionSnapshotRewind:
var d SessionSnapshotRewindData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeSessionShutdown:
var d SessionShutdownData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeSessionContextChanged:
var d SessionContextChangedData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeSessionUsageInfo:
var d SessionUsageInfoData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeSessionCompactionStart:
var d SessionCompactionStartData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeSessionCompactionComplete:
var d SessionCompactionCompleteData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeSessionTaskComplete:
var d SessionTaskCompleteData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeUserMessage:
var d UserMessageData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypePendingMessagesModified:
var d PendingMessagesModifiedData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeAssistantTurnStart:
var d AssistantTurnStartData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeAssistantIntent:
var d AssistantIntentData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeAssistantReasoning:
var d AssistantReasoningData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeAssistantReasoningDelta:
var d AssistantReasoningDeltaData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeAssistantStreamingDelta:
var d AssistantStreamingDeltaData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeAssistantMessage:
var d AssistantMessageData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeAssistantMessageDelta:
var d AssistantMessageDeltaData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeAssistantTurnEnd:
var d AssistantTurnEndData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeAssistantUsage:
var d AssistantUsageData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeAbort:
var d AbortData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeToolUserRequested:
var d ToolUserRequestedData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeToolExecutionStart:
var d ToolExecutionStartData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeToolExecutionPartialResult:
var d ToolExecutionPartialResultData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeToolExecutionProgress:
var d ToolExecutionProgressData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeToolExecutionComplete:
var d ToolExecutionCompleteData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeSkillInvoked:
var d SkillInvokedData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeSubagentStarted:
var d SubagentStartedData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeSubagentCompleted:
var d SubagentCompletedData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeSubagentFailed:
var d SubagentFailedData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeSubagentSelected:
var d SubagentSelectedData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeSubagentDeselected:
var d SubagentDeselectedData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeHookStart:
var d HookStartData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeHookEnd:
var d HookEndData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeSystemMessage:
var d SystemMessageData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeSystemNotification:
var d SystemNotificationData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypePermissionRequested:
var d PermissionRequestedData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypePermissionCompleted:
var d PermissionCompletedData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeUserInputRequested:
var d UserInputRequestedData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeUserInputCompleted:
var d UserInputCompletedData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeElicitationRequested:
var d ElicitationRequestedData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeElicitationCompleted:
var d ElicitationCompletedData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeSamplingRequested:
var d SamplingRequestedData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeSamplingCompleted:
var d SamplingCompletedData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeMcpOauthRequired:
var d McpOauthRequiredData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeMcpOauthCompleted:
var d McpOauthCompletedData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeExternalToolRequested:
var d ExternalToolRequestedData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeExternalToolCompleted:
var d ExternalToolCompletedData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeCommandQueued:
var d CommandQueuedData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeCommandExecute:
var d CommandExecuteData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeCommandCompleted:
var d CommandCompletedData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeCommandsChanged:
var d CommandsChangedData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeCapabilitiesChanged:
var d CapabilitiesChangedData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeExitPlanModeRequested:
var d ExitPlanModeRequestedData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeExitPlanModeCompleted:
var d ExitPlanModeCompletedData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeSessionToolsUpdated:
var d SessionToolsUpdatedData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeSessionBackgroundTasksChanged:
var d SessionBackgroundTasksChangedData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeSessionSkillsLoaded:
var d SessionSkillsLoadedData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeSessionCustomAgentsUpdated:
var d SessionCustomAgentsUpdatedData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeSessionMcpServersLoaded:
var d SessionMcpServersLoadedData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeSessionMcpServerStatusChanged:
var d SessionMcpServerStatusChangedData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
case SessionEventTypeSessionExtensionsLoaded:
var d SessionExtensionsLoadedData
if err := json.Unmarshal(raw.Data, &d); err != nil {
return err
}
e.Data = &d
default:
e.Data = &RawSessionEventData{Raw: raw.Data}
}
return nil
}
func (e SessionEvent) MarshalJSON() ([]byte, error) {
type rawEvent struct {
ID string `json:"id"`
Timestamp time.Time `json:"timestamp"`
ParentID *string `json:"parentId"`
Ephemeral *bool `json:"ephemeral,omitempty"`
Type SessionEventType `json:"type"`
Data any `json:"data"`
}
return json.Marshal(rawEvent{
ID: e.ID,
Timestamp: e.Timestamp,
ParentID: e.ParentID,
Ephemeral: e.Ephemeral,
Type: e.Type,
Data: e.Data,
})
}
// SessionEventType identifies the kind of session event.
type SessionEventType string
const (
SessionEventTypeSessionStart SessionEventType = "session.start"
SessionEventTypeSessionResume SessionEventType = "session.resume"
SessionEventTypeSessionRemoteSteerableChanged SessionEventType = "session.remote_steerable_changed"
SessionEventTypeSessionError SessionEventType = "session.error"
SessionEventTypeSessionIdle SessionEventType = "session.idle"
SessionEventTypeSessionTitleChanged SessionEventType = "session.title_changed"
SessionEventTypeSessionInfo SessionEventType = "session.info"
SessionEventTypeSessionWarning SessionEventType = "session.warning"
SessionEventTypeSessionModelChange SessionEventType = "session.model_change"
SessionEventTypeSessionModeChanged SessionEventType = "session.mode_changed"
SessionEventTypeSessionPlanChanged SessionEventType = "session.plan_changed"
SessionEventTypeSessionWorkspaceFileChanged SessionEventType = "session.workspace_file_changed"
SessionEventTypeSessionHandoff SessionEventType = "session.handoff"
SessionEventTypeSessionTruncation SessionEventType = "session.truncation"
SessionEventTypeSessionSnapshotRewind SessionEventType = "session.snapshot_rewind"
SessionEventTypeSessionShutdown SessionEventType = "session.shutdown"
SessionEventTypeSessionContextChanged SessionEventType = "session.context_changed"
SessionEventTypeSessionUsageInfo SessionEventType = "session.usage_info"
SessionEventTypeSessionCompactionStart SessionEventType = "session.compaction_start"
SessionEventTypeSessionCompactionComplete SessionEventType = "session.compaction_complete"
SessionEventTypeSessionTaskComplete SessionEventType = "session.task_complete"
SessionEventTypeUserMessage SessionEventType = "user.message"
SessionEventTypePendingMessagesModified SessionEventType = "pending_messages.modified"
SessionEventTypeAssistantTurnStart SessionEventType = "assistant.turn_start"
SessionEventTypeAssistantIntent SessionEventType = "assistant.intent"
SessionEventTypeAssistantReasoning SessionEventType = "assistant.reasoning"
SessionEventTypeAssistantReasoningDelta SessionEventType = "assistant.reasoning_delta"
SessionEventTypeAssistantStreamingDelta SessionEventType = "assistant.streaming_delta"
SessionEventTypeAssistantMessage SessionEventType = "assistant.message"
SessionEventTypeAssistantMessageDelta SessionEventType = "assistant.message_delta"
SessionEventTypeAssistantTurnEnd SessionEventType = "assistant.turn_end"
SessionEventTypeAssistantUsage SessionEventType = "assistant.usage"
SessionEventTypeAbort SessionEventType = "abort"
SessionEventTypeToolUserRequested SessionEventType = "tool.user_requested"
SessionEventTypeToolExecutionStart SessionEventType = "tool.execution_start"
SessionEventTypeToolExecutionPartialResult SessionEventType = "tool.execution_partial_result"
SessionEventTypeToolExecutionProgress SessionEventType = "tool.execution_progress"
SessionEventTypeToolExecutionComplete SessionEventType = "tool.execution_complete"
SessionEventTypeSkillInvoked SessionEventType = "skill.invoked"
SessionEventTypeSubagentStarted SessionEventType = "subagent.started"
SessionEventTypeSubagentCompleted SessionEventType = "subagent.completed"
SessionEventTypeSubagentFailed SessionEventType = "subagent.failed"
SessionEventTypeSubagentSelected SessionEventType = "subagent.selected"
SessionEventTypeSubagentDeselected SessionEventType = "subagent.deselected"
SessionEventTypeHookStart SessionEventType = "hook.start"
SessionEventTypeHookEnd SessionEventType = "hook.end"
SessionEventTypeSystemMessage SessionEventType = "system.message"
SessionEventTypeSystemNotification SessionEventType = "system.notification"
SessionEventTypePermissionRequested SessionEventType = "permission.requested"
SessionEventTypePermissionCompleted SessionEventType = "permission.completed"
SessionEventTypeUserInputRequested SessionEventType = "user_input.requested"
SessionEventTypeUserInputCompleted SessionEventType = "user_input.completed"
SessionEventTypeElicitationRequested SessionEventType = "elicitation.requested"
SessionEventTypeElicitationCompleted SessionEventType = "elicitation.completed"
SessionEventTypeSamplingRequested SessionEventType = "sampling.requested"
SessionEventTypeSamplingCompleted SessionEventType = "sampling.completed"
SessionEventTypeMcpOauthRequired SessionEventType = "mcp.oauth_required"
SessionEventTypeMcpOauthCompleted SessionEventType = "mcp.oauth_completed"
SessionEventTypeExternalToolRequested SessionEventType = "external_tool.requested"
SessionEventTypeExternalToolCompleted SessionEventType = "external_tool.completed"
SessionEventTypeCommandQueued SessionEventType = "command.queued"
SessionEventTypeCommandExecute SessionEventType = "command.execute"
SessionEventTypeCommandCompleted SessionEventType = "command.completed"
SessionEventTypeCommandsChanged SessionEventType = "commands.changed"
SessionEventTypeCapabilitiesChanged SessionEventType = "capabilities.changed"
SessionEventTypeExitPlanModeRequested SessionEventType = "exit_plan_mode.requested"
SessionEventTypeExitPlanModeCompleted SessionEventType = "exit_plan_mode.completed"
SessionEventTypeSessionToolsUpdated SessionEventType = "session.tools_updated"
SessionEventTypeSessionBackgroundTasksChanged SessionEventType = "session.background_tasks_changed"
SessionEventTypeSessionSkillsLoaded SessionEventType = "session.skills_loaded"
SessionEventTypeSessionCustomAgentsUpdated SessionEventType = "session.custom_agents_updated"
SessionEventTypeSessionMcpServersLoaded SessionEventType = "session.mcp_servers_loaded"
SessionEventTypeSessionMcpServerStatusChanged SessionEventType = "session.mcp_server_status_changed"
SessionEventTypeSessionExtensionsLoaded SessionEventType = "session.extensions_loaded"
)
// Session initialization metadata including context and configuration
type SessionStartData struct {
// Unique identifier for the session
SessionID string `json:"sessionId"`
// Schema version number for the session event format
Version float64 `json:"version"`
// Identifier of the software producing the events (e.g., "copilot-agent")
Producer string `json:"producer"`
// Version string of the Copilot application
CopilotVersion string `json:"copilotVersion"`
// ISO 8601 timestamp when the session was created
StartTime time.Time `json:"startTime"`
// Model selected at session creation time, if any
SelectedModel *string `json:"selectedModel,omitempty"`
// Reasoning effort level used for model calls, if applicable (e.g. "low", "medium", "high", "xhigh")
ReasoningEffort *string `json:"reasoningEffort,omitempty"`
// Working directory and git context at session start
Context *SessionStartDataContext `json:"context,omitempty"`
// Whether the session was already in use by another client at start time
AlreadyInUse *bool `json:"alreadyInUse,omitempty"`
// Whether this session supports remote steering via Mission Control
RemoteSteerable *bool `json:"remoteSteerable,omitempty"`
}
func (*SessionStartData) sessionEventData() {}
// Session resume metadata including current context and event count
type SessionResumeData struct {
// ISO 8601 timestamp when the session was resumed
ResumeTime time.Time `json:"resumeTime"`
// Total number of persisted events in the session at the time of resume
EventCount float64 `json:"eventCount"`
// Model currently selected at resume time
SelectedModel *string `json:"selectedModel,omitempty"`
// Reasoning effort level used for model calls, if applicable (e.g. "low", "medium", "high", "xhigh")
ReasoningEffort *string `json:"reasoningEffort,omitempty"`
// Updated working directory and git context at resume time
Context *SessionResumeDataContext `json:"context,omitempty"`
// Whether the session was already in use by another client at resume time
AlreadyInUse *bool `json:"alreadyInUse,omitempty"`
// Whether this session supports remote steering via Mission Control
RemoteSteerable *bool `json:"remoteSteerable,omitempty"`
}
func (*SessionResumeData) sessionEventData() {}
// Notifies Mission Control that the session's remote steering capability has changed
type SessionRemoteSteerableChangedData struct {
// Whether this session now supports remote steering via Mission Control
RemoteSteerable bool `json:"remoteSteerable"`
}
func (*SessionRemoteSteerableChangedData) sessionEventData() {}
// Error details for timeline display including message and optional diagnostic information
type SessionErrorData struct {
// Category of error (e.g., "authentication", "authorization", "quota", "rate_limit", "context_limit", "query")
ErrorType string `json:"errorType"`
// Human-readable error message
Message string `json:"message"`
// Error stack trace, when available
Stack *string `json:"stack,omitempty"`
// HTTP status code from the upstream request, if applicable
StatusCode *int64 `json:"statusCode,omitempty"`
// GitHub request tracing ID (x-github-request-id header) for correlating with server-side logs
ProviderCallID *string `json:"providerCallId,omitempty"`
// Optional URL associated with this error that the user can open in a browser
URL *string `json:"url,omitempty"`
}
func (*SessionErrorData) sessionEventData() {}
// Payload indicating the session is idle with no background agents in flight
type SessionIdleData struct {
// True when the preceding agentic loop was cancelled via abort signal
Aborted *bool `json:"aborted,omitempty"`
}
func (*SessionIdleData) sessionEventData() {}
// Session title change payload containing the new display title
type SessionTitleChangedData struct {
// The new display title for the session
Title string `json:"title"`
}
func (*SessionTitleChangedData) sessionEventData() {}
// Informational message for timeline display with categorization
type SessionInfoData struct {
// Category of informational message (e.g., "notification", "timing", "context_window", "mcp", "snapshot", "configuration", "authentication", "model")
InfoType string `json:"infoType"`
// Human-readable informational message for display in the timeline
Message string `json:"message"`
// Optional URL associated with this message that the user can open in a browser
URL *string `json:"url,omitempty"`
}
func (*SessionInfoData) sessionEventData() {}
// Warning message for timeline display with categorization
type SessionWarningData struct {
// Category of warning (e.g., "subscription", "policy", "mcp")
WarningType string `json:"warningType"`
// Human-readable warning message for display in the timeline
Message string `json:"message"`
// Optional URL associated with this warning that the user can open in a browser
URL *string `json:"url,omitempty"`
}
func (*SessionWarningData) sessionEventData() {}
// Model change details including previous and new model identifiers
type SessionModelChangeData struct {
// Model that was previously selected, if any
PreviousModel *string `json:"previousModel,omitempty"`
// Newly selected model identifier
NewModel string `json:"newModel"`
// Reasoning effort level before the model change, if applicable
PreviousReasoningEffort *string `json:"previousReasoningEffort,omitempty"`
// Reasoning effort level after the model change, if applicable
ReasoningEffort *string `json:"reasoningEffort,omitempty"`
}
func (*SessionModelChangeData) sessionEventData() {}
// Agent mode change details including previous and new modes
type SessionModeChangedData struct {
// Agent mode before the change (e.g., "interactive", "plan", "autopilot")
PreviousMode string `json:"previousMode"`
// Agent mode after the change (e.g., "interactive", "plan", "autopilot")
NewMode string `json:"newMode"`
}
func (*SessionModeChangedData) sessionEventData() {}
// Plan file operation details indicating what changed
type SessionPlanChangedData struct {
// The type of operation performed on the plan file
Operation SessionPlanChangedDataOperation `json:"operation"`
}
func (*SessionPlanChangedData) sessionEventData() {}
// Workspace file change details including path and operation type
type SessionWorkspaceFileChangedData struct {
// Relative path within the session workspace files directory
Path string `json:"path"`
// Whether the file was newly created or updated
Operation SessionWorkspaceFileChangedDataOperation `json:"operation"`
}
func (*SessionWorkspaceFileChangedData) sessionEventData() {}
// Session handoff metadata including source, context, and repository information
type SessionHandoffData struct {
// ISO 8601 timestamp when the handoff occurred
HandoffTime time.Time `json:"handoffTime"`
// Origin type of the session being handed off
SourceType SessionHandoffDataSourceType `json:"sourceType"`
// Repository context for the handed-off session
Repository *SessionHandoffDataRepository `json:"repository,omitempty"`
// Additional context information for the handoff
Context *string `json:"context,omitempty"`
// Summary of the work done in the source session
Summary *string `json:"summary,omitempty"`
// Session ID of the remote session being handed off
RemoteSessionID *string `json:"remoteSessionId,omitempty"`
// GitHub host URL for the source session (e.g., https://github.com or https://tenant.ghe.com)
Host *string `json:"host,omitempty"`
}
func (*SessionHandoffData) sessionEventData() {}
// Conversation truncation statistics including token counts and removed content metrics
type SessionTruncationData struct {
// Maximum token count for the model's context window
TokenLimit float64 `json:"tokenLimit"`
// Total tokens in conversation messages before truncation
PreTruncationTokensInMessages float64 `json:"preTruncationTokensInMessages"`
// Number of conversation messages before truncation
PreTruncationMessagesLength float64 `json:"preTruncationMessagesLength"`
// Total tokens in conversation messages after truncation
PostTruncationTokensInMessages float64 `json:"postTruncationTokensInMessages"`
// Number of conversation messages after truncation
PostTruncationMessagesLength float64 `json:"postTruncationMessagesLength"`
// Number of tokens removed by truncation
TokensRemovedDuringTruncation float64 `json:"tokensRemovedDuringTruncation"`
// Number of messages removed by truncation
MessagesRemovedDuringTruncation float64 `json:"messagesRemovedDuringTruncation"`
// Identifier of the component that performed truncation (e.g., "BasicTruncator")
PerformedBy string `json:"performedBy"`
}
func (*SessionTruncationData) sessionEventData() {}
// Session rewind details including target event and count of removed events
type SessionSnapshotRewindData struct {
// Event ID that was rewound to; this event and all after it were removed
UpToEventID string `json:"upToEventId"`
// Number of events that were removed by the rewind
EventsRemoved float64 `json:"eventsRemoved"`
}
func (*SessionSnapshotRewindData) sessionEventData() {}
// Session termination metrics including usage statistics, code changes, and shutdown reason
type SessionShutdownData struct {
// Whether the session ended normally ("routine") or due to a crash/fatal error ("error")
ShutdownType SessionShutdownDataShutdownType `json:"shutdownType"`
// Error description when shutdownType is "error"
ErrorReason *string `json:"errorReason,omitempty"`
// Total number of premium API requests used during the session
TotalPremiumRequests float64 `json:"totalPremiumRequests"`
// Cumulative time spent in API calls during the session, in milliseconds
TotalAPIDurationMs float64 `json:"totalApiDurationMs"`
// Unix timestamp (milliseconds) when the session started
SessionStartTime float64 `json:"sessionStartTime"`
// Aggregate code change metrics for the session
CodeChanges SessionShutdownDataCodeChanges `json:"codeChanges"`
// Per-model usage breakdown, keyed by model identifier
ModelMetrics map[string]SessionShutdownDataModelMetricsValue `json:"modelMetrics"`
// Model that was selected at the time of shutdown
CurrentModel *string `json:"currentModel,omitempty"`
// Total tokens in context window at shutdown
CurrentTokens *float64 `json:"currentTokens,omitempty"`
// System message token count at shutdown
SystemTokens *float64 `json:"systemTokens,omitempty"`
// Non-system message token count at shutdown
ConversationTokens *float64 `json:"conversationTokens,omitempty"`
// Tool definitions token count at shutdown
ToolDefinitionsTokens *float64 `json:"toolDefinitionsTokens,omitempty"`
}
func (*SessionShutdownData) sessionEventData() {}
// Updated working directory and git context after the change
type SessionContextChangedData struct {
// Current working directory path
Cwd string `json:"cwd"`
// Root directory of the git repository, resolved via git rev-parse
GitRoot *string `json:"gitRoot,omitempty"`
// Repository identifier derived from the git remote URL ("owner/name" for GitHub, "org/project/repo" for Azure DevOps)
Repository *string `json:"repository,omitempty"`
// Hosting platform type of the repository (github or ado)
HostType *SessionStartDataContextHostType `json:"hostType,omitempty"`
// Current git branch name
Branch *string `json:"branch,omitempty"`
// Head commit of current git branch at session start time
HeadCommit *string `json:"headCommit,omitempty"`
// Base commit of current git branch at session start time
BaseCommit *string `json:"baseCommit,omitempty"`
}
func (*SessionContextChangedData) sessionEventData() {}
// Current context window usage statistics including token and message counts
type SessionUsageInfoData struct {
// Maximum token count for the model's context window
TokenLimit float64 `json:"tokenLimit"`
// Current number of tokens in the context window
CurrentTokens float64 `json:"currentTokens"`
// Current number of messages in the conversation
MessagesLength float64 `json:"messagesLength"`
// Token count from system message(s)
SystemTokens *float64 `json:"systemTokens,omitempty"`
// Token count from non-system messages (user, assistant, tool)
ConversationTokens *float64 `json:"conversationTokens,omitempty"`
// Token count from tool definitions
ToolDefinitionsTokens *float64 `json:"toolDefinitionsTokens,omitempty"`
// Whether this is the first usage_info event emitted in this session
IsInitial *bool `json:"isInitial,omitempty"`
}
func (*SessionUsageInfoData) sessionEventData() {}
// Context window breakdown at the start of LLM-powered conversation compaction
type SessionCompactionStartData struct {
// Token count from system message(s) at compaction start
SystemTokens *float64 `json:"systemTokens,omitempty"`
// Token count from non-system messages (user, assistant, tool) at compaction start
ConversationTokens *float64 `json:"conversationTokens,omitempty"`
// Token count from tool definitions at compaction start
ToolDefinitionsTokens *float64 `json:"toolDefinitionsTokens,omitempty"`
}
func (*SessionCompactionStartData) sessionEventData() {}
// Conversation compaction results including success status, metrics, and optional error details
type SessionCompactionCompleteData struct {
// Whether compaction completed successfully
Success bool `json:"success"`
// Error message if compaction failed
Error *string `json:"error,omitempty"`
// Total tokens in conversation before compaction
PreCompactionTokens *float64 `json:"preCompactionTokens,omitempty"`
// Total tokens in conversation after compaction
PostCompactionTokens *float64 `json:"postCompactionTokens,omitempty"`
// Number of messages before compaction
PreCompactionMessagesLength *float64 `json:"preCompactionMessagesLength,omitempty"`
// Number of messages removed during compaction
MessagesRemoved *float64 `json:"messagesRemoved,omitempty"`
// Number of tokens removed during compaction
TokensRemoved *float64 `json:"tokensRemoved,omitempty"`
// LLM-generated summary of the compacted conversation history
SummaryContent *string `json:"summaryContent,omitempty"`
// Checkpoint snapshot number created for recovery
CheckpointNumber *float64 `json:"checkpointNumber,omitempty"`
// File path where the checkpoint was stored
CheckpointPath *string `json:"checkpointPath,omitempty"`
// Token usage breakdown for the compaction LLM call
CompactionTokensUsed *SessionCompactionCompleteDataCompactionTokensUsed `json:"compactionTokensUsed,omitempty"`
// GitHub request tracing ID (x-github-request-id header) for the compaction LLM call
RequestID *string `json:"requestId,omitempty"`
// Token count from system message(s) after compaction
SystemTokens *float64 `json:"systemTokens,omitempty"`
// Token count from non-system messages (user, assistant, tool) after compaction
ConversationTokens *float64 `json:"conversationTokens,omitempty"`
// Token count from tool definitions after compaction
ToolDefinitionsTokens *float64 `json:"toolDefinitionsTokens,omitempty"`
}
func (*SessionCompactionCompleteData) sessionEventData() {}
// Task completion notification with summary from the agent
type SessionTaskCompleteData struct {
// Summary of the completed task, provided by the agent
Summary *string `json:"summary,omitempty"`
// Whether the tool call succeeded. False when validation failed (e.g., invalid arguments)
Success *bool `json:"success,omitempty"`
}
func (*SessionTaskCompleteData) sessionEventData() {}
// UserMessageData holds the payload for user.message events.
type UserMessageData struct {
// The user's message text as displayed in the timeline
Content string `json:"content"`
// Transformed version of the message sent to the model, with XML wrapping, timestamps, and other augmentations for prompt caching
TransformedContent *string `json:"transformedContent,omitempty"`
// Files, selections, or GitHub references attached to the message
Attachments []UserMessageDataAttachmentsItem `json:"attachments,omitempty"`
// Origin of this message, used for timeline filtering (e.g., "skill-pdf" for skill-injected messages that should be hidden from the user)
Source *string `json:"source,omitempty"`
// The agent mode that was active when this message was sent
AgentMode *UserMessageDataAgentMode `json:"agentMode,omitempty"`
// CAPI interaction ID for correlating this user message with its turn
InteractionID *string `json:"interactionId,omitempty"`
}
func (*UserMessageData) sessionEventData() {}
// Empty payload; the event signals that the pending message queue has changed
type PendingMessagesModifiedData struct {
}
func (*PendingMessagesModifiedData) sessionEventData() {}
// Turn initialization metadata including identifier and interaction tracking
type AssistantTurnStartData struct {
// Identifier for this turn within the agentic loop, typically a stringified turn number
TurnID string `json:"turnId"`
// CAPI interaction ID for correlating this turn with upstream telemetry
InteractionID *string `json:"interactionId,omitempty"`
}
func (*AssistantTurnStartData) sessionEventData() {}
// Agent intent description for current activity or plan
type AssistantIntentData struct {
// Short description of what the agent is currently doing or planning to do
Intent string `json:"intent"`
}
func (*AssistantIntentData) sessionEventData() {}
// Assistant reasoning content for timeline display with complete thinking text
type AssistantReasoningData struct {