-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expand file tree
/
Copy pathgenerated_session_events.go
More file actions
1887 lines (1784 loc) · 72.2 KB
/
generated_session_events.go
File metadata and controls
1887 lines (1784 loc) · 72.2 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
// Code generated from JSON Schema using quicktype. DO NOT EDIT.
// To parse and unparse this JSON data, add this code to your project and do:
//
// sessionEvent, err := UnmarshalSessionEvent(bytes)
// bytes, err = sessionEvent.Marshal()
package copilot
import "bytes"
import "errors"
import "time"
import "encoding/json"
func UnmarshalSessionEvent(data []byte) (SessionEvent, error) {
var r SessionEvent
err := json.Unmarshal(data, &r)
return r, err
}
func (r *SessionEvent) Marshal() ([]byte, error) {
return json.Marshal(r)
}
type SessionEvent struct {
// Session initialization metadata including context and configuration
//
// Session resume metadata including current context and event count
//
// Notifies Mission Control that the session's remote steering capability has changed
//
// Error details for timeline display including message and optional diagnostic information
//
// Payload indicating the agent is idle; includes any background tasks still in flight
//
// Session title change payload containing the new display title
//
// Informational message for timeline display with categorization
//
// Warning message for timeline display with categorization
//
// Model change details including previous and new model identifiers
//
// Agent mode change details including previous and new modes
//
// Plan file operation details indicating what changed
//
// Workspace file change details including path and operation type
//
// Session handoff metadata including source, context, and repository information
//
// Conversation truncation statistics including token counts and removed content metrics
//
// Session rewind details including target event and count of removed events
//
// Session termination metrics including usage statistics, code changes, and shutdown
// reason
//
// Updated working directory and git context after the change
//
// Current context window usage statistics including token and message counts
//
// Context window breakdown at the start of LLM-powered conversation compaction
//
// Conversation compaction results including success status, metrics, and optional error
// details
//
// Task completion notification with summary from the agent
//
// Empty payload; the event signals that the pending message queue has changed
//
// Turn initialization metadata including identifier and interaction tracking
//
// Agent intent description for current activity or plan
//
// Assistant reasoning content for timeline display with complete thinking text
//
// Streaming reasoning delta for incremental extended thinking updates
//
// Streaming response progress with cumulative byte count
//
// Assistant response containing text content, optional tool requests, and interaction
// metadata
//
// Streaming assistant message delta for incremental response updates
//
// Turn completion metadata including the turn identifier
//
// LLM API call usage metrics including tokens, costs, quotas, and billing information
//
// Turn abort information including the reason for termination
//
// User-initiated tool invocation request with tool name and arguments
//
// Tool execution startup details including MCP server information when applicable
//
// Streaming tool execution output for incremental result display
//
// Tool execution progress notification with status message
//
// Tool execution completion results including success status, detailed output, and error
// information
//
// Skill invocation details including content, allowed tools, and plugin metadata
//
// Sub-agent startup details including parent tool call and agent information
//
// Sub-agent completion details for successful execution
//
// Sub-agent failure details including error message and agent information
//
// Custom agent selection details including name and available tools
//
// Empty payload; the event signals that the custom agent was deselected, returning to the
// default agent
//
// Hook invocation start details including type and input data
//
// Hook invocation completion details including output, success status, and error
// information
//
// System or developer message content with role and optional template metadata
//
// System-generated notification for runtime events like background task completion
//
// Permission request notification requiring client approval with request details
//
// Permission request completion notification signaling UI dismissal
//
// User input request notification with question and optional predefined choices
//
// User input request completion notification signaling UI dismissal
//
// Elicitation request; may be form-based (structured input) or URL-based (browser
// redirect)
//
// Elicitation request completion notification signaling UI dismissal
//
// Sampling request from an MCP server; contains the server name and a requestId for
// correlation
//
// Sampling request completion notification signaling UI dismissal
//
// OAuth authentication request for an MCP server
//
// MCP OAuth request completion notification
//
// External tool invocation request for client-side tool execution
//
// External tool completion notification signaling UI dismissal
//
// Queued slash command dispatch request for client execution
//
// Registered command dispatch request routed to the owning client
//
// Queued command completion notification signaling UI dismissal
//
// SDK command registration change notification
//
// Session capability change notification
//
// Plan approval request with plan content and available user actions
//
// Plan mode exit completion notification signaling UI dismissal
Data Data `json:"data"`
// When true, the event is transient and not persisted to the session event log on disk
Ephemeral *bool `json:"ephemeral,omitempty"`
// Unique event identifier (UUID v4), generated when the event is emitted
ID string `json:"id"`
// ID of the chronologically preceding event in the session, forming a linked chain. Null
// for the first event.
ParentID *string `json:"parentId"`
// ISO 8601 timestamp when the event was created
Timestamp time.Time `json:"timestamp"`
Type SessionEventType `json:"type"`
}
// Session initialization metadata including context and configuration
//
// # Session resume metadata including current context and event count
//
// # Notifies Mission Control that the session's remote steering capability has changed
//
// # Error details for timeline display including message and optional diagnostic information
//
// Payload indicating the agent is idle; includes any background tasks still in flight
//
// # Session title change payload containing the new display title
//
// # Informational message for timeline display with categorization
//
// # Warning message for timeline display with categorization
//
// # Model change details including previous and new model identifiers
//
// # Agent mode change details including previous and new modes
//
// # Plan file operation details indicating what changed
//
// # Workspace file change details including path and operation type
//
// # Session handoff metadata including source, context, and repository information
//
// # Conversation truncation statistics including token counts and removed content metrics
//
// # Session rewind details including target event and count of removed events
//
// Session termination metrics including usage statistics, code changes, and shutdown
// reason
//
// # Updated working directory and git context after the change
//
// # Current context window usage statistics including token and message counts
//
// # Context window breakdown at the start of LLM-powered conversation compaction
//
// Conversation compaction results including success status, metrics, and optional error
// details
//
// # Task completion notification with summary from the agent
//
// Empty payload; the event signals that the pending message queue has changed
//
// # Turn initialization metadata including identifier and interaction tracking
//
// # Agent intent description for current activity or plan
//
// # Assistant reasoning content for timeline display with complete thinking text
//
// # Streaming reasoning delta for incremental extended thinking updates
//
// # Streaming response progress with cumulative byte count
//
// Assistant response containing text content, optional tool requests, and interaction
// metadata
//
// # Streaming assistant message delta for incremental response updates
//
// # Turn completion metadata including the turn identifier
//
// # LLM API call usage metrics including tokens, costs, quotas, and billing information
//
// # Turn abort information including the reason for termination
//
// # User-initiated tool invocation request with tool name and arguments
//
// # Tool execution startup details including MCP server information when applicable
//
// # Streaming tool execution output for incremental result display
//
// # Tool execution progress notification with status message
//
// Tool execution completion results including success status, detailed output, and error
// information
//
// # Skill invocation details including content, allowed tools, and plugin metadata
//
// # Sub-agent startup details including parent tool call and agent information
//
// # Sub-agent completion details for successful execution
//
// # Sub-agent failure details including error message and agent information
//
// # Custom agent selection details including name and available tools
//
// Empty payload; the event signals that the custom agent was deselected, returning to the
// default agent
//
// # Hook invocation start details including type and input data
//
// Hook invocation completion details including output, success status, and error
// information
//
// # System or developer message content with role and optional template metadata
//
// # System-generated notification for runtime events like background task completion
//
// # Permission request notification requiring client approval with request details
//
// # Permission request completion notification signaling UI dismissal
//
// # User input request notification with question and optional predefined choices
//
// # User input request completion notification signaling UI dismissal
//
// Elicitation request; may be form-based (structured input) or URL-based (browser
// redirect)
//
// # Elicitation request completion notification signaling UI dismissal
//
// Sampling request from an MCP server; contains the server name and a requestId for
// correlation
//
// # Sampling request completion notification signaling UI dismissal
//
// # OAuth authentication request for an MCP server
//
// # MCP OAuth request completion notification
//
// # External tool invocation request for client-side tool execution
//
// # External tool completion notification signaling UI dismissal
//
// # Queued slash command dispatch request for client execution
//
// # Registered command dispatch request routed to the owning client
//
// # Queued command completion notification signaling UI dismissal
//
// # SDK command registration change notification
//
// # Session capability change notification
//
// # Plan approval request with plan content and available user actions
//
// Plan mode exit completion notification signaling UI dismissal
type Data struct {
// Whether the session was already in use by another client at start time
//
// Whether the session was already in use by another client at resume time
AlreadyInUse *bool `json:"alreadyInUse,omitempty"`
// Working directory and git context at session start
//
// Updated working directory and git context at resume time
//
// Additional context information for the handoff
Context *ContextUnion `json:"context"`
// Version string of the Copilot application
CopilotVersion *string `json:"copilotVersion,omitempty"`
// Identifier of the software producing the events (e.g., "copilot-agent")
Producer *string `json:"producer,omitempty"`
// Reasoning effort level used for model calls, if applicable (e.g. "low", "medium", "high",
// "xhigh")
//
// Reasoning effort level after the model change, if applicable
ReasoningEffort *string `json:"reasoningEffort,omitempty"`
// Whether this session supports remote steering via Mission Control
//
// Whether this session now supports remote steering via Mission Control
RemoteSteerable *bool `json:"remoteSteerable,omitempty"`
// Model selected at session creation time, if any
//
// Model currently selected at resume time
SelectedModel *string `json:"selectedModel,omitempty"`
// Unique identifier for the session
//
// Session ID that this external tool request belongs to
SessionID *string `json:"sessionId,omitempty"`
// ISO 8601 timestamp when the session was created
StartTime *time.Time `json:"startTime,omitempty"`
// Schema version number for the session event format
Version *float64 `json:"version,omitempty"`
// Total number of persisted events in the session at the time of resume
EventCount *float64 `json:"eventCount,omitempty"`
// ISO 8601 timestamp when the session was resumed
ResumeTime *time.Time `json:"resumeTime,omitempty"`
// Category of error (e.g., "authentication", "authorization", "quota", "rate_limit",
// "query")
ErrorType *string `json:"errorType,omitempty"`
// Human-readable error message
//
// Human-readable informational message for display in the timeline
//
// Human-readable warning message for display in the timeline
//
// Message describing what information is needed from the user
Message *string `json:"message,omitempty"`
// GitHub request tracing ID (x-github-request-id header) for correlating with server-side
// logs
//
// GitHub request tracing ID (x-github-request-id header) for server-side log correlation
ProviderCallID *string `json:"providerCallId,omitempty"`
// Error stack trace, when available
Stack *string `json:"stack,omitempty"`
// HTTP status code from the upstream request, if applicable
StatusCode *int64 `json:"statusCode,omitempty"`
// Optional URL associated with this error that the user can open in a browser
//
// Optional URL associated with this message that the user can open in a browser
//
// Optional URL associated with this warning that the user can open in a browser
//
// URL to open in the user's browser (url mode only)
URL *string `json:"url,omitempty"`
// True when the preceding agentic loop was cancelled via abort signal
Aborted *bool `json:"aborted,omitempty"`
// Background tasks still running when the agent became idle
BackgroundTasks *BackgroundTasks `json:"backgroundTasks,omitempty"`
// The new display title for the session
Title *string `json:"title,omitempty"`
// Category of informational message (e.g., "notification", "timing", "context_window",
// "mcp", "snapshot", "configuration", "authentication", "model")
InfoType *string `json:"infoType,omitempty"`
// Category of warning (e.g., "subscription", "policy", "mcp")
WarningType *string `json:"warningType,omitempty"`
// Newly selected model identifier
NewModel *string `json:"newModel,omitempty"`
// Model that was previously selected, if any
PreviousModel *string `json:"previousModel,omitempty"`
// Reasoning effort level before the model change, if applicable
PreviousReasoningEffort *string `json:"previousReasoningEffort,omitempty"`
// Agent mode after the change (e.g., "interactive", "plan", "autopilot")
NewMode *string `json:"newMode,omitempty"`
// Agent mode before the change (e.g., "interactive", "plan", "autopilot")
PreviousMode *string `json:"previousMode,omitempty"`
// The type of operation performed on the plan file
//
// Whether the file was newly created or updated
Operation *Operation `json:"operation,omitempty"`
// Relative path within the session workspace files directory
//
// File path to the SKILL.md definition
Path *string `json:"path,omitempty"`
// ISO 8601 timestamp when the handoff occurred
HandoffTime *time.Time `json:"handoffTime,omitempty"`
// GitHub host URL for the source session (e.g., https://github.com or
// https://tenant.ghe.com)
Host *string `json:"host,omitempty"`
// Session ID of the remote session being handed off
RemoteSessionID *string `json:"remoteSessionId,omitempty"`
// Repository context for the handed-off session
//
// Repository identifier derived from the git remote URL ("owner/name" for GitHub,
// "org/project/repo" for Azure DevOps)
Repository *RepositoryUnion `json:"repository"`
// Origin type of the session being handed off
SourceType *SourceType `json:"sourceType,omitempty"`
// Summary of the work done in the source session
//
// Summary of the completed task, provided by the agent
//
// Summary of the plan that was created
Summary *string `json:"summary,omitempty"`
// Number of messages removed by truncation
MessagesRemovedDuringTruncation *float64 `json:"messagesRemovedDuringTruncation,omitempty"`
// Identifier of the component that performed truncation (e.g., "BasicTruncator")
PerformedBy *string `json:"performedBy,omitempty"`
// Number of conversation messages after truncation
PostTruncationMessagesLength *float64 `json:"postTruncationMessagesLength,omitempty"`
// Total tokens in conversation messages after truncation
PostTruncationTokensInMessages *float64 `json:"postTruncationTokensInMessages,omitempty"`
// Number of conversation messages before truncation
PreTruncationMessagesLength *float64 `json:"preTruncationMessagesLength,omitempty"`
// Total tokens in conversation messages before truncation
PreTruncationTokensInMessages *float64 `json:"preTruncationTokensInMessages,omitempty"`
// Maximum token count for the model's context window
TokenLimit *float64 `json:"tokenLimit,omitempty"`
// Number of tokens removed by truncation
TokensRemovedDuringTruncation *float64 `json:"tokensRemovedDuringTruncation,omitempty"`
// Number of events that were removed by the rewind
EventsRemoved *float64 `json:"eventsRemoved,omitempty"`
// Event ID that was rewound to; all events after this one were removed
UpToEventID *string `json:"upToEventId,omitempty"`
// Aggregate code change metrics for the session
CodeChanges *CodeChanges `json:"codeChanges,omitempty"`
// Non-system message token count at shutdown
//
// Token count from non-system messages (user, assistant, tool)
//
// Token count from non-system messages (user, assistant, tool) at compaction start
//
// Token count from non-system messages (user, assistant, tool) after compaction
ConversationTokens *float64 `json:"conversationTokens,omitempty"`
// Model that was selected at the time of shutdown
CurrentModel *string `json:"currentModel,omitempty"`
// Total tokens in context window at shutdown
//
// Current number of tokens in the context window
CurrentTokens *float64 `json:"currentTokens,omitempty"`
// Error description when shutdownType is "error"
ErrorReason *string `json:"errorReason,omitempty"`
// Per-model usage breakdown, keyed by model identifier
ModelMetrics map[string]ModelMetric `json:"modelMetrics,omitempty"`
// Unix timestamp (milliseconds) when the session started
SessionStartTime *float64 `json:"sessionStartTime,omitempty"`
// Whether the session ended normally ("routine") or due to a crash/fatal error ("error")
ShutdownType *ShutdownType `json:"shutdownType,omitempty"`
// System message token count at shutdown
//
// Token count from system message(s)
//
// Token count from system message(s) at compaction start
//
// Token count from system message(s) after compaction
SystemTokens *float64 `json:"systemTokens,omitempty"`
// Tool definitions token count at shutdown
//
// Token count from tool definitions
//
// Token count from tool definitions at compaction start
//
// Token count from tool definitions after compaction
ToolDefinitionsTokens *float64 `json:"toolDefinitionsTokens,omitempty"`
// Cumulative time spent in API calls during the session, in milliseconds
TotalAPIDurationMS *float64 `json:"totalApiDurationMs,omitempty"`
// Total number of premium API requests used during the session
TotalPremiumRequests *float64 `json:"totalPremiumRequests,omitempty"`
// Base commit of current git branch at session start time
BaseCommit *string `json:"baseCommit,omitempty"`
// Current git branch name
Branch *string `json:"branch,omitempty"`
// Current working directory path
Cwd *string `json:"cwd,omitempty"`
// Root directory of the git repository, resolved via git rev-parse
GitRoot *string `json:"gitRoot,omitempty"`
// Head commit of current git branch at session start time
HeadCommit *string `json:"headCommit,omitempty"`
// Hosting platform type of the repository (github or ado)
HostType *HostType `json:"hostType,omitempty"`
// Whether this is the first usage_info event emitted in this session
IsInitial *bool `json:"isInitial,omitempty"`
// Current number of messages in the conversation
MessagesLength *float64 `json:"messagesLength,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 *CompactionTokensUsed `json:"compactionTokensUsed,omitempty"`
// Error message if compaction failed
//
// Error details when the tool execution failed
//
// Error message describing why the sub-agent failed
//
// Error details when the hook failed
Error *ErrorUnion `json:"error"`
// Number of messages removed during compaction
MessagesRemoved *float64 `json:"messagesRemoved,omitempty"`
// Total tokens in conversation after compaction
PostCompactionTokens *float64 `json:"postCompactionTokens,omitempty"`
// Number of messages before compaction
PreCompactionMessagesLength *float64 `json:"preCompactionMessagesLength,omitempty"`
// Total tokens in conversation before compaction
PreCompactionTokens *float64 `json:"preCompactionTokens,omitempty"`
// GitHub request tracing ID (x-github-request-id header) for the compaction LLM call
//
// Unique identifier for this permission request; used to respond via
// session.respondToPermission()
//
// Request ID of the resolved permission request; clients should dismiss any UI for this
// request
//
// Unique identifier for this input request; used to respond via
// session.respondToUserInput()
//
// Request ID of the resolved user input request; clients should dismiss any UI for this
// request
//
// Unique identifier for this elicitation request; used to respond via
// session.respondToElicitation()
//
// Request ID of the resolved elicitation request; clients should dismiss any UI for this
// request
//
// Unique identifier for this sampling request; used to respond via
// session.respondToSampling()
//
// Request ID of the resolved sampling request; clients should dismiss any UI for this
// request
//
// Unique identifier for this OAuth request; used to respond via
// session.respondToMcpOAuth()
//
// Request ID of the resolved OAuth request
//
// Unique identifier for this request; used to respond via session.respondToExternalTool()
//
// Request ID of the resolved external tool request; clients should dismiss any UI for this
// request
//
// Unique identifier for this request; used to respond via session.respondToQueuedCommand()
//
// Unique identifier; used to respond via session.commands.handlePendingCommand()
//
// Request ID of the resolved command request; clients should dismiss any UI for this
// request
//
// Unique identifier for this request; used to respond via session.respondToExitPlanMode()
//
// Request ID of the resolved exit plan mode request; clients should dismiss any UI for this
// request
RequestID *string `json:"requestId,omitempty"`
// Whether compaction completed successfully
//
// Whether the tool call succeeded. False when validation failed (e.g., invalid arguments)
//
// Whether the tool execution completed successfully
//
// Whether the hook completed successfully
Success *bool `json:"success,omitempty"`
// LLM-generated summary of the compacted conversation history
SummaryContent *string `json:"summaryContent,omitempty"`
// Number of tokens removed during compaction
TokensRemoved *float64 `json:"tokensRemoved,omitempty"`
// The agent mode that was active when this message was sent
AgentMode *AgentMode `json:"agentMode,omitempty"`
// Files, selections, or GitHub references attached to the message
Attachments []Attachment `json:"attachments,omitempty"`
// The user's message text as displayed in the timeline
//
// The complete extended thinking text from the model
//
// The assistant's text response content
//
// Full content of the skill file, injected into the conversation for the model
//
// The system or developer prompt text
//
// The notification text, typically wrapped in <system_notification> XML tags
Content *string `json:"content,omitempty"`
// CAPI interaction ID for correlating this user message with its turn
//
// CAPI interaction ID for correlating this turn with upstream telemetry
//
// CAPI interaction ID for correlating this message with upstream telemetry
//
// CAPI interaction ID for correlating this tool execution with upstream telemetry
InteractionID *string `json:"interactionId,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"`
// Transformed version of the message sent to the model, with XML wrapping, timestamps, and
// other augmentations for prompt caching
TransformedContent *string `json:"transformedContent,omitempty"`
// Identifier for this turn within the agentic loop, typically a stringified turn number
//
// Identifier of the turn that has ended, matching the corresponding assistant.turn_start
// event
TurnID *string `json:"turnId,omitempty"`
// Short description of what the agent is currently doing or planning to do
Intent *string `json:"intent,omitempty"`
// Unique identifier for this reasoning block
//
// Reasoning block ID this delta belongs to, matching the corresponding assistant.reasoning
// event
ReasoningID *string `json:"reasoningId,omitempty"`
// Incremental text chunk to append to the reasoning content
//
// Incremental text chunk to append to the message content
DeltaContent *string `json:"deltaContent,omitempty"`
// Cumulative total bytes received from the streaming response so far
TotalResponseSizeBytes *float64 `json:"totalResponseSizeBytes,omitempty"`
// Encrypted reasoning content from OpenAI models. Session-bound and stripped on resume.
EncryptedContent *string `json:"encryptedContent,omitempty"`
// Unique identifier for this assistant message
//
// Message ID this delta belongs to, matching the corresponding assistant.message event
MessageID *string `json:"messageId,omitempty"`
// Actual output token count from the API response (completion_tokens), used for accurate
// token accounting
//
// Number of output tokens produced
OutputTokens *float64 `json:"outputTokens,omitempty"`
// Tool call ID of the parent tool invocation when this event originates from a sub-agent
//
// Parent tool call ID when this usage originates from a sub-agent
ParentToolCallID *string `json:"parentToolCallId,omitempty"`
// Generation phase for phased-output models (e.g., thinking vs. response phases)
Phase *string `json:"phase,omitempty"`
// Opaque/encrypted extended thinking data from Anthropic models. Session-bound and stripped
// on resume.
ReasoningOpaque *string `json:"reasoningOpaque,omitempty"`
// Readable reasoning text from the model's extended thinking
ReasoningText *string `json:"reasoningText,omitempty"`
// Tool invocations requested by the assistant in this message
ToolRequests []ToolRequest `json:"toolRequests,omitempty"`
// Completion ID from the model provider (e.g., chatcmpl-abc123)
APICallID *string `json:"apiCallId,omitempty"`
// Number of tokens read from prompt cache
CacheReadTokens *float64 `json:"cacheReadTokens,omitempty"`
// Number of tokens written to prompt cache
CacheWriteTokens *float64 `json:"cacheWriteTokens,omitempty"`
// Per-request cost and usage data from the CAPI copilot_usage response field
CopilotUsage *CopilotUsage `json:"copilotUsage,omitempty"`
// Model multiplier cost for billing purposes
Cost *float64 `json:"cost,omitempty"`
// Duration of the API call in milliseconds
Duration *float64 `json:"duration,omitempty"`
// What initiated this API call (e.g., "sub-agent", "mcp-sampling"); absent for
// user-initiated calls
Initiator *string `json:"initiator,omitempty"`
// Number of input tokens consumed
InputTokens *float64 `json:"inputTokens,omitempty"`
// Average inter-token latency in milliseconds. Only available for streaming requests
InterTokenLatencyMS *float64 `json:"interTokenLatencyMs,omitempty"`
// Model identifier used for this API call
//
// Model identifier that generated this tool call
//
// Model used by the sub-agent
//
// Model used by the sub-agent (if any model calls succeeded before failure)
Model *string `json:"model,omitempty"`
// Per-quota resource usage snapshots, keyed by quota identifier
QuotaSnapshots map[string]QuotaSnapshot `json:"quotaSnapshots,omitempty"`
// Time to first token in milliseconds. Only available for streaming requests
TtftMS *float64 `json:"ttftMs,omitempty"`
// Reason the current turn was aborted (e.g., "user initiated")
Reason *string `json:"reason,omitempty"`
// Arguments for the tool invocation
//
// Arguments passed to the tool
//
// Arguments to pass to the external tool
Arguments interface{} `json:"arguments"`
// Unique identifier for this tool call
//
// Tool call ID this partial result belongs to
//
// Tool call ID this progress notification belongs to
//
// Unique identifier for the completed tool call
//
// Tool call ID of the parent tool invocation that spawned this sub-agent
//
// The LLM-assigned tool call ID that triggered this request; used by remote UIs to
// correlate responses
//
// Tool call ID from the LLM completion; used to correlate with CompletionChunk.toolCall.id
// for remote UIs
//
// Tool call ID assigned to this external tool invocation
ToolCallID *string `json:"toolCallId,omitempty"`
// Name of the tool the user wants to invoke
//
// Name of the tool being executed
//
// Name of the external tool to invoke
ToolName *string `json:"toolName,omitempty"`
// Name of the MCP server hosting this tool, when the tool is an MCP tool
MCPServerName *string `json:"mcpServerName,omitempty"`
// Original tool name on the MCP server, when the tool is an MCP tool
MCPToolName *string `json:"mcpToolName,omitempty"`
// Incremental output chunk from the running tool
PartialOutput *string `json:"partialOutput,omitempty"`
// Human-readable progress status message (e.g., from an MCP server)
ProgressMessage *string `json:"progressMessage,omitempty"`
// Whether this tool call was explicitly requested by the user rather than the assistant
IsUserRequested *bool `json:"isUserRequested,omitempty"`
// Tool execution result on success
//
// The result of the permission request
Result *Result `json:"result,omitempty"`
// Tool-specific telemetry data (e.g., CodeQL check counts, grep match counts)
ToolTelemetry map[string]interface{} `json:"toolTelemetry,omitempty"`
// Tool names that should be auto-approved when this skill is active
AllowedTools []string `json:"allowedTools,omitempty"`
// Description of the skill from its SKILL.md frontmatter
Description *string `json:"description,omitempty"`
// Name of the invoked skill
//
// Optional name identifier for the message source
Name *string `json:"name,omitempty"`
// Name of the plugin this skill originated from, when applicable
PluginName *string `json:"pluginName,omitempty"`
// Version of the plugin this skill originated from, when applicable
PluginVersion *string `json:"pluginVersion,omitempty"`
// Description of what the sub-agent does
AgentDescription *string `json:"agentDescription,omitempty"`
// Human-readable display name of the sub-agent
//
// Human-readable display name of the selected custom agent
AgentDisplayName *string `json:"agentDisplayName,omitempty"`
// Internal name of the sub-agent
//
// Internal name of the selected custom agent
AgentName *string `json:"agentName,omitempty"`
// Wall-clock duration of the sub-agent execution in milliseconds
DurationMS *float64 `json:"durationMs,omitempty"`
// Total tokens (input + output) consumed by the sub-agent
//
// Total tokens (input + output) consumed before the sub-agent failed
TotalTokens *float64 `json:"totalTokens,omitempty"`
// Total number of tool calls made by the sub-agent
//
// Total number of tool calls made before the sub-agent failed
TotalToolCalls *float64 `json:"totalToolCalls,omitempty"`
// List of tool names available to this agent, or null for all tools
Tools []string `json:"tools"`
// Unique identifier for this hook invocation
//
// Identifier matching the corresponding hook.start event
HookInvocationID *string `json:"hookInvocationId,omitempty"`
// Type of hook being invoked (e.g., "preToolUse", "postToolUse", "sessionStart")
//
// Type of hook that was invoked (e.g., "preToolUse", "postToolUse", "sessionStart")
HookType *string `json:"hookType,omitempty"`
// Input data passed to the hook
Input interface{} `json:"input"`
// Output data produced by the hook
Output interface{} `json:"output"`
// Metadata about the prompt template and its construction
Metadata *Metadata `json:"metadata,omitempty"`
// Message role: "system" for system prompts, "developer" for developer-injected instructions
Role *Role `json:"role,omitempty"`
// Structured metadata identifying what triggered this notification
Kind *KindClass `json:"kind,omitempty"`
// Details of the permission being requested
PermissionRequest *PermissionRequest `json:"permissionRequest,omitempty"`
// Whether the user can provide a free-form text response in addition to predefined choices
AllowFreeform *bool `json:"allowFreeform,omitempty"`
// Predefined choices for the user to select from, if applicable
Choices []string `json:"choices,omitempty"`
// The question or prompt to present to the user
Question *string `json:"question,omitempty"`
// The source that initiated the request (MCP server name, or absent for agent-initiated)
ElicitationSource *string `json:"elicitationSource,omitempty"`
// Elicitation mode; "form" for structured input, "url" for browser-based. Defaults to
// "form" when absent.
Mode *Mode `json:"mode,omitempty"`
// JSON Schema describing the form fields to present to the user (form mode only)
RequestedSchema *RequestedSchema `json:"requestedSchema,omitempty"`
// The JSON-RPC request ID from the MCP protocol
MCPRequestID *MCPRequestID `json:"mcpRequestId"`
// Name of the MCP server that initiated the sampling request
//
// Display name of the MCP server that requires OAuth
//
// Name of the MCP server whose status changed
ServerName *string `json:"serverName,omitempty"`
// URL of the MCP server that requires OAuth
ServerURL *string `json:"serverUrl,omitempty"`
// Static OAuth client configuration, if the server specifies one
StaticClientConfig *StaticClientConfig `json:"staticClientConfig,omitempty"`
// W3C Trace Context traceparent header for the execute_tool span
Traceparent *string `json:"traceparent,omitempty"`
// W3C Trace Context tracestate header for the execute_tool span
Tracestate *string `json:"tracestate,omitempty"`
// The slash command text to be executed (e.g., /help, /clear)
//
// The full command text (e.g., /deploy production)
Command *string `json:"command,omitempty"`
// Raw argument string after the command name
Args *string `json:"args,omitempty"`
// Command name without leading /
CommandName *string `json:"commandName,omitempty"`
// Current list of registered SDK commands
Commands []DataCommand `json:"commands,omitempty"`
// UI capability changes
UI *UI `json:"ui,omitempty"`
// Available actions the user can take (e.g., approve, edit, reject)
Actions []string `json:"actions,omitempty"`
// Full content of the plan file
PlanContent *string `json:"planContent,omitempty"`
// The recommended action for the user to take
RecommendedAction *string `json:"recommendedAction,omitempty"`
// Array of resolved skill metadata
Skills []Skill `json:"skills,omitempty"`
// Array of loaded custom agent metadata
Agents []DataAgent `json:"agents,omitempty"`
// Fatal errors from agent loading
Errors []string `json:"errors,omitempty"`
// Non-fatal warnings from agent loading
Warnings []string `json:"warnings,omitempty"`
// Array of MCP server status summaries
Servers []Server `json:"servers,omitempty"`
// New connection status: connected, failed, needs-auth, pending, disabled, or not_configured
Status *ServerStatus `json:"status,omitempty"`
// Array of discovered extensions and their status
Extensions []Extension `json:"extensions,omitempty"`
}
type DataAgent struct {
// Description of what the agent does
Description string `json:"description"`
// Human-readable display name
DisplayName string `json:"displayName"`
// Unique identifier for the agent
ID string `json:"id"`
// Model override for this agent, if set
Model *string `json:"model,omitempty"`
// Internal name of the agent
Name string `json:"name"`
// Source location: user, project, inherited, remote, or plugin
Source string `json:"source"`
// List of tool names available to this agent
Tools []string `json:"tools"`
// Whether the agent can be selected by the user
UserInvocable bool `json:"userInvocable"`
}
// A user message attachment — a file, directory, code selection, blob, or GitHub reference
//
// # File attachment
//
// # Directory attachment
//
// # Code selection attachment from an editor
//
// # GitHub issue, pull request, or discussion reference
//
// Blob attachment with inline base64-encoded data
type Attachment struct {
// User-facing display name for the attachment
//
// User-facing display name for the selection
DisplayName *string `json:"displayName,omitempty"`
// Optional line range to scope the attachment to a specific section of the file
LineRange *LineRange `json:"lineRange,omitempty"`
// Absolute file path
//
// Absolute directory path
Path *string `json:"path,omitempty"`
// Attachment type discriminator
Type AttachmentType `json:"type"`
// Absolute path to the file containing the selection
FilePath *string `json:"filePath,omitempty"`
// Position range of the selection within the file
Selection *SelectionClass `json:"selection,omitempty"`
// The selected text content
Text *string `json:"text,omitempty"`
// Issue, pull request, or discussion number
Number *float64 `json:"number,omitempty"`
// Type of GitHub reference
ReferenceType *ReferenceType `json:"referenceType,omitempty"`
// Current state of the referenced item (e.g., open, closed, merged)
State *string `json:"state,omitempty"`
// Title of the referenced item
Title *string `json:"title,omitempty"`
// URL to the referenced item on GitHub
URL *string `json:"url,omitempty"`
// Base64-encoded content
Data *string `json:"data,omitempty"`
// MIME type of the inline data
MIMEType *string `json:"mimeType,omitempty"`
}
// Optional line range to scope the attachment to a specific section of the file
type LineRange struct {
// End line number (1-based, inclusive)
End float64 `json:"end"`
// Start line number (1-based)
Start float64 `json:"start"`
}
// Position range of the selection within the file
type SelectionClass struct {
// End position of the selection
End End `json:"end"`
// Start position of the selection
Start Start `json:"start"`
}
// End position of the selection
type End struct {
// End character offset within the line (0-based)
Character float64 `json:"character"`
// End line number (0-based)
Line float64 `json:"line"`
}
// Start position of the selection
type Start struct {
// Start character offset within the line (0-based)
Character float64 `json:"character"`
// Start line number (0-based)
Line float64 `json:"line"`
}
// Background tasks still running when the agent became idle
type BackgroundTasks struct {
// Currently running background agents
Agents []BackgroundTasksAgent `json:"agents"`
// Currently running background shell commands
Shells []Shell `json:"shells"`
}
// A background agent task
type BackgroundTasksAgent struct {
// Unique identifier of the background agent
AgentID string `json:"agentId"`
// Type of the background agent
AgentType string `json:"agentType"`
// Human-readable description of the agent task
Description *string `json:"description,omitempty"`
}
// A background shell command
type Shell struct {
// Human-readable description of the shell command
Description *string `json:"description,omitempty"`
// Unique identifier of the background shell
ShellID string `json:"shellId"`
}
// Aggregate code change metrics for the session
type CodeChanges struct {
// List of file paths that were modified during the session
FilesModified []string `json:"filesModified"`
// Total number of lines added during the session
LinesAdded float64 `json:"linesAdded"`
// Total number of lines removed during the session
LinesRemoved float64 `json:"linesRemoved"`
}
type DataCommand struct {