@github/copilot-sdk 0.3.0 → 1.0.0-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,31 +2,106 @@
2
2
  * AUTO-GENERATED FILE - DO NOT EDIT
3
3
  * Generated from: session-events.schema.json
4
4
  */
5
- 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 | AssistantMessageDeltaEvent | AssistantTurnEndEvent | AssistantUsageEvent | 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;
5
+ /**
6
+ * Union of all session event variants emitted by the Copilot CLI runtime.
7
+ */
8
+ export type SessionEvent = StartEvent | ResumeEvent | RemoteSteerableChangedEvent | ErrorEvent | IdleEvent | TitleChangedEvent | ScheduleCreatedEvent | ScheduleCancelledEvent | AutopilotObjectiveChangedEvent | InfoEvent | WarningEvent | ModelChangeEvent | ModeChangedEvent | PermissionsChangedEvent | 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 | HookProgressEvent | SystemMessageEvent | SystemNotificationEvent | PermissionRequestedEvent | PermissionCompletedEvent | UserInputRequestedEvent | UserInputCompletedEvent | ElicitationRequestedEvent | ElicitationCompletedEvent | SamplingRequestedEvent | SamplingCompletedEvent | McpOauthRequiredEvent | McpOauthCompletedEvent | CustomNotificationEvent | ExternalToolRequestedEvent | ExternalToolCompletedEvent | CommandQueuedEvent | CommandExecuteEvent | CommandCompletedEvent | AutoModeSwitchRequestedEvent | AutoModeSwitchCompletedEvent | CommandsChangedEvent | CapabilitiesChangedEvent | ExitPlanModeRequestedEvent | ExitPlanModeCompletedEvent | ToolsUpdatedEvent | BackgroundTasksChangedEvent | SkillsLoadedEvent | CustomAgentsUpdatedEvent | McpServersLoadedEvent | McpServerStatusChangedEvent | ExtensionsLoadedEvent | CanvasOpenedEvent | CanvasRegistryChangedEvent | McpAppToolCallCompleteEvent;
6
9
  /**
7
10
  * Hosting platform type of the repository (github or ado)
8
11
  */
9
- export type WorkingDirectoryContextHostType = "github" | "ado";
12
+ export type WorkingDirectoryContextHostType =
13
+ /** Repository is hosted on GitHub. */
14
+ "github"
15
+ /** Repository is hosted on Azure DevOps. */
16
+ | "ado";
17
+ /**
18
+ * Reasoning summary mode used for model calls, if applicable (e.g. "none", "concise", "detailed")
19
+ */
20
+ export type ReasoningSummary =
21
+ /** Do not request reasoning summaries from the model. */
22
+ "none"
23
+ /** Request a concise summary of the model's reasoning. */
24
+ | "concise"
25
+ /** Request a detailed summary of the model's reasoning. */
26
+ | "detailed";
27
+ /**
28
+ * The type of operation performed on the autopilot objective state file
29
+ */
30
+ export type AutopilotObjectiveChangedOperation =
31
+ /** Autopilot objective state file was created for a new objective. */
32
+ "create"
33
+ /** Autopilot objective state file was updated for an existing objective. */
34
+ | "update"
35
+ /** Autopilot objective state file was deleted or cleared. */
36
+ | "delete";
37
+ /**
38
+ * Current autopilot objective status, if one exists
39
+ */
40
+ export type AutopilotObjectiveChangedStatus =
41
+ /** Objective is active and can drive autopilot continuations. */
42
+ "active"
43
+ /** Objective is paused and will not drive autopilot continuations. */
44
+ | "paused"
45
+ /** Legacy objective state indicating the previous continuation cap was reached. */
46
+ | "cap_reached"
47
+ /** Objective was completed by the agent. */
48
+ | "completed";
49
+ /**
50
+ * The session mode the agent is operating in
51
+ */
52
+ export type SessionMode =
53
+ /** The agent is responding interactively to the user. */
54
+ "interactive"
55
+ /** The agent is preparing a plan before making changes. */
56
+ | "plan"
57
+ /** The agent is working autonomously toward task completion. */
58
+ | "autopilot";
10
59
  /**
11
60
  * The type of operation performed on the plan file
12
61
  */
13
- export type PlanChangedOperation = "create" | "update" | "delete";
62
+ export type PlanChangedOperation =
63
+ /** The plan file was created. */
64
+ "create"
65
+ /** The plan file was updated. */
66
+ | "update"
67
+ /** The plan file was deleted. */
68
+ | "delete";
14
69
  /**
15
70
  * Whether the file was newly created or updated
16
71
  */
17
- export type WorkspaceFileChangedOperation = "create" | "update";
72
+ export type WorkspaceFileChangedOperation =
73
+ /** The workspace file was created. */
74
+ "create"
75
+ /** The workspace file was updated. */
76
+ | "update";
18
77
  /**
19
78
  * Origin type of the session being handed off
20
79
  */
21
- export type HandoffSourceType = "remote" | "local";
80
+ export type HandoffSourceType =
81
+ /** The handoff originated from a remote session. */
82
+ "remote"
83
+ /** The handoff originated from a local session. */
84
+ | "local";
22
85
  /**
23
86
  * Whether the session ended normally ("routine") or due to a crash/fatal error ("error")
24
87
  */
25
- export type ShutdownType = "routine" | "error";
88
+ export type ShutdownType =
89
+ /** The session ended normally. */
90
+ "routine"
91
+ /** The session ended because of a crash or fatal error. */
92
+ | "error";
26
93
  /**
27
94
  * The agent mode that was active when this message was sent
28
95
  */
29
- export type UserMessageAgentMode = "interactive" | "plan" | "autopilot" | "shell";
96
+ export type UserMessageAgentMode =
97
+ /** The agent is responding interactively to the user. */
98
+ "interactive"
99
+ /** The agent is preparing a plan before making changes. */
100
+ | "plan"
101
+ /** The agent is working autonomously toward task completion. */
102
+ | "autopilot"
103
+ /** The agent is in shell-focused UI mode. */
104
+ | "shell";
30
105
  /**
31
106
  * A user message attachment — a file, directory, code selection, blob, or GitHub reference
32
107
  */
@@ -34,11 +109,53 @@ export type UserMessageAttachment = UserMessageAttachmentFile | UserMessageAttac
34
109
  /**
35
110
  * Type of GitHub reference
36
111
  */
37
- export type UserMessageAttachmentGithubReferenceType = "issue" | "pr" | "discussion";
112
+ export type UserMessageAttachmentGithubReferenceType =
113
+ /** GitHub issue reference. */
114
+ "issue"
115
+ /** GitHub pull request reference. */
116
+ | "pr"
117
+ /** GitHub discussion reference. */
118
+ | "discussion";
38
119
  /**
39
120
  * Tool call type: "function" for standard tool calls, "custom" for grammar-based tool calls. Defaults to "function" when absent.
40
121
  */
41
- export type AssistantMessageToolRequestType = "function" | "custom";
122
+ export type AssistantMessageToolRequestType =
123
+ /** Standard function-style tool call. */
124
+ "function"
125
+ /** Custom grammar-based tool call. */
126
+ | "custom";
127
+ /**
128
+ * API endpoint used for this model call, matching CAPI supported_endpoints vocabulary
129
+ */
130
+ export type AssistantUsageApiEndpoint =
131
+ /** Chat Completions API endpoint. */
132
+ "/chat/completions"
133
+ /** Anthropic Messages API endpoint. */
134
+ | "/v1/messages"
135
+ /** Responses API endpoint. */
136
+ | "/responses"
137
+ /** WebSocket Responses API endpoint. */
138
+ | "ws:/responses";
139
+ /**
140
+ * Where the failed model call originated
141
+ */
142
+ export type ModelCallFailureSource =
143
+ /** Model call from the top-level agent. */
144
+ "top_level"
145
+ /** Model call from a sub-agent. */
146
+ | "subagent"
147
+ /** Model call from MCP sampling. */
148
+ | "mcp_sampling";
149
+ /**
150
+ * Finite reason code describing why the current turn was aborted
151
+ */
152
+ export type AbortReason =
153
+ /** The local user requested the abort, for example by pressing Ctrl+C in the CLI. */
154
+ "user_initiated"
155
+ /** A remote command requested the abort. */
156
+ | "remote_command"
157
+ /** An MCP server delivered a user.abort notification. */
158
+ | "user_abort";
42
159
  /**
43
160
  * A content block within a tool result, which may be text, terminal output, image, audio, or a resource
44
161
  */
@@ -46,80 +163,234 @@ export type ToolExecutionCompleteContent = ToolExecutionCompleteContentText | To
46
163
  /**
47
164
  * Theme variant this icon is intended for
48
165
  */
49
- export type ToolExecutionCompleteContentResourceLinkIconTheme = "light" | "dark";
166
+ export type ToolExecutionCompleteContentResourceLinkIconTheme =
167
+ /** Icon intended for light themes. */
168
+ "light"
169
+ /** Icon intended for dark themes. */
170
+ | "dark";
50
171
  /**
51
172
  * The embedded resource contents, either text or base64-encoded binary
52
173
  */
53
174
  export type ToolExecutionCompleteContentResourceDetails = EmbeddedTextResourceContents | EmbeddedBlobResourceContents;
175
+ /**
176
+ * Allowed values for the `ToolExecutionCompleteToolDescriptionMetaUIVisibility` enumeration.
177
+ */
178
+ export type ToolExecutionCompleteToolDescriptionMetaUIVisibility =
179
+ /** Tool is callable by the model (LLM tool surface) */
180
+ "model"
181
+ /** Tool is callable by the MCP App view (iframe) via session.mcp.apps.callTool */
182
+ | "app";
183
+ /**
184
+ * 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)
185
+ */
186
+ export type SkillInvokedTrigger =
187
+ /** Skill invocation requested explicitly by the user, such as via a slash command or UI affordance. */
188
+ "user-invoked"
189
+ /** Skill invocation requested by the agent. */
190
+ | "agent-invoked"
191
+ /** Skill content loaded as part of another context, such as a configured custom agent or subagent. */
192
+ | "context-load";
54
193
  /**
55
194
  * Message role: "system" for system prompts, "developer" for developer-injected instructions
56
195
  */
57
- export type SystemMessageRole = "system" | "developer";
196
+ export type SystemMessageRole =
197
+ /** System prompt message. */
198
+ "system"
199
+ /** Developer instruction message. */
200
+ | "developer";
58
201
  /**
59
202
  * Structured metadata identifying what triggered this notification
60
203
  */
61
- export type SystemNotification = SystemNotificationAgentCompleted | SystemNotificationAgentIdle | SystemNotificationNewInboxMessage | SystemNotificationShellCompleted | SystemNotificationShellDetachedCompleted;
204
+ export type SystemNotification = SystemNotificationAgentCompleted | SystemNotificationAgentIdle | SystemNotificationNewInboxMessage | SystemNotificationShellCompleted | SystemNotificationShellDetachedCompleted | SystemNotificationInstructionDiscovered;
62
205
  /**
63
206
  * Whether the agent completed successfully or failed
64
207
  */
65
- export type SystemNotificationAgentCompletedStatus = "completed" | "failed";
208
+ export type SystemNotificationAgentCompletedStatus =
209
+ /** The agent completed successfully. */
210
+ "completed"
211
+ /** The agent failed. */
212
+ | "failed";
66
213
  /**
67
214
  * Details of the permission being requested
68
215
  */
69
- export type PermissionRequest = PermissionRequestShell | PermissionRequestWrite | PermissionRequestRead | PermissionRequestMcp | PermissionRequestUrl | PermissionRequestMemory | PermissionRequestCustomTool | PermissionRequestHook;
216
+ export type PermissionRequest = PermissionRequestShell | PermissionRequestWrite | PermissionRequestRead | PermissionRequestMcp | PermissionRequestUrl | PermissionRequestMemory | PermissionRequestCustomTool | PermissionRequestHook | PermissionRequestExtensionManagement | PermissionRequestExtensionPermissionAccess;
70
217
  /**
71
218
  * Whether this is a store or vote memory operation
72
219
  */
73
- export type PermissionRequestMemoryAction = "store" | "vote";
220
+ export type PermissionRequestMemoryAction =
221
+ /** Store a new memory. */
222
+ "store"
223
+ /** Vote on an existing memory. */
224
+ | "vote";
74
225
  /**
75
226
  * Vote direction (vote only)
76
227
  */
77
- export type PermissionRequestMemoryDirection = "upvote" | "downvote";
228
+ export type PermissionRequestMemoryDirection =
229
+ /** Vote that the memory is useful or accurate. */
230
+ "upvote"
231
+ /** Vote that the memory is incorrect or outdated. */
232
+ | "downvote";
78
233
  /**
79
234
  * Derived user-facing permission prompt details for UI consumers
80
235
  */
81
- export type PermissionPromptRequest = PermissionPromptRequestCommands | PermissionPromptRequestWrite | PermissionPromptRequestRead | PermissionPromptRequestMcp | PermissionPromptRequestUrl | PermissionPromptRequestMemory | PermissionPromptRequestCustomTool | PermissionPromptRequestPath | PermissionPromptRequestHook;
82
- /**
83
- * Whether this is a store or vote memory operation
84
- */
85
- export type PermissionPromptRequestMemoryAction = "store" | "vote";
236
+ export type PermissionPromptRequest = PermissionPromptRequestCommands | PermissionPromptRequestWrite | PermissionPromptRequestRead | PermissionPromptRequestMcp | PermissionPromptRequestUrl | PermissionPromptRequestMemory | PermissionPromptRequestCustomTool | PermissionPromptRequestPath | PermissionPromptRequestHook | PermissionPromptRequestExtensionManagement | PermissionPromptRequestExtensionPermissionAccess;
86
237
  /**
87
- * Vote direction (vote only)
238
+ * Underlying permission kind that needs path approval
88
239
  */
89
- export type PermissionPromptRequestMemoryDirection = "upvote" | "downvote";
240
+ export type PermissionPromptRequestPathAccessKind =
241
+ /** Read access to a filesystem path. */
242
+ "read"
243
+ /** Shell command access involving a filesystem path. */
244
+ | "shell"
245
+ /** Write access to a filesystem path. */
246
+ | "write";
90
247
  /**
91
- * Underlying permission kind that needs path approval
248
+ * The result of the permission request
92
249
  */
93
- export type PermissionPromptRequestPathAccessKind = "read" | "shell" | "write";
250
+ export type PermissionResult = PermissionApproved | PermissionApprovedForSession | PermissionApprovedForLocation | PermissionCancelled | PermissionDeniedByRules | PermissionDeniedNoApprovalRuleAndCouldNotRequestFromUser | PermissionDeniedInteractivelyByUser | PermissionDeniedByContentExclusionPolicy | PermissionDeniedByPermissionRequestHook;
94
251
  /**
95
- * The outcome of the permission request
252
+ * The approval to add as a session-scoped rule
96
253
  */
97
- export type PermissionCompletedKind = "approved" | "approved-for-session" | "approved-for-location" | "denied-by-rules" | "denied-no-approval-rule-and-could-not-request-from-user" | "denied-interactively-by-user" | "denied-by-content-exclusion-policy" | "denied-by-permission-request-hook";
254
+ export type UserToolSessionApproval = UserToolSessionApprovalCommands | UserToolSessionApprovalRead | UserToolSessionApprovalWrite | UserToolSessionApprovalMcp | UserToolSessionApprovalMemory | UserToolSessionApprovalCustomTool | UserToolSessionApprovalExtensionManagement | UserToolSessionApprovalExtensionPermissionAccess;
98
255
  /**
99
256
  * Elicitation mode; "form" for structured input, "url" for browser-based. Defaults to "form" when absent.
100
257
  */
101
- export type ElicitationRequestedMode = "form" | "url";
258
+ export type ElicitationRequestedMode =
259
+ /** Structured form-based elicitation. */
260
+ "form"
261
+ /** Browser URL-based elicitation. */
262
+ | "url";
102
263
  /**
103
264
  * The user action: "accept" (submitted form), "decline" (explicitly refused), or "cancel" (dismissed)
104
265
  */
105
- export type ElicitationCompletedAction = "accept" | "decline" | "cancel";
106
- export type ElicitationCompletedContent = string | number | boolean | string[];
266
+ export type ElicitationCompletedAction =
267
+ /** The user submitted the requested form. */
268
+ "accept"
269
+ /** The user explicitly declined the request. */
270
+ | "decline"
271
+ /** The user dismissed the request. */
272
+ | "cancel";
273
+ /**
274
+ * Schema for the `ElicitationCompletedContent` type.
275
+ */
276
+ export type ElicitationCompletedContent = (string | number | boolean | string[]) | undefined;
277
+ /**
278
+ * Source-defined JSON payload for the custom notification
279
+ */
280
+ export type CustomNotificationPayload = string | number | boolean | null | unknown[] | {
281
+ [k: string]: unknown | undefined;
282
+ };
283
+ /**
284
+ * The user's auto-mode-switch choice
285
+ */
286
+ export type AutoModeSwitchResponse =
287
+ /** Switch models for this request. */
288
+ "yes"
289
+ /** Switch models now and keep using the replacement automatically. */
290
+ | "yes_always"
291
+ /** Do not switch models. */
292
+ | "no";
293
+ /**
294
+ * Exit plan mode action
295
+ */
296
+ export type ExitPlanModeAction =
297
+ /** Exit plan mode without starting implementation. */
298
+ "exit_only"
299
+ /** Exit plan mode and continue in interactive mode. */
300
+ | "interactive"
301
+ /** Exit plan mode and continue autonomously. */
302
+ | "autopilot"
303
+ /** Exit plan mode and continue with parallel autonomous workers. */
304
+ | "autopilot_fleet";
305
+ /**
306
+ * Source location type (e.g., project, personal-copilot, plugin, builtin)
307
+ */
308
+ export type SkillSource =
309
+ /** Skill defined in the current project's skill directories. */
310
+ "project"
311
+ /** Skill discovered from a parent directory in the current workspace tree. */
312
+ | "inherited"
313
+ /** Skill defined in the user's Copilot skill directory. */
314
+ | "personal-copilot"
315
+ /** Skill defined in the user's personal agents skill directory. */
316
+ | "personal-agents"
317
+ /** Skill provided by an installed plugin. */
318
+ | "plugin"
319
+ /** Skill loaded from a configured custom skill directory. */
320
+ | "custom"
321
+ /** Skill bundled with the runtime. */
322
+ | "builtin";
323
+ /**
324
+ * Configuration source: user, workspace, plugin, or builtin
325
+ */
326
+ export type McpServerSource =
327
+ /** Server configured in the user's global MCP configuration. */
328
+ "user"
329
+ /** Server configured by the current workspace. */
330
+ | "workspace"
331
+ /** Server contributed by an installed plugin. */
332
+ | "plugin"
333
+ /** Server bundled with the runtime. */
334
+ | "builtin";
107
335
  /**
108
336
  * Connection status: connected, failed, needs-auth, pending, disabled, or not_configured
109
337
  */
110
- export type McpServersLoadedServerStatus = "connected" | "failed" | "needs-auth" | "pending" | "disabled" | "not_configured";
111
- /**
112
- * New connection status: connected, failed, needs-auth, pending, disabled, or not_configured
113
- */
114
- export type McpServerStatusChangedStatus = "connected" | "failed" | "needs-auth" | "pending" | "disabled" | "not_configured";
338
+ export type McpServerStatus =
339
+ /** The server is connected and available. */
340
+ "connected"
341
+ /** The server failed to connect or initialize. */
342
+ | "failed"
343
+ /** The server requires authentication before it can connect. */
344
+ | "needs-auth"
345
+ /** The server connection is still being established. */
346
+ | "pending"
347
+ /** The server is configured but disabled. */
348
+ | "disabled"
349
+ /** The server is not configured for this session. */
350
+ | "not_configured";
351
+ /**
352
+ * Transport mechanism: stdio, http, sse (deprecated), or memory (in-process MCP server)
353
+ */
354
+ export type McpServerTransport =
355
+ /** Server communicates over stdio with a local child process. */
356
+ "stdio"
357
+ /** Server communicates over streamable HTTP. */
358
+ | "http"
359
+ /** Server communicates over Server-Sent Events (deprecated). */
360
+ | "sse"
361
+ /** Server is backed by an in-memory runtime implementation. */
362
+ | "memory";
115
363
  /**
116
364
  * Discovery source
117
365
  */
118
- export type ExtensionsLoadedExtensionSource = "project" | "user";
366
+ export type ExtensionsLoadedExtensionSource =
367
+ /** Extension discovered from the current project. */
368
+ "project"
369
+ /** Extension discovered from the user's extension directory. */
370
+ | "user";
119
371
  /**
120
372
  * Current status: running, disabled, failed, or starting
121
373
  */
122
- export type ExtensionsLoadedExtensionStatus = "running" | "disabled" | "failed" | "starting";
374
+ export type ExtensionsLoadedExtensionStatus =
375
+ /** The extension process is running. */
376
+ "running"
377
+ /** The extension is installed but disabled. */
378
+ | "disabled"
379
+ /** The extension failed to start or crashed. */
380
+ | "failed"
381
+ /** The extension process is starting. */
382
+ | "starting";
383
+ /**
384
+ * Runtime-controlled routing state for the instance. "ready" when the provider connection is live; "stale" when the provider has gone away and the instance is awaiting rebinding.
385
+ */
386
+ export type CanvasOpenedAvailability =
387
+ /** Provider connection is live; actions can be invoked. */
388
+ "ready"
389
+ /** Provider has gone away; the instance is awaiting rebinding. */
390
+ | "stale";
391
+ /**
392
+ * Session event "session.start". Session initialization metadata including context and configuration
393
+ */
123
394
  export interface StartEvent {
124
395
  /**
125
396
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
@@ -142,6 +413,9 @@ export interface StartEvent {
142
413
  * ISO 8601 timestamp when the event was created
143
414
  */
144
415
  timestamp: string;
416
+ /**
417
+ * Type discriminator. Always "session.start".
418
+ */
145
419
  type: "session.start";
146
420
  }
