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