-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expand file tree
/
Copy pathsession-events.ts
More file actions
5106 lines (5104 loc) · 130 KB
/
session-events.ts
File metadata and controls
5106 lines (5104 loc) · 130 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
*/
export type SessionEvent =
| StartEvent
| ResumeEvent
| RemoteSteerableChangedEvent
| ErrorEvent
| IdleEvent
| TitleChangedEvent
| InfoEvent
| WarningEvent
| ModelChangeEvent
| ModeChangedEvent
| PlanChangedEvent
| WorkspaceFileChangedEvent
| HandoffEvent
| TruncationEvent
| SnapshotRewindEvent
| ShutdownEvent
| ContextChangedEvent
| UsageInfoEvent
| CompactionStartEvent
| CompactionCompleteEvent
| TaskCompleteEvent
| UserMessageEvent
| PendingMessagesModifiedEvent
| AssistantTurnStartEvent
| AssistantIntentEvent
| AssistantReasoningEvent
| AssistantReasoningDeltaEvent
| AssistantStreamingDeltaEvent
| AssistantMessageEvent
| AssistantMessageStartEvent
| AssistantMessageDeltaEvent
| AssistantTurnEndEvent
| AssistantUsageEvent
| ModelCallFailureEvent
| AbortEvent
| ToolUserRequestedEvent
| ToolExecutionStartEvent
| ToolExecutionPartialResultEvent
| ToolExecutionProgressEvent
| ToolExecutionCompleteEvent
| SkillInvokedEvent
| SubagentStartedEvent
| SubagentCompletedEvent
| SubagentFailedEvent
| SubagentSelectedEvent
| SubagentDeselectedEvent
| HookStartEvent
| HookEndEvent
| SystemMessageEvent
| SystemNotificationEvent
| PermissionRequestedEvent
| PermissionCompletedEvent
| UserInputRequestedEvent
| UserInputCompletedEvent
| ElicitationRequestedEvent
| ElicitationCompletedEvent
| SamplingRequestedEvent
| SamplingCompletedEvent
| McpOauthRequiredEvent
| McpOauthCompletedEvent
| ExternalToolRequestedEvent
| ExternalToolCompletedEvent
| CommandQueuedEvent
| CommandExecuteEvent
| CommandCompletedEvent
| AutoModeSwitchRequestedEvent
| AutoModeSwitchCompletedEvent
| CommandsChangedEvent
| CapabilitiesChangedEvent
| ExitPlanModeRequestedEvent
| ExitPlanModeCompletedEvent
| ToolsUpdatedEvent
| BackgroundTasksChangedEvent
| SkillsLoadedEvent
| CustomAgentsUpdatedEvent
| McpServersLoadedEvent
| McpServerStatusChangedEvent
| ExtensionsLoadedEvent;
/**
* Hosting platform type of the repository (github or ado)
*/
export type WorkingDirectoryContextHostType = "github" | "ado";
/**
* The type of operation performed on the plan file
*/
export type PlanChangedOperation = "create" | "update" | "delete";
/**
* Whether the file was newly created or updated
*/
export type WorkspaceFileChangedOperation = "create" | "update";
/**
* Origin type of the session being handed off
*/
export type HandoffSourceType = "remote" | "local";
/**
* Whether the session ended normally ("routine") or due to a crash/fatal error ("error")
*/
export type ShutdownType = "routine" | "error";
/**
* The agent mode that was active when this message was sent
*/
export type UserMessageAgentMode = "interactive" | "plan" | "autopilot" | "shell";
/**
* A user message attachment — a file, directory, code selection, blob, or GitHub reference
*/
export type UserMessageAttachment =
| UserMessageAttachmentFile
| UserMessageAttachmentDirectory
| UserMessageAttachmentSelection
| UserMessageAttachmentGithubReference
| UserMessageAttachmentBlob;
/**
* Type of GitHub reference
*/
export type UserMessageAttachmentGithubReferenceType = "issue" | "pr" | "discussion";
/**
* Tool call type: "function" for standard tool calls, "custom" for grammar-based tool calls. Defaults to "function" when absent.
*/
export type AssistantMessageToolRequestType = "function" | "custom";
/**
* Where the failed model call originated
*/
export type ModelCallFailureSource = "top_level" | "subagent" | "mcp_sampling";
/**
* A content block within a tool result, which may be text, terminal output, image, audio, or a resource
*/
export type ToolExecutionCompleteContent =
| ToolExecutionCompleteContentText
| ToolExecutionCompleteContentTerminal
| ToolExecutionCompleteContentImage
| ToolExecutionCompleteContentAudio
| ToolExecutionCompleteContentResourceLink
| ToolExecutionCompleteContentResource;
/**
* Theme variant this icon is intended for
*/
export type ToolExecutionCompleteContentResourceLinkIconTheme = "light" | "dark";
/**
* The embedded resource contents, either text or base64-encoded binary
*/
export type ToolExecutionCompleteContentResourceDetails = EmbeddedTextResourceContents | EmbeddedBlobResourceContents;
/**
* Message role: "system" for system prompts, "developer" for developer-injected instructions
*/
export type SystemMessageRole = "system" | "developer";
/**
* Structured metadata identifying what triggered this notification
*/
export type SystemNotification =
| SystemNotificationAgentCompleted
| SystemNotificationAgentIdle
| SystemNotificationNewInboxMessage
| SystemNotificationShellCompleted
| SystemNotificationShellDetachedCompleted
| SystemNotificationInstructionDiscovered;
/**
* Whether the agent completed successfully or failed
*/
export type SystemNotificationAgentCompletedStatus = "completed" | "failed";
/**
* Details of the permission being requested
*/
export type PermissionRequest =
| PermissionRequestShell
| PermissionRequestWrite
| PermissionRequestRead
| PermissionRequestMcp
| PermissionRequestUrl
| PermissionRequestMemory
| PermissionRequestCustomTool
| PermissionRequestHook;
/**
* Whether this is a store or vote memory operation
*/
export type PermissionRequestMemoryAction = "store" | "vote";
/**
* Vote direction (vote only)
*/
export type PermissionRequestMemoryDirection = "upvote" | "downvote";
/**
* Derived user-facing permission prompt details for UI consumers
*/
export type PermissionPromptRequest =
| PermissionPromptRequestCommands
| PermissionPromptRequestWrite
| PermissionPromptRequestRead
| PermissionPromptRequestMcp
| PermissionPromptRequestUrl
| PermissionPromptRequestMemory
| PermissionPromptRequestCustomTool
| PermissionPromptRequestPath
| PermissionPromptRequestHook;
/**
* Whether this is a store or vote memory operation
*/
export type PermissionPromptRequestMemoryAction = "store" | "vote";
/**
* Vote direction (vote only)
*/
export type PermissionPromptRequestMemoryDirection = "upvote" | "downvote";
/**
* Underlying permission kind that needs path approval
*/
export type PermissionPromptRequestPathAccessKind = "read" | "shell" | "write";
/**
* The result of the permission request
*/
export type PermissionResult =
| PermissionApproved
| PermissionApprovedForSession
| PermissionApprovedForLocation
| PermissionCancelled
| PermissionDeniedByRules
| PermissionDeniedNoApprovalRuleAndCouldNotRequestFromUser
| PermissionDeniedInteractivelyByUser
| PermissionDeniedByContentExclusionPolicy
| PermissionDeniedByPermissionRequestHook;
/**
* The approval to add as a session-scoped rule
*/
export type UserToolSessionApproval =
| UserToolSessionApprovalCommands
| UserToolSessionApprovalRead
| UserToolSessionApprovalWrite
| UserToolSessionApprovalMcp
| UserToolSessionApprovalMemory
| UserToolSessionApprovalCustomTool;
/**
* Elicitation mode; "form" for structured input, "url" for browser-based. Defaults to "form" when absent.
*/
export type ElicitationRequestedMode = "form" | "url";
/**
* The user action: "accept" (submitted form), "decline" (explicitly refused), or "cancel" (dismissed)
*/
export type ElicitationCompletedAction = "accept" | "decline" | "cancel";
export type ElicitationCompletedContent = string | number | boolean | string[];
/**
* Connection status: connected, failed, needs-auth, pending, disabled, or not_configured
*/
export type McpServersLoadedServerStatus =
| "connected"
| "failed"
| "needs-auth"
| "pending"
| "disabled"
| "not_configured";
/**
* New connection status: connected, failed, needs-auth, pending, disabled, or not_configured
*/
export type McpServerStatusChangedStatus =
| "connected"
| "failed"
| "needs-auth"
| "pending"
| "disabled"
| "not_configured";
/**
* Discovery source
*/
export type ExtensionsLoadedExtensionSource = "project" | "user";
/**
* Current status: running, disabled, failed, or starting
*/
export type ExtensionsLoadedExtensionStatus = "running" | "disabled" | "failed" | "starting";
export interface StartEvent {
/**
* Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
*/
agentId?: string;
data: StartData;
/**
* When true, the event is transient and not persisted to the session event log on disk
*/
ephemeral?: boolean;
/**
* Unique event identifier (UUID v4), generated when the event is emitted
*/
id: string;
/**
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
*/
parentId: string | null;
/**
* ISO 8601 timestamp when the event was created
*/
timestamp: string;
type: "session.start";
}
/**
* Session initialization metadata including context and configuration
*/
export interface StartData {
/**
* Whether the session was already in use by another client at start time
*/
alreadyInUse?: boolean;
context?: WorkingDirectoryContext;
/**
* Version string of the Copilot application
*/
copilotVersion: string;
/**
* Identifier of the software producing the events (e.g., "copilot-agent")
*/
producer: string;
/**
* Reasoning effort level used for model calls, if applicable (e.g. "low", "medium", "high", "xhigh")
*/
reasoningEffort?: string;
/**
* Whether this session supports remote steering via Mission Control
*/
remoteSteerable?: boolean;
/**
* Model selected at session creation time, if any
*/
selectedModel?: string;
/**
* Unique identifier for the session
*/
sessionId: string;
/**
* ISO 8601 timestamp when the session was created
*/
startTime: string;
/**
* Schema version number for the session event format
*/
version: number;
}
/**
* Working directory and git context at session start
*/
export interface WorkingDirectoryContext {
/**
* Base commit of current git branch at session start time
*/
baseCommit?: string;
/**
* Current git branch name
*/
branch?: string;
/**
* Current working directory path
*/
cwd: string;
/**
* Root directory of the git repository, resolved via git rev-parse
*/
gitRoot?: string;
/**
* Head commit of current git branch at session start time
*/
headCommit?: string;
hostType?: WorkingDirectoryContextHostType;
/**
* Repository identifier derived from the git remote URL ("owner/name" for GitHub, "org/project/repo" for Azure DevOps)
*/
repository?: string;
/**
* Raw host string from the git remote URL (e.g. "github.com", "mycompany.ghe.com", "dev.azure.com")
*/
repositoryHost?: string;
}
export interface ResumeEvent {
/**
* Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
*/
agentId?: string;
data: ResumeData;
/**
* When true, the event is transient and not persisted to the session event log on disk
*/
ephemeral?: boolean;
/**
* Unique event identifier (UUID v4), generated when the event is emitted
*/
id: string;
/**
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
*/
parentId: string | null;
/**
* ISO 8601 timestamp when the event was created
*/
timestamp: string;
type: "session.resume";
}
/**
* Session resume metadata including current context and event count
*/
export interface ResumeData {
/**
* Whether the session was already in use by another client at resume time
*/
alreadyInUse?: boolean;
context?: WorkingDirectoryContext;
/**
* When true, tool calls and permission requests left in flight by the previous session lifetime remain pending after resume and the agentic loop awaits their results. User sends are queued behind the pending work until all such requests reach a terminal state. When false (the default), any such tool calls and permission requests are immediately marked as interrupted on resume.
*/
continuePendingWork?: boolean;
/**
* Total number of persisted events in the session at the time of resume
*/
eventCount: number;
/**
* Reasoning effort level used for model calls, if applicable (e.g. "low", "medium", "high", "xhigh")
*/
reasoningEffort?: string;
/**
* Whether this session supports remote steering via Mission Control
*/
remoteSteerable?: boolean;
/**
* ISO 8601 timestamp when the session was resumed
*/
resumeTime: string;
/**
* Model currently selected at resume time
*/
selectedModel?: string;
/**
* True when this resume attached to a session that the runtime already had running in-memory (for example, an extension joining a session another client was actively driving). False (or omitted) for cold resumes — the runtime had to reconstitute the session from its persisted event log.
*/
sessionWasActive?: boolean;
}
export interface RemoteSteerableChangedEvent {
/**
* Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
*/
agentId?: string;
data: RemoteSteerableChangedData;
/**
* When true, the event is transient and not persisted to the session event log on disk
*/
ephemeral?: boolean;
/**
* Unique event identifier (UUID v4), generated when the event is emitted
*/
id: string;
/**
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
*/
parentId: string | null;
/**
* ISO 8601 timestamp when the event was created
*/
timestamp: string;
type: "session.remote_steerable_changed";
}
/**
* Notifies Mission Control that the session's remote steering capability has changed
*/
export interface RemoteSteerableChangedData {
/**
* Whether this session now supports remote steering via Mission Control
*/
remoteSteerable: boolean;
}
export interface ErrorEvent {
/**
* Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
*/
agentId?: string;
data: ErrorData;
/**
* When true, the event is transient and not persisted to the session event log on disk
*/
ephemeral?: boolean;
/**
* Unique event identifier (UUID v4), generated when the event is emitted
*/
id: string;
/**
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
*/
parentId: string | null;
/**
* ISO 8601 timestamp when the event was created
*/
timestamp: string;
type: "session.error";
}
/**
* Error details for timeline display including message and optional diagnostic information
*/
export interface ErrorData {
/**
* Only set on `errorType: "rate_limit"`. When `true`, the runtime will follow this error with an `auto_mode_switch.requested` event (or silently switch if `continueOnAutoMode` is enabled). UI clients can use this flag to suppress duplicate rendering of the rate-limit error when they show their own auto-mode-switch prompt.
*/
eligibleForAutoSwitch?: boolean;
/**
* Fine-grained error code from the upstream provider, when available. For `errorType: "rate_limit"`, this is one of the `RateLimitErrorCode` values (e.g., `"user_weekly_rate_limited"`, `"user_global_rate_limited"`, `"rate_limited"`, `"user_model_rate_limited"`, `"integration_rate_limited"`).
*/
errorCode?: string;
/**
* Category of error (e.g., "authentication", "authorization", "quota", "rate_limit", "context_limit", "query")
*/
errorType: string;
/**
* Human-readable error message
*/
message: string;
/**
* GitHub request tracing ID (x-github-request-id header) for correlating with server-side logs
*/
providerCallId?: string;
/**
* Error stack trace, when available
*/
stack?: string;
/**
* HTTP status code from the upstream request, if applicable
*/
statusCode?: number;
/**
* Optional URL associated with this error that the user can open in a browser
*/
url?: string;
}
export interface IdleEvent {
/**
* Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
*/
agentId?: string;
data: IdleData;
ephemeral: true;
/**
* Unique event identifier (UUID v4), generated when the event is emitted
*/
id: string;
/**
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
*/
parentId: string | null;
/**
* ISO 8601 timestamp when the event was created
*/
timestamp: string;
type: "session.idle";
}
/**
* Payload indicating the session is idle with no background agents in flight
*/
export interface IdleData {
/**
* True when the preceding agentic loop was cancelled via abort signal
*/
aborted?: boolean;
}
export interface TitleChangedEvent {
/**
* Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
*/
agentId?: string;
data: TitleChangedData;
ephemeral: true;
/**
* Unique event identifier (UUID v4), generated when the event is emitted
*/
id: string;
/**
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
*/
parentId: string | null;
/**
* ISO 8601 timestamp when the event was created
*/
timestamp: string;
type: "session.title_changed";
}
/**
* Session title change payload containing the new display title
*/
export interface TitleChangedData {
/**
* The new display title for the session
*/
title: string;
}
export interface InfoEvent {
/**
* Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
*/
agentId?: string;
data: InfoData;
/**
* When true, the event is transient and not persisted to the session event log on disk
*/
ephemeral?: boolean;
/**
* Unique event identifier (UUID v4), generated when the event is emitted
*/
id: string;
/**
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
*/
parentId: string | null;
/**
* ISO 8601 timestamp when the event was created
*/
timestamp: string;
type: "session.info";
}
/**
* Informational message for timeline display with categorization
*/
export interface InfoData {
/**
* Category of informational message (e.g., "notification", "timing", "context_window", "mcp", "snapshot", "configuration", "authentication", "model")
*/
infoType: string;
/**
* Human-readable informational message for display in the timeline
*/
message: string;
/**
* Optional actionable tip displayed with this message
*/
tip?: string;
/**
* Optional URL associated with this message that the user can open in a browser
*/
url?: string;
}
export interface WarningEvent {
/**
* Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
*/
agentId?: string;
data: WarningData;
/**
* When true, the event is transient and not persisted to the session event log on disk
*/
ephemeral?: boolean;
/**
* Unique event identifier (UUID v4), generated when the event is emitted
*/
id: string;
/**
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
*/
parentId: string | null;
/**
* ISO 8601 timestamp when the event was created
*/
timestamp: string;
type: "session.warning";
}
/**
* Warning message for timeline display with categorization
*/
export interface WarningData {
/**
* Human-readable warning message for display in the timeline
*/
message: string;
/**
* Optional URL associated with this warning that the user can open in a browser
*/
url?: string;
/**
* Category of warning (e.g., "subscription", "policy", "mcp")
*/
warningType: string;
}
export interface ModelChangeEvent {
/**
* Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
*/
agentId?: string;
data: ModelChangeData;
/**
* When true, the event is transient and not persisted to the session event log on disk
*/
ephemeral?: boolean;
/**
* Unique event identifier (UUID v4), generated when the event is emitted
*/
id: string;
/**
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
*/
parentId: string | null;
/**
* ISO 8601 timestamp when the event was created
*/
timestamp: string;
type: "session.model_change";
}
/**
* Model change details including previous and new model identifiers
*/
export interface ModelChangeData {
/**
* Reason the change happened, when not user-initiated. Currently `"rate_limit_auto_switch"` for changes triggered by the auto-mode-switch rate-limit recovery path. UI clients can use this to render contextual copy.
*/
cause?: string;
/**
* Newly selected model identifier
*/
newModel: string;
/**
* Model that was previously selected, if any
*/
previousModel?: string;
/**
* Reasoning effort level before the model change, if applicable
*/
previousReasoningEffort?: string;
/**
* Reasoning effort level after the model change, if applicable
*/
reasoningEffort?: string;
}
export interface ModeChangedEvent {
/**
* Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
*/
agentId?: string;
data: ModeChangedData;
/**
* When true, the event is transient and not persisted to the session event log on disk
*/
ephemeral?: boolean;
/**
* Unique event identifier (UUID v4), generated when the event is emitted
*/
id: string;
/**
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
*/
parentId: string | null;
/**
* ISO 8601 timestamp when the event was created
*/
timestamp: string;
type: "session.mode_changed";
}
/**
* Agent mode change details including previous and new modes
*/
export interface ModeChangedData {
/**
* Agent mode after the change (e.g., "interactive", "plan", "autopilot")
*/
newMode: string;
/**
* Agent mode before the change (e.g., "interactive", "plan", "autopilot")
*/
previousMode: string;
}
export interface PlanChangedEvent {
/**
* Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
*/
agentId?: string;
data: PlanChangedData;
/**
* When true, the event is transient and not persisted to the session event log on disk
*/
ephemeral?: boolean;
/**
* Unique event identifier (UUID v4), generated when the event is emitted
*/
id: string;
/**
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
*/
parentId: string | null;
/**
* ISO 8601 timestamp when the event was created
*/
timestamp: string;
type: "session.plan_changed";
}
/**
* Plan file operation details indicating what changed
*/
export interface PlanChangedData {
operation: PlanChangedOperation;
}
export interface WorkspaceFileChangedEvent {
/**
* Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
*/
agentId?: string;
data: WorkspaceFileChangedData;
/**
* When true, the event is transient and not persisted to the session event log on disk
*/
ephemeral?: boolean;
/**
* Unique event identifier (UUID v4), generated when the event is emitted
*/
id: string;
/**
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
*/
parentId: string | null;
/**
* ISO 8601 timestamp when the event was created
*/
timestamp: string;
type: "session.workspace_file_changed";
}
/**
* Workspace file change details including path and operation type
*/
export interface WorkspaceFileChangedData {
operation: WorkspaceFileChangedOperation;
/**
* Relative path within the session workspace files directory
*/
path: string;
}
export interface HandoffEvent {
/**
* Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
*/
agentId?: string;
data: HandoffData;
/**
* When true, the event is transient and not persisted to the session event log on disk
*/
ephemeral?: boolean;
/**
* Unique event identifier (UUID v4), generated when the event is emitted
*/
id: string;
/**
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
*/
parentId: string | null;
/**
* ISO 8601 timestamp when the event was created
*/
timestamp: string;
type: "session.handoff";
}
/**
* Session handoff metadata including source, context, and repository information
*/
export interface HandoffData {
/**
* Additional context information for the handoff
*/
context?: string;
/**
* ISO 8601 timestamp when the handoff occurred
*/
handoffTime: string;
/**
* GitHub host URL for the source session (e.g., https://github.com or https://tenant.ghe.com)
*/
host?: string;
/**
* Session ID of the remote session being handed off
*/
remoteSessionId?: string;
repository?: HandoffRepository;
sourceType: HandoffSourceType;
/**
* Summary of the work done in the source session
*/
summary?: string;
}
/**
* Repository context for the handed-off session
*/
export interface HandoffRepository {
/**
* Git branch name, if applicable
*/
branch?: string;
/**
* Repository name
*/
name: string;
/**
* Repository owner (user or organization)
*/
owner: string;
}
export interface TruncationEvent {
/**
* Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
*/
agentId?: string;
data: TruncationData;
/**
* When true, the event is transient and not persisted to the session event log on disk
*/
ephemeral?: boolean;
/**
* Unique event identifier (UUID v4), generated when the event is emitted
*/
id: string;
/**
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
*/
parentId: string | null;
/**
* ISO 8601 timestamp when the event was created
*/
timestamp: string;
type: "session.truncation";
}
/**
* Conversation truncation statistics including token counts and removed content metrics
*/
export interface TruncationData {
/**
* Number of messages removed by truncation
*/
messagesRemovedDuringTruncation: number;
/**
* Identifier of the component that performed truncation (e.g., "BasicTruncator")
*/
performedBy: string;
/**
* Number of conversation messages after truncation
*/
postTruncationMessagesLength: number;
/**
* Total tokens in conversation messages after truncation
*/
postTruncationTokensInMessages: number;
/**
* Number of conversation messages before truncation
*/
preTruncationMessagesLength: number;
/**
* Total tokens in conversation messages before truncation
*/
preTruncationTokensInMessages: number;
/**
* Maximum token count for the model's context window
*/
tokenLimit: number;
/**
* Number of tokens removed by truncation
*/
tokensRemovedDuringTruncation: number;
}
export interface SnapshotRewindEvent {
/**
* Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
*/
agentId?: string;
data: SnapshotRewindData;
ephemeral: true;
/**
* Unique event identifier (UUID v4), generated when the event is emitted
*/
id: string;
/**
* ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
*/
parentId: string | null;
/**
* ISO 8601 timestamp when the event was created
*/
timestamp: string;
type: "session.snapshot_rewind";
}
/**
* Session rewind details including target event and count of removed events
*/
export interface SnapshotRewindData {
/**
* Number of events that were removed by the rewind
*/
eventsRemoved: number;
/**
* Event ID that was rewound to; this event and all after it were removed
*/
upToEventId: string;
}
export interface ShutdownEvent {
/**
* Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
*/
agentId?: string;
data: ShutdownData;
/**
* When true, the event is transient and not persisted to the session event log on disk
*/
ephemeral?: boolean;
/**
* Unique event identifier (UUID v4), generated when the event is emitted
*/
id: string;