147
421
  /**
@@ -153,20 +427,31 @@ export interface StartData {
153
427
  */
154
428
  alreadyInUse?: boolean;
155
429
  context?: WorkingDirectoryContext;
430
+ /**
431
+ * Context tier selected at session creation time for models with tiered context pricing; null when no tier is selected (e.g., non-tiered model)
432
+ */
433
+ contextTier?: "default"
434
+ /** Extended context tier with a larger context window. */
435
+ | "long_context" | null;
156
436
  /**
157
437
  * Version string of the Copilot application
158
438
  */
159
439
  copilotVersion: string;
440
+ /**
441
+ * 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.
442
+ */
443
+ detachedFromSpawningParentSessionId?: string;
160
444
  /**
161
445
  * Identifier of the software producing the events (e.g., "copilot-agent")
162
446
  */
163
447
  producer: string;
164
448
  /**
165
- * Reasoning effort level used for model calls, if applicable (e.g. "low", "medium", "high", "xhigh")
449
+ * Reasoning effort level used for model calls, if applicable (e.g. "none", "low", "medium", "high", "xhigh", "max")
166
450
  */
167
451
  reasoningEffort?: string;
452
+ reasoningSummary?: ReasoningSummary;
168
453
  /**
169
- * Whether this session supports remote steering via Mission Control
454
+ * Whether this session supports remote steering via GitHub
170
455
  */
171
456
  remoteSteerable?: boolean;
172
457
  /**
@@ -220,6 +505,9 @@ export interface WorkingDirectoryContext {
220
505
  */
221
506
  repositoryHost?: string;
222
507
  }
508
+ /**
509
+ * Session event "session.resume". Session resume metadata including current context and event count
510
+ */
223
511
  export interface ResumeEvent {
224
512
  /**
225
513
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
@@ -242,6 +530,9 @@ export interface ResumeEvent {
242
530
  * ISO 8601 timestamp when the event was created
243
531
  */
244
532
  timestamp: string;
533
+ /**
534
+ * Type discriminator. Always "session.resume".
535
+ */
245
536
  type: "session.resume";
246
537
  }
247
538
  /**
@@ -253,16 +544,27 @@ export interface ResumeData {
253
544
  */
254
545
  alreadyInUse?: boolean;
255
546
  context?: WorkingDirectoryContext;
547
+ /**
548
+ * Context tier currently selected at resume time; null when no tier is active
549
+ */
550
+ contextTier?: "default"
551
+ /** Extended context tier with a larger context window. */
552
+ | "long_context" | null;
553
+ /**
554
+ * 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.
555
+ */
556
+ continuePendingWork?: boolean;
256
557
  /**
257
558
  * Total number of persisted events in the session at the time of resume
258
559
  */
259
560
  eventCount: number;
260
561
  /**
261
- * Reasoning effort level used for model calls, if applicable (e.g. "low", "medium", "high", "xhigh")
562
+ * Reasoning effort level used for model calls, if applicable (e.g. "none", "low", "medium", "high", "xhigh", "max")
262
563
  */
263
564
  reasoningEffort?: string;
565
+ reasoningSummary?: ReasoningSummary;
264
566
  /**
265
- * Whether this session supports remote steering via Mission Control
567
+ * Whether this session supports remote steering via GitHub
266
568
  */
267
569
  remoteSteerable?: boolean;
268
570
  /**
@@ -273,7 +575,14 @@ export interface ResumeData {
273
575
  * Model currently selected at resume time
274
576
  */
275
577
  selectedModel?: string;
578
+ /**
579
+ * 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.
580
+ */
581
+ sessionWasActive?: boolean;
276
582
  }
583
+ /**
584
+ * Session event "session.remote_steerable_changed". Notifies that the session's remote steering capability has changed
585
+ */
277
586
  export interface RemoteSteerableChangedEvent {
278
587
  /**
279
588
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
@@ -296,17 +605,23 @@ export interface RemoteSteerableChangedEvent {
296
605
  * ISO 8601 timestamp when the event was created
297
606
  */
298
607
  timestamp: string;
608
+ /**
609
+ * Type discriminator. Always "session.remote_steerable_changed".
610
+ */
299
611
  type: "session.remote_steerable_changed";
300
612
  }
301
613
  /**
302
- * Notifies Mission Control that the session's remote steering capability has changed
614
+ * Notifies that the session's remote steering capability has changed
303
615
  */
304
616
  export interface RemoteSteerableChangedData {
305
617
  /**
306
- * Whether this session now supports remote steering via Mission Control
618
+ * Whether this session now supports remote steering via GitHub
307
619
  */
308
620
  remoteSteerable: boolean;
309
621
  }
622
+ /**
623
+ * Session event "session.error". Error details for timeline display including message and optional diagnostic information
624
+ */
310
625
  export interface ErrorEvent {
311
626
  /**
312
627
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
@@ -329,12 +644,23 @@ export interface ErrorEvent {
329
644
  * ISO 8601 timestamp when the event was created
330
645
  */
331
646
  timestamp: string;
647
+ /**
648
+ * Type discriminator. Always "session.error".
649
+ */
332
650
  type: "session.error";
333
651
  }
334
652
  /**
335
653
  * Error details for timeline display including message and optional diagnostic information
336
654
  */
337
655
  export interface ErrorData {
656
+ /**
657
+ * 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.
658
+ */
659
+ eligibleForAutoSwitch?: boolean;
660
+ /**
661
+ * 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"`).
662
+ */
663
+ errorCode?: string;
338
664
  /**
339
665
  * Category of error (e.g., "authentication", "authorization", "quota", "rate_limit", "context_limit", "query")
340
666
  */
@@ -347,6 +673,10 @@ export interface ErrorData {
347
673
  * GitHub request tracing ID (x-github-request-id header) for correlating with server-side logs
348
674
  */
349
675
  providerCallId?: string;
676
+ /**
677
+ * Copilot service request ID (x-copilot-service-request-id header) for CAPI log correlation
678
+ */
679
+ serviceRequestId?: string;
350
680
  /**
351
681
  * Error stack trace, when available
352
682
  */
@@ -360,12 +690,18 @@ export interface ErrorData {
360
690
  */
361
691
  url?: string;
362
692
  }
693
+ /**
694
+ * Session event "session.idle". Payload indicating the session is idle with no background agents in flight
695
+ */
363
696
  export interface IdleEvent {
364
697
  /**
365
698
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
366
699
  */
367
700
  agentId?: string;
368
701
  data: IdleData;
702
+ /**
703
+ * Always true for events that are transient and not persisted to the session event log on disk.
704
+ */
369
705
  ephemeral: true;
370
706
  /**
371
707
  * Unique event identifier (UUID v4), generated when the event is emitted
@@ -379,6 +715,9 @@ export interface IdleEvent {
379
715
  * ISO 8601 timestamp when the event was created
380
716
  */
381
717
  timestamp: string;
718
+ /**
719
+ * Type discriminator. Always "session.idle".
720
+ */
382
721
  type: "session.idle";
383
722
  }
384
723
  /**
@@ -390,12 +729,18 @@ export interface IdleData {
390
729
  */
391
730
  aborted?: boolean;
392
731
  }
732
+ /**
733
+ * Session event "session.title_changed". Session title change payload containing the new display title
734
+ */
393
735
  export interface TitleChangedEvent {
394
736
  /**
395
737
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
396
738
  */
397
739
  agentId?: string;
398
740
  data: TitleChangedData;
741
+ /**
742
+ * Always true for events that are transient and not persisted to the session event log on disk.
743
+ */
399
744
  ephemeral: true;
400
745
  /**
401
746
  * Unique event identifier (UUID v4), generated when the event is emitted
@@ -409,6 +754,9 @@ export interface TitleChangedEvent {
409
754
  * ISO 8601 timestamp when the event was created
410
755
  */
411
756
  timestamp: string;
757
+ /**
758
+ * Type discriminator. Always "session.title_changed".
759
+ */
412
760
  type: "session.title_changed";
413
761
  }
414
762
  /**
@@ -420,6 +768,144 @@ export interface TitleChangedData {
420
768
  */
421
769
  title: string;
422
770
  }
771
+ /**
772
+ * Session event "session.schedule_created". Scheduled prompt registered via /every or /after
773
+ */
774
+ export interface ScheduleCreatedEvent {
775
+ /**
776
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
777
+ */
778
+ agentId?: string;
779
+ data: ScheduleCreatedData;
780
+ /**
781
+ * When true, the event is transient and not persisted to the session event log on disk
782
+ */
783
+ ephemeral?: boolean;
784
+ /**
785
+ * Unique event identifier (UUID v4), generated when the event is emitted
786
+ */
787
+ id: string;
788
+ /**
789
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
790
+ */
791
+ parentId: string | null;
792
+ /**
793
+ * ISO 8601 timestamp when the event was created
794
+ */
795
+ timestamp: string;
796
+ /**
797
+ * Type discriminator. Always "session.schedule_created".
798
+ */
799
+ type: "session.schedule_created";
800
+ }
801
+ /**
802
+ * Scheduled prompt registered via /every or /after
803
+ */
804
+ export interface ScheduleCreatedData {
805
+ /**
806
+ * Optional user-facing label shown in the timeline instead of the actual prompt (e.g. `/skill-name args` when the prompt is a skill invocation expansion)
807
+ */
808
+ displayPrompt?: string;
809
+ /**
810
+ * Sequential id assigned to the scheduled prompt within the session
811
+ */
812
+ id: number;
813
+ /**
814
+ * Interval between ticks in milliseconds
815
+ */
816
+ intervalMs: number;
817
+ /**
818
+ * Prompt text that gets enqueued on every tick
819
+ */
820
+ prompt: string;
821
+ /**
822
+ * Whether the schedule re-arms after each tick (`/every`) or fires once (`/after`)
823
+ */
824
+ recurring?: boolean;
825
+ }
826
+ /**
827
+ * Session event "session.schedule_cancelled". Scheduled prompt cancelled from the schedule manager dialog
828
+ */
829
+ export interface ScheduleCancelledEvent {
830
+ /**
831
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
832
+ */
833
+ agentId?: string;
834
+ data: ScheduleCancelledData;
835
+ /**
836
+ * When true, the event is transient and not persisted to the session event log on disk
837
+ */
838
+ ephemeral?: boolean;
839
+ /**
840
+ * Unique event identifier (UUID v4), generated when the event is emitted
841
+ */
842
+ id: string;
843
+ /**
844
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
845
+ */
846
+ parentId: string | null;
847
+ /**
848
+ * ISO 8601 timestamp when the event was created
849
+ */
850
+ timestamp: string;
851
+ /**
852
+ * Type discriminator. Always "session.schedule_cancelled".
853
+ */
854
+ type: "session.schedule_cancelled";
855
+ }
856
+ /**
857
+ * Scheduled prompt cancelled from the schedule manager dialog
858
+ */
859
+ export interface ScheduleCancelledData {
860
+ /**
861
+ * Id of the scheduled prompt that was cancelled
862
+ */
863
+ id: number;
864
+ }
865
+ /**
866
+ * Session event "session.autopilot_objective_changed". Autopilot objective state file operation details indicating what changed
867
+ */
868
+ export interface AutopilotObjectiveChangedEvent {
869
+ /**
870
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
871
+ */
872
+ agentId?: string;
873
+ data: AutopilotObjectiveChangedData;
874
+ /**
875
+ * When true, the event is transient and not persisted to the session event log on disk
876
+ */
877
+ ephemeral?: boolean;
878
+ /**
879
+ * Unique event identifier (UUID v4), generated when the event is emitted
880
+ */
881
+ id: string;
882
+ /**
883
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
884
+ */
885
+ parentId: string | null;
886
+ /**
887
+ * ISO 8601 timestamp when the event was created
888
+ */
889
+ timestamp: string;
890
+ /**
891
+ * Type discriminator. Always "session.autopilot_objective_changed".
892
+ */
893
+ type: "session.autopilot_objective_changed";
894
+ }
895
+ /**
896
+ * Autopilot objective state file operation details indicating what changed
897
+ */
898
+ export interface AutopilotObjectiveChangedData {
899
+ /**
900
+ * Current autopilot objective id, if one exists
901
+ */
902
+ id?: number;
903
+ operation: AutopilotObjectiveChangedOperation;
904
+ status?: AutopilotObjectiveChangedStatus;
905
+ }
906
+ /**
907
+ * Session event "session.info". Informational message for timeline display with categorization
908
+ */
423
909
  export interface InfoEvent {
424
910
  /**
425
911
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
@@ -442,6 +928,9 @@ export interface InfoEvent {
442
928
  * ISO 8601 timestamp when the event was created
443
929
  */
444
930
  timestamp: string;
931
+ /**
932
+ * Type discriminator. Always "session.info".
933
+ */
445
934
  type: "session.info";
446
935
  }
447
936
  /**
@@ -456,11 +945,18 @@ export interface InfoData {
456
945
  * Human-readable informational message for display in the timeline
457
946
  */
458
947
  message: string;
948
+ /**
949
+ * Optional actionable tip displayed with this message
950
+ */
951
+ tip?: string;
459
952
  /**
460
953
  * Optional URL associated with this message that the user can open in a browser
461
954
  */
462
955
  url?: string;
463
956
  }
957
+ /**
958
+ * Session event "session.warning". Warning message for timeline display with categorization
959
+ */
464
960
  export interface WarningEvent {
465
961
  /**
466
962
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
@@ -483,6 +979,9 @@ export interface WarningEvent {
483
979
  * ISO 8601 timestamp when the event was created
484
980
  */
485
981
  timestamp: string;
982
+ /**
983
+ * Type discriminator. Always "session.warning".
984
+ */
486
985
  type: "session.warning";
487
986
  }
488
987
  /**
@@ -502,6 +1001,9 @@ export interface WarningData {
502
1001
  */
503
1002
  warningType: string;
504
1003
  }
1004
+ /**
1005
+ * Session event "session.model_change". Model change details including previous and new model identifiers
1006
+ */
505
1007
  export interface ModelChangeEvent {
506
1008
  /**
507
1009
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
@@ -524,12 +1026,25 @@ export interface ModelChangeEvent {
524
1026
  * ISO 8601 timestamp when the event was created
525
1027
  */
526
1028
  timestamp: string;
1029
+ /**
1030
+ * Type discriminator. Always "session.model_change".
1031
+ */
527
1032
  type: "session.model_change";
528
1033
  }
529
1034
  /**
530
1035
  * Model change details including previous and new model identifiers
531
1036
  */
532
1037
  export interface ModelChangeData {
1038
+ /**
1039
+ * 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.
1040
+ */
1041
+ cause?: string;
1042
+ /**
1043
+ * Context tier after the model change; null explicitly clears a previously selected tier
1044
+ */
1045
+ contextTier?: "default"
1046
+ /** Extended context tier with a larger context window. */
1047
+ | "long_context" | null;
533
1048
  /**
534
1049
  * Newly selected model identifier
535
1050
  */
@@ -542,11 +1057,16 @@ export interface ModelChangeData {
542
1057
  * Reasoning effort level before the model change, if applicable
543
1058
  */
544
1059
  previousReasoningEffort?: string;
1060
+ previousReasoningSummary?: ReasoningSummary;
545
1061
  /**
546
1062
  * Reasoning effort level after the model change, if applicable
547
1063
  */
548
- reasoningEffort?: string;
1064
+ reasoningEffort?: string | null;
1065
+ reasoningSummary?: ReasoningSummary;
549
1066
  }
1067
+ /**
1068
+ * Session event "session.mode_changed". Agent mode change details including previous and new modes
1069
+ */
550
1070
  export interface ModeChangedEvent {
551
1071
  /**
552
1072
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
@@ -569,21 +1089,64 @@ export interface ModeChangedEvent {
569
1089
  * ISO 8601 timestamp when the event was created
570
1090
  */
571
1091
  timestamp: string;
1092
+ /**
1093
+ * Type discriminator. Always "session.mode_changed".
1094
+ */
572
1095
  type: "session.mode_changed";
573
1096
  }
574
1097
  /**
575
1098
  * Agent mode change details including previous and new modes
576
1099
  */
577
1100
  export interface ModeChangedData {
1101
+ newMode: SessionMode;
1102
+ previousMode: SessionMode;
1103
+ }
1104
+ /**
1105
+ * Session event "session.permissions_changed". Permissions change details carrying the aggregate allow-all boolean transition.
1106
+ */
1107
+ export interface PermissionsChangedEvent {
1108
+ /**
1109
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
1110
+ */
1111
+ agentId?: string;
1112
+ data: PermissionsChangedData;
1113
+ /**
1114
+ * When true, the event is transient and not persisted to the session event log on disk
1115
+ */
1116
+ ephemeral?: boolean;
1117
+ /**
1118
+ * Unique event identifier (UUID v4), generated when the event is emitted
1119
+ */
1120
+ id: string;
1121
+ /**
1122
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
1123
+ */
1124
+ parentId: string | null;
1125
+ /**
1126
+ * ISO 8601 timestamp when the event was created
1127
+ */
1128
+ timestamp: string;
1129
+ /**
1130
+ * Type discriminator. Always "session.permissions_changed".
1131
+ */
1132
+ type: "session.permissions_changed";
1133
+ }
1134
+ /**
1135
+ * Permissions change details carrying the aggregate allow-all boolean transition.
1136
+ */
1137
+ export interface PermissionsChangedData {
578
1138
  /**
579
- * Agent mode after the change (e.g., "interactive", "plan", "autopilot")
1139
+ * Aggregate allow-all flag after the change
580
1140
  */
581
- newMode: string;
1141
+ allowAllPermissions: boolean;
582
1142
  /**
583
- * Agent mode before the change (e.g., "interactive", "plan", "autopilot")
1143
+ * Aggregate allow-all flag before the change
584
1144
  */
585
- previousMode: string;
1145
+ previousAllowAllPermissions: boolean;
586
1146
  }
1147
+ /**
1148
+ * Session event "session.plan_changed". Plan file operation details indicating what changed
1149
+ */
587
1150
  export interface PlanChangedEvent {
588
1151
  /**
589
1152
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
@@ -606,6 +1169,9 @@ export interface PlanChangedEvent {
606
1169
  * ISO 8601 timestamp when the event was created
607
1170
  */
608
1171
  timestamp: string;
1172
+ /**
1173
+ * Type discriminator. Always "session.plan_changed".
1174
+ */
609
1175
  type: "session.plan_changed";
610
1176
  }
611
1177
  /**
@@ -614,6 +1180,9 @@ export interface PlanChangedEvent {
614
1180
  export interface PlanChangedData {
615
1181
  operation: PlanChangedOperation;
616
1182
  }
1183
+ /**
1184
+ * Session event "session.workspace_file_changed". Workspace file change details including path and operation type
1185
+ */
617
1186
  export interface WorkspaceFileChangedEvent {
618
1187
  /**
619
1188
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
@@ -636,6 +1205,9 @@ export interface WorkspaceFileChangedEvent {
636
1205
  * ISO 8601 timestamp when the event was created
637
1206
  */
638
1207
  timestamp: string;
1208
+ /**
1209
+ * Type discriminator. Always "session.workspace_file_changed".
1210
+ */
639
1211
  type: "session.workspace_file_changed";
640
1212
  }
641
1213
  /**
@@ -648,6 +1220,9 @@ export interface WorkspaceFileChangedData {
648
1220
  */
649
1221
  path: string;
650
1222
  }
1223
+ /**
1224
+ * Session event "session.handoff". Session handoff metadata including source, context, and repository information
1225
+ */
651
1226
  export interface HandoffEvent {
652
1227
  /**
653
1228
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
@@ -670,6 +1245,9 @@ export interface HandoffEvent {
670
1245
  * ISO 8601 timestamp when the event was created
671
1246
  */
672
1247
  timestamp: string;
1248
+ /**
1249
+ * Type discriminator. Always "session.handoff".
1250
+ */
673
1251
  type: "session.handoff";
674
1252
  }
675
1253
  /**
@@ -716,6 +1294,9 @@ export interface HandoffRepository {
716
1294
  */
717
1295
  owner: string;
718
1296
  }
1297
+ /**
1298
+ * Session event "session.truncation". Conversation truncation statistics including token counts and removed content metrics
1299
+ */
719
1300
  export interface TruncationEvent {
720
1301
  /**
721
1302
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
@@ -738,6 +1319,9 @@ export interface TruncationEvent {
738
1319
  * ISO 8601 timestamp when the event was created
739
1320
  */
740
1321
  timestamp: string;
1322
+ /**
1323
+ * Type discriminator. Always "session.truncation".
1324
+ */
741
1325
  type: "session.truncation";
742
1326
  }
743
1327
  /**
@@ -777,12 +1361,18 @@ export interface TruncationData {
777
1361
  */
778
1362
  tokensRemovedDuringTruncation: number;
779
1363
  }
1364
+ /**
1365
+ * Session event "session.snapshot_rewind". Session rewind details including target event and count of removed events
1366
+ */
780
1367
  export interface SnapshotRewindEvent {
781
1368
  /**
782
1369
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
783
1370
  */
784
1371
  agentId?: string;
785
1372
  data: SnapshotRewindData;
1373
+ /**
1374
+ * Always true for events that are transient and not persisted to the session event log on disk.
1375
+ */
786
1376
  ephemeral: true;
787
1377
  /**
788
1378
  * Unique event identifier (UUID v4), generated when the event is emitted
@@ -796,6 +1386,9 @@ export interface SnapshotRewindEvent {
796
1386
  * ISO 8601 timestamp when the event was created
797
1387
  */
798
1388
  timestamp: string;
1389
+ /**
1390
+ * Type discriminator. Always "session.snapshot_rewind".
1391
+ */
799
1392
  type: "session.snapshot_rewind";
800
1393
  }
