Skip to main content

github_copilot_sdk/generated/
session_events.rs

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