-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Expand file tree
/
Copy pathsession-events.ts
More file actions
8677 lines (8675 loc) · 233 KB
/
Copy pathsession-events.ts
File metadata and controls
8677 lines (8675 loc) · 233 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
*/
/**
* Union of all session event variants emitted by the Copilot CLI runtime.
*/
export type SessionEvent =
| StartEvent
| ResumeEvent
| RemoteSteerableChangedEvent
| ErrorEvent
| IdleEvent
| TitleChangedEvent
| ScheduleCreatedEvent
| ScheduleCancelledEvent
| ScheduleRearmedEvent
| AutopilotObjectiveChangedEvent
| InfoEvent
| WarningEvent
| ModelChangeEvent
| ModeChangedEvent
| SessionLimitsChangedEvent
| PermissionsChangedEvent
| PlanChangedEvent
| TodosChangedEvent
| WorkspaceFileChangedEvent
| HandoffEvent
| TruncationEvent
| SnapshotRewindEvent
| ShutdownEvent
| UsageCheckpointEvent
| ContextChangedEvent
| UsageInfoEvent
| CompactionStartEvent
| CompactionCompleteEvent
| TaskCompleteEvent
| UserMessageEvent
| PendingMessagesModifiedEvent
| AssistantTurnStartEvent
| AssistantIntentEvent
| AssistantReasoningEvent
| AssistantReasoningDeltaEvent
| AssistantStreamingDeltaEvent
| AssistantMessageEvent
| AssistantMessageStartEvent
| AssistantMessageDeltaEvent
| AssistantTurnEndEvent
| AssistantIdleEvent
| AssistantUsageEvent
| ModelCallFailureEvent
| AbortEvent
| ToolUserRequestedEvent
| ToolExecutionStartEvent
| ToolExecutionPartialResultEvent
| ToolExecutionProgressEvent
| ToolExecutionCompleteEvent
| SkillInvokedEvent
| SubagentStartedEvent
| SubagentCompletedEvent
| SubagentFailedEvent
| SubagentSelectedEvent
| SubagentDeselectedEvent
| HookStartEvent
| HookEndEvent
| HookProgressEvent
| BinaryAssetEvent
| SystemMessageEvent
| SystemNotificationEvent
| PermissionRequestedEvent
| PermissionCompletedEvent
| UserInputRequestedEvent
| UserInputCompletedEvent
| ElicitationRequestedEvent
| ElicitationCompletedEvent
| SamplingRequestedEvent
| SamplingCompletedEvent
| McpOauthRequiredEvent
| McpOauthCompletedEvent
| McpHeadersRefreshRequiredEvent
| McpHeadersRefreshCompletedEvent
| CustomNotificationEvent
| ExternalToolRequestedEvent
| ExternalToolCompletedEvent
| CommandQueuedEvent
| CommandExecuteEvent
| CommandCompletedEvent
| AutoModeSwitchRequestedEvent
| AutoModeSwitchCompletedEvent
| SessionLimitsExhaustedRequestedEvent
| SessionLimitsExhaustedCompletedEvent
| CommandsChangedEvent
| CapabilitiesChangedEvent
| ExitPlanModeRequestedEvent
| ExitPlanModeCompletedEvent
| ToolsUpdatedEvent
| BackgroundTasksChangedEvent
| SkillsLoadedEvent
| CustomAgentsUpdatedEvent
| McpServersLoadedEvent
| McpServerStatusChangedEvent
| ExtensionsLoadedEvent
| CanvasOpenedEvent
| CanvasRegistryChangedEvent
| CanvasClosedEvent
| CanvasUnavailableEvent
| CanvasRecordedEvent
| CanvasRemovedEvent
| ExtensionsAttachmentsPushedEvent
| McpAppToolCallCompleteEvent;
/**
* Hosting platform type of the repository (github or ado)
*/
export type WorkingDirectoryContextHostType =
/** Repository is hosted on GitHub. */
| "github"
/** Repository is hosted on Azure DevOps. */
| "ado";
/**
* Allowed values for the `ContextTier` enumeration.
*/
export type ContextTier =
/** Default context tier with standard context window size. */
| "default"
/** Extended context tier with a larger context window. */
| "long_context";
/**
* Reasoning summary mode used for model calls, if applicable (e.g. "none", "concise", "detailed")
*/
export type ReasoningSummary =
/** Do not request reasoning summaries from the model. */
| "none"
/** Request a concise summary of the model's reasoning. */
| "concise"
/** Request a detailed summary of the model's reasoning. */
| "detailed";
/**
* The type of operation performed on the autopilot objective state file
*/
export type AutopilotObjectiveChangedOperation =
/** Autopilot objective state file was created for a new objective. */
| "create"
/** Autopilot objective state file was updated for an existing objective. */
| "update"
/** Autopilot objective state file was deleted or cleared. */
| "delete";
/**
* Current autopilot objective status, if one exists
*/
export type AutopilotObjectiveChangedStatus =
/** Objective is active and can drive autopilot continuations. */
| "active"
/** Objective is paused and will not drive autopilot continuations. */
| "paused"
/** Legacy objective state indicating the previous continuation cap was reached. */
| "cap_reached"
/** Objective was completed by the agent. */
| "completed";
/**
* The session mode the agent is operating in
*/
export type SessionMode =
/** The agent is responding interactively to the user. */
| "interactive"
/** The agent is preparing a plan before making changes. */
| "plan"
/** The agent is working autonomously toward task completion. */
| "autopilot";
/**
* The type of operation performed on the plan file
*/
export type PlanChangedOperation =
/** The plan file was created. */
| "create"
/** The plan file was updated. */
| "update"
/** The plan file was deleted. */
| "delete";
/**
* Whether the file was newly created or updated
*/
export type WorkspaceFileChangedOperation =
/** The workspace file was created. */
| "create"
/** The workspace file was updated. */
| "update";
/**
* Origin type of the session being handed off
*/
export type HandoffSourceType =
/** The handoff originated from a remote session. */
| "remote"
/** The handoff originated from a local session. */
| "local";
/**
* Whether the session ended normally ("routine") or due to a crash/fatal error ("error")
*/
export type ShutdownType =
/** The session ended normally. */
| "routine"
/** The session ended because of a crash or fatal error. */
| "error";
/**
* The agent mode that was active when this message was sent
*/
export type UserMessageAgentMode =
/** The agent is responding interactively to the user. */
| "interactive"
/** The agent is preparing a plan before making changes. */
| "plan"
/** The agent is working autonomously toward task completion. */
| "autopilot"
/** The agent is in shell-focused UI mode. */
| "shell";
/**
* A user message attachment — a file, directory, code selection, blob, GitHub reference, GitHub-anchored pointer, or extension-supplied context payload
*/
export type Attachment =
| AttachmentFile
| AttachmentDirectory
| AttachmentSelection
| AttachmentGitHubReference
| AttachmentGitHubCommit
| AttachmentGitHubRelease
| AttachmentGitHubActionsJob
| AttachmentGitHubRepository
| AttachmentGitHubFileDiff
| AttachmentGitHubTreeComparison
| AttachmentGitHubUrl
| AttachmentGitHubFile
| AttachmentGitHubSnippet
| AttachmentBlob
| AttachmentExtensionContext;
/**
* Why the binary data is absent: it exceeded the inline size limit, or its asset was unavailable
*/
export type OmittedBinaryOmittedReason =
/** Bytes exceeded the session's inline size limit. */
| "too_large"
/** The referenced binary asset could not be found (e.g. a truncated log). */
| "asset_unavailable";
/**
* Type of GitHub reference
*/
export type AttachmentGitHubReferenceType =
/** GitHub issue reference. */
| "issue"
/** GitHub pull request reference. */
| "pr"
/** GitHub discussion reference. */
| "discussion";
/**
* How this user message was delivered to the agentic loop, relative to whether the loop was already running. This is the timing axis only; the message's origin (human vs. system/command/schedule/skill/etc.) is carried separately by `source`. A system-injected message has a delivery too — e.g. a background-task notification waking an idle agent is `idle`, the same mechanism as a human starting a fresh turn.
*/
export type UserMessageDelivery =
/** Delivered while the loop was idle; starts its own run immediately (a human's fresh turn, or a system notification waking an idle agent). */
| "idle"
/** Injected into the current in-flight run while the agent was busy (immediate mode). */
| "steering"
/** Enqueued while the agent was busy; processed as its own run afterward. */
| "queued";
/**
* The system that produced a citation.
*/
/** @experimental */
export type CitationProvider =
/** Citation produced by an Anthropic (Claude) model response. */
| "anthropic"
/** Citation produced by an OpenAI model response. */
| "openai"
/** Citation synthesized client-side by the runtime from tool output. */
| "client";
/**
* Location within a cited source (character, page, or content-block range) that supports a span.
*/
/** @experimental */
export type CitationLocation = CitationLocationChar | CitationLocationPage | CitationLocationBlock;
/**
* Tool call type: "function" for standard tool calls, "custom" for grammar-based tool calls. Defaults to "function" when absent.
*/
export type AssistantMessageToolRequestType =
/** Standard function-style tool call. */
| "function"
/** Custom grammar-based tool call. */
| "custom";
/**
* API endpoint used for this model call, matching CAPI supported_endpoints vocabulary
*/
export type AssistantUsageApiEndpoint =
/** Chat Completions API endpoint. */
| "/chat/completions"
/** Anthropic Messages API endpoint. */
| "/v1/messages"
/** Responses API endpoint. */
| "/responses"
/** WebSocket Responses API endpoint. */
| "ws:/responses";
/**
* For HTTP 400 failures only: whether the response carried a structured CAPI error envelope (structured_error, a deterministic validation failure) or no error body (bodyless, the transient gateway/proxy signature). Absent for non-400 failures.
*/
export type ModelCallFailureBadRequestKind =
/** The 400 response carried no error body (transient gateway/proxy signature). */
| "bodyless"
/** The 400 response carried a structured CAPI error envelope (deterministic validation failure). */
| "structured_error";
/**
* Where the failed model call originated
*/
export type ModelCallFailureSource =
/** Model call from the top-level agent. */
| "top_level"
/** Model call from a sub-agent. */
| "subagent"
/** Model call from MCP sampling. */
| "mcp_sampling";
/**
* Finite reason code describing why the current turn was aborted
*/
export type AbortReason =
/** The local user requested the abort, for example by pressing Ctrl+C in the CLI. */
| "user_initiated"
/** A remote command requested the abort. */
| "remote_command"
/** An MCP server delivered a user.abort notification. */
| "user_abort";
/**
* Allowed values for the `ToolExecutionStartToolDescriptionMetaUIVisibility` enumeration.
*/
export type ToolExecutionStartToolDescriptionMetaUIVisibility =
/** Tool is callable by the model (LLM tool surface) */
| "model"
/** Tool is callable by the MCP App view (iframe) via session.mcp.apps.callTool */
| "app";
/**
* A model-facing binary result as persisted: full inline data, a size-omitted marker, or a deduplicated asset reference
*/
/** @experimental */
export type PersistedBinaryResult = PersistedBinaryImage | OmittedBinaryResult | BinaryAssetReference;
/**
* Binary result type discriminator. Use "image" for images and "resource" for other binary data.
*/
export type PersistedBinaryImageType =
/** Binary image data. */
| "image"
/** Other binary resource data. */
| "resource";
/**
* Binary result type discriminator. Use "image" for images and "resource" for other binary data.
*/
export type OmittedBinaryType =
/** Binary image data. */
| "image"
/** Other binary resource data. */
| "resource";
/**
* Binary result type discriminator. Use "image" for images and "resource" for other binary data.
*/
export type BinaryAssetReferenceType =
/** Binary image data. */
| "image"
/** Other binary resource data. */
| "resource";
/**
* A content block within a tool result, which may be text, terminal output, image, audio, or a resource
*/
export type ToolExecutionCompleteContent =
| ToolExecutionCompleteContentText
| ToolExecutionCompleteContentTerminal
| ToolExecutionCompleteContentShellExit
| ToolExecutionCompleteContentImage
| ToolExecutionCompleteContentAudio
| ToolExecutionCompleteContentResourceLink
| ToolExecutionCompleteContentResource;
/**
* Theme variant this icon is intended for
*/
export type ToolExecutionCompleteContentResourceLinkIconTheme =
/** Icon intended for light themes. */
| "light"
/** Icon intended for dark themes. */
| "dark";
/**
* The embedded resource contents, either text or base64-encoded binary
*/
export type ToolExecutionCompleteContentResourceDetails = EmbeddedTextResourceContents | EmbeddedBlobResourceContents;
/**
* Allowed values for the `ToolExecutionCompleteToolDescriptionMetaUIVisibility` enumeration.
*/
export type ToolExecutionCompleteToolDescriptionMetaUIVisibility =
/** Tool is callable by the model (LLM tool surface) */
| "model"
/** Tool is callable by the MCP App view (iframe) via session.mcp.apps.callTool */
| "app";
/**
* What triggered the skill invocation: `user-invoked` (explicit user action, such as via a slash command or UI affordance), `agent-invoked` (agent requested the skill), or `context-load` (loaded as part of another context, such as preloading skills configured on a custom agent or subagent)
*/
export type SkillInvokedTrigger =
/** Skill invocation requested explicitly by the user, such as via a slash command or UI affordance. */
| "user-invoked"
/** Skill invocation requested by the agent. */
| "agent-invoked"
/** Skill content loaded as part of another context, such as a configured custom agent or subagent. */
| "context-load";
/**
* Binary asset type discriminator. Use "image" for images and "resource" otherwise.
*/
export type BinaryAssetType =
/** Binary image data. */
| "image"
/** Other binary resource data. */
| "resource";
/**
* Message role: "system" for system prompts, "developer" for developer-injected instructions
*/
export type SystemMessageRole =
/** System prompt message. */
| "system"
/** Developer instruction message. */
| "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 =
/** The agent completed successfully. */
| "completed"
/** The agent failed. */
| "failed";
/**
* Details of the permission being requested
*/
export type PermissionRequest =
| PermissionRequestShell
| PermissionRequestWrite
| PermissionRequestRead
| PermissionRequestMcp
| PermissionRequestUrl
| PermissionRequestMemory
| PermissionRequestCustomTool
| PermissionRequestHook
| PermissionRequestExtensionManagement
| PermissionRequestExtensionPermissionAccess;
/**
* Whether this is a store or vote memory operation
*/
export type PermissionRequestMemoryAction =
/** Store a new memory. */
| "store"
/** Vote on an existing memory. */
| "vote";
/**
* Vote direction (vote only)
*/
export type PermissionRequestMemoryDirection =
/** Vote that the memory is useful or accurate. */
| "upvote"
/** Vote that the memory is incorrect or outdated. */
| "downvote";
/**
* Derived user-facing permission prompt details for UI consumers
*/
export type PermissionPromptRequest =
| PermissionPromptRequestCommands
| PermissionPromptRequestWrite
| PermissionPromptRequestRead
| PermissionPromptRequestMcp
| PermissionPromptRequestUrl
| PermissionPromptRequestMemory
| PermissionPromptRequestCustomTool
| PermissionPromptRequestPath
| PermissionPromptRequestHook
| PermissionPromptRequestExtensionManagement
| PermissionPromptRequestExtensionPermissionAccess;
/**
* Underlying permission kind that needs path approval
*/
export type PermissionPromptRequestPathAccessKind =
/** Read access to a filesystem path. */
| "read"
/** Shell command access involving a filesystem path. */
| "shell"
/** Write access to a filesystem path. */
| "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
| UserToolSessionApprovalExtensionManagement
| UserToolSessionApprovalExtensionPermissionAccess;
/**
* Elicitation mode; "form" for structured input, "url" for browser-based. Defaults to "form" when absent.
*/
export type ElicitationRequestedMode =
/** Structured form-based elicitation. */
| "form"
/** Browser URL-based elicitation. */
| "url";
/**
* The user action: "accept" (submitted form), "decline" (explicitly refused), or "cancel" (dismissed)
*/
export type ElicitationCompletedAction =
/** The user submitted the requested form. */
| "accept"
/** The user explicitly declined the request. */
| "decline"
/** The user dismissed the request. */
| "cancel";
/**
* Reason the runtime is requesting host-provided MCP OAuth credentials
*/
export type McpOauthRequestReason =
/** Initial credentials are required before connecting to the MCP server. */
| "initial"
/** The current host-provided credential was rejected and a replacement is requested. */
| "refresh"
/** The server requires a new host authorization flow before continuing. */
| "reauth"
/** The server requires a credential with additional scope or audience. */
| "upscope";
/**
* How the pending MCP OAuth request was completed
*/
export type McpOauthCompletionOutcome =
/** The request completed with a token-backed OAuth provider. */
| "token"
/** The request completed without an OAuth provider. */
| "cancelled";
/**
* Why dynamic headers are being requested.
*/
export type McpHeadersRefreshRequiredReason =
/** The transport is making its first dynamic header request for this server. */
| "startup"
/** The previously cached dynamic headers expired. */
| "ttl-expired"
/** The server returned 401 and stale dynamic headers were invalidated. */
| "auth-failed";
/**
* How the pending MCP headers refresh request resolved.
*/
export type McpHeadersRefreshCompletedOutcome =
/** The host supplied dynamic headers. */
| "headers"
/** The host responded with no dynamic headers. */
| "none"
/** No response arrived within the bounded window. */
| "timeout";
/**
* The user's auto-mode-switch choice
*/
export type AutoModeSwitchResponse =
/** Switch models for this request. */
| "yes"
/** Switch models now and keep using the replacement automatically. */
| "yes_always"
/** Do not switch models. */
| "no";
/**
* User action selected for an exhausted session limit.
*/
export type SessionLimitsExhaustedResponseAction =
/** Increase the current max by an exact AI Credits amount. */
| "add"
/** Set a new absolute max AI Credits value. */
| "set"
/** Remove the current session limit. */
| "unset"
/** Leave the limit unchanged and cancel the blocked model request. */
| "cancel";
/**
* Exit plan mode action
*/
export type ExitPlanModeAction =
/** Exit plan mode without starting implementation. */
| "exit_only"
/** Exit plan mode and continue in interactive mode. */
| "interactive"
/** Exit plan mode and continue autonomously. */
| "autopilot"
/** Exit plan mode and continue with parallel autonomous workers. */
| "autopilot_fleet";
/**
* Source location type (e.g., project, personal-copilot, plugin, builtin)
*/
export type SkillSource =
/** Skill defined in the current project's skill directories. */
| "project"
/** Skill discovered from a parent directory in the current workspace tree. */
| "inherited"
/** Skill defined in the user's Copilot skill directory. */
| "personal-copilot"
/** Skill defined in the user's personal agents skill directory. */
| "personal-agents"
/** Skill provided by an installed plugin. */
| "plugin"
/** Skill loaded from a configured custom skill directory. */
| "custom"
/** Skill bundled with the runtime. */
| "builtin";
/**
* Configuration source: user, workspace, plugin, or builtin
*/
export type McpServerSource =
/** Server configured in the user's global MCP configuration. */
| "user"
/** Server configured by the current workspace. */
| "workspace"
/** Server contributed by an installed plugin. */
| "plugin"
/** Server bundled with the runtime. */
| "builtin";
/**
* Connection status: connected, failed, needs-auth, pending, disabled, or not_configured
*/
export type McpServerStatus =
/** The server is connected and available. */
| "connected"
/** The server failed to connect or initialize. */
| "failed"
/** The server requires authentication before it can connect. */
| "needs-auth"
/** The server connection is still being established. */
| "pending"
/** The server is configured but disabled. */
| "disabled"
/** The server is not configured for this session. */
| "not_configured";
/**
* Transport mechanism: stdio, http, sse (deprecated), or memory (in-process MCP server)
*/
export type McpServerTransport =
/** Server communicates over stdio with a local child process. */
| "stdio"
/** Server communicates over streamable HTTP. */
| "http"
/** Server communicates over Server-Sent Events (deprecated). */
| "sse"
/** Server is backed by an in-memory runtime implementation. */
| "memory";
/**
* Discovery source
*/
export type ExtensionsLoadedExtensionSource =
/** Extension discovered from the current project. */
| "project"
/** Extension discovered from the user's extension directory. */
| "user"
/** Extension contributed by an installed plugin. */
| "plugin"
/** Extension discovered from the current session's state directory. */
| "session";
/**
* Current status: running, disabled, failed, or starting
*/
export type ExtensionsLoadedExtensionStatus =
/** The extension process is running. */
| "running"
/** The extension is installed but disabled. */
| "disabled"
/** The extension failed to start or crashed. */
| "failed"
/** The extension process is starting. */
| "starting";
/**
* Session event "session.start". Session initialization metadata including context and configuration
*/
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 discriminator. Always "session.start".
*/
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;
/**
* Context tier selected at session creation time for models with tiered context pricing; null when no tier is selected (e.g., non-tiered model)
*/
contextTier?: ContextTier | null;
/**
* Version string of the Copilot application
*/
copilotVersion: string;
/**
* When set, identifies a parent session whose context this session continues — e.g., a detached headless rem-agent run launched on the parent's interactive shutdown. Telemetry from this session is reported under the parent's session_id.
*/
detachedFromSpawningParentSessionId?: 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. "none", "low", "medium", "high", "xhigh", "max")
*/
reasoningEffort?: string;
reasoningSummary?: ReasoningSummary;
/**
* Whether this session supports remote steering via GitHub
*/
remoteSteerable?: boolean;
/**
* Model selected at session creation time, if any
*/
selectedModel?: string;
/**
* Unique identifier for the session
*/
sessionId: string;
sessionLimits?: SessionLimitsConfig;
/**
* 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;
}
/**
* Optional session limits.
*/
export interface SessionLimitsConfig {
/**
* Maximum AI Credits allowed across the session's current accounting window.
*/
maxAiCredits?: number;
}
/**
* Session event "session.resume". Session resume metadata including current context and event count
*/
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 discriminator. Always "session.resume".
*/
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;
/**
* Context tier currently selected at resume time; null when no tier is active
*/
contextTier?: ContextTier | null;
/**
* 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;
/**
* On-disk byte size of the session's persisted events.jsonl file at resume time; omitted when the file does not exist or cannot be stat'd
*/
eventsFileSizeBytes?: number;
/**
* Reasoning effort level used for model calls, if applicable (e.g. "none", "low", "medium", "high", "xhigh", "max")
*/
reasoningEffort?: string;
reasoningSummary?: ReasoningSummary;
/**
* Whether this session supports remote steering via GitHub
*/
remoteSteerable?: boolean;
/**
* ISO 8601 timestamp when the session was resumed
*/
resumeTime: string;
/**
* Model currently selected at resume time
*/
selectedModel?: string;
/**
* Session limits currently configured at resume time; null when no limits are active
*/
sessionLimits?: SessionLimitsConfig | null;
/**
* 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;
}
/**
* Session event "session.remote_steerable_changed". Notifies that the session's remote steering capability has changed
*/
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 discriminator. Always "session.remote_steerable_changed".
*/
type: "session.remote_steerable_changed";
}
/**
* Notifies that the session's remote steering capability has changed
*/
export interface RemoteSteerableChangedData {
/**
* Whether this session now supports remote steering via GitHub
*/
remoteSteerable: boolean;
}
/**
* Session event "session.error". Error details for timeline display including message and optional diagnostic information
*/
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 discriminator. Always "session.error".
*/
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"`). For `errorType: "quota"`, this is the CAPI quota error code (e.g., `"quota_exceeded"`, `"session_quota_exceeded"`, `"billing_not_configured"`).
*/
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;
/**
* Copilot service request ID (x-copilot-service-request-id header) for CAPI log correlation
*/
serviceRequestId?: string;
/**
* Error stack trace, when available
*/
stack?: string;