801
1394
  /**
@@ -811,6 +1404,9 @@ export interface SnapshotRewindData {
811
1404
  */
812
1405
  upToEventId: string;
813
1406
  }
1407
+ /**
1408
+ * Session event "session.shutdown". Session termination metrics including usage statistics, code changes, and shutdown reason
1409
+ */
814
1410
  export interface ShutdownEvent {
815
1411
  /**
816
1412
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
@@ -833,6 +1429,9 @@ export interface ShutdownEvent {
833
1429
  * ISO 8601 timestamp when the event was created
834
1430
  */
835
1431
  timestamp: string;
1432
+ /**
1433
+ * Type discriminator. Always "session.shutdown".
1434
+ */
836
1435
  type: "session.shutdown";
837
1436
  }
838
1437
  /**
@@ -860,7 +1459,7 @@ export interface ShutdownData {
860
1459
  * Per-model usage breakdown, keyed by model identifier
861
1460
  */
862
1461
  modelMetrics: {
863
- [k: string]: ShutdownModelMetric;
1462
+ [k: string]: ShutdownModelMetric | undefined;
864
1463
  };
865
1464
  /**
866
1465
  * Unix timestamp (milliseconds) when the session started
@@ -871,6 +1470,12 @@ export interface ShutdownData {
871
1470
  * System message token count at shutdown
872
1471
  */
873
1472
  systemTokens?: number;
1473
+ /**
1474
+ * Session-wide per-token-type accumulated token counts
1475
+ */
1476
+ tokenDetails?: {
1477
+ [k: string]: ShutdownTokenDetail | undefined;
1478
+ };
874
1479
  /**
875
1480
  * Tool definitions token count at shutdown
876
1481
  */
@@ -880,9 +1485,11 @@ export interface ShutdownData {
880
1485
  */
881
1486
  totalApiDurationMs: number;
882
1487
  /**
883
- * Total number of premium API requests used during the session
1488
+ * Session-wide accumulated nano-AI units cost
1489
+ *
1490
+ * @experimental
884
1491
  */
885
- totalPremiumRequests: number;
1492
+ totalNanoAiu?: number;
886
1493
  }
887
1494
  /**
888
1495
  * Aggregate code change metrics for the session
@@ -901,8 +1508,23 @@ export interface ShutdownCodeChanges {
901
1508
  */
902
1509
  linesRemoved: number;
903
1510
  }
1511
+ /**
1512
+ * Schema for the `ShutdownModelMetric` type.
1513
+ */
904
1514
  export interface ShutdownModelMetric {
905
1515
  requests: ShutdownModelMetricRequests;
1516
+ /**
1517
+ * Token count details per type
1518
+ */
1519
+ tokenDetails?: {
1520
+ [k: string]: ShutdownModelMetricTokenDetail | undefined;
1521
+ };
1522
+ /**
1523
+ * Accumulated nano-AI units cost for this model
1524
+ *
1525
+ * @experimental
1526
+ */
1527
+ totalNanoAiu?: number;
906
1528
  usage: ShutdownModelMetricUsage;
907
1529
  }
908
1530
  /**
@@ -911,12 +1533,25 @@ export interface ShutdownModelMetric {
911
1533
  export interface ShutdownModelMetricRequests {
912
1534
  /**
913
1535
  * Cumulative cost multiplier for requests to this model
1536
+ *
1537
+ * @experimental
914
1538
  */
915
- cost: number;
1539
+ cost?: number;
916
1540
  /**
917
1541
  * Total number of API requests made to this model
1542
+ *
1543
+ * @experimental
918
1544
  */
919
- count: number;
1545
+ count?: number;
1546
+ }
1547
+ /**
1548
+ * Schema for the `ShutdownModelMetricTokenDetail` type.
1549
+ */
1550
+ export interface ShutdownModelMetricTokenDetail {
1551
+ /**
1552
+ * Accumulated token count for this token type
1553
+ */
1554
+ tokenCount: number;
920
1555
  }
921
1556
  /**
922
1557
  * Token usage breakdown
@@ -943,8 +1578,20 @@ export interface ShutdownModelMetricUsage {
943
1578
  */
944
1579
  reasoningTokens?: number;
945
1580
  }
946
- export interface ContextChangedEvent {
947
- /**
1581
+ /**
1582
+ * Schema for the `ShutdownTokenDetail` type.
1583
+ */
1584
+ export interface ShutdownTokenDetail {
1585
+ /**
1586
+ * Accumulated token count for this token type
1587
+ */
1588
+ tokenCount: number;
1589
+ }
1590
+ /**
1591
+ * Session event "session.context_changed". Updated working directory and git context after the change
1592
+ */
1593
+ export interface ContextChangedEvent {
1594
+ /**
948
1595
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
949
1596
  */
950
1597
  agentId?: string;
@@ -965,14 +1612,23 @@ export interface ContextChangedEvent {
965
1612
  * ISO 8601 timestamp when the event was created
966
1613
  */
967
1614
  timestamp: string;
1615
+ /**
1616
+ * Type discriminator. Always "session.context_changed".
1617
+ */
968
1618
  type: "session.context_changed";
969
1619
  }
1620
+ /**
1621
+ * Session event "session.usage_info". Current context window usage statistics including token and message counts
1622
+ */
970
1623
  export interface UsageInfoEvent {
971
1624
  /**
972
1625
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
973
1626
  */
974
1627
  agentId?: string;
975
1628
  data: UsageInfoData;
1629
+ /**
1630
+ * Always true for events that are transient and not persisted to the session event log on disk.
1631
+ */
976
1632
  ephemeral: true;
977
1633
  /**
978
1634
  * Unique event identifier (UUID v4), generated when the event is emitted
@@ -986,6 +1642,9 @@ export interface UsageInfoEvent {
986
1642
  * ISO 8601 timestamp when the event was created
987
1643
  */
988
1644
  timestamp: string;
1645
+ /**
1646
+ * Type discriminator. Always "session.usage_info".
1647
+ */
989
1648
  type: "session.usage_info";
990
1649
  }
991
1650
  /**
@@ -1021,6 +1680,9 @@ export interface UsageInfoData {
1021
1680
  */
1022
1681
  toolDefinitionsTokens?: number;
1023
1682
  }
1683
+ /**
1684
+ * Session event "session.compaction_start". Context window breakdown at the start of LLM-powered conversation compaction
1685
+ */
1024
1686
  export interface CompactionStartEvent {
1025
1687
  /**
1026
1688
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
@@ -1043,6 +1705,9 @@ export interface CompactionStartEvent {
1043
1705
  * ISO 8601 timestamp when the event was created
1044
1706
  */
1045
1707
  timestamp: string;
1708
+ /**
1709
+ * Type discriminator. Always "session.compaction_start".
1710
+ */
1046
1711
  type: "session.compaction_start";
1047
1712
  }
1048
1713
  /**
@@ -1062,6 +1727,9 @@ export interface CompactionStartData {
1062
1727
  */
1063
1728
  toolDefinitionsTokens?: number;
1064
1729
  }
1730
+ /**
1731
+ * Session event "session.compaction_complete". Conversation compaction results including success status, metrics, and optional error details
1732
+ */
1065
1733
  export interface CompactionCompleteEvent {
1066
1734
  /**
1067
1735
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
@@ -1084,6 +1752,9 @@ export interface CompactionCompleteEvent {
1084
1752
  * ISO 8601 timestamp when the event was created
1085
1753
  */
1086
1754
  timestamp: string;
1755
+ /**
1756
+ * Type discriminator. Always "session.compaction_complete".
1757
+ */
1087
1758
  type: "session.compaction_complete";
1088
1759
  }
1089
1760
  /**
@@ -1103,6 +1774,10 @@ export interface CompactionCompleteData {
1103
1774
  * Token count from non-system messages (user, assistant, tool) after compaction
1104
1775
  */
1105
1776
  conversationTokens?: number;
1777
+ /**
1778
+ * User-supplied focus instructions provided to a manual `/compact` invocation. Omitted for automatic compaction and for manual compaction with no focus text.
1779
+ */
1780
+ customInstructions?: string;
1106
1781
  /**
1107
1782
  * Error message if compaction failed
1108
1783
  */
@@ -1127,6 +1802,10 @@ export interface CompactionCompleteData {
1127
1802
  * GitHub request tracing ID (x-github-request-id header) for the compaction LLM call
1128
1803
  */
1129
1804
  requestId?: string;
1805
+ /**
1806
+ * Copilot service request ID (x-copilot-service-request-id header) for the compaction LLM call
1807
+ */
1808
+ serviceRequestId?: string;
1130
1809
  /**
1131
1810
  * Whether compaction completed successfully
1132
1811
  */
@@ -1160,7 +1839,6 @@ export interface CompactionCompleteCompactionTokensUsed {
1160
1839
  * Tokens written to prompt cache in the compaction LLM call
1161
1840
  */
1162
1841
  cacheWriteTokens?: number;
1163
- copilotUsage?: CompactionCompleteCompactionTokensUsedCopilotUsage;
1164
1842
  /**
1165
1843
  * Duration of the compaction LLM call in milliseconds
1166
1844
  */
@@ -1178,19 +1856,6 @@ export interface CompactionCompleteCompactionTokensUsed {
1178
1856
  */
1179
1857
  outputTokens?: number;
1180
1858
  }
1181
- /**
1182
- * Per-request cost and usage data from the CAPI copilot_usage response field
1183
- */
1184
- export interface CompactionCompleteCompactionTokensUsedCopilotUsage {
1185
- /**
1186
- * Itemized token usage breakdown
1187
- */
1188
- tokenDetails: CompactionCompleteCompactionTokensUsedCopilotUsageTokenDetail[];
1189
- /**
1190
- * Total cost in nano-AIU (AI Units) for this request
1191
- */
1192
- totalNanoAiu: number;
1193
- }
1194
1859
  /**
1195
1860
  * Token usage detail for a single billing category
1196
1861
  */
@@ -1212,6 +1877,9 @@ export interface CompactionCompleteCompactionTokensUsedCopilotUsageTokenDetail {
1212
1877
  */
1213
1878
  tokenType: string;
1214
1879
  }
1880
+ /**
1881
+ * Session event "session.task_complete". Task completion notification with summary from the agent
1882
+ */
1215
1883
  export interface TaskCompleteEvent {
1216
1884
  /**
1217
1885
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
@@ -1234,6 +1902,9 @@ export interface TaskCompleteEvent {
1234
1902
  * ISO 8601 timestamp when the event was created
1235
1903
  */
1236
1904
  timestamp: string;
1905
+ /**
1906
+ * Type discriminator. Always "session.task_complete".
1907
+ */
1237
1908
  type: "session.task_complete";
1238
1909
  }
1239
1910
  /**
@@ -1249,6 +1920,9 @@ export interface TaskCompleteData {
1249
1920
  */
1250
1921
  summary?: string;
1251
1922
  }
1923
+ /**
1924
+ * Session event "user.message".
1925
+ */
1252
1926
  export interface UserMessageEvent {
1253
1927
  /**
1254
1928
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
@@ -1271,8 +1945,14 @@ export interface UserMessageEvent {
1271
1945
  * ISO 8601 timestamp when the event was created
1272
1946
  */
1273
1947
  timestamp: string;
1948
+ /**
1949
+ * Type discriminator. Always "user.message".
1950
+ */
1274
1951
  type: "user.message";
1275
1952
  }
1953
+ /**
1954
+ * Schema for the `UserMessageData` type.
1955
+ */
1276
1956
  export interface UserMessageData {
1277
1957
  agentMode?: UserMessageAgentMode;
1278
1958
  /**
@@ -1288,9 +1968,17 @@ export interface UserMessageData {
1288
1968
  */
1289
1969
  interactionId?: string;
1290
1970
  /**
1291
- * Path-backed native document attachments that stayed on the tagged_files path flow because native upload would exceed the request size limit
1971
+ * True when this user message was auto-injected by autopilot's continuation loop rather than typed by the user; used to distinguish autopilot-driven turns in telemetry.
1972
+ */
1973
+ isAutopilotContinuation?: boolean;
1974
+ /**
1975
+ * Path-backed native document attachments that stayed on the tagged_files path flow because native upload could not read them or would exceed the request size limit
1292
1976
  */
1293
1977
  nativeDocumentPathFallbackPaths?: string[];
1978
+ /**
1979
+ * Parent agent task ID for background telemetry correlated to this user turn
1980
+ */
1981
+ parentAgentTaskId?: string;
1294
1982
  /**
1295
1983
  * Origin of this message, used for timeline filtering (e.g., "skill-pdf" for skill-injected messages that should be hidden from the user)
1296
1984
  */
@@ -1454,12 +2142,18 @@ export interface UserMessageAttachmentBlob {
1454
2142
  */
1455
2143
  type: "blob";
1456
2144
  }
2145
+ /**
2146
+ * Session event "pending_messages.modified". Empty payload; the event signals that the pending message queue has changed
2147
+ */
1457
2148
  export interface PendingMessagesModifiedEvent {
1458
2149
  /**
1459
2150
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
1460
2151
  */
1461
2152
  agentId?: string;
1462
2153
  data: PendingMessagesModifiedData;
2154
+ /**
2155
+ * Always true for events that are transient and not persisted to the session event log on disk.
2156
+ */
1463
2157
  ephemeral: true;
1464
2158
  /**
1465
2159
  * Unique event identifier (UUID v4), generated when the event is emitted
@@ -1473,6 +2167,9 @@ export interface PendingMessagesModifiedEvent {
1473
2167
  * ISO 8601 timestamp when the event was created
1474
2168
  */
1475
2169
  timestamp: string;
2170
+ /**
2171
+ * Type discriminator. Always "pending_messages.modified".
2172
+ */
1476
2173
  type: "pending_messages.modified";
1477
2174
  }
1478
2175
  /**
@@ -1480,6 +2177,9 @@ export interface PendingMessagesModifiedEvent {
1480
2177
  */
1481
2178
  export interface PendingMessagesModifiedData {
1482
2179
  }
2180
+ /**
2181
+ * Session event "assistant.turn_start". Turn initialization metadata including identifier and interaction tracking
2182
+ */
1483
2183
  export interface AssistantTurnStartEvent {
1484
2184
  /**
1485
2185
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
@@ -1502,6 +2202,9 @@ export interface AssistantTurnStartEvent {
1502
2202
  * ISO 8601 timestamp when the event was created
1503
2203
  */
1504
2204
  timestamp: string;
2205
+ /**
2206
+ * Type discriminator. Always "assistant.turn_start".
2207
+ */
1505
2208
  type: "assistant.turn_start";
1506
2209
  }
1507
2210
  /**
@@ -1517,12 +2220,18 @@ export interface AssistantTurnStartData {
1517
2220
  */
1518
2221
  turnId: string;
1519
2222
  }
2223
+ /**
2224
+ * Session event "assistant.intent". Agent intent description for current activity or plan
2225
+ */
1520
2226
  export interface AssistantIntentEvent {
1521
2227
  /**
1522
2228
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
1523
2229
  */
1524
2230
  agentId?: string;
1525
2231
  data: AssistantIntentData;
2232
+ /**
2233
+ * Always true for events that are transient and not persisted to the session event log on disk.
2234
+ */
1526
2235
  ephemeral: true;
1527
2236
  /**
1528
2237
  * Unique event identifier (UUID v4), generated when the event is emitted
@@ -1536,6 +2245,9 @@ export interface AssistantIntentEvent {
1536
2245
  * ISO 8601 timestamp when the event was created
1537
2246
  */
1538
2247
  timestamp: string;
2248
+ /**
2249
+ * Type discriminator. Always "assistant.intent".
2250
+ */
1539
2251
  type: "assistant.intent";
1540
2252
  }
1541
2253
  /**
@@ -1547,6 +2259,9 @@ export interface AssistantIntentData {
1547
2259
  */
1548
2260
  intent: string;
1549
2261
  }
2262
+ /**
2263
+ * Session event "assistant.reasoning". Assistant reasoning content for timeline display with complete thinking text
2264
+ */
1550
2265
  export interface AssistantReasoningEvent {
1551
2266
  /**
1552
2267
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
@@ -1569,6 +2284,9 @@ export interface AssistantReasoningEvent {
1569
2284
  * ISO 8601 timestamp when the event was created
1570
2285
  */
1571
2286
  timestamp: string;
2287
+ /**
2288
+ * Type discriminator. Always "assistant.reasoning".
2289
+ */
1572
2290
  type: "assistant.reasoning";
1573
2291
  }
1574
2292
  /**
@@ -1584,12 +2302,18 @@ export interface AssistantReasoningData {
1584
2302
  */
1585
2303
  reasoningId: string;
1586
2304
  }
2305
+ /**
2306
+ * Session event "assistant.reasoning_delta". Streaming reasoning delta for incremental extended thinking updates
2307
+ */
1587
2308
  export interface AssistantReasoningDeltaEvent {
1588
2309
  /**
1589
2310
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
1590
2311
  */
1591
2312
  agentId?: string;
1592
2313
  data: AssistantReasoningDeltaData;
2314
+ /**
2315
+ * Always true for events that are transient and not persisted to the session event log on disk.
2316
+ */
1593
2317
  ephemeral: true;
1594
2318
  /**
1595
2319
  * Unique event identifier (UUID v4), generated when the event is emitted
@@ -1603,6 +2327,9 @@ export interface AssistantReasoningDeltaEvent {
1603
2327
  * ISO 8601 timestamp when the event was created
1604
2328
  */
1605
2329
  timestamp: string;
2330
+ /**
2331
+ * Type discriminator. Always "assistant.reasoning_delta".
2332
+ */
1606
2333
  type: "assistant.reasoning_delta";
1607
2334
  }
1608
2335
  /**
@@ -1618,12 +2345,18 @@ export interface AssistantReasoningDeltaData {
1618
2345
  */
1619
2346
  reasoningId: string;
1620
2347
  }
2348
+ /**
2349
+ * Session event "assistant.streaming_delta". Streaming response progress with cumulative byte count
2350
+ */
1621
2351
  export interface AssistantStreamingDeltaEvent {
1622
2352
  /**
1623
2353
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
1624
2354
  */
1625
2355
  agentId?: string;
1626
2356
  data: AssistantStreamingDeltaData;
2357
+ /**
2358
+ * Always true for events that are transient and not persisted to the session event log on disk.
2359
+ */
1627
2360
  ephemeral: true;
1628
2361
  /**
1629
2362
  * Unique event identifier (UUID v4), generated when the event is emitted
@@ -1637,6 +2370,9 @@ export interface AssistantStreamingDeltaEvent {
1637
2370
  * ISO 8601 timestamp when the event was created
1638
2371
  */
1639
2372
  timestamp: string;
2373
+ /**
2374
+ * Type discriminator. Always "assistant.streaming_delta".
2375
+ */
1640
2376
  type: "assistant.streaming_delta";
1641
2377
  }
1642
2378
  /**
@@ -1648,6 +2384,9 @@ export interface AssistantStreamingDeltaData {
1648
2384
  */
1649
2385
  totalResponseSizeBytes: number;
1650
2386
  }
2387
+ /**
2388
+ * Session event "assistant.message". Assistant response containing text content, optional tool requests, and interaction metadata
2389
+ */
1651
2390
  export interface AssistantMessageEvent {
1652
2391
  /**
1653
2392
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
@@ -1670,12 +2409,27 @@ export interface AssistantMessageEvent {
1670
2409
  * ISO 8601 timestamp when the event was created
1671
2410
  */
1672
2411
  timestamp: string;
2412
+ /**
2413
+ * Type discriminator. Always "assistant.message".
2414
+ */
1673
2415
  type: "assistant.message";
1674
2416
  }
1675
2417
  /**
1676
2418
  * Assistant response containing text content, optional tool requests, and interaction metadata
1677
2419
  */
