Skip to main content

github_copilot_sdk/generated/
session_events.rs

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