Skip to main content

github_copilot_sdk/generated/
session_events.rs

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