1678
2420
  export interface AssistantMessageData {
2421
+ /**
2422
+ * Raw Anthropic content array with advisor blocks (server_tool_use, advisor_tool_result) for verbatim round-tripping
2423
+ *
2424
+ * @experimental
2425
+ */
2426
+ anthropicAdvisorBlocks?: unknown[];
2427
+ /**
2428
+ * Anthropic advisor model ID used for this response, for timeline display on replay
2429
+ *
2430
+ * @experimental
2431
+ */
2432
+ anthropicAdvisorModel?: string;
1679
2433
  /**
1680
2434
  * The assistant's text response content
1681
2435
  */
@@ -1692,6 +2446,10 @@ export interface AssistantMessageData {
1692
2446
  * Unique identifier for this assistant message
1693
2447
  */
1694
2448
  messageId: string;
2449
+ /**
2450
+ * Model that produced this assistant message, if known
2451
+ */
2452
+ model?: string;
1695
2453
  /**
1696
2454
  * Actual output token count from the API response (completion_tokens), used for accurate token accounting
1697
2455
  */
@@ -1717,10 +2475,18 @@ export interface AssistantMessageData {
1717
2475
  * GitHub request tracing ID (x-github-request-id header) for correlating with server-side logs
1718
2476
  */
1719
2477
  requestId?: string;
2478
+ /**
2479
+ * Copilot service request ID (x-copilot-service-request-id header) for CAPI log correlation
2480
+ */
2481
+ serviceRequestId?: string;
1720
2482
  /**
1721
2483
  * Tool invocations requested by the assistant in this message
1722
2484
  */
1723
2485
  toolRequests?: AssistantMessageToolRequest[];
2486
+ /**
2487
+ * Identifier for the agent loop turn that produced this message, matching the corresponding assistant.turn_start event
2488
+ */
2489
+ turnId?: string;
1724
2490
  }
1725
2491
  /**
1726
2492
  * A tool invocation request from the assistant
@@ -1730,7 +2496,7 @@ export interface AssistantMessageToolRequest {
1730
2496
  * Arguments to pass to the tool, format depends on the tool
1731
2497
  */
1732
2498
  arguments?: {
1733
- [k: string]: unknown;
2499
+ [k: string]: unknown | undefined;
1734
2500
  };
1735
2501
  /**
1736
2502
  * Resolved intention summary describing what this specific call does
@@ -1740,6 +2506,10 @@ export interface AssistantMessageToolRequest {
1740
2506
  * Name of the MCP server hosting this tool, when the tool is an MCP tool
1741
2507
  */
1742
2508
  mcpServerName?: string;
2509
+ /**
2510
+ * Original tool name on the MCP server, when the tool is an MCP tool
2511
+ */
2512
+ mcpToolName?: string;
1743
2513
  /**
1744
2514
  * Name of the tool being invoked
1745
2515
  */
@@ -1754,12 +2524,61 @@ export interface AssistantMessageToolRequest {
1754
2524
  toolTitle?: string;
1755
2525
  type?: AssistantMessageToolRequestType;
1756
2526
  }
2527
+ /**
2528
+ * Session event "assistant.message_start". Streaming assistant message start metadata
2529
+ */
2530
+ export interface AssistantMessageStartEvent {
2531
+ /**
2532
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
2533
+ */
2534
+ agentId?: string;
2535
+ data: AssistantMessageStartData;
2536
+ /**
2537
+ * Always true for events that are transient and not persisted to the session event log on disk.
2538
+ */
2539
+ ephemeral: true;
2540
+ /**
2541
+ * Unique event identifier (UUID v4), generated when the event is emitted
2542
+ */
2543
+ id: string;
2544
+ /**
2545
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
2546
+ */
2547
+ parentId: string | null;
2548
+ /**
2549
+ * ISO 8601 timestamp when the event was created
2550
+ */
2551
+ timestamp: string;
2552
+ /**
2553
+ * Type discriminator. Always "assistant.message_start".
2554
+ */
2555
+ type: "assistant.message_start";
2556
+ }
2557
+ /**
2558
+ * Streaming assistant message start metadata
2559
+ */
2560
+ export interface AssistantMessageStartData {
2561
+ /**
2562
+ * Message ID this start event belongs to, matching subsequent deltas and assistant.message
2563
+ */
2564
+ messageId: string;
2565
+ /**
2566
+ * Generation phase this message belongs to for phased-output models
2567
+ */
2568
+ phase?: string;
2569
+ }
2570
+ /**
2571
+ * Session event "assistant.message_delta". Streaming assistant message delta for incremental response updates
2572
+ */
1757
2573
  export interface AssistantMessageDeltaEvent {
1758
2574
  /**
1759
2575
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
1760
2576
  */
1761
2577
  agentId?: string;
1762
2578
  data: AssistantMessageDeltaData;
2579
+ /**
2580
+ * Always true for events that are transient and not persisted to the session event log on disk.
2581
+ */
1763
2582
  ephemeral: true;
1764
2583
  /**
1765
2584
  * Unique event identifier (UUID v4), generated when the event is emitted
@@ -1773,6 +2592,9 @@ export interface AssistantMessageDeltaEvent {
1773
2592
  * ISO 8601 timestamp when the event was created
1774
2593
  */
1775
2594
  timestamp: string;
2595
+ /**
2596
+ * Type discriminator. Always "assistant.message_delta".
2597
+ */
1776
2598
  type: "assistant.message_delta";
1777
2599
  }
1778
2600
  /**
@@ -1793,6 +2615,9 @@ export interface AssistantMessageDeltaData {
1793
2615
  */
1794
2616
  parentToolCallId?: string;
1795
2617
  }
2618
+ /**
2619
+ * Session event "assistant.turn_end". Turn completion metadata including the turn identifier
2620
+ */
1796
2621
  export interface AssistantTurnEndEvent {
1797
2622
  /**
1798
2623
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
@@ -1815,6 +2640,9 @@ export interface AssistantTurnEndEvent {
1815
2640
  * ISO 8601 timestamp when the event was created
1816
2641
  */
1817
2642
  timestamp: string;
2643
+ /**
2644
+ * Type discriminator. Always "assistant.turn_end".
2645
+ */
1818
2646
  type: "assistant.turn_end";
1819
2647
  }
1820
2648
  /**
@@ -1826,12 +2654,18 @@ export interface AssistantTurnEndData {
1826
2654
  */
1827
2655
  turnId: string;
1828
2656
  }
2657
+ /**
2658
+ * Session event "assistant.usage". LLM API call usage metrics including tokens, costs, quotas, and billing information
2659
+ */
1829
2660
  export interface AssistantUsageEvent {
1830
2661
  /**
1831
2662
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
1832
2663
  */
1833
2664
  agentId?: string;
1834
2665
  data: AssistantUsageData;
2666
+ /**
2667
+ * Always true for events that are transient and not persisted to the session event log on disk.
2668
+ */
1835
2669
  ephemeral: true;
1836
2670
  /**
1837
2671
  * Unique event identifier (UUID v4), generated when the event is emitted
@@ -1845,6 +2679,9 @@ export interface AssistantUsageEvent {
1845
2679
  * ISO 8601 timestamp when the event was created
1846
2680
  */
1847
2681
  timestamp: string;
2682
+ /**
2683
+ * Type discriminator. Always "assistant.usage".
2684
+ */
1848
2685
  type: "assistant.usage";
1849
2686
  }
1850
2687
  /**
@@ -1855,6 +2692,7 @@ export interface AssistantUsageData {
1855
2692
  * Completion ID from the model provider (e.g., chatcmpl-abc123)
1856
2693
  */
1857
2694
  apiCallId?: string;
2695
+ apiEndpoint?: AssistantUsageApiEndpoint;
1858
2696
  /**
1859
2697
  * Number of tokens read from prompt cache
1860
2698
  */
@@ -1863,9 +2701,10 @@ export interface AssistantUsageData {
1863
2701
  * Number of tokens written to prompt cache
1864
2702
  */
1865
2703
  cacheWriteTokens?: number;
1866
- copilotUsage?: AssistantUsageCopilotUsage;
1867
2704
  /**
1868
2705
  * Model multiplier cost for billing purposes
2706
+ *
2707
+ * @experimental
1869
2708
  */
1870
2709
  cost?: number;
1871
2710
  /**
@@ -1902,13 +2741,7 @@ export interface AssistantUsageData {
1902
2741
  */
1903
2742
  providerCallId?: string;
1904
2743
  /**
1905
- * Per-quota resource usage snapshots, keyed by quota identifier
1906
- */
1907
- quotaSnapshots?: {
1908
- [k: string]: AssistantUsageQuotaSnapshot;
1909
- };
1910
- /**
1911
- * Reasoning effort level used for model calls, if applicable (e.g. "low", "medium", "high", "xhigh")
2744
+ * Reasoning effort level used for model calls, if applicable (e.g. "none", "low", "medium", "high", "xhigh", "max")
1912
2745
  */
1913
2746
  reasoningEffort?: string;
1914
2747
  /**
@@ -1916,22 +2749,13 @@ export interface AssistantUsageData {
1916
2749
  */
1917
2750
  reasoningTokens?: number;
1918
2751
  /**
1919
- * Time to first token in milliseconds. Only available for streaming requests
1920
- */
1921
- ttftMs?: number;
1922
- }
1923
- /**
1924
- * Per-request cost and usage data from the CAPI copilot_usage response field
1925
- */
1926
- export interface AssistantUsageCopilotUsage {
1927
- /**
1928
- * Itemized token usage breakdown
2752
+ * Copilot service request ID (x-copilot-service-request-id header) for CAPI log correlation
1929
2753
  */
1930
- tokenDetails: AssistantUsageCopilotUsageTokenDetail[];
2754
+ serviceRequestId?: string;
1931
2755
  /**
1932
- * Total cost in nano-AIU (AI Units) for this request
2756
+ * Time to first token in milliseconds. Only available for streaming requests
1933
2757
  */
1934
- totalNanoAiu: number;
2758
+ timeToFirstTokenMs?: number;
1935
2759
  }
1936
2760
  /**
1937
2761
  * Token usage detail for a single billing category
@@ -1954,40 +2778,77 @@ export interface AssistantUsageCopilotUsageTokenDetail {
1954
2778
  */
1955
2779
  tokenType: string;
1956
2780
  }
1957
- export interface AssistantUsageQuotaSnapshot {
2781
+ /**
2782
+ * Session event "model.call_failure". Failed LLM API call metadata for telemetry
2783
+ */
2784
+ export interface ModelCallFailureEvent {
2785
+ /**
2786
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
2787
+ */
2788
+ agentId?: string;
2789
+ data: ModelCallFailureData;
2790
+ /**
2791
+ * Always true for events that are transient and not persisted to the session event log on disk.
2792
+ */
2793
+ ephemeral: true;
2794
+ /**
2795
+ * Unique event identifier (UUID v4), generated when the event is emitted
2796
+ */
2797
+ id: string;
2798
+ /**
2799
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
2800
+ */
2801
+ parentId: string | null;
2802
+ /**
2803
+ * ISO 8601 timestamp when the event was created
2804
+ */
2805
+ timestamp: string;
2806
+ /**
2807
+ * Type discriminator. Always "model.call_failure".
2808
+ */
2809
+ type: "model.call_failure";
2810
+ }
2811
+ /**
2812
+ * Failed LLM API call metadata for telemetry
2813
+ */
2814
+ export interface ModelCallFailureData {
1958
2815
  /**
1959
- * Total requests allowed by the entitlement
2816
+ * Completion ID from the model provider (e.g., chatcmpl-abc123)
1960
2817
  */
1961
- entitlementRequests: number;
2818
+ apiCallId?: string;
1962
2819
  /**
1963
- * Whether the user has an unlimited usage entitlement
2820
+ * Duration of the failed API call in milliseconds
1964
2821
  */
1965
- isUnlimitedEntitlement: boolean;
2822
+ durationMs?: number;
1966
2823
  /**
1967
- * Number of requests over the entitlement limit
2824
+ * Raw provider/runtime error message for restricted telemetry
1968
2825
  */
1969
- overage: number;
2826
+ errorMessage?: string;
1970
2827
  /**
1971
- * Whether overage is allowed when quota is exhausted
2828
+ * What initiated this API call (e.g., "sub-agent", "mcp-sampling"); absent for user-initiated calls
1972
2829
  */
1973
- overageAllowedWithExhaustedQuota: boolean;
2830
+ initiator?: string;
1974
2831
  /**
1975
- * Percentage of quota remaining (0.0 to 1.0)
2832
+ * Model identifier used for the failed API call
1976
2833
  */
1977
- remainingPercentage: number;
2834
+ model?: string;
1978
2835
  /**
1979
- * Date when the quota resets
2836
+ * GitHub request tracing ID (x-github-request-id header) for server-side log correlation
1980
2837
  */
1981
- resetDate?: string;
2838
+ providerCallId?: string;
1982
2839
  /**
1983
- * Whether usage is still permitted after quota exhaustion
2840
+ * Copilot service request ID (x-copilot-service-request-id header) for CAPI log correlation
1984
2841
  */
1985
- usageAllowedWithExhaustedQuota: boolean;
2842
+ serviceRequestId?: string;
2843
+ source: ModelCallFailureSource;
1986
2844
  /**
1987
- * Number of requests already consumed
2845
+ * HTTP status code from the failed request
1988
2846
  */
1989
- usedRequests: number;
2847
+ statusCode?: number;
1990
2848
  }
2849
+ /**
2850
+ * Session event "abort". Turn abort information including the reason for termination
2851
+ */
1991
2852
  export interface AbortEvent {
1992
2853
  /**
1993
2854
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
@@ -2010,17 +2871,20 @@ export interface AbortEvent {
2010
2871
  * ISO 8601 timestamp when the event was created
2011
2872
  */
2012
2873
  timestamp: string;
2874
+ /**
2875
+ * Type discriminator. Always "abort".
2876
+ */
2013
2877
  type: "abort";
2014
2878
  }
2015
2879
  /**
2016
2880
  * Turn abort information including the reason for termination
2017
2881
  */
2018
2882
  export interface AbortData {
2019
- /**
2020
- * Reason the current turn was aborted (e.g., "user initiated")
2021
- */
2022
- reason: string;
2883
+ reason: AbortReason;
2023
2884
  }
2885
+ /**
2886
+ * Session event "tool.user_requested". User-initiated tool invocation request with tool name and arguments
2887
+ */
2024
2888
  export interface ToolUserRequestedEvent {
2025
2889
  /**
2026
2890
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
@@ -2043,6 +2907,9 @@ export interface ToolUserRequestedEvent {
2043
2907
  * ISO 8601 timestamp when the event was created
2044
2908
  */
2045
2909
  timestamp: string;
2910
+ /**
2911
+ * Type discriminator. Always "tool.user_requested".
2912
+ */
2046
2913
  type: "tool.user_requested";
2047
2914
  }
2048
2915
  /**
@@ -2053,7 +2920,7 @@ export interface ToolUserRequestedData {
2053
2920
  * Arguments for the tool invocation
2054
2921
  */
2055
2922
  arguments?: {
2056
- [k: string]: unknown;
2923
+ [k: string]: unknown | undefined;
2057
2924
  };
2058
2925
  /**
2059
2926
  * Unique identifier for this tool call
@@ -2064,6 +2931,9 @@ export interface ToolUserRequestedData {
2064
2931
  */
2065
2932
  toolName: string;
2066
2933
  }
2934
+ /**
2935
+ * Session event "tool.execution_start". Tool execution startup details including MCP server information when applicable
2936
+ */
2067
2937
  export interface ToolExecutionStartEvent {
2068
2938
  /**
2069
2939
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
@@ -2086,6 +2956,9 @@ export interface ToolExecutionStartEvent {
2086
2956
  * ISO 8601 timestamp when the event was created
2087
2957
  */
2088
2958
  timestamp: string;
2959
+ /**
2960
+ * Type discriminator. Always "tool.execution_start".
2961
+ */
2089
2962
  type: "tool.execution_start";
2090
2963
  }
2091
2964
  /**
@@ -2096,8 +2969,12 @@ export interface ToolExecutionStartData {
2096
2969
  * Arguments passed to the tool
2097
2970
  */
2098
2971
  arguments?: {
2099
- [k: string]: unknown;
2972
+ [k: string]: unknown | undefined;
2100
2973
  };
2974
+ /**
2975
+ * When true, the tool output should be displayed expanded (verbatim) in the CLI timeline
2976
+ */
2977
+ displayVerbatim?: boolean;
2101
2978
  /**
2102
2979
  * Name of the MCP server hosting this tool, when the tool is an MCP tool
2103
2980
  */
@@ -2119,13 +2996,23 @@ export interface ToolExecutionStartData {
2119
2996
  * Name of the tool being executed
2120
2997
  */
2121
2998
  toolName: string;
2999
+ /**
3000
+ * Identifier for the agent loop turn this tool was invoked in, matching the corresponding assistant.turn_start event
3001
+ */
3002
+ turnId?: string;
2122
3003
  }
3004
+ /**
3005
+ * Session event "tool.execution_partial_result". Streaming tool execution output for incremental result display
3006
+ */
2123
3007
  export interface ToolExecutionPartialResultEvent {
2124
3008
  /**
2125
3009
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
2126
3010
  */
2127
3011
  agentId?: string;
2128
3012
  data: ToolExecutionPartialData;
3013
+ /**
3014
+ * Always true for events that are transient and not persisted to the session event log on disk.
3015
+ */
2129
3016
  ephemeral: true;
2130
3017
  /**
2131
3018
  * Unique event identifier (UUID v4), generated when the event is emitted
@@ -2139,6 +3026,9 @@ export interface ToolExecutionPartialResultEvent {
2139
3026
  * ISO 8601 timestamp when the event was created
2140
3027
  */
2141
3028
  timestamp: string;
3029
+ /**
3030
+ * Type discriminator. Always "tool.execution_partial_result".
3031
+ */
2142
3032
  type: "tool.execution_partial_result";
2143
3033
  }
2144
3034
  /**
@@ -2154,12 +3044,18 @@ export interface ToolExecutionPartialData {
2154
3044
  */
2155
3045
  toolCallId: string;
2156
3046
  }
3047
+ /**
3048
+ * Session event "tool.execution_progress". Tool execution progress notification with status message
3049
+ */
2157
3050
  export interface ToolExecutionProgressEvent {
2158
3051
  /**
2159
3052
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
2160
3053
  */
2161
3054
  agentId?: string;
2162
3055
  data: ToolExecutionProgressData;
3056
+ /**
3057
+ * Always true for events that are transient and not persisted to the session event log on disk.
3058
+ */
2163
3059
  ephemeral: true;
2164
3060
  /**
2165
3061
  * Unique event identifier (UUID v4), generated when the event is emitted
@@ -2173,6 +3069,9 @@ export interface ToolExecutionProgressEvent {
2173
3069
  * ISO 8601 timestamp when the event was created
2174
3070
  */
2175
3071
  timestamp: string;
3072
+ /**
3073
+ * Type discriminator. Always "tool.execution_progress".
3074
+ */
2176
3075
  type: "tool.execution_progress";
2177
3076
  }
2178
3077
  /**
@@ -2188,6 +3087,9 @@ export interface ToolExecutionProgressData {
2188
3087
  */
2189
3088
  toolCallId: string;
2190
3089
  }
3090
+ /**
3091
+ * Session event "tool.execution_complete". Tool execution completion results including success status, detailed output, and error information
3092
+ */
2191
3093
  export interface ToolExecutionCompleteEvent {
2192
3094
  /**
2193
3095
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
@@ -2210,6 +3112,9 @@ export interface ToolExecutionCompleteEvent {
2210
3112
  * ISO 8601 timestamp when the event was created
2211
3113
  */
2212
3114
  timestamp: string;
3115
+ /**
3116
+ * Type discriminator. Always "tool.execution_complete".
3117
+ */
2213
3118
  type: "tool.execution_complete";
2214
3119
  }
2215
3120
  /**
@@ -2235,6 +3140,10 @@ export interface ToolExecutionCompleteData {
2235
3140
  */
2236
3141
  parentToolCallId?: string;
2237
3142
  result?: ToolExecutionCompleteResult;
3143
+ /**
3144
+ * Whether this tool execution ran inside a sandbox container
3145
+ */
3146
+ sandboxed?: boolean;
2238
3147
  /**
2239
3148
  * Whether the tool execution completed successfully
2240
3149
  */
@@ -2243,12 +3152,17 @@ export interface ToolExecutionCompleteData {
2243
3152
  * Unique identifier for the completed tool call
2244
3153
  */
2245
3154
  toolCallId: string;
3155
+ toolDescription?: ToolExecutionCompleteToolDescription;
2246
3156
  /**
2247
3157
  * Tool-specific telemetry data (e.g., CodeQL check counts, grep match counts)
2248
3158
  */
2249
3159
  toolTelemetry?: {
2250
- [k: string]: unknown;
3160
+ [k: string]: unknown | undefined;
2251
3161
  };
3162
+ /**
3163
+ * Identifier for the agent loop turn this tool was invoked in, matching the corresponding assistant.turn_start event
3164
+ */
3165
+ turnId?: string;
2252
3166
  }
2253
3167
  /**
2254
3168
  * Error details when the tool execution failed
@@ -2279,6 +3193,7 @@ export interface ToolExecutionCompleteResult {
2279
3193
  * Full detailed tool result for UI/timeline display, preserving complete content such as diffs. Falls back to content when absent.
2280
3194
  */
2281
3195
  detailedContent?: string;
3196
+ uiResource?: ToolExecutionCompleteUIResource;
2282
3197
  }
2283
3198
  /**
2284
3199
  * Plain text content block
@@ -2413,6 +3328,9 @@ export interface ToolExecutionCompleteContentResource {
2413
3328
  */
2414
3329
  type: "resource";
2415
3330
  }
3331
+ /**
3332
+ * Schema for the `EmbeddedTextResourceContents` type.
3333
+ */
2416
3334
  export interface EmbeddedTextResourceContents {
2417
3335
  /**
2418
3336
  * MIME type of the text content
@@ -2427,6 +3345,9 @@ export interface EmbeddedTextResourceContents {
2427
3345
  */
2428
3346
  uri: string;
2429
3347
  }
3348
+ /**
3349
+ * Schema for the `EmbeddedBlobResourceContents` type.
3350
+ */
2430
3351
  export interface EmbeddedBlobResourceContents {
2431
3352
  /**
2432
3353
  * Base64-encoded binary content of the resource
@@ -2441,29 +3362,147 @@ export interface EmbeddedBlobResourceContents {
2441
3362
  */
2442
3363
  uri: string;
2443
3364
  }
