Skip to main content

github_copilot_sdk/generated/
session_events.rs

1//! Auto-generated from session-events.schema.json — do not edit manually.
2
3#![allow(deprecated)]
4
5use std::collections::HashMap;
6
7use serde::{Deserialize, Serialize};
8
9use crate::types::{RequestId, SessionId};
10
11/// Identifies the kind of session event.
12#[derive(Debug, Clone, Default, PartialEq, Eq, Hash, Serialize, Deserialize)]
13pub enum SessionEventType {
14    #[serde(rename = "session.start")]
15    SessionStart,
16    #[serde(rename = "session.resume")]
17    SessionResume,
18    #[serde(rename = "session.remote_steerable_changed")]
19    SessionRemoteSteerableChanged,
20    #[serde(rename = "session.error")]
21    SessionError,
22    #[serde(rename = "session.idle")]
23    SessionIdle,
24    #[serde(rename = "session.title_changed")]
25    SessionTitleChanged,
26    #[serde(rename = "session.schedule_created")]
27    SessionScheduleCreated,
28    #[serde(rename = "session.schedule_cancelled")]
29    SessionScheduleCancelled,
30    #[serde(rename = "session.schedule_rearmed")]
31    SessionScheduleRearmed,
32    #[serde(rename = "session.autopilot_objective_changed")]
33    SessionAutopilotObjectiveChanged,
34    #[serde(rename = "session.info")]
35    SessionInfo,
36    #[serde(rename = "session.warning")]
37    SessionWarning,
38    #[serde(rename = "session.model_change")]
39    SessionModelChange,
40    #[serde(rename = "session.mode_changed")]
41    SessionModeChanged,
42    #[serde(rename = "session.session_limits_changed")]
43    SessionSessionLimitsChanged,
44    #[serde(rename = "session.permissions_changed")]
45    SessionPermissionsChanged,
46    #[serde(rename = "session.plan_changed")]
47    SessionPlanChanged,
48    #[serde(rename = "session.todos_changed")]
49    SessionTodosChanged,
50    #[serde(rename = "session.workspace_file_changed")]
51    SessionWorkspaceFileChanged,
52    #[serde(rename = "session.handoff")]
53    SessionHandoff,
54    #[serde(rename = "session.truncation")]
55    SessionTruncation,
56    #[serde(rename = "session.snapshot_rewind")]
57    SessionSnapshotRewind,
58    #[serde(rename = "session.shutdown")]
59    SessionShutdown,
60    #[serde(rename = "session.usage_checkpoint")]
61    SessionUsageCheckpoint,
62    #[serde(rename = "session.context_changed")]
63    SessionContextChanged,
64    #[serde(rename = "session.usage_info")]
65    SessionUsageInfo,
66    #[serde(rename = "session.compaction_start")]
67    SessionCompactionStart,
68    #[serde(rename = "session.compaction_complete")]
69    SessionCompactionComplete,
70    #[serde(rename = "session.task_complete")]
71    SessionTaskComplete,
72    #[serde(rename = "user.message")]
73    UserMessage,
74    #[serde(rename = "pending_messages.modified")]
75    PendingMessagesModified,
76    #[serde(rename = "assistant.turn_start")]
77    AssistantTurnStart,
78    #[serde(rename = "assistant.intent")]
79    AssistantIntent,
80    #[serde(rename = "assistant.reasoning")]
81    AssistantReasoning,
82    #[serde(rename = "assistant.reasoning_delta")]
83    AssistantReasoningDelta,
84    #[serde(rename = "assistant.tool_call_delta")]
85    AssistantToolCallDelta,
86    #[serde(rename = "assistant.streaming_delta")]
87    AssistantStreamingDelta,
88    #[serde(rename = "assistant.message")]
89    AssistantMessage,
90    #[serde(rename = "assistant.message_start")]
91    AssistantMessageStart,
92    #[serde(rename = "assistant.message_delta")]
93    AssistantMessageDelta,
94    #[serde(rename = "assistant.turn_end")]
95    AssistantTurnEnd,
96    #[serde(rename = "assistant.idle")]
97    AssistantIdle,
98    #[serde(rename = "assistant.usage")]
99    AssistantUsage,
100    #[serde(rename = "model.call_failure")]
101    ModelCallFailure,
102    #[serde(rename = "abort")]
103    Abort,
104    #[serde(rename = "tool.user_requested")]
105    ToolUserRequested,
106    #[serde(rename = "tool.execution_start")]
107    ToolExecutionStart,
108    #[serde(rename = "tool.execution_partial_result")]
109    ToolExecutionPartialResult,
110    #[serde(rename = "tool.execution_progress")]
111    ToolExecutionProgress,
112    #[serde(rename = "tool.execution_complete")]
113    ToolExecutionComplete,
114    #[serde(rename = "skill.invoked")]
115    SkillInvoked,
116    #[serde(rename = "subagent.started")]
117    SubagentStarted,
118    #[serde(rename = "subagent.completed")]
119    SubagentCompleted,
120    #[serde(rename = "subagent.failed")]
121    SubagentFailed,
122    #[serde(rename = "subagent.selected")]
123    SubagentSelected,
124    #[serde(rename = "subagent.deselected")]
125    SubagentDeselected,
126    #[serde(rename = "hook.start")]
127    HookStart,
128    #[serde(rename = "hook.end")]
129    HookEnd,
130    #[serde(rename = "hook.progress")]
131    HookProgress,
132    ///
133    /// <div class="warning">
134    ///
135    /// **Experimental.** This type is part of an experimental wire-protocol surface
136    /// and may change or be removed in future SDK or CLI releases.
137    ///
138    /// </div>
139    #[serde(rename = "session.binary_asset")]
140    SessionBinaryAsset,
141    #[serde(rename = "system.message")]
142    SystemMessage,
143    #[serde(rename = "system.notification")]
144    SystemNotification,
145    #[serde(rename = "permission.requested")]
146    PermissionRequested,
147    #[serde(rename = "permission.completed")]
148    PermissionCompleted,
149    #[serde(rename = "user_input.requested")]
150    UserInputRequested,
151    #[serde(rename = "user_input.completed")]
152    UserInputCompleted,
153    #[serde(rename = "elicitation.requested")]
154    ElicitationRequested,
155    #[serde(rename = "elicitation.completed")]
156    ElicitationCompleted,
157    #[serde(rename = "sampling.requested")]
158    SamplingRequested,
159    #[serde(rename = "sampling.completed")]
160    SamplingCompleted,
161    #[serde(rename = "mcp.oauth_required")]
162    McpOauthRequired,
163    #[serde(rename = "mcp.oauth_completed")]
164    McpOauthCompleted,
165    #[serde(rename = "mcp.headers_refresh_required")]
166    McpHeadersRefreshRequired,
167    #[serde(rename = "mcp.headers_refresh_completed")]
168    McpHeadersRefreshCompleted,
169    #[serde(rename = "session.custom_notification")]
170    SessionCustomNotification,
171    #[serde(rename = "external_tool.requested")]
172    ExternalToolRequested,
173    #[serde(rename = "external_tool.completed")]
174    ExternalToolCompleted,
175    #[serde(rename = "command.queued")]
176    CommandQueued,
177    #[serde(rename = "command.execute")]
178    CommandExecute,
179    #[serde(rename = "command.completed")]
180    CommandCompleted,
181    #[serde(rename = "auto_mode_switch.requested")]
182    AutoModeSwitchRequested,
183    #[serde(rename = "auto_mode_switch.completed")]
184    AutoModeSwitchCompleted,
185    #[serde(rename = "session_limits_exhausted.requested")]
186    SessionLimitsExhaustedRequested,
187    #[serde(rename = "session_limits_exhausted.completed")]
188    SessionLimitsExhaustedCompleted,
189    ///
190    /// <div class="warning">
191    ///
192    /// **Experimental.** This type is part of an experimental wire-protocol surface
193    /// and may change or be removed in future SDK or CLI releases.
194    ///
195    /// </div>
196    #[serde(rename = "session.auto_mode_resolved")]
197    SessionAutoModeResolved,
198    #[serde(rename = "commands.changed")]
199    CommandsChanged,
200    #[serde(rename = "capabilities.changed")]
201    CapabilitiesChanged,
202    #[serde(rename = "exit_plan_mode.requested")]
203    ExitPlanModeRequested,
204    #[serde(rename = "exit_plan_mode.completed")]
205    ExitPlanModeCompleted,
206    #[serde(rename = "session.tools_updated")]
207    SessionToolsUpdated,
208    #[serde(rename = "session.background_tasks_changed")]
209    SessionBackgroundTasksChanged,
210    #[serde(rename = "session.skills_loaded")]
211    SessionSkillsLoaded,
212    #[serde(rename = "session.custom_agents_updated")]
213    SessionCustomAgentsUpdated,
214    #[serde(rename = "session.mcp_servers_loaded")]
215    SessionMcpServersLoaded,
216    #[serde(rename = "session.mcp_server_status_changed")]
217    SessionMcpServerStatusChanged,
218    #[serde(rename = "mcp.tools.list_changed")]
219    McpToolsListChanged,
220    #[serde(rename = "mcp.resources.list_changed")]
221    McpResourcesListChanged,
222    #[serde(rename = "mcp.prompts.list_changed")]
223    McpPromptsListChanged,
224    #[serde(rename = "session.extensions_loaded")]
225    SessionExtensionsLoaded,
226    ///
227    /// <div class="warning">
228    ///
229    /// **Experimental.** This type is part of an experimental wire-protocol surface
230    /// and may change or be removed in future SDK or CLI releases.
231    ///
232    /// </div>
233    #[serde(rename = "session.canvas.opened")]
234    SessionCanvasOpened,
235    ///
236    /// <div class="warning">
237    ///
238    /// **Experimental.** This type is part of an experimental wire-protocol surface
239    /// and may change or be removed in future SDK or CLI releases.
240    ///
241    /// </div>
242    #[serde(rename = "session.canvas.registry_changed")]
243    SessionCanvasRegistryChanged,
244    ///
245    /// <div class="warning">
246    ///
247    /// **Experimental.** This type is part of an experimental wire-protocol surface
248    /// and may change or be removed in future SDK or CLI releases.
249    ///
250    /// </div>
251    #[serde(rename = "session.canvas.closed")]
252    SessionCanvasClosed,
253    ///
254    /// <div class="warning">
255    ///
256    /// **Experimental.** This type is part of an experimental wire-protocol surface
257    /// and may change or be removed in future SDK or CLI releases.
258    ///
259    /// </div>
260    #[serde(rename = "session.canvas.unavailable")]
261    SessionCanvasUnavailable,
262    ///
263    /// <div class="warning">
264    ///
265    /// **Experimental.** This type is part of an experimental wire-protocol surface
266    /// and may change or be removed in future SDK or CLI releases.
267    ///
268    /// </div>
269    #[serde(rename = "session.canvas.recorded")]
270    SessionCanvasRecorded,
271    ///
272    /// <div class="warning">
273    ///
274    /// **Experimental.** This type is part of an experimental wire-protocol surface
275    /// and may change or be removed in future SDK or CLI releases.
276    ///
277    /// </div>
278    #[serde(rename = "session.canvas.removed")]
279    SessionCanvasRemoved,
280    #[serde(rename = "session.extensions.attachments_pushed")]
281    SessionExtensionsAttachmentsPushed,
282    #[serde(rename = "mcp_app.tool_call_complete")]
283    McpAppToolCallComplete,
284    /// Unknown event type for forward compatibility.
285    #[default]
286    #[serde(other)]
287    Unknown,
288}
289
290/// Typed session event data, discriminated by the event `type` field.
291///
292/// Use with [`TypedSessionEvent`] for fully typed event handling.
293#[derive(Debug, Clone, Serialize, Deserialize)]
294#[serde(tag = "type", content = "data")]
295pub enum SessionEventData {
296    #[serde(rename = "session.start")]
297    SessionStart(SessionStartData),
298    #[serde(rename = "session.resume")]
299    SessionResume(SessionResumeData),
300    #[serde(rename = "session.remote_steerable_changed")]
301    SessionRemoteSteerableChanged(SessionRemoteSteerableChangedData),
302    #[serde(rename = "session.error")]
303    SessionError(SessionErrorData),
304    #[serde(rename = "session.idle")]
305    SessionIdle(SessionIdleData),
306    #[serde(rename = "session.title_changed")]
307    SessionTitleChanged(SessionTitleChangedData),
308    #[serde(rename = "session.schedule_created")]
309    SessionScheduleCreated(SessionScheduleCreatedData),
310    #[serde(rename = "session.schedule_cancelled")]
311    SessionScheduleCancelled(SessionScheduleCancelledData),
312    #[serde(rename = "session.schedule_rearmed")]
313    SessionScheduleRearmed(SessionScheduleRearmedData),
314    #[serde(rename = "session.autopilot_objective_changed")]
315    SessionAutopilotObjectiveChanged(SessionAutopilotObjectiveChangedData),
316    #[serde(rename = "session.info")]
317    SessionInfo(SessionInfoData),
318    #[serde(rename = "session.warning")]
319    SessionWarning(SessionWarningData),
320    #[serde(rename = "session.model_change")]
321    SessionModelChange(SessionModelChangeData),
322    #[serde(rename = "session.mode_changed")]
323    SessionModeChanged(SessionModeChangedData),
324    #[serde(rename = "session.session_limits_changed")]
325    SessionSessionLimitsChanged(SessionSessionLimitsChangedData),
326    #[serde(rename = "session.permissions_changed")]
327    SessionPermissionsChanged(SessionPermissionsChangedData),
328    #[serde(rename = "session.plan_changed")]
329    SessionPlanChanged(SessionPlanChangedData),
330    #[serde(rename = "session.todos_changed")]
331    SessionTodosChanged(SessionTodosChangedData),
332    #[serde(rename = "session.workspace_file_changed")]
333    SessionWorkspaceFileChanged(SessionWorkspaceFileChangedData),
334    #[serde(rename = "session.handoff")]
335    SessionHandoff(SessionHandoffData),
336    #[serde(rename = "session.truncation")]
337    SessionTruncation(SessionTruncationData),
338    #[serde(rename = "session.snapshot_rewind")]
339    SessionSnapshotRewind(SessionSnapshotRewindData),
340    #[serde(rename = "session.shutdown")]
341    SessionShutdown(SessionShutdownData),
342    #[serde(rename = "session.usage_checkpoint")]
343    SessionUsageCheckpoint(SessionUsageCheckpointData),
344    #[serde(rename = "session.context_changed")]
345    SessionContextChanged(SessionContextChangedData),
346    #[serde(rename = "session.usage_info")]
347    SessionUsageInfo(SessionUsageInfoData),
348    #[serde(rename = "session.compaction_start")]
349    SessionCompactionStart(SessionCompactionStartData),
350    #[serde(rename = "session.compaction_complete")]
351    SessionCompactionComplete(SessionCompactionCompleteData),
352    #[serde(rename = "session.task_complete")]
353    SessionTaskComplete(SessionTaskCompleteData),
354    #[serde(rename = "user.message")]
355    UserMessage(UserMessageData),
356    #[serde(rename = "pending_messages.modified")]
357    PendingMessagesModified(PendingMessagesModifiedData),
358    #[serde(rename = "assistant.turn_start")]
359    AssistantTurnStart(AssistantTurnStartData),
360    #[serde(rename = "assistant.intent")]
361    AssistantIntent(AssistantIntentData),
362    #[serde(rename = "assistant.reasoning")]
363    AssistantReasoning(AssistantReasoningData),
364    #[serde(rename = "assistant.reasoning_delta")]
365    AssistantReasoningDelta(AssistantReasoningDeltaData),
366    #[serde(rename = "assistant.tool_call_delta")]
367    AssistantToolCallDelta(AssistantToolCallDeltaData),
368    #[serde(rename = "assistant.streaming_delta")]
369    AssistantStreamingDelta(AssistantStreamingDeltaData),
370    #[serde(rename = "assistant.message")]
371    AssistantMessage(AssistantMessageData),
372    #[serde(rename = "assistant.message_start")]
373    AssistantMessageStart(AssistantMessageStartData),
374    #[serde(rename = "assistant.message_delta")]
375    AssistantMessageDelta(AssistantMessageDeltaData),
376    #[serde(rename = "assistant.turn_end")]
377    AssistantTurnEnd(AssistantTurnEndData),
378    #[serde(rename = "assistant.idle")]
379    AssistantIdle(AssistantIdleData),
380    #[serde(rename = "assistant.usage")]
381    AssistantUsage(AssistantUsageData),
382    #[serde(rename = "model.call_failure")]
383    ModelCallFailure(ModelCallFailureData),
384    #[serde(rename = "abort")]
385    Abort(AbortData),
386    #[serde(rename = "tool.user_requested")]
387    ToolUserRequested(ToolUserRequestedData),
388    #[serde(rename = "tool.execution_start")]
389    ToolExecutionStart(ToolExecutionStartData),
390    #[serde(rename = "tool.execution_partial_result")]
391    ToolExecutionPartialResult(ToolExecutionPartialResultData),
392    #[serde(rename = "tool.execution_progress")]
393    ToolExecutionProgress(ToolExecutionProgressData),
394    #[serde(rename = "tool.execution_complete")]
395    ToolExecutionComplete(ToolExecutionCompleteData),
396    #[serde(rename = "skill.invoked")]
397    SkillInvoked(SkillInvokedData),
398    #[serde(rename = "subagent.started")]
399    SubagentStarted(SubagentStartedData),
400    #[serde(rename = "subagent.completed")]
401    SubagentCompleted(SubagentCompletedData),
402    #[serde(rename = "subagent.failed")]
403    SubagentFailed(SubagentFailedData),
404    #[serde(rename = "subagent.selected")]
405    SubagentSelected(SubagentSelectedData),
406    #[serde(rename = "subagent.deselected")]
407    SubagentDeselected(SubagentDeselectedData),
408    #[serde(rename = "hook.start")]
409    HookStart(HookStartData),
410    #[serde(rename = "hook.end")]
411    HookEnd(HookEndData),
412    #[serde(rename = "hook.progress")]
413    HookProgress(HookProgressData),
414    #[serde(rename = "session.binary_asset")]
415    SessionBinaryAsset(SessionBinaryAssetData),
416    #[serde(rename = "system.message")]
417    SystemMessage(SystemMessageData),
418    #[serde(rename = "system.notification")]
419    SystemNotification(SystemNotificationData),
420    #[serde(rename = "permission.requested")]
421    PermissionRequested(PermissionRequestedData),
422    #[serde(rename = "permission.completed")]
423    PermissionCompleted(PermissionCompletedData),
424    #[serde(rename = "user_input.requested")]
425    UserInputRequested(UserInputRequestedData),
426    #[serde(rename = "user_input.completed")]
427    UserInputCompleted(UserInputCompletedData),
428    #[serde(rename = "elicitation.requested")]
429    ElicitationRequested(ElicitationRequestedData),
430    #[serde(rename = "elicitation.completed")]
431    ElicitationCompleted(ElicitationCompletedData),
432    #[serde(rename = "sampling.requested")]
433    SamplingRequested(SamplingRequestedData),
434    #[serde(rename = "sampling.completed")]
435    SamplingCompleted(SamplingCompletedData),
436    #[serde(rename = "mcp.oauth_required")]
437    McpOauthRequired(McpOauthRequiredData),
438    #[serde(rename = "mcp.oauth_completed")]
439    McpOauthCompleted(McpOauthCompletedData),
440    #[serde(rename = "mcp.headers_refresh_required")]
441    McpHeadersRefreshRequired(McpHeadersRefreshRequiredData),
442    #[serde(rename = "mcp.headers_refresh_completed")]
443    McpHeadersRefreshCompleted(McpHeadersRefreshCompletedData),
444    #[serde(rename = "session.custom_notification")]
445    SessionCustomNotification(SessionCustomNotificationData),
446    #[serde(rename = "external_tool.requested")]
447    ExternalToolRequested(ExternalToolRequestedData),
448    #[serde(rename = "external_tool.completed")]
449    ExternalToolCompleted(ExternalToolCompletedData),
450    #[serde(rename = "command.queued")]
451    CommandQueued(CommandQueuedData),
452    #[serde(rename = "command.execute")]
453    CommandExecute(CommandExecuteData),
454    #[serde(rename = "command.completed")]
455    CommandCompleted(CommandCompletedData),
456    #[serde(rename = "auto_mode_switch.requested")]
457    AutoModeSwitchRequested(AutoModeSwitchRequestedData),
458    #[serde(rename = "auto_mode_switch.completed")]
459    AutoModeSwitchCompleted(AutoModeSwitchCompletedData),
460    #[serde(rename = "session_limits_exhausted.requested")]
461    SessionLimitsExhaustedRequested(SessionLimitsExhaustedRequestedData),
462    #[serde(rename = "session_limits_exhausted.completed")]
463    SessionLimitsExhaustedCompleted(SessionLimitsExhaustedCompletedData),
464    ///
465    /// <div class="warning">
466    ///
467    /// **Experimental.** This type is part of an experimental wire-protocol surface
468    /// and may change or be removed in future SDK or CLI releases.
469    ///
470    /// </div>
471    #[serde(rename = "session.auto_mode_resolved")]
472    SessionAutoModeResolved(SessionAutoModeResolvedData),
473    #[serde(rename = "commands.changed")]
474    CommandsChanged(CommandsChangedData),
475    #[serde(rename = "capabilities.changed")]
476    CapabilitiesChanged(CapabilitiesChangedData),
477    #[serde(rename = "exit_plan_mode.requested")]
478    ExitPlanModeRequested(ExitPlanModeRequestedData),
479    #[serde(rename = "exit_plan_mode.completed")]
480    ExitPlanModeCompleted(ExitPlanModeCompletedData),
481    #[serde(rename = "session.tools_updated")]
482    SessionToolsUpdated(SessionToolsUpdatedData),
483    #[serde(rename = "session.background_tasks_changed")]
484    SessionBackgroundTasksChanged(SessionBackgroundTasksChangedData),
485    #[serde(rename = "session.skills_loaded")]
486    SessionSkillsLoaded(SessionSkillsLoadedData),
487    #[serde(rename = "session.custom_agents_updated")]
488    SessionCustomAgentsUpdated(SessionCustomAgentsUpdatedData),
489    #[serde(rename = "session.mcp_servers_loaded")]
490    SessionMcpServersLoaded(SessionMcpServersLoadedData),
491    #[serde(rename = "session.mcp_server_status_changed")]
492    SessionMcpServerStatusChanged(SessionMcpServerStatusChangedData),
493    #[serde(rename = "mcp.tools.list_changed")]
494    McpToolsListChanged(McpToolsListChangedData),
495    #[serde(rename = "mcp.resources.list_changed")]
496    McpResourcesListChanged(McpResourcesListChangedData),
497    #[serde(rename = "mcp.prompts.list_changed")]
498    McpPromptsListChanged(McpPromptsListChangedData),
499    #[serde(rename = "session.extensions_loaded")]
500    SessionExtensionsLoaded(SessionExtensionsLoadedData),
501    ///
502    /// <div class="warning">
503    ///
504    /// **Experimental.** This type is part of an experimental wire-protocol surface
505    /// and may change or be removed in future SDK or CLI releases.
506    ///
507    /// </div>
508    #[serde(rename = "session.canvas.opened")]
509    SessionCanvasOpened(SessionCanvasOpenedData),
510    ///
511    /// <div class="warning">
512    ///
513    /// **Experimental.** This type is part of an experimental wire-protocol surface
514    /// and may change or be removed in future SDK or CLI releases.
515    ///
516    /// </div>
517    #[serde(rename = "session.canvas.registry_changed")]
518    SessionCanvasRegistryChanged(SessionCanvasRegistryChangedData),
519    ///
520    /// <div class="warning">
521    ///
522    /// **Experimental.** This type is part of an experimental wire-protocol surface
523    /// and may change or be removed in future SDK or CLI releases.
524    ///
525    /// </div>
526    #[serde(rename = "session.canvas.closed")]
527    SessionCanvasClosed(SessionCanvasClosedData),
528    ///
529    /// <div class="warning">
530    ///
531    /// **Experimental.** This type is part of an experimental wire-protocol surface
532    /// and may change or be removed in future SDK or CLI releases.
533    ///
534    /// </div>
535    #[serde(rename = "session.canvas.unavailable")]
536    SessionCanvasUnavailable(SessionCanvasUnavailableData),
537    ///
538    /// <div class="warning">
539    ///
540    /// **Experimental.** This type is part of an experimental wire-protocol surface
541    /// and may change or be removed in future SDK or CLI releases.
542    ///
543    /// </div>
544    #[serde(rename = "session.canvas.recorded")]
545    SessionCanvasRecorded(SessionCanvasRecordedData),
546    ///
547    /// <div class="warning">
548    ///
549    /// **Experimental.** This type is part of an experimental wire-protocol surface
550    /// and may change or be removed in future SDK or CLI releases.
551    ///
552    /// </div>
553    #[serde(rename = "session.canvas.removed")]
554    SessionCanvasRemoved(SessionCanvasRemovedData),
555    #[serde(rename = "session.extensions.attachments_pushed")]
556    SessionExtensionsAttachmentsPushed(SessionExtensionsAttachmentsPushedData),
557    #[serde(rename = "mcp_app.tool_call_complete")]
558    McpAppToolCallComplete(McpAppToolCallCompleteData),
559}
560
561/// A session event with typed data payload.
562///
563/// The common event fields (id, timestamp, parentId, ephemeral, agentId)
564/// are available directly. The event-specific data is in the `payload`
565/// field as a [`SessionEventData`] enum.
566#[derive(Debug, Clone, Serialize, Deserialize)]
567#[serde(rename_all = "camelCase")]
568pub struct TypedSessionEvent {
569    /// Unique event identifier (UUID v4).
570    pub id: String,
571    /// ISO 8601 timestamp when the event was created.
572    pub timestamp: String,
573    /// ID of the preceding event in the chain.
574    #[serde(skip_serializing_if = "Option::is_none")]
575    pub parent_id: Option<String>,
576    /// When true, the event is transient and not persisted.
577    #[serde(skip_serializing_if = "Option::is_none")]
578    pub ephemeral: Option<bool>,
579    /// Sub-agent instance identifier. Absent for events from the root /
580    /// main agent and session-level events.
581    #[serde(skip_serializing_if = "Option::is_none")]
582    pub agent_id: Option<String>,
583    /// The typed event payload (discriminated by event type).
584    #[serde(flatten)]
585    pub payload: SessionEventData,
586}
587
588/// Working directory and git context at session start
589#[derive(Debug, Clone, Default, Serialize, Deserialize)]
590#[serde(rename_all = "camelCase")]
591pub struct WorkingDirectoryContext {
592    /// Base commit of current git branch at session start time
593    #[serde(skip_serializing_if = "Option::is_none")]
594    pub base_commit: Option<String>,
595    /// Current git branch name
596    #[serde(skip_serializing_if = "Option::is_none")]
597    pub branch: Option<String>,
598    /// Current working directory path
599    pub cwd: String,
600    /// Root directory of the git repository, resolved via git rev-parse
601    #[serde(skip_serializing_if = "Option::is_none")]
602    pub git_root: Option<String>,
603    /// Head commit of current git branch at session start time
604    #[serde(skip_serializing_if = "Option::is_none")]
605    pub head_commit: Option<String>,
606    /// Hosting platform type of the repository (github or ado)
607    #[serde(skip_serializing_if = "Option::is_none")]
608    pub host_type: Option<WorkingDirectoryContextHostType>,
609    /// Repository identifier derived from the git remote URL ("owner/name" for GitHub, "org/project/repo" for Azure DevOps)
610    #[serde(skip_serializing_if = "Option::is_none")]
611    pub repository: Option<String>,
612    /// Raw host string from the git remote URL (e.g. "github.com", "mycompany.ghe.com", "dev.azure.com")
613    #[serde(skip_serializing_if = "Option::is_none")]
614    pub repository_host: Option<String>,
615}
616
617/// Optional session limits.
618#[derive(Debug, Clone, Default, Serialize, Deserialize)]
619#[serde(rename_all = "camelCase")]
620pub struct SessionLimitsConfig {
621    /// Maximum AI Credits allowed across the session's current accounting window.
622    #[serde(skip_serializing_if = "Option::is_none")]
623    pub max_ai_credits: Option<f64>,
624}
625
626/// Session event "session.start". Session initialization metadata including context and configuration
627#[derive(Debug, Clone, Default, Serialize, Deserialize)]
628#[serde(rename_all = "camelCase")]
629pub struct SessionStartData {
630    /// Whether the session was already in use by another client at start time
631    #[serde(skip_serializing_if = "Option::is_none")]
632    pub already_in_use: Option<bool>,
633    /// Working directory and git context at session start
634    #[serde(skip_serializing_if = "Option::is_none")]
635    pub context: Option<WorkingDirectoryContext>,
636    /// Context tier selected at session creation time for models with tiered context pricing; null when no tier is selected (e.g., non-tiered model)
637    #[serde(skip_serializing_if = "Option::is_none")]
638    pub context_tier: Option<ContextTier>,
639    /// Version string of the Copilot application
640    pub copilot_version: String,
641    /// 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.
642    #[serde(skip_serializing_if = "Option::is_none")]
643    pub detached_from_spawning_parent_session_id: Option<String>,
644    /// Identifier of the software producing the events (e.g., "copilot-agent")
645    pub producer: String,
646    /// Reasoning effort level used for model calls, if applicable (e.g. "none", "low", "medium", "high", "xhigh", "max")
647    #[serde(skip_serializing_if = "Option::is_none")]
648    pub reasoning_effort: Option<String>,
649    /// Reasoning summary mode used for model calls, if applicable (e.g. "none", "concise", "detailed")
650    #[serde(skip_serializing_if = "Option::is_none")]
651    pub reasoning_summary: Option<ReasoningSummary>,
652    /// Whether this session supports remote steering via GitHub
653    #[serde(skip_serializing_if = "Option::is_none")]
654    pub remote_steerable: Option<bool>,
655    /// Model selected at session creation time, if any
656    #[serde(skip_serializing_if = "Option::is_none")]
657    pub selected_model: Option<String>,
658    /// Unique identifier for the session
659    pub session_id: SessionId,
660    /// Session limits configured at session creation time, if any
661    #[serde(skip_serializing_if = "Option::is_none")]
662    pub session_limits: Option<SessionLimitsConfig>,
663    /// ISO 8601 timestamp when the session was created
664    pub start_time: String,
665    /// Output verbosity level used for model calls, if applicable (e.g. "low", "medium", "high")
666    #[serde(skip_serializing_if = "Option::is_none")]
667    pub verbosity: Option<Verbosity>,
668    /// Schema version number for the session event format
669    pub version: i64,
670}
671
672/// Session event "session.resume". Session resume metadata including current context and event count
673#[derive(Debug, Clone, Default, Serialize, Deserialize)]
674#[serde(rename_all = "camelCase")]
675pub struct SessionResumeData {
676    /// Whether the session was already in use by another client at resume time
677    #[serde(skip_serializing_if = "Option::is_none")]
678    pub already_in_use: Option<bool>,
679    /// Updated working directory and git context at resume time
680    #[serde(skip_serializing_if = "Option::is_none")]
681    pub context: Option<WorkingDirectoryContext>,
682    /// Context tier currently selected at resume time; null when no tier is active
683    #[serde(skip_serializing_if = "Option::is_none")]
684    pub context_tier: Option<ContextTier>,
685    /// 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.
686    #[serde(skip_serializing_if = "Option::is_none")]
687    pub continue_pending_work: Option<bool>,
688    /// Total number of persisted events in the session at the time of resume
689    pub event_count: i64,
690    /// On-disk byte size of the session's persisted events.jsonl file at resume time; omitted when the file does not exist or cannot be stat'd
691    #[serde(skip_serializing_if = "Option::is_none")]
692    pub events_file_size_bytes: Option<i64>,
693    /// Reasoning effort level used for model calls, if applicable (e.g. "none", "low", "medium", "high", "xhigh", "max")
694    #[serde(skip_serializing_if = "Option::is_none")]
695    pub reasoning_effort: Option<String>,
696    /// Reasoning summary mode used for model calls, if applicable (e.g. "none", "concise", "detailed")
697    #[serde(skip_serializing_if = "Option::is_none")]
698    pub reasoning_summary: Option<ReasoningSummary>,
699    /// Whether this session supports remote steering via GitHub
700    #[serde(skip_serializing_if = "Option::is_none")]
701    pub remote_steerable: Option<bool>,
702    /// ISO 8601 timestamp when the session was resumed
703    pub resume_time: String,
704    /// Model currently selected at resume time
705    #[serde(skip_serializing_if = "Option::is_none")]
706    pub selected_model: Option<String>,
707    /// Session limits currently configured at resume time; null when no limits are active
708    #[serde(skip_serializing_if = "Option::is_none")]
709    pub session_limits: Option<SessionLimitsConfig>,
710    /// 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.
711    #[serde(skip_serializing_if = "Option::is_none")]
712    pub session_was_active: Option<bool>,
713    /// Output verbosity level used for model calls, if applicable (e.g. "low", "medium", "high")
714    #[serde(skip_serializing_if = "Option::is_none")]
715    pub verbosity: Option<Verbosity>,
716}
717
718/// Session event "session.remote_steerable_changed". Notifies that the session's remote steering capability has changed
719#[derive(Debug, Clone, Default, Serialize, Deserialize)]
720#[serde(rename_all = "camelCase")]
721pub struct SessionRemoteSteerableChangedData {
722    /// Whether this session now supports remote steering via GitHub
723    pub remote_steerable: bool,
724}
725
726/// Session event "session.error". Error details for timeline display including message and optional diagnostic information
727#[derive(Debug, Clone, Default, Serialize, Deserialize)]
728#[serde(rename_all = "camelCase")]
729pub struct SessionErrorData {
730    /// 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.
731    #[serde(skip_serializing_if = "Option::is_none")]
732    pub eligible_for_auto_switch: Option<bool>,
733    /// 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"`).
734    #[serde(skip_serializing_if = "Option::is_none")]
735    pub error_code: Option<String>,
736    /// Category of error (e.g., "authentication", "authorization", "quota", "rate_limit", "context_limit", "query")
737    pub error_type: String,
738    /// Human-readable error message
739    pub message: String,
740    /// GitHub request tracing ID (x-github-request-id header) for correlating with server-side logs
741    #[serde(skip_serializing_if = "Option::is_none")]
742    pub provider_call_id: Option<String>,
743    /// Copilot service request ID (x-copilot-service-request-id header) for CAPI log correlation
744    #[serde(skip_serializing_if = "Option::is_none")]
745    pub service_request_id: Option<String>,
746    /// Error stack trace, when available
747    #[serde(skip_serializing_if = "Option::is_none")]
748    pub stack: Option<String>,
749    /// HTTP status code from the upstream request, if applicable
750    #[serde(skip_serializing_if = "Option::is_none")]
751    pub status_code: Option<i32>,
752    /// Optional URL associated with this error that the user can open in a browser
753    #[serde(skip_serializing_if = "Option::is_none")]
754    pub url: Option<String>,
755}
756
757/// Session event "session.idle". Payload indicating the session is idle with no background agents or attached shell commands in flight
758#[derive(Debug, Clone, Default, Serialize, Deserialize)]
759#[serde(rename_all = "camelCase")]
760pub struct SessionIdleData {
761    /// True when the preceding agentic loop was cancelled via abort signal
762    #[serde(skip_serializing_if = "Option::is_none")]
763    pub aborted: Option<bool>,
764}
765
766/// Session event "session.title_changed". Session title change payload containing the new display title
767#[derive(Debug, Clone, Default, Serialize, Deserialize)]
768#[serde(rename_all = "camelCase")]
769pub struct SessionTitleChangedData {
770    /// The new display title for the session
771    pub title: String,
772}
773
774/// Session event "session.schedule_created". Scheduled prompt registered via /every or /after
775#[derive(Debug, Clone, Default, Serialize, Deserialize)]
776#[serde(rename_all = "camelCase")]
777pub struct SessionScheduleCreatedData {
778    /// Absolute fire time (epoch milliseconds) for a one-shot calendar schedule
779    #[serde(skip_serializing_if = "Option::is_none")]
780    pub at: Option<i64>,
781    /// 5-field cron expression for a recurring calendar schedule, evaluated in `tz`
782    #[serde(skip_serializing_if = "Option::is_none")]
783    pub cron: Option<String>,
784    /// 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)
785    #[serde(skip_serializing_if = "Option::is_none")]
786    pub display_prompt: Option<String>,
787    /// Sequential id assigned to the scheduled prompt within the session
788    pub id: i64,
789    /// Interval between ticks in milliseconds (relative-interval schedules)
790    #[serde(skip_serializing_if = "Option::is_none")]
791    pub interval_ms: Option<i64>,
792    /// Prompt text that gets enqueued on every tick
793    pub prompt: String,
794    /// Whether the schedule re-arms after each tick (`/every`) or fires once (`/after`)
795    #[serde(skip_serializing_if = "Option::is_none")]
796    pub recurring: Option<bool>,
797    /// True for a self-paced (`dynamic`) schedule: no fixed cadence; the model arms each next run via the `manage_schedule` `wakeup` action. `nextRunAt` is model-controlled rather than auto-computed.
798    #[serde(skip_serializing_if = "Option::is_none")]
799    pub self_paced: Option<bool>,
800    /// IANA timezone the `cron` expression is evaluated in
801    #[serde(skip_serializing_if = "Option::is_none")]
802    pub tz: Option<String>,
803}
804
805/// Session event "session.schedule_cancelled". Scheduled prompt cancelled from the schedule manager dialog
806#[derive(Debug, Clone, Default, Serialize, Deserialize)]
807#[serde(rename_all = "camelCase")]
808pub struct SessionScheduleCancelledData {
809    /// Id of the scheduled prompt that was cancelled
810    pub id: i64,
811}
812
813/// Session event "session.schedule_rearmed". Self-paced schedule re-armed for its next run
814#[derive(Debug, Clone, Default, Serialize, Deserialize)]
815#[serde(rename_all = "camelCase")]
816pub struct SessionScheduleRearmedData {
817    /// Id of the self-paced schedule that was re-armed
818    pub id: i64,
819    /// Absolute time (epoch milliseconds) the model armed the next run to fire
820    pub next_run_at: i64,
821}
822
823/// Session event "session.autopilot_objective_changed". Autopilot objective state file operation details indicating what changed
824#[derive(Debug, Clone, Default, Serialize, Deserialize)]
825#[serde(rename_all = "camelCase")]
826pub struct SessionAutopilotObjectiveChangedData {
827    /// Current autopilot objective id, if one exists
828    #[serde(skip_serializing_if = "Option::is_none")]
829    pub id: Option<i64>,
830    /// The type of operation performed on the autopilot objective state file
831    pub operation: AutopilotObjectiveChangedOperation,
832    /// Current autopilot objective status, if one exists
833    #[serde(skip_serializing_if = "Option::is_none")]
834    pub status: Option<AutopilotObjectiveChangedStatus>,
835}
836
837/// Session event "session.info". Informational message for timeline display with categorization
838#[derive(Debug, Clone, Default, Serialize, Deserialize)]
839#[serde(rename_all = "camelCase")]
840pub struct SessionInfoData {
841    /// Category of informational message (e.g., "notification", "timing", "context_window", "mcp", "snapshot", "configuration", "authentication", "model")
842    pub info_type: String,
843    /// Human-readable informational message for display in the timeline
844    pub message: String,
845    /// Optional actionable tip displayed with this message
846    #[serde(skip_serializing_if = "Option::is_none")]
847    pub tip: Option<String>,
848    /// Optional URL associated with this message that the user can open in a browser
849    #[serde(skip_serializing_if = "Option::is_none")]
850    pub url: Option<String>,
851}
852
853/// Session event "session.warning". Warning message for timeline display with categorization
854#[derive(Debug, Clone, Default, Serialize, Deserialize)]
855#[serde(rename_all = "camelCase")]
856pub struct SessionWarningData {
857    /// Human-readable warning message for display in the timeline
858    pub message: String,
859    /// Optional URL associated with this warning that the user can open in a browser
860    #[serde(skip_serializing_if = "Option::is_none")]
861    pub url: Option<String>,
862    /// Category of warning (e.g., "subscription", "policy", "mcp")
863    pub warning_type: String,
864}
865
866/// Session event "session.model_change". Model change details including previous and new model identifiers
867#[derive(Debug, Clone, Default, Serialize, Deserialize)]
868#[serde(rename_all = "camelCase")]
869pub struct SessionModelChangeData {
870    /// 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.
871    #[serde(skip_serializing_if = "Option::is_none")]
872    pub cause: Option<String>,
873    /// Context tier after the model change; null explicitly clears a previously selected tier
874    #[serde(skip_serializing_if = "Option::is_none")]
875    pub context_tier: Option<ContextTier>,
876    /// Newly selected model identifier
877    pub new_model: String,
878    /// Model that was previously selected, if any
879    #[serde(skip_serializing_if = "Option::is_none")]
880    pub previous_model: Option<String>,
881    /// Reasoning effort level before the model change, if applicable
882    #[serde(skip_serializing_if = "Option::is_none")]
883    pub previous_reasoning_effort: Option<String>,
884    /// Reasoning summary mode before the model change, if applicable
885    #[serde(skip_serializing_if = "Option::is_none")]
886    pub previous_reasoning_summary: Option<ReasoningSummary>,
887    /// Output verbosity level before the model change, if applicable
888    #[serde(skip_serializing_if = "Option::is_none")]
889    pub previous_verbosity: Option<Verbosity>,
890    /// Reasoning effort level after the model change, if applicable
891    #[serde(skip_serializing_if = "Option::is_none")]
892    pub reasoning_effort: Option<String>,
893    /// Reasoning summary mode after the model change, if applicable
894    #[serde(skip_serializing_if = "Option::is_none")]
895    pub reasoning_summary: Option<ReasoningSummary>,
896    /// Output verbosity level after the model change, if applicable
897    #[serde(skip_serializing_if = "Option::is_none")]
898    pub verbosity: Option<Verbosity>,
899}
900
901/// Session event "session.mode_changed". Agent mode change details including previous and new modes
902#[derive(Debug, Clone, Default, Serialize, Deserialize)]
903#[serde(rename_all = "camelCase")]
904pub struct SessionModeChangedData {
905    /// The session mode the agent is operating in
906    pub new_mode: SessionMode,
907    /// The session mode the agent is operating in
908    pub previous_mode: SessionMode,
909}
910
911/// Session event "session.session_limits_changed". Session limits update details. Null clears the limits.
912#[derive(Debug, Clone, Default, Serialize, Deserialize)]
913#[serde(rename_all = "camelCase")]
914pub struct SessionSessionLimitsChangedData {
915    /// Current session limits, or null when no limits are active
916    pub session_limits: Option<SessionLimitsConfig>,
917}
918
919/// Session event "session.permissions_changed". Permissions change details carrying the aggregate allow-all transition.
920#[derive(Debug, Clone, Default, Serialize, Deserialize)]
921#[serde(rename_all = "camelCase")]
922pub struct SessionPermissionsChangedData {
923    /// Allow-all mode after the change
924    ///
925    /// <div class="warning">
926    ///
927    /// **Experimental.** This type is part of an experimental wire-protocol surface
928    /// and may change or be removed in future SDK or CLI releases.
929    ///
930    /// </div>
931    #[serde(skip_serializing_if = "Option::is_none")]
932    pub allow_all_permission_mode: Option<PermissionAllowAllMode>,
933    /// Aggregate allow-all flag after the change
934    pub allow_all_permissions: bool,
935    /// Allow-all mode before the change
936    ///
937    /// <div class="warning">
938    ///
939    /// **Experimental.** This type is part of an experimental wire-protocol surface
940    /// and may change or be removed in future SDK or CLI releases.
941    ///
942    /// </div>
943    #[serde(skip_serializing_if = "Option::is_none")]
944    pub previous_allow_all_permission_mode: Option<PermissionAllowAllMode>,
945    /// Aggregate allow-all flag before the change
946    pub previous_allow_all_permissions: bool,
947}
948
949/// Session event "session.plan_changed". Plan file operation details indicating what changed
950#[derive(Debug, Clone, Default, Serialize, Deserialize)]
951#[serde(rename_all = "camelCase")]
952pub struct SessionPlanChangedData {
953    /// The type of operation performed on the plan file
954    pub operation: PlanChangedOperation,
955}
956
957/// Session event "session.todos_changed". Signal-only event: the agent's todos or todo_deps table was written to. No payload — clients should call session.plan.readSqlTodosWithDependencies() to fetch the current state. Events arrive in order; clients can debounce on arrival if needed.
958#[derive(Debug, Clone, Default, Serialize, Deserialize)]
959#[serde(rename_all = "camelCase")]
960pub struct SessionTodosChangedData {}
961
962/// Session event "session.workspace_file_changed". Workspace file change details including path and operation type
963#[derive(Debug, Clone, Default, Serialize, Deserialize)]
964#[serde(rename_all = "camelCase")]
965pub struct SessionWorkspaceFileChangedData {
966    /// Whether the file was newly created or updated
967    pub operation: WorkspaceFileChangedOperation,
968    /// Relative path within the session workspace files directory
969    pub path: String,
970}
971
972/// Repository context for the handed-off session
973#[derive(Debug, Clone, Default, Serialize, Deserialize)]
974#[serde(rename_all = "camelCase")]
975pub struct HandoffRepository {
976    /// Git branch name, if applicable
977    #[serde(skip_serializing_if = "Option::is_none")]
978    pub branch: Option<String>,
979    /// Repository name
980    pub name: String,
981    /// Repository owner (user or organization)
982    pub owner: String,
983}
984
985/// Session event "session.handoff". Session handoff metadata including source, context, and repository information
986#[derive(Debug, Clone, Default, Serialize, Deserialize)]
987#[serde(rename_all = "camelCase")]
988pub struct SessionHandoffData {
989    /// Additional context information for the handoff
990    #[serde(skip_serializing_if = "Option::is_none")]
991    pub context: Option<String>,
992    /// ISO 8601 timestamp when the handoff occurred
993    pub handoff_time: String,
994    /// GitHub host URL for the source session (e.g., https://github.com or https://tenant.ghe.com)
995    #[serde(skip_serializing_if = "Option::is_none")]
996    pub host: Option<String>,
997    /// Session ID of the remote session being handed off
998    #[serde(skip_serializing_if = "Option::is_none")]
999    pub remote_session_id: Option<SessionId>,
1000    /// Repository context for the handed-off session
1001    #[serde(skip_serializing_if = "Option::is_none")]
1002    pub repository: Option<HandoffRepository>,
1003    /// Origin type of the session being handed off
1004    pub source_type: HandoffSourceType,
1005    /// Summary of the work done in the source session
1006    #[serde(skip_serializing_if = "Option::is_none")]
1007    pub summary: Option<String>,
1008}
1009
1010/// Session event "session.truncation". Conversation truncation statistics including token counts and removed content metrics
1011#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1012#[serde(rename_all = "camelCase")]
1013pub struct SessionTruncationData {
1014    /// Number of messages removed by truncation
1015    pub messages_removed_during_truncation: i64,
1016    /// Identifier of the component that performed truncation (e.g., "BasicTruncator")
1017    pub performed_by: String,
1018    /// Number of conversation messages after truncation
1019    pub post_truncation_messages_length: i64,
1020    /// Total tokens in conversation messages after truncation
1021    pub post_truncation_tokens_in_messages: i64,
1022    /// Number of conversation messages before truncation
1023    pub pre_truncation_messages_length: i64,
1024    /// Total tokens in conversation messages before truncation
1025    pub pre_truncation_tokens_in_messages: i64,
1026    /// Maximum token count for the model's context window
1027    pub token_limit: i64,
1028    /// Number of tokens removed by truncation
1029    pub tokens_removed_during_truncation: i64,
1030}
1031
1032/// Session event "session.snapshot_rewind". Session rewind details including target event and count of removed events
1033#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1034#[serde(rename_all = "camelCase")]
1035pub struct SessionSnapshotRewindData {
1036    /// Number of events that were removed by the rewind
1037    pub events_removed: i64,
1038    /// Event ID that was rewound to; this event and all after it were removed
1039    pub up_to_event_id: String,
1040}
1041
1042/// Aggregate code change metrics for the session
1043#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1044#[serde(rename_all = "camelCase")]
1045pub struct ShutdownCodeChanges {
1046    /// List of file paths that were modified during the session
1047    pub files_modified: Vec<String>,
1048    /// Total number of lines added during the session
1049    pub lines_added: i64,
1050    /// Total number of lines removed during the session
1051    pub lines_removed: i64,
1052}
1053
1054/// Request count and cost metrics
1055#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1056#[serde(rename_all = "camelCase")]
1057pub struct ShutdownModelMetricRequests {
1058    /// Cumulative cost multiplier for requests to this model
1059    ///
1060    /// <div class="warning">
1061    ///
1062    /// **Experimental.** This type is part of an experimental wire-protocol surface
1063    /// and may change or be removed in future SDK or CLI releases.
1064    ///
1065    /// </div>
1066    #[serde(skip_serializing_if = "Option::is_none")]
1067    pub cost: Option<f64>,
1068    /// Total number of API requests made to this model
1069    ///
1070    /// <div class="warning">
1071    ///
1072    /// **Experimental.** This type is part of an experimental wire-protocol surface
1073    /// and may change or be removed in future SDK or CLI releases.
1074    ///
1075    /// </div>
1076    #[serde(skip_serializing_if = "Option::is_none")]
1077    pub count: Option<i64>,
1078}
1079
1080/// A token-type entry in a shutdown model metric, storing the accumulated token count.
1081#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1082#[serde(rename_all = "camelCase")]
1083pub struct ShutdownModelMetricTokenDetail {
1084    /// Accumulated token count for this token type
1085    pub token_count: i64,
1086}
1087
1088/// Token usage breakdown
1089#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1090#[serde(rename_all = "camelCase")]
1091pub struct ShutdownModelMetricUsage {
1092    /// Total tokens read from prompt cache across all requests
1093    pub cache_read_tokens: i64,
1094    /// Total tokens written to prompt cache across all requests
1095    pub cache_write_tokens: i64,
1096    /// Total input tokens consumed across all requests to this model
1097    pub input_tokens: i64,
1098    /// Total output tokens produced across all requests to this model
1099    pub output_tokens: i64,
1100    /// Total reasoning tokens produced across all requests to this model
1101    #[serde(skip_serializing_if = "Option::is_none")]
1102    pub reasoning_tokens: Option<i64>,
1103}
1104
1105/// Per-model shutdown metrics with request counts, token usage, nano-AI units, and token details.
1106#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1107#[serde(rename_all = "camelCase")]
1108pub struct ShutdownModelMetric {
1109    /// Request count and cost metrics
1110    pub requests: ShutdownModelMetricRequests,
1111    /// Token count details per type
1112    #[serde(skip_serializing_if = "Option::is_none")]
1113    pub token_details: Option<HashMap<String, ShutdownModelMetricTokenDetail>>,
1114    /// Accumulated nano-AI units cost for this model
1115    ///
1116    /// <div class="warning">
1117    ///
1118    /// **Experimental.** This type is part of an experimental wire-protocol surface
1119    /// and may change or be removed in future SDK or CLI releases.
1120    ///
1121    /// </div>
1122    #[serde(skip_serializing_if = "Option::is_none")]
1123    pub total_nano_aiu: Option<f64>,
1124    /// Token usage breakdown
1125    pub usage: ShutdownModelMetricUsage,
1126}
1127
1128/// A session-wide shutdown token-type entry storing the accumulated token count.
1129#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1130#[serde(rename_all = "camelCase")]
1131pub struct ShutdownTokenDetail {
1132    /// Accumulated token count for this token type
1133    pub token_count: i64,
1134}
1135
1136/// Session event "session.shutdown". Session termination metrics including usage statistics, code changes, and shutdown reason
1137#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1138#[serde(rename_all = "camelCase")]
1139pub struct SessionShutdownData {
1140    /// Aggregate code change metrics for the session
1141    pub code_changes: ShutdownCodeChanges,
1142    /// Non-system message token count at shutdown
1143    #[serde(skip_serializing_if = "Option::is_none")]
1144    pub conversation_tokens: Option<i64>,
1145    /// Model that was selected at the time of shutdown
1146    #[serde(skip_serializing_if = "Option::is_none")]
1147    pub current_model: Option<String>,
1148    /// Total tokens in context window at shutdown
1149    #[serde(skip_serializing_if = "Option::is_none")]
1150    pub current_tokens: Option<i64>,
1151    /// Error description when shutdownType is "error"
1152    #[serde(skip_serializing_if = "Option::is_none")]
1153    pub error_reason: Option<String>,
1154    /// On-disk byte size of the session's persisted events.jsonl file at shutdown time; omitted when the file does not exist or cannot be stat'd
1155    #[serde(skip_serializing_if = "Option::is_none")]
1156    pub events_file_size_bytes: Option<i64>,
1157    /// Per-model usage breakdown, keyed by model identifier
1158    pub model_metrics: HashMap<String, ShutdownModelMetric>,
1159    /// Unix timestamp (milliseconds) when the session started
1160    pub session_start_time: i64,
1161    /// Whether the session ended normally ("routine") or due to a crash/fatal error ("error")
1162    pub shutdown_type: ShutdownType,
1163    /// System message token count at shutdown
1164    #[serde(skip_serializing_if = "Option::is_none")]
1165    pub system_tokens: Option<i64>,
1166    /// Session-wide per-token-type accumulated token counts
1167    #[serde(skip_serializing_if = "Option::is_none")]
1168    pub token_details: Option<HashMap<String, ShutdownTokenDetail>>,
1169    /// Tool definitions token count at shutdown
1170    #[serde(skip_serializing_if = "Option::is_none")]
1171    pub tool_definitions_tokens: Option<i64>,
1172    /// Cumulative time spent in API calls during the session, in milliseconds
1173    pub total_api_duration_ms: i64,
1174    /// Session-wide accumulated nano-AI units cost
1175    ///
1176    /// <div class="warning">
1177    ///
1178    /// **Experimental.** This type is part of an experimental wire-protocol surface
1179    /// and may change or be removed in future SDK or CLI releases.
1180    ///
1181    /// </div>
1182    #[serde(skip_serializing_if = "Option::is_none")]
1183    pub total_nano_aiu: Option<f64>,
1184    /// Total number of premium API requests used during the session
1185    #[doc(hidden)]
1186    #[serde(skip_serializing_if = "Option::is_none")]
1187    pub(crate) total_premium_requests: Option<f64>,
1188}
1189
1190/// Session event "session.usage_checkpoint". Durable session usage checkpoint for reconstructing aggregate accounting on resume
1191#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1192#[serde(rename_all = "camelCase")]
1193pub struct SessionUsageCheckpointData {
1194    /// Session-wide accumulated nano-AI units cost at checkpoint time
1195    pub total_nano_aiu: f64,
1196    /// Total number of premium API requests used at checkpoint time
1197    #[doc(hidden)]
1198    #[serde(skip_serializing_if = "Option::is_none")]
1199    pub(crate) total_premium_requests: Option<f64>,
1200}
1201
1202/// Session event "session.context_changed". Updated working directory and git context after the change
1203#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1204#[serde(rename_all = "camelCase")]
1205pub struct SessionContextChangedData {
1206    /// Base commit of current git branch at session start time
1207    #[serde(skip_serializing_if = "Option::is_none")]
1208    pub base_commit: Option<String>,
1209    /// Current git branch name
1210    #[serde(skip_serializing_if = "Option::is_none")]
1211    pub branch: Option<String>,
1212    /// Current working directory path
1213    pub cwd: String,
1214    /// Root directory of the git repository, resolved via git rev-parse
1215    #[serde(skip_serializing_if = "Option::is_none")]
1216    pub git_root: Option<String>,
1217    /// Head commit of current git branch at session start time
1218    #[serde(skip_serializing_if = "Option::is_none")]
1219    pub head_commit: Option<String>,
1220    /// Hosting platform type of the repository (github or ado)
1221    #[serde(skip_serializing_if = "Option::is_none")]
1222    pub host_type: Option<WorkingDirectoryContextHostType>,
1223    /// Repository identifier derived from the git remote URL ("owner/name" for GitHub, "org/project/repo" for Azure DevOps)
1224    #[serde(skip_serializing_if = "Option::is_none")]
1225    pub repository: Option<String>,
1226    /// Raw host string from the git remote URL (e.g. "github.com", "mycompany.ghe.com", "dev.azure.com")
1227    #[serde(skip_serializing_if = "Option::is_none")]
1228    pub repository_host: Option<String>,
1229}
1230
1231/// Session event "session.usage_info". Current context window usage statistics including token and message counts
1232#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1233#[serde(rename_all = "camelCase")]
1234pub struct SessionUsageInfoData {
1235    /// Token count from non-system messages (user, assistant, tool)
1236    #[serde(skip_serializing_if = "Option::is_none")]
1237    pub conversation_tokens: Option<i64>,
1238    /// Current number of tokens in the context window
1239    pub current_tokens: i64,
1240    /// Whether this is the first usage_info event emitted in this session
1241    #[serde(skip_serializing_if = "Option::is_none")]
1242    pub is_initial: Option<bool>,
1243    /// Current number of messages in the conversation
1244    pub messages_length: i64,
1245    /// Token count from system message(s)
1246    #[serde(skip_serializing_if = "Option::is_none")]
1247    pub system_tokens: Option<i64>,
1248    /// Maximum token count for the model's context window
1249    pub token_limit: i64,
1250    /// Token count from tool definitions
1251    #[serde(skip_serializing_if = "Option::is_none")]
1252    pub tool_definitions_tokens: Option<i64>,
1253}
1254
1255/// Session event "session.compaction_start". Context window breakdown at the start of LLM-powered conversation compaction
1256#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1257#[serde(rename_all = "camelCase")]
1258pub struct SessionCompactionStartData {
1259    /// Token count from non-system messages (user, assistant, tool) at compaction start
1260    #[serde(skip_serializing_if = "Option::is_none")]
1261    pub conversation_tokens: Option<i64>,
1262    /// Model identifier used for compaction, when known
1263    #[serde(skip_serializing_if = "Option::is_none")]
1264    pub model: Option<String>,
1265    /// Token count from system message(s) at compaction start
1266    #[serde(skip_serializing_if = "Option::is_none")]
1267    pub system_tokens: Option<i64>,
1268    /// Token count from tool definitions at compaction start
1269    #[serde(skip_serializing_if = "Option::is_none")]
1270    pub tool_definitions_tokens: Option<i64>,
1271}
1272
1273/// Token usage detail for a single billing category
1274#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1275#[serde(rename_all = "camelCase")]
1276pub struct CompactionCompleteCompactionTokensUsedCopilotUsageTokenDetail {
1277    /// Number of tokens in this billing batch
1278    pub batch_size: i64,
1279    /// Cost per batch of tokens
1280    pub cost_per_batch: i64,
1281    /// Total token count for this entry
1282    pub token_count: i64,
1283    /// Token category (e.g., "input", "output")
1284    pub token_type: String,
1285}
1286
1287/// Per-request cost and usage data from the CAPI copilot_usage response field
1288#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1289#[serde(rename_all = "camelCase")]
1290pub(crate) struct CompactionCompleteCompactionTokensUsedCopilotUsage {
1291    /// Itemized token usage breakdown
1292    #[doc(hidden)]
1293    #[serde(skip_serializing_if = "Option::is_none")]
1294    pub(crate) token_details:
1295        Option<Vec<CompactionCompleteCompactionTokensUsedCopilotUsageTokenDetail>>,
1296    /// Total cost in nano-AI units for this request
1297    pub total_nano_aiu: f64,
1298}
1299
1300/// Token usage breakdown for the compaction LLM call (aligned with assistant.usage format)
1301#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1302#[serde(rename_all = "camelCase")]
1303pub struct CompactionCompleteCompactionTokensUsed {
1304    /// Cached input tokens reused in the compaction LLM call
1305    #[serde(skip_serializing_if = "Option::is_none")]
1306    pub cache_read_tokens: Option<i64>,
1307    /// Tokens written to prompt cache in the compaction LLM call
1308    #[serde(skip_serializing_if = "Option::is_none")]
1309    pub cache_write_tokens: Option<i64>,
1310    /// Per-request cost and usage data from the CAPI copilot_usage response field
1311    #[doc(hidden)]
1312    #[serde(skip_serializing_if = "Option::is_none")]
1313    pub(crate) copilot_usage: Option<CompactionCompleteCompactionTokensUsedCopilotUsage>,
1314    /// Duration of the compaction LLM call in milliseconds
1315    #[serde(skip_serializing_if = "Option::is_none")]
1316    pub duration: Option<i64>,
1317    /// Input tokens consumed by the compaction LLM call
1318    #[serde(skip_serializing_if = "Option::is_none")]
1319    pub input_tokens: Option<i64>,
1320    /// Model identifier used for the compaction LLM call
1321    #[serde(skip_serializing_if = "Option::is_none")]
1322    pub model: Option<String>,
1323    /// Output tokens produced by the compaction LLM call
1324    #[serde(skip_serializing_if = "Option::is_none")]
1325    pub output_tokens: Option<i64>,
1326}
1327
1328/// Session event "session.compaction_complete". Conversation compaction results including success status, metrics, and optional error details
1329#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1330#[serde(rename_all = "camelCase")]
1331pub struct SessionCompactionCompleteData {
1332    /// Checkpoint snapshot number created for recovery
1333    #[serde(skip_serializing_if = "Option::is_none")]
1334    pub checkpoint_number: Option<i64>,
1335    /// File path where the checkpoint was stored
1336    #[serde(skip_serializing_if = "Option::is_none")]
1337    pub checkpoint_path: Option<String>,
1338    /// Token usage breakdown for the compaction LLM call (aligned with assistant.usage format)
1339    #[serde(skip_serializing_if = "Option::is_none")]
1340    pub compaction_tokens_used: Option<CompactionCompleteCompactionTokensUsed>,
1341    /// Token count from non-system messages (user, assistant, tool) after compaction
1342    #[serde(skip_serializing_if = "Option::is_none")]
1343    pub conversation_tokens: Option<i64>,
1344    /// User-supplied focus instructions provided to a manual `/compact` invocation. Omitted for automatic compaction and for manual compaction with no focus text.
1345    #[serde(skip_serializing_if = "Option::is_none")]
1346    pub custom_instructions: Option<String>,
1347    /// Error message if compaction failed
1348    #[serde(skip_serializing_if = "Option::is_none")]
1349    pub error: Option<String>,
1350    /// Number of messages removed during compaction
1351    #[serde(skip_serializing_if = "Option::is_none")]
1352    pub messages_removed: Option<i64>,
1353    /// Total tokens in conversation after compaction
1354    #[serde(skip_serializing_if = "Option::is_none")]
1355    pub post_compaction_tokens: Option<i64>,
1356    /// Number of messages before compaction
1357    #[serde(skip_serializing_if = "Option::is_none")]
1358    pub pre_compaction_messages_length: Option<i64>,
1359    /// Total tokens in conversation before compaction
1360    #[serde(skip_serializing_if = "Option::is_none")]
1361    pub pre_compaction_tokens: Option<i64>,
1362    /// GitHub request tracing ID (x-github-request-id header) for the compaction LLM call
1363    #[serde(skip_serializing_if = "Option::is_none")]
1364    pub request_id: Option<RequestId>,
1365    /// Copilot service request ID (x-copilot-service-request-id header) for the compaction LLM call
1366    #[serde(skip_serializing_if = "Option::is_none")]
1367    pub service_request_id: Option<String>,
1368    /// For failed compaction only: the HTTP status code of the compaction LLM call failure, when it carried one. Absent for successful compaction and for failures without an HTTP status (e.g. an empty model response or a transport error).
1369    #[serde(skip_serializing_if = "Option::is_none")]
1370    pub status_code: Option<i64>,
1371    /// Whether compaction completed successfully
1372    pub success: bool,
1373    /// LLM-generated summary of the compacted conversation history
1374    #[serde(skip_serializing_if = "Option::is_none")]
1375    pub summary_content: Option<String>,
1376    /// Token count from system message(s) after compaction
1377    #[serde(skip_serializing_if = "Option::is_none")]
1378    pub system_tokens: Option<i64>,
1379    /// Number of tokens removed during compaction
1380    #[serde(skip_serializing_if = "Option::is_none")]
1381    pub tokens_removed: Option<i64>,
1382    /// Token count from tool definitions after compaction
1383    #[serde(skip_serializing_if = "Option::is_none")]
1384    pub tool_definitions_tokens: Option<i64>,
1385}
1386
1387/// Session event "session.task_complete". Task completion notification with summary from the agent
1388#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1389#[serde(rename_all = "camelCase")]
1390pub struct SessionTaskCompleteData {
1391    /// Whether the tool call succeeded. False when validation failed (e.g., invalid arguments)
1392    #[serde(skip_serializing_if = "Option::is_none")]
1393    pub success: Option<bool>,
1394    /// Summary of the completed task, provided by the agent
1395    #[serde(skip_serializing_if = "Option::is_none")]
1396    pub summary: Option<String>,
1397}
1398
1399/// Session event "user.message". Payload of `user.message` with displayed and model-transformed content, attachments, source/delivery metadata, mode, and telemetry IDs.
1400#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1401#[serde(rename_all = "camelCase")]
1402pub struct UserMessageData {
1403    /// The agent mode that was active when this message was sent
1404    #[serde(skip_serializing_if = "Option::is_none")]
1405    pub agent_mode: Option<UserMessageAgentMode>,
1406    /// Files, selections, or GitHub references attached to the message
1407    #[serde(skip_serializing_if = "Option::is_none")]
1408    pub attachments: Option<Vec<serde_json::Value>>,
1409    /// The user's message text as displayed in the timeline
1410    pub content: String,
1411    /// How this message was delivered to the agentic loop relative to loop state (idle-start vs. steering/queued while busy). The timing axis; combine with `source` (origin) for the full picture. Used for telemetry attribution.
1412    #[serde(skip_serializing_if = "Option::is_none")]
1413    pub delivery: Option<UserMessageDelivery>,
1414    /// CAPI interaction ID for correlating this user message with its turn
1415    #[serde(skip_serializing_if = "Option::is_none")]
1416    pub interaction_id: Option<String>,
1417    /// 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.
1418    #[serde(skip_serializing_if = "Option::is_none")]
1419    pub is_autopilot_continuation: Option<bool>,
1420    /// 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
1421    #[serde(skip_serializing_if = "Option::is_none")]
1422    pub native_document_path_fallback_paths: Option<Vec<String>>,
1423    /// Parent agent task ID for background telemetry correlated to this user turn
1424    #[serde(skip_serializing_if = "Option::is_none")]
1425    pub parent_agent_task_id: Option<String>,
1426    /// Origin of this message, used for timeline filtering (e.g., "skill-pdf" for skill-injected messages that should be hidden from the user)
1427    #[serde(skip_serializing_if = "Option::is_none")]
1428    pub source: Option<String>,
1429    /// Normalized document MIME types that were sent natively instead of through tagged_files XML
1430    #[serde(skip_serializing_if = "Option::is_none")]
1431    pub supported_native_document_mime_types: Option<Vec<String>>,
1432    /// Transformed version of the message sent to the model, with XML wrapping, timestamps, and other augmentations for prompt caching
1433    #[serde(skip_serializing_if = "Option::is_none")]
1434    pub transformed_content: Option<String>,
1435}
1436
1437/// Session event "pending_messages.modified". Empty payload; the event signals that the pending message queue has changed
1438#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1439#[serde(rename_all = "camelCase")]
1440pub struct PendingMessagesModifiedData {}
1441
1442/// Session event "assistant.turn_start". Turn initialization metadata including identifier and interaction tracking
1443#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1444#[serde(rename_all = "camelCase")]
1445pub struct AssistantTurnStartData {
1446    /// CAPI interaction ID for correlating this turn with upstream telemetry
1447    #[serde(skip_serializing_if = "Option::is_none")]
1448    pub interaction_id: Option<String>,
1449    /// Model identifier used for this turn, when known
1450    #[serde(skip_serializing_if = "Option::is_none")]
1451    pub model: Option<String>,
1452    /// Identifier for this turn within the agentic loop, typically a stringified turn number
1453    pub turn_id: String,
1454}
1455
1456/// Session event "assistant.intent". Agent intent description for current activity or plan
1457#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1458#[serde(rename_all = "camelCase")]
1459pub struct AssistantIntentData {
1460    /// Short description of what the agent is currently doing or planning to do
1461    pub intent: String,
1462}
1463
1464/// Session event "assistant.reasoning". Assistant reasoning content for timeline display with complete thinking text
1465#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1466#[serde(rename_all = "camelCase")]
1467pub struct AssistantReasoningData {
1468    /// The complete extended thinking text from the model
1469    pub content: String,
1470    /// Unique identifier for this reasoning block
1471    pub reasoning_id: String,
1472}
1473
1474/// Session event "assistant.reasoning_delta". Streaming reasoning delta for incremental extended thinking updates
1475#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1476#[serde(rename_all = "camelCase")]
1477pub struct AssistantReasoningDeltaData {
1478    /// Incremental text chunk to append to the reasoning content
1479    pub delta_content: String,
1480    /// Reasoning block ID this delta belongs to, matching the corresponding assistant.reasoning event
1481    pub reasoning_id: String,
1482}
1483
1484/// Session event "assistant.tool_call_delta". Streaming tool-call input delta for incremental tool-call updates
1485#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1486#[serde(rename_all = "camelCase")]
1487pub struct AssistantToolCallDeltaData {
1488    /// Raw provider tool input fragment to append for this tool call. Function/tool-use providers stream serialized JSON argument text (so newlines inside JSON string values may appear as escaped `\n` until the accumulated JSON is parsed); custom tool calls stream raw custom input.
1489    pub input_delta: String,
1490    /// Tool call ID this delta belongs to, matching the corresponding assistant.message tool request
1491    pub tool_call_id: String,
1492    /// Name of the tool being invoked, when known from the stream
1493    #[serde(skip_serializing_if = "Option::is_none")]
1494    pub tool_name: Option<String>,
1495    /// Tool call type, when known from the stream
1496    #[serde(skip_serializing_if = "Option::is_none")]
1497    pub tool_type: Option<AssistantMessageToolRequestType>,
1498}
1499
1500/// Session event "assistant.streaming_delta". Streaming response progress with cumulative byte count
1501#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1502#[serde(rename_all = "camelCase")]
1503pub struct AssistantStreamingDeltaData {
1504    /// Cumulative total bytes received from the streaming response so far
1505    pub total_response_size_bytes: i64,
1506}
1507
1508/// A source that backs one or more cited spans in the assistant's response.
1509///
1510/// <div class="warning">
1511///
1512/// **Experimental.** This type is part of an experimental wire-protocol surface
1513/// and may change or be removed in future SDK or CLI releases.
1514///
1515/// </div>
1516#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1517#[serde(rename_all = "camelCase")]
1518pub struct CitationSource {
1519    /// Stable, turn-scoped identifier for this source, referenced by CitationReference.sourceId.
1520    pub id: String,
1521    /// File path relative to the agent's workspace root, when the source is a file.
1522    #[serde(skip_serializing_if = "Option::is_none")]
1523    pub path: Option<String>,
1524    /// The system that produced this citation.
1525    pub provider: CitationProvider,
1526    /// Human-readable title of the source.
1527    #[serde(skip_serializing_if = "Option::is_none")]
1528    pub title: Option<String>,
1529    /// URL of the source, when it is a web resource.
1530    #[serde(skip_serializing_if = "Option::is_none")]
1531    pub url: Option<String>,
1532}
1533
1534/// A single citation occurrence linking a span of generated text to a supporting source.
1535///
1536/// <div class="warning">
1537///
1538/// **Experimental.** This type is part of an experimental wire-protocol surface
1539/// and may change or be removed in future SDK or CLI releases.
1540///
1541/// </div>
1542#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1543#[serde(rename_all = "camelCase")]
1544pub struct CitationReference {
1545    /// The exact text from the source that supports the cited span, when provided by the model.
1546    #[serde(skip_serializing_if = "Option::is_none")]
1547    pub cited_text: Option<String>,
1548    /// Location within the source that supports the cited span, when the provider reports one.
1549    #[serde(skip_serializing_if = "Option::is_none")]
1550    pub location: Option<serde_json::Value>,
1551    /// Provider-native citation correlation data (e.g. Anthropic search_result_index / document_index), passed through opaquely for debugging and forward compatibility.
1552    #[serde(skip_serializing_if = "Option::is_none")]
1553    pub provider_metadata: Option<serde_json::Value>,
1554    /// Identifier of the CitationSource this reference points to (CitationSource.id).
1555    pub source_id: String,
1556}
1557
1558/// A contiguous span of generated assistant text and the source references that support it.
1559///
1560/// <div class="warning">
1561///
1562/// **Experimental.** This type is part of an experimental wire-protocol surface
1563/// and may change or be removed in future SDK or CLI releases.
1564///
1565/// </div>
1566#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1567#[serde(rename_all = "camelCase")]
1568pub struct CitationSpan {
1569    /// End offset of the cited span within the final assistant message content (UTF-16 code units, zero-based, exclusive).
1570    pub end_index: i64,
1571    /// The sources that support this span of generated text.
1572    pub references: Vec<CitationReference>,
1573    /// Start offset of the cited span within the final assistant message content (UTF-16 code units, zero-based, inclusive).
1574    pub start_index: i64,
1575}
1576
1577/// Provider-agnostic citations linking spans of the assistant's response to their supporting sources.
1578///
1579/// <div class="warning">
1580///
1581/// **Experimental.** This type is part of an experimental wire-protocol surface
1582/// and may change or be removed in future SDK or CLI releases.
1583///
1584/// </div>
1585#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1586#[serde(rename_all = "camelCase")]
1587pub struct Citations {
1588    /// Deduplicated set of sources referenced by the citation spans.
1589    pub sources: Vec<CitationSource>,
1590    /// Spans of generated text annotated with the sources that support them.
1591    pub spans: Vec<CitationSpan>,
1592}
1593
1594/// Neutral provider-tagged server-side tool-use payload (tool search, advisor) for verbatim round-tripping
1595///
1596/// <div class="warning">
1597///
1598/// **Experimental.** This type is part of an experimental wire-protocol surface
1599/// and may change or be removed in future SDK or CLI releases.
1600///
1601/// </div>
1602#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1603#[serde(rename_all = "camelCase")]
1604pub struct AssistantMessageServerTools {
1605    #[serde(skip_serializing_if = "Option::is_none")]
1606    pub advisor_model: Option<String>,
1607    #[serde(skip_serializing_if = "Option::is_none")]
1608    pub function_call_namespaces: Option<HashMap<String, String>>,
1609    #[serde(skip_serializing_if = "Option::is_none")]
1610    pub items: Option<Vec<serde_json::Value>>,
1611    pub provider: String,
1612    #[serde(skip_serializing_if = "Option::is_none")]
1613    pub raw_content_blocks: Option<Vec<serde_json::Value>>,
1614}
1615
1616/// A tool invocation request from the assistant
1617#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1618#[serde(rename_all = "camelCase")]
1619pub struct AssistantMessageToolRequest {
1620    /// Arguments to pass to the tool, format depends on the tool
1621    #[serde(skip_serializing_if = "Option::is_none")]
1622    pub arguments: Option<serde_json::Value>,
1623    /// Resolved intention summary describing what this specific call does
1624    #[serde(skip_serializing_if = "Option::is_none")]
1625    pub intention_summary: Option<String>,
1626    /// Name of the MCP server hosting this tool, when the tool is an MCP tool
1627    #[serde(skip_serializing_if = "Option::is_none")]
1628    pub mcp_server_name: Option<String>,
1629    /// Original tool name on the MCP server, when the tool is an MCP tool
1630    #[serde(skip_serializing_if = "Option::is_none")]
1631    pub mcp_tool_name: Option<String>,
1632    /// Name of the tool being invoked
1633    pub name: String,
1634    /// Unique identifier for this tool call
1635    pub tool_call_id: String,
1636    /// Human-readable display title for the tool
1637    #[serde(skip_serializing_if = "Option::is_none")]
1638    pub tool_title: Option<String>,
1639    /// Tool call type: "function" for standard tool calls, "custom" for grammar-based tool calls. Defaults to "function" when absent.
1640    #[serde(skip_serializing_if = "Option::is_none")]
1641    pub r#type: Option<AssistantMessageToolRequestType>,
1642}
1643
1644/// Session event "assistant.message". Assistant response containing text content, optional tool requests, and interaction metadata
1645#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1646#[serde(rename_all = "camelCase")]
1647pub struct AssistantMessageData {
1648    /// Provider's completion / response identifier; shared across all chunks of a single API call. Used to group multi-chunk assistant utterances.
1649    #[serde(skip_serializing_if = "Option::is_none")]
1650    pub api_call_id: Option<String>,
1651    /// Provider-agnostic citations linking spans of this message's content to the sources that support them. Experimental; only populated when citation emission is enabled.
1652    ///
1653    /// <div class="warning">
1654    ///
1655    /// **Experimental.** This type is part of an experimental wire-protocol surface
1656    /// and may change or be removed in future SDK or CLI releases.
1657    ///
1658    /// </div>
1659    #[serde(skip_serializing_if = "Option::is_none")]
1660    pub citations: Option<Citations>,
1661    /// Client-minted request id (x-request-id header) echoed by the server. Distinct from requestId (x-github-request-id) and serviceRequestId (x-copilot-service-request-id).
1662    #[serde(skip_serializing_if = "Option::is_none")]
1663    pub client_request_id: Option<String>,
1664    /// The assistant's text response content
1665    pub content: String,
1666    /// Encrypted reasoning content from OpenAI models. Session-bound and stripped on resume.
1667    #[serde(skip_serializing_if = "Option::is_none")]
1668    pub encrypted_content: Option<String>,
1669    /// CAPI interaction ID for correlating this message with upstream telemetry
1670    #[serde(skip_serializing_if = "Option::is_none")]
1671    pub interaction_id: Option<String>,
1672    /// Unique identifier for this assistant message
1673    pub message_id: String,
1674    /// Model that produced this assistant message, if known
1675    #[serde(skip_serializing_if = "Option::is_none")]
1676    pub model: Option<String>,
1677    /// Actual output token count from the API response (completion_tokens), used for accurate token accounting
1678    #[serde(skip_serializing_if = "Option::is_none")]
1679    pub output_tokens: Option<i64>,
1680    /// Tool call ID of the parent tool invocation when this event originates from a sub-agent
1681    #[doc(hidden)]
1682    #[deprecated]
1683    #[serde(skip_serializing_if = "Option::is_none")]
1684    pub parent_tool_call_id: Option<String>,
1685    /// Generation phase for phased-output models (e.g., thinking vs. response phases)
1686    #[serde(skip_serializing_if = "Option::is_none")]
1687    pub phase: Option<String>,
1688    /// Opaque/encrypted extended thinking data from Anthropic models. Session-bound and stripped on resume.
1689    #[serde(skip_serializing_if = "Option::is_none")]
1690    pub reasoning_opaque: Option<String>,
1691    /// Readable reasoning text from the model's extended thinking
1692    #[serde(skip_serializing_if = "Option::is_none")]
1693    pub reasoning_text: Option<String>,
1694    /// OpenAI-compatible wire field the provider used for reasoning (e.g. reasoning_content/reasoning). Populated only when non-canonical, so the dialect round-trips across turns.
1695    #[serde(skip_serializing_if = "Option::is_none")]
1696    pub reasoning_wire_field: Option<String>,
1697    /// GitHub request tracing ID (x-github-request-id header) for correlating with server-side logs
1698    #[serde(skip_serializing_if = "Option::is_none")]
1699    pub request_id: Option<RequestId>,
1700    /// Neutral provider-tagged server-side tool-use payload (tool search, advisor) for verbatim round-tripping
1701    #[serde(skip_serializing_if = "Option::is_none")]
1702    pub server_tools: Option<AssistantMessageServerTools>,
1703    /// Copilot service request ID (x-copilot-service-request-id header) for CAPI log correlation
1704    #[serde(skip_serializing_if = "Option::is_none")]
1705    pub service_request_id: Option<String>,
1706    /// Tool invocations requested by the assistant in this message
1707    #[serde(skip_serializing_if = "Option::is_none")]
1708    pub tool_requests: Option<Vec<AssistantMessageToolRequest>>,
1709    /// Identifier for the agent loop turn that produced this message, matching the corresponding assistant.turn_start event
1710    #[serde(skip_serializing_if = "Option::is_none")]
1711    pub turn_id: Option<String>,
1712}
1713
1714/// Session event "assistant.message_start". Streaming assistant message start metadata
1715#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1716#[serde(rename_all = "camelCase")]
1717pub struct AssistantMessageStartData {
1718    /// Message ID this start event belongs to, matching subsequent deltas and assistant.message
1719    pub message_id: String,
1720    /// Generation phase this message belongs to for phased-output models
1721    #[serde(skip_serializing_if = "Option::is_none")]
1722    pub phase: Option<String>,
1723}
1724
1725/// Session event "assistant.message_delta". Streaming assistant message delta for incremental response updates
1726#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1727#[serde(rename_all = "camelCase")]
1728pub struct AssistantMessageDeltaData {
1729    /// Incremental text chunk to append to the message content
1730    pub delta_content: String,
1731    /// Message ID this delta belongs to, matching the corresponding assistant.message event
1732    pub message_id: String,
1733    /// Tool call ID of the parent tool invocation when this event originates from a sub-agent
1734    #[doc(hidden)]
1735    #[deprecated]
1736    #[serde(skip_serializing_if = "Option::is_none")]
1737    pub parent_tool_call_id: Option<String>,
1738}
1739
1740/// Session event "assistant.turn_end". Turn completion metadata including the turn identifier
1741#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1742#[serde(rename_all = "camelCase")]
1743pub struct AssistantTurnEndData {
1744    /// Model identifier used for this turn, when known
1745    #[serde(skip_serializing_if = "Option::is_none")]
1746    pub model: Option<String>,
1747    /// Identifier of the turn that has ended, matching the corresponding assistant.turn_start event
1748    pub turn_id: String,
1749}
1750
1751/// Session event "assistant.idle". Payload emitted whenever the main agent's processing loop goes idle, including while related background work (running agents or in-flight attached shell commands) is still pending and the session-level idle event is therefore deferred
1752#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1753#[serde(rename_all = "camelCase")]
1754pub struct AssistantIdleData {
1755    /// True when the preceding agentic loop was cancelled via abort signal
1756    #[serde(skip_serializing_if = "Option::is_none")]
1757    pub aborted: Option<bool>,
1758}
1759
1760/// Token usage detail for a single billing category
1761#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1762#[serde(rename_all = "camelCase")]
1763pub struct AssistantUsageCopilotUsageTokenDetail {
1764    /// Number of tokens in this billing batch
1765    pub batch_size: i64,
1766    /// Cost per batch of tokens
1767    pub cost_per_batch: i64,
1768    /// Total token count for this entry
1769    pub token_count: i64,
1770    /// Token category (e.g., "input", "output")
1771    pub token_type: String,
1772}
1773
1774/// Per-request cost and usage data from the CAPI copilot_usage response field
1775#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1776#[serde(rename_all = "camelCase")]
1777pub struct AssistantUsageCopilotUsage {
1778    /// Itemized token usage breakdown
1779    #[doc(hidden)]
1780    #[serde(skip_serializing_if = "Option::is_none")]
1781    pub(crate) token_details: Option<Vec<AssistantUsageCopilotUsageTokenDetail>>,
1782    /// Total cost in nano-AI units for this request
1783    pub total_nano_aiu: f64,
1784}
1785
1786/// Internal per-quota snapshot for assistant usage, including entitlement, consumed requests, overage, reset date, and remaining quota.
1787#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1788#[serde(rename_all = "camelCase")]
1789pub(crate) struct AssistantUsageQuotaSnapshot {
1790    /// Total requests allowed by the entitlement
1791    #[doc(hidden)]
1792    pub(crate) entitlement_requests: i64,
1793    /// Whether the user currently has quota available for use
1794    #[doc(hidden)]
1795    #[serde(skip_serializing_if = "Option::is_none")]
1796    pub(crate) has_quota: Option<bool>,
1797    /// Whether the user has an unlimited usage entitlement
1798    #[doc(hidden)]
1799    pub(crate) is_unlimited_entitlement: bool,
1800    /// Number of additional usage requests made this period
1801    #[doc(hidden)]
1802    pub(crate) overage: f64,
1803    /// Whether additional usage is allowed when quota is exhausted
1804    #[doc(hidden)]
1805    pub(crate) overage_allowed_with_exhausted_quota: bool,
1806    /// Pay-as-you-go additional-usage budget cap in AI credits (1 credit = $0.01); present only when CAPI emits a finite value
1807    #[doc(hidden)]
1808    #[serde(skip_serializing_if = "Option::is_none")]
1809    pub(crate) overage_entitlement: Option<f64>,
1810    /// Percentage of quota remaining (0 to 100)
1811    #[doc(hidden)]
1812    pub(crate) remaining_percentage: f64,
1813    /// Date when the quota resets
1814    #[doc(hidden)]
1815    #[serde(skip_serializing_if = "Option::is_none")]
1816    pub(crate) reset_date: Option<String>,
1817    /// Whether this snapshot uses token-based billing (AI-credits allocation)
1818    #[doc(hidden)]
1819    #[serde(skip_serializing_if = "Option::is_none")]
1820    pub(crate) token_based_billing: Option<bool>,
1821    /// Whether usage is still permitted after quota exhaustion
1822    #[doc(hidden)]
1823    pub(crate) usage_allowed_with_exhausted_quota: bool,
1824    /// Number of requests already consumed
1825    #[doc(hidden)]
1826    pub(crate) used_requests: i64,
1827}
1828
1829/// Session event "assistant.usage". LLM API call usage metrics including tokens, costs, quotas, and billing information
1830#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1831#[serde(rename_all = "camelCase")]
1832pub struct AssistantUsageData {
1833    /// Completion ID from the model provider (e.g., chatcmpl-abc123)
1834    #[serde(skip_serializing_if = "Option::is_none")]
1835    pub api_call_id: Option<String>,
1836    /// API endpoint used for this model call, matching CAPI supported_endpoints vocabulary
1837    #[serde(skip_serializing_if = "Option::is_none")]
1838    pub api_endpoint: Option<AssistantUsageApiEndpoint>,
1839    /// Number of tokens read from prompt cache
1840    #[serde(skip_serializing_if = "Option::is_none")]
1841    pub cache_read_tokens: Option<i64>,
1842    /// Number of tokens written to prompt cache
1843    #[serde(skip_serializing_if = "Option::is_none")]
1844    pub cache_write_tokens: Option<i64>,
1845    /// Whether the model response was blocked or truncated by content filtering (finish_reason === 'content_filter'). For Anthropic models this corresponds to a 'refusal' stop reason.
1846    #[serde(skip_serializing_if = "Option::is_none")]
1847    pub content_filter_triggered: Option<bool>,
1848    /// Per-request cost and usage data from the CAPI copilot_usage response field
1849    #[serde(skip_serializing_if = "Option::is_none")]
1850    pub copilot_usage: Option<AssistantUsageCopilotUsage>,
1851    /// Model multiplier cost for billing purposes
1852    ///
1853    /// <div class="warning">
1854    ///
1855    /// **Experimental.** This type is part of an experimental wire-protocol surface
1856    /// and may change or be removed in future SDK or CLI releases.
1857    ///
1858    /// </div>
1859    #[serde(skip_serializing_if = "Option::is_none")]
1860    pub cost: Option<f64>,
1861    /// Duration of the API call in milliseconds
1862    #[serde(skip_serializing_if = "Option::is_none")]
1863    pub duration: Option<i64>,
1864    /// Finish reason reported by the model for this API call (e.g. "stop", "length", "tool_calls", "content_filter"). Normalized to OpenAI vocabulary; for Anthropic models a "refusal" stop reason maps to "content_filter".
1865    #[serde(skip_serializing_if = "Option::is_none")]
1866    pub finish_reason: Option<String>,
1867    /// What initiated this API call (e.g., "sub-agent", "mcp-sampling"); absent for user-initiated calls
1868    #[serde(skip_serializing_if = "Option::is_none")]
1869    pub initiator: Option<String>,
1870    /// Number of input tokens consumed
1871    #[serde(skip_serializing_if = "Option::is_none")]
1872    pub input_tokens: Option<i64>,
1873    /// Average inter-token latency in milliseconds. Only available for streaming requests
1874    #[serde(skip_serializing_if = "Option::is_none")]
1875    pub inter_token_latency_ms: Option<f64>,
1876    /// Model identifier used for this API call
1877    pub model: String,
1878    /// Number of output tokens produced
1879    #[serde(skip_serializing_if = "Option::is_none")]
1880    pub output_tokens: Option<i64>,
1881    /// Parent tool call ID when this usage originates from a sub-agent
1882    #[doc(hidden)]
1883    #[deprecated]
1884    #[serde(skip_serializing_if = "Option::is_none")]
1885    pub parent_tool_call_id: Option<String>,
1886    /// GitHub request tracing ID (x-github-request-id header) for server-side log correlation
1887    #[serde(skip_serializing_if = "Option::is_none")]
1888    pub provider_call_id: Option<String>,
1889    /// Per-quota resource usage snapshots, keyed by quota identifier
1890    #[doc(hidden)]
1891    #[serde(skip_serializing_if = "Option::is_none")]
1892    pub(crate) quota_snapshots: Option<HashMap<String, AssistantUsageQuotaSnapshot>>,
1893    /// Reasoning effort level used for model calls, if applicable (e.g. "none", "low", "medium", "high", "xhigh", "max")
1894    #[serde(skip_serializing_if = "Option::is_none")]
1895    pub reasoning_effort: Option<String>,
1896    /// Number of output tokens used for reasoning (e.g., chain-of-thought)
1897    #[serde(skip_serializing_if = "Option::is_none")]
1898    pub reasoning_tokens: Option<i64>,
1899    /// Copilot service request ID (x-copilot-service-request-id header) for CAPI log correlation
1900    #[serde(skip_serializing_if = "Option::is_none")]
1901    pub service_request_id: Option<String>,
1902    /// Time to first token in milliseconds. Only available for streaming requests
1903    #[serde(skip_serializing_if = "Option::is_none")]
1904    pub time_to_first_token_ms: Option<f64>,
1905}
1906
1907/// Content-free structural summary of the failing request for diagnosing malformed 4xx calls
1908#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1909#[serde(rename_all = "camelCase")]
1910pub struct ModelCallFailureRequestFingerprint {
1911    /// Total number of image content parts
1912    pub image_part_count: i64,
1913    /// Image parts whose media type cannot be determined (rejected by strict providers)
1914    pub image_parts_missing_media_type: i64,
1915    /// Role of the final message in the request
1916    #[serde(skip_serializing_if = "Option::is_none")]
1917    pub last_message_role: Option<String>,
1918    /// Total number of messages in the request
1919    pub message_count: i64,
1920    /// Tool calls whose name is missing or empty (rejected by strict providers)
1921    pub nameless_tool_call_count: i64,
1922    /// Total number of tool calls across assistant messages
1923    pub tool_call_count: i64,
1924    /// Number of "tool" result messages in the request
1925    pub tool_result_message_count: i64,
1926}
1927
1928/// Session event "model.call_failure". Failed LLM API call metadata for telemetry
1929#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1930#[serde(rename_all = "camelCase")]
1931pub struct ModelCallFailureData {
1932    /// Completion ID from the model provider (e.g., chatcmpl-abc123)
1933    #[serde(skip_serializing_if = "Option::is_none")]
1934    pub api_call_id: Option<String>,
1935    /// For HTTP 400 failures only: whether the response carried a structured CAPI error envelope (structured_error, a deterministic validation failure) or no error body (bodyless, the transient gateway/proxy signature). Absent for non-400 failures.
1936    #[serde(skip_serializing_if = "Option::is_none")]
1937    pub bad_request_kind: Option<ModelCallFailureBadRequestKind>,
1938    /// Duration of the failed API call in milliseconds
1939    #[serde(skip_serializing_if = "Option::is_none")]
1940    pub duration_ms: Option<i64>,
1941    /// For HTTP 400 failures only: the `code` from the CAPI error envelope (e.g. 'model_max_prompt_tokens_exceeded') identifying which deterministic validation failure occurred. Raw server-controlled string, emitted only through restricted telemetry. Absent for bodyless or non-400 failures.
1942    #[serde(skip_serializing_if = "Option::is_none")]
1943    pub error_code: Option<String>,
1944    /// Raw provider/runtime error message for restricted telemetry
1945    #[serde(skip_serializing_if = "Option::is_none")]
1946    pub error_message: Option<String>,
1947    /// For HTTP 400 failures only: the `type` from the CAPI error envelope (e.g. 'websocket_error'), a coarser companion to errorCode for envelopes that carry no code. Raw server-controlled string, emitted only through restricted telemetry. Absent for bodyless or non-400 failures.
1948    #[serde(skip_serializing_if = "Option::is_none")]
1949    pub error_type: Option<String>,
1950    /// What initiated this API call (e.g., "sub-agent", "mcp-sampling"); absent for user-initiated calls
1951    #[serde(skip_serializing_if = "Option::is_none")]
1952    pub initiator: Option<String>,
1953    /// Model identifier used for the failed API call
1954    #[serde(skip_serializing_if = "Option::is_none")]
1955    pub model: Option<String>,
1956    /// GitHub request tracing ID (x-github-request-id header) for server-side log correlation
1957    #[serde(skip_serializing_if = "Option::is_none")]
1958    pub provider_call_id: Option<String>,
1959    /// Per-quota usage snapshots parsed from the failed response's quota headers, keyed by quota identifier. Present when the error response carried quota headers (e.g. a 402 once the additional spend limit is reached) so the UI can refresh the quota display on failure.
1960    #[doc(hidden)]
1961    #[serde(skip_serializing_if = "Option::is_none")]
1962    pub(crate) quota_snapshots: Option<HashMap<String, AssistantUsageQuotaSnapshot>>,
1963    /// Content-free structural summary of the failing request. Contains only counts and shape flags (no prompt content), so it is safe for unrestricted telemetry. Populated only for client-error (4xx) failures.
1964    #[serde(skip_serializing_if = "Option::is_none")]
1965    pub request_fingerprint: Option<ModelCallFailureRequestFingerprint>,
1966    /// Copilot service request ID (x-copilot-service-request-id header) for CAPI log correlation
1967    #[serde(skip_serializing_if = "Option::is_none")]
1968    pub service_request_id: Option<String>,
1969    /// Where the failed model call originated
1970    pub source: ModelCallFailureSource,
1971    /// HTTP status code from the failed request
1972    #[serde(skip_serializing_if = "Option::is_none")]
1973    pub status_code: Option<i32>,
1974}
1975
1976/// Session event "abort". Turn abort information including the reason for termination
1977#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1978#[serde(rename_all = "camelCase")]
1979pub struct AbortData {
1980    /// Finite reason code describing why the current turn was aborted
1981    pub reason: AbortReason,
1982}
1983
1984/// Session event "tool.user_requested". User-initiated tool invocation request with tool name and arguments
1985#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1986#[serde(rename_all = "camelCase")]
1987pub struct ToolUserRequestedData {
1988    /// Arguments for the tool invocation
1989    #[serde(skip_serializing_if = "Option::is_none")]
1990    pub arguments: Option<serde_json::Value>,
1991    /// Unique identifier for this tool call
1992    pub tool_call_id: String,
1993    /// Name of the tool the user wants to invoke
1994    pub tool_name: String,
1995}
1996
1997/// Shell-aware path hints for a shell tool's command, captured at start time so consumers can snapshot a file's pre-image before the tool runs.
1998#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1999#[serde(rename_all = "camelCase")]
2000pub struct ToolExecutionStartShellToolInfo {
2001    /// Whether the command includes a file write redirection (e.g., > or >>).
2002    pub has_write_file_redirection: bool,
2003    /// File paths the command may read or write, derived from the command at start time. Produced by the same shell-aware extractor as PermissionRequestShell.possiblePaths, so it is present even when the command is auto-approved and no permission request fires.
2004    pub possible_paths: Vec<String>,
2005}
2006
2007/// MCP Apps tool `_meta.ui` resource URI and visibility captured on `tool.execution_start`.
2008#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2009#[serde(rename_all = "camelCase")]
2010pub struct ToolExecutionStartToolDescriptionMetaUI {
2011    /// URI of the UI resource
2012    #[serde(skip_serializing_if = "Option::is_none")]
2013    pub resource_uri: Option<String>,
2014    /// Who can access this tool
2015    #[serde(skip_serializing_if = "Option::is_none")]
2016    pub visibility: Option<Vec<ToolExecutionStartToolDescriptionMetaUIVisibility>>,
2017}
2018
2019/// MCP Apps metadata for UI resource association
2020#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2021#[serde(rename_all = "camelCase")]
2022pub struct ToolExecutionStartToolDescriptionMeta {
2023    /// MCP Apps tool `_meta.ui` resource URI and visibility captured on `tool.execution_start`.
2024    #[serde(skip_serializing_if = "Option::is_none")]
2025    pub ui: Option<ToolExecutionStartToolDescriptionMetaUI>,
2026}
2027
2028/// Tool definition metadata, present for MCP tools with MCP Apps support
2029#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2030#[serde(rename_all = "camelCase")]
2031pub struct ToolExecutionStartToolDescription {
2032    /// MCP Apps metadata for UI resource association
2033    #[serde(rename = "_meta", skip_serializing_if = "Option::is_none")]
2034    pub meta: Option<ToolExecutionStartToolDescriptionMeta>,
2035    /// Tool description
2036    #[serde(skip_serializing_if = "Option::is_none")]
2037    pub description: Option<String>,
2038    /// Tool name
2039    pub name: String,
2040}
2041
2042/// Session event "tool.execution_start". Tool execution startup details including MCP server information when applicable
2043#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2044#[serde(rename_all = "camelCase")]
2045pub struct ToolExecutionStartData {
2046    /// Arguments passed to the tool
2047    #[serde(skip_serializing_if = "Option::is_none")]
2048    pub arguments: Option<serde_json::Value>,
2049    /// When true, the tool output should be displayed expanded (verbatim) in the CLI timeline
2050    #[serde(skip_serializing_if = "Option::is_none")]
2051    pub display_verbatim: Option<bool>,
2052    /// Name of the MCP server hosting this tool, when the tool is an MCP tool
2053    #[serde(skip_serializing_if = "Option::is_none")]
2054    pub mcp_server_name: Option<String>,
2055    /// Original tool name on the MCP server, when the tool is an MCP tool
2056    #[serde(skip_serializing_if = "Option::is_none")]
2057    pub mcp_tool_name: Option<String>,
2058    /// Model identifier that generated this tool call
2059    #[serde(skip_serializing_if = "Option::is_none")]
2060    pub model: Option<String>,
2061    /// Tool call ID of the parent tool invocation when this event originates from a sub-agent
2062    #[doc(hidden)]
2063    #[deprecated]
2064    #[serde(skip_serializing_if = "Option::is_none")]
2065    pub parent_tool_call_id: Option<String>,
2066    /// Shell-tool path hints derived from the command at start time for shell tools (bash/powershell/local_shell). Produced by the same shell-aware extractor as PermissionRequestShell.possiblePaths, so it is present even when the command is auto-approved and no permission request fires. Absent for non-shell tools.
2067    #[serde(skip_serializing_if = "Option::is_none")]
2068    pub shell_tool_info: Option<ToolExecutionStartShellToolInfo>,
2069    /// Unique identifier for this tool call
2070    pub tool_call_id: String,
2071    /// Tool definition metadata, present for MCP tools with MCP Apps support
2072    #[serde(skip_serializing_if = "Option::is_none")]
2073    pub tool_description: Option<ToolExecutionStartToolDescription>,
2074    /// Name of the tool being executed
2075    pub tool_name: String,
2076    /// Identifier for the agent loop turn this tool was invoked in, matching the corresponding assistant.turn_start event
2077    #[serde(skip_serializing_if = "Option::is_none")]
2078    pub turn_id: Option<String>,
2079}
2080
2081/// Session event "tool.execution_partial_result". Streaming tool execution output for incremental result display
2082#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2083#[serde(rename_all = "camelCase")]
2084pub struct ToolExecutionPartialResultData {
2085    /// Incremental output chunk from the running tool
2086    pub partial_output: String,
2087    /// Tool call ID this partial result belongs to
2088    pub tool_call_id: String,
2089}
2090
2091/// Session event "tool.execution_progress". Tool execution progress notification with status message
2092#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2093#[serde(rename_all = "camelCase")]
2094pub struct ToolExecutionProgressData {
2095    /// Human-readable progress status message (e.g., from an MCP server)
2096    pub progress_message: String,
2097    /// Tool call ID this progress notification belongs to
2098    pub tool_call_id: String,
2099}
2100
2101/// Error details when the tool execution failed
2102#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2103#[serde(rename_all = "camelCase")]
2104pub struct ToolExecutionCompleteError {
2105    /// Machine-readable error code
2106    #[serde(skip_serializing_if = "Option::is_none")]
2107    pub code: Option<String>,
2108    /// Human-readable error message
2109    pub message: String,
2110}
2111
2112/// A source supplied by a tool that should be made available to the model as citable content.
2113///
2114/// <div class="warning">
2115///
2116/// **Experimental.** This type is part of an experimental wire-protocol surface
2117/// and may change or be removed in future SDK or CLI releases.
2118///
2119/// </div>
2120#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2121#[serde(rename_all = "camelCase")]
2122pub struct CitableSource {
2123    /// The source text made available to the model as citable content.
2124    pub content: String,
2125    /// Stable identifier for this source within the tool result. Used for deduplication and may be used by future provider integrations to correlate response citations back to the originating source.
2126    pub id: String,
2127    /// File path relative to the agent's workspace root, when the source is a file.
2128    #[serde(skip_serializing_if = "Option::is_none")]
2129    pub path: Option<String>,
2130    /// Human-readable title of the source.
2131    #[serde(skip_serializing_if = "Option::is_none")]
2132    pub title: Option<String>,
2133    /// URL of the source, when it is a web resource.
2134    #[serde(skip_serializing_if = "Option::is_none")]
2135    pub url: Option<String>,
2136}
2137
2138/// Plain text content block
2139#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2140#[serde(rename_all = "camelCase")]
2141pub struct ToolExecutionCompleteContentText {
2142    /// The text content
2143    pub text: String,
2144    /// Content block type discriminator
2145    pub r#type: ToolExecutionCompleteContentTextType,
2146}
2147
2148/// Deprecated for shell command exit metadata. Use ToolExecutionCompleteContentShellExit instead.
2149#[doc(hidden)]
2150#[deprecated]
2151#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2152#[serde(rename_all = "camelCase")]
2153pub struct ToolExecutionCompleteContentTerminal {
2154    /// Working directory where the command was executed
2155    #[serde(skip_serializing_if = "Option::is_none")]
2156    pub cwd: Option<String>,
2157    /// Process exit code, if the command has completed
2158    #[serde(skip_serializing_if = "Option::is_none")]
2159    pub exit_code: Option<i64>,
2160    /// Terminal/shell output text
2161    pub text: String,
2162    /// Content block type discriminator
2163    pub r#type: ToolExecutionCompleteContentTerminalType,
2164}
2165
2166/// Shell command exit metadata with optional output preview
2167#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2168#[serde(rename_all = "camelCase")]
2169pub struct ToolExecutionCompleteContentShellExit {
2170    /// Working directory where the shell command was executed
2171    #[serde(skip_serializing_if = "Option::is_none")]
2172    pub cwd: Option<String>,
2173    /// Exit code from the completed shell command
2174    pub exit_code: i64,
2175    /// Output associated with this shell command, if available. May be partial, truncated, or a preview; not guaranteed to be full output.
2176    #[serde(skip_serializing_if = "Option::is_none")]
2177    pub output_preview: Option<String>,
2178    /// Whether outputPreview is known to be incomplete or truncated
2179    #[serde(skip_serializing_if = "Option::is_none")]
2180    pub output_truncated: Option<bool>,
2181    /// Shell id, as assigned by Copilot runtime
2182    pub shell_id: String,
2183    /// Content block type discriminator
2184    pub r#type: ToolExecutionCompleteContentShellExitType,
2185}
2186
2187/// Image content block with base64-encoded data
2188#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2189#[serde(rename_all = "camelCase")]
2190pub struct ToolExecutionCompleteContentImage {
2191    /// Base64-encoded image data
2192    pub data: String,
2193    /// MIME type of the image (e.g., image/png, image/jpeg)
2194    pub mime_type: String,
2195    /// Content block type discriminator
2196    pub r#type: ToolExecutionCompleteContentImageType,
2197}
2198
2199/// Audio content block with base64-encoded data
2200#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2201#[serde(rename_all = "camelCase")]
2202pub struct ToolExecutionCompleteContentAudio {
2203    /// Base64-encoded audio data
2204    pub data: String,
2205    /// MIME type of the audio (e.g., audio/wav, audio/mpeg)
2206    pub mime_type: String,
2207    /// Content block type discriminator
2208    pub r#type: ToolExecutionCompleteContentAudioType,
2209}
2210
2211/// Icon image for a resource
2212#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2213#[serde(rename_all = "camelCase")]
2214pub struct ToolExecutionCompleteContentResourceLinkIcon {
2215    /// MIME type of the icon image
2216    #[serde(skip_serializing_if = "Option::is_none")]
2217    pub mime_type: Option<String>,
2218    /// Available icon sizes (e.g., ['16x16', '32x32'])
2219    #[serde(skip_serializing_if = "Option::is_none")]
2220    pub sizes: Option<Vec<String>>,
2221    /// URL or path to the icon image
2222    pub src: String,
2223    /// Theme variant this icon is intended for
2224    #[serde(skip_serializing_if = "Option::is_none")]
2225    pub theme: Option<ToolExecutionCompleteContentResourceLinkIconTheme>,
2226}
2227
2228/// Resource link content block referencing an external resource
2229#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2230#[serde(rename_all = "camelCase")]
2231pub struct ToolExecutionCompleteContentResourceLink {
2232    /// Human-readable description of the resource
2233    #[serde(skip_serializing_if = "Option::is_none")]
2234    pub description: Option<String>,
2235    /// Icons associated with this resource
2236    #[serde(skip_serializing_if = "Option::is_none")]
2237    pub icons: Option<Vec<ToolExecutionCompleteContentResourceLinkIcon>>,
2238    /// MIME type of the resource content
2239    #[serde(skip_serializing_if = "Option::is_none")]
2240    pub mime_type: Option<String>,
2241    /// Resource name identifier
2242    pub name: String,
2243    /// Size of the resource in bytes
2244    #[serde(skip_serializing_if = "Option::is_none")]
2245    pub size: Option<i64>,
2246    /// Human-readable display title for the resource
2247    #[serde(skip_serializing_if = "Option::is_none")]
2248    pub title: Option<String>,
2249    /// Content block type discriminator
2250    pub r#type: ToolExecutionCompleteContentResourceLinkType,
2251    /// URI identifying the resource
2252    pub uri: String,
2253}
2254
2255/// Embedded text resource contents identified by a URI, with an optional MIME type and a text payload.
2256#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2257#[serde(rename_all = "camelCase")]
2258pub struct EmbeddedTextResourceContents {
2259    /// MIME type of the text content
2260    #[serde(skip_serializing_if = "Option::is_none")]
2261    pub mime_type: Option<String>,
2262    /// Text content of the resource
2263    pub text: String,
2264    /// URI identifying the resource
2265    pub uri: String,
2266}
2267
2268/// Embedded binary resource contents identified by a URI, with an optional MIME type and a base64-encoded blob.
2269#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2270#[serde(rename_all = "camelCase")]
2271pub struct EmbeddedBlobResourceContents {
2272    /// Base64-encoded binary content of the resource
2273    pub blob: String,
2274    /// MIME type of the blob content
2275    #[serde(skip_serializing_if = "Option::is_none")]
2276    pub mime_type: Option<String>,
2277    /// URI identifying the resource
2278    pub uri: String,
2279}
2280
2281/// Embedded resource content block with inline text or binary data
2282#[derive(Debug, Clone, Serialize, Deserialize)]
2283#[serde(rename_all = "camelCase")]
2284pub struct ToolExecutionCompleteContentResource {
2285    /// The embedded resource contents, either text or base64-encoded binary
2286    pub resource: ToolExecutionCompleteContentResourceDetails,
2287    /// Content block type discriminator
2288    pub r#type: ToolExecutionCompleteContentResourceType,
2289}
2290
2291/// CSP domain allowlists for an MCP Apps UI resource, including connect, resource, frame, and base URI domains.
2292#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2293#[serde(rename_all = "camelCase")]
2294pub struct ToolExecutionCompleteUIResourceMetaUICsp {
2295    #[serde(skip_serializing_if = "Option::is_none")]
2296    pub base_uri_domains: Option<Vec<String>>,
2297    #[serde(skip_serializing_if = "Option::is_none")]
2298    pub connect_domains: Option<Vec<String>>,
2299    #[serde(skip_serializing_if = "Option::is_none")]
2300    pub frame_domains: Option<Vec<String>>,
2301    #[serde(skip_serializing_if = "Option::is_none")]
2302    pub resource_domains: Option<Vec<String>>,
2303}
2304
2305/// Marker object for camera permission on an MCP Apps UI resource.
2306#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2307#[serde(rename_all = "camelCase")]
2308pub struct ToolExecutionCompleteUIResourceMetaUIPermissionsCamera {}
2309
2310/// Marker object for clipboard-write permission on an MCP Apps UI resource.
2311#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2312#[serde(rename_all = "camelCase")]
2313pub struct ToolExecutionCompleteUIResourceMetaUIPermissionsClipboardWrite {}
2314
2315/// Marker object for geolocation permission on an MCP Apps UI resource.
2316#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2317#[serde(rename_all = "camelCase")]
2318pub struct ToolExecutionCompleteUIResourceMetaUIPermissionsGeolocation {}
2319
2320/// Marker object for microphone permission on an MCP Apps UI resource.
2321#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2322#[serde(rename_all = "camelCase")]
2323pub struct ToolExecutionCompleteUIResourceMetaUIPermissionsMicrophone {}
2324
2325/// Browser permission metadata for an MCP Apps UI resource, including camera, microphone, geolocation, and clipboard-write.
2326#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2327#[serde(rename_all = "camelCase")]
2328pub struct ToolExecutionCompleteUIResourceMetaUIPermissions {
2329    /// Marker object for camera permission on an MCP Apps UI resource.
2330    #[serde(skip_serializing_if = "Option::is_none")]
2331    pub camera: Option<ToolExecutionCompleteUIResourceMetaUIPermissionsCamera>,
2332    /// Marker object for clipboard-write permission on an MCP Apps UI resource.
2333    #[serde(skip_serializing_if = "Option::is_none")]
2334    pub clipboard_write: Option<ToolExecutionCompleteUIResourceMetaUIPermissionsClipboardWrite>,
2335    /// Marker object for geolocation permission on an MCP Apps UI resource.
2336    #[serde(skip_serializing_if = "Option::is_none")]
2337    pub geolocation: Option<ToolExecutionCompleteUIResourceMetaUIPermissionsGeolocation>,
2338    /// Marker object for microphone permission on an MCP Apps UI resource.
2339    #[serde(skip_serializing_if = "Option::is_none")]
2340    pub microphone: Option<ToolExecutionCompleteUIResourceMetaUIPermissionsMicrophone>,
2341}
2342
2343/// MCP Apps UI resource metadata for a completed tool result, including CSP, permissions, domain, and border preference.
2344#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2345#[serde(rename_all = "camelCase")]
2346pub struct ToolExecutionCompleteUIResourceMetaUI {
2347    /// CSP domain allowlists for an MCP Apps UI resource, including connect, resource, frame, and base URI domains.
2348    #[serde(skip_serializing_if = "Option::is_none")]
2349    pub csp: Option<ToolExecutionCompleteUIResourceMetaUICsp>,
2350    #[serde(skip_serializing_if = "Option::is_none")]
2351    pub domain: Option<String>,
2352    /// Browser permission metadata for an MCP Apps UI resource, including camera, microphone, geolocation, and clipboard-write.
2353    #[serde(skip_serializing_if = "Option::is_none")]
2354    pub permissions: Option<ToolExecutionCompleteUIResourceMetaUIPermissions>,
2355    #[serde(skip_serializing_if = "Option::is_none")]
2356    pub prefers_border: Option<bool>,
2357}
2358
2359/// Resource-level UI metadata (CSP, permissions, visual preferences)
2360#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2361#[serde(rename_all = "camelCase")]
2362pub struct ToolExecutionCompleteUIResourceMeta {
2363    /// MCP Apps UI resource metadata for a completed tool result, including CSP, permissions, domain, and border preference.
2364    #[serde(skip_serializing_if = "Option::is_none")]
2365    pub ui: Option<ToolExecutionCompleteUIResourceMetaUI>,
2366}
2367
2368/// MCP Apps UI resource content for rendering in a sandboxed iframe
2369#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2370#[serde(rename_all = "camelCase")]
2371pub struct ToolExecutionCompleteUIResource {
2372    /// Resource-level UI metadata (CSP, permissions, visual preferences)
2373    #[serde(rename = "_meta", skip_serializing_if = "Option::is_none")]
2374    pub meta: Option<ToolExecutionCompleteUIResourceMeta>,
2375    /// Base64-encoded HTML content
2376    #[serde(skip_serializing_if = "Option::is_none")]
2377    pub blob: Option<String>,
2378    /// MIME type of the content
2379    pub mime_type: String,
2380    /// HTML content as a string
2381    #[serde(skip_serializing_if = "Option::is_none")]
2382    pub text: Option<String>,
2383    /// The ui:// URI of the resource
2384    pub uri: String,
2385}
2386
2387/// Tool execution result on success
2388#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2389#[serde(rename_all = "camelCase")]
2390pub struct ToolExecutionCompleteResult {
2391    /// Model-facing binary results (base64 inline or size-omitted markers) sent to the LLM for this tool call
2392    ///
2393    /// <div class="warning">
2394    ///
2395    /// **Experimental.** This type is part of an experimental wire-protocol surface
2396    /// and may change or be removed in future SDK or CLI releases.
2397    ///
2398    /// </div>
2399    #[serde(skip_serializing_if = "Option::is_none")]
2400    pub binary_results_for_llm: Option<Vec<serde_json::Value>>,
2401    /// Provider-neutral source material this tool makes available to the model as citable content. Persisted so it survives session resume. Experimental.
2402    ///
2403    /// <div class="warning">
2404    ///
2405    /// **Experimental.** This type is part of an experimental wire-protocol surface
2406    /// and may change or be removed in future SDK or CLI releases.
2407    ///
2408    /// </div>
2409    #[serde(skip_serializing_if = "Option::is_none")]
2410    pub citable_sources: Option<Vec<CitableSource>>,
2411    /// Concise tool result text sent to the LLM for chat completion, potentially truncated for token efficiency
2412    pub content: String,
2413    /// Structured content blocks (text, images, audio, resources) returned by the tool in their native format
2414    #[serde(skip_serializing_if = "Option::is_none")]
2415    pub contents: Option<Vec<ToolExecutionCompleteContent>>,
2416    /// Full detailed tool result for UI/timeline display, preserving complete content such as diffs. Falls back to content when absent.
2417    #[serde(skip_serializing_if = "Option::is_none")]
2418    pub detailed_content: Option<String>,
2419    /// FIDES IFC label projected from tool ingress metadata (MCP `CallToolResult._meta` or synthesized built-in ingress labels) — persisted as `{ ifc: ... }` (only the `ifc` key, not the whole `_meta`). Persisted so the FIDES IFC label survives session resume: the engine rehydrates accumulated taint by replaying these on load. Populated for ingress sources when FIDES IFC is on. Experimental.
2420    ///
2421    /// <div class="warning">
2422    ///
2423    /// **Experimental.** This type is part of an experimental wire-protocol surface
2424    /// and may change or be removed in future SDK or CLI releases.
2425    ///
2426    /// </div>
2427    #[serde(skip_serializing_if = "Option::is_none")]
2428    pub mcp_meta: Option<serde_json::Value>,
2429    /// Structured content (arbitrary JSON) returned verbatim by the MCP tool
2430    #[serde(skip_serializing_if = "Option::is_none")]
2431    pub structured_content: Option<serde_json::Value>,
2432    /// MCP Apps UI resource content for rendering in a sandboxed iframe
2433    #[serde(skip_serializing_if = "Option::is_none")]
2434    pub ui_resource: Option<ToolExecutionCompleteUIResource>,
2435}
2436
2437/// MCP Apps tool `_meta.ui` resource URI and visibility captured on `tool.execution_complete`.
2438#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2439#[serde(rename_all = "camelCase")]
2440pub struct ToolExecutionCompleteToolDescriptionMetaUI {
2441    /// URI of the UI resource
2442    #[serde(skip_serializing_if = "Option::is_none")]
2443    pub resource_uri: Option<String>,
2444    /// Who can access this tool
2445    #[serde(skip_serializing_if = "Option::is_none")]
2446    pub visibility: Option<Vec<ToolExecutionCompleteToolDescriptionMetaUIVisibility>>,
2447}
2448
2449/// MCP Apps metadata for UI resource association
2450#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2451#[serde(rename_all = "camelCase")]
2452pub struct ToolExecutionCompleteToolDescriptionMeta {
2453    /// MCP Apps tool `_meta.ui` resource URI and visibility captured on `tool.execution_complete`.
2454    #[serde(skip_serializing_if = "Option::is_none")]
2455    pub ui: Option<ToolExecutionCompleteToolDescriptionMetaUI>,
2456}
2457
2458/// Tool definition metadata, present for MCP tools with MCP Apps support
2459#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2460#[serde(rename_all = "camelCase")]
2461pub struct ToolExecutionCompleteToolDescription {
2462    /// MCP Apps metadata for UI resource association
2463    #[serde(rename = "_meta", skip_serializing_if = "Option::is_none")]
2464    pub meta: Option<ToolExecutionCompleteToolDescriptionMeta>,
2465    /// Tool description
2466    #[serde(skip_serializing_if = "Option::is_none")]
2467    pub description: Option<String>,
2468    /// Tool name
2469    pub name: String,
2470}
2471
2472/// Session event "tool.execution_complete". Tool execution completion results including success status, detailed output, and error information
2473#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2474#[serde(rename_all = "camelCase")]
2475pub struct ToolExecutionCompleteData {
2476    /// Error details when the tool execution failed
2477    #[serde(skip_serializing_if = "Option::is_none")]
2478    pub error: Option<ToolExecutionCompleteError>,
2479    /// CAPI interaction ID for correlating this tool execution with upstream telemetry
2480    #[serde(skip_serializing_if = "Option::is_none")]
2481    pub interaction_id: Option<String>,
2482    /// Whether this tool call was explicitly requested by the user rather than the assistant
2483    #[serde(skip_serializing_if = "Option::is_none")]
2484    pub is_user_requested: Option<bool>,
2485    /// FIDES IFC label projected from tool ingress metadata (MCP `CallToolResult._meta` or synthesized built-in ingress labels). Persisted as `{ ifc: ... }` so the label survives session resume, including model-visible failure results. Experimental.
2486    ///
2487    /// <div class="warning">
2488    ///
2489    /// **Experimental.** This type is part of an experimental wire-protocol surface
2490    /// and may change or be removed in future SDK or CLI releases.
2491    ///
2492    /// </div>
2493    #[serde(skip_serializing_if = "Option::is_none")]
2494    pub mcp_meta: Option<serde_json::Value>,
2495    /// Model identifier that generated this tool call
2496    #[serde(skip_serializing_if = "Option::is_none")]
2497    pub model: Option<String>,
2498    /// Tool call ID of the parent tool invocation when this event originates from a sub-agent
2499    #[doc(hidden)]
2500    #[deprecated]
2501    #[serde(skip_serializing_if = "Option::is_none")]
2502    pub parent_tool_call_id: Option<String>,
2503    /// Tool execution result on success
2504    #[serde(skip_serializing_if = "Option::is_none")]
2505    pub result: Option<ToolExecutionCompleteResult>,
2506    /// Whether this tool execution ran inside a sandbox container
2507    #[serde(skip_serializing_if = "Option::is_none")]
2508    pub sandboxed: Option<bool>,
2509    /// Whether the tool execution completed successfully
2510    pub success: bool,
2511    /// Unique identifier for the completed tool call
2512    pub tool_call_id: String,
2513    /// Tool definition metadata, present for MCP tools with MCP Apps support
2514    #[serde(skip_serializing_if = "Option::is_none")]
2515    pub tool_description: Option<ToolExecutionCompleteToolDescription>,
2516    /// Tool-specific telemetry data (e.g., CodeQL check counts, grep match counts)
2517    #[serde(skip_serializing_if = "Option::is_none")]
2518    pub tool_telemetry: Option<HashMap<String, serde_json::Value>>,
2519    /// Identifier for the agent loop turn this tool was invoked in, matching the corresponding assistant.turn_start event
2520    #[serde(skip_serializing_if = "Option::is_none")]
2521    pub turn_id: Option<String>,
2522}
2523
2524/// Session event "skill.invoked". Skill invocation details including content, allowed tools, and plugin metadata
2525#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2526#[serde(rename_all = "camelCase")]
2527pub struct SkillInvokedData {
2528    /// Tool names that should be auto-approved when this skill is active
2529    #[serde(skip_serializing_if = "Option::is_none")]
2530    pub allowed_tools: Option<Vec<String>>,
2531    /// Full content of the skill file, injected into the conversation for the model
2532    pub content: String,
2533    /// Description of the skill from its SKILL.md frontmatter
2534    #[serde(skip_serializing_if = "Option::is_none")]
2535    pub description: Option<String>,
2536    /// Model identifier active when the skill was invoked, when known
2537    #[serde(skip_serializing_if = "Option::is_none")]
2538    pub model: Option<String>,
2539    /// Name of the invoked skill
2540    pub name: String,
2541    /// File path to the SKILL.md definition
2542    pub path: String,
2543    /// Name of the plugin this skill originated from, when applicable
2544    #[serde(skip_serializing_if = "Option::is_none")]
2545    pub plugin_name: Option<String>,
2546    /// Version of the plugin this skill originated from, when applicable
2547    #[serde(skip_serializing_if = "Option::is_none")]
2548    pub plugin_version: Option<String>,
2549    /// 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), custom (configured directory), plugin (installed plugin), builtin (bundled runtime skill), and remote (org/enterprise skill)
2550    #[serde(skip_serializing_if = "Option::is_none")]
2551    pub source: Option<String>,
2552    /// 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)
2553    #[serde(skip_serializing_if = "Option::is_none")]
2554    pub trigger: Option<SkillInvokedTrigger>,
2555}
2556
2557/// Session event "subagent.started". Sub-agent startup details including parent tool call and agent information
2558#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2559#[serde(rename_all = "camelCase")]
2560pub struct SubagentStartedData {
2561    /// Description of what the sub-agent does
2562    pub agent_description: String,
2563    /// Human-readable display name of the sub-agent
2564    pub agent_display_name: String,
2565    /// Internal name of the sub-agent
2566    pub agent_name: String,
2567    /// Model the sub-agent will run with, when known at start.
2568    #[serde(skip_serializing_if = "Option::is_none")]
2569    pub model: Option<String>,
2570    /// Tool call ID of the parent tool invocation that spawned this sub-agent
2571    pub tool_call_id: String,
2572}
2573
2574/// Session event "subagent.completed". Sub-agent completion details for successful execution
2575#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2576#[serde(rename_all = "camelCase")]
2577pub struct SubagentCompletedData {
2578    /// Human-readable display name of the sub-agent
2579    pub agent_display_name: String,
2580    /// Internal name of the sub-agent
2581    pub agent_name: String,
2582    /// Wall-clock duration of the sub-agent execution in milliseconds
2583    #[serde(skip_serializing_if = "Option::is_none")]
2584    pub duration_ms: Option<i64>,
2585    /// Model used by the sub-agent
2586    #[serde(skip_serializing_if = "Option::is_none")]
2587    pub model: Option<String>,
2588    /// Tool call ID of the parent tool invocation that spawned this sub-agent
2589    pub tool_call_id: String,
2590    /// Total tokens (input + output) consumed by the sub-agent
2591    #[serde(skip_serializing_if = "Option::is_none")]
2592    pub total_tokens: Option<i64>,
2593    /// Total number of tool calls made by the sub-agent
2594    #[serde(skip_serializing_if = "Option::is_none")]
2595    pub total_tool_calls: Option<i64>,
2596}
2597
2598/// Session event "subagent.failed". Sub-agent failure details including error message and agent information
2599#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2600#[serde(rename_all = "camelCase")]
2601pub struct SubagentFailedData {
2602    /// Human-readable display name of the sub-agent
2603    pub agent_display_name: String,
2604    /// Internal name of the sub-agent
2605    pub agent_name: String,
2606    /// Wall-clock duration of the sub-agent execution in milliseconds
2607    #[serde(skip_serializing_if = "Option::is_none")]
2608    pub duration_ms: Option<i64>,
2609    /// Error message describing why the sub-agent failed
2610    pub error: String,
2611    /// Model selected for the sub-agent, when known
2612    #[serde(skip_serializing_if = "Option::is_none")]
2613    pub model: Option<String>,
2614    /// Tool call ID of the parent tool invocation that spawned this sub-agent
2615    pub tool_call_id: String,
2616    /// Total tokens (input + output) consumed before the sub-agent failed
2617    #[serde(skip_serializing_if = "Option::is_none")]
2618    pub total_tokens: Option<i64>,
2619    /// Total number of tool calls made before the sub-agent failed
2620    #[serde(skip_serializing_if = "Option::is_none")]
2621    pub total_tool_calls: Option<i64>,
2622}
2623
2624/// Session event "subagent.selected". Custom agent selection details including name and available tools
2625#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2626#[serde(rename_all = "camelCase")]
2627pub struct SubagentSelectedData {
2628    /// Human-readable display name of the selected custom agent
2629    pub agent_display_name: String,
2630    /// Internal name of the selected custom agent
2631    pub agent_name: String,
2632    /// List of tool names available to this agent, or null for all tools
2633    pub tools: Option<Vec<String>>,
2634}
2635
2636/// Session event "subagent.deselected". Empty payload; the event signals that the custom agent was deselected, returning to the default agent
2637#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2638#[serde(rename_all = "camelCase")]
2639pub struct SubagentDeselectedData {}
2640
2641/// Session event "hook.start". Hook invocation start details including type and input data
2642#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2643#[serde(rename_all = "camelCase")]
2644pub struct HookStartData {
2645    /// Unique identifier for this hook invocation
2646    pub hook_invocation_id: String,
2647    /// Type of hook being invoked (e.g., "preToolUse", "postToolUse", "sessionStart")
2648    pub hook_type: String,
2649    /// Input data passed to the hook
2650    #[serde(skip_serializing_if = "Option::is_none")]
2651    pub input: Option<serde_json::Value>,
2652}
2653
2654/// Error details when the hook failed
2655#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2656#[serde(rename_all = "camelCase")]
2657pub struct HookEndError {
2658    /// Human-readable error message
2659    pub message: String,
2660    /// Source label of the hook that errored (e.g. the plugin it was loaded from), when known
2661    #[serde(skip_serializing_if = "Option::is_none")]
2662    pub source: Option<String>,
2663    /// Error stack trace, when available
2664    #[serde(skip_serializing_if = "Option::is_none")]
2665    pub stack: Option<String>,
2666}
2667
2668/// Session event "hook.end". Hook invocation completion details including output, success status, and error information
2669#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2670#[serde(rename_all = "camelCase")]
2671pub struct HookEndData {
2672    /// Error details when the hook failed
2673    #[serde(skip_serializing_if = "Option::is_none")]
2674    pub error: Option<HookEndError>,
2675    /// Identifier matching the corresponding hook.start event
2676    pub hook_invocation_id: String,
2677    /// Type of hook that was invoked (e.g., "preToolUse", "postToolUse", "sessionStart")
2678    pub hook_type: String,
2679    /// Output data produced by the hook
2680    #[serde(skip_serializing_if = "Option::is_none")]
2681    pub output: Option<serde_json::Value>,
2682    /// Whether the hook completed successfully
2683    pub success: bool,
2684}
2685
2686/// Session event "hook.progress". Ephemeral progress update from a running hook process
2687#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2688#[serde(rename_all = "camelCase")]
2689pub struct HookProgressData {
2690    /// Human-readable progress message from the hook process
2691    pub message: String,
2692    /// When true, this status message replaces the previous temporary one instead of accumulating
2693    #[serde(skip_serializing_if = "Option::is_none")]
2694    pub temporary: Option<bool>,
2695}
2696
2697/// Session event "session.binary_asset". Canonical bytes for a content-addressed binary asset shared by reference across events
2698#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2699#[serde(rename_all = "camelCase")]
2700pub struct SessionBinaryAssetData {
2701    /// Content-addressed id for this binary asset (e.g. "sha256:...").
2702    pub asset_id: String,
2703    /// Decoded byte length of the binary asset
2704    pub byte_length: i64,
2705    /// Base64-encoded binary data
2706    pub data: String,
2707    /// Human-readable description of the binary data
2708    #[serde(skip_serializing_if = "Option::is_none")]
2709    pub description: Option<String>,
2710    /// Optional metadata from the producing tool.
2711    #[serde(skip_serializing_if = "Option::is_none")]
2712    pub metadata: Option<HashMap<String, serde_json::Value>>,
2713    /// MIME type of the binary asset
2714    pub mime_type: String,
2715    /// Binary asset type discriminator. Use "image" for images and "resource" otherwise.
2716    pub r#type: BinaryAssetType,
2717}
2718
2719/// Metadata about the prompt template and its construction
2720#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2721#[serde(rename_all = "camelCase")]
2722pub struct SystemMessageMetadata {
2723    /// Version identifier of the prompt template used
2724    #[serde(skip_serializing_if = "Option::is_none")]
2725    pub prompt_version: Option<String>,
2726    /// Template variables used when constructing the prompt
2727    #[serde(skip_serializing_if = "Option::is_none")]
2728    pub variables: Option<HashMap<String, serde_json::Value>>,
2729}
2730
2731/// Session event "system.message". System/developer instruction content with role and optional template metadata
2732#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2733#[serde(rename_all = "camelCase")]
2734pub struct SystemMessageData {
2735    /// The system or developer prompt text sent as model input
2736    pub content: String,
2737    /// Metadata about the prompt template and its construction
2738    #[serde(skip_serializing_if = "Option::is_none")]
2739    pub metadata: Option<SystemMessageMetadata>,
2740    /// Optional name identifier for the message source
2741    #[serde(skip_serializing_if = "Option::is_none")]
2742    pub name: Option<String>,
2743    /// Message role: "system" for system prompts, "developer" for developer-injected instructions
2744    pub role: SystemMessageRole,
2745}
2746
2747/// Session event "system.notification". System-generated notification for runtime events like background task completion
2748#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2749#[serde(rename_all = "camelCase")]
2750pub struct SystemNotificationData {
2751    /// The notification text, typically wrapped in <system_notification> XML tags
2752    pub content: String,
2753    /// Structured metadata identifying what triggered this notification
2754    pub kind: serde_json::Value,
2755}
2756
2757/// A parsed command identifier in a shell permission request, including whether it is read-only.
2758#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2759#[serde(rename_all = "camelCase")]
2760pub struct PermissionRequestShellCommand {
2761    /// Command identifier (e.g., executable name)
2762    pub identifier: String,
2763    /// Whether this command is read-only (no side effects)
2764    pub read_only: bool,
2765}
2766
2767/// A URL that may be accessed by a command in a shell permission request.
2768#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2769#[serde(rename_all = "camelCase")]
2770pub struct PermissionRequestShellPossibleUrl {
2771    /// URL that may be accessed by the command
2772    pub url: String,
2773}
2774
2775/// Shell command permission request
2776#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2777#[serde(rename_all = "camelCase")]
2778pub struct PermissionRequestShell {
2779    /// Whether the UI can offer session-wide approval for this command pattern
2780    pub can_offer_session_approval: bool,
2781    /// Parsed command identifiers found in the command text
2782    pub commands: Vec<PermissionRequestShellCommand>,
2783    /// The complete shell command text to be executed
2784    pub full_command_text: String,
2785    /// Whether the command includes a file write redirection (e.g., > or >>)
2786    pub has_write_file_redirection: bool,
2787    /// Human-readable description of what the command intends to do
2788    pub intention: String,
2789    /// Permission kind discriminator
2790    pub kind: PermissionRequestShellKind,
2791    /// File paths that may be read or written by the command
2792    pub possible_paths: Vec<String>,
2793    /// URLs that may be accessed by the command
2794    pub possible_urls: Vec<PermissionRequestShellPossibleUrl>,
2795    /// True when the model has requested to run this command outside the sandbox (it set requestSandboxBypass: true and the host opted in via sandbox.allowBypass). This is a request, not a grant: the command runs unsandboxed only if the user approves this permission request. Hosts should highlight the elevated risk in the approval UI.
2796    #[serde(skip_serializing_if = "Option::is_none")]
2797    pub request_sandbox_bypass: Option<bool>,
2798    /// Model-provided justification for the sandbox-bypass request. Only meaningful when requestSandboxBypass is true.
2799    #[serde(skip_serializing_if = "Option::is_none")]
2800    pub request_sandbox_bypass_reason: Option<String>,
2801    /// Tool call ID that triggered this permission request
2802    #[serde(skip_serializing_if = "Option::is_none")]
2803    pub tool_call_id: Option<String>,
2804    /// Optional warning message about risks of running this command
2805    #[serde(skip_serializing_if = "Option::is_none")]
2806    pub warning: Option<String>,
2807}
2808
2809/// File write permission request
2810#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2811#[serde(rename_all = "camelCase")]
2812pub struct PermissionRequestWrite {
2813    /// Whether the UI can offer session-wide approval for file write operations
2814    pub can_offer_session_approval: bool,
2815    /// Unified diff showing the proposed changes
2816    pub diff: String,
2817    /// Path of the file being written to
2818    pub file_name: String,
2819    /// Human-readable description of the intended file change
2820    pub intention: String,
2821    /// Permission kind discriminator
2822    pub kind: PermissionRequestWriteKind,
2823    /// Complete new file contents for newly created files
2824    #[serde(skip_serializing_if = "Option::is_none")]
2825    pub new_file_contents: Option<String>,
2826    /// True when a built-in file tool (apply_patch / str_replace_editor) asked to write a path the sandbox filesystem policy would block, and the host opted in via sandbox.allowBypass. This is a request, not a grant: the write happens unsandboxed only if the user approves this permission request. Hosts should highlight the elevated risk in the approval UI.
2827    #[serde(skip_serializing_if = "Option::is_none")]
2828    pub request_sandbox_bypass: Option<bool>,
2829    /// Justification for the sandbox-bypass request. Only meaningful when requestSandboxBypass is true.
2830    #[serde(skip_serializing_if = "Option::is_none")]
2831    pub request_sandbox_bypass_reason: Option<String>,
2832    /// Tool call ID that triggered this permission request
2833    #[serde(skip_serializing_if = "Option::is_none")]
2834    pub tool_call_id: Option<String>,
2835}
2836
2837/// File or directory read permission request
2838#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2839#[serde(rename_all = "camelCase")]
2840pub struct PermissionRequestRead {
2841    /// Human-readable description of why the file is being read
2842    pub intention: String,
2843    /// Permission kind discriminator
2844    pub kind: PermissionRequestReadKind,
2845    /// Path of the file or directory being read
2846    pub path: String,
2847    /// True when the model has requested to run this search outside the sandbox (it set requestSandboxBypass: true and the host opted in via sandbox.allowBypass). This is a request, not a grant: the search runs unsandboxed only if the user approves this permission request. Hosts should highlight the elevated risk in the approval UI.
2848    #[serde(skip_serializing_if = "Option::is_none")]
2849    pub request_sandbox_bypass: Option<bool>,
2850    /// Model-provided justification for the sandbox-bypass request. Only meaningful when requestSandboxBypass is true.
2851    #[serde(skip_serializing_if = "Option::is_none")]
2852    pub request_sandbox_bypass_reason: Option<String>,
2853    /// Tool call ID that triggered this permission request
2854    #[serde(skip_serializing_if = "Option::is_none")]
2855    pub tool_call_id: Option<String>,
2856}
2857
2858/// MCP tool invocation permission request
2859#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2860#[serde(rename_all = "camelCase")]
2861pub struct PermissionRequestMcp {
2862    /// Arguments to pass to the MCP tool
2863    #[serde(skip_serializing_if = "Option::is_none")]
2864    pub args: Option<serde_json::Value>,
2865    /// Permission kind discriminator
2866    pub kind: PermissionRequestMcpKind,
2867    /// Whether this MCP tool is read-only (no side effects)
2868    pub read_only: bool,
2869    /// Name of the MCP server providing the tool
2870    pub server_name: String,
2871    /// Tool call ID that triggered this permission request
2872    #[serde(skip_serializing_if = "Option::is_none")]
2873    pub tool_call_id: Option<String>,
2874    /// Internal name of the MCP tool
2875    pub tool_name: String,
2876    /// Human-readable title of the MCP tool
2877    pub tool_title: String,
2878}
2879
2880/// URL access permission request
2881#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2882#[serde(rename_all = "camelCase")]
2883pub struct PermissionRequestUrl {
2884    /// Human-readable description of why the URL is being accessed
2885    pub intention: String,
2886    /// Permission kind discriminator
2887    pub kind: PermissionRequestUrlKind,
2888    /// True when this URL fetch is requesting to bypass the sandbox network policy: either the model set requestSandboxBypass: true, or the tool re-issued the request as an interactive bypass after the network policy denied the approved URL (host opted in via sandbox.allowBypass). This is a request, not a grant: the fetch runs only if the user approves this permission request. Hosts should highlight the elevated risk in the approval UI.
2889    #[serde(skip_serializing_if = "Option::is_none")]
2890    pub request_sandbox_bypass: Option<bool>,
2891    /// Model-provided justification for the sandbox-bypass request. Only meaningful when requestSandboxBypass is true.
2892    #[serde(skip_serializing_if = "Option::is_none")]
2893    pub request_sandbox_bypass_reason: Option<String>,
2894    /// Tool call ID that triggered this permission request
2895    #[serde(skip_serializing_if = "Option::is_none")]
2896    pub tool_call_id: Option<String>,
2897    /// URL to be fetched
2898    pub url: String,
2899}
2900
2901/// Memory operation permission request
2902#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2903#[serde(rename_all = "camelCase")]
2904pub struct PermissionRequestMemory {
2905    /// Whether this is a store or vote memory operation
2906    #[serde(skip_serializing_if = "Option::is_none")]
2907    pub action: Option<PermissionRequestMemoryAction>,
2908    /// Source references for the stored fact (store only)
2909    #[serde(skip_serializing_if = "Option::is_none")]
2910    pub citations: Option<String>,
2911    /// Vote direction (vote only)
2912    #[serde(skip_serializing_if = "Option::is_none")]
2913    pub direction: Option<PermissionRequestMemoryDirection>,
2914    /// The fact being stored or voted on
2915    pub fact: String,
2916    /// Permission kind discriminator
2917    pub kind: PermissionRequestMemoryKind,
2918    /// Reason for the vote (vote only)
2919    #[serde(skip_serializing_if = "Option::is_none")]
2920    pub reason: Option<String>,
2921    /// Topic or subject of the memory (store only)
2922    #[serde(skip_serializing_if = "Option::is_none")]
2923    pub subject: Option<String>,
2924    /// Tool call ID that triggered this permission request
2925    #[serde(skip_serializing_if = "Option::is_none")]
2926    pub tool_call_id: Option<String>,
2927}
2928
2929/// Custom tool invocation permission request
2930#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2931#[serde(rename_all = "camelCase")]
2932pub struct PermissionRequestCustomTool {
2933    /// Arguments to pass to the custom tool
2934    #[serde(skip_serializing_if = "Option::is_none")]
2935    pub args: Option<serde_json::Value>,
2936    /// Permission kind discriminator
2937    pub kind: PermissionRequestCustomToolKind,
2938    /// Tool call ID that triggered this permission request
2939    #[serde(skip_serializing_if = "Option::is_none")]
2940    pub tool_call_id: Option<String>,
2941    /// Description of what the custom tool does
2942    pub tool_description: String,
2943    /// Name of the custom tool
2944    pub tool_name: String,
2945}
2946
2947/// Hook confirmation permission request
2948#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2949#[serde(rename_all = "camelCase")]
2950pub struct PermissionRequestHook {
2951    /// Optional message from the hook explaining why confirmation is needed
2952    #[serde(skip_serializing_if = "Option::is_none")]
2953    pub hook_message: Option<String>,
2954    /// Permission kind discriminator
2955    pub kind: PermissionRequestHookKind,
2956    /// Arguments of the tool call being gated
2957    #[serde(skip_serializing_if = "Option::is_none")]
2958    pub tool_args: Option<serde_json::Value>,
2959    /// Tool call ID that triggered this permission request
2960    #[serde(skip_serializing_if = "Option::is_none")]
2961    pub tool_call_id: Option<String>,
2962    /// Name of the tool the hook is gating
2963    pub tool_name: String,
2964}
2965
2966/// Extension management permission request
2967#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2968#[serde(rename_all = "camelCase")]
2969pub struct PermissionRequestExtensionManagement {
2970    /// Name of the extension being managed
2971    #[serde(skip_serializing_if = "Option::is_none")]
2972    pub extension_name: Option<String>,
2973    /// Permission kind discriminator
2974    pub kind: PermissionRequestExtensionManagementKind,
2975    /// The extension management operation (scaffold, reload)
2976    pub operation: String,
2977    /// Tool call ID that triggered this permission request
2978    #[serde(skip_serializing_if = "Option::is_none")]
2979    pub tool_call_id: Option<String>,
2980}
2981
2982/// Extension permission access request
2983#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2984#[serde(rename_all = "camelCase")]
2985pub struct PermissionRequestExtensionPermissionAccess {
2986    /// Capabilities the extension is requesting
2987    pub capabilities: Vec<String>,
2988    /// Name of the extension requesting permission access
2989    pub extension_name: String,
2990    /// Permission kind discriminator
2991    pub kind: PermissionRequestExtensionPermissionAccessKind,
2992    /// Tool call ID that triggered this permission request
2993    #[serde(skip_serializing_if = "Option::is_none")]
2994    pub tool_call_id: Option<String>,
2995}
2996
2997/// Auto-approval judge information attached to a permission request. Present (non-null) only when the session's allow-all mode is "auto"; its absence means auto mode was off and the judge did not evaluate the request. The `recommendation` conveys the judge's disposition for this request.
2998///
2999/// <div class="warning">
3000///
3001/// **Experimental.** This type is part of an experimental wire-protocol surface
3002/// and may change or be removed in future SDK or CLI releases.
3003///
3004/// </div>
3005#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3006#[serde(rename_all = "camelCase")]
3007pub struct PermissionAutoApproval {
3008    /// Human-readable reason for the judge's recommendation, when available.
3009    #[serde(skip_serializing_if = "Option::is_none")]
3010    pub reason: Option<String>,
3011    /// The auto-approval safety judge's outcome for this request.
3012    pub recommendation: AutoApprovalRecommendation,
3013}
3014
3015/// Shell command permission prompt
3016#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3017#[serde(rename_all = "camelCase")]
3018pub struct PermissionPromptRequestCommands {
3019    /// Auto-approval judge information for this request; present only when auto mode is enabled.
3020    ///
3021    /// <div class="warning">
3022    ///
3023    /// **Experimental.** This type is part of an experimental wire-protocol surface
3024    /// and may change or be removed in future SDK or CLI releases.
3025    ///
3026    /// </div>
3027    #[serde(skip_serializing_if = "Option::is_none")]
3028    pub auto_approval: Option<PermissionAutoApproval>,
3029    /// Whether the UI can offer session-wide approval for this command pattern
3030    pub can_offer_session_approval: bool,
3031    /// Command identifiers covered by this approval prompt
3032    pub command_identifiers: Vec<String>,
3033    /// The complete shell command text to be executed
3034    pub full_command_text: String,
3035    /// Human-readable description of what the command intends to do
3036    pub intention: String,
3037    /// Prompt kind discriminator
3038    pub kind: PermissionPromptRequestCommandsKind,
3039    /// Tool call ID that triggered this permission request
3040    #[serde(skip_serializing_if = "Option::is_none")]
3041    pub tool_call_id: Option<String>,
3042    /// Optional warning message about risks of running this command
3043    #[serde(skip_serializing_if = "Option::is_none")]
3044    pub warning: Option<String>,
3045}
3046
3047/// File write permission prompt
3048#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3049#[serde(rename_all = "camelCase")]
3050pub struct PermissionPromptRequestWrite {
3051    /// Auto-approval judge information for this request; present only when auto mode is enabled.
3052    ///
3053    /// <div class="warning">
3054    ///
3055    /// **Experimental.** This type is part of an experimental wire-protocol surface
3056    /// and may change or be removed in future SDK or CLI releases.
3057    ///
3058    /// </div>
3059    #[serde(skip_serializing_if = "Option::is_none")]
3060    pub auto_approval: Option<PermissionAutoApproval>,
3061    /// Whether the UI can offer session-wide approval for file write operations
3062    pub can_offer_session_approval: bool,
3063    /// Unified diff showing the proposed changes
3064    pub diff: String,
3065    /// Path of the file being written to
3066    pub file_name: String,
3067    /// Human-readable description of the intended file change
3068    pub intention: String,
3069    /// Prompt kind discriminator
3070    pub kind: PermissionPromptRequestWriteKind,
3071    /// Complete new file contents for newly created files
3072    #[serde(skip_serializing_if = "Option::is_none")]
3073    pub new_file_contents: Option<String>,
3074    /// Tool call ID that triggered this permission request
3075    #[serde(skip_serializing_if = "Option::is_none")]
3076    pub tool_call_id: Option<String>,
3077}
3078
3079/// File read permission prompt
3080#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3081#[serde(rename_all = "camelCase")]
3082pub struct PermissionPromptRequestRead {
3083    /// Auto-approval judge information for this request; present only when auto mode is enabled.
3084    ///
3085    /// <div class="warning">
3086    ///
3087    /// **Experimental.** This type is part of an experimental wire-protocol surface
3088    /// and may change or be removed in future SDK or CLI releases.
3089    ///
3090    /// </div>
3091    #[serde(skip_serializing_if = "Option::is_none")]
3092    pub auto_approval: Option<PermissionAutoApproval>,
3093    /// Human-readable description of why the file is being read
3094    pub intention: String,
3095    /// Prompt kind discriminator
3096    pub kind: PermissionPromptRequestReadKind,
3097    /// Path of the file or directory being read
3098    pub path: String,
3099    /// Tool call ID that triggered this permission request
3100    #[serde(skip_serializing_if = "Option::is_none")]
3101    pub tool_call_id: Option<String>,
3102}
3103
3104/// MCP tool invocation permission prompt
3105#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3106#[serde(rename_all = "camelCase")]
3107pub struct PermissionPromptRequestMcp {
3108    /// Arguments to pass to the MCP tool
3109    #[serde(skip_serializing_if = "Option::is_none")]
3110    pub args: Option<serde_json::Value>,
3111    /// Auto-approval judge information for this request; present only when auto mode is enabled.
3112    ///
3113    /// <div class="warning">
3114    ///
3115    /// **Experimental.** This type is part of an experimental wire-protocol surface
3116    /// and may change or be removed in future SDK or CLI releases.
3117    ///
3118    /// </div>
3119    #[serde(skip_serializing_if = "Option::is_none")]
3120    pub auto_approval: Option<PermissionAutoApproval>,
3121    /// Prompt kind discriminator
3122    pub kind: PermissionPromptRequestMcpKind,
3123    /// Name of the MCP server providing the tool
3124    pub server_name: String,
3125    /// Tool call ID that triggered this permission request
3126    #[serde(skip_serializing_if = "Option::is_none")]
3127    pub tool_call_id: Option<String>,
3128    /// Internal name of the MCP tool
3129    pub tool_name: String,
3130    /// Human-readable title of the MCP tool
3131    pub tool_title: String,
3132}
3133
3134/// URL access permission prompt
3135#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3136#[serde(rename_all = "camelCase")]
3137pub struct PermissionPromptRequestUrl {
3138    /// Auto-approval judge information for this request; present only when auto mode is enabled.
3139    ///
3140    /// <div class="warning">
3141    ///
3142    /// **Experimental.** This type is part of an experimental wire-protocol surface
3143    /// and may change or be removed in future SDK or CLI releases.
3144    ///
3145    /// </div>
3146    #[serde(skip_serializing_if = "Option::is_none")]
3147    pub auto_approval: Option<PermissionAutoApproval>,
3148    /// Human-readable description of why the URL is being accessed
3149    pub intention: String,
3150    /// Prompt kind discriminator
3151    pub kind: PermissionPromptRequestUrlKind,
3152    /// True when this URL fetch is requesting to bypass the sandbox network policy: either the model set requestSandboxBypass: true, or the tool re-issued the request as an interactive bypass after the network policy denied the approved URL (host opted in via sandbox.allowBypass). This is a request, not a grant: the fetch runs only if the user approves this permission request. Hosts should highlight the elevated risk in the approval UI.
3153    #[serde(skip_serializing_if = "Option::is_none")]
3154    pub request_sandbox_bypass: Option<bool>,
3155    /// Model-provided justification for the sandbox-bypass request. Only meaningful when requestSandboxBypass is true.
3156    #[serde(skip_serializing_if = "Option::is_none")]
3157    pub request_sandbox_bypass_reason: Option<String>,
3158    /// Tool call ID that triggered this permission request
3159    #[serde(skip_serializing_if = "Option::is_none")]
3160    pub tool_call_id: Option<String>,
3161    /// URL to be fetched
3162    pub url: String,
3163}
3164
3165/// Memory operation permission prompt
3166#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3167#[serde(rename_all = "camelCase")]
3168pub struct PermissionPromptRequestMemory {
3169    /// Whether this is a store or vote memory operation
3170    #[serde(skip_serializing_if = "Option::is_none")]
3171    pub action: Option<PermissionRequestMemoryAction>,
3172    /// Auto-approval judge information for this request; present only when auto mode is enabled.
3173    ///
3174    /// <div class="warning">
3175    ///
3176    /// **Experimental.** This type is part of an experimental wire-protocol surface
3177    /// and may change or be removed in future SDK or CLI releases.
3178    ///
3179    /// </div>
3180    #[serde(skip_serializing_if = "Option::is_none")]
3181    pub auto_approval: Option<PermissionAutoApproval>,
3182    /// Source references for the stored fact (store only)
3183    #[serde(skip_serializing_if = "Option::is_none")]
3184    pub citations: Option<String>,
3185    /// Vote direction (vote only)
3186    #[serde(skip_serializing_if = "Option::is_none")]
3187    pub direction: Option<PermissionRequestMemoryDirection>,
3188    /// The fact being stored or voted on
3189    pub fact: String,
3190    /// Prompt kind discriminator
3191    pub kind: PermissionPromptRequestMemoryKind,
3192    /// Reason for the vote (vote only)
3193    #[serde(skip_serializing_if = "Option::is_none")]
3194    pub reason: Option<String>,
3195    /// Topic or subject of the memory (store only)
3196    #[serde(skip_serializing_if = "Option::is_none")]
3197    pub subject: Option<String>,
3198    /// Tool call ID that triggered this permission request
3199    #[serde(skip_serializing_if = "Option::is_none")]
3200    pub tool_call_id: Option<String>,
3201}
3202
3203/// Custom tool invocation permission prompt
3204#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3205#[serde(rename_all = "camelCase")]
3206pub struct PermissionPromptRequestCustomTool {
3207    /// Arguments to pass to the custom tool
3208    #[serde(skip_serializing_if = "Option::is_none")]
3209    pub args: Option<serde_json::Value>,
3210    /// Auto-approval judge information for this request; present only when auto mode is enabled.
3211    ///
3212    /// <div class="warning">
3213    ///
3214    /// **Experimental.** This type is part of an experimental wire-protocol surface
3215    /// and may change or be removed in future SDK or CLI releases.
3216    ///
3217    /// </div>
3218    #[serde(skip_serializing_if = "Option::is_none")]
3219    pub auto_approval: Option<PermissionAutoApproval>,
3220    /// Prompt kind discriminator
3221    pub kind: PermissionPromptRequestCustomToolKind,
3222    /// Tool call ID that triggered this permission request
3223    #[serde(skip_serializing_if = "Option::is_none")]
3224    pub tool_call_id: Option<String>,
3225    /// Description of what the custom tool does
3226    pub tool_description: String,
3227    /// Name of the custom tool
3228    pub tool_name: String,
3229}
3230
3231/// Path access permission prompt
3232#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3233#[serde(rename_all = "camelCase")]
3234pub struct PermissionPromptRequestPath {
3235    /// Underlying permission kind that needs path approval
3236    pub access_kind: PermissionPromptRequestPathAccessKind,
3237    /// Auto-approval judge information for this request; present only when auto mode is enabled.
3238    ///
3239    /// <div class="warning">
3240    ///
3241    /// **Experimental.** This type is part of an experimental wire-protocol surface
3242    /// and may change or be removed in future SDK or CLI releases.
3243    ///
3244    /// </div>
3245    #[serde(skip_serializing_if = "Option::is_none")]
3246    pub auto_approval: Option<PermissionAutoApproval>,
3247    /// Prompt kind discriminator
3248    pub kind: PermissionPromptRequestPathKind,
3249    /// File paths that require explicit approval
3250    pub paths: Vec<String>,
3251    /// Tool call ID that triggered this permission request
3252    #[serde(skip_serializing_if = "Option::is_none")]
3253    pub tool_call_id: Option<String>,
3254}
3255
3256/// Hook confirmation permission prompt
3257#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3258#[serde(rename_all = "camelCase")]
3259pub struct PermissionPromptRequestHook {
3260    /// Auto-approval judge information for this request; present only when auto mode is enabled.
3261    ///
3262    /// <div class="warning">
3263    ///
3264    /// **Experimental.** This type is part of an experimental wire-protocol surface
3265    /// and may change or be removed in future SDK or CLI releases.
3266    ///
3267    /// </div>
3268    #[serde(skip_serializing_if = "Option::is_none")]
3269    pub auto_approval: Option<PermissionAutoApproval>,
3270    /// Optional message from the hook explaining why confirmation is needed
3271    #[serde(skip_serializing_if = "Option::is_none")]
3272    pub hook_message: Option<String>,
3273    /// Prompt kind discriminator
3274    pub kind: PermissionPromptRequestHookKind,
3275    /// Arguments of the tool call being gated
3276    #[serde(skip_serializing_if = "Option::is_none")]
3277    pub tool_args: Option<serde_json::Value>,
3278    /// Tool call ID that triggered this permission request
3279    #[serde(skip_serializing_if = "Option::is_none")]
3280    pub tool_call_id: Option<String>,
3281    /// Name of the tool the hook is gating
3282    pub tool_name: String,
3283}
3284
3285/// Extension management permission prompt
3286#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3287#[serde(rename_all = "camelCase")]
3288pub struct PermissionPromptRequestExtensionManagement {
3289    /// Auto-approval judge information for this request; present only when auto mode is enabled.
3290    ///
3291    /// <div class="warning">
3292    ///
3293    /// **Experimental.** This type is part of an experimental wire-protocol surface
3294    /// and may change or be removed in future SDK or CLI releases.
3295    ///
3296    /// </div>
3297    #[serde(skip_serializing_if = "Option::is_none")]
3298    pub auto_approval: Option<PermissionAutoApproval>,
3299    /// Name of the extension being managed
3300    #[serde(skip_serializing_if = "Option::is_none")]
3301    pub extension_name: Option<String>,
3302    /// Prompt kind discriminator
3303    pub kind: PermissionPromptRequestExtensionManagementKind,
3304    /// The extension management operation (scaffold, reload)
3305    pub operation: String,
3306    /// Tool call ID that triggered this permission request
3307    #[serde(skip_serializing_if = "Option::is_none")]
3308    pub tool_call_id: Option<String>,
3309}
3310
3311/// Extension permission access prompt
3312#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3313#[serde(rename_all = "camelCase")]
3314pub struct PermissionPromptRequestExtensionPermissionAccess {
3315    /// Auto-approval judge information for this request; present only when auto mode is enabled.
3316    ///
3317    /// <div class="warning">
3318    ///
3319    /// **Experimental.** This type is part of an experimental wire-protocol surface
3320    /// and may change or be removed in future SDK or CLI releases.
3321    ///
3322    /// </div>
3323    #[serde(skip_serializing_if = "Option::is_none")]
3324    pub auto_approval: Option<PermissionAutoApproval>,
3325    /// Capabilities the extension is requesting
3326    pub capabilities: Vec<String>,
3327    /// Name of the extension requesting permission access
3328    pub extension_name: String,
3329    /// Prompt kind discriminator
3330    pub kind: PermissionPromptRequestExtensionPermissionAccessKind,
3331    /// Tool call ID that triggered this permission request
3332    #[serde(skip_serializing_if = "Option::is_none")]
3333    pub tool_call_id: Option<String>,
3334}
3335
3336/// Session event "permission.requested". Permission request notification requiring client approval with request details
3337#[derive(Debug, Clone, Serialize, Deserialize)]
3338#[serde(rename_all = "camelCase")]
3339pub struct PermissionRequestedData {
3340    /// Details of the permission being requested
3341    pub permission_request: PermissionRequest,
3342    /// Derived user-facing permission prompt details for UI consumers
3343    #[serde(skip_serializing_if = "Option::is_none")]
3344    pub prompt_request: Option<PermissionPromptRequest>,
3345    /// Unique identifier for this permission request; used to respond via session.respondToPermission()
3346    pub request_id: RequestId,
3347    /// When true, this permission was already resolved by a permissionRequest hook and requires no client action
3348    #[serde(skip_serializing_if = "Option::is_none")]
3349    pub resolved_by_hook: Option<bool>,
3350}
3351
3352/// Permission response variant indicating the request was approved without persisting an approval rule.
3353#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3354#[serde(rename_all = "camelCase")]
3355pub struct PermissionApproved {
3356    /// The permission request was approved
3357    pub kind: PermissionApprovedKind,
3358}
3359
3360/// Session-scoped tool-approval rule for specific shell command identifiers.
3361#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3362#[serde(rename_all = "camelCase")]
3363pub struct UserToolSessionApprovalCommands {
3364    /// Command identifiers approved by the user
3365    pub command_identifiers: Vec<String>,
3366    /// Command approval kind
3367    pub kind: UserToolSessionApprovalCommandsKind,
3368}
3369
3370/// Session-scoped tool-approval rule for read-only filesystem operations.
3371#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3372#[serde(rename_all = "camelCase")]
3373pub struct UserToolSessionApprovalRead {
3374    /// Read approval kind
3375    pub kind: UserToolSessionApprovalReadKind,
3376}
3377
3378/// Session-scoped tool-approval rule for filesystem write operations.
3379#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3380#[serde(rename_all = "camelCase")]
3381pub struct UserToolSessionApprovalWrite {
3382    /// Write approval kind
3383    pub kind: UserToolSessionApprovalWriteKind,
3384}
3385
3386/// Session-scoped tool-approval rule for an MCP server tool, or all tools on the server when `toolName` is null.
3387#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3388#[serde(rename_all = "camelCase")]
3389pub struct UserToolSessionApprovalMcp {
3390    /// MCP tool approval kind
3391    pub kind: UserToolSessionApprovalMcpKind,
3392    /// MCP server name
3393    pub server_name: String,
3394    /// Optional MCP tool name, or null for all tools on the server
3395    pub tool_name: Option<String>,
3396}
3397
3398/// Session-scoped tool-approval rule for writes to long-term memory.
3399#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3400#[serde(rename_all = "camelCase")]
3401pub struct UserToolSessionApprovalMemory {
3402    /// Memory approval kind
3403    pub kind: UserToolSessionApprovalMemoryKind,
3404}
3405
3406/// Session-scoped tool-approval rule for a custom tool, keyed by tool name.
3407#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3408#[serde(rename_all = "camelCase")]
3409pub struct UserToolSessionApprovalCustomTool {
3410    /// Custom tool approval kind
3411    pub kind: UserToolSessionApprovalCustomToolKind,
3412    /// Custom tool name
3413    pub tool_name: String,
3414}
3415
3416/// Session-scoped tool-approval rule for extension-management operations, optionally narrowed by operation.
3417#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3418#[serde(rename_all = "camelCase")]
3419pub struct UserToolSessionApprovalExtensionManagement {
3420    /// Extension management approval kind
3421    pub kind: UserToolSessionApprovalExtensionManagementKind,
3422    /// Optional operation identifier
3423    #[serde(skip_serializing_if = "Option::is_none")]
3424    pub operation: Option<String>,
3425}
3426
3427/// Session-scoped tool-approval rule for an extension's permission-gated capability access, keyed by extension name.
3428#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3429#[serde(rename_all = "camelCase")]
3430pub struct UserToolSessionApprovalExtensionPermissionAccess {
3431    /// Extension name
3432    pub extension_name: String,
3433    /// Extension permission access approval kind
3434    pub kind: UserToolSessionApprovalExtensionPermissionAccessKind,
3435}
3436
3437/// Permission response variant that approves a request and remembers the provided approval for the rest of the session.
3438#[derive(Debug, Clone, Serialize, Deserialize)]
3439#[serde(rename_all = "camelCase")]
3440pub struct PermissionApprovedForSession {
3441    /// The approval to add as a session-scoped rule
3442    pub approval: UserToolSessionApproval,
3443    /// Approved and remembered for the rest of the session
3444    pub kind: PermissionApprovedForSessionKind,
3445}
3446
3447/// Permission response variant that approves a request and persists the provided approval to a project location key.
3448#[derive(Debug, Clone, Serialize, Deserialize)]
3449#[serde(rename_all = "camelCase")]
3450pub struct PermissionApprovedForLocation {
3451    /// The approval to persist for this location
3452    pub approval: UserToolSessionApproval,
3453    /// Approved and persisted for this project location
3454    pub kind: PermissionApprovedForLocationKind,
3455    /// The location key (git root or cwd) to persist the approval to
3456    pub location_key: String,
3457}
3458
3459/// Permission response variant indicating the request was cancelled before use, with an optional reason.
3460#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3461#[serde(rename_all = "camelCase")]
3462pub struct PermissionCancelled {
3463    /// The permission request was cancelled before a response was used
3464    pub kind: PermissionCancelledKind,
3465    /// Optional explanation of why the request was cancelled
3466    #[serde(skip_serializing_if = "Option::is_none")]
3467    pub reason: Option<String>,
3468}
3469
3470/// A permission approval or denial rule matched against a tool request, identified by a rule kind with an optional argument value.
3471#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3472#[serde(rename_all = "camelCase")]
3473pub struct PermissionRule {
3474    /// Argument value matched against the request, or null when the rule kind has no argument (e.g. 'read', 'write', 'memory').
3475    pub argument: Option<String>,
3476    /// The rule kind, such as Shell or GitHubMCP
3477    pub kind: String,
3478}
3479
3480/// Permission response variant denied because matching approval rules explicitly blocked the request.
3481#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3482#[serde(rename_all = "camelCase")]
3483pub struct PermissionDeniedByRules {
3484    /// Denied because approval rules explicitly blocked it
3485    pub kind: PermissionDeniedByRulesKind,
3486    /// Rules that denied the request
3487    pub rules: Vec<PermissionRule>,
3488}
3489
3490/// Permission response variant denied because no approval rule matched and user confirmation was unavailable.
3491#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3492#[serde(rename_all = "camelCase")]
3493pub struct PermissionDeniedNoApprovalRuleAndCouldNotRequestFromUser {
3494    /// Denied because no approval rule matched and user confirmation was unavailable
3495    pub kind: PermissionDeniedNoApprovalRuleAndCouldNotRequestFromUserKind,
3496}
3497
3498/// Permission response variant denied in an interactive user prompt, with optional feedback and force-reject flag.
3499#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3500#[serde(rename_all = "camelCase")]
3501pub struct PermissionDeniedInteractivelyByUser {
3502    /// Optional feedback from the user explaining the denial
3503    #[serde(skip_serializing_if = "Option::is_none")]
3504    pub feedback: Option<String>,
3505    /// Whether to force-reject the current agent turn
3506    #[serde(skip_serializing_if = "Option::is_none")]
3507    pub force_reject: Option<bool>,
3508    /// Denied by the user during an interactive prompt
3509    pub kind: PermissionDeniedInteractivelyByUserKind,
3510}
3511
3512/// Permission response variant denying a path under content exclusion policy, with the path and message.
3513#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3514#[serde(rename_all = "camelCase")]
3515pub struct PermissionDeniedByContentExclusionPolicy {
3516    /// Denied by the organization's content exclusion policy
3517    pub kind: PermissionDeniedByContentExclusionPolicyKind,
3518    /// Human-readable explanation of why the path was excluded
3519    pub message: String,
3520    /// File path that triggered the exclusion
3521    pub path: String,
3522}
3523
3524/// Permission response variant denied by a permission-request hook, with optional message and interrupt flag.
3525#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3526#[serde(rename_all = "camelCase")]
3527pub struct PermissionDeniedByPermissionRequestHook {
3528    /// Whether to interrupt the current agent turn
3529    #[serde(skip_serializing_if = "Option::is_none")]
3530    pub interrupt: Option<bool>,
3531    /// Denied by a permission request hook registered by an extension or plugin
3532    pub kind: PermissionDeniedByPermissionRequestHookKind,
3533    /// Optional message from the hook explaining the denial
3534    #[serde(skip_serializing_if = "Option::is_none")]
3535    pub message: Option<String>,
3536}
3537
3538/// Session event "permission.completed". Permission request completion notification signaling UI dismissal
3539#[derive(Debug, Clone, Serialize, Deserialize)]
3540#[serde(rename_all = "camelCase")]
3541pub struct PermissionCompletedData {
3542    /// Request ID of the resolved permission request; clients should dismiss any UI for this request
3543    pub request_id: RequestId,
3544    /// The result of the permission request
3545    pub result: PermissionResult,
3546    /// Optional tool call ID associated with this permission prompt; clients may use it to correlate UI created from tool-scoped prompts
3547    #[serde(skip_serializing_if = "Option::is_none")]
3548    pub tool_call_id: Option<String>,
3549}
3550
3551/// Session event "user_input.requested". User input request notification with question and optional predefined choices
3552#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3553#[serde(rename_all = "camelCase")]
3554pub struct UserInputRequestedData {
3555    /// Whether the user can provide a free-form text response in addition to predefined choices
3556    #[serde(skip_serializing_if = "Option::is_none")]
3557    pub allow_freeform: Option<bool>,
3558    /// Predefined choices for the user to select from, if applicable
3559    #[serde(skip_serializing_if = "Option::is_none")]
3560    pub choices: Option<Vec<String>>,
3561    /// The question or prompt to present to the user
3562    pub question: String,
3563    /// Unique identifier for this input request; used to respond via session.respondToUserInput()
3564    pub request_id: RequestId,
3565    /// The LLM-assigned tool call ID that triggered this request; used by remote UIs to correlate responses
3566    #[serde(skip_serializing_if = "Option::is_none")]
3567    pub tool_call_id: Option<String>,
3568}
3569
3570/// Session event "user_input.completed". User input request completion with the user's response
3571#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3572#[serde(rename_all = "camelCase")]
3573pub struct UserInputCompletedData {
3574    /// The user's answer to the input request
3575    #[serde(skip_serializing_if = "Option::is_none")]
3576    pub answer: Option<String>,
3577    /// Request ID of the resolved user input request; clients should dismiss any UI for this request
3578    pub request_id: RequestId,
3579    /// Whether the answer was typed as free-form text rather than selected from choices
3580    #[serde(skip_serializing_if = "Option::is_none")]
3581    pub was_freeform: Option<bool>,
3582}
3583
3584/// JSON Schema describing the form fields to present to the user (form mode only)
3585#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3586#[serde(rename_all = "camelCase")]
3587pub struct ElicitationRequestedSchema {
3588    /// Form field definitions, keyed by field name
3589    pub properties: HashMap<String, serde_json::Value>,
3590    /// List of required field names
3591    #[serde(skip_serializing_if = "Option::is_none")]
3592    pub required: Option<Vec<String>>,
3593    /// Schema type indicator (always 'object')
3594    pub r#type: ElicitationRequestedSchemaType,
3595}
3596
3597/// Session event "elicitation.requested". Elicitation request; may be form-based (structured input) or URL-based (browser redirect)
3598#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3599#[serde(rename_all = "camelCase")]
3600pub struct ElicitationRequestedData {
3601    /// The source that initiated the request (MCP server name, or absent for agent-initiated)
3602    #[serde(skip_serializing_if = "Option::is_none")]
3603    pub elicitation_source: Option<String>,
3604    /// Message describing what information is needed from the user
3605    pub message: String,
3606    /// Elicitation mode; "form" for structured input, "url" for browser-based. Defaults to "form" when absent.
3607    #[serde(skip_serializing_if = "Option::is_none")]
3608    pub mode: Option<ElicitationRequestedMode>,
3609    /// JSON Schema describing the form fields to present to the user (form mode only)
3610    #[serde(skip_serializing_if = "Option::is_none")]
3611    pub requested_schema: Option<ElicitationRequestedSchema>,
3612    /// Unique identifier for this elicitation request; used to respond via session.respondToElicitation()
3613    pub request_id: RequestId,
3614    /// Tool call ID from the LLM completion; used to correlate with CompletionChunk.toolCall.id for remote UIs
3615    #[serde(skip_serializing_if = "Option::is_none")]
3616    pub tool_call_id: Option<String>,
3617    /// URL to open in the user's browser (url mode only)
3618    #[serde(skip_serializing_if = "Option::is_none")]
3619    pub url: Option<String>,
3620}
3621
3622/// Session event "elicitation.completed". Elicitation request completion with the user's response
3623#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3624#[serde(rename_all = "camelCase")]
3625pub struct ElicitationCompletedData {
3626    /// The user action: "accept" (submitted form), "decline" (explicitly refused), or "cancel" (dismissed)
3627    #[serde(skip_serializing_if = "Option::is_none")]
3628    pub action: Option<ElicitationCompletedAction>,
3629    /// The submitted form data when action is 'accept'; keys match the requested schema fields
3630    #[serde(skip_serializing_if = "Option::is_none")]
3631    pub content: Option<HashMap<String, serde_json::Value>>,
3632    /// Request ID of the resolved elicitation request; clients should dismiss any UI for this request
3633    pub request_id: RequestId,
3634}
3635
3636/// Session event "sampling.requested". Sampling request from an MCP server; contains the server name and a requestId for correlation
3637#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3638#[serde(rename_all = "camelCase")]
3639pub struct SamplingRequestedData {
3640    /// The JSON-RPC request ID from the MCP protocol
3641    pub mcp_request_id: serde_json::Value,
3642    /// Unique identifier for this sampling request; used to respond via session.respondToSampling()
3643    pub request_id: RequestId,
3644    /// Name of the MCP server that initiated the sampling request
3645    pub server_name: String,
3646}
3647
3648/// Session event "sampling.completed". Sampling request completion notification signaling UI dismissal
3649#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3650#[serde(rename_all = "camelCase")]
3651pub struct SamplingCompletedData {
3652    /// Request ID of the resolved sampling request; clients should dismiss any UI for this request
3653    pub request_id: RequestId,
3654}
3655
3656/// Static OAuth client configuration, if the server specifies one
3657#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3658#[serde(rename_all = "camelCase")]
3659pub struct McpOauthRequiredStaticClientConfig {
3660    /// OAuth client ID for the server
3661    pub client_id: String,
3662    /// Optional OAuth client secret for confidential static clients, when the runtime can resolve one
3663    #[serde(skip_serializing_if = "Option::is_none")]
3664    pub client_secret: Option<String>,
3665    /// 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).
3666    #[serde(skip_serializing_if = "Option::is_none")]
3667    pub grant_type: Option<McpOauthRequiredStaticClientConfigGrantType>,
3668    /// Whether this is a public OAuth client
3669    #[serde(skip_serializing_if = "Option::is_none")]
3670    pub public_client: Option<bool>,
3671}
3672
3673/// OAuth WWW-Authenticate parameters parsed from an MCP auth challenge
3674#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3675#[serde(rename_all = "camelCase")]
3676pub struct McpOauthWWWAuthenticateParams {
3677    /// OAuth error from the WWW-Authenticate error parameter, if present
3678    #[serde(skip_serializing_if = "Option::is_none")]
3679    pub error: Option<String>,
3680    /// Protected resource metadata URL from the WWW-Authenticate resource_metadata parameter, if present
3681    #[serde(skip_serializing_if = "Option::is_none")]
3682    pub resource_metadata_url: Option<String>,
3683    /// Requested OAuth scopes from the WWW-Authenticate scope parameter, if present
3684    #[serde(skip_serializing_if = "Option::is_none")]
3685    pub scope: Option<String>,
3686}
3687
3688/// Session event "mcp.oauth_required". OAuth authentication request for an MCP server
3689#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3690#[serde(rename_all = "camelCase")]
3691pub struct McpOauthRequiredData {
3692    /// Why the runtime is requesting host-provided OAuth credentials.
3693    pub reason: McpOauthRequestReason,
3694    /// Unique identifier for this OAuth request; used to respond via session.mcp.oauth.handlePendingRequest
3695    pub request_id: RequestId,
3696    /// Raw OAuth protected-resource metadata document fetched for the MCP server, if available
3697    #[serde(skip_serializing_if = "Option::is_none")]
3698    pub resource_metadata: Option<String>,
3699    /// Display name of the MCP server that requires OAuth
3700    pub server_name: String,
3701    /// URL of the MCP server that requires OAuth
3702    pub server_url: String,
3703    /// Static OAuth client configuration, if the server specifies one
3704    #[serde(skip_serializing_if = "Option::is_none")]
3705    pub static_client_config: Option<McpOauthRequiredStaticClientConfig>,
3706    /// OAuth WWW-Authenticate parameters parsed from the auth challenge, if available
3707    #[serde(skip_serializing_if = "Option::is_none")]
3708    pub www_authenticate_params: Option<McpOauthWWWAuthenticateParams>,
3709}
3710
3711/// Session event "mcp.oauth_completed". MCP OAuth request completion notification
3712#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3713#[serde(rename_all = "camelCase")]
3714pub struct McpOauthCompletedData {
3715    /// How the pending OAuth request was completed
3716    pub outcome: McpOauthCompletionOutcome,
3717    /// Request ID of the resolved OAuth request
3718    pub request_id: RequestId,
3719}
3720
3721/// Session event "mcp.headers_refresh_required". Dynamic headers refresh request for a remote MCP server
3722#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3723#[serde(rename_all = "camelCase")]
3724pub struct McpHeadersRefreshRequiredData {
3725    /// Why dynamic headers are being requested.
3726    pub reason: McpHeadersRefreshRequiredReason,
3727    /// Unique identifier for this headers refresh request; used to respond via session.mcp.headers.handlePendingHeadersRefreshRequest()
3728    pub request_id: RequestId,
3729    /// Display name of the remote MCP server requesting headers
3730    pub server_name: String,
3731    /// URL of the remote MCP server requesting headers
3732    pub server_url: String,
3733}
3734
3735/// Session event "mcp.headers_refresh_completed". MCP headers refresh request completion notification
3736#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3737#[serde(rename_all = "camelCase")]
3738pub struct McpHeadersRefreshCompletedData {
3739    /// How the pending MCP headers refresh request resolved.
3740    pub outcome: McpHeadersRefreshCompletedOutcome,
3741    /// Request ID of the resolved headers refresh request
3742    pub request_id: RequestId,
3743}
3744
3745/// Session event "session.custom_notification". Opaque custom notification data. Consumers may branch on source and name, but payload semantics are source-defined.
3746#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3747#[serde(rename_all = "camelCase")]
3748pub struct SessionCustomNotificationData {
3749    /// Source-defined custom notification name
3750    pub name: String,
3751    /// Source-defined JSON payload for the custom notification
3752    pub payload: serde_json::Value,
3753    /// Namespace for the custom notification producer
3754    pub source: String,
3755    /// Optional source-defined string identifiers describing the payload subject
3756    #[serde(skip_serializing_if = "Option::is_none")]
3757    pub subject: Option<HashMap<String, String>>,
3758    /// Optional source-defined payload schema version
3759    #[serde(skip_serializing_if = "Option::is_none")]
3760    pub version: Option<i64>,
3761}
3762
3763/// Session event "external_tool.requested". External tool invocation request for client-side tool execution
3764#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3765#[serde(rename_all = "camelCase")]
3766pub struct ExternalToolRequestedData {
3767    /// Arguments to pass to the external tool
3768    #[serde(skip_serializing_if = "Option::is_none")]
3769    pub arguments: Option<serde_json::Value>,
3770    /// Unique identifier for this request; used to respond via session.respondToExternalTool()
3771    pub request_id: RequestId,
3772    /// Session ID that this external tool request belongs to
3773    pub session_id: SessionId,
3774    /// Tool call ID assigned to this external tool invocation
3775    pub tool_call_id: String,
3776    /// Name of the external tool to invoke
3777    pub tool_name: String,
3778    /// W3C Trace Context traceparent header for the execute_tool span
3779    #[serde(skip_serializing_if = "Option::is_none")]
3780    pub traceparent: Option<String>,
3781    /// W3C Trace Context tracestate header for the execute_tool span
3782    #[serde(skip_serializing_if = "Option::is_none")]
3783    pub tracestate: Option<String>,
3784    /// Active session working directory, when known.
3785    #[serde(skip_serializing_if = "Option::is_none")]
3786    pub working_directory: Option<String>,
3787}
3788
3789/// Session event "external_tool.completed". External tool completion notification signaling UI dismissal
3790#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3791#[serde(rename_all = "camelCase")]
3792pub struct ExternalToolCompletedData {
3793    /// Request ID of the resolved external tool request; clients should dismiss any UI for this request
3794    pub request_id: RequestId,
3795}
3796
3797/// Session event "command.queued". Queued slash command dispatch request for client execution
3798#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3799#[serde(rename_all = "camelCase")]
3800pub struct CommandQueuedData {
3801    /// The slash command text to be executed (e.g., /help, /clear)
3802    pub command: String,
3803    /// Unique identifier for this request; used to respond via session.respondToQueuedCommand()
3804    pub request_id: RequestId,
3805}
3806
3807/// Session event "command.execute". Registered command dispatch request routed to the owning client
3808#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3809#[serde(rename_all = "camelCase")]
3810pub struct CommandExecuteData {
3811    /// Raw argument string after the command name
3812    pub args: String,
3813    /// The full command text (e.g., /deploy production)
3814    pub command: String,
3815    /// Command name without leading /
3816    pub command_name: String,
3817    /// Unique identifier; used to respond via session.commands.handlePendingCommand()
3818    pub request_id: RequestId,
3819}
3820
3821/// Session event "command.completed". Queued command completion notification signaling UI dismissal
3822#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3823#[serde(rename_all = "camelCase")]
3824pub struct CommandCompletedData {
3825    /// Request ID of the resolved command request; clients should dismiss any UI for this request
3826    pub request_id: RequestId,
3827}
3828
3829/// Session event "auto_mode_switch.requested". Auto mode switch request notification requiring user approval
3830#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3831#[serde(rename_all = "camelCase")]
3832pub struct AutoModeSwitchRequestedData {
3833    /// The rate limit error code that triggered this request
3834    #[serde(skip_serializing_if = "Option::is_none")]
3835    pub error_code: Option<String>,
3836    /// Unique identifier for this request; used to respond via session.respondToAutoModeSwitch()
3837    pub request_id: RequestId,
3838    /// Seconds until the rate limit resets, when known. Lets clients render a humanized reset time alongside the prompt.
3839    #[serde(skip_serializing_if = "Option::is_none")]
3840    pub retry_after_seconds: Option<i64>,
3841}
3842
3843/// Session event "auto_mode_switch.completed". Auto mode switch completion notification
3844#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3845#[serde(rename_all = "camelCase")]
3846pub struct AutoModeSwitchCompletedData {
3847    /// Request ID of the resolved request; clients should dismiss any UI for this request
3848    pub request_id: RequestId,
3849    /// The user's auto-mode-switch choice
3850    pub response: AutoModeSwitchResponse,
3851}
3852
3853/// Session event "session_limits_exhausted.requested". Session limit exhaustion notification requiring user action.
3854#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3855#[serde(rename_all = "camelCase")]
3856pub struct SessionLimitsExhaustedRequestedData {
3857    /// Configured max AI Credits for the current accounting window.
3858    pub max_ai_credits: f64,
3859    /// Unique identifier for this request; used to respond via session.ui.handlePendingSessionLimitsExhausted().
3860    pub request_id: RequestId,
3861    /// AI Credits already consumed in the current accounting window.
3862    pub used_ai_credits: f64,
3863}
3864
3865/// The user's selected action for an exhausted session limit.
3866#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3867#[serde(rename_all = "camelCase")]
3868pub struct SessionLimitsExhaustedResponse {
3869    /// Action selected by the user.
3870    pub action: SessionLimitsExhaustedResponseAction,
3871    /// AI Credits to add to the current max when action is 'add'.
3872    #[serde(skip_serializing_if = "Option::is_none")]
3873    pub additional_ai_credits: Option<f64>,
3874    /// New absolute max AI Credits when action is 'set'.
3875    #[serde(skip_serializing_if = "Option::is_none")]
3876    pub max_ai_credits: Option<f64>,
3877}
3878
3879/// Session event "session_limits_exhausted.completed". Session limit exhaustion prompt completion notification.
3880#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3881#[serde(rename_all = "camelCase")]
3882pub struct SessionLimitsExhaustedCompletedData {
3883    /// Request ID of the resolved request; clients should dismiss any UI for this request.
3884    pub request_id: RequestId,
3885    /// The user's selected session-limit action.
3886    pub response: SessionLimitsExhaustedResponse,
3887}
3888
3889/// Session event "session.auto_mode_resolved". Auto Intent resolution: the concrete model the session settled on for the first prompt of an auto-mode session, and why. Lets SDK clients render the chosen model and the full reason it was picked. The core selection fields (chosenModel/reasoningBucket/categoryScores) are stable; the routing-analytics fields (predictedLabel/confidence/candidateModels) mirror the upstream intent service and may evolve, hence the event's experimental stability.
3890///
3891/// <div class="warning">
3892///
3893/// **Experimental.** This type is part of an experimental wire-protocol surface
3894/// and may change or be removed in future SDK or CLI releases.
3895///
3896/// </div>
3897#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3898#[serde(rename_all = "camelCase")]
3899pub struct SessionAutoModeResolvedData {
3900    /// Ordered candidate model list the router returned, when not a fallback
3901    #[serde(skip_serializing_if = "Option::is_none")]
3902    pub candidate_models: Option<Vec<String>>,
3903    /// Per-category classifier scores (0-1) behind the bucket: the granular HYDRA capability scores (reasoning, code_gen, debugging, tool_use), or the binary needs_reasoning/no_reasoning scores when HYDRA didn't run. Lets clients show a breakdown rather than just the bucket.
3904    #[serde(skip_serializing_if = "Option::is_none")]
3905    pub category_scores: Option<HashMap<String, f64>>,
3906    /// The concrete model the session will use after any intent refinement
3907    pub chosen_model: String,
3908    /// Classifier confidence for the predicted label, when available
3909    #[serde(skip_serializing_if = "Option::is_none")]
3910    pub confidence: Option<f64>,
3911    /// The predicted classifier label (e.g. `needs_reasoning`), when available
3912    #[serde(skip_serializing_if = "Option::is_none")]
3913    pub predicted_label: Option<String>,
3914    /// Coarse request-difficulty bucket, for explaining why a model was chosen ("picked X because this looks like high-reasoning work")
3915    #[serde(skip_serializing_if = "Option::is_none")]
3916    pub reasoning_bucket: Option<AutoModeResolvedReasoningBucket>,
3917}
3918
3919/// A single slash command available in the session, as listed by the `commands.changed` event.
3920#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3921#[serde(rename_all = "camelCase")]
3922pub struct CommandsChangedCommand {
3923    /// Optional human-readable command description.
3924    #[serde(skip_serializing_if = "Option::is_none")]
3925    pub description: Option<String>,
3926    /// Slash command name without the leading slash.
3927    pub name: String,
3928}
3929
3930/// Session event "commands.changed". SDK command registration change notification
3931#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3932#[serde(rename_all = "camelCase")]
3933pub struct CommandsChangedData {
3934    /// Current list of registered SDK commands
3935    pub commands: Vec<CommandsChangedCommand>,
3936}
3937
3938/// UI capability changes
3939#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3940#[serde(rename_all = "camelCase")]
3941pub struct CapabilitiesChangedUI {
3942    /// Whether canvas rendering is now supported
3943    #[serde(skip_serializing_if = "Option::is_none")]
3944    pub canvases: Option<bool>,
3945    /// Whether elicitation is now supported
3946    #[serde(skip_serializing_if = "Option::is_none")]
3947    pub elicitation: Option<bool>,
3948    /// Whether MCP Apps (SEP-1865) UI passthrough is now supported
3949    #[serde(skip_serializing_if = "Option::is_none")]
3950    pub mcp_apps: Option<bool>,
3951}
3952
3953/// Session event "capabilities.changed". Session capability change notification
3954#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3955#[serde(rename_all = "camelCase")]
3956pub struct CapabilitiesChangedData {
3957    /// UI capability changes
3958    #[serde(skip_serializing_if = "Option::is_none")]
3959    pub ui: Option<CapabilitiesChangedUI>,
3960}
3961
3962/// Session event "exit_plan_mode.requested". Plan approval request with plan content and available user actions
3963#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3964#[serde(rename_all = "camelCase")]
3965pub struct ExitPlanModeRequestedData {
3966    /// Available actions the user can take
3967    pub actions: Vec<ExitPlanModeAction>,
3968    /// Full content of the plan file
3969    pub plan_content: String,
3970    /// Recommended action to preselect for the user
3971    pub recommended_action: ExitPlanModeAction,
3972    /// Unique identifier for this request; used to respond via session.respondToExitPlanMode()
3973    pub request_id: RequestId,
3974    /// Summary of the plan that was created
3975    pub summary: String,
3976}
3977
3978/// Session event "exit_plan_mode.completed". Plan mode exit completion with the user's approval decision and optional feedback
3979#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3980#[serde(rename_all = "camelCase")]
3981pub struct ExitPlanModeCompletedData {
3982    /// Whether the plan was approved by the user
3983    #[serde(skip_serializing_if = "Option::is_none")]
3984    pub approved: Option<bool>,
3985    /// Whether edits should be auto-approved without confirmation
3986    #[serde(skip_serializing_if = "Option::is_none")]
3987    pub auto_approve_edits: Option<bool>,
3988    /// Free-form feedback from the user if they requested changes to the plan
3989    #[serde(skip_serializing_if = "Option::is_none")]
3990    pub feedback: Option<String>,
3991    /// Request ID of the resolved exit plan mode request; clients should dismiss any UI for this request
3992    pub request_id: RequestId,
3993    /// Action selected by the user
3994    #[serde(skip_serializing_if = "Option::is_none")]
3995    pub selected_action: Option<ExitPlanModeAction>,
3996}
3997
3998/// Session event "session.tools_updated". Payload of `session.tools_updated` identifying the model whose resolved tools were updated.
3999#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4000#[serde(rename_all = "camelCase")]
4001pub struct SessionToolsUpdatedData {
4002    /// Identifier of the model the resolved tools apply to.
4003    pub model: String,
4004}
4005
4006/// Session event "session.background_tasks_changed". Empty payload for `session.background_tasks_changed`, indicating background task state changed.
4007#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4008#[serde(rename_all = "camelCase")]
4009pub struct SessionBackgroundTasksChangedData {}
4010
4011/// A single resolved skill in `session.skills_loaded`, including source, invocability, enabled state, path, and argument hint.
4012#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4013#[serde(rename_all = "camelCase")]
4014pub struct SkillsLoadedSkill {
4015    /// Optional freeform hint describing the skill's expected arguments, from the `argument-hint` frontmatter field
4016    #[serde(skip_serializing_if = "Option::is_none")]
4017    pub argument_hint: Option<String>,
4018    /// Description of what the skill does
4019    pub description: String,
4020    /// Whether the skill is currently enabled
4021    pub enabled: bool,
4022    /// Unique identifier for the skill
4023    pub name: String,
4024    /// Absolute path to the skill file, if available
4025    #[serde(skip_serializing_if = "Option::is_none")]
4026    pub path: Option<String>,
4027    /// Source location type (e.g., project, personal-copilot, plugin, builtin)
4028    pub source: SkillSource,
4029    /// Whether the skill can be invoked by the user as a slash command
4030    pub user_invocable: bool,
4031}
4032
4033/// Session event "session.skills_loaded". Payload of `session.skills_loaded` listing resolved skill metadata.
4034#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4035#[serde(rename_all = "camelCase")]
4036pub struct SessionSkillsLoadedData {
4037    /// Array of resolved skill metadata
4038    pub skills: Vec<SkillsLoadedSkill>,
4039}
4040
4041/// A single loaded custom agent in `session.custom_agents_updated`, with identity, source, tools, invocability, and model override.
4042#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4043#[serde(rename_all = "camelCase")]
4044pub struct CustomAgentsUpdatedAgent {
4045    /// Description of what the agent does
4046    pub description: String,
4047    /// Human-readable display name
4048    pub display_name: String,
4049    /// Unique identifier for the agent
4050    pub id: String,
4051    /// Model override for this agent, if set
4052    #[serde(skip_serializing_if = "Option::is_none")]
4053    pub model: Option<String>,
4054    /// Internal name of the agent
4055    pub name: String,
4056    /// Source location: user, project, inherited, remote, or plugin
4057    pub source: String,
4058    /// List of tool names available to this agent, or null when all tools are available
4059    pub tools: Option<Vec<String>>,
4060    /// Whether the agent can be selected by the user
4061    pub user_invocable: bool,
4062}
4063
4064/// Session event "session.custom_agents_updated". Payload of `session.custom_agents_updated` with loaded custom agents plus non-fatal warnings and fatal errors.
4065#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4066#[serde(rename_all = "camelCase")]
4067pub struct SessionCustomAgentsUpdatedData {
4068    /// Array of loaded custom agent metadata
4069    pub agents: Vec<CustomAgentsUpdatedAgent>,
4070    /// Fatal errors from agent loading
4071    pub errors: Vec<String>,
4072    /// Non-fatal warnings from agent loading
4073    pub warnings: Vec<String>,
4074}
4075
4076/// A single MCP server status summary in `session.mcp_servers_loaded`, including name, status, source, transport, and plugin metadata.
4077#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4078#[serde(rename_all = "camelCase")]
4079pub struct McpServersLoadedServer {
4080    /// Error message if the server failed to connect
4081    #[serde(skip_serializing_if = "Option::is_none")]
4082    pub error: Option<String>,
4083    /// Server name (config key)
4084    pub name: String,
4085    /// Name of the plugin that supplied the effective MCP server config, only when source is plugin
4086    #[serde(skip_serializing_if = "Option::is_none")]
4087    pub plugin_name: Option<String>,
4088    /// Version of the plugin that supplied the effective MCP server config, only when source is plugin
4089    #[serde(skip_serializing_if = "Option::is_none")]
4090    pub plugin_version: Option<String>,
4091    /// Configuration source: user, workspace, plugin, or builtin
4092    #[serde(skip_serializing_if = "Option::is_none")]
4093    pub source: Option<McpServerSource>,
4094    /// Connection status: connected, failed, needs-auth, pending, disabled, or not_configured
4095    pub status: McpServerStatus,
4096    /// Transport mechanism: stdio, http, sse (deprecated), or memory (in-process MCP server)
4097    #[serde(skip_serializing_if = "Option::is_none")]
4098    pub transport: Option<McpServerTransport>,
4099}
4100
4101/// Session event "session.mcp_servers_loaded". Payload of `session.mcp_servers_loaded` listing MCP server status summaries.
4102#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4103#[serde(rename_all = "camelCase")]
4104pub struct SessionMcpServersLoadedData {
4105    /// Array of MCP server status summaries
4106    pub servers: Vec<McpServersLoadedServer>,
4107}
4108
4109/// Session event "session.mcp_server_status_changed". Payload of `session.mcp_server_status_changed` for one MCP server's status and optional failure error.
4110#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4111#[serde(rename_all = "camelCase")]
4112pub struct SessionMcpServerStatusChangedData {
4113    /// Error message if the server entered a failed state
4114    #[serde(skip_serializing_if = "Option::is_none")]
4115    pub error: Option<String>,
4116    /// Name of the MCP server whose status changed
4117    pub server_name: String,
4118    /// Connection status: connected, failed, needs-auth, pending, disabled, or not_configured
4119    pub status: McpServerStatus,
4120}
4121
4122/// Session event "mcp.tools.list_changed". Payload of MCP `list_changed` notification events, emitted when an MCP server announces at runtime that one of its advertised lists changed.
4123#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4124#[serde(rename_all = "camelCase")]
4125pub struct McpToolsListChangedData {
4126    /// Name of the MCP server whose list changed
4127    pub server_name: String,
4128}
4129
4130/// Session event "mcp.resources.list_changed". Payload of MCP `list_changed` notification events, emitted when an MCP server announces at runtime that one of its advertised lists changed.
4131#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4132#[serde(rename_all = "camelCase")]
4133pub struct McpResourcesListChangedData {
4134    /// Name of the MCP server whose list changed
4135    pub server_name: String,
4136}
4137
4138/// Session event "mcp.prompts.list_changed". Payload of MCP `list_changed` notification events, emitted when an MCP server announces at runtime that one of its advertised lists changed.
4139#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4140#[serde(rename_all = "camelCase")]
4141pub struct McpPromptsListChangedData {
4142    /// Name of the MCP server whose list changed
4143    pub server_name: String,
4144}
4145
4146/// A single extension discovered by `session.extensions_loaded`, including qualified ID, source, and current status.
4147#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4148#[serde(rename_all = "camelCase")]
4149pub struct ExtensionsLoadedExtension {
4150    /// Source-qualified extension ID (e.g., 'project:my-ext', 'user:auth-helper', 'plugin:my-plugin:my-ext')
4151    pub id: String,
4152    /// Extension name (directory name)
4153    pub name: String,
4154    /// Discovery source
4155    pub source: ExtensionsLoadedExtensionSource,
4156    /// Current status: running, disabled, failed, or starting
4157    pub status: ExtensionsLoadedExtensionStatus,
4158}
4159
4160/// Session event "session.extensions_loaded". Payload of `session.extensions_loaded` listing discovered extensions and their statuses.
4161#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4162#[serde(rename_all = "camelCase")]
4163pub struct SessionExtensionsLoadedData {
4164    /// Array of discovered extensions and their status
4165    pub extensions: Vec<ExtensionsLoadedExtension>,
4166}
4167
4168/// Session event "session.canvas.opened". Payload of `session.canvas.opened` with canvas instance and provider IDs plus optional icon, title, status, URL, and input.
4169///
4170/// <div class="warning">
4171///
4172/// **Experimental.** This type is part of an experimental wire-protocol surface
4173/// and may change or be removed in future SDK or CLI releases.
4174///
4175/// </div>
4176#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4177#[serde(rename_all = "camelCase")]
4178pub struct SessionCanvasOpenedData {
4179    /// Provider-local canvas identifier
4180    pub canvas_id: String,
4181    /// Owning provider identifier
4182    pub extension_id: String,
4183    /// Owning extension display name, when available
4184    #[serde(skip_serializing_if = "Option::is_none")]
4185    pub extension_name: Option<String>,
4186    /// Host-local PNG path for the canvas icon, when supplied
4187    #[serde(skip_serializing_if = "Option::is_none")]
4188    pub icon: Option<String>,
4189    /// Input supplied when the instance was opened
4190    #[serde(skip_serializing_if = "Option::is_none")]
4191    pub input: Option<serde_json::Value>,
4192    /// Stable caller-supplied canvas instance identifier
4193    pub instance_id: String,
4194    /// Provider-supplied status text
4195    #[serde(skip_serializing_if = "Option::is_none")]
4196    pub status: Option<String>,
4197    /// Rendered title
4198    #[serde(skip_serializing_if = "Option::is_none")]
4199    pub title: Option<String>,
4200    /// URL for web-rendered canvases
4201    #[serde(skip_serializing_if = "Option::is_none")]
4202    pub url: Option<String>,
4203}
4204
4205/// A single action within a canvas declaration, with its name, optional description, and optional input schema.
4206///
4207/// <div class="warning">
4208///
4209/// **Experimental.** This type is part of an experimental wire-protocol surface
4210/// and may change or be removed in future SDK or CLI releases.
4211///
4212/// </div>
4213#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4214#[serde(rename_all = "camelCase")]
4215pub struct CanvasRegistryChangedCanvasAction {
4216    /// Action description
4217    #[serde(skip_serializing_if = "Option::is_none")]
4218    pub description: Option<String>,
4219    /// JSON Schema for action input
4220    #[serde(skip_serializing_if = "Option::is_none")]
4221    pub input_schema: Option<serde_json::Value>,
4222    /// Action name
4223    pub name: String,
4224}
4225
4226/// A single canvas declaration in `session.canvas.registry_changed`, including provider IDs, display metadata, input schema, and actions.
4227///
4228/// <div class="warning">
4229///
4230/// **Experimental.** This type is part of an experimental wire-protocol surface
4231/// and may change or be removed in future SDK or CLI releases.
4232///
4233/// </div>
4234#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4235#[serde(rename_all = "camelCase")]
4236pub struct CanvasRegistryChangedCanvas {
4237    /// Actions the agent or host may invoke
4238    #[serde(skip_serializing_if = "Option::is_none")]
4239    pub actions: Option<Vec<CanvasRegistryChangedCanvasAction>>,
4240    /// Provider-local canvas identifier
4241    pub canvas_id: String,
4242    /// Short, single-sentence description shown to the agent in canvas catalogs.
4243    pub description: String,
4244    /// Human-readable canvas name
4245    pub display_name: String,
4246    /// Owning provider identifier
4247    pub extension_id: String,
4248    /// Owning extension display name, when available
4249    #[serde(skip_serializing_if = "Option::is_none")]
4250    pub extension_name: Option<String>,
4251    /// Host-local PNG path for the canvas icon, when supplied
4252    #[serde(skip_serializing_if = "Option::is_none")]
4253    pub icon: Option<String>,
4254    /// JSON Schema for canvas open input
4255    #[serde(skip_serializing_if = "Option::is_none")]
4256    pub input_schema: Option<serde_json::Value>,
4257}
4258
4259/// Session event "session.canvas.registry_changed". Payload of `session.canvas.registry_changed` listing the canvas declarations currently available.
4260///
4261/// <div class="warning">
4262///
4263/// **Experimental.** This type is part of an experimental wire-protocol surface
4264/// and may change or be removed in future SDK or CLI releases.
4265///
4266/// </div>
4267#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4268#[serde(rename_all = "camelCase")]
4269pub struct SessionCanvasRegistryChangedData {
4270    /// Canvas declarations currently available
4271    pub canvases: Vec<CanvasRegistryChangedCanvas>,
4272}
4273
4274/// Session event "session.canvas.closed". Payload of `session.canvas.closed` with the closed canvas instance ID, provider ID, and canvas ID.
4275///
4276/// <div class="warning">
4277///
4278/// **Experimental.** This type is part of an experimental wire-protocol surface
4279/// and may change or be removed in future SDK or CLI releases.
4280///
4281/// </div>
4282#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4283#[serde(rename_all = "camelCase")]
4284pub struct SessionCanvasClosedData {
4285    /// Provider-local canvas identifier
4286    pub canvas_id: String,
4287    /// Owning provider identifier
4288    pub extension_id: String,
4289    /// Stable caller-supplied identifier of the canvas instance that was closed
4290    pub instance_id: String,
4291}
4292
4293/// Session event "session.canvas.unavailable". Transient signal that an open canvas instance's provider has dropped (for example the extension is reloading mid-session). The host should keep the panel mounted and surface a reconnecting affordance rather than tearing it down; a subsequent `session.canvas.opened` for the same instanceId clears the affordance once the provider reconnects with a fresh url. Ephemeral and never persisted, so it is never replayed on cold resume.
4294///
4295/// <div class="warning">
4296///
4297/// **Experimental.** This type is part of an experimental wire-protocol surface
4298/// and may change or be removed in future SDK or CLI releases.
4299///
4300/// </div>
4301#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4302#[serde(rename_all = "camelCase")]
4303pub struct SessionCanvasUnavailableData {
4304    /// Provider-local canvas identifier
4305    pub canvas_id: String,
4306    /// Owning provider identifier
4307    pub extension_id: String,
4308    /// Stable caller-supplied identifier of the canvas instance whose provider became unavailable
4309    pub instance_id: String,
4310}
4311
4312/// Session event "session.canvas.recorded". Durable record that a canvas instance is open, used to restore open canvases on cold session resume. Intentionally omits the transient url and availability.
4313///
4314/// <div class="warning">
4315///
4316/// **Experimental.** This type is part of an experimental wire-protocol surface
4317/// and may change or be removed in future SDK or CLI releases.
4318///
4319/// </div>
4320#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4321#[serde(rename_all = "camelCase")]
4322pub struct SessionCanvasRecordedData {
4323    /// Provider-local canvas identifier
4324    pub canvas_id: String,
4325    /// Owning provider identifier
4326    pub extension_id: String,
4327    /// Input supplied when the instance was opened
4328    #[serde(skip_serializing_if = "Option::is_none")]
4329    pub input: Option<serde_json::Value>,
4330    /// Stable caller-supplied canvas instance identifier
4331    pub instance_id: String,
4332    /// Rendered title
4333    #[serde(skip_serializing_if = "Option::is_none")]
4334    pub title: Option<String>,
4335}
4336
4337/// Session event "session.canvas.removed". Durable record that a canvas instance was closed, superseding a prior instance_recorded during resume replay.
4338///
4339/// <div class="warning">
4340///
4341/// **Experimental.** This type is part of an experimental wire-protocol surface
4342/// and may change or be removed in future SDK or CLI releases.
4343///
4344/// </div>
4345#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4346#[serde(rename_all = "camelCase")]
4347pub struct SessionCanvasRemovedData {
4348    /// Provider-local canvas identifier
4349    pub canvas_id: String,
4350    /// Owning provider identifier
4351    pub extension_id: String,
4352    /// Stable caller-supplied identifier of the canvas instance that was closed
4353    pub instance_id: String,
4354}
4355
4356/// Session event "session.extensions.attachments_pushed". Payload of `session.extensions.attachments_pushed` with extension-contributed attachments for the next send.
4357#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4358#[serde(rename_all = "camelCase")]
4359pub struct SessionExtensionsAttachmentsPushedData {
4360    /// Attachments contributed by an extension; the host should surface these as composer pills and forward them via the next session.send call.
4361    pub attachments: Vec<serde_json::Value>,
4362}
4363
4364/// Set when the underlying tools/call threw an error before returning a CallToolResult
4365#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4366#[serde(rename_all = "camelCase")]
4367pub struct McpAppToolCallCompleteError {
4368    /// Human-readable error message
4369    pub message: String,
4370}
4371
4372/// MCP App tool `_meta.ui` resource URI and SEP-1865 visibility captured with an `mcp_app.tool_call_complete` result.
4373#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4374#[serde(rename_all = "camelCase")]
4375pub struct McpAppToolCallCompleteToolMetaUI {
4376    /// `ui://` URI declared by the tool's `_meta.ui.resourceUri`
4377    #[serde(skip_serializing_if = "Option::is_none")]
4378    pub resource_uri: Option<String>,
4379    /// Tool visibility per SEP-1865 (typically a subset of `["model","app"]`)
4380    #[serde(skip_serializing_if = "Option::is_none")]
4381    pub visibility: Option<Vec<String>>,
4382}
4383
4384/// 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.
4385#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4386#[serde(rename_all = "camelCase")]
4387pub struct McpAppToolCallCompleteToolMeta {
4388    /// MCP App tool `_meta.ui` resource URI and SEP-1865 visibility captured with an `mcp_app.tool_call_complete` result.
4389    #[serde(skip_serializing_if = "Option::is_none")]
4390    pub ui: Option<McpAppToolCallCompleteToolMetaUI>,
4391}
4392
4393/// Session event "mcp_app.tool_call_complete". MCP App view called a tool on a connected MCP server (SEP-1865)
4394#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4395#[serde(rename_all = "camelCase")]
4396pub struct McpAppToolCallCompleteData {
4397    /// Arguments passed to the tool by the app view, if any
4398    #[serde(skip_serializing_if = "Option::is_none")]
4399    pub arguments: Option<HashMap<String, serde_json::Value>>,
4400    /// Wall-clock duration of the underlying tools/call in milliseconds
4401    pub duration_ms: f64,
4402    /// Set when the underlying tools/call threw an error before returning a CallToolResult
4403    #[serde(skip_serializing_if = "Option::is_none")]
4404    pub error: Option<McpAppToolCallCompleteError>,
4405    /// Standard MCP CallToolResult returned by the server. Present whether or not the call set isError.
4406    #[serde(skip_serializing_if = "Option::is_none")]
4407    pub result: Option<HashMap<String, serde_json::Value>>,
4408    /// Name of the MCP server hosting the tool
4409    pub server_name: String,
4410    /// True when the call completed without throwing AND the MCP CallToolResult did not set isError
4411    pub success: bool,
4412    /// 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.
4413    #[serde(skip_serializing_if = "Option::is_none")]
4414    pub tool_meta: Option<McpAppToolCallCompleteToolMeta>,
4415    /// MCP tool name that was invoked
4416    pub tool_name: String,
4417}
4418
4419/// Hosting platform type of the repository (github or ado)
4420#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
4421pub enum WorkingDirectoryContextHostType {
4422    /// Repository is hosted on GitHub.
4423    #[serde(rename = "github")]
4424    GitHub,
4425    /// Repository is hosted on Azure DevOps.
4426    #[serde(rename = "ado")]
4427    Ado,
4428    /// Unknown variant for forward compatibility.
4429    #[default]
4430    #[serde(other)]
4431    Unknown,
4432}
4433
4434/// Allowed values for the `ContextTier` enumeration.
4435#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
4436pub enum ContextTier {
4437    /// Default context tier with standard context window size.
4438    #[serde(rename = "default")]
4439    Default,
4440    /// Extended context tier with a larger context window.
4441    #[serde(rename = "long_context")]
4442    LongContext,
4443    /// Unknown variant for forward compatibility.
4444    #[default]
4445    #[serde(other)]
4446    Unknown,
4447}
4448
4449/// Reasoning summary mode used for model calls, if applicable (e.g. "none", "concise", "detailed")
4450#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
4451pub enum ReasoningSummary {
4452    /// Do not request reasoning summaries from the model.
4453    #[serde(rename = "none")]
4454    None,
4455    /// Request a concise summary of the model's reasoning.
4456    #[serde(rename = "concise")]
4457    Concise,
4458    /// Request a detailed summary of the model's reasoning.
4459    #[serde(rename = "detailed")]
4460    Detailed,
4461    /// Unknown variant for forward compatibility.
4462    #[default]
4463    #[serde(other)]
4464    Unknown,
4465}
4466
4467/// Output verbosity level used for supported model calls (e.g. "low", "medium", "high")
4468#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
4469pub enum Verbosity {
4470    /// A terse response was requested.
4471    #[serde(rename = "low")]
4472    Low,
4473    /// A medium amount of response detail was requested.
4474    #[serde(rename = "medium")]
4475    Medium,
4476    /// A more detailed response was requested.
4477    #[serde(rename = "high")]
4478    High,
4479    /// Unknown variant for forward compatibility.
4480    #[default]
4481    #[serde(other)]
4482    Unknown,
4483}
4484
4485/// The type of operation performed on the autopilot objective state file
4486#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
4487pub enum AutopilotObjectiveChangedOperation {
4488    /// Autopilot objective state file was created for a new objective.
4489    #[serde(rename = "create")]
4490    Create,
4491    /// Autopilot objective state file was updated for an existing objective.
4492    #[serde(rename = "update")]
4493    Update,
4494    /// Autopilot objective state file was deleted or cleared.
4495    #[serde(rename = "delete")]
4496    Delete,
4497    /// Unknown variant for forward compatibility.
4498    #[default]
4499    #[serde(other)]
4500    Unknown,
4501}
4502
4503/// Current autopilot objective status, if one exists
4504#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
4505pub enum AutopilotObjectiveChangedStatus {
4506    /// Objective is active and can drive autopilot continuations.
4507    #[serde(rename = "active")]
4508    Active,
4509    /// Objective is paused and will not drive autopilot continuations.
4510    #[serde(rename = "paused")]
4511    Paused,
4512    /// Legacy objective state indicating the previous continuation cap was reached.
4513    #[serde(rename = "cap_reached")]
4514    CapReached,
4515    /// Objective was completed by the agent.
4516    #[serde(rename = "completed")]
4517    Completed,
4518    /// Unknown variant for forward compatibility.
4519    #[default]
4520    #[serde(other)]
4521    Unknown,
4522}
4523
4524/// The session mode the agent is operating in
4525#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
4526pub enum SessionMode {
4527    /// The agent is responding interactively to the user.
4528    #[serde(rename = "interactive")]
4529    Interactive,
4530    /// The agent is preparing a plan before making changes.
4531    #[serde(rename = "plan")]
4532    Plan,
4533    /// The agent is working autonomously toward task completion.
4534    #[serde(rename = "autopilot")]
4535    Autopilot,
4536    /// Unknown variant for forward compatibility.
4537    #[default]
4538    #[serde(other)]
4539    Unknown,
4540}
4541
4542/// Allow-all mode for the session.
4543///
4544/// <div class="warning">
4545///
4546/// **Experimental.** This type is part of an experimental wire-protocol surface
4547/// and may change or be removed in future SDK or CLI releases.
4548///
4549/// </div>
4550#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
4551pub enum PermissionAllowAllMode {
4552    /// Permission requests follow the normal approval flow.
4553    #[serde(rename = "off")]
4554    Off,
4555    /// Tool, path, and URL permission requests are automatically approved.
4556    #[serde(rename = "on")]
4557    On,
4558    /// Permission requests follow the normal approval flow with an LLM advisory recommendation attached; clients may choose to auto-approve requests the judge evaluated as acceptable.
4559    #[serde(rename = "auto")]
4560    Auto,
4561    /// Unknown variant for forward compatibility.
4562    #[default]
4563    #[serde(other)]
4564    Unknown,
4565}
4566
4567/// The type of operation performed on the plan file
4568#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
4569pub enum PlanChangedOperation {
4570    /// The plan file was created.
4571    #[serde(rename = "create")]
4572    Create,
4573    /// The plan file was updated.
4574    #[serde(rename = "update")]
4575    Update,
4576    /// The plan file was deleted.
4577    #[serde(rename = "delete")]
4578    Delete,
4579    /// Unknown variant for forward compatibility.
4580    #[default]
4581    #[serde(other)]
4582    Unknown,
4583}
4584
4585/// Whether the file was newly created or updated
4586#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
4587pub enum WorkspaceFileChangedOperation {
4588    /// The workspace file was created.
4589    #[serde(rename = "create")]
4590    Create,
4591    /// The workspace file was updated.
4592    #[serde(rename = "update")]
4593    Update,
4594    /// Unknown variant for forward compatibility.
4595    #[default]
4596    #[serde(other)]
4597    Unknown,
4598}
4599
4600/// Origin type of the session being handed off
4601#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
4602pub enum HandoffSourceType {
4603    /// The handoff originated from a remote session.
4604    #[serde(rename = "remote")]
4605    Remote,
4606    /// The handoff originated from a local session.
4607    #[serde(rename = "local")]
4608    Local,
4609    /// Unknown variant for forward compatibility.
4610    #[default]
4611    #[serde(other)]
4612    Unknown,
4613}
4614
4615/// Whether the session ended normally ("routine") or due to a crash/fatal error ("error")
4616#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
4617pub enum ShutdownType {
4618    /// The session ended normally.
4619    #[serde(rename = "routine")]
4620    Routine,
4621    /// The session ended because of a crash or fatal error.
4622    #[serde(rename = "error")]
4623    Error,
4624    /// Unknown variant for forward compatibility.
4625    #[default]
4626    #[serde(other)]
4627    Unknown,
4628}
4629
4630/// The agent mode that was active when this message was sent
4631#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
4632pub enum UserMessageAgentMode {
4633    /// The agent is responding interactively to the user.
4634    #[serde(rename = "interactive")]
4635    Interactive,
4636    /// The agent is preparing a plan before making changes.
4637    #[serde(rename = "plan")]
4638    Plan,
4639    /// The agent is working autonomously toward task completion.
4640    #[serde(rename = "autopilot")]
4641    Autopilot,
4642    /// The agent is in shell-focused UI mode.
4643    #[serde(rename = "shell")]
4644    Shell,
4645    /// Unknown variant for forward compatibility.
4646    #[default]
4647    #[serde(other)]
4648    Unknown,
4649}
4650
4651/// How this user message was delivered to the agentic loop, relative to whether the loop was already running. This is the timing axis only; the message's origin (human vs. system/command/schedule/skill/etc.) is carried separately by `source`. A system-injected message has a delivery too — e.g. a background-task notification waking an idle agent is `idle`, the same mechanism as a human starting a fresh turn.
4652#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
4653pub enum UserMessageDelivery {
4654    /// Delivered while the loop was idle; starts its own run immediately (a human's fresh turn, or a system notification waking an idle agent).
4655    #[serde(rename = "idle")]
4656    Idle,
4657    /// Injected into the current in-flight run while the agent was busy (immediate mode).
4658    #[serde(rename = "steering")]
4659    Steering,
4660    /// Enqueued while the agent was busy; processed as its own run afterward.
4661    #[serde(rename = "queued")]
4662    Queued,
4663    /// Unknown variant for forward compatibility.
4664    #[default]
4665    #[serde(other)]
4666    Unknown,
4667}
4668
4669/// Tool call type: "function" for standard tool calls, "custom" for grammar-based tool calls. Defaults to "function" when absent.
4670#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
4671pub enum AssistantMessageToolRequestType {
4672    /// Standard function-style tool call.
4673    #[serde(rename = "function")]
4674    Function,
4675    /// Custom grammar-based tool call.
4676    #[serde(rename = "custom")]
4677    Custom,
4678    /// Unknown variant for forward compatibility.
4679    #[default]
4680    #[serde(other)]
4681    Unknown,
4682}
4683
4684/// The system that produced a citation.
4685///
4686/// <div class="warning">
4687///
4688/// **Experimental.** This type is part of an experimental wire-protocol surface
4689/// and may change or be removed in future SDK or CLI releases.
4690///
4691/// </div>
4692#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
4693pub enum CitationProvider {
4694    /// Citation produced by an Anthropic (Claude) model response.
4695    #[serde(rename = "anthropic")]
4696    Anthropic,
4697    /// Citation produced by an OpenAI model response.
4698    #[serde(rename = "openai")]
4699    Openai,
4700    /// Citation synthesized client-side by the runtime from tool output.
4701    #[serde(rename = "client")]
4702    Client,
4703    /// Unknown variant for forward compatibility.
4704    #[default]
4705    #[serde(other)]
4706    Unknown,
4707}
4708
4709/// API endpoint used for this model call, matching CAPI supported_endpoints vocabulary
4710#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
4711pub enum AssistantUsageApiEndpoint {
4712    /// Chat Completions API endpoint.
4713    #[serde(rename = "/chat/completions")]
4714    ChatCompletions,
4715    /// Anthropic Messages API endpoint.
4716    #[serde(rename = "/v1/messages")]
4717    V1Messages,
4718    /// Responses API endpoint.
4719    #[serde(rename = "/responses")]
4720    Responses,
4721    /// WebSocket Responses API endpoint.
4722    #[serde(rename = "ws:/responses")]
4723    WsResponses,
4724    /// Unknown variant for forward compatibility.
4725    #[default]
4726    #[serde(other)]
4727    Unknown,
4728}
4729
4730/// For HTTP 400 failures only: whether the response carried a structured CAPI error envelope (structured_error, a deterministic validation failure) or no error body (bodyless, the transient gateway/proxy signature). Absent for non-400 failures.
4731#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
4732pub enum ModelCallFailureBadRequestKind {
4733    /// The 400 response carried no error body (transient gateway/proxy signature).
4734    #[serde(rename = "bodyless")]
4735    Bodyless,
4736    /// The 400 response carried a structured CAPI error envelope (deterministic validation failure).
4737    #[serde(rename = "structured_error")]
4738    StructuredError,
4739    /// Unknown variant for forward compatibility.
4740    #[default]
4741    #[serde(other)]
4742    Unknown,
4743}
4744
4745/// Where the failed model call originated
4746#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
4747pub enum ModelCallFailureSource {
4748    /// Model call from the top-level agent.
4749    #[serde(rename = "top_level")]
4750    TopLevel,
4751    /// Model call from a sub-agent.
4752    #[serde(rename = "subagent")]
4753    Subagent,
4754    /// Model call from MCP sampling.
4755    #[serde(rename = "mcp_sampling")]
4756    McpSampling,
4757    /// Unknown variant for forward compatibility.
4758    #[default]
4759    #[serde(other)]
4760    Unknown,
4761}
4762
4763/// Finite reason code describing why the current turn was aborted
4764#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
4765pub enum AbortReason {
4766    /// The local user requested the abort, for example by pressing Ctrl+C in the CLI.
4767    #[serde(rename = "user_initiated")]
4768    UserInitiated,
4769    /// A remote command requested the abort.
4770    #[serde(rename = "remote_command")]
4771    RemoteCommand,
4772    /// An MCP server delivered a user.abort notification.
4773    #[serde(rename = "user_abort")]
4774    UserAbort,
4775    /// Unknown variant for forward compatibility.
4776    #[default]
4777    #[serde(other)]
4778    Unknown,
4779}
4780
4781/// Allowed values for the `ToolExecutionStartToolDescriptionMetaUIVisibility` enumeration.
4782#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
4783pub enum ToolExecutionStartToolDescriptionMetaUIVisibility {
4784    /// Tool is callable by the model (LLM tool surface)
4785    #[serde(rename = "model")]
4786    Model,
4787    /// Tool is callable by the MCP App view (iframe) via session.mcp.apps.callTool
4788    #[serde(rename = "app")]
4789    App,
4790    /// Unknown variant for forward compatibility.
4791    #[default]
4792    #[serde(other)]
4793    Unknown,
4794}
4795
4796/// Content block type discriminator
4797#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
4798pub enum ToolExecutionCompleteContentTextType {
4799    #[serde(rename = "text")]
4800    #[default]
4801    Text,
4802}
4803
4804/// Content block type discriminator
4805#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
4806pub enum ToolExecutionCompleteContentTerminalType {
4807    #[serde(rename = "terminal")]
4808    #[default]
4809    Terminal,
4810}
4811
4812/// Content block type discriminator
4813#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
4814pub enum ToolExecutionCompleteContentShellExitType {
4815    #[serde(rename = "shell_exit")]
4816    #[default]
4817    ShellExit,
4818}
4819
4820/// Content block type discriminator
4821#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
4822pub enum ToolExecutionCompleteContentImageType {
4823    #[serde(rename = "image")]
4824    #[default]
4825    Image,
4826}
4827
4828/// Content block type discriminator
4829#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
4830pub enum ToolExecutionCompleteContentAudioType {
4831    #[serde(rename = "audio")]
4832    #[default]
4833    Audio,
4834}
4835
4836/// Theme variant this icon is intended for
4837#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
4838pub enum ToolExecutionCompleteContentResourceLinkIconTheme {
4839    /// Icon intended for light themes.
4840    #[serde(rename = "light")]
4841    Light,
4842    /// Icon intended for dark themes.
4843    #[serde(rename = "dark")]
4844    Dark,
4845    /// Unknown variant for forward compatibility.
4846    #[default]
4847    #[serde(other)]
4848    Unknown,
4849}
4850
4851/// Content block type discriminator
4852#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
4853pub enum ToolExecutionCompleteContentResourceLinkType {
4854    #[serde(rename = "resource_link")]
4855    #[default]
4856    ResourceLink,
4857}
4858
4859/// The embedded resource contents, either text or base64-encoded binary
4860#[derive(Debug, Clone, Serialize, Deserialize)]
4861#[serde(untagged)]
4862pub enum ToolExecutionCompleteContentResourceDetails {
4863    EmbeddedTextResourceContents(EmbeddedTextResourceContents),
4864    EmbeddedBlobResourceContents(EmbeddedBlobResourceContents),
4865}
4866
4867/// Content block type discriminator
4868#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
4869pub enum ToolExecutionCompleteContentResourceType {
4870    #[serde(rename = "resource")]
4871    #[default]
4872    Resource,
4873}
4874
4875/// A content block within a tool result, which may be text, terminal output, image, audio, or a resource
4876#[derive(Debug, Clone, Serialize, Deserialize)]
4877#[serde(untagged)]
4878pub enum ToolExecutionCompleteContent {
4879    Text(ToolExecutionCompleteContentText),
4880    Terminal(ToolExecutionCompleteContentTerminal),
4881    ShellExit(ToolExecutionCompleteContentShellExit),
4882    Image(ToolExecutionCompleteContentImage),
4883    Audio(ToolExecutionCompleteContentAudio),
4884    ResourceLink(ToolExecutionCompleteContentResourceLink),
4885    Resource(ToolExecutionCompleteContentResource),
4886}
4887
4888/// Allowed values for the `ToolExecutionCompleteToolDescriptionMetaUIVisibility` enumeration.
4889#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
4890pub enum ToolExecutionCompleteToolDescriptionMetaUIVisibility {
4891    /// Tool is callable by the model (LLM tool surface)
4892    #[serde(rename = "model")]
4893    Model,
4894    /// Tool is callable by the MCP App view (iframe) via session.mcp.apps.callTool
4895    #[serde(rename = "app")]
4896    App,
4897    /// Unknown variant for forward compatibility.
4898    #[default]
4899    #[serde(other)]
4900    Unknown,
4901}
4902
4903/// 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)
4904#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
4905pub enum SkillInvokedTrigger {
4906    /// Skill invocation requested explicitly by the user, such as via a slash command or UI affordance.
4907    #[serde(rename = "user-invoked")]
4908    UserInvoked,
4909    /// Skill invocation requested by the agent.
4910    #[serde(rename = "agent-invoked")]
4911    AgentInvoked,
4912    /// Skill content loaded as part of another context, such as a configured custom agent or subagent.
4913    #[serde(rename = "context-load")]
4914    ContextLoad,
4915    /// Unknown variant for forward compatibility.
4916    #[default]
4917    #[serde(other)]
4918    Unknown,
4919}
4920
4921/// Binary asset type discriminator. Use "image" for images and "resource" otherwise.
4922#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
4923pub enum BinaryAssetType {
4924    /// Binary image data.
4925    #[serde(rename = "image")]
4926    Image,
4927    /// Other binary resource data.
4928    #[serde(rename = "resource")]
4929    Resource,
4930    /// Unknown variant for forward compatibility.
4931    #[default]
4932    #[serde(other)]
4933    Unknown,
4934}
4935
4936/// Message role: "system" for system prompts, "developer" for developer-injected instructions
4937#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
4938pub enum SystemMessageRole {
4939    /// System prompt message.
4940    #[serde(rename = "system")]
4941    System,
4942    /// Developer instruction message.
4943    #[serde(rename = "developer")]
4944    Developer,
4945    /// Unknown variant for forward compatibility.
4946    #[default]
4947    #[serde(other)]
4948    Unknown,
4949}
4950
4951/// Permission kind discriminator
4952#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
4953pub enum PermissionRequestShellKind {
4954    #[serde(rename = "shell")]
4955    #[default]
4956    Shell,
4957}
4958
4959/// Permission kind discriminator
4960#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
4961pub enum PermissionRequestWriteKind {
4962    #[serde(rename = "write")]
4963    #[default]
4964    Write,
4965}
4966
4967/// Permission kind discriminator
4968#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
4969pub enum PermissionRequestReadKind {
4970    #[serde(rename = "read")]
4971    #[default]
4972    Read,
4973}
4974
4975/// Permission kind discriminator
4976#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
4977pub enum PermissionRequestMcpKind {
4978    #[serde(rename = "mcp")]
4979    #[default]
4980    Mcp,
4981}
4982
4983/// Permission kind discriminator
4984#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
4985pub enum PermissionRequestUrlKind {
4986    #[serde(rename = "url")]
4987    #[default]
4988    Url,
4989}
4990
4991/// Whether this is a store or vote memory operation
4992#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
4993pub enum PermissionRequestMemoryAction {
4994    /// Store a new memory.
4995    #[serde(rename = "store")]
4996    Store,
4997    /// Vote on an existing memory.
4998    #[serde(rename = "vote")]
4999    Vote,
5000    /// Unknown variant for forward compatibility.
5001    #[default]
5002    #[serde(other)]
5003    Unknown,
5004}
5005
5006/// Vote direction (vote only)
5007#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
5008pub enum PermissionRequestMemoryDirection {
5009    /// Vote that the memory is useful or accurate.
5010    #[serde(rename = "upvote")]
5011    Upvote,
5012    /// Vote that the memory is incorrect or outdated.
5013    #[serde(rename = "downvote")]
5014    Downvote,
5015    /// Unknown variant for forward compatibility.
5016    #[default]
5017    #[serde(other)]
5018    Unknown,
5019}
5020
5021/// Permission kind discriminator
5022#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
5023pub enum PermissionRequestMemoryKind {
5024    #[serde(rename = "memory")]
5025    #[default]
5026    Memory,
5027}
5028
5029/// Permission kind discriminator
5030#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
5031pub enum PermissionRequestCustomToolKind {
5032    #[serde(rename = "custom-tool")]
5033    #[default]
5034    CustomTool,
5035}
5036
5037/// Permission kind discriminator
5038#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
5039pub enum PermissionRequestHookKind {
5040    #[serde(rename = "hook")]
5041    #[default]
5042    Hook,
5043}
5044
5045/// Permission kind discriminator
5046#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
5047pub enum PermissionRequestExtensionManagementKind {
5048    #[serde(rename = "extension-management")]
5049    #[default]
5050    ExtensionManagement,
5051}
5052
5053/// Permission kind discriminator
5054#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
5055pub enum PermissionRequestExtensionPermissionAccessKind {
5056    #[serde(rename = "extension-permission-access")]
5057    #[default]
5058    ExtensionPermissionAccess,
5059}
5060
5061/// Details of the permission being requested
5062#[derive(Debug, Clone, Serialize, Deserialize)]
5063#[serde(untagged)]
5064pub enum PermissionRequest {
5065    Shell(PermissionRequestShell),
5066    Write(PermissionRequestWrite),
5067    Read(PermissionRequestRead),
5068    Mcp(PermissionRequestMcp),
5069    Url(PermissionRequestUrl),
5070    Memory(PermissionRequestMemory),
5071    CustomTool(PermissionRequestCustomTool),
5072    Hook(PermissionRequestHook),
5073    ExtensionManagement(PermissionRequestExtensionManagement),
5074    ExtensionPermissionAccess(PermissionRequestExtensionPermissionAccess),
5075}
5076
5077/// Outcome of the auto-approval safety judge for a permission request. Present only when auto mode is enabled; its absence means the judge did not evaluate the request (auto mode was off).
5078///
5079/// <div class="warning">
5080///
5081/// **Experimental.** This type is part of an experimental wire-protocol surface
5082/// and may change or be removed in future SDK or CLI releases.
5083///
5084/// </div>
5085#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
5086pub enum AutoApprovalRecommendation {
5087    /// The judge evaluated the request and recommends automatically approving it.
5088    #[serde(rename = "approve")]
5089    Approve,
5090    /// The judge evaluated the request and does not recommend auto-approving it; explicit approval is required. Whether that means prompting, denying, or something else is the consumer's decision.
5091    #[serde(rename = "requireApproval")]
5092    RequireApproval,
5093    /// Auto mode is enabled, but this request category is never auto-approvable (for example, sandbox-bypass requests), so the judge was not consulted.
5094    #[serde(rename = "excluded")]
5095    Excluded,
5096    /// The judge was consulted but did not return a usable recommendation, so the request requires explicit approval.
5097    #[serde(rename = "error")]
5098    Error,
5099    /// Unknown variant for forward compatibility.
5100    #[default]
5101    #[serde(other)]
5102    Unknown,
5103}
5104
5105/// Prompt kind discriminator
5106#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
5107pub enum PermissionPromptRequestCommandsKind {
5108    #[serde(rename = "commands")]
5109    #[default]
5110    Commands,
5111}
5112
5113/// Prompt kind discriminator
5114#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
5115pub enum PermissionPromptRequestWriteKind {
5116    #[serde(rename = "write")]
5117    #[default]
5118    Write,
5119}
5120
5121/// Prompt kind discriminator
5122#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
5123pub enum PermissionPromptRequestReadKind {
5124    #[serde(rename = "read")]
5125    #[default]
5126    Read,
5127}
5128
5129/// Prompt kind discriminator
5130#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
5131pub enum PermissionPromptRequestMcpKind {
5132    #[serde(rename = "mcp")]
5133    #[default]
5134    Mcp,
5135}
5136
5137/// Prompt kind discriminator
5138#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
5139pub enum PermissionPromptRequestUrlKind {
5140    #[serde(rename = "url")]
5141    #[default]
5142    Url,
5143}
5144
5145/// Prompt kind discriminator
5146#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
5147pub enum PermissionPromptRequestMemoryKind {
5148    #[serde(rename = "memory")]
5149    #[default]
5150    Memory,
5151}
5152
5153/// Prompt kind discriminator
5154#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
5155pub enum PermissionPromptRequestCustomToolKind {
5156    #[serde(rename = "custom-tool")]
5157    #[default]
5158    CustomTool,
5159}
5160
5161/// Underlying permission kind that needs path approval
5162#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
5163pub enum PermissionPromptRequestPathAccessKind {
5164    /// Read access to a filesystem path.
5165    #[serde(rename = "read")]
5166    Read,
5167    /// Shell command access involving a filesystem path.
5168    #[serde(rename = "shell")]
5169    Shell,
5170    /// Write access to a filesystem path.
5171    #[serde(rename = "write")]
5172    Write,
5173    /// Unknown variant for forward compatibility.
5174    #[default]
5175    #[serde(other)]
5176    Unknown,
5177}
5178
5179/// Prompt kind discriminator
5180#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
5181pub enum PermissionPromptRequestPathKind {
5182    #[serde(rename = "path")]
5183    #[default]
5184    Path,
5185}
5186
5187/// Prompt kind discriminator
5188#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
5189pub enum PermissionPromptRequestHookKind {
5190    #[serde(rename = "hook")]
5191    #[default]
5192    Hook,
5193}
5194
5195/// Prompt kind discriminator
5196#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
5197pub enum PermissionPromptRequestExtensionManagementKind {
5198    #[serde(rename = "extension-management")]
5199    #[default]
5200    ExtensionManagement,
5201}
5202
5203/// Prompt kind discriminator
5204#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
5205pub enum PermissionPromptRequestExtensionPermissionAccessKind {
5206    #[serde(rename = "extension-permission-access")]
5207    #[default]
5208    ExtensionPermissionAccess,
5209}
5210
5211/// Derived user-facing permission prompt details for UI consumers
5212#[derive(Debug, Clone, Serialize, Deserialize)]
5213#[serde(untagged)]
5214pub enum PermissionPromptRequest {
5215    Commands(PermissionPromptRequestCommands),
5216    Write(PermissionPromptRequestWrite),
5217    Read(PermissionPromptRequestRead),
5218    Mcp(PermissionPromptRequestMcp),
5219    Url(PermissionPromptRequestUrl),
5220    Memory(PermissionPromptRequestMemory),
5221    CustomTool(PermissionPromptRequestCustomTool),
5222    Path(PermissionPromptRequestPath),
5223    Hook(PermissionPromptRequestHook),
5224    ExtensionManagement(PermissionPromptRequestExtensionManagement),
5225    ExtensionPermissionAccess(PermissionPromptRequestExtensionPermissionAccess),
5226}
5227
5228/// The permission request was approved
5229#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
5230pub enum PermissionApprovedKind {
5231    #[serde(rename = "approved")]
5232    #[default]
5233    Approved,
5234}
5235
5236/// Command approval kind
5237#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
5238pub enum UserToolSessionApprovalCommandsKind {
5239    #[serde(rename = "commands")]
5240    #[default]
5241    Commands,
5242}
5243
5244/// Read approval kind
5245#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
5246pub enum UserToolSessionApprovalReadKind {
5247    #[serde(rename = "read")]
5248    #[default]
5249    Read,
5250}
5251
5252/// Write approval kind
5253#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
5254pub enum UserToolSessionApprovalWriteKind {
5255    #[serde(rename = "write")]
5256    #[default]
5257    Write,
5258}
5259
5260/// MCP tool approval kind
5261#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
5262pub enum UserToolSessionApprovalMcpKind {
5263    #[serde(rename = "mcp")]
5264    #[default]
5265    Mcp,
5266}
5267
5268/// Memory approval kind
5269#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
5270pub enum UserToolSessionApprovalMemoryKind {
5271    #[serde(rename = "memory")]
5272    #[default]
5273    Memory,
5274}
5275
5276/// Custom tool approval kind
5277#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
5278pub enum UserToolSessionApprovalCustomToolKind {
5279    #[serde(rename = "custom-tool")]
5280    #[default]
5281    CustomTool,
5282}
5283
5284/// Extension management approval kind
5285#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
5286pub enum UserToolSessionApprovalExtensionManagementKind {
5287    #[serde(rename = "extension-management")]
5288    #[default]
5289    ExtensionManagement,
5290}
5291
5292/// Extension permission access approval kind
5293#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
5294pub enum UserToolSessionApprovalExtensionPermissionAccessKind {
5295    #[serde(rename = "extension-permission-access")]
5296    #[default]
5297    ExtensionPermissionAccess,
5298}
5299
5300/// The approval to add as a session-scoped rule
5301#[derive(Debug, Clone, Serialize, Deserialize)]
5302#[serde(untagged)]
5303pub enum UserToolSessionApproval {
5304    Commands(UserToolSessionApprovalCommands),
5305    Read(UserToolSessionApprovalRead),
5306    Write(UserToolSessionApprovalWrite),
5307    Mcp(UserToolSessionApprovalMcp),
5308    Memory(UserToolSessionApprovalMemory),
5309    CustomTool(UserToolSessionApprovalCustomTool),
5310    ExtensionManagement(UserToolSessionApprovalExtensionManagement),
5311    ExtensionPermissionAccess(UserToolSessionApprovalExtensionPermissionAccess),
5312}
5313
5314/// Approved and remembered for the rest of the session
5315#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
5316pub enum PermissionApprovedForSessionKind {
5317    #[serde(rename = "approved-for-session")]
5318    #[default]
5319    ApprovedForSession,
5320}
5321
5322/// Approved and persisted for this project location
5323#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
5324pub enum PermissionApprovedForLocationKind {
5325    #[serde(rename = "approved-for-location")]
5326    #[default]
5327    ApprovedForLocation,
5328}
5329
5330/// The permission request was cancelled before a response was used
5331#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
5332pub enum PermissionCancelledKind {
5333    #[serde(rename = "cancelled")]
5334    #[default]
5335    Cancelled,
5336}
5337
5338/// Denied because approval rules explicitly blocked it
5339#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
5340pub enum PermissionDeniedByRulesKind {
5341    #[serde(rename = "denied-by-rules")]
5342    #[default]
5343    DeniedByRules,
5344}
5345
5346/// Denied because no approval rule matched and user confirmation was unavailable
5347#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
5348pub enum PermissionDeniedNoApprovalRuleAndCouldNotRequestFromUserKind {
5349    #[serde(rename = "denied-no-approval-rule-and-could-not-request-from-user")]
5350    #[default]
5351    DeniedNoApprovalRuleAndCouldNotRequestFromUser,
5352}
5353
5354/// Denied by the user during an interactive prompt
5355#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
5356pub enum PermissionDeniedInteractivelyByUserKind {
5357    #[serde(rename = "denied-interactively-by-user")]
5358    #[default]
5359    DeniedInteractivelyByUser,
5360}
5361
5362/// Denied by the organization's content exclusion policy
5363#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
5364pub enum PermissionDeniedByContentExclusionPolicyKind {
5365    #[serde(rename = "denied-by-content-exclusion-policy")]
5366    #[default]
5367    DeniedByContentExclusionPolicy,
5368}
5369
5370/// Denied by a permission request hook registered by an extension or plugin
5371#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
5372pub enum PermissionDeniedByPermissionRequestHookKind {
5373    #[serde(rename = "denied-by-permission-request-hook")]
5374    #[default]
5375    DeniedByPermissionRequestHook,
5376}
5377
5378/// The result of the permission request
5379#[derive(Debug, Clone, Serialize, Deserialize)]
5380#[serde(untagged)]
5381pub enum PermissionResult {
5382    Approved(PermissionApproved),
5383    ApprovedForSession(PermissionApprovedForSession),
5384    ApprovedForLocation(PermissionApprovedForLocation),
5385    Cancelled(PermissionCancelled),
5386    DeniedByRules(PermissionDeniedByRules),
5387    DeniedNoApprovalRuleAndCouldNotRequestFromUser(
5388        PermissionDeniedNoApprovalRuleAndCouldNotRequestFromUser,
5389    ),
5390    DeniedInteractivelyByUser(PermissionDeniedInteractivelyByUser),
5391    DeniedByContentExclusionPolicy(PermissionDeniedByContentExclusionPolicy),
5392    DeniedByPermissionRequestHook(PermissionDeniedByPermissionRequestHook),
5393}
5394
5395/// Elicitation mode; "form" for structured input, "url" for browser-based. Defaults to "form" when absent.
5396#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
5397pub enum ElicitationRequestedMode {
5398    /// Structured form-based elicitation.
5399    #[serde(rename = "form")]
5400    Form,
5401    /// Browser URL-based elicitation.
5402    #[serde(rename = "url")]
5403    Url,
5404    /// Unknown variant for forward compatibility.
5405    #[default]
5406    #[serde(other)]
5407    Unknown,
5408}
5409
5410/// Schema type indicator (always 'object')
5411#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
5412pub enum ElicitationRequestedSchemaType {
5413    #[serde(rename = "object")]
5414    #[default]
5415    Object,
5416}
5417
5418/// The user action: "accept" (submitted form), "decline" (explicitly refused), or "cancel" (dismissed)
5419#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
5420pub enum ElicitationCompletedAction {
5421    /// The user submitted the requested form.
5422    #[serde(rename = "accept")]
5423    Accept,
5424    /// The user explicitly declined the request.
5425    #[serde(rename = "decline")]
5426    Decline,
5427    /// The user dismissed the request.
5428    #[serde(rename = "cancel")]
5429    Cancel,
5430    /// Unknown variant for forward compatibility.
5431    #[default]
5432    #[serde(other)]
5433    Unknown,
5434}
5435
5436/// Reason the runtime is requesting host-provided MCP OAuth credentials
5437#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
5438pub enum McpOauthRequestReason {
5439    /// Initial credentials are required before connecting to the MCP server.
5440    #[serde(rename = "initial")]
5441    Initial,
5442    /// The current host-provided credential was rejected and a replacement is requested.
5443    #[serde(rename = "refresh")]
5444    Refresh,
5445    /// The server requires a new host authorization flow before continuing.
5446    #[serde(rename = "reauth")]
5447    Reauth,
5448    /// The server requires a credential with additional scope or audience.
5449    #[serde(rename = "upscope")]
5450    Upscope,
5451    /// Unknown variant for forward compatibility.
5452    #[default]
5453    #[serde(other)]
5454    Unknown,
5455}
5456
5457/// 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).
5458#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
5459pub enum McpOauthRequiredStaticClientConfigGrantType {
5460    #[serde(rename = "client_credentials")]
5461    #[default]
5462    ClientCredentials,
5463}
5464
5465/// How the pending MCP OAuth request was completed
5466#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
5467pub enum McpOauthCompletionOutcome {
5468    /// The request completed with a token-backed OAuth provider.
5469    #[serde(rename = "token")]
5470    Token,
5471    /// The request completed without an OAuth provider.
5472    #[serde(rename = "cancelled")]
5473    Cancelled,
5474    /// Unknown variant for forward compatibility.
5475    #[default]
5476    #[serde(other)]
5477    Unknown,
5478}
5479
5480/// Why dynamic headers are being requested.
5481#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
5482pub enum McpHeadersRefreshRequiredReason {
5483    /// The transport is making its first dynamic header request for this server.
5484    #[serde(rename = "startup")]
5485    Startup,
5486    /// The previously cached dynamic headers expired.
5487    #[serde(rename = "ttl-expired")]
5488    TtlExpired,
5489    /// The server returned 401 and stale dynamic headers were invalidated.
5490    #[serde(rename = "auth-failed")]
5491    AuthFailed,
5492    /// Unknown variant for forward compatibility.
5493    #[default]
5494    #[serde(other)]
5495    Unknown,
5496}
5497
5498/// How the pending MCP headers refresh request resolved.
5499#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
5500pub enum McpHeadersRefreshCompletedOutcome {
5501    /// The host supplied dynamic headers.
5502    #[serde(rename = "headers")]
5503    Headers,
5504    /// The host responded with no dynamic headers.
5505    #[serde(rename = "none")]
5506    None,
5507    /// No response arrived within the bounded window.
5508    #[serde(rename = "timeout")]
5509    Timeout,
5510    /// Unknown variant for forward compatibility.
5511    #[default]
5512    #[serde(other)]
5513    Unknown,
5514}
5515
5516/// The user's auto-mode-switch choice
5517#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
5518pub enum AutoModeSwitchResponse {
5519    /// Switch models for this request.
5520    #[serde(rename = "yes")]
5521    Yes,
5522    /// Switch models now and keep using the replacement automatically.
5523    #[serde(rename = "yes_always")]
5524    YesAlways,
5525    /// Do not switch models.
5526    #[serde(rename = "no")]
5527    No,
5528    /// Unknown variant for forward compatibility.
5529    #[default]
5530    #[serde(other)]
5531    Unknown,
5532}
5533
5534/// User action selected for an exhausted session limit.
5535#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
5536pub enum SessionLimitsExhaustedResponseAction {
5537    /// Increase the current max by an exact AI Credits amount.
5538    #[serde(rename = "add")]
5539    Add,
5540    /// Set a new absolute max AI Credits value.
5541    #[serde(rename = "set")]
5542    Set,
5543    /// Remove the current session limit.
5544    #[serde(rename = "unset")]
5545    Unset,
5546    /// Leave the limit unchanged and cancel the blocked model request.
5547    #[serde(rename = "cancel")]
5548    Cancel,
5549    /// Unknown variant for forward compatibility.
5550    #[default]
5551    #[serde(other)]
5552    Unknown,
5553}
5554
5555/// Coarse request-difficulty bucket for UX explainability
5556#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
5557pub enum AutoModeResolvedReasoningBucket {
5558    /// The request looks low-reasoning; a lighter model is appropriate.
5559    #[serde(rename = "low")]
5560    Low,
5561    /// The request needs a moderate amount of reasoning.
5562    #[serde(rename = "medium")]
5563    Medium,
5564    /// The request looks high-reasoning; a stronger model is appropriate.
5565    #[serde(rename = "high")]
5566    High,
5567    /// Unknown variant for forward compatibility.
5568    #[default]
5569    #[serde(other)]
5570    Unknown,
5571}
5572
5573/// Exit plan mode action
5574#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
5575pub enum ExitPlanModeAction {
5576    /// Exit plan mode without starting implementation.
5577    #[serde(rename = "exit_only")]
5578    ExitOnly,
5579    /// Exit plan mode and continue in interactive mode.
5580    #[serde(rename = "interactive")]
5581    Interactive,
5582    /// Exit plan mode and continue autonomously.
5583    #[serde(rename = "autopilot")]
5584    Autopilot,
5585    /// Exit plan mode and continue with parallel autonomous workers.
5586    #[serde(rename = "autopilot_fleet")]
5587    AutopilotFleet,
5588    /// Unknown variant for forward compatibility.
5589    #[default]
5590    #[serde(other)]
5591    Unknown,
5592}
5593
5594/// Source location type (e.g., project, personal-copilot, plugin, builtin)
5595#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
5596pub enum SkillSource {
5597    /// Skill defined in the current project's skill directories.
5598    #[serde(rename = "project")]
5599    Project,
5600    /// Skill discovered from a parent directory in the current workspace tree.
5601    #[serde(rename = "inherited")]
5602    Inherited,
5603    /// Skill defined in the user's Copilot skill directory.
5604    #[serde(rename = "personal-copilot")]
5605    PersonalCopilot,
5606    /// Skill defined in the user's personal agents skill directory.
5607    #[serde(rename = "personal-agents")]
5608    PersonalAgents,
5609    /// Skill provided by an installed plugin.
5610    #[serde(rename = "plugin")]
5611    Plugin,
5612    /// Skill loaded from a configured custom skill directory.
5613    #[serde(rename = "custom")]
5614    Custom,
5615    /// Skill bundled with the runtime.
5616    #[serde(rename = "builtin")]
5617    Builtin,
5618    /// Unknown variant for forward compatibility.
5619    #[default]
5620    #[serde(other)]
5621    Unknown,
5622}
5623
5624/// Configuration source: user, workspace, plugin, or builtin
5625#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
5626pub enum McpServerSource {
5627    /// Server configured in the user's global MCP configuration.
5628    #[serde(rename = "user")]
5629    User,
5630    /// Server configured by the current workspace.
5631    #[serde(rename = "workspace")]
5632    Workspace,
5633    /// Server contributed by an installed plugin.
5634    #[serde(rename = "plugin")]
5635    Plugin,
5636    /// Server bundled with the runtime.
5637    #[serde(rename = "builtin")]
5638    Builtin,
5639    /// Unknown variant for forward compatibility.
5640    #[default]
5641    #[serde(other)]
5642    Unknown,
5643}
5644
5645/// Connection status: connected, failed, needs-auth, pending, disabled, or not_configured
5646#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
5647pub enum McpServerStatus {
5648    /// The server is connected and available.
5649    #[serde(rename = "connected")]
5650    Connected,
5651    /// The server failed to connect or initialize.
5652    #[serde(rename = "failed")]
5653    Failed,
5654    /// The server requires authentication before it can connect.
5655    #[serde(rename = "needs-auth")]
5656    NeedsAuth,
5657    /// The server connection is still being established.
5658    #[serde(rename = "pending")]
5659    Pending,
5660    /// The server is configured but disabled.
5661    #[serde(rename = "disabled")]
5662    Disabled,
5663    /// The server is not configured for this session.
5664    #[serde(rename = "not_configured")]
5665    NotConfigured,
5666    /// Unknown variant for forward compatibility.
5667    #[default]
5668    #[serde(other)]
5669    Unknown,
5670}
5671
5672/// Transport mechanism: stdio, http, sse (deprecated), or memory (in-process MCP server)
5673#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
5674pub enum McpServerTransport {
5675    /// Server communicates over stdio with a local child process.
5676    #[serde(rename = "stdio")]
5677    Stdio,
5678    /// Server communicates over streamable HTTP.
5679    #[serde(rename = "http")]
5680    Http,
5681    /// Server communicates over Server-Sent Events (deprecated).
5682    #[serde(rename = "sse")]
5683    Sse,
5684    /// Server is backed by an in-memory runtime implementation.
5685    #[serde(rename = "memory")]
5686    Memory,
5687    /// Unknown variant for forward compatibility.
5688    #[default]
5689    #[serde(other)]
5690    Unknown,
5691}
5692
5693/// Discovery source
5694#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
5695pub enum ExtensionsLoadedExtensionSource {
5696    /// Extension discovered from the current project.
5697    #[serde(rename = "project")]
5698    Project,
5699    /// Extension discovered from the user's extension directory.
5700    #[serde(rename = "user")]
5701    User,
5702    /// Extension contributed by an installed plugin.
5703    #[serde(rename = "plugin")]
5704    Plugin,
5705    /// Extension discovered from the current session's state directory.
5706    #[serde(rename = "session")]
5707    Session,
5708    /// Unknown variant for forward compatibility.
5709    #[default]
5710    #[serde(other)]
5711    Unknown,
5712}
5713
5714/// Current status: running, disabled, failed, or starting
5715#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
5716pub enum ExtensionsLoadedExtensionStatus {
5717    /// The extension process is running.
5718    #[serde(rename = "running")]
5719    Running,
5720    /// The extension is installed but disabled.
5721    #[serde(rename = "disabled")]
5722    Disabled,
5723    /// The extension failed to start or crashed.
5724    #[serde(rename = "failed")]
5725    Failed,
5726    /// The extension process is starting.
5727    #[serde(rename = "starting")]
5728    Starting,
5729    /// Unknown variant for forward compatibility.
5730    #[default]
5731    #[serde(other)]
5732    Unknown,
5733}