2444
- export interface SkillInvokedEvent {
2445
- /**
2446
- * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
2447
- */
2448
- agentId?: string;
2449
- data: SkillInvokedData;
3365
+ /**
3366
+ * MCP Apps UI resource content for rendering in a sandboxed iframe
3367
+ */
3368
+ export interface ToolExecutionCompleteUIResource {
3369
+ _meta?: ToolExecutionCompleteUIResourceMeta;
2450
3370
  /**
2451
- * When true, the event is transient and not persisted to the session event log on disk
3371
+ * Base64-encoded HTML content
2452
3372
  */
2453
- ephemeral?: boolean;
3373
+ blob?: string;
2454
3374
  /**
2455
- * Unique event identifier (UUID v4), generated when the event is emitted
3375
+ * MIME type of the content
2456
3376
  */
2457
- id: string;
3377
+ mimeType: string;
2458
3378
  /**
2459
- * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
3379
+ * HTML content as a string
2460
3380
  */
2461
- parentId: string | null;
3381
+ text?: string;
2462
3382
  /**
2463
- * ISO 8601 timestamp when the event was created
3383
+ * The ui:// URI of the resource
2464
3384
  */
2465
- timestamp: string;
2466
- type: "skill.invoked";
3385
+ uri: string;
3386
+ }
3387
+ /**
3388
+ * Resource-level UI metadata (CSP, permissions, visual preferences)
3389
+ */
3390
+ export interface ToolExecutionCompleteUIResourceMeta {
3391
+ ui?: ToolExecutionCompleteUIResourceMetaUI;
3392
+ }
3393
+ /**
3394
+ * Schema for the `ToolExecutionCompleteUIResourceMetaUI` type.
3395
+ */
3396
+ export interface ToolExecutionCompleteUIResourceMetaUI {
3397
+ csp?: ToolExecutionCompleteUIResourceMetaUICsp;
3398
+ domain?: string;
3399
+ permissions?: ToolExecutionCompleteUIResourceMetaUIPermissions;
3400
+ prefersBorder?: boolean;
3401
+ }
3402
+ /**
3403
+ * Schema for the `ToolExecutionCompleteUIResourceMetaUICsp` type.
3404
+ */
3405
+ export interface ToolExecutionCompleteUIResourceMetaUICsp {
3406
+ baseUriDomains?: string[];
3407
+ connectDomains?: string[];
3408
+ frameDomains?: string[];
3409
+ resourceDomains?: string[];
3410
+ }
3411
+ /**
3412
+ * Schema for the `ToolExecutionCompleteUIResourceMetaUIPermissions` type.
3413
+ */
3414
+ export interface ToolExecutionCompleteUIResourceMetaUIPermissions {
3415
+ camera?: ToolExecutionCompleteUIResourceMetaUIPermissionsCamera;
3416
+ clipboardWrite?: ToolExecutionCompleteUIResourceMetaUIPermissionsClipboardWrite;
3417
+ geolocation?: ToolExecutionCompleteUIResourceMetaUIPermissionsGeolocation;
3418
+ microphone?: ToolExecutionCompleteUIResourceMetaUIPermissionsMicrophone;
3419
+ }
3420
+ /**
3421
+ * Schema for the `ToolExecutionCompleteUIResourceMetaUIPermissionsCamera` type.
3422
+ */
3423
+ export interface ToolExecutionCompleteUIResourceMetaUIPermissionsCamera {
3424
+ [k: string]: unknown | undefined;
3425
+ }
3426
+ /**
3427
+ * Schema for the `ToolExecutionCompleteUIResourceMetaUIPermissionsClipboardWrite` type.
3428
+ */
3429
+ export interface ToolExecutionCompleteUIResourceMetaUIPermissionsClipboardWrite {
3430
+ [k: string]: unknown | undefined;
3431
+ }
3432
+ /**
3433
+ * Schema for the `ToolExecutionCompleteUIResourceMetaUIPermissionsGeolocation` type.
3434
+ */
3435
+ export interface ToolExecutionCompleteUIResourceMetaUIPermissionsGeolocation {
3436
+ [k: string]: unknown | undefined;
3437
+ }
3438
+ /**
3439
+ * Schema for the `ToolExecutionCompleteUIResourceMetaUIPermissionsMicrophone` type.
3440
+ */
3441
+ export interface ToolExecutionCompleteUIResourceMetaUIPermissionsMicrophone {
3442
+ [k: string]: unknown | undefined;
3443
+ }
3444
+ /**
3445
+ * Tool definition metadata, present for MCP tools with MCP Apps support
3446
+ */
3447
+ export interface ToolExecutionCompleteToolDescription {
3448
+ _meta?: ToolExecutionCompleteToolDescriptionMeta;
3449
+ /**
3450
+ * Tool description
3451
+ */
3452
+ description?: string;
3453
+ /**
3454
+ * Tool name
3455
+ */
3456
+ name: string;
3457
+ }
3458
+ /**
3459
+ * MCP Apps metadata for UI resource association
3460
+ */
3461
+ export interface ToolExecutionCompleteToolDescriptionMeta {
3462
+ ui?: ToolExecutionCompleteToolDescriptionMetaUI;
3463
+ }
3464
+ /**
3465
+ * Schema for the `ToolExecutionCompleteToolDescriptionMetaUI` type.
3466
+ */
3467
+ export interface ToolExecutionCompleteToolDescriptionMetaUI {
3468
+ /**
3469
+ * URI of the UI resource
3470
+ */
3471
+ resourceUri?: string;
3472
+ /**
3473
+ * Who can access this tool
3474
+ */
3475
+ visibility?: ToolExecutionCompleteToolDescriptionMetaUIVisibility[];
3476
+ }
3477
+ /**
3478
+ * Session event "skill.invoked". Skill invocation details including content, allowed tools, and plugin metadata
3479
+ */
3480
+ export interface SkillInvokedEvent {
3481
+ /**
3482
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
3483
+ */
3484
+ agentId?: string;
3485
+ data: SkillInvokedData;
3486
+ /**
3487
+ * When true, the event is transient and not persisted to the session event log on disk
3488
+ */
3489
+ ephemeral?: boolean;
3490
+ /**
3491
+ * Unique event identifier (UUID v4), generated when the event is emitted
3492
+ */
3493
+ id: string;
3494
+ /**
3495
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
3496
+ */
3497
+ parentId: string | null;
3498
+ /**
3499
+ * ISO 8601 timestamp when the event was created
3500
+ */
3501
+ timestamp: string;
3502
+ /**
3503
+ * Type discriminator. Always "skill.invoked".
3504
+ */
3505
+ type: "skill.invoked";
2467
3506
  }
2468
3507
  /**
2469
3508
  * Skill invocation details including content, allowed tools, and plugin metadata
@@ -2497,7 +3536,15 @@ export interface SkillInvokedData {
2497
3536
  * Version of the plugin this skill originated from, when applicable
2498
3537
  */
2499
3538
  pluginVersion?: string;
3539
+ /**
3540
+ * Source identifier for where the skill was discovered. Known values include: project (workspace skill), inherited (parent-directory skill), personal-copilot (~/.copilot/skills), personal-agents (~/.agents/skills), personal-claude (~/.claude/skills), custom (configured directory), plugin (installed plugin), builtin (bundled runtime skill), and remote (org/enterprise skill)
3541
+ */
3542
+ source?: string;
3543
+ trigger?: SkillInvokedTrigger;
2500
3544
  }
3545
+ /**
3546
+ * Session event "subagent.started". Sub-agent startup details including parent tool call and agent information
3547
+ */
2501
3548
  export interface SubagentStartedEvent {
2502
3549
  /**
2503
3550
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
@@ -2520,6 +3567,9 @@ export interface SubagentStartedEvent {
2520
3567
  * ISO 8601 timestamp when the event was created
2521
3568
  */
2522
3569
  timestamp: string;
3570
+ /**
3571
+ * Type discriminator. Always "subagent.started".
3572
+ */
2523
3573
  type: "subagent.started";
2524
3574
  }
2525
3575
  /**
@@ -2538,11 +3588,18 @@ export interface SubagentStartedData {
2538
3588
  * Internal name of the sub-agent
2539
3589
  */
2540
3590
  agentName: string;
3591
+ /**
3592
+ * Model the sub-agent will run with, when known at start. Surfaced in the timeline for auto-selected sub-agents (e.g. rubber-duck).
3593
+ */
3594
+ model?: string;
2541
3595
  /**
2542
3596
  * Tool call ID of the parent tool invocation that spawned this sub-agent
2543
3597
  */
2544
3598
  toolCallId: string;
2545
3599
  }
3600
+ /**
3601
+ * Session event "subagent.completed". Sub-agent completion details for successful execution
3602
+ */
2546
3603
  export interface SubagentCompletedEvent {
2547
3604
  /**
2548
3605
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
@@ -2565,6 +3622,9 @@ export interface SubagentCompletedEvent {
2565
3622
  * ISO 8601 timestamp when the event was created
2566
3623
  */
2567
3624
  timestamp: string;
3625
+ /**
3626
+ * Type discriminator. Always "subagent.completed".
3627
+ */
2568
3628
  type: "subagent.completed";
2569
3629
  }
2570
3630
  /**
@@ -2600,6 +3660,9 @@ export interface SubagentCompletedData {
2600
3660
  */
2601
3661
  totalToolCalls?: number;
2602
3662
  }
3663
+ /**
3664
+ * Session event "subagent.failed". Sub-agent failure details including error message and agent information
3665
+ */
2603
3666
  export interface SubagentFailedEvent {
2604
3667
  /**
2605
3668
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
@@ -2622,6 +3685,9 @@ export interface SubagentFailedEvent {
2622
3685
  * ISO 8601 timestamp when the event was created
2623
3686
  */
2624
3687
  timestamp: string;
3688
+ /**
3689
+ * Type discriminator. Always "subagent.failed".
3690
+ */
2625
3691
  type: "subagent.failed";
2626
3692
  }
2627
3693
  /**
@@ -2661,6 +3727,9 @@ export interface SubagentFailedData {
2661
3727
  */
2662
3728
  totalToolCalls?: number;
2663
3729
  }
3730
+ /**
3731
+ * Session event "subagent.selected". Custom agent selection details including name and available tools
3732
+ */
2664
3733
  export interface SubagentSelectedEvent {
2665
3734
  /**
2666
3735
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
@@ -2683,6 +3752,9 @@ export interface SubagentSelectedEvent {
2683
3752
  * ISO 8601 timestamp when the event was created
2684
3753
  */
2685
3754
  timestamp: string;
3755
+ /**
3756
+ * Type discriminator. Always "subagent.selected".
3757
+ */
2686
3758
  type: "subagent.selected";
2687
3759
  }
2688
3760
  /**
@@ -2702,6 +3774,9 @@ export interface SubagentSelectedData {
2702
3774
  */
2703
3775
  tools: string[] | null;
2704
3776
  }
3777
+ /**
3778
+ * Session event "subagent.deselected". Empty payload; the event signals that the custom agent was deselected, returning to the default agent
3779
+ */
2705
3780
  export interface SubagentDeselectedEvent {
2706
3781
  /**
2707
3782
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
@@ -2724,6 +3799,9 @@ export interface SubagentDeselectedEvent {
2724
3799
  * ISO 8601 timestamp when the event was created
2725
3800
  */
2726
3801
  timestamp: string;
3802
+ /**
3803
+ * Type discriminator. Always "subagent.deselected".
3804
+ */
2727
3805
  type: "subagent.deselected";
2728
3806
  }
2729
3807
  /**
@@ -2731,6 +3809,9 @@ export interface SubagentDeselectedEvent {
2731
3809
  */
2732
3810
  export interface SubagentDeselectedData {
2733
3811
  }
3812
+ /**
3813
+ * Session event "hook.start". Hook invocation start details including type and input data
3814
+ */
2734
3815
  export interface HookStartEvent {
2735
3816
  /**
2736
3817
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
@@ -2753,6 +3834,9 @@ export interface HookStartEvent {
2753
3834
  * ISO 8601 timestamp when the event was created
2754
3835
  */
2755
3836
  timestamp: string;
3837
+ /**
3838
+ * Type discriminator. Always "hook.start".
3839
+ */
2756
3840
  type: "hook.start";
2757
3841
  }
2758
3842
  /**
@@ -2771,9 +3855,12 @@ export interface HookStartData {
2771
3855
  * Input data passed to the hook
2772
3856
  */
2773
3857
  input?: {
2774
- [k: string]: unknown;
3858
+ [k: string]: unknown | undefined;
2775
3859
  };
2776
3860
  }
3861
+ /**
3862
+ * Session event "hook.end". Hook invocation completion details including output, success status, and error information
3863
+ */
2777
3864
  export interface HookEndEvent {
2778
3865
  /**
2779
3866
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
@@ -2796,6 +3883,9 @@ export interface HookEndEvent {
2796
3883
  * ISO 8601 timestamp when the event was created
2797
3884
  */
2798
3885
  timestamp: string;
3886
+ /**
3887
+ * Type discriminator. Always "hook.end".
3888
+ */
2799
3889
  type: "hook.end";
2800
3890
  }
2801
3891
  /**
@@ -2815,7 +3905,7 @@ export interface HookEndData {
2815
3905
  * Output data produced by the hook
2816
3906
  */
2817
3907
  output?: {
2818
- [k: string]: unknown;
3908
+ [k: string]: unknown | undefined;
2819
3909
  };
2820
3910
  /**
2821
3911
  * Whether the hook completed successfully
@@ -2835,6 +3925,48 @@ export interface HookEndError {
2835
3925
  */
2836
3926
  stack?: string;
2837
3927
  }
3928
+ /**
3929
+ * Session event "hook.progress". Ephemeral progress update from a running hook process
3930
+ */
3931
+ export interface HookProgressEvent {
3932
+ /**
3933
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
3934
+ */
3935
+ agentId?: string;
3936
+ data: HookProgressData;
3937
+ /**
3938
+ * Always true for events that are transient and not persisted to the session event log on disk.
3939
+ */
3940
+ ephemeral: true;
3941
+ /**
3942
+ * Unique event identifier (UUID v4), generated when the event is emitted
3943
+ */
3944
+ id: string;
3945
+ /**
3946
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
3947
+ */
3948
+ parentId: string | null;
3949
+ /**
3950
+ * ISO 8601 timestamp when the event was created
3951
+ */
3952
+ timestamp: string;
3953
+ /**
3954
+ * Type discriminator. Always "hook.progress".
3955
+ */
3956
+ type: "hook.progress";
3957
+ }
3958
+ /**
3959
+ * Ephemeral progress update from a running hook process
3960
+ */
3961
+ export interface HookProgressData {
3962
+ /**
3963
+ * Human-readable progress message from the hook process
3964
+ */
3965
+ message: string;
3966
+ }
3967
+ /**
3968
+ * Session event "system.message". System/developer instruction content with role and optional template metadata
3969
+ */
2838
3970
  export interface SystemMessageEvent {
2839
3971
  /**
2840
3972
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
@@ -2857,6 +3989,9 @@ export interface SystemMessageEvent {
2857
3989
  * ISO 8601 timestamp when the event was created
2858
3990
  */
2859
3991
  timestamp: string;
3992
+ /**
3993
+ * Type discriminator. Always "system.message".
3994
+ */
2860
3995
  type: "system.message";
2861
3996
  }
2862
3997
  /**
@@ -2886,9 +4021,12 @@ export interface SystemMessageMetadata {
2886
4021
  * Template variables used when constructing the prompt
2887
4022
  */
2888
4023
  variables?: {
2889
- [k: string]: unknown;
4024
+ [k: string]: unknown | undefined;
2890
4025
  };
2891
4026
  }
4027
+ /**
4028
+ * Session event "system.notification". System-generated notification for runtime events like background task completion
4029
+ */
2892
4030
  export interface SystemNotificationEvent {
2893
4031
  /**
2894
4032
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
@@ -2911,6 +4049,9 @@ export interface SystemNotificationEvent {
2911
4049
  * ISO 8601 timestamp when the event was created
2912
4050
  */
2913
4051
  timestamp: string;
4052
+ /**
4053
+ * Type discriminator. Always "system.notification".
4054
+ */
2914
4055
  type: "system.notification";
2915
4056
  }
2916
4057
  /**
@@ -2923,6 +4064,9 @@ export interface SystemNotificationData {
2923
4064
  content: string;
2924
4065
  kind: SystemNotification;
2925
4066
  }
4067
+ /**
4068
+ * Schema for the `SystemNotificationAgentCompleted` type.
4069
+ */
2926
4070
  export interface SystemNotificationAgentCompleted {
2927
4071
  /**
2928
4072
  * Unique identifier of the background agent
@@ -2941,8 +4085,14 @@ export interface SystemNotificationAgentCompleted {
2941
4085
  */
2942
4086
  prompt?: string;
2943
4087
  status: SystemNotificationAgentCompletedStatus;
4088
+ /**
4089
+ * Type discriminator. Always "agent_completed".
4090
+ */
2944
4091
  type: "agent_completed";
2945
4092
  }
4093
+ /**
4094
+ * Schema for the `SystemNotificationAgentIdle` type.
4095
+ */
2946
4096
  export interface SystemNotificationAgentIdle {
2947
4097
  /**
2948
4098
  * Unique identifier of the background agent
@@ -2956,8 +4106,14 @@ export interface SystemNotificationAgentIdle {
2956
4106
  * Human-readable description of the agent task
2957
4107
  */
2958
4108
  description?: string;
4109
+ /**
4110
+ * Type discriminator. Always "agent_idle".
4111
+ */
2959
4112
  type: "agent_idle";
2960
4113
  }
4114
+ /**
4115
+ * Schema for the `SystemNotificationNewInboxMessage` type.
4116
+ */
2961
4117
  export interface SystemNotificationNewInboxMessage {
2962
4118
  /**
2963
4119
  * Unique identifier of the inbox entry
@@ -2968,15 +4124,21 @@ export interface SystemNotificationNewInboxMessage {
2968
4124
  */
2969
4125
  senderName: string;
2970
4126
  /**
2971
- * Category of the sender (e.g., ambient-agent, plugin, hook)
4127
+ * Category of the sender (e.g., sidekick-agent, plugin, hook)
2972
4128
  */
2973
4129
  senderType: string;
2974
4130
  /**
2975
4131
  * Short summary shown before the agent decides whether to read the inbox
2976
4132
  */
2977
4133
  summary: string;
4134
+ /**
4135
+ * Type discriminator. Always "new_inbox_message".
4136
+ */
2978
4137
  type: "new_inbox_message";
2979
4138
  }
4139
+ /**
4140
+ * Schema for the `SystemNotificationShellCompleted` type.
4141
+ */
2980
4142
  export interface SystemNotificationShellCompleted {
2981
4143
  /**
2982
4144
  * Human-readable description of the command
@@ -2990,8 +4152,14 @@ export interface SystemNotificationShellCompleted {
2990
4152
  * Unique identifier of the shell session
2991
4153
  */
2992
4154
  shellId: string;
4155
+ /**
4156
+ * Type discriminator. Always "shell_completed".
4157
+ */
2993
4158
  type: "shell_completed";
2994
4159
  }
4160
+ /**
4161
+ * Schema for the `SystemNotificationShellDetachedCompleted` type.
4162
+ */
2995
4163
  export interface SystemNotificationShellDetachedCompleted {
2996
4164
  /**
2997
4165
  * Human-readable description of the command
@@ -3001,15 +4169,49 @@ export interface SystemNotificationShellDetachedCompleted {
3001
4169
  * Unique identifier of the detached shell session
3002
4170
  */
3003
4171
  shellId: string;
4172
+ /**
4173
+ * Type discriminator. Always "shell_detached_completed".
4174
+ */
3004
4175
  type: "shell_detached_completed";
3005
4176
  }
4177
+ /**
4178
+ * Schema for the `SystemNotificationInstructionDiscovered` type.
4179
+ */
4180
+ export interface SystemNotificationInstructionDiscovered {
4181
+ /**
4182
+ * Human-readable label for the timeline (e.g., 'AGENTS.md from packages/billing/')
4183
+ */
4184
+ description?: string;
4185
+ /**
4186
+ * Relative path to the discovered instruction file
4187
+ */
4188
+ sourcePath: string;
4189
+ /**
4190
+ * Path of the file access that triggered discovery
4191
+ */
4192
+ triggerFile: string;
4193
+ /**
4194
+ * Tool command that triggered discovery (currently always 'view')
4195
+ */
4196
+ triggerTool: string;
4197
+ /**
4198
+ * Type discriminator. Always "instruction_discovered".
4199
+ */
4200
+ type: "instruction_discovered";
4201
+ }
4202
+ /**
4203
+ * Session event "permission.requested". Permission request notification requiring client approval with request details
4204
+ */
3006
4205
  export interface PermissionRequestedEvent {
3007
4206
  /**
3008
4207
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
3009
4208
  */
3010
4209
  agentId?: string;
3011
4210
  data: PermissionRequestedData;
3012
- ephemeral: true;
4211
+ /**
4212
+ * When true, the event is transient and not persisted to the session event log on disk
4213
+ */
4214
+ ephemeral?: boolean;
3013
4215
  /**
3014
4216
  * Unique event identifier (UUID v4), generated when the event is emitted
3015
4217
  */
@@ -3022,6 +4224,9 @@ export interface PermissionRequestedEvent {
3022
4224
  * ISO 8601 timestamp when the event was created
3023
4225
  */
3024
4226
  timestamp: string;
4227
+ /**
4228
+ * Type discriminator. Always "permission.requested".
4229
+ */
3025
4230
  type: "permission.requested";
3026
4231
  }
3027
4232
  /**
@@ -3084,6 +4289,9 @@ export interface PermissionRequestShell {
3084
4289
  */
3085
4290
  warning?: string;
3086
4291
  }
4292
+ /**
4293
+ * Schema for the `PermissionRequestShellCommand` type.
4294
+ */
3087
4295
  export interface PermissionRequestShellCommand {
3088
4296
  /**
3089
4297
  * Command identifier (e.g., executable name)
@@ -3094,6 +4302,9 @@ export interface PermissionRequestShellCommand {
3094
4302
  */
3095
4303
  readOnly: boolean;
3096
4304
  }
4305
+ /**
4306
+ * Schema for the `PermissionRequestShellPossibleUrl` type.
4307
+ */
3097
4308
  export interface PermissionRequestShellPossibleUrl {
3098
4309
  /**
3099
4310
  * URL that may be accessed by the command
@@ -3162,7 +4373,7 @@ export interface PermissionRequestMcp {
3162
4373
  * Arguments to pass to the MCP tool
3163
4374
  */
3164
4375
  args?: {
3165
- [k: string]: unknown;
4376
+ [k: string]: unknown | undefined;
3166
4377
  };
3167
4378
  /**
3168
4379
  * Permission kind discriminator
@@ -3249,7 +4460,7 @@ export interface PermissionRequestCustomTool {
3249
4460
  * Arguments to pass to the custom tool
3250
4461
  */
3251
4462
  args?: {
3252
- [k: string]: unknown;
4463
+ [k: string]: unknown | undefined;
3253
4464
  };
3254
4465
  /**
3255
4466
  * Permission kind discriminator
@@ -3284,7 +4495,7 @@ export interface PermissionRequestHook {
3284
4495
  * Arguments of the tool call being gated
3285
4496
  */
3286
4497
  toolArgs?: {
3287
- [k: string]: unknown;
4498
+ [k: string]: unknown | undefined;
3288
4499
  };
3289
4500
  /**
3290
4501
  * Tool call ID that triggered this permission request
@@ -3295,6 +4506,48 @@ export interface PermissionRequestHook {
3295
4506
  */
3296
4507
  toolName: string;
3297
4508
  }
4509
+ /**
4510
+ * Extension management permission request
4511
+ */
4512
+ export interface PermissionRequestExtensionManagement {
4513
+ /**
4514
+ * Name of the extension being managed
4515
+ */
4516
+ extensionName?: string;
4517
+ /**
4518
+ * Permission kind discriminator
4519
+ */
4520
+ kind: "extension-management";
4521
+ /**
4522
+ * The extension management operation (scaffold, reload)
4523
+ */
4524
+ operation: string;
4525
+ /**
4526
+ * Tool call ID that triggered this permission request
4527
+ */
4528
+ toolCallId?: string;
4529
+ }
4530
+ /**
4531
+ * Extension permission access request
4532
+ */
4533
+ export interface PermissionRequestExtensionPermissionAccess {
4534
+ /**
4535
+ * Capabilities the extension is requesting
4536
+ */
4537
+ capabilities: string[];
4538
+ /**
4539
+ * Name of the extension requesting permission access
4540
+ */
4541
+ extensionName: string;
4542
+ /**
4543
+ * Permission kind discriminator
4544
+ */
4545
+ kind: "extension-permission-access";
4546
+ /**
4547
+ * Tool call ID that triggered this permission request
4548
+ */
4549
+ toolCallId?: string;
4550
+ }
3298
4551
  /**
3299
4552
  * Shell command permission prompt
3300
4553
  */
@@ -3433,12 +4686,12 @@ export interface PermissionPromptRequestUrl {
3433
4686
  * Memory operation permission prompt
3434
4687
  */
3435
4688
  export interface PermissionPromptRequestMemory {
3436
- action?: PermissionPromptRequestMemoryAction;
4689
+ action?: PermissionRequestMemoryAction;
3437
4690
  /**
3438
4691
  * Source references for the stored fact (store only)
3439
4692
  */
3440
4693
  citations?: string;
3441
- direction?: PermissionPromptRequestMemoryDirection;
4694
+ direction?: PermissionRequestMemoryDirection;
3442
4695
  /**
3443
4696
  * The fact being stored or voted on
3444
4697
  */
@@ -3468,7 +4721,7 @@ export interface PermissionPromptRequestCustomTool {
3468
4721
  * Arguments to pass to the custom tool
3469
4722
  */
3470
4723
  args?: {
3471
- [k: string]: unknown;
4724
+ [k: string]: unknown | undefined;
3472
4725
  };
3473
4726
  /**
3474
4727
  * Prompt kind discriminator
@@ -3521,7 +4774,7 @@ export interface PermissionPromptRequestHook {
3521
4774
  * Arguments of the tool call being gated
3522
4775
  */
3523
4776
  toolArgs?: {
3524
- [k: string]: unknown;
4777
+ [k: string]: unknown | undefined;
3525
4778
  };
3526
4779
  /**
3527
4780
  * Tool call ID that triggered this permission request
@@ -3532,54 +4785,333 @@ export interface PermissionPromptRequestHook {
3532
4785
  */
3533
4786
  toolName: string;
3534
4787
  }
3535
- export interface PermissionCompletedEvent {
4788
+ /**
4789
+ * Extension management permission prompt
4790
+ */
4791
+ export interface PermissionPromptRequestExtensionManagement {
3536
4792
  /**
3537
- * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
4793
+ * Name of the extension being managed
3538
4794
  */
3539
- agentId?: string;
3540
- data: PermissionCompletedData;
3541
- ephemeral: true;
4795
+ extensionName?: string;
3542
4796
  /**
3543
- * Unique event identifier (UUID v4), generated when the event is emitted
4797
+ * Prompt kind discriminator
3544
4798
  */
3545
- id: string;
4799
+ kind: "extension-management";
3546
4800
  /**
3547
- * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
4801
+ * The extension management operation (scaffold, reload)
3548
4802
  */
3549
- parentId: string | null;
4803
+ operation: string;
3550
4804
  /**
3551
- * ISO 8601 timestamp when the event was created
4805
+ * Tool call ID that triggered this permission request
3552
4806
  */
3553
- timestamp: string;
3554
- type: "permission.completed";
4807
+ toolCallId?: string;
3555
4808
  }
3556
4809
  /**
3557
- * Permission request completion notification signaling UI dismissal
4810
+ * Extension permission access prompt
3558
4811
  */
3559
- export interface PermissionCompletedData {
4812
+ export interface PermissionPromptRequestExtensionPermissionAccess {
3560
4813
  /**
3561
- * Request ID of the resolved permission request; clients should dismiss any UI for this request
4814
+ * Capabilities the extension is requesting
3562
4815
  */
3563
- requestId: string;
3564
- result: PermissionCompletedResult;
4816
+ capabilities: string[];
3565
4817
  /**
3566
- * Optional tool call ID associated with this permission prompt; clients may use it to correlate UI created from tool-scoped prompts
4818
+ * Name of the extension requesting permission access
4819
+ */
4820
+ extensionName: string;
4821
+ /**
4822
+ * Prompt kind discriminator
4823
+ */
4824
+ kind: "extension-permission-access";
4825
+ /**
4826
+ * Tool call ID that triggered this permission request
3567
4827
  */
3568
4828
  toolCallId?: string;
3569
4829
  }
3570
4830
  /**
3571
- * The result of the permission request
4831
+ * Session event "permission.completed". Permission request completion notification signaling UI dismissal
3572
4832
  */
3573
- export interface PermissionCompletedResult {
3574
- kind: PermissionCompletedKind;
3575
- }
3576
- export interface UserInputRequestedEvent {
4833
+ export interface PermissionCompletedEvent {
3577
4834
  /**
3578
4835
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
3579
4836
  */
3580
4837
  agentId?: string;
3581
- data: UserInputRequestedData;
3582
- ephemeral: true;
4838
+ data: PermissionCompletedData;
4839
+ /**
4840
+ * When true, the event is transient and not persisted to the session event log on disk
4841
+ */
4842
+ ephemeral?: boolean;
4843
+ /**
4844
+ * Unique event identifier (UUID v4), generated when the event is emitted
4845
+ */
4846
+ id: string;
4847
+ /**
4848
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
4849
+ */
4850
+ parentId: string | null;
4851
+ /**
4852
+ * ISO 8601 timestamp when the event was created
4853
+ */
4854
+ timestamp: string;
4855
+ /**
4856
+ * Type discriminator. Always "permission.completed".
4857
+ */
4858
+ type: "permission.completed";
4859
+ }
4860
+ /**
4861
+ * Permission request completion notification signaling UI dismissal
4862
+ */
4863
+ export interface PermissionCompletedData {
4864
+ /**
4865
+ * Request ID of the resolved permission request; clients should dismiss any UI for this request
4866
+ */
4867
+ requestId: string;
4868
+ result: PermissionResult;
4869
+ /**
4870
+ * Optional tool call ID associated with this permission prompt; clients may use it to correlate UI created from tool-scoped prompts
4871
+ */
4872
+ toolCallId?: string;
4873
+ }
4874
+ /**
4875
+ * Schema for the `PermissionApproved` type.
4876
+ */
4877
+ export interface PermissionApproved {
4878
+ /**
4879
+ * The permission request was approved
4880
+ */
4881
+ kind: "approved";
4882
+ }
4883
+ /**
4884
+ * Schema for the `PermissionApprovedForSession` type.
4885
+ */
4886
+ export interface PermissionApprovedForSession {
4887
+ approval: UserToolSessionApproval;
4888
+ /**
4889
+ * Approved and remembered for the rest of the session
4890
+ */
4891
+ kind: "approved-for-session";
4892
+ }
4893
+ /**
4894
+ * Schema for the `UserToolSessionApprovalCommands` type.
4895
+ */
4896
+ export interface UserToolSessionApprovalCommands {
4897
+ /**
4898
+ * Command identifiers approved by the user
4899
+ */
4900
+ commandIdentifiers: string[];
4901
+ /**
4902
+ * Command approval kind
4903
+ */
4904
+ kind: "commands";
4905
+ }
4906
+ /**
4907
+ * Schema for the `UserToolSessionApprovalRead` type.
4908
+ */
4909
+ export interface UserToolSessionApprovalRead {
4910
+ /**
4911
+ * Read approval kind
4912
+ */
4913
+ kind: "read";
4914
+ }
4915
+ /**
4916
+ * Schema for the `UserToolSessionApprovalWrite` type.
4917
+ */
4918
+ export interface UserToolSessionApprovalWrite {
4919
+ /**
4920
+ * Write approval kind
4921
+ */
4922
+ kind: "write";
4923
+ }
4924
+ /**
4925
+ * Schema for the `UserToolSessionApprovalMcp` type.
4926
+ */
4927
+ export interface UserToolSessionApprovalMcp {
4928
+ /**
4929
+ * MCP tool approval kind
4930
+ */
4931
+ kind: "mcp";
4932
+ /**
4933
+ * MCP server name
4934
+ */
4935
+ serverName: string;
4936
+ /**
4937
+ * Optional MCP tool name, or null for all tools on the server
4938
+ */
4939
+ toolName: string | null;
4940
+ }
4941
+ /**
4942
+ * Schema for the `UserToolSessionApprovalMemory` type.
4943
+ */
4944
+ export interface UserToolSessionApprovalMemory {
4945
+ /**
4946
+ * Memory approval kind
4947
+ */
4948
+ kind: "memory";
4949
+ }
4950
+ /**
4951
+ * Schema for the `UserToolSessionApprovalCustomTool` type.
4952
+ */
4953
+ export interface UserToolSessionApprovalCustomTool {
4954
+ /**
4955
+ * Custom tool approval kind
4956
+ */
4957
+ kind: "custom-tool";
4958
+ /**
4959
+ * Custom tool name
4960
+ */
4961
+ toolName: string;
4962
+ }
4963
+ /**
4964
+ * Schema for the `UserToolSessionApprovalExtensionManagement` type.
4965
+ */
4966
+ export interface UserToolSessionApprovalExtensionManagement {
4967
+ /**
4968
+ * Extension management approval kind
4969
+ */
4970
+ kind: "extension-management";
4971
+ /**
4972
+ * Optional operation identifier
4973
+ */
4974
+ operation?: string;
4975
+ }
4976
+ /**
4977
+ * Schema for the `UserToolSessionApprovalExtensionPermissionAccess` type.
4978
+ */
4979
+ export interface UserToolSessionApprovalExtensionPermissionAccess {
4980
+ /**
4981
+ * Extension name
4982
+ */
4983
+ extensionName: string;
4984
+ /**
4985
+ * Extension permission access approval kind
4986
+ */
4987
+ kind: "extension-permission-access";
4988
+ }
4989
+ /**
4990
+ * Schema for the `PermissionApprovedForLocation` type.
4991
+ */
4992
+ export interface PermissionApprovedForLocation {
4993
+ approval: UserToolSessionApproval;
4994
+ /**
4995
+ * Approved and persisted for this project location
4996
+ */
4997
+ kind: "approved-for-location";
4998
+ /**
4999
+ * The location key (git root or cwd) to persist the approval to
5000
+ */
5001
+ locationKey: string;
5002
+ }
5003
+ /**
5004
+ * Schema for the `PermissionCancelled` type.
5005
+ */
5006
+ export interface PermissionCancelled {
5007
+ /**
5008
+ * The permission request was cancelled before a response was used
5009
+ */
5010
+ kind: "cancelled";
5011
+ /**
5012
+ * Optional explanation of why the request was cancelled
5013
+ */
5014
+ reason?: string;
5015
+ }
5016
+ /**
5017
+ * Schema for the `PermissionDeniedByRules` type.
5018
+ */
5019
+ export interface PermissionDeniedByRules {
5020
+ /**
5021
+ * Denied because approval rules explicitly blocked it
5022
+ */
5023
+ kind: "denied-by-rules";
5024
+ /**
5025
+ * Rules that denied the request
5026
+ */
5027
+ rules: PermissionRule[];
5028
+ }
5029
+ /**
5030
+ * Schema for the `PermissionRule` type.
5031
+ */
5032
+ export interface PermissionRule {
5033
+ /**
5034
+ * Argument value matched against the request, or null when the rule kind has no argument (e.g. 'read', 'write', 'memory').
5035
+ */
5036
+ argument: string | null;
5037
+ /**
5038
+ * The rule kind, such as Shell or GitHubMCP
5039
+ */
5040
+ kind: string;
5041
+ }
5042
+ /**
5043
+ * Schema for the `PermissionDeniedNoApprovalRuleAndCouldNotRequestFromUser` type.
5044
+ */
5045
+ export interface PermissionDeniedNoApprovalRuleAndCouldNotRequestFromUser {
5046
+ /**
5047
+ * Denied because no approval rule matched and user confirmation was unavailable
5048
+ */
5049
+ kind: "denied-no-approval-rule-and-could-not-request-from-user";
5050
+ }
5051
+ /**
5052
+ * Schema for the `PermissionDeniedInteractivelyByUser` type.
5053
+ */
5054
+ export interface PermissionDeniedInteractivelyByUser {
5055
+ /**
5056
+ * Optional feedback from the user explaining the denial
5057
+ */
5058
+ feedback?: string;
5059
+ /**
5060
+ * Whether to force-reject the current agent turn
5061
+ */
5062
+ forceReject?: boolean;
5063
+ /**
5064
+ * Denied by the user during an interactive prompt
5065
+ */
5066
+ kind: "denied-interactively-by-user";
5067
+ }
5068
+ /**
5069
+ * Schema for the `PermissionDeniedByContentExclusionPolicy` type.
5070
+ */
5071
+ export interface PermissionDeniedByContentExclusionPolicy {
5072
+ /**
5073
+ * Denied by the organization's content exclusion policy
5074
+ */
5075
+ kind: "denied-by-content-exclusion-policy";
5076
+ /**
5077
+ * Human-readable explanation of why the path was excluded
5078
+ */
5079
+ message: string;
5080
+ /**
5081
+ * File path that triggered the exclusion
5082
+ */
5083
+ path: string;
5084
+ }
5085
+ /**
5086
+ * Schema for the `PermissionDeniedByPermissionRequestHook` type.
5087
+ */
5088
+ export interface PermissionDeniedByPermissionRequestHook {
5089
+ /**
5090
+ * Whether to interrupt the current agent turn
5091
+ */
5092
+ interrupt?: boolean;
5093
+ /**
5094
+ * Denied by a permission request hook registered by an extension or plugin
5095
+ */
5096
+ kind: "denied-by-permission-request-hook";
5097
+ /**
5098
+ * Optional message from the hook explaining the denial
5099
+ */
5100
+ message?: string;
5101
+ }
5102
+ /**
5103
+ * Session event "user_input.requested". User input request notification with question and optional predefined choices
5104
+ */
5105
+ export interface UserInputRequestedEvent {
5106
+ /**
5107
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
5108
+ */
5109
+ agentId?: string;
5110
+ data: UserInputRequestedData;
5111
+ /**
5112
+ * Always true for events that are transient and not persisted to the session event log on disk.
5113
+ */
5114
+ ephemeral: true;
3583
5115
  /**
3584
5116
  * Unique event identifier (UUID v4), generated when the event is emitted
3585
5117
  */
@@ -3592,6 +5124,9 @@ export interface UserInputRequestedEvent {
3592
5124
  * ISO 8601 timestamp when the event was created
3593
5125
  */
3594
5126
  timestamp: string;
5127
+ /**
5128
+ * Type discriminator. Always "user_input.requested".
5129
+ */
3595
5130
  type: "user_input.requested";
3596
5131
  }
3597
5132
  /**
@@ -3619,12 +5154,18 @@ export interface UserInputRequestedData {
3619
5154
  */
3620
5155
  toolCallId?: string;
3621
5156
  }
5157
+ /**
5158
+ * Session event "user_input.completed". User input request completion with the user's response
5159
+ */
3622
5160
  export interface UserInputCompletedEvent {
3623
5161
  /**
3624
5162
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
3625
5163
  */
3626
5164
  agentId?: string;
3627
5165
  data: UserInputCompletedData;
5166
+ /**
5167
+ * Always true for events that are transient and not persisted to the session event log on disk.
5168
+ */
3628
5169
  ephemeral: true;
3629
5170
  /**
3630
5171
  * Unique event identifier (UUID v4), generated when the event is emitted
@@ -3638,6 +5179,9 @@ export interface UserInputCompletedEvent {
3638
5179
  * ISO 8601 timestamp when the event was created
3639
5180
  */
3640
5181
  timestamp: string;
5182
+ /**
5183
+ * Type discriminator. Always "user_input.completed".
5184
+ */
3641
5185
  type: "user_input.completed";
3642
5186
  }
3643
5187
  /**
@@ -3657,12 +5201,18 @@ export interface UserInputCompletedData {
3657
5201
  */
3658
5202
  wasFreeform?: boolean;
3659
5203
  }
5204
+ /**
5205
+ * Session event "elicitation.requested". Elicitation request; may be form-based (structured input) or URL-based (browser redirect)
5206
+ */
3660
5207
  export interface ElicitationRequestedEvent {
3661
5208
  /**
3662
5209
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
3663
5210
  */
3664
5211
  agentId?: string;
3665
5212
  data: ElicitationRequestedData;
5213
+ /**
5214
+ * Always true for events that are transient and not persisted to the session event log on disk.
5215
+ */
3666
5216
  ephemeral: true;
3667
5217
  /**
3668
5218
  * Unique event identifier (UUID v4), generated when the event is emitted
@@ -3676,6 +5226,9 @@ export interface ElicitationRequestedEvent {
3676
5226
  * ISO 8601 timestamp when the event was created
3677
5227
  */
3678
5228
  timestamp: string;
5229
+ /**
5230
+ * Type discriminator. Always "elicitation.requested".
5231
+ */
3679
5232
  type: "elicitation.requested";
3680
5233
  }
3681
5234
  /**
@@ -3704,7 +5257,7 @@ export interface ElicitationRequestedData {
3704
5257
  * URL to open in the user's browser (url mode only)
3705
5258
  */
3706
5259
  url?: string;
3707
- [k: string]: unknown;
5260
+ [k: string]: unknown | undefined;
3708
5261
  }
3709
5262
  /**
3710
5263
  * JSON Schema describing the form fields to present to the user (form mode only)
@@ -3714,7 +5267,7 @@ export interface ElicitationRequestedSchema {
3714
5267
  * Form field definitions, keyed by field name
3715
5268
  */
3716
5269
  properties: {
3717
- [k: string]: unknown;
5270
+ [k: string]: unknown | undefined;
3718
5271
  };
3719
5272
  /**
3720
5273
  * List of required field names
@@ -3725,12 +5278,18 @@ export interface ElicitationRequestedSchema {
3725
5278
  */
3726
5279
  type: "object";
3727
5280
  }
5281
+ /**
5282
+ * Session event "elicitation.completed". Elicitation request completion with the user's response
5283
+ */
3728
5284
  export interface ElicitationCompletedEvent {
3729
5285
  /**
3730
5286
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
3731
5287
  */
3732
5288
  agentId?: string;
3733
5289
  data: ElicitationCompletedData;
5290
+ /**
5291
+ * Always true for events that are transient and not persisted to the session event log on disk.
5292
+ */
3734
5293
  ephemeral: true;
3735
5294
  /**
3736
5295
  * Unique event identifier (UUID v4), generated when the event is emitted
@@ -3744,6 +5303,9 @@ export interface ElicitationCompletedEvent {
3744
5303
  * ISO 8601 timestamp when the event was created
3745
5304
  */
3746
5305
  timestamp: string;
5306
+ /**
5307
+ * Type discriminator. Always "elicitation.completed".
5308
+ */
3747
5309
  type: "elicitation.completed";
3748
5310
  }
3749
5311
  /**
@@ -3755,19 +5317,25 @@ export interface ElicitationCompletedData {
3755
5317
  * The submitted form data when action is 'accept'; keys match the requested schema fields
3756
5318
  */
3757
5319
  content?: {
3758
- [k: string]: ElicitationCompletedContent;
5320
+ [k: string]: ElicitationCompletedContent | undefined;
3759
5321
  };
3760
5322
  /**
3761
5323
  * Request ID of the resolved elicitation request; clients should dismiss any UI for this request
3762
5324
  */
3763
5325
  requestId: string;
3764
5326
  }
5327
+ /**
5328
+ * Session event "sampling.requested". Sampling request from an MCP server; contains the server name and a requestId for correlation
5329
+ */
3765
5330
  export interface SamplingRequestedEvent {
3766
5331
  /**
3767
5332
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
3768
5333
  */
3769
5334
  agentId?: string;
3770
5335
  data: SamplingRequestedData;
5336
+ /**
5337
+ * Always true for events that are transient and not persisted to the session event log on disk.
5338
+ */
3771
5339
  ephemeral: true;
3772
5340
  /**
3773
5341
  * Unique event identifier (UUID v4), generated when the event is emitted
@@ -3781,6 +5349,9 @@ export interface SamplingRequestedEvent {
3781
5349
  * ISO 8601 timestamp when the event was created
3782
5350
  */
3783
5351
  timestamp: string;
5352
+ /**
5353
+ * Type discriminator. Always "sampling.requested".
5354
+ */
3784
5355
  type: "sampling.requested";
3785
5356
  }
3786
5357
  /**
@@ -3799,14 +5370,20 @@ export interface SamplingRequestedData {
3799
5370
  * Name of the MCP server that initiated the sampling request
3800
5371
  */
3801
5372
  serverName: string;
3802
- [k: string]: unknown;
5373
+ [k: string]: unknown | undefined;
3803
5374
  }
5375
+ /**
5376
+ * Session event "sampling.completed". Sampling request completion notification signaling UI dismissal
5377
+ */
3804
5378
  export interface SamplingCompletedEvent {
3805
5379
  /**
3806
5380
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
3807
5381
  */
3808
5382
  agentId?: string;
3809
5383
  data: SamplingCompletedData;
5384
+ /**
5385
+ * Always true for events that are transient and not persisted to the session event log on disk.
5386
+ */
3810
5387
  ephemeral: true;
3811
5388
  /**
3812
5389
  * Unique event identifier (UUID v4), generated when the event is emitted
@@ -3820,6 +5397,9 @@ export interface SamplingCompletedEvent {
3820
5397
  * ISO 8601 timestamp when the event was created
3821
5398
  */
3822
5399
  timestamp: string;
5400
+ /**
5401
+ * Type discriminator. Always "sampling.completed".
5402
+ */
3823
5403
  type: "sampling.completed";
3824
5404
  }
3825
5405
  /**
@@ -3831,12 +5411,18 @@ export interface SamplingCompletedData {
3831
5411
  */
3832
5412
  requestId: string;
3833
5413
  }
5414
+ /**
5415
+ * Session event "mcp.oauth_required". OAuth authentication request for an MCP server
5416
+ */
3834
5417
  export interface McpOauthRequiredEvent {
3835
5418
  /**
3836
5419
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
3837
5420
  */
3838
5421
  agentId?: string;
3839
5422
  data: McpOauthRequiredData;
5423
+ /**
5424
+ * Always true for events that are transient and not persisted to the session event log on disk.
5425
+ */
3840
5426
  ephemeral: true;
3841
5427
  /**
3842
5428
  * Unique event identifier (UUID v4), generated when the event is emitted
@@ -3850,6 +5436,9 @@ export interface McpOauthRequiredEvent {
3850
5436
  * ISO 8601 timestamp when the event was created
3851
5437
  */
3852
5438
  timestamp: string;
5439
+ /**
5440
+ * Type discriminator. Always "mcp.oauth_required".
5441
+ */
3853
5442
  type: "mcp.oauth_required";
3854
5443
  }
3855
5444
  /**
@@ -3878,17 +5467,27 @@ export interface McpOauthRequiredStaticClientConfig {
3878
5467
  * OAuth client ID for the server
3879
5468
  */
3880
5469
  clientId: string;
5470
+ /**
5471
+ * Optional non-default OAuth grant type. When set to 'client_credentials', the OAuth flow runs headlessly using the client_id + keychain-stored secret (no browser, no callback server).
5472
+ */
5473
+ grantType?: "client_credentials";
3881
5474
  /**
3882
5475
  * Whether this is a public OAuth client
3883
5476
  */
3884
5477
  publicClient?: boolean;
3885
5478
  }
5479
+ /**
5480
+ * Session event "mcp.oauth_completed". MCP OAuth request completion notification
5481
+ */
3886
5482
  export interface McpOauthCompletedEvent {
3887
5483
  /**
3888
5484
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
3889
5485
  */
3890
5486
  agentId?: string;
3891
5487
  data: McpOauthCompletedData;
5488
+ /**
5489
+ * Always true for events that are transient and not persisted to the session event log on disk.
5490
+ */
3892
5491
  ephemeral: true;
3893
5492
  /**
3894
5493
  * Unique event identifier (UUID v4), generated when the event is emitted
@@ -3902,6 +5501,9 @@ export interface McpOauthCompletedEvent {
3902
5501
  * ISO 8601 timestamp when the event was created
3903
5502
  */
3904
5503
  timestamp: string;
5504
+ /**
5505
+ * Type discriminator. Always "mcp.oauth_completed".
5506
+ */
3905
5507
  type: "mcp.oauth_completed";
3906
5508
  }
3907
5509
  /**
@@ -3913,12 +5515,18 @@ export interface McpOauthCompletedData {
3913
5515
  */
3914
5516
  requestId: string;
3915
5517
  }
3916
- export interface ExternalToolRequestedEvent {
5518
+ /**
5519
+ * Session event "session.custom_notification". Opaque custom notification data. Consumers may branch on source and name, but payload semantics are source-defined.
5520
+ */
5521
+ export interface CustomNotificationEvent {
3917
5522
  /**
3918
5523
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
3919
5524
  */
3920
5525
  agentId?: string;
3921
- data: ExternalToolRequestedData;
5526
+ data: CustomNotificationData;
5527
+ /**
5528
+ * Always true for events that are transient and not persisted to the session event log on disk.
5529
+ */
3922
5530
  ephemeral: true;
3923
5531
  /**
3924
5532
  * Unique event identifier (UUID v4), generated when the event is emitted
@@ -3932,31 +5540,89 @@ export interface ExternalToolRequestedEvent {
3932
5540
  * ISO 8601 timestamp when the event was created
3933
5541
  */
3934
5542
  timestamp: string;
3935
- type: "external_tool.requested";
5543
+ /**
5544
+ * Type discriminator. Always "session.custom_notification".
5545
+ */
5546
+ type: "session.custom_notification";
3936
5547
  }
3937
5548
  /**
3938
- * External tool invocation request for client-side tool execution
5549
+ * Opaque custom notification data. Consumers may branch on source and name, but payload semantics are source-defined.
3939
5550
  */
3940
- export interface ExternalToolRequestedData {
5551
+ export interface CustomNotificationData {
3941
5552
  /**
3942
- * Arguments to pass to the external tool
5553
+ * Source-defined custom notification name
3943
5554
  */
3944
- arguments?: {
3945
- [k: string]: unknown;
3946
- };
5555
+ name: string;
5556
+ payload: CustomNotificationPayload;
3947
5557
  /**
3948
- * Unique identifier for this request; used to respond via session.respondToExternalTool()
5558
+ * Namespace for the custom notification producer
3949
5559
  */
3950
- requestId: string;
5560
+ source: string;
5561
+ subject?: CustomNotificationSubject;
3951
5562
  /**
3952
- * Session ID that this external tool request belongs to
5563
+ * Optional source-defined payload schema version
3953
5564
  */
3954
- sessionId: string;
5565
+ version?: number;
5566
+ }
5567
+ /**
5568
+ * Optional source-defined string identifiers describing the payload subject
5569
+ */
5570
+ export interface CustomNotificationSubject {
5571
+ [k: string]: string | undefined;
5572
+ }
5573
+ /**
5574
+ * Session event "external_tool.requested". External tool invocation request for client-side tool execution
5575
+ */
5576
+ export interface ExternalToolRequestedEvent {
3955
5577
  /**
3956
- * Tool call ID assigned to this external tool invocation
5578
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
3957
5579
  */
3958
- toolCallId: string;
3959
- /**
5580
+ agentId?: string;
5581
+ data: ExternalToolRequestedData;
5582
+ /**
5583
+ * When true, the event is transient and not persisted to the session event log on disk
5584
+ */
5585
+ ephemeral?: boolean;
5586
+ /**
5587
+ * Unique event identifier (UUID v4), generated when the event is emitted
5588
+ */
5589
+ id: string;
5590
+ /**
5591
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
5592
+ */
5593
+ parentId: string | null;
5594
+ /**
5595
+ * ISO 8601 timestamp when the event was created
5596
+ */
5597
+ timestamp: string;
5598
+ /**
5599
+ * Type discriminator. Always "external_tool.requested".
5600
+ */
5601
+ type: "external_tool.requested";
5602
+ }
5603
+ /**
5604
+ * External tool invocation request for client-side tool execution
5605
+ */
5606
+ export interface ExternalToolRequestedData {
5607
+ /**
5608
+ * Arguments to pass to the external tool
5609
+ */
5610
+ arguments?: {
5611
+ [k: string]: unknown | undefined;
5612
+ };
5613
+ /**
5614
+ * Unique identifier for this request; used to respond via session.respondToExternalTool()
5615
+ */
5616
+ requestId: string;
5617
+ /**
5618
+ * Session ID that this external tool request belongs to
5619
+ */
5620
+ sessionId: string;
5621
+ /**
5622
+ * Tool call ID assigned to this external tool invocation
5623
+ */
5624
+ toolCallId: string;
5625
+ /**
3960
5626
  * Name of the external tool to invoke
3961
5627
  */
3962
5628
  toolName: string;
@@ -3968,14 +5634,24 @@ export interface ExternalToolRequestedData {
3968
5634
  * W3C Trace Context tracestate header for the execute_tool span
3969
5635
  */
3970
5636
  tracestate?: string;
5637
+ /**
5638
+ * Active session working directory, when known.
5639
+ */
5640
+ workingDirectory?: string;
3971
5641
  }
5642
+ /**
5643
+ * Session event "external_tool.completed". External tool completion notification signaling UI dismissal
5644
+ */
3972
5645
  export interface ExternalToolCompletedEvent {
3973
5646
  /**
3974
5647
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
3975
5648
  */
3976
5649
  agentId?: string;
3977
5650
  data: ExternalToolCompletedData;
3978
- ephemeral: true;
5651
+ /**
5652
+ * Always true for events that are transient and not persisted to the session event log on disk.
5653
+ */
5654
+ ephemeral?: true;
3979
5655
  /**
3980
5656
  * Unique event identifier (UUID v4), generated when the event is emitted
3981
5657
  */
@@ -3988,6 +5664,9 @@ export interface ExternalToolCompletedEvent {
3988
5664
  * ISO 8601 timestamp when the event was created
3989
5665
  */
3990
5666
  timestamp: string;
5667
+ /**
5668
+ * Type discriminator. Always "external_tool.completed".
5669
+ */
3991
5670
  type: "external_tool.completed";
3992
5671
  }
3993
5672
  /**
@@ -3999,12 +5678,18 @@ export interface ExternalToolCompletedData {
3999
5678
  */
4000
5679
  requestId: string;
4001
5680
  }
5681
+ /**
5682
+ * Session event "command.queued". Queued slash command dispatch request for client execution
5683
+ */
4002
5684
  export interface CommandQueuedEvent {
4003
5685
  /**
4004
5686
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
4005
5687
  */
4006
5688
  agentId?: string;
4007
5689
  data: CommandQueuedData;
5690
+ /**
5691
+ * Always true for events that are transient and not persisted to the session event log on disk.
5692
+ */
4008
5693
  ephemeral: true;
4009
5694
  /**
4010
5695
  * Unique event identifier (UUID v4), generated when the event is emitted
@@ -4018,6 +5703,9 @@ export interface CommandQueuedEvent {
4018
5703
  * ISO 8601 timestamp when the event was created
4019
5704
  */
4020
5705
  timestamp: string;
5706
+ /**
5707
+ * Type discriminator. Always "command.queued".
5708
+ */
4021
5709
  type: "command.queued";
4022
5710
  }
4023
5711
  /**
@@ -4033,12 +5721,18 @@ export interface CommandQueuedData {
4033
5721
  */
4034
5722
  requestId: string;
4035
5723
  }
5724
+ /**
5725
+ * Session event "command.execute". Registered command dispatch request routed to the owning client
5726
+ */
4036
5727
  export interface CommandExecuteEvent {
4037
5728
  /**
4038
5729
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
4039
5730
  */
4040
5731
  agentId?: string;
4041
5732
  data: CommandExecuteData;
5733
+ /**
5734
+ * Always true for events that are transient and not persisted to the session event log on disk.
5735
+ */
4042
5736
  ephemeral: true;
4043
5737
  /**
4044
5738
  * Unique event identifier (UUID v4), generated when the event is emitted
@@ -4052,6 +5746,9 @@ export interface CommandExecuteEvent {
4052
5746
  * ISO 8601 timestamp when the event was created
4053
5747
  */
4054
5748
  timestamp: string;
5749
+ /**
5750
+ * Type discriminator. Always "command.execute".
5751
+ */
4055
5752
  type: "command.execute";
4056
5753
  }
4057
5754
  /**
@@ -4075,12 +5772,18 @@ export interface CommandExecuteData {
4075
5772
  */
4076
5773
  requestId: string;
4077
5774
  }
5775
+ /**
5776
+ * Session event "command.completed". Queued command completion notification signaling UI dismissal
5777
+ */
4078
5778
  export interface CommandCompletedEvent {
4079
5779
  /**
4080
5780
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
4081
5781
  */
4082
5782
  agentId?: string;
4083
5783
  data: CommandCompletedData;
5784
+ /**
5785
+ * Always true for events that are transient and not persisted to the session event log on disk.
5786
+ */
4084
5787
  ephemeral: true;
4085
5788
  /**
4086
5789
  * Unique event identifier (UUID v4), generated when the event is emitted
@@ -4094,6 +5797,9 @@ export interface CommandCompletedEvent {
4094
5797
  * ISO 8601 timestamp when the event was created
4095
5798
  */
4096
5799
  timestamp: string;
5800
+ /**
5801
+ * Type discriminator. Always "command.completed".
5802
+ */
4097
5803
  type: "command.completed";
4098
5804
  }
4099
5805
  /**
@@ -4105,12 +5811,18 @@ export interface CommandCompletedData {
4105
5811
  */
4106
5812
  requestId: string;
4107
5813
  }
5814
+ /**
5815
+ * Session event "auto_mode_switch.requested". Auto mode switch request notification requiring user approval
5816
+ */
4108
5817
  export interface AutoModeSwitchRequestedEvent {
4109
5818
  /**
4110
5819
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
4111
5820
  */
4112
5821
  agentId?: string;
4113
5822
  data: AutoModeSwitchRequestedData;
5823
+ /**
5824
+ * Always true for events that are transient and not persisted to the session event log on disk.
5825
+ */
4114
5826
  ephemeral: true;
4115
5827
  /**
4116
5828
  * Unique event identifier (UUID v4), generated when the event is emitted
@@ -4124,6 +5836,9 @@ export interface AutoModeSwitchRequestedEvent {
4124
5836
  * ISO 8601 timestamp when the event was created
4125
5837
  */
4126
5838
  timestamp: string;
5839
+ /**
5840
+ * Type discriminator. Always "auto_mode_switch.requested".
5841
+ */
4127
5842
  type: "auto_mode_switch.requested";
4128
5843
  }
4129
5844
  /**
@@ -4138,13 +5853,23 @@ export interface AutoModeSwitchRequestedData {
4138
5853
  * Unique identifier for this request; used to respond via session.respondToAutoModeSwitch()
4139
5854
  */
4140
5855
  requestId: string;
5856
+ /**
5857
+ * Seconds until the rate limit resets, when known. Lets clients render a humanized reset time alongside the prompt.
5858
+ */
5859
+ retryAfterSeconds?: number;
4141
5860
  }
5861
+ /**
5862
+ * Session event "auto_mode_switch.completed". Auto mode switch completion notification
5863
+ */
4142
5864
  export interface AutoModeSwitchCompletedEvent {
4143
5865
  /**
4144
5866
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
4145
5867
  */
4146
5868
  agentId?: string;
4147
5869
  data: AutoModeSwitchCompletedData;
5870
+ /**
5871
+ * Always true for events that are transient and not persisted to the session event log on disk.
5872
+ */
4148
5873
  ephemeral: true;
4149
5874
  /**
4150
5875
  * Unique event identifier (UUID v4), generated when the event is emitted
@@ -4158,6 +5883,9 @@ export interface AutoModeSwitchCompletedEvent {
4158
5883
  * ISO 8601 timestamp when the event was created
4159
5884
  */
4160
5885
  timestamp: string;
5886
+ /**
5887
+ * Type discriminator. Always "auto_mode_switch.completed".
5888
+ */
4161
5889
  type: "auto_mode_switch.completed";
4162
5890
  }
4163
5891
  /**
@@ -4168,17 +5896,20 @@ export interface AutoModeSwitchCompletedData {
4168
5896
  * Request ID of the resolved request; clients should dismiss any UI for this request
4169
5897
  */
4170
5898
  requestId: string;
4171
- /**
4172
- * The user's choice: 'yes', 'yes_always', or 'no'
4173
- */
4174
- response: string;
5899
+ response: AutoModeSwitchResponse;
4175
5900
  }
5901
+ /**
5902
+ * Session event "commands.changed". SDK command registration change notification
5903
+ */
4176
5904
  export interface CommandsChangedEvent {
4177
5905
  /**
4178
5906
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
4179
5907
  */
4180
5908
  agentId?: string;
4181
5909
  data: CommandsChangedData;
5910
+ /**
5911
+ * Always true for events that are transient and not persisted to the session event log on disk.
5912
+ */
4182
5913
  ephemeral: true;
4183
5914
  /**
4184
5915
  * Unique event identifier (UUID v4), generated when the event is emitted
@@ -4192,6 +5923,9 @@ export interface CommandsChangedEvent {
4192
5923
  * ISO 8601 timestamp when the event was created
4193
5924
  */
4194
5925
  timestamp: string;
5926
+ /**
5927
+ * Type discriminator. Always "commands.changed".
5928
+ */
4195
5929
  type: "commands.changed";
4196
5930
  }
4197
5931
  /**
@@ -4203,16 +5937,31 @@ export interface CommandsChangedData {
4203
5937
  */
4204
5938
  commands: CommandsChangedCommand[];
4205
5939
  }
5940
+ /**
5941
+ * Schema for the `CommandsChangedCommand` type.
5942
+ */
4206
5943
  export interface CommandsChangedCommand {
5944
+ /**
5945
+ * Optional human-readable command description.
5946
+ */
4207
5947
  description?: string;
5948
+ /**
5949
+ * Slash command name without the leading slash.
5950
+ */
4208
5951
  name: string;
4209
5952
  }
5953
+ /**
5954
+ * Session event "capabilities.changed". Session capability change notification
5955
+ */
4210
5956
  export interface CapabilitiesChangedEvent {
4211
5957
  /**
4212
5958
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
4213
5959
  */
4214
5960
  agentId?: string;
4215
5961
  data: CapabilitiesChangedData;
5962
+ /**
5963
+ * Always true for events that are transient and not persisted to the session event log on disk.
5964
+ */
4216
5965
  ephemeral: true;
4217
5966
  /**
4218
5967
  * Unique event identifier (UUID v4), generated when the event is emitted
@@ -4226,6 +5975,9 @@ export interface CapabilitiesChangedEvent {
4226
5975
  * ISO 8601 timestamp when the event was created
4227
5976
  */
4228
5977
  timestamp: string;
5978
+ /**
5979
+ * Type discriminator. Always "capabilities.changed".
5980
+ */
4229
5981
  type: "capabilities.changed";
4230
5982
  }
4231
5983
  /**
@@ -4238,17 +5990,31 @@ export interface CapabilitiesChangedData {
4238
5990
  * UI capability changes
4239
5991
  */
4240
5992
  export interface CapabilitiesChangedUI {
5993
+ /**
5994
+ * Whether canvas rendering is now supported
5995
+ */
5996
+ canvases?: boolean;
4241
5997
  /**
4242
5998
  * Whether elicitation is now supported
4243
5999
  */
4244
6000
  elicitation?: boolean;
6001
+ /**
6002
+ * Whether MCP Apps (SEP-1865) UI passthrough is now supported
6003
+ */
6004
+ mcpApps?: boolean;
4245
6005
  }
6006
+ /**
6007
+ * Session event "exit_plan_mode.requested". Plan approval request with plan content and available user actions
6008
+ */
4246
6009
  export interface ExitPlanModeRequestedEvent {
4247
6010
  /**
4248
6011
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
4249
6012
  */
4250
6013
  agentId?: string;
4251
6014
  data: ExitPlanModeRequestedData;
6015
+ /**
6016
+ * Always true for events that are transient and not persisted to the session event log on disk.
6017
+ */
4252
6018
  ephemeral: true;
4253
6019
  /**
4254
6020
  * Unique event identifier (UUID v4), generated when the event is emitted
@@ -4262,6 +6028,9 @@ export interface ExitPlanModeRequestedEvent {
4262
6028
  * ISO 8601 timestamp when the event was created
4263
6029
  */
4264
6030
  timestamp: string;
6031
+ /**
6032
+ * Type discriminator. Always "exit_plan_mode.requested".
6033
+ */
4265
6034
  type: "exit_plan_mode.requested";
4266
6035
  }
4267
6036
  /**
@@ -4269,17 +6038,14 @@ export interface ExitPlanModeRequestedEvent {
4269
6038
  */
4270
6039
  export interface ExitPlanModeRequestedData {
4271
6040
  /**
4272
- * Available actions the user can take (e.g., approve, edit, reject)
6041
+ * Available actions the user can take
4273
6042
  */
4274
- actions: string[];
6043
+ actions: ExitPlanModeAction[];
4275
6044
  /**
4276
6045
  * Full content of the plan file
4277
6046
  */
4278
6047
  planContent: string;
4279
- /**
4280
- * The recommended action for the user to take
4281
- */
4282
- recommendedAction: string;
6048
+ recommendedAction: ExitPlanModeAction;
4283
6049
  /**
4284
6050
  * Unique identifier for this request; used to respond via session.respondToExitPlanMode()
4285
6051
  */
@@ -4289,12 +6055,18 @@ export interface ExitPlanModeRequestedData {
4289
6055
  */
4290
6056
  summary: string;
4291
6057
  }
6058
+ /**
6059
+ * Session event "exit_plan_mode.completed". Plan mode exit completion with the user's approval decision and optional feedback
6060
+ */
4292
6061
  export interface ExitPlanModeCompletedEvent {
4293
6062
  /**
4294
6063
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
4295
6064
  */
4296
6065
  agentId?: string;
4297
6066
  data: ExitPlanModeCompletedData;
6067
+ /**
6068
+ * Always true for events that are transient and not persisted to the session event log on disk.
6069
+ */
4298
6070
  ephemeral: true;
4299
6071
  /**
4300
6072
  * Unique event identifier (UUID v4), generated when the event is emitted
@@ -4308,6 +6080,9 @@ export interface ExitPlanModeCompletedEvent {
4308
6080
  * ISO 8601 timestamp when the event was created
4309
6081
  */
4310
6082
  timestamp: string;
6083
+ /**
6084
+ * Type discriminator. Always "exit_plan_mode.completed".
6085
+ */
4311
6086
  type: "exit_plan_mode.completed";
4312
6087
  }
4313
6088
  /**
@@ -4330,17 +6105,20 @@ export interface ExitPlanModeCompletedData {
4330
6105
  * Request ID of the resolved exit plan mode request; clients should dismiss any UI for this request
4331
6106
  */
4332
6107
  requestId: string;
4333
- /**
4334
- * Which action the user selected (e.g. 'autopilot', 'interactive', 'exit_only')
4335
- */
4336
- selectedAction?: string;
6108
+ selectedAction?: ExitPlanModeAction;
4337
6109
  }
6110
+ /**
6111
+ * Session event "session.tools_updated".
6112
+ */
4338
6113
  export interface ToolsUpdatedEvent {
4339
6114
  /**
4340
6115
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
4341
6116
  */
4342
6117
  agentId?: string;
4343
6118
  data: ToolsUpdatedData;
6119
+ /**
6120
+ * Always true for events that are transient and not persisted to the session event log on disk.
6121
+ */
4344
6122
  ephemeral: true;
4345
6123
  /**
4346
6124
  * Unique event identifier (UUID v4), generated when the event is emitted
@@ -4354,17 +6132,32 @@ export interface ToolsUpdatedEvent {
4354
6132
  * ISO 8601 timestamp when the event was created
4355
6133
  */
4356
6134
  timestamp: string;
6135
+ /**
6136
+ * Type discriminator. Always "session.tools_updated".
6137
+ */
4357
6138
  type: "session.tools_updated";
4358
6139
  }
6140
+ /**
6141
+ * Schema for the `ToolsUpdatedData` type.
6142
+ */
4359
6143
  export interface ToolsUpdatedData {
6144
+ /**
6145
+ * Identifier of the model the resolved tools apply to.
6146
+ */
4360
6147
  model: string;
4361
6148
  }
6149
+ /**
6150
+ * Session event "session.background_tasks_changed".
6151
+ */
4362
6152
  export interface BackgroundTasksChangedEvent {
4363
6153
  /**
4364
6154
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
4365
6155
  */
4366
6156
  agentId?: string;
4367
6157
  data: BackgroundTasksChangedData;
6158
+ /**
6159
+ * Always true for events that are transient and not persisted to the session event log on disk.
6160
+ */
4368
6161
  ephemeral: true;
4369
6162
  /**
4370
6163
  * Unique event identifier (UUID v4), generated when the event is emitted
@@ -4378,16 +6171,28 @@ export interface BackgroundTasksChangedEvent {
4378
6171
  * ISO 8601 timestamp when the event was created
4379
6172
  */
4380
6173
  timestamp: string;
6174
+ /**
6175
+ * Type discriminator. Always "session.background_tasks_changed".
6176
+ */
4381
6177
  type: "session.background_tasks_changed";
4382
6178
  }
6179
+ /**
6180
+ * Schema for the `BackgroundTasksChangedData` type.
6181
+ */
4383
6182
  export interface BackgroundTasksChangedData {
4384
6183
  }
6184
+ /**
6185
+ * Session event "session.skills_loaded".
6186
+ */
4385
6187
  export interface SkillsLoadedEvent {
4386
6188
  /**
4387
6189
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
4388
6190
  */
4389
6191
  agentId?: string;
4390
6192
  data: SkillsLoadedData;
6193
+ /**
6194
+ * Always true for events that are transient and not persisted to the session event log on disk.
6195
+ */
4391
6196
  ephemeral: true;
4392
6197
  /**
4393
6198
  * Unique event identifier (UUID v4), generated when the event is emitted
@@ -4401,14 +6206,23 @@ export interface SkillsLoadedEvent {
4401
6206
  * ISO 8601 timestamp when the event was created
4402
6207
  */
4403
6208
  timestamp: string;
6209
+ /**
6210
+ * Type discriminator. Always "session.skills_loaded".
6211
+ */
4404
6212
  type: "session.skills_loaded";
4405
6213
  }
6214
+ /**
6215
+ * Schema for the `SkillsLoadedData` type.
6216
+ */
4406
6217
  export interface SkillsLoadedData {
4407
6218
  /**
4408
6219
  * Array of resolved skill metadata
4409
6220
  */
4410
6221
  skills: SkillsLoadedSkill[];
4411
6222
  }
6223
+ /**
6224
+ * Schema for the `SkillsLoadedSkill` type.
6225
+ */
4412
6226
  export interface SkillsLoadedSkill {
4413
6227
  /**
4414
6228
  * Description of what the skill does
@@ -4426,21 +6240,24 @@ export interface SkillsLoadedSkill {
4426
6240
  * Absolute path to the skill file, if available
4427
6241
  */
4428
6242
  path?: string;
4429
- /**
4430
- * Source location type of the skill (e.g., project, personal, plugin)
4431
- */
4432
- source: string;
6243
+ source: SkillSource;
4433
6244
  /**
4434
6245
  * Whether the skill can be invoked by the user as a slash command
4435
6246
  */
4436
6247
  userInvocable: boolean;
4437
6248
  }
6249
+ /**
6250
+ * Session event "session.custom_agents_updated".
6251
+ */
4438
6252
  export interface CustomAgentsUpdatedEvent {
4439
6253
  /**
4440
6254
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
4441
6255
  */
4442
6256
  agentId?: string;
4443
6257
  data: CustomAgentsUpdatedData;
6258
+ /**
6259
+ * Always true for events that are transient and not persisted to the session event log on disk.
6260
+ */
4444
6261
  ephemeral: true;
4445
6262
  /**
4446
6263
  * Unique event identifier (UUID v4), generated when the event is emitted
@@ -4454,8 +6271,14 @@ export interface CustomAgentsUpdatedEvent {
4454
6271
  * ISO 8601 timestamp when the event was created
4455
6272
  */
4456
6273
  timestamp: string;
6274
+ /**
6275
+ * Type discriminator. Always "session.custom_agents_updated".
6276
+ */
4457
6277
  type: "session.custom_agents_updated";
4458
6278
  }
6279
+ /**
6280
+ * Schema for the `CustomAgentsUpdatedData` type.
6281
+ */
4459
6282
  export interface CustomAgentsUpdatedData {
4460
6283
  /**
4461
6284
  * Array of loaded custom agent metadata
@@ -4470,6 +6293,9 @@ export interface CustomAgentsUpdatedData {
4470
6293
  */
4471
6294
  warnings: string[];
4472
6295
  }
6296
+ /**
6297
+ * Schema for the `CustomAgentsUpdatedAgent` type.
6298
+ */
4473
6299
  export interface CustomAgentsUpdatedAgent {
4474
6300
  /**
4475
6301
  * Description of what the agent does
@@ -4496,20 +6322,26 @@ export interface CustomAgentsUpdatedAgent {
4496
6322
  */
4497
6323
  source: string;
4498
6324
  /**
4499
- * List of tool names available to this agent
6325
+ * List of tool names available to this agent, or null when all tools are available
4500
6326
  */
4501
- tools: string[];
6327
+ tools: string[] | null;
4502
6328
  /**
4503
6329
  * Whether the agent can be selected by the user
4504
6330
  */
4505
6331
  userInvocable: boolean;
4506
6332
  }
6333
+ /**
6334
+ * Session event "session.mcp_servers_loaded".
6335
+ */
4507
6336
  export interface McpServersLoadedEvent {
4508
6337
  /**
4509
6338
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
4510
6339
  */
4511
6340
  agentId?: string;
4512
6341
  data: McpServersLoadedData;
6342
+ /**
6343
+ * Always true for events that are transient and not persisted to the session event log on disk.
6344
+ */
4513
6345
  ephemeral: true;
4514
6346
  /**
4515
6347
  * Unique event identifier (UUID v4), generated when the event is emitted
@@ -4523,14 +6355,23 @@ export interface McpServersLoadedEvent {
4523
6355
  * ISO 8601 timestamp when the event was created
4524
6356
  */
4525
6357
  timestamp: string;
6358
+ /**
6359
+ * Type discriminator. Always "session.mcp_servers_loaded".
6360
+ */
4526
6361
  type: "session.mcp_servers_loaded";
4527
6362
  }
6363
+ /**
6364
+ * Schema for the `McpServersLoadedData` type.
6365
+ */
4528
6366
  export interface McpServersLoadedData {
4529
6367
  /**
4530
6368
  * Array of MCP server status summaries
4531
6369
  */
4532
6370
  servers: McpServersLoadedServer[];
4533
6371
  }
6372
+ /**
6373
+ * Schema for the `McpServersLoadedServer` type.
6374
+ */
4534
6375
  export interface McpServersLoadedServer {
4535
6376
  /**
4536
6377
  * Error message if the server failed to connect
@@ -4541,17 +6382,29 @@ export interface McpServersLoadedServer {
4541
6382
  */
4542
6383
  name: string;
4543
6384
  /**
4544
- * Configuration source: user, workspace, plugin, or builtin
6385
+ * Name of the plugin that supplied the effective MCP server config, only when source is plugin
4545
6386
  */
4546
- source?: string;
4547
- status: McpServersLoadedServerStatus;
6387
+ pluginName?: string;
6388
+ /**
6389
+ * Version of the plugin that supplied the effective MCP server config, only when source is plugin
6390
+ */
6391
+ pluginVersion?: string;
6392
+ source?: McpServerSource;
6393
+ status: McpServerStatus;
6394
+ transport?: McpServerTransport;
4548
6395
  }
6396
+ /**
6397
+ * Session event "session.mcp_server_status_changed".
6398
+ */
4549
6399
  export interface McpServerStatusChangedEvent {
4550
6400
  /**
4551
6401
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
4552
6402
  */
4553
6403
  agentId?: string;
4554
6404
  data: McpServerStatusChangedData;
6405
+ /**
6406
+ * Always true for events that are transient and not persisted to the session event log on disk.
6407
+ */
4555
6408
  ephemeral: true;
4556
6409
  /**
4557
6410
  * Unique event identifier (UUID v4), generated when the event is emitted
@@ -4565,21 +6418,37 @@ export interface McpServerStatusChangedEvent {
4565
6418
  * ISO 8601 timestamp when the event was created
4566
6419
  */
4567
6420
  timestamp: string;
6421
+ /**
6422
+ * Type discriminator. Always "session.mcp_server_status_changed".
6423
+ */
4568
6424
  type: "session.mcp_server_status_changed";
4569
6425
  }
6426
+ /**
6427
+ * Schema for the `McpServerStatusChangedData` type.
6428
+ */
4570
6429
  export interface McpServerStatusChangedData {
6430
+ /**
6431
+ * Error message if the server entered a failed state
6432
+ */
6433
+ error?: string;
4571
6434
  /**
4572
6435
  * Name of the MCP server whose status changed
4573
6436
  */
4574
6437
  serverName: string;
4575
- status: McpServerStatusChangedStatus;
6438
+ status: McpServerStatus;
4576
6439
  }
6440
+ /**
6441
+ * Session event "session.extensions_loaded".
6442
+ */
4577
6443
  export interface ExtensionsLoadedEvent {
4578
6444
  /**
4579
6445
  * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
4580
6446
  */
4581
6447
  agentId?: string;
4582
6448
  data: ExtensionsLoadedData;
6449
+ /**
6450
+ * Always true for events that are transient and not persisted to the session event log on disk.
6451
+ */
4583
6452
  ephemeral: true;
4584
6453
  /**
4585
6454
  * Unique event identifier (UUID v4), generated when the event is emitted
@@ -4593,14 +6462,23 @@ export interface ExtensionsLoadedEvent {
4593
6462
  * ISO 8601 timestamp when the event was created
4594
6463
  */
4595
6464
  timestamp: string;
6465
+ /**
6466
+ * Type discriminator. Always "session.extensions_loaded".
6467
+ */
4596
6468
  type: "session.extensions_loaded";
4597
6469
  }
6470
+ /**
6471
+ * Schema for the `ExtensionsLoadedData` type.
6472
+ */
4598
6473
  export interface ExtensionsLoadedData {
4599
6474
  /**
4600
6475
  * Array of discovered extensions and their status
4601
6476
  */
4602
6477
  extensions: ExtensionsLoadedExtension[];
4603
6478
  }
6479
+ /**
6480
+ * Schema for the `ExtensionsLoadedExtension` type.
6481
+ */
4604
6482
  export interface ExtensionsLoadedExtension {
4605
6483
  /**
4606
6484
  * Source-qualified extension ID (e.g., 'project:my-ext', 'user:auth-helper')
@@ -4613,3 +6491,265 @@ export interface ExtensionsLoadedExtension {
4613
6491
  source: ExtensionsLoadedExtensionSource;
4614
6492
  status: ExtensionsLoadedExtensionStatus;
4615
6493
  }
6494
+ /**
6495
+ * Session event "session.canvas.opened".
6496
+ */
6497
+ export interface CanvasOpenedEvent {
6498
+ /**
6499
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
6500
+ */
6501
+ agentId?: string;
6502
+ data: CanvasOpenedData;
6503
+ /**
6504
+ * Always true for events that are transient and not persisted to the session event log on disk.
6505
+ */
6506
+ ephemeral: true;
6507
+ /**
6508
+ * Unique event identifier (UUID v4), generated when the event is emitted
6509
+ */
6510
+ id: string;
6511
+ /**
6512
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
6513
+ */
6514
+ parentId: string | null;
6515
+ /**
6516
+ * ISO 8601 timestamp when the event was created
6517
+ */
6518
+ timestamp: string;
6519
+ /**
6520
+ * Type discriminator. Always "session.canvas.opened".
6521
+ */
6522
+ type: "session.canvas.opened";
6523
+ }
6524
+ /**
6525
+ * Schema for the `CanvasOpenedData` type.
6526
+ */
6527
+ export interface CanvasOpenedData {
6528
+ availability: CanvasOpenedAvailability;
6529
+ /**
6530
+ * Provider-local canvas identifier
6531
+ */
6532
+ canvasId: string;
6533
+ /**
6534
+ * Owning provider identifier
6535
+ */
6536
+ extensionId: string;
6537
+ /**
6538
+ * Owning extension display name, when available
6539
+ */
6540
+ extensionName?: string;
6541
+ /**
6542
+ * Input supplied when the instance was opened
6543
+ */
6544
+ input?: {
6545
+ [k: string]: unknown | undefined;
6546
+ };
6547
+ /**
6548
+ * Stable caller-supplied canvas instance identifier
6549
+ */
6550
+ instanceId: string;
6551
+ /**
6552
+ * Whether this notification represents an idempotent reopen
6553
+ */
6554
+ reopen: boolean;
6555
+ /**
6556
+ * Provider-supplied status text
6557
+ */
6558
+ status?: string;
6559
+ /**
6560
+ * Rendered title
6561
+ */
6562
+ title?: string;
6563
+ /**
6564
+ * URL for web-rendered canvases
6565
+ */
6566
+ url?: string;
6567
+ }
6568
+ /**
6569
+ * Session event "session.canvas.registry_changed".
6570
+ */
6571
+ export interface CanvasRegistryChangedEvent {
6572
+ /**
6573
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
6574
+ */
6575
+ agentId?: string;
6576
+ data: CanvasRegistryChangedData;
6577
+ /**
6578
+ * Always true for events that are transient and not persisted to the session event log on disk.
6579
+ */
6580
+ ephemeral: true;
6581
+ /**
6582
+ * Unique event identifier (UUID v4), generated when the event is emitted
6583
+ */
6584
+ id: string;
6585
+ /**
6586
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
6587
+ */
6588
+ parentId: string | null;
6589
+ /**
6590
+ * ISO 8601 timestamp when the event was created
6591
+ */
6592
+ timestamp: string;
6593
+ /**
6594
+ * Type discriminator. Always "session.canvas.registry_changed".
6595
+ */
6596
+ type: "session.canvas.registry_changed";
6597
+ }
6598
+ /**
6599
+ * Schema for the `CanvasRegistryChangedData` type.
6600
+ */
6601
+ export interface CanvasRegistryChangedData {
6602
+ /**
6603
+ * Canvas declarations currently available
6604
+ */
6605
+ canvases: CanvasRegistryChangedCanvas[];
6606
+ }
6607
+ /**
6608
+ * Schema for the `CanvasRegistryChangedCanvas` type.
6609
+ */
6610
+ export interface CanvasRegistryChangedCanvas {
6611
+ /**
6612
+ * Actions the agent or host may invoke
6613
+ */
6614
+ actions?: CanvasRegistryChangedCanvasAction[];
6615
+ /**
6616
+ * Provider-local canvas identifier
6617
+ */
6618
+ canvasId: string;
6619
+ /**
6620
+ * Short, single-sentence description shown to the agent in canvas catalogs.
6621
+ */
6622
+ description: string;
6623
+ /**
6624
+ * Human-readable canvas name
6625
+ */
6626
+ displayName: string;
6627
+ /**
6628
+ * Owning provider identifier
6629
+ */
6630
+ extensionId: string;
6631
+ /**
6632
+ * Owning extension display name, when available
6633
+ */
6634
+ extensionName?: string;
6635
+ /**
6636
+ * JSON Schema for canvas open input
6637
+ */
6638
+ inputSchema?: {
6639
+ [k: string]: unknown | undefined;
6640
+ };
6641
+ }
6642
+ /**
6643
+ * Schema for the `CanvasRegistryChangedCanvasAction` type.
6644
+ */
6645
+ export interface CanvasRegistryChangedCanvasAction {
6646
+ /**
6647
+ * Action description
6648
+ */
6649
+ description?: string;
6650
+ /**
6651
+ * JSON Schema for action input
6652
+ */
6653
+ inputSchema?: {
6654
+ [k: string]: unknown | undefined;
6655
+ };
6656
+ /**
6657
+ * Action name
6658
+ */
6659
+ name: string;
6660
+ }
6661
+ /**
6662
+ * Session event "mcp_app.tool_call_complete". MCP App view called a tool on a connected MCP server (SEP-1865)
6663
+ */
6664
+ export interface McpAppToolCallCompleteEvent {
6665
+ /**
6666
+ * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events.
6667
+ */
6668
+ agentId?: string;
6669
+ data: McpAppToolCallCompleteData;
6670
+ /**
6671
+ * Always true for events that are transient and not persisted to the session event log on disk.
6672
+ */
6673
+ ephemeral: true;
6674
+ /**
6675
+ * Unique event identifier (UUID v4), generated when the event is emitted
6676
+ */
6677
+ id: string;
6678
+ /**
6679
+ * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event.
6680
+ */
6681
+ parentId: string | null;
6682
+ /**
6683
+ * ISO 8601 timestamp when the event was created
6684
+ */
6685
+ timestamp: string;
6686
+ /**
6687
+ * Type discriminator. Always "mcp_app.tool_call_complete".
6688
+ */
6689
+ type: "mcp_app.tool_call_complete";
6690
+ }
6691
+ /**
6692
+ * MCP App view called a tool on a connected MCP server (SEP-1865)
6693
+ */
6694
+ export interface McpAppToolCallCompleteData {
6695
+ /**
6696
+ * Arguments passed to the tool by the app view, if any
6697
+ */
6698
+ arguments?: {
6699
+ [k: string]: unknown | undefined;
6700
+ };
6701
+ /**
6702
+ * Wall-clock duration of the underlying tools/call in milliseconds
6703
+ */
6704
+ durationMs: number;
6705
+ error?: McpAppToolCallCompleteError;
6706
+ /**
6707
+ * Standard MCP CallToolResult returned by the server. Present whether or not the call set isError.
6708
+ */
6709
+ result?: {
6710
+ [k: string]: unknown | undefined;
6711
+ };
6712
+ /**
6713
+ * Name of the MCP server hosting the tool
6714
+ */
6715
+ serverName: string;
6716
+ /**
6717
+ * True when the call completed without throwing AND the MCP CallToolResult did not set isError
6718
+ */
6719
+ success: boolean;
6720
+ toolMeta?: McpAppToolCallCompleteToolMeta;
6721
+ /**
6722
+ * MCP tool name that was invoked
6723
+ */
6724
+ toolName: string;
6725
+ }
6726
+ /**
6727
+ * Set when the underlying tools/call threw an error before returning a CallToolResult
6728
+ */
6729
+ export interface McpAppToolCallCompleteError {
6730
+ /**
6731
+ * Human-readable error message
6732
+ */
6733
+ message: string;
6734
+ }
6735
+ /**
6736
+ * The tool's `_meta.ui` block at the time of the call, so consumers can decide whether to forward the result to the model without re-listing tools.
6737
+ */
6738
+ export interface McpAppToolCallCompleteToolMeta {
6739
+ ui?: McpAppToolCallCompleteToolMetaUI;
6740
+ [k: string]: unknown | undefined;
6741
+ }
6742
+ /**
6743
+ * Schema for the `McpAppToolCallCompleteToolMetaUI` type.
6744
+ */
6745
+ export interface McpAppToolCallCompleteToolMetaUI {
6746
+ /**
6747
+ * `ui://` URI declared by the tool's `_meta.ui.resourceUri`
6748
+ */
6749
+ resourceUri?: string;
6750
+ /**
6751
+ * Tool visibility per SEP-1865 (typically a subset of `["model","app"]`)
6752
+ */
6753
+ visibility?: string[];
6754
+ [k: string]: unknown | undefined;
6755
+ }