github_copilot_sdk/generated/session_events.rs
1//! Auto-generated from session-events.schema.json — do not edit manually.
2
3#![allow(deprecated)]
4
5use std::collections::HashMap;
6
7use serde::{Deserialize, Serialize};
8
9use crate::types::{RequestId, SessionId};
10
11/// Identifies the kind of session event.
12#[derive(Debug, Clone, Default, PartialEq, Eq, Hash, Serialize, Deserialize)]
13pub enum SessionEventType {
14 #[serde(rename = "session.start")]
15 SessionStart,
16 #[serde(rename = "session.resume")]
17 SessionResume,
18 #[serde(rename = "session.remote_steerable_changed")]
19 SessionRemoteSteerableChanged,
20 #[serde(rename = "session.error")]
21 SessionError,
22 #[serde(rename = "session.idle")]
23 SessionIdle,
24 #[serde(rename = "session.title_changed")]
25 SessionTitleChanged,
26 #[serde(rename = "session.schedule_created")]
27 SessionScheduleCreated,
28 #[serde(rename = "session.schedule_cancelled")]
29 SessionScheduleCancelled,
30 #[serde(rename = "session.schedule_rearmed")]
31 SessionScheduleRearmed,
32 #[serde(rename = "session.autopilot_objective_changed")]
33 SessionAutopilotObjectiveChanged,
34 #[serde(rename = "session.info")]
35 SessionInfo,
36 #[serde(rename = "session.warning")]
37 SessionWarning,
38 #[serde(rename = "session.model_change")]
39 SessionModelChange,
40 #[serde(rename = "session.auto_tier_switch_failed")]
41 SessionAutoTierSwitchFailed,
42 #[serde(rename = "session.mode_changed")]
43 SessionModeChanged,
44 #[serde(rename = "session.mode_notice_delivered")]
45 SessionModeNoticeDelivered,
46 #[serde(rename = "session.session_limits_changed")]
47 SessionSessionLimitsChanged,
48 ///
49 /// <div class="warning">
50 ///
51 /// **Experimental.** This type is part of an experimental wire-protocol surface
52 /// and may change or be removed in future SDK or CLI releases.
53 ///
54 /// </div>
55 #[serde(rename = "session.permissions_changed")]
56 SessionPermissionsChanged,
57 #[serde(rename = "session.plan_changed")]
58 SessionPlanChanged,
59 #[serde(rename = "session.todos_changed")]
60 SessionTodosChanged,
61 #[serde(rename = "session.workspace_file_changed")]
62 SessionWorkspaceFileChanged,
63 #[serde(rename = "session.handoff")]
64 SessionHandoff,
65 #[serde(rename = "session.truncation")]
66 SessionTruncation,
67 #[serde(rename = "session.snapshot_rewind")]
68 SessionSnapshotRewind,
69 #[serde(rename = "session.shutdown")]
70 SessionShutdown,
71 #[serde(rename = "session.usage_checkpoint")]
72 SessionUsageCheckpoint,
73 #[serde(rename = "session.context_changed")]
74 SessionContextChanged,
75 #[serde(rename = "session.usage_info")]
76 SessionUsageInfo,
77 #[serde(rename = "session.context_cleared")]
78 SessionContextCleared,
79 #[serde(rename = "session.compaction_start")]
80 SessionCompactionStart,
81 #[serde(rename = "session.compaction_complete")]
82 SessionCompactionComplete,
83 #[serde(rename = "session.task_complete")]
84 SessionTaskComplete,
85 ///
86 /// <div class="warning">
87 ///
88 /// **Experimental.** This type is part of an experimental wire-protocol surface
89 /// and may change or be removed in future SDK or CLI releases.
90 ///
91 /// </div>
92 #[serde(rename = "session.completion_receipt")]
93 SessionCompletionReceipt,
94 ///
95 /// <div class="warning">
96 ///
97 /// **Experimental.** This type is part of an experimental wire-protocol surface
98 /// and may change or be removed in future SDK or CLI releases.
99 ///
100 /// </div>
101 #[serde(rename = "session.fusion_route_started")]
102 SessionFusionRouteStarted,
103 ///
104 /// <div class="warning">
105 ///
106 /// **Experimental.** This type is part of an experimental wire-protocol surface
107 /// and may change or be removed in future SDK or CLI releases.
108 ///
109 /// </div>
110 #[serde(rename = "session.fusion_route_failed")]
111 SessionFusionRouteFailed,
112 ///
113 /// <div class="warning">
114 ///
115 /// **Experimental.** This type is part of an experimental wire-protocol surface
116 /// and may change or be removed in future SDK or CLI releases.
117 ///
118 /// </div>
119 #[serde(rename = "session.fusion_resolved")]
120 SessionFusionResolved,
121 ///
122 /// <div class="warning">
123 ///
124 /// **Experimental.** This type is part of an experimental wire-protocol surface
125 /// and may change or be removed in future SDK or CLI releases.
126 ///
127 /// </div>
128 #[serde(rename = "session.fusion_completed")]
129 SessionFusionCompleted,
130 #[serde(rename = "user.message")]
131 UserMessage,
132 #[serde(rename = "pending_messages.modified")]
133 PendingMessagesModified,
134 #[serde(rename = "assistant.turn_start")]
135 AssistantTurnStart,
136 #[serde(rename = "assistant.turn_retry")]
137 AssistantTurnRetry,
138 #[serde(rename = "agent.interrupted")]
139 AgentInterrupted,
140 #[serde(rename = "assistant.intent")]
141 AssistantIntent,
142 ///
143 /// <div class="warning">
144 ///
145 /// **Experimental.** This type is part of an experimental wire-protocol surface
146 /// and may change or be removed in future SDK or CLI releases.
147 ///
148 /// </div>
149 #[serde(rename = "assistant.fusion_phase_started")]
150 AssistantFusionPhaseStarted,
151 ///
152 /// <div class="warning">
153 ///
154 /// **Experimental.** This type is part of an experimental wire-protocol surface
155 /// and may change or be removed in future SDK or CLI releases.
156 ///
157 /// </div>
158 #[serde(rename = "assistant.fusion_phase_activity")]
159 AssistantFusionPhaseActivity,
160 ///
161 /// <div class="warning">
162 ///
163 /// **Experimental.** This type is part of an experimental wire-protocol surface
164 /// and may change or be removed in future SDK or CLI releases.
165 ///
166 /// </div>
167 #[serde(rename = "assistant.fusion_phase_completed")]
168 AssistantFusionPhaseCompleted,
169 ///
170 /// <div class="warning">
171 ///
172 /// **Experimental.** This type is part of an experimental wire-protocol surface
173 /// and may change or be removed in future SDK or CLI releases.
174 ///
175 /// </div>
176 #[serde(rename = "assistant.fusion_phase_failed")]
177 AssistantFusionPhaseFailed,
178 #[serde(rename = "assistant.server_tool_progress")]
179 AssistantServerToolProgress,
180 #[serde(rename = "assistant.reasoning")]
181 AssistantReasoning,
182 #[serde(rename = "assistant.reasoning_delta")]
183 AssistantReasoningDelta,
184 #[serde(rename = "assistant.tool_call_delta")]
185 AssistantToolCallDelta,
186 #[serde(rename = "assistant.streaming_delta")]
187 AssistantStreamingDelta,
188 #[serde(rename = "assistant.message")]
189 AssistantMessage,
190 #[serde(rename = "assistant.message_start")]
191 AssistantMessageStart,
192 #[serde(rename = "assistant.message_delta")]
193 AssistantMessageDelta,
194 #[serde(rename = "assistant.turn_end")]
195 AssistantTurnEnd,
196 #[serde(rename = "assistant.idle")]
197 AssistantIdle,
198 #[serde(rename = "assistant.usage")]
199 AssistantUsage,
200 #[serde(rename = "prompt_cache_break")]
201 PromptCacheBreak,
202 #[serde(rename = "model.call_failure")]
203 ModelCallFailure,
204 #[serde(rename = "model.call_finished")]
205 ModelCallFinished,
206 #[serde(rename = "model.call_start")]
207 ModelCallStart,
208 #[serde(rename = "abort")]
209 Abort,
210 #[serde(rename = "tool.user_requested")]
211 ToolUserRequested,
212 #[serde(rename = "tool.execution_start")]
213 ToolExecutionStart,
214 #[serde(rename = "tool.execution_partial_result")]
215 ToolExecutionPartialResult,
216 #[serde(rename = "tool.execution_progress")]
217 ToolExecutionProgress,
218 #[serde(rename = "tool.execution_complete")]
219 ToolExecutionComplete,
220 #[serde(rename = "tool_search.activated")]
221 ToolSearchActivated,
222 #[serde(rename = "skill.invoked")]
223 SkillInvoked,
224 #[serde(rename = "sandbox.decision")]
225 SandboxDecision,
226 #[serde(rename = "subagent.started")]
227 SubagentStarted,
228 #[serde(rename = "subagent.configured")]
229 SubagentConfigured,
230 #[serde(rename = "subagent.completed")]
231 SubagentCompleted,
232 #[serde(rename = "subagent.failed")]
233 SubagentFailed,
234 #[serde(rename = "subagent.selected")]
235 SubagentSelected,
236 #[serde(rename = "subagent.deselected")]
237 SubagentDeselected,
238 #[serde(rename = "hook.start")]
239 HookStart,
240 #[serde(rename = "hook.end")]
241 HookEnd,
242 #[serde(rename = "hook.progress")]
243 HookProgress,
244 ///
245 /// <div class="warning">
246 ///
247 /// **Experimental.** This type is part of an experimental wire-protocol surface
248 /// and may change or be removed in future SDK or CLI releases.
249 ///
250 /// </div>
251 #[serde(rename = "session.binary_asset")]
252 SessionBinaryAsset,
253 #[serde(rename = "system.message")]
254 SystemMessage,
255 #[serde(rename = "system.notification")]
256 SystemNotification,
257 #[serde(rename = "permission.requested")]
258 PermissionRequested,
259 #[serde(rename = "permission.completed")]
260 PermissionCompleted,
261 #[serde(rename = "user_input.requested")]
262 UserInputRequested,
263 #[serde(rename = "user_input.completed")]
264 UserInputCompleted,
265 #[serde(rename = "elicitation.requested")]
266 ElicitationRequested,
267 #[serde(rename = "elicitation.completed")]
268 ElicitationCompleted,
269 #[serde(rename = "sampling.requested")]
270 SamplingRequested,
271 #[serde(rename = "sampling.completed")]
272 SamplingCompleted,
273 #[serde(rename = "mcp.oauth_required")]
274 McpOauthRequired,
275 #[serde(rename = "mcp.oauth_completed")]
276 McpOauthCompleted,
277 #[serde(rename = "mcp.headers_refresh_required")]
278 McpHeadersRefreshRequired,
279 #[serde(rename = "mcp.headers_refresh_completed")]
280 McpHeadersRefreshCompleted,
281 #[serde(rename = "session.custom_notification")]
282 SessionCustomNotification,
283 ///
284 /// <div class="warning">
285 ///
286 /// **Experimental.** This type is part of an experimental wire-protocol surface
287 /// and may change or be removed in future SDK or CLI releases.
288 ///
289 /// </div>
290 #[serde(rename = "ui.ephemeral_query")]
291 UiEphemeralQuery,
292 #[serde(rename = "external_tool.requested")]
293 ExternalToolRequested,
294 #[serde(rename = "external_tool.completed")]
295 ExternalToolCompleted,
296 #[serde(rename = "command.queued")]
297 CommandQueued,
298 #[serde(rename = "command.execute")]
299 CommandExecute,
300 #[serde(rename = "command.completed")]
301 CommandCompleted,
302 #[serde(rename = "auto_mode_switch.requested")]
303 AutoModeSwitchRequested,
304 #[serde(rename = "auto_mode_switch.completed")]
305 AutoModeSwitchCompleted,
306 #[serde(rename = "session_limits_exhausted.requested")]
307 SessionLimitsExhaustedRequested,
308 #[serde(rename = "session_limits_exhausted.completed")]
309 SessionLimitsExhaustedCompleted,
310 ///
311 /// <div class="warning">
312 ///
313 /// **Experimental.** This type is part of an experimental wire-protocol surface
314 /// and may change or be removed in future SDK or CLI releases.
315 ///
316 /// </div>
317 #[serde(rename = "session.auto_mode_resolved")]
318 SessionAutoModeResolved,
319 ///
320 /// <div class="warning">
321 ///
322 /// **Experimental.** This type is part of an experimental wire-protocol surface
323 /// and may change or be removed in future SDK or CLI releases.
324 ///
325 /// </div>
326 #[serde(rename = "session.managed_settings_resolved")]
327 SessionManagedSettingsResolved,
328 ///
329 /// <div class="warning">
330 ///
331 /// **Experimental.** This type is part of an experimental wire-protocol surface
332 /// and may change or be removed in future SDK or CLI releases.
333 ///
334 /// </div>
335 #[serde(rename = "session.managed_settings_enforced")]
336 SessionManagedSettingsEnforced,
337 #[serde(rename = "commands.changed")]
338 CommandsChanged,
339 #[serde(rename = "capabilities.changed")]
340 CapabilitiesChanged,
341 #[serde(rename = "exit_plan_mode.requested")]
342 ExitPlanModeRequested,
343 #[serde(rename = "exit_plan_mode.completed")]
344 ExitPlanModeCompleted,
345 #[serde(rename = "session.tools_updated")]
346 SessionToolsUpdated,
347 #[serde(rename = "session.background_tasks_changed")]
348 SessionBackgroundTasksChanged,
349 ///
350 /// <div class="warning">
351 ///
352 /// **Experimental.** This type is part of an experimental wire-protocol surface
353 /// and may change or be removed in future SDK or CLI releases.
354 ///
355 /// </div>
356 #[serde(rename = "factory.run_updated")]
357 FactoryRunUpdated,
358 ///
359 /// <div class="warning">
360 ///
361 /// **Experimental.** This type is part of an experimental wire-protocol surface
362 /// and may change or be removed in future SDK or CLI releases.
363 ///
364 /// </div>
365 #[serde(rename = "factory.run_started")]
366 FactoryRunStarted,
367 ///
368 /// <div class="warning">
369 ///
370 /// **Experimental.** This type is part of an experimental wire-protocol surface
371 /// and may change or be removed in future SDK or CLI releases.
372 ///
373 /// </div>
374 #[serde(rename = "factory.run_settled")]
375 FactoryRunSettled,
376 #[serde(rename = "session.skills_loaded")]
377 SessionSkillsLoaded,
378 #[serde(rename = "session.custom_agents_updated")]
379 SessionCustomAgentsUpdated,
380 #[serde(rename = "session.mcp_servers_loaded")]
381 SessionMcpServersLoaded,
382 #[serde(rename = "session.mcp_server_status_changed")]
383 SessionMcpServerStatusChanged,
384 #[serde(rename = "session.mcp_server_removed")]
385 SessionMcpServerRemoved,
386 #[serde(rename = "session.mcp_server_needs_reconnect")]
387 SessionMcpServerNeedsReconnect,
388 #[serde(rename = "mcp.tools.list_changed")]
389 McpToolsListChanged,
390 #[serde(rename = "mcp.resources.list_changed")]
391 McpResourcesListChanged,
392 #[serde(rename = "mcp.prompts.list_changed")]
393 McpPromptsListChanged,
394 #[serde(rename = "session.extensions_loaded")]
395 SessionExtensionsLoaded,
396 ///
397 /// <div class="warning">
398 ///
399 /// **Experimental.** This type is part of an experimental wire-protocol surface
400 /// and may change or be removed in future SDK or CLI releases.
401 ///
402 /// </div>
403 #[serde(rename = "session.canvas.opened")]
404 SessionCanvasOpened,
405 ///
406 /// <div class="warning">
407 ///
408 /// **Experimental.** This type is part of an experimental wire-protocol surface
409 /// and may change or be removed in future SDK or CLI releases.
410 ///
411 /// </div>
412 #[serde(rename = "session.canvas.registry_changed")]
413 SessionCanvasRegistryChanged,
414 ///
415 /// <div class="warning">
416 ///
417 /// **Experimental.** This type is part of an experimental wire-protocol surface
418 /// and may change or be removed in future SDK or CLI releases.
419 ///
420 /// </div>
421 #[serde(rename = "session.canvas.closed")]
422 SessionCanvasClosed,
423 ///
424 /// <div class="warning">
425 ///
426 /// **Experimental.** This type is part of an experimental wire-protocol surface
427 /// and may change or be removed in future SDK or CLI releases.
428 ///
429 /// </div>
430 #[serde(rename = "session.canvas.unavailable")]
431 SessionCanvasUnavailable,
432 ///
433 /// <div class="warning">
434 ///
435 /// **Experimental.** This type is part of an experimental wire-protocol surface
436 /// and may change or be removed in future SDK or CLI releases.
437 ///
438 /// </div>
439 #[serde(rename = "session.canvas.recorded")]
440 SessionCanvasRecorded,
441 ///
442 /// <div class="warning">
443 ///
444 /// **Experimental.** This type is part of an experimental wire-protocol surface
445 /// and may change or be removed in future SDK or CLI releases.
446 ///
447 /// </div>
448 #[serde(rename = "session.canvas.removed")]
449 SessionCanvasRemoved,
450 #[serde(rename = "session.extensions.attachments_pushed")]
451 SessionExtensionsAttachmentsPushed,
452 #[serde(rename = "mcp_app.tool_call_complete")]
453 McpAppToolCallComplete,
454 /// Unknown event type for forward compatibility.
455 #[default]
456 #[serde(other)]
457 Unknown,
458}
459
460/// Typed session event data, discriminated by the event `type` field.
461///
462/// Use with [`TypedSessionEvent`] for fully typed event handling.
463#[derive(Debug, Clone, Serialize, Deserialize)]
464#[serde(tag = "type", content = "data")]
465pub enum SessionEventData {
466 #[serde(rename = "session.start")]
467 SessionStart(SessionStartData),
468 #[serde(rename = "session.resume")]
469 SessionResume(SessionResumeData),
470 #[serde(rename = "session.remote_steerable_changed")]
471 SessionRemoteSteerableChanged(SessionRemoteSteerableChangedData),
472 #[serde(rename = "session.error")]
473 SessionError(SessionErrorData),
474 #[serde(rename = "session.idle")]
475 SessionIdle(SessionIdleData),
476 #[serde(rename = "session.title_changed")]
477 SessionTitleChanged(SessionTitleChangedData),
478 #[serde(rename = "session.schedule_created")]
479 SessionScheduleCreated(SessionScheduleCreatedData),
480 #[serde(rename = "session.schedule_cancelled")]
481 SessionScheduleCancelled(SessionScheduleCancelledData),
482 #[serde(rename = "session.schedule_rearmed")]
483 SessionScheduleRearmed(SessionScheduleRearmedData),
484 #[serde(rename = "session.autopilot_objective_changed")]
485 SessionAutopilotObjectiveChanged(SessionAutopilotObjectiveChangedData),
486 #[serde(rename = "session.info")]
487 SessionInfo(SessionInfoData),
488 #[serde(rename = "session.warning")]
489 SessionWarning(SessionWarningData),
490 #[serde(rename = "session.model_change")]
491 SessionModelChange(SessionModelChangeData),
492 #[serde(rename = "session.auto_tier_switch_failed")]
493 SessionAutoTierSwitchFailed(SessionAutoTierSwitchFailedData),
494 #[serde(rename = "session.mode_changed")]
495 SessionModeChanged(SessionModeChangedData),
496 #[serde(rename = "session.mode_notice_delivered")]
497 SessionModeNoticeDelivered(SessionModeNoticeDeliveredData),
498 #[serde(rename = "session.session_limits_changed")]
499 SessionSessionLimitsChanged(SessionSessionLimitsChangedData),
500 ///
501 /// <div class="warning">
502 ///
503 /// **Experimental.** This type is part of an experimental wire-protocol surface
504 /// and may change or be removed in future SDK or CLI releases.
505 ///
506 /// </div>
507 #[serde(rename = "session.permissions_changed")]
508 SessionPermissionsChanged(SessionPermissionsChangedData),
509 #[serde(rename = "session.plan_changed")]
510 SessionPlanChanged(SessionPlanChangedData),
511 #[serde(rename = "session.todos_changed")]
512 SessionTodosChanged(SessionTodosChangedData),
513 #[serde(rename = "session.workspace_file_changed")]
514 SessionWorkspaceFileChanged(SessionWorkspaceFileChangedData),
515 #[serde(rename = "session.handoff")]
516 SessionHandoff(SessionHandoffData),
517 #[serde(rename = "session.truncation")]
518 SessionTruncation(SessionTruncationData),
519 #[serde(rename = "session.snapshot_rewind")]
520 SessionSnapshotRewind(SessionSnapshotRewindData),
521 #[serde(rename = "session.shutdown")]
522 SessionShutdown(SessionShutdownData),
523 #[serde(rename = "session.usage_checkpoint")]
524 SessionUsageCheckpoint(SessionUsageCheckpointData),
525 #[serde(rename = "session.context_changed")]
526 SessionContextChanged(SessionContextChangedData),
527 #[serde(rename = "session.usage_info")]
528 SessionUsageInfo(SessionUsageInfoData),
529 #[serde(rename = "session.context_cleared")]
530 SessionContextCleared(SessionContextClearedData),
531 #[serde(rename = "session.compaction_start")]
532 SessionCompactionStart(SessionCompactionStartData),
533 #[serde(rename = "session.compaction_complete")]
534 SessionCompactionComplete(SessionCompactionCompleteData),
535 #[serde(rename = "session.task_complete")]
536 SessionTaskComplete(SessionTaskCompleteData),
537 ///
538 /// <div class="warning">
539 ///
540 /// **Experimental.** This type is part of an experimental wire-protocol surface
541 /// and may change or be removed in future SDK or CLI releases.
542 ///
543 /// </div>
544 #[serde(rename = "session.completion_receipt")]
545 SessionCompletionReceipt(SessionCompletionReceiptData),
546 ///
547 /// <div class="warning">
548 ///
549 /// **Experimental.** This type is part of an experimental wire-protocol surface
550 /// and may change or be removed in future SDK or CLI releases.
551 ///
552 /// </div>
553 #[serde(rename = "session.fusion_route_started")]
554 SessionFusionRouteStarted(SessionFusionRouteStartedData),
555 ///
556 /// <div class="warning">
557 ///
558 /// **Experimental.** This type is part of an experimental wire-protocol surface
559 /// and may change or be removed in future SDK or CLI releases.
560 ///
561 /// </div>
562 #[serde(rename = "session.fusion_route_failed")]
563 SessionFusionRouteFailed(SessionFusionRouteFailedData),
564 ///
565 /// <div class="warning">
566 ///
567 /// **Experimental.** This type is part of an experimental wire-protocol surface
568 /// and may change or be removed in future SDK or CLI releases.
569 ///
570 /// </div>
571 #[serde(rename = "session.fusion_resolved")]
572 SessionFusionResolved(SessionFusionResolvedData),
573 ///
574 /// <div class="warning">
575 ///
576 /// **Experimental.** This type is part of an experimental wire-protocol surface
577 /// and may change or be removed in future SDK or CLI releases.
578 ///
579 /// </div>
580 #[serde(rename = "session.fusion_completed")]
581 SessionFusionCompleted(SessionFusionCompletedData),
582 #[serde(rename = "user.message")]
583 UserMessage(UserMessageData),
584 #[serde(rename = "pending_messages.modified")]
585 PendingMessagesModified(PendingMessagesModifiedData),
586 #[serde(rename = "assistant.turn_start")]
587 AssistantTurnStart(AssistantTurnStartData),
588 #[serde(rename = "assistant.turn_retry")]
589 AssistantTurnRetry(AssistantTurnRetryData),
590 #[serde(rename = "agent.interrupted")]
591 AgentInterrupted(AgentInterruptedData),
592 #[serde(rename = "assistant.intent")]
593 AssistantIntent(AssistantIntentData),
594 ///
595 /// <div class="warning">
596 ///
597 /// **Experimental.** This type is part of an experimental wire-protocol surface
598 /// and may change or be removed in future SDK or CLI releases.
599 ///
600 /// </div>
601 #[serde(rename = "assistant.fusion_phase_started")]
602 AssistantFusionPhaseStarted(AssistantFusionPhaseStartedData),
603 ///
604 /// <div class="warning">
605 ///
606 /// **Experimental.** This type is part of an experimental wire-protocol surface
607 /// and may change or be removed in future SDK or CLI releases.
608 ///
609 /// </div>
610 #[serde(rename = "assistant.fusion_phase_activity")]
611 AssistantFusionPhaseActivity(AssistantFusionPhaseActivityData),
612 ///
613 /// <div class="warning">
614 ///
615 /// **Experimental.** This type is part of an experimental wire-protocol surface
616 /// and may change or be removed in future SDK or CLI releases.
617 ///
618 /// </div>
619 #[serde(rename = "assistant.fusion_phase_completed")]
620 AssistantFusionPhaseCompleted(AssistantFusionPhaseCompletedData),
621 ///
622 /// <div class="warning">
623 ///
624 /// **Experimental.** This type is part of an experimental wire-protocol surface
625 /// and may change or be removed in future SDK or CLI releases.
626 ///
627 /// </div>
628 #[serde(rename = "assistant.fusion_phase_failed")]
629 AssistantFusionPhaseFailed(AssistantFusionPhaseFailedData),
630 #[serde(rename = "assistant.server_tool_progress")]
631 AssistantServerToolProgress(AssistantServerToolProgressData),
632 #[serde(rename = "assistant.reasoning")]
633 AssistantReasoning(AssistantReasoningData),
634 #[serde(rename = "assistant.reasoning_delta")]
635 AssistantReasoningDelta(AssistantReasoningDeltaData),
636 #[serde(rename = "assistant.tool_call_delta")]
637 AssistantToolCallDelta(AssistantToolCallDeltaData),
638 #[serde(rename = "assistant.streaming_delta")]
639 AssistantStreamingDelta(AssistantStreamingDeltaData),
640 #[serde(rename = "assistant.message")]
641 AssistantMessage(AssistantMessageData),
642 #[serde(rename = "assistant.message_start")]
643 AssistantMessageStart(AssistantMessageStartData),
644 #[serde(rename = "assistant.message_delta")]
645 AssistantMessageDelta(AssistantMessageDeltaData),
646 #[serde(rename = "assistant.turn_end")]
647 AssistantTurnEnd(AssistantTurnEndData),
648 #[serde(rename = "assistant.idle")]
649 AssistantIdle(AssistantIdleData),
650 #[serde(rename = "assistant.usage")]
651 AssistantUsage(AssistantUsageData),
652 #[serde(rename = "prompt_cache_break")]
653 PromptCacheBreak(PromptCacheBreakData),
654 #[serde(rename = "model.call_failure")]
655 ModelCallFailure(ModelCallFailureData),
656 #[serde(rename = "model.call_finished")]
657 ModelCallFinished(ModelCallFinishedData),
658 #[serde(rename = "model.call_start")]
659 ModelCallStart(ModelCallStartData),
660 #[serde(rename = "abort")]
661 Abort(AbortData),
662 #[serde(rename = "tool.user_requested")]
663 ToolUserRequested(ToolUserRequestedData),
664 #[serde(rename = "tool.execution_start")]
665 ToolExecutionStart(ToolExecutionStartData),
666 #[serde(rename = "tool.execution_partial_result")]
667 ToolExecutionPartialResult(ToolExecutionPartialResultData),
668 #[serde(rename = "tool.execution_progress")]
669 ToolExecutionProgress(ToolExecutionProgressData),
670 #[serde(rename = "tool.execution_complete")]
671 ToolExecutionComplete(ToolExecutionCompleteData),
672 #[serde(rename = "tool_search.activated")]
673 ToolSearchActivated(ToolSearchActivatedData),
674 #[serde(rename = "skill.invoked")]
675 SkillInvoked(SkillInvokedData),
676 #[serde(rename = "sandbox.decision")]
677 SandboxDecision(SandboxDecisionData),
678 #[serde(rename = "subagent.started")]
679 SubagentStarted(SubagentStartedData),
680 #[serde(rename = "subagent.configured")]
681 SubagentConfigured(SubagentConfiguredData),
682 #[serde(rename = "subagent.completed")]
683 SubagentCompleted(SubagentCompletedData),
684 #[serde(rename = "subagent.failed")]
685 SubagentFailed(SubagentFailedData),
686 #[serde(rename = "subagent.selected")]
687 SubagentSelected(SubagentSelectedData),
688 #[serde(rename = "subagent.deselected")]
689 SubagentDeselected(SubagentDeselectedData),
690 #[serde(rename = "hook.start")]
691 HookStart(HookStartData),
692 #[serde(rename = "hook.end")]
693 HookEnd(HookEndData),
694 #[serde(rename = "hook.progress")]
695 HookProgress(HookProgressData),
696 #[serde(rename = "session.binary_asset")]
697 SessionBinaryAsset(SessionBinaryAssetData),
698 #[serde(rename = "system.message")]
699 SystemMessage(SystemMessageData),
700 #[serde(rename = "system.notification")]
701 SystemNotification(SystemNotificationData),
702 #[serde(rename = "permission.requested")]
703 PermissionRequested(PermissionRequestedData),
704 #[serde(rename = "permission.completed")]
705 PermissionCompleted(PermissionCompletedData),
706 #[serde(rename = "user_input.requested")]
707 UserInputRequested(UserInputRequestedData),
708 #[serde(rename = "user_input.completed")]
709 UserInputCompleted(UserInputCompletedData),
710 #[serde(rename = "elicitation.requested")]
711 ElicitationRequested(ElicitationRequestedData),
712 #[serde(rename = "elicitation.completed")]
713 ElicitationCompleted(ElicitationCompletedData),
714 #[serde(rename = "sampling.requested")]
715 SamplingRequested(SamplingRequestedData),
716 #[serde(rename = "sampling.completed")]
717 SamplingCompleted(SamplingCompletedData),
718 #[serde(rename = "mcp.oauth_required")]
719 McpOauthRequired(McpOauthRequiredData),
720 #[serde(rename = "mcp.oauth_completed")]
721 McpOauthCompleted(McpOauthCompletedData),
722 #[serde(rename = "mcp.headers_refresh_required")]
723 McpHeadersRefreshRequired(McpHeadersRefreshRequiredData),
724 #[serde(rename = "mcp.headers_refresh_completed")]
725 McpHeadersRefreshCompleted(McpHeadersRefreshCompletedData),
726 #[serde(rename = "session.custom_notification")]
727 SessionCustomNotification(SessionCustomNotificationData),
728 ///
729 /// <div class="warning">
730 ///
731 /// **Experimental.** This type is part of an experimental wire-protocol surface
732 /// and may change or be removed in future SDK or CLI releases.
733 ///
734 /// </div>
735 #[serde(rename = "ui.ephemeral_query")]
736 UiEphemeralQuery(UiEphemeralQueryData),
737 #[serde(rename = "external_tool.requested")]
738 ExternalToolRequested(ExternalToolRequestedData),
739 #[serde(rename = "external_tool.completed")]
740 ExternalToolCompleted(ExternalToolCompletedData),
741 #[serde(rename = "command.queued")]
742 CommandQueued(CommandQueuedData),
743 #[serde(rename = "command.execute")]
744 CommandExecute(CommandExecuteData),
745 #[serde(rename = "command.completed")]
746 CommandCompleted(CommandCompletedData),
747 #[serde(rename = "auto_mode_switch.requested")]
748 AutoModeSwitchRequested(AutoModeSwitchRequestedData),
749 #[serde(rename = "auto_mode_switch.completed")]
750 AutoModeSwitchCompleted(AutoModeSwitchCompletedData),
751 #[serde(rename = "session_limits_exhausted.requested")]
752 SessionLimitsExhaustedRequested(SessionLimitsExhaustedRequestedData),
753 #[serde(rename = "session_limits_exhausted.completed")]
754 SessionLimitsExhaustedCompleted(SessionLimitsExhaustedCompletedData),
755 ///
756 /// <div class="warning">
757 ///
758 /// **Experimental.** This type is part of an experimental wire-protocol surface
759 /// and may change or be removed in future SDK or CLI releases.
760 ///
761 /// </div>
762 #[serde(rename = "session.auto_mode_resolved")]
763 SessionAutoModeResolved(SessionAutoModeResolvedData),
764 ///
765 /// <div class="warning">
766 ///
767 /// **Experimental.** This type is part of an experimental wire-protocol surface
768 /// and may change or be removed in future SDK or CLI releases.
769 ///
770 /// </div>
771 #[serde(rename = "session.managed_settings_resolved")]
772 SessionManagedSettingsResolved(SessionManagedSettingsResolvedData),
773 ///
774 /// <div class="warning">
775 ///
776 /// **Experimental.** This type is part of an experimental wire-protocol surface
777 /// and may change or be removed in future SDK or CLI releases.
778 ///
779 /// </div>
780 #[serde(rename = "session.managed_settings_enforced")]
781 SessionManagedSettingsEnforced(SessionManagedSettingsEnforcedData),
782 #[serde(rename = "commands.changed")]
783 CommandsChanged(CommandsChangedData),
784 #[serde(rename = "capabilities.changed")]
785 CapabilitiesChanged(CapabilitiesChangedData),
786 #[serde(rename = "exit_plan_mode.requested")]
787 ExitPlanModeRequested(ExitPlanModeRequestedData),
788 #[serde(rename = "exit_plan_mode.completed")]
789 ExitPlanModeCompleted(ExitPlanModeCompletedData),
790 #[serde(rename = "session.tools_updated")]
791 SessionToolsUpdated(SessionToolsUpdatedData),
792 #[serde(rename = "session.background_tasks_changed")]
793 SessionBackgroundTasksChanged(SessionBackgroundTasksChangedData),
794 ///
795 /// <div class="warning">
796 ///
797 /// **Experimental.** This type is part of an experimental wire-protocol surface
798 /// and may change or be removed in future SDK or CLI releases.
799 ///
800 /// </div>
801 #[serde(rename = "factory.run_updated")]
802 FactoryRunUpdated(FactoryRunUpdatedData),
803 ///
804 /// <div class="warning">
805 ///
806 /// **Experimental.** This type is part of an experimental wire-protocol surface
807 /// and may change or be removed in future SDK or CLI releases.
808 ///
809 /// </div>
810 #[serde(rename = "factory.run_started")]
811 FactoryRunStarted(FactoryRunStartedData),
812 ///
813 /// <div class="warning">
814 ///
815 /// **Experimental.** This type is part of an experimental wire-protocol surface
816 /// and may change or be removed in future SDK or CLI releases.
817 ///
818 /// </div>
819 #[serde(rename = "factory.run_settled")]
820 FactoryRunSettled(FactoryRunSettledData),
821 #[serde(rename = "session.skills_loaded")]
822 SessionSkillsLoaded(SessionSkillsLoadedData),
823 #[serde(rename = "session.custom_agents_updated")]
824 SessionCustomAgentsUpdated(SessionCustomAgentsUpdatedData),
825 #[serde(rename = "session.mcp_servers_loaded")]
826 SessionMcpServersLoaded(SessionMcpServersLoadedData),
827 #[serde(rename = "session.mcp_server_status_changed")]
828 SessionMcpServerStatusChanged(SessionMcpServerStatusChangedData),
829 #[serde(rename = "session.mcp_server_removed")]
830 SessionMcpServerRemoved(SessionMcpServerRemovedData),
831 #[serde(rename = "session.mcp_server_needs_reconnect")]
832 SessionMcpServerNeedsReconnect(SessionMcpServerNeedsReconnectData),
833 #[serde(rename = "mcp.tools.list_changed")]
834 McpToolsListChanged(McpToolsListChangedData),
835 #[serde(rename = "mcp.resources.list_changed")]
836 McpResourcesListChanged(McpResourcesListChangedData),
837 #[serde(rename = "mcp.prompts.list_changed")]
838 McpPromptsListChanged(McpPromptsListChangedData),
839 #[serde(rename = "session.extensions_loaded")]
840 SessionExtensionsLoaded(SessionExtensionsLoadedData),
841 ///
842 /// <div class="warning">
843 ///
844 /// **Experimental.** This type is part of an experimental wire-protocol surface
845 /// and may change or be removed in future SDK or CLI releases.
846 ///
847 /// </div>
848 #[serde(rename = "session.canvas.opened")]
849 SessionCanvasOpened(SessionCanvasOpenedData),
850 ///
851 /// <div class="warning">
852 ///
853 /// **Experimental.** This type is part of an experimental wire-protocol surface
854 /// and may change or be removed in future SDK or CLI releases.
855 ///
856 /// </div>
857 #[serde(rename = "session.canvas.registry_changed")]
858 SessionCanvasRegistryChanged(SessionCanvasRegistryChangedData),
859 ///
860 /// <div class="warning">
861 ///
862 /// **Experimental.** This type is part of an experimental wire-protocol surface
863 /// and may change or be removed in future SDK or CLI releases.
864 ///
865 /// </div>
866 #[serde(rename = "session.canvas.closed")]
867 SessionCanvasClosed(SessionCanvasClosedData),
868 ///
869 /// <div class="warning">
870 ///
871 /// **Experimental.** This type is part of an experimental wire-protocol surface
872 /// and may change or be removed in future SDK or CLI releases.
873 ///
874 /// </div>
875 #[serde(rename = "session.canvas.unavailable")]
876 SessionCanvasUnavailable(SessionCanvasUnavailableData),
877 ///
878 /// <div class="warning">
879 ///
880 /// **Experimental.** This type is part of an experimental wire-protocol surface
881 /// and may change or be removed in future SDK or CLI releases.
882 ///
883 /// </div>
884 #[serde(rename = "session.canvas.recorded")]
885 SessionCanvasRecorded(SessionCanvasRecordedData),
886 ///
887 /// <div class="warning">
888 ///
889 /// **Experimental.** This type is part of an experimental wire-protocol surface
890 /// and may change or be removed in future SDK or CLI releases.
891 ///
892 /// </div>
893 #[serde(rename = "session.canvas.removed")]
894 SessionCanvasRemoved(SessionCanvasRemovedData),
895 #[serde(rename = "session.extensions.attachments_pushed")]
896 SessionExtensionsAttachmentsPushed(SessionExtensionsAttachmentsPushedData),
897 #[serde(rename = "mcp_app.tool_call_complete")]
898 McpAppToolCallComplete(McpAppToolCallCompleteData),
899}
900
901/// A session event with typed data payload.
902///
903/// The common event fields (id, timestamp, parentId, ephemeral, agentId)
904/// are available directly. The event-specific data is in the `payload`
905/// field as a [`SessionEventData`] enum.
906#[derive(Debug, Clone, Serialize, Deserialize)]
907#[serde(rename_all = "camelCase")]
908pub struct TypedSessionEvent {
909 /// Unique event identifier (UUID v4).
910 pub id: String,
911 /// ISO 8601 timestamp when the event was created.
912 pub timestamp: String,
913 /// ID of the preceding event in the chain.
914 #[serde(skip_serializing_if = "Option::is_none")]
915 pub parent_id: Option<String>,
916 /// When true, the event is transient and not persisted.
917 #[serde(skip_serializing_if = "Option::is_none")]
918 pub ephemeral: Option<bool>,
919 /// Sub-agent instance identifier. Absent for events from the root /
920 /// main agent and session-level events.
921 #[serde(skip_serializing_if = "Option::is_none")]
922 pub agent_id: Option<String>,
923 /// The typed event payload (discriminated by event type).
924 #[serde(flatten)]
925 pub payload: SessionEventData,
926}
927
928/// Working directory and git context at session start
929#[derive(Debug, Clone, Default, Serialize, Deserialize)]
930#[serde(rename_all = "camelCase")]
931pub struct WorkingDirectoryContext {
932 /// Base commit of current git branch at session start time
933 #[serde(skip_serializing_if = "Option::is_none")]
934 pub base_commit: Option<String>,
935 /// Current git branch name
936 #[serde(skip_serializing_if = "Option::is_none")]
937 pub branch: Option<String>,
938 /// Current working directory path
939 pub cwd: String,
940 /// Root directory of the git repository, resolved via git rev-parse
941 #[serde(skip_serializing_if = "Option::is_none")]
942 pub git_root: Option<String>,
943 /// Head commit of current git branch at session start time
944 #[serde(skip_serializing_if = "Option::is_none")]
945 pub head_commit: Option<String>,
946 /// Hosting platform type of the repository (github or ado)
947 #[serde(skip_serializing_if = "Option::is_none")]
948 pub host_type: Option<WorkingDirectoryContextHostType>,
949 /// Set on the immediate preliminary event of a working-directory change, before the git context is resolved. A settled follow-up event (enriched with git context, or cwd-only for a non-repository) is always emitted afterward, so observers may defer to it. Absent on standalone/final events (e.g. relay context changes).
950 #[serde(skip_serializing_if = "Option::is_none")]
951 pub pending_git_context: Option<bool>,
952 /// Repository identifier derived from the git remote URL ("owner/name" for GitHub, "org/project/repo" for Azure DevOps)
953 #[serde(skip_serializing_if = "Option::is_none")]
954 pub repository: Option<String>,
955 /// Raw host string from the git remote URL (e.g. "github.com", "mycompany.ghe.com", "dev.azure.com")
956 #[serde(skip_serializing_if = "Option::is_none")]
957 pub repository_host: Option<String>,
958}
959
960/// Per-session configuration for the built-in GitHub MCP server
961#[derive(Debug, Clone, Default, Serialize, Deserialize)]
962#[serde(rename_all = "camelCase")]
963pub struct GitHubMcpToolConfig {
964 /// Additional GitHub MCP tools requested by the session
965 #[serde(skip_serializing_if = "Option::is_none")]
966 pub additional_tools: Option<Vec<String>>,
967 /// Additional GitHub MCP toolsets requested by the session
968 #[serde(skip_serializing_if = "Option::is_none")]
969 pub additional_toolsets: Option<Vec<String>>,
970 /// Whether to use the read-write endpoint and request all toolsets
971 #[serde(skip_serializing_if = "Option::is_none")]
972 pub enable_all_tools: Option<bool>,
973 /// Whether to request the GitHub MCP insiders build
974 #[serde(skip_serializing_if = "Option::is_none")]
975 pub enable_insiders_mode: Option<bool>,
976}
977
978/// Optional session limits.
979#[derive(Debug, Clone, Default, Serialize, Deserialize)]
980#[serde(rename_all = "camelCase")]
981pub struct SessionLimitsConfig {
982 /// Maximum AI Credits allowed across the session's current accounting window.
983 #[serde(skip_serializing_if = "Option::is_none")]
984 pub max_ai_credits: Option<f64>,
985}
986
987/// Session event "session.start". Session initialization metadata including context and configuration
988#[derive(Debug, Clone, Default, Serialize, Deserialize)]
989#[serde(rename_all = "camelCase")]
990pub struct SessionStartData {
991 /// Whether the session was already in use by another client at start time
992 #[serde(skip_serializing_if = "Option::is_none")]
993 pub already_in_use: Option<bool>,
994 /// Auto routing preference selected at session creation time
995 #[serde(skip_serializing_if = "Option::is_none")]
996 pub auto_tier: Option<AutoTier>,
997 /// Working directory and git context at session start
998 #[serde(skip_serializing_if = "Option::is_none")]
999 pub context: Option<WorkingDirectoryContext>,
1000 /// Context tier selected at session creation time for models with tiered context pricing; null when no tier is selected (e.g., non-tiered model)
1001 #[serde(skip_serializing_if = "Option::is_none")]
1002 pub context_tier: Option<ContextTier>,
1003 /// Version string of the Copilot application
1004 pub copilot_version: String,
1005 /// 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.
1006 #[serde(skip_serializing_if = "Option::is_none")]
1007 pub detached_from_spawning_parent_session_id: Option<String>,
1008 /// Per-session GitHub MCP override persisted for cold resume
1009 #[serde(skip_serializing_if = "Option::is_none")]
1010 pub github_mcp_tool_config: Option<GitHubMcpToolConfig>,
1011 /// Identifier of the software producing the events (e.g., "copilot-agent")
1012 pub producer: String,
1013 /// Reasoning effort level used for model calls, if applicable (e.g. "none", "low", "medium", "high", "xhigh", "max")
1014 #[serde(skip_serializing_if = "Option::is_none")]
1015 pub reasoning_effort: Option<String>,
1016 /// Reasoning summary mode used for model calls, if applicable (e.g. "none", "concise", "detailed")
1017 #[serde(skip_serializing_if = "Option::is_none")]
1018 pub reasoning_summary: Option<ReasoningSummary>,
1019 /// Whether this session supports remote steering via GitHub
1020 #[serde(skip_serializing_if = "Option::is_none")]
1021 pub remote_steerable: Option<bool>,
1022 /// Model selected at session creation time, if any
1023 #[serde(skip_serializing_if = "Option::is_none")]
1024 pub selected_model: Option<String>,
1025 /// Unique identifier for the session
1026 pub session_id: SessionId,
1027 /// Session limits configured at session creation time, if any
1028 #[serde(skip_serializing_if = "Option::is_none")]
1029 pub session_limits: Option<SessionLimitsConfig>,
1030 /// ISO 8601 timestamp when the session was created
1031 pub start_time: String,
1032 /// Output verbosity level used for model calls, if applicable (e.g. "low", "medium", "high")
1033 #[serde(skip_serializing_if = "Option::is_none")]
1034 pub verbosity: Option<Verbosity>,
1035 /// Schema version number for the session event format
1036 pub version: i64,
1037}
1038
1039/// Session event "session.resume". Session resume metadata including current context and event count
1040#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1041#[serde(rename_all = "camelCase")]
1042pub struct SessionResumeData {
1043 /// Whether the session was already in use by another client at resume time
1044 #[serde(skip_serializing_if = "Option::is_none")]
1045 pub already_in_use: Option<bool>,
1046 /// Auto routing preference active at resume time
1047 #[serde(skip_serializing_if = "Option::is_none")]
1048 pub auto_tier: Option<AutoTier>,
1049 /// Updated working directory and git context at resume time
1050 #[serde(skip_serializing_if = "Option::is_none")]
1051 pub context: Option<WorkingDirectoryContext>,
1052 /// Context tier currently selected at resume time; null when no tier is active
1053 #[serde(skip_serializing_if = "Option::is_none")]
1054 pub context_tier: Option<ContextTier>,
1055 /// When true, tool calls and permission requests left in flight by the previous session lifetime remain pending after resume and the agentic loop awaits their results. User sends are queued behind the pending work until all such requests reach a terminal state. When false or omitted, pending work is normally marked as interrupted unless the resume passively joined live work owned by another client; sessionWasActive distinguishes that case.
1056 #[serde(skip_serializing_if = "Option::is_none")]
1057 pub continue_pending_work: Option<bool>,
1058 /// Total number of persisted events in the session at the time of resume
1059 pub event_count: i64,
1060 /// 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
1061 #[serde(skip_serializing_if = "Option::is_none")]
1062 pub events_file_size_bytes: Option<i64>,
1063 /// Reasoning effort level used for model calls, if applicable (e.g. "none", "low", "medium", "high", "xhigh", "max")
1064 #[serde(skip_serializing_if = "Option::is_none")]
1065 pub reasoning_effort: Option<String>,
1066 /// Reasoning summary mode used for model calls, if applicable (e.g. "none", "concise", "detailed")
1067 #[serde(skip_serializing_if = "Option::is_none")]
1068 pub reasoning_summary: Option<ReasoningSummary>,
1069 /// Whether this session supports remote steering via GitHub
1070 #[serde(skip_serializing_if = "Option::is_none")]
1071 pub remote_steerable: Option<bool>,
1072 /// ISO 8601 timestamp when the session was resumed
1073 pub resume_time: String,
1074 /// Model currently selected at resume time
1075 #[serde(skip_serializing_if = "Option::is_none")]
1076 pub selected_model: Option<String>,
1077 /// Session limits currently configured at resume time; null when no limits are active
1078 #[serde(skip_serializing_if = "Option::is_none")]
1079 pub session_limits: Option<SessionLimitsConfig>,
1080 /// True when this resume passively joined a session that already had live work running in the runtime - an agent turn, a native queue run, a queued resume continuation, or an in-flight send (for example, an extension joining a session another client was actively driving). False (or omitted) when the session had no live work or when the resume explicitly abandoned pending work, including cold resumes and suspended sessions that remain resident in memory.
1081 #[serde(skip_serializing_if = "Option::is_none")]
1082 pub session_was_active: Option<bool>,
1083 /// Output verbosity level used for model calls, if applicable (e.g. "low", "medium", "high")
1084 #[serde(skip_serializing_if = "Option::is_none")]
1085 pub verbosity: Option<Verbosity>,
1086}
1087
1088/// Session event "session.remote_steerable_changed". Notifies that the session's remote steering capability has changed
1089#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1090#[serde(rename_all = "camelCase")]
1091pub struct SessionRemoteSteerableChangedData {
1092 /// Whether this session now supports remote steering via GitHub
1093 pub remote_steerable: bool,
1094}
1095
1096/// Session event "session.error". Error details for timeline display including message and optional diagnostic information
1097#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1098#[serde(rename_all = "camelCase")]
1099pub struct SessionErrorData {
1100 /// 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.
1101 #[serde(skip_serializing_if = "Option::is_none")]
1102 pub eligible_for_auto_switch: Option<bool>,
1103 /// 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"`).
1104 #[serde(skip_serializing_if = "Option::is_none")]
1105 pub error_code: Option<String>,
1106 /// Category of error (e.g., "authentication", "authorization", "quota", "rate_limit", "context_limit", "query")
1107 pub error_type: String,
1108 /// Human-readable error message
1109 pub message: String,
1110 /// GitHub request tracing ID (x-github-request-id header) for correlating with server-side logs
1111 #[serde(skip_serializing_if = "Option::is_none")]
1112 pub provider_call_id: Option<String>,
1113 /// What the user must do to recover, when the runtime knows of an action. The `message` never names a client affordance, so a client that offers one — a slash command, a settings pane, a link — renders it from this value.
1114 #[serde(skip_serializing_if = "Option::is_none")]
1115 pub remediation: Option<RemediationAction>,
1116 /// Copilot service request ID (x-copilot-service-request-id header) for CAPI log correlation
1117 #[serde(skip_serializing_if = "Option::is_none")]
1118 pub service_request_id: Option<String>,
1119 /// Error stack trace, when available
1120 #[serde(skip_serializing_if = "Option::is_none")]
1121 pub stack: Option<String>,
1122 /// HTTP status code from the upstream request, if applicable
1123 #[serde(skip_serializing_if = "Option::is_none")]
1124 pub status_code: Option<i32>,
1125 /// Optional URL associated with this error that the user can open in a browser
1126 #[serde(skip_serializing_if = "Option::is_none")]
1127 pub url: Option<String>,
1128}
1129
1130/// Session event "session.idle". Payload indicating the session is idle with no background agents or attached shell commands in flight
1131#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1132#[serde(rename_all = "camelCase")]
1133pub struct SessionIdleData {
1134 /// True when the preceding agentic loop was cancelled via abort signal
1135 #[serde(skip_serializing_if = "Option::is_none")]
1136 pub aborted: Option<bool>,
1137 /// The session mode the agent was operating in when it went idle, when the mode is known. Lets turn-scoped consumers distinguish an autopilot continuation boundary (where the agent keeps working after this idle) from a genuine turn completion.
1138 #[serde(skip_serializing_if = "Option::is_none")]
1139 pub mode: Option<SessionMode>,
1140}
1141
1142/// Session event "session.title_changed". Session title change payload containing the new display title
1143#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1144#[serde(rename_all = "camelCase")]
1145pub struct SessionTitleChangedData {
1146 /// The new display title for the session
1147 pub title: String,
1148}
1149
1150/// Session event "session.schedule_created". Scheduled prompt registered via /every or /after
1151#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1152#[serde(rename_all = "camelCase")]
1153pub struct SessionScheduleCreatedData {
1154 /// Absolute fire time (epoch milliseconds) for a one-shot calendar schedule
1155 #[serde(skip_serializing_if = "Option::is_none")]
1156 pub at: Option<i64>,
1157 /// 5-field cron expression for a recurring calendar schedule, evaluated in `tz`
1158 #[serde(skip_serializing_if = "Option::is_none")]
1159 pub cron: Option<String>,
1160 /// 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)
1161 #[serde(skip_serializing_if = "Option::is_none")]
1162 pub display_prompt: Option<String>,
1163 /// Sequential id assigned to the scheduled prompt within the session
1164 pub id: i64,
1165 /// Interval between ticks in milliseconds (relative-interval schedules)
1166 #[serde(skip_serializing_if = "Option::is_none")]
1167 pub interval_ms: Option<i64>,
1168 /// Who created the schedule (`user` or `model`). Persisted so a resumed session keeps gating non-user schedules from firing skills that opted out of model invocation. Absent on entries created before this field existed; a missing origin fails closed (treated the same as a non-user origin), so such a schedule may not resolve a `disable-model-invocation` skill.
1169 #[serde(skip_serializing_if = "Option::is_none")]
1170 pub origin: Option<ScheduleOrigin>,
1171 /// Prompt text that gets enqueued on every tick
1172 pub prompt: String,
1173 /// Whether the schedule re-arms after each tick (`/every`) or fires once (`/after`)
1174 #[serde(skip_serializing_if = "Option::is_none")]
1175 pub recurring: Option<bool>,
1176 /// True for a self-paced (`dynamic`) schedule: no fixed cadence; the model arms each next run via the `manage_schedule` `wakeup` action. `nextRunAt` is model-controlled rather than auto-computed.
1177 #[serde(skip_serializing_if = "Option::is_none")]
1178 pub self_paced: Option<bool>,
1179 /// IANA timezone the `cron` expression is evaluated in
1180 #[serde(skip_serializing_if = "Option::is_none")]
1181 pub tz: Option<String>,
1182}
1183
1184/// Session event "session.schedule_cancelled". Scheduled prompt cancelled from the schedule manager dialog
1185#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1186#[serde(rename_all = "camelCase")]
1187pub struct SessionScheduleCancelledData {
1188 /// Id of the scheduled prompt that was cancelled
1189 pub id: i64,
1190}
1191
1192/// Session event "session.schedule_rearmed". Self-paced schedule re-armed for its next run
1193#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1194#[serde(rename_all = "camelCase")]
1195pub struct SessionScheduleRearmedData {
1196 /// Id of the self-paced schedule that was re-armed
1197 pub id: i64,
1198 /// Absolute time (epoch milliseconds) the model armed the next run to fire
1199 pub next_run_at: i64,
1200}
1201
1202/// Session event "session.autopilot_objective_changed". Autopilot objective state file operation details indicating what changed
1203#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1204#[serde(rename_all = "camelCase")]
1205pub struct SessionAutopilotObjectiveChangedData {
1206 /// Current autopilot objective id, if one exists
1207 #[serde(skip_serializing_if = "Option::is_none")]
1208 pub id: Option<i64>,
1209 /// The type of operation performed on the autopilot objective state file
1210 pub operation: AutopilotObjectiveChangedOperation,
1211 /// Current autopilot objective status, if one exists
1212 #[serde(skip_serializing_if = "Option::is_none")]
1213 pub status: Option<AutopilotObjectiveChangedStatus>,
1214}
1215
1216/// Session event "session.info". Informational message for timeline display with categorization
1217#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1218#[serde(rename_all = "camelCase")]
1219pub struct SessionInfoData {
1220 /// Category of informational message (e.g., "notification", "timing", "context_window", "mcp", "snapshot", "configuration", "authentication", "model")
1221 pub info_type: String,
1222 /// Human-readable informational message for display in the timeline
1223 pub message: String,
1224 /// Optional actionable tip displayed with this message
1225 #[serde(skip_serializing_if = "Option::is_none")]
1226 pub tip: Option<String>,
1227 /// Optional URL associated with this message that the user can open in a browser
1228 #[serde(skip_serializing_if = "Option::is_none")]
1229 pub url: Option<String>,
1230}
1231
1232/// Session event "session.warning". Warning message for timeline display with categorization
1233#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1234#[serde(rename_all = "camelCase")]
1235pub struct SessionWarningData {
1236 /// Human-readable warning message for display in the timeline
1237 pub message: String,
1238 /// What the user must do to recover, when the runtime knows of an action. The `message` never names a client affordance, so a client that offers one — a slash command, a settings pane, a link — renders it from this value.
1239 #[serde(skip_serializing_if = "Option::is_none")]
1240 pub remediation: Option<RemediationAction>,
1241 /// Optional URL associated with this warning that the user can open in a browser
1242 #[serde(skip_serializing_if = "Option::is_none")]
1243 pub url: Option<String>,
1244 /// Category of warning (e.g., "subscription", "policy", "mcp")
1245 pub warning_type: String,
1246}
1247
1248/// Session event "session.model_change". Model change details including previous and new model identifiers
1249#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1250#[serde(rename_all = "camelCase")]
1251pub struct SessionModelChangeData {
1252 /// Committed Auto preference after the model configuration change, when applicable.
1253 #[serde(skip_serializing_if = "Option::is_none")]
1254 pub auto_tier: Option<AutoTier>,
1255 /// Reason the change happened, when not user-initiated. `"rate_limit_auto_switch"` for changes triggered by the auto-mode-switch rate-limit recovery path, or `"refusal_fallback"` when the active model declined a request (content refusal) and the runtime switched to the configured refusal-fallback model. UI clients can use this to render contextual copy.
1256 #[serde(skip_serializing_if = "Option::is_none")]
1257 pub cause: Option<String>,
1258 /// Context tier after the model change; null explicitly clears a previously selected tier
1259 #[serde(skip_serializing_if = "Option::is_none")]
1260 pub context_tier: Option<ContextTier>,
1261 /// Newly selected model identifier
1262 pub new_model: String,
1263 /// Previously committed Auto preference, when one was explicitly selected.
1264 #[serde(skip_serializing_if = "Option::is_none")]
1265 pub previous_auto_tier: Option<AutoTier>,
1266 /// Model that was previously selected, if any
1267 #[serde(skip_serializing_if = "Option::is_none")]
1268 pub previous_model: Option<String>,
1269 /// Reasoning effort level before the model change, if applicable
1270 #[serde(skip_serializing_if = "Option::is_none")]
1271 pub previous_reasoning_effort: Option<String>,
1272 /// Reasoning summary mode before the model change, if applicable
1273 #[serde(skip_serializing_if = "Option::is_none")]
1274 pub previous_reasoning_summary: Option<ReasoningSummary>,
1275 /// Output verbosity level before the model change, if applicable
1276 #[serde(skip_serializing_if = "Option::is_none")]
1277 pub previous_verbosity: Option<Verbosity>,
1278 /// Reasoning effort level after the model change, if applicable
1279 #[serde(skip_serializing_if = "Option::is_none")]
1280 pub reasoning_effort: Option<String>,
1281 /// Reasoning summary mode after the model change, if applicable
1282 #[serde(skip_serializing_if = "Option::is_none")]
1283 pub reasoning_summary: Option<ReasoningSummary>,
1284 /// Origin of the effective model change, when known.
1285 #[serde(skip_serializing_if = "Option::is_none")]
1286 pub source: Option<ModelChangeSource>,
1287 /// Output verbosity level after the model change, if applicable
1288 #[serde(skip_serializing_if = "Option::is_none")]
1289 pub verbosity: Option<Verbosity>,
1290}
1291
1292/// Session event "session.auto_tier_switch_failed". A transient Auto preference failure emitted when the runtime cannot mint or accept a usable model and token pair. The previously effective preference remains active, so SDK clients can surface a non-blocking failure without changing their committed-tier state. This event is ephemeral and is not persisted or replayed on resume.
1293#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1294#[serde(rename_all = "camelCase")]
1295pub struct SessionAutoTierSwitchFailedData {
1296 /// Auto preference that remains effective after the failed request.
1297 #[serde(skip_serializing_if = "Option::is_none")]
1298 pub effective_auto_tier: Option<AutoTier>,
1299 /// Low-cardinality failure outcome reported by Auto resolution.
1300 pub reason: AutoTierSwitchFailureReason,
1301 /// Auto preference that failed to activate, or null when returning to provider-default routing failed.
1302 pub requested_auto_tier: Option<AutoTier>,
1303}
1304
1305/// Session event "session.mode_changed". Agent mode change details including previous and new modes
1306#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1307#[serde(rename_all = "camelCase")]
1308pub struct SessionModeChangedData {
1309 /// The session mode the agent is operating in
1310 pub new_mode: SessionMode,
1311 /// The session mode the agent is operating in
1312 pub previous_mode: SessionMode,
1313}
1314
1315/// Session event "session.mode_notice_delivered". Records that a mode transition notice reached the model so cache-stable mode tools can remain offered across resume.
1316#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1317#[serde(rename_all = "camelCase")]
1318pub struct SessionModeNoticeDeliveredData {
1319 /// Model-visible transition notice persisted for a mid-turn delivery
1320 #[serde(skip_serializing_if = "Option::is_none")]
1321 pub content: Option<String>,
1322 /// Mode established by the delivered transition notice
1323 pub mode: SessionMode,
1324}
1325
1326/// Session event "session.session_limits_changed". Session limits update details. Null clears the limits.
1327#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1328#[serde(rename_all = "camelCase")]
1329pub struct SessionSessionLimitsChangedData {
1330 /// Current session limits, or null when no limits are active
1331 pub session_limits: Option<SessionLimitsConfig>,
1332}
1333
1334/// Session event "session.permissions_changed". Permission-mode transition details.
1335///
1336/// <div class="warning">
1337///
1338/// **Experimental.** This type is part of an experimental wire-protocol surface
1339/// and may change or be removed in future SDK or CLI releases.
1340///
1341/// </div>
1342#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1343#[serde(rename_all = "camelCase")]
1344pub struct SessionPermissionsChangedData {
1345 /// Explicit LLM judge model override used by assisted mode; omitted when the provider default applies
1346 ///
1347 /// <div class="warning">
1348 ///
1349 /// **Experimental.** This type is part of an experimental wire-protocol surface
1350 /// and may change or be removed in future SDK or CLI releases.
1351 ///
1352 /// </div>
1353 #[serde(skip_serializing_if = "Option::is_none")]
1354 pub assisted_approval_model: Option<String>,
1355 /// Permission mode after the change
1356 ///
1357 /// <div class="warning">
1358 ///
1359 /// **Experimental.** This type is part of an experimental wire-protocol surface
1360 /// and may change or be removed in future SDK or CLI releases.
1361 ///
1362 /// </div>
1363 pub mode: PermissionMode,
1364 /// Permission mode before the change
1365 ///
1366 /// <div class="warning">
1367 ///
1368 /// **Experimental.** This type is part of an experimental wire-protocol surface
1369 /// and may change or be removed in future SDK or CLI releases.
1370 ///
1371 /// </div>
1372 pub previous_mode: PermissionMode,
1373}
1374
1375/// Session event "session.plan_changed". Plan file operation details indicating what changed
1376#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1377#[serde(rename_all = "camelCase")]
1378pub struct SessionPlanChangedData {
1379 /// The type of operation performed on the plan file
1380 pub operation: PlanChangedOperation,
1381}
1382
1383/// 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.
1384#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1385#[serde(rename_all = "camelCase")]
1386pub struct SessionTodosChangedData {}
1387
1388/// Session event "session.workspace_file_changed". Workspace file change details including path and operation type
1389#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1390#[serde(rename_all = "camelCase")]
1391pub struct SessionWorkspaceFileChangedData {
1392 /// Whether the file was newly created or updated
1393 pub operation: WorkspaceFileChangedOperation,
1394 /// Relative path within the session workspace files directory
1395 pub path: String,
1396}
1397
1398/// Repository context for the handed-off session
1399#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1400#[serde(rename_all = "camelCase")]
1401pub struct HandoffRepository {
1402 /// Git branch name, if applicable
1403 #[serde(skip_serializing_if = "Option::is_none")]
1404 pub branch: Option<String>,
1405 /// Repository name
1406 pub name: String,
1407 /// Repository owner (user or organization)
1408 pub owner: String,
1409}
1410
1411/// Session event "session.handoff". Session handoff metadata including source, context, and repository information
1412#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1413#[serde(rename_all = "camelCase")]
1414pub struct SessionHandoffData {
1415 /// Additional context information for the handoff
1416 #[serde(skip_serializing_if = "Option::is_none")]
1417 pub context: Option<String>,
1418 /// ISO 8601 timestamp when the handoff occurred
1419 pub handoff_time: String,
1420 /// GitHub host URL for the source session (e.g., https://github.com or https://tenant.ghe.com)
1421 #[serde(skip_serializing_if = "Option::is_none")]
1422 pub host: Option<String>,
1423 /// Session ID of the remote session being handed off
1424 #[serde(skip_serializing_if = "Option::is_none")]
1425 pub remote_session_id: Option<SessionId>,
1426 /// Repository context for the handed-off session
1427 #[serde(skip_serializing_if = "Option::is_none")]
1428 pub repository: Option<HandoffRepository>,
1429 /// Origin type of the session being handed off
1430 pub source_type: HandoffSourceType,
1431 /// Summary of the work done in the source session
1432 #[serde(skip_serializing_if = "Option::is_none")]
1433 pub summary: Option<String>,
1434}
1435
1436/// Session event "session.truncation". Conversation truncation statistics including token counts and removed content metrics
1437#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1438#[serde(rename_all = "camelCase")]
1439pub struct SessionTruncationData {
1440 /// Number of messages removed by truncation
1441 pub messages_removed_during_truncation: i64,
1442 /// Identifier of the component that performed truncation (e.g., "BasicTruncator")
1443 pub performed_by: String,
1444 /// Number of conversation messages after truncation
1445 pub post_truncation_messages_length: i64,
1446 /// Total tokens in conversation messages after truncation
1447 pub post_truncation_tokens_in_messages: i64,
1448 /// Number of conversation messages before truncation
1449 pub pre_truncation_messages_length: i64,
1450 /// Total tokens in conversation messages before truncation
1451 pub pre_truncation_tokens_in_messages: i64,
1452 /// Maximum token count for the model's context window
1453 pub token_limit: i64,
1454 /// Number of tokens removed by truncation
1455 pub tokens_removed_during_truncation: i64,
1456}
1457
1458/// Session event "session.snapshot_rewind". Session rewind details including target event and count of removed events
1459#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1460#[serde(rename_all = "camelCase")]
1461pub struct SessionSnapshotRewindData {
1462 /// Number of events that were removed by the rewind
1463 pub events_removed: i64,
1464 /// Event ID that was rewound to; this event and all after it were removed
1465 pub up_to_event_id: String,
1466}
1467
1468/// Request count and cost metrics
1469#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1470#[serde(rename_all = "camelCase")]
1471pub struct ShutdownModelMetricRequests {
1472 /// Cumulative cost multiplier for requests to this model
1473 ///
1474 /// <div class="warning">
1475 ///
1476 /// **Experimental.** This type is part of an experimental wire-protocol surface
1477 /// and may change or be removed in future SDK or CLI releases.
1478 ///
1479 /// </div>
1480 #[serde(skip_serializing_if = "Option::is_none")]
1481 pub cost: Option<f64>,
1482 /// Total number of API requests made to this model
1483 ///
1484 /// <div class="warning">
1485 ///
1486 /// **Experimental.** This type is part of an experimental wire-protocol surface
1487 /// and may change or be removed in future SDK or CLI releases.
1488 ///
1489 /// </div>
1490 #[serde(skip_serializing_if = "Option::is_none")]
1491 pub count: Option<i64>,
1492}
1493
1494/// A token-type entry in a shutdown model metric, storing the accumulated token count.
1495#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1496#[serde(rename_all = "camelCase")]
1497pub struct ShutdownModelMetricTokenDetail {
1498 /// Accumulated token count for this token type
1499 pub token_count: i64,
1500}
1501
1502/// Token usage breakdown
1503#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1504#[serde(rename_all = "camelCase")]
1505pub struct ShutdownModelMetricUsage {
1506 /// Total tokens read from prompt cache across all requests
1507 pub cache_read_tokens: i64,
1508 /// Total tokens written to prompt cache across all requests
1509 pub cache_write_tokens: i64,
1510 /// Total input tokens consumed across all requests to this model
1511 pub input_tokens: i64,
1512 /// Total output tokens produced across all requests to this model
1513 pub output_tokens: i64,
1514 /// Total reasoning tokens produced across all requests to this model
1515 #[serde(skip_serializing_if = "Option::is_none")]
1516 pub reasoning_tokens: Option<i64>,
1517}
1518
1519/// Per-model shutdown metrics with request counts, token usage, nano-AI units, and token details.
1520#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1521#[serde(rename_all = "camelCase")]
1522pub struct ShutdownModelMetric {
1523 /// Request count and cost metrics
1524 pub requests: ShutdownModelMetricRequests,
1525 /// Token count details per type
1526 #[serde(skip_serializing_if = "Option::is_none")]
1527 pub token_details: Option<HashMap<String, ShutdownModelMetricTokenDetail>>,
1528 /// Accumulated nano-AI units cost for this model
1529 ///
1530 /// <div class="warning">
1531 ///
1532 /// **Experimental.** This type is part of an experimental wire-protocol surface
1533 /// and may change or be removed in future SDK or CLI releases.
1534 ///
1535 /// </div>
1536 #[serde(skip_serializing_if = "Option::is_none")]
1537 pub total_nano_aiu: Option<f64>,
1538 /// Token usage breakdown
1539 pub usage: ShutdownModelMetricUsage,
1540}
1541
1542/// Usage attributed to one agent instance at session shutdown.
1543#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1544#[serde(rename_all = "camelCase")]
1545pub struct ShutdownAgentMetric {
1546 /// Human-readable label for this subagent invocation, copied from the originating `subagent.started` event. For task-tool subagents this is the invocation's task description rather than the agent's configured display name, so group by `agentName` for stable per-agent labels.
1547 #[serde(skip_serializing_if = "Option::is_none")]
1548 pub agent_display_name: Option<String>,
1549 /// Configured agent name, when this is a subagent
1550 #[serde(skip_serializing_if = "Option::is_none")]
1551 pub agent_name: Option<String>,
1552 /// Per-model usage for this agent, keyed by model identifier
1553 pub model_metrics: HashMap<String, ShutdownModelMetric>,
1554 /// Time spent in model API calls by this agent, in milliseconds
1555 pub total_api_duration_ms: i64,
1556 /// Accumulated nano-AI units cost for this agent
1557 pub total_nano_aiu: f64,
1558}
1559
1560/// Aggregate code change metrics for the session
1561#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1562#[serde(rename_all = "camelCase")]
1563pub struct ShutdownCodeChanges {
1564 /// List of file paths that were modified during the session
1565 pub files_modified: Vec<String>,
1566 /// Total number of lines added during the session
1567 pub lines_added: i64,
1568 /// Total number of lines removed during the session
1569 pub lines_removed: i64,
1570}
1571
1572/// A session-wide shutdown token-type entry storing the accumulated token count.
1573#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1574#[serde(rename_all = "camelCase")]
1575pub struct ShutdownTokenDetail {
1576 /// Accumulated token count for this token type
1577 pub token_count: i64,
1578}
1579
1580/// Session event "session.shutdown". Session termination metrics including usage statistics, code changes, and shutdown reason
1581#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1582#[serde(rename_all = "camelCase")]
1583pub struct SessionShutdownData {
1584 /// Per-agent usage breakdown, keyed by agent instance identifier. The main conversation uses the stable key `main`.
1585 #[serde(skip_serializing_if = "Option::is_none")]
1586 pub agent_metrics: Option<HashMap<String, ShutdownAgentMetric>>,
1587 /// Aggregate code change metrics for the session
1588 pub code_changes: ShutdownCodeChanges,
1589 /// Non-system message token count at shutdown
1590 #[serde(skip_serializing_if = "Option::is_none")]
1591 pub conversation_tokens: Option<i64>,
1592 /// Model that was selected at the time of shutdown
1593 #[serde(skip_serializing_if = "Option::is_none")]
1594 pub current_model: Option<String>,
1595 /// Total tokens in context window at shutdown
1596 #[serde(skip_serializing_if = "Option::is_none")]
1597 pub current_tokens: Option<i64>,
1598 /// Error description when shutdownType is "error"
1599 #[serde(skip_serializing_if = "Option::is_none")]
1600 pub error_reason: Option<String>,
1601 /// 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
1602 #[serde(skip_serializing_if = "Option::is_none")]
1603 pub events_file_size_bytes: Option<i64>,
1604 /// Per-model usage breakdown, keyed by model identifier
1605 pub model_metrics: HashMap<String, ShutdownModelMetric>,
1606 /// Unix timestamp (milliseconds) when the session started
1607 pub session_start_time: i64,
1608 /// Whether the session ended normally ("routine") or due to a crash/fatal error ("error")
1609 pub shutdown_type: ShutdownType,
1610 /// System message token count at shutdown
1611 #[serde(skip_serializing_if = "Option::is_none")]
1612 pub system_tokens: Option<i64>,
1613 /// Session-wide per-token-type accumulated token counts
1614 #[serde(skip_serializing_if = "Option::is_none")]
1615 pub token_details: Option<HashMap<String, ShutdownTokenDetail>>,
1616 /// Tool definitions token count at shutdown
1617 #[serde(skip_serializing_if = "Option::is_none")]
1618 pub tool_definitions_tokens: Option<i64>,
1619 /// Cumulative time spent in API calls during the session, in milliseconds
1620 pub total_api_duration_ms: i64,
1621 /// Session-wide accumulated nano-AI units cost
1622 ///
1623 /// <div class="warning">
1624 ///
1625 /// **Experimental.** This type is part of an experimental wire-protocol surface
1626 /// and may change or be removed in future SDK or CLI releases.
1627 ///
1628 /// </div>
1629 #[serde(skip_serializing_if = "Option::is_none")]
1630 pub total_nano_aiu: Option<f64>,
1631 /// Total number of premium API requests used during the session
1632 #[doc(hidden)]
1633 #[serde(skip_serializing_if = "Option::is_none")]
1634 pub(crate) total_premium_requests: Option<f64>,
1635}
1636
1637/// Internal prompt-cache expiration state for one model
1638#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1639#[serde(rename_all = "camelCase")]
1640pub(crate) struct UsageCheckpointModelCacheState {
1641 /// Latest known prompt-cache expiration
1642 pub cache_expires_at: String,
1643 /// Retained cache lifetime in seconds, used to refresh expiration after a cache read
1644 #[doc(hidden)]
1645 pub(crate) cache_ttl_seconds: i64,
1646 /// Model identifier associated with this cache state
1647 pub model_id: String,
1648}
1649
1650/// Session event "session.usage_checkpoint". Durable session usage checkpoint for reconstructing aggregate accounting on resume
1651#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1652#[serde(rename_all = "camelCase")]
1653pub struct SessionUsageCheckpointData {
1654 /// Internal per-model prompt-cache state used to restore expiration tracking on resume
1655 #[doc(hidden)]
1656 #[serde(skip_serializing_if = "Option::is_none")]
1657 pub(crate) model_cache_state: Option<Vec<UsageCheckpointModelCacheState>>,
1658 /// Internal per-conversation prompt-cache-break detector baselines restored on resume
1659 #[doc(hidden)]
1660 #[serde(skip_serializing_if = "Option::is_none")]
1661 pub(crate) prompt_cache_break_state: Option<Vec<serde_json::Value>>,
1662 /// Session-wide accumulated nano-AI units cost at checkpoint time
1663 pub total_nano_aiu: f64,
1664 /// Total number of premium API requests used at checkpoint time
1665 #[doc(hidden)]
1666 #[serde(skip_serializing_if = "Option::is_none")]
1667 pub(crate) total_premium_requests: Option<f64>,
1668}
1669
1670/// Session event "session.context_changed". Updated working directory and git context after the change
1671#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1672#[serde(rename_all = "camelCase")]
1673pub struct SessionContextChangedData {
1674 /// Base commit of current git branch at session start time
1675 #[serde(skip_serializing_if = "Option::is_none")]
1676 pub base_commit: Option<String>,
1677 /// Current git branch name
1678 #[serde(skip_serializing_if = "Option::is_none")]
1679 pub branch: Option<String>,
1680 /// Current working directory path
1681 pub cwd: String,
1682 /// Root directory of the git repository, resolved via git rev-parse
1683 #[serde(skip_serializing_if = "Option::is_none")]
1684 pub git_root: Option<String>,
1685 /// Head commit of current git branch at session start time
1686 #[serde(skip_serializing_if = "Option::is_none")]
1687 pub head_commit: Option<String>,
1688 /// Hosting platform type of the repository (github or ado)
1689 #[serde(skip_serializing_if = "Option::is_none")]
1690 pub host_type: Option<WorkingDirectoryContextHostType>,
1691 /// Set on the immediate preliminary event of a working-directory change, before the git context is resolved. A settled follow-up event (enriched with git context, or cwd-only for a non-repository) is always emitted afterward, so observers may defer to it. Absent on standalone/final events (e.g. relay context changes).
1692 #[serde(skip_serializing_if = "Option::is_none")]
1693 pub pending_git_context: Option<bool>,
1694 /// Repository identifier derived from the git remote URL ("owner/name" for GitHub, "org/project/repo" for Azure DevOps)
1695 #[serde(skip_serializing_if = "Option::is_none")]
1696 pub repository: Option<String>,
1697 /// Raw host string from the git remote URL (e.g. "github.com", "mycompany.ghe.com", "dev.azure.com")
1698 #[serde(skip_serializing_if = "Option::is_none")]
1699 pub repository_host: Option<String>,
1700}
1701
1702/// Session event "session.usage_info". Current context window usage statistics including token and message counts
1703#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1704#[serde(rename_all = "camelCase")]
1705pub struct SessionUsageInfoData {
1706 /// Token count from non-system messages (user, assistant, tool)
1707 #[serde(skip_serializing_if = "Option::is_none")]
1708 pub conversation_tokens: Option<i64>,
1709 /// Current number of tokens in the context window
1710 pub current_tokens: i64,
1711 /// Whether this is the first usage_info event emitted in this session
1712 #[serde(skip_serializing_if = "Option::is_none")]
1713 pub is_initial: Option<bool>,
1714 /// Current number of messages in the conversation
1715 pub messages_length: i64,
1716 /// Token count from system message(s)
1717 #[serde(skip_serializing_if = "Option::is_none")]
1718 pub system_tokens: Option<i64>,
1719 /// Maximum token count for the model's context window
1720 pub token_limit: i64,
1721 /// Token count from tool definitions
1722 #[serde(skip_serializing_if = "Option::is_none")]
1723 pub tool_definitions_tokens: Option<i64>,
1724}
1725
1726/// Session event "session.context_cleared". Context-cleared details emitted when the host clears the conversation (the session.history.clearContext RPC / Session.clearContextMessages)
1727#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1728#[serde(rename_all = "camelCase")]
1729pub struct SessionContextClearedData {
1730 /// Optional initial message set after clearing
1731 #[serde(skip_serializing_if = "Option::is_none")]
1732 pub initial_message: Option<String>,
1733 /// Number of conversation messages that were cleared
1734 pub messages_cleared: i64,
1735}
1736
1737/// Session event "session.compaction_start". Context window breakdown at the start of LLM-powered conversation compaction
1738#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1739#[serde(rename_all = "camelCase")]
1740pub struct SessionCompactionStartData {
1741 /// Token count from non-system messages (user, assistant, tool) at compaction start
1742 #[serde(skip_serializing_if = "Option::is_none")]
1743 pub conversation_tokens: Option<i64>,
1744 /// Total context tokens (system + conversation + tool definitions) at compaction start, when known
1745 #[serde(skip_serializing_if = "Option::is_none")]
1746 pub current_tokens: Option<i64>,
1747 /// Model identifier used for compaction, when known
1748 #[serde(skip_serializing_if = "Option::is_none")]
1749 pub model: Option<String>,
1750 /// Token count from system message(s) at compaction start
1751 #[serde(skip_serializing_if = "Option::is_none")]
1752 pub system_tokens: Option<i64>,
1753 /// Model context window token limit the compaction is targeting, when known
1754 #[serde(skip_serializing_if = "Option::is_none")]
1755 pub token_limit: Option<i64>,
1756 /// Token count from tool definitions at compaction start
1757 #[serde(skip_serializing_if = "Option::is_none")]
1758 pub tool_definitions_tokens: Option<i64>,
1759 /// What initiated this compaction, when known
1760 #[serde(skip_serializing_if = "Option::is_none")]
1761 pub trigger: Option<CompactionTrigger>,
1762}
1763
1764/// Token usage detail for a single billing category
1765#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1766#[serde(rename_all = "camelCase")]
1767pub struct CompactionCompleteCompactionTokensUsedCopilotUsageTokenDetail {
1768 /// Number of tokens in this billing batch
1769 pub batch_size: i64,
1770 /// Cost per batch of tokens
1771 pub cost_per_batch: i64,
1772 /// Total token count for this entry
1773 pub token_count: i64,
1774 /// Token category (e.g., "input", "output")
1775 pub token_type: String,
1776}
1777
1778/// Per-request cost and usage data from the CAPI copilot_usage response field
1779#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1780#[serde(rename_all = "camelCase")]
1781pub(crate) struct CompactionCompleteCompactionTokensUsedCopilotUsage {
1782 /// Itemized token usage breakdown
1783 #[doc(hidden)]
1784 #[serde(skip_serializing_if = "Option::is_none")]
1785 pub(crate) token_details:
1786 Option<Vec<CompactionCompleteCompactionTokensUsedCopilotUsageTokenDetail>>,
1787 /// Total cost in nano-AI units for this request
1788 pub total_nano_aiu: f64,
1789}
1790
1791/// Token usage breakdown for the compaction LLM call (aligned with assistant.usage format)
1792#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1793#[serde(rename_all = "camelCase")]
1794pub struct CompactionCompleteCompactionTokensUsed {
1795 /// Cached input tokens reused in the compaction LLM call
1796 #[serde(skip_serializing_if = "Option::is_none")]
1797 pub cache_read_tokens: Option<i64>,
1798 /// Tokens written to prompt cache in the compaction LLM call
1799 #[serde(skip_serializing_if = "Option::is_none")]
1800 pub cache_write_tokens: Option<i64>,
1801 /// Per-request cost and usage data from the CAPI copilot_usage response field
1802 #[doc(hidden)]
1803 #[serde(skip_serializing_if = "Option::is_none")]
1804 pub(crate) copilot_usage: Option<CompactionCompleteCompactionTokensUsedCopilotUsage>,
1805 /// Duration of the compaction LLM call in milliseconds
1806 #[serde(skip_serializing_if = "Option::is_none")]
1807 pub duration: Option<i64>,
1808 /// Input tokens consumed by the compaction LLM call
1809 #[serde(skip_serializing_if = "Option::is_none")]
1810 pub input_tokens: Option<i64>,
1811 /// Model identifier used for the compaction LLM call
1812 #[serde(skip_serializing_if = "Option::is_none")]
1813 pub model: Option<String>,
1814 /// Output tokens produced by the compaction LLM call
1815 #[serde(skip_serializing_if = "Option::is_none")]
1816 pub output_tokens: Option<i64>,
1817}
1818
1819/// Session event "session.compaction_complete". Conversation compaction results including success status, metrics, and optional error details
1820#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1821#[serde(rename_all = "camelCase")]
1822pub struct SessionCompactionCompleteData {
1823 /// Canonical model identifier used for model-specific behavior when replaying compaction
1824 #[serde(skip_serializing_if = "Option::is_none")]
1825 pub behavior_model_id: Option<String>,
1826 /// Checkpoint snapshot number created for recovery
1827 #[serde(skip_serializing_if = "Option::is_none")]
1828 pub checkpoint_number: Option<i64>,
1829 /// File path where the checkpoint was stored
1830 #[serde(skip_serializing_if = "Option::is_none")]
1831 pub checkpoint_path: Option<String>,
1832 /// Token usage breakdown for the compaction LLM call (aligned with assistant.usage format)
1833 #[serde(skip_serializing_if = "Option::is_none")]
1834 pub compaction_tokens_used: Option<CompactionCompleteCompactionTokensUsed>,
1835 /// Token count from non-system messages (user, assistant, tool) after compaction
1836 #[serde(skip_serializing_if = "Option::is_none")]
1837 pub conversation_tokens: Option<i64>,
1838 /// User-supplied focus instructions provided to a manual `/compact` invocation. Omitted for automatic compaction and for manual compaction with no focus text.
1839 #[serde(skip_serializing_if = "Option::is_none")]
1840 pub custom_instructions: Option<String>,
1841 /// Error message if compaction failed
1842 #[serde(skip_serializing_if = "Option::is_none")]
1843 pub error: Option<String>,
1844 /// Number of messages removed during compaction
1845 #[serde(skip_serializing_if = "Option::is_none")]
1846 pub messages_removed: Option<i64>,
1847 /// Total tokens in conversation after compaction
1848 #[serde(skip_serializing_if = "Option::is_none")]
1849 pub post_compaction_tokens: Option<i64>,
1850 /// Number of messages before compaction
1851 #[serde(skip_serializing_if = "Option::is_none")]
1852 pub pre_compaction_messages_length: Option<i64>,
1853 /// Total tokens in conversation before compaction
1854 #[serde(skip_serializing_if = "Option::is_none")]
1855 pub pre_compaction_tokens: Option<i64>,
1856 /// GitHub request tracing ID (x-github-request-id header) for the compaction LLM call
1857 #[serde(skip_serializing_if = "Option::is_none")]
1858 pub request_id: Option<RequestId>,
1859 /// Copilot service request ID (x-copilot-service-request-id header) for the compaction LLM call
1860 #[serde(skip_serializing_if = "Option::is_none")]
1861 pub service_request_id: Option<String>,
1862 /// For failed compaction only: the HTTP status code of the compaction LLM call failure, when it carried one. Absent for successful compaction and for failures without an HTTP status (e.g. an empty model response or a transport error).
1863 #[serde(skip_serializing_if = "Option::is_none")]
1864 pub status_code: Option<i64>,
1865 /// Whether compaction completed successfully
1866 pub success: bool,
1867 /// LLM-generated summary of the compacted conversation history
1868 #[serde(skip_serializing_if = "Option::is_none")]
1869 pub summary_content: Option<String>,
1870 /// Token count from system message(s) after compaction
1871 #[serde(skip_serializing_if = "Option::is_none")]
1872 pub system_tokens: Option<i64>,
1873 /// Model context window token limit the compaction was targeting, when known
1874 #[serde(skip_serializing_if = "Option::is_none")]
1875 pub token_limit: Option<i64>,
1876 /// Number of tokens removed during compaction
1877 #[serde(skip_serializing_if = "Option::is_none")]
1878 pub tokens_removed: Option<i64>,
1879 /// Token count from tool definitions after compaction
1880 #[serde(skip_serializing_if = "Option::is_none")]
1881 pub tool_definitions_tokens: Option<i64>,
1882 /// What initiated this compaction, when known
1883 #[serde(skip_serializing_if = "Option::is_none")]
1884 pub trigger: Option<CompactionTrigger>,
1885}
1886
1887/// Session event "session.task_complete". Task completion notification with summary from the agent
1888#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1889#[serde(rename_all = "camelCase")]
1890pub struct SessionTaskCompleteData {
1891 /// Active autopilot objective ID evaluated by the completion reviewer
1892 #[serde(skip_serializing_if = "Option::is_none")]
1893 pub objective_id: Option<i64>,
1894 /// Semantic completion decision. Absent on legacy events and invalid tool calls
1895 #[serde(skip_serializing_if = "Option::is_none")]
1896 pub outcome: Option<TaskCompletionOutcome>,
1897 /// Label-safe runtime rationale for the completion decision (e.g. a cancellation or pause/resume downgrade), when one applies. Reviewer-authored rationale is intentionally omitted here because this event has no IFC label channel; the reviewer's findings remain available through its own labeled sub-agent events
1898 #[serde(skip_serializing_if = "Option::is_none")]
1899 pub reason: Option<String>,
1900 /// Whether the task was accepted as complete. False when validation failed or completion was rejected or blocked by the reviewer
1901 #[serde(skip_serializing_if = "Option::is_none")]
1902 pub success: Option<bool>,
1903 /// Summary of the completed task, provided by the agent
1904 #[serde(skip_serializing_if = "Option::is_none")]
1905 pub summary: Option<String>,
1906}
1907
1908/// Inclusive durable event range summarized by a completion receipt.
1909#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1910#[serde(rename_all = "camelCase")]
1911pub struct CompletionReceiptEventRange {
1912 /// Identifier of the assistant turn-end event that ends the covered exchange. Always equals the receipt's sourceEventId, so either field is a valid join key.
1913 pub end_event_id: String,
1914 /// Identifier of the user message that starts the covered exchange.
1915 pub start_event_id: String,
1916}
1917
1918/// Final structured tool completion in the covered event range.
1919#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1920#[serde(rename_all = "camelCase")]
1921pub struct CompletionReceiptFinalTool {
1922 /// Process exit code from a structured shell result, when available.
1923 #[serde(skip_serializing_if = "Option::is_none")]
1924 pub exit_code: Option<i64>,
1925 /// Structured success or failure status from the tool completion event.
1926 pub status: CompletionReceiptToolStatus,
1927 /// Unique identifier of the completed tool call.
1928 pub tool_call_id: String,
1929 /// Tool name from the matching tool execution start event, when available.
1930 #[serde(skip_serializing_if = "Option::is_none")]
1931 pub tool_name: Option<String>,
1932}
1933
1934/// Session event "session.completion_receipt". Behavior-neutral record of structured runtime facts present when an agent completion decision is accepted.
1935///
1936/// <div class="warning">
1937///
1938/// **Experimental.** This type is part of an experimental wire-protocol surface
1939/// and may change or be removed in future SDK or CLI releases.
1940///
1941/// </div>
1942#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1943#[serde(rename_all = "camelCase")]
1944pub struct SessionCompletionReceiptData {
1945 /// One-based accepted completion receipt ordinal in the durable session history.
1946 pub attempt: i64,
1947 /// Inclusive durable event range summarized by this receipt.
1948 pub event_range: CompletionReceiptEventRange,
1949 /// Number of failed structured tool completions in the covered range.
1950 pub failed_tool_count: i64,
1951 /// Final structured tool completion in the covered range, when one exists.
1952 #[serde(skip_serializing_if = "Option::is_none")]
1953 pub final_tool: Option<CompletionReceiptFinalTool>,
1954 /// Version of the completion receipt payload.
1955 pub schema_version: i64,
1956 /// Identifier of the assistant turn-end event that supplied the accepted completion boundary. This is the receipt's idempotency key, and always equals eventRange.endEventId.
1957 pub source_event_id: String,
1958 /// Runtime reason the completion decision was accepted.
1959 pub stop_reason: CompletionReceiptStopReason,
1960 /// Number of successful structured tool completions in the covered range.
1961 pub successful_tool_count: i64,
1962}
1963
1964/// Session event "session.fusion_route_started". Experimental transient signal that HydraFusion routing has started for an eligible turn.
1965///
1966/// <div class="warning">
1967///
1968/// **Experimental.** This type is part of an experimental wire-protocol surface
1969/// and may change or be removed in future SDK or CLI releases.
1970///
1971/// </div>
1972#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1973#[serde(rename_all = "camelCase")]
1974pub struct SessionFusionRouteStartedData {
1975 /// Identifier for this routing attempt before a durable Fusion turn exists.
1976 pub attempt_id: String,
1977 /// HydraFusion routing policy requested for the turn.
1978 #[serde(skip_serializing_if = "Option::is_none")]
1979 pub policy: Option<String>,
1980 /// Synthetic HydraFusion model selected for the session.
1981 #[serde(skip_serializing_if = "Option::is_none")]
1982 pub synthetic_model: Option<String>,
1983 /// Kind of turn being routed.
1984 pub turn_kind: FusionTurnKind,
1985}
1986
1987/// Session event "session.fusion_route_failed". Experimental durable HydraFusion routing failure and the deterministic concrete fallback selected for the turn.
1988///
1989/// <div class="warning">
1990///
1991/// **Experimental.** This type is part of an experimental wire-protocol surface
1992/// and may change or be removed in future SDK or CLI releases.
1993///
1994/// </div>
1995#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1996#[serde(rename_all = "camelCase")]
1997pub struct SessionFusionRouteFailedData {
1998 /// Identifier of the routing attempt that failed.
1999 pub attempt_id: String,
2000 /// Provider or validation error detail, when available.
2001 #[serde(skip_serializing_if = "Option::is_none")]
2002 pub error_message: Option<String>,
2003 /// Concrete model selected as the deterministic fallback.
2004 pub fallback_model: String,
2005 /// HydraFusion routing policy requested for the turn.
2006 pub policy: String,
2007 /// Stable machine-readable reason for the routing failure.
2008 pub reason: String,
2009 /// Elapsed routing time in milliseconds before the failure.
2010 #[serde(skip_serializing_if = "Option::is_none")]
2011 pub routing_latency_ms: Option<f64>,
2012 /// Synthetic HydraFusion model selected for the session.
2013 pub synthetic_model: String,
2014}
2015
2016/// Durable server recommendation for subsequent HydraFusion turns.
2017///
2018/// <div class="warning">
2019///
2020/// **Experimental.** This type is part of an experimental wire-protocol surface
2021/// and may change or be removed in future SDK or CLI releases.
2022///
2023/// </div>
2024#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2025#[serde(rename_all = "camelCase")]
2026pub struct FusionFollowUpRecommendation {
2027 /// Recommended routing action for the next compaction turn.
2028 pub compaction_turn: FusionFollowUpAction,
2029 /// Recommended routing action for the next user-message turn.
2030 pub user_turn: FusionFollowUpAction,
2031}
2032
2033/// Presentation-neutral phase planned for a HydraFusion turn.
2034///
2035/// <div class="warning">
2036///
2037/// **Experimental.** This type is part of an experimental wire-protocol surface
2038/// and may change or be removed in future SDK or CLI releases.
2039///
2040/// </div>
2041#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2042#[serde(rename_all = "camelCase")]
2043pub struct FusionPhasePlanStep {
2044 /// Whether the phase executes only when an earlier phase requests it.
2045 pub conditional: bool,
2046 /// Kind of phase that may execute.
2047 pub kind: FusionPhaseKind,
2048 /// Semantic role assigned to the phase.
2049 pub role: String,
2050 /// Conversation scope in which the phase executes.
2051 pub scope: FusionConversationScope,
2052}
2053
2054/// Validated HydraFusion routing capability scores.
2055///
2056/// <div class="warning">
2057///
2058/// **Experimental.** This type is part of an experimental wire-protocol surface
2059/// and may change or be removed in future SDK or CLI releases.
2060///
2061/// </div>
2062#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2063#[serde(rename_all = "camelCase")]
2064pub struct FusionScores {
2065 /// Code-generation capability score returned by the authenticated router.
2066 pub code_gen: f64,
2067 /// Debugging capability score returned by the authenticated router.
2068 pub debugging: f64,
2069 /// Reasoning capability score returned by the authenticated router.
2070 pub reasoning: f64,
2071 /// Tool-use capability score returned by the authenticated router.
2072 pub tool_use: f64,
2073}
2074
2075/// Session event "session.fusion_resolved". Experimental durable validated HydraFusion route and turn policy.
2076///
2077/// <div class="warning">
2078///
2079/// **Experimental.** This type is part of an experimental wire-protocol surface
2080/// and may change or be removed in future SDK or CLI releases.
2081///
2082/// </div>
2083#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2084#[serde(rename_all = "camelCase")]
2085pub struct SessionFusionResolvedData {
2086 /// Version of the validated HydraFusion event contract.
2087 pub contract_version: i64,
2088 /// Concrete model used when the planned primary model cannot execute.
2089 pub fallback_model: String,
2090 /// Router recommendation controlling reuse or rerouting on later turns.
2091 #[serde(skip_serializing_if = "Option::is_none")]
2092 pub follow_up: Option<FusionFollowUpRecommendation>,
2093 /// Concrete model recommended for eligible follow-up turns.
2094 pub follow_up_model: String,
2095 /// Stable identifier for the resolved HydraFusion turn.
2096 pub fusion_id: String,
2097 /// Version of the executable model universe used for selection.
2098 #[serde(skip_serializing_if = "Option::is_none")]
2099 pub model_universe_version: Option<String>,
2100 /// Validated orchestration pattern selected for the turn.
2101 pub pattern: FusionPattern,
2102 /// Presentation-neutral phase plan for clients that render workflow progress.
2103 ///
2104 /// <div class="warning">
2105 ///
2106 /// **Experimental.** This type is part of an experimental wire-protocol surface
2107 /// and may change or be removed in future SDK or CLI releases.
2108 ///
2109 /// </div>
2110 #[serde(skip_serializing_if = "Option::is_none")]
2111 pub phase_plan: Option<Vec<FusionPhasePlanStep>>,
2112 /// Version of the validated execution-plan format.
2113 #[serde(skip_serializing_if = "Option::is_none")]
2114 pub plan_version: Option<String>,
2115 /// HydraFusion routing policy used to resolve the plan.
2116 pub policy: String,
2117 /// Version of the local routing policy.
2118 #[serde(skip_serializing_if = "Option::is_none")]
2119 pub policy_version: Option<String>,
2120 /// Concrete model selected for the primary solver phase.
2121 pub primary_model: String,
2122 /// Router implementation that supplied the plan.
2123 #[serde(skip_serializing_if = "Option::is_none")]
2124 pub route_source: Option<String>,
2125 /// Elapsed time in milliseconds required to resolve and validate the route.
2126 #[serde(skip_serializing_if = "Option::is_none")]
2127 pub routing_latency_ms: Option<f64>,
2128 /// Identifier of the local policy rule that matched.
2129 #[serde(skip_serializing_if = "Option::is_none")]
2130 pub rule_id: Option<String>,
2131 /// Zero-based index of the local policy rule that matched.
2132 #[serde(skip_serializing_if = "Option::is_none")]
2133 pub rule_index: Option<i64>,
2134 /// Human-readable name of the local policy rule that matched.
2135 #[serde(skip_serializing_if = "Option::is_none")]
2136 pub rule_name: Option<String>,
2137 /// Validated capability scores used to select the route.
2138 #[serde(skip_serializing_if = "Option::is_none")]
2139 pub scores: Option<FusionScores>,
2140 /// Concrete model selected for the review or judge phase, when required.
2141 pub secondary_model: Option<String>,
2142 /// Synthetic HydraFusion model selected for the session.
2143 pub synthetic_model: String,
2144 /// Identifier of the session turn associated with the route.
2145 pub turn_id: String,
2146}
2147
2148/// Session event "session.fusion_completed". Experimental durable aggregate outcome of a HydraFusion turn.
2149///
2150/// <div class="warning">
2151///
2152/// **Experimental.** This type is part of an experimental wire-protocol surface
2153/// and may change or be removed in future SDK or CLI releases.
2154///
2155/// </div>
2156#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2157#[serde(rename_all = "camelCase")]
2158pub struct SessionFusionCompletedData {
2159 /// Total cached input tokens reported across all phases.
2160 pub cached_tokens: i64,
2161 /// Total tokens written to prompt cache across all phases.
2162 #[serde(skip_serializing_if = "Option::is_none")]
2163 pub cache_write_tokens: Option<i64>,
2164 /// Idempotency identifier for the authoritative final commit.
2165 pub commit_id: String,
2166 /// Reason the turn used a degraded route, when applicable.
2167 pub degraded_reason: Option<String>,
2168 /// Total elapsed execution time for the HydraFusion turn in milliseconds.
2169 pub duration_ms: f64,
2170 /// Concrete model that supplied the authoritative final content.
2171 pub final_source_model: Option<String>,
2172 /// Phase whose output supplied the authoritative final content.
2173 pub final_source_phase_id: Option<String>,
2174 /// Concrete model recommended for eligible follow-up turns.
2175 pub follow_up_model: String,
2176 /// Stable identifier for the completed HydraFusion turn.
2177 pub fusion_id: String,
2178 /// Total input tokens consumed across all phases.
2179 pub input_tokens: i64,
2180 /// Stable aggregate outcome of the HydraFusion turn.
2181 pub outcome: String,
2182 /// Total output tokens produced across all phases.
2183 pub output_tokens: i64,
2184 /// HydraFusion orchestration pattern executed for the turn.
2185 pub pattern: FusionPattern,
2186 /// Number of concrete phases attempted by the turn.
2187 pub phase_count: i64,
2188 /// Total concrete model requests made across all phases.
2189 pub request_count: i64,
2190 /// Synthetic HydraFusion model selected for the session.
2191 pub synthetic_model: String,
2192 /// Total normalized AI-unit cost reported across all phases, in nano-AIU.
2193 pub total_nano_aiu: f64,
2194 /// Identifier of the session turn associated with the completion.
2195 pub turn_id: String,
2196}
2197
2198/// Session event "user.message". Payload of `user.message` with displayed and model-transformed content, attachments, source/delivery metadata, mode, and telemetry IDs.
2199#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2200#[serde(rename_all = "camelCase")]
2201pub struct UserMessageData {
2202 /// The agent mode that was active when this message was sent
2203 #[serde(skip_serializing_if = "Option::is_none")]
2204 pub agent_mode: Option<UserMessageAgentMode>,
2205 /// Files, selections, or GitHub references attached to the message
2206 #[serde(skip_serializing_if = "Option::is_none")]
2207 pub attachments: Option<Vec<serde_json::Value>>,
2208 /// The user's message text as displayed in the timeline
2209 pub content: String,
2210 /// How this message was delivered to the agentic loop relative to loop state (idle-start vs. steering/queued while busy). The timing axis; combine with `source` (origin) for the full picture. Used for telemetry attribution.
2211 #[serde(skip_serializing_if = "Option::is_none")]
2212 pub delivery: Option<UserMessageDelivery>,
2213 /// CAPI interaction ID for correlating this user message with its turn
2214 #[serde(skip_serializing_if = "Option::is_none")]
2215 pub interaction_id: Option<String>,
2216 /// 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.
2217 #[serde(skip_serializing_if = "Option::is_none")]
2218 pub is_autopilot_continuation: Option<bool>,
2219 /// Stable identity of the logical user message, matching the ID returned by send and retained by pending queue snapshots
2220 #[serde(skip_serializing_if = "Option::is_none")]
2221 pub message_id: Option<String>,
2222 /// 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
2223 #[serde(skip_serializing_if = "Option::is_none")]
2224 pub native_document_path_fallback_paths: Option<Vec<String>>,
2225 /// Parent agent task ID for background telemetry correlated to this user turn
2226 #[serde(skip_serializing_if = "Option::is_none")]
2227 pub parent_agent_task_id: Option<String>,
2228 /// Origin of this message, used for timeline filtering and attribution (e.g., `skill-pdf` for hidden skill injection or `agent-<agent-id>` for an inter-agent prompt)
2229 #[serde(skip_serializing_if = "Option::is_none")]
2230 pub source: Option<String>,
2231 /// Normalized document MIME types that were sent natively instead of through tagged_files XML
2232 #[serde(skip_serializing_if = "Option::is_none")]
2233 pub supported_native_document_mime_types: Option<Vec<String>>,
2234 /// Transformed version of the message sent to the model, with XML wrapping, timestamps, and other augmentations for prompt caching
2235 #[serde(skip_serializing_if = "Option::is_none")]
2236 pub transformed_content: Option<String>,
2237 /// The agent-loop turn ID that consumed this message; absent when no agent-loop turn consumed it
2238 #[serde(skip_serializing_if = "Option::is_none")]
2239 pub turn_id: Option<String>,
2240}
2241
2242/// Session event "pending_messages.modified". Empty payload; the event signals that the pending message queue has changed
2243#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2244#[serde(rename_all = "camelCase")]
2245pub struct PendingMessagesModifiedData {}
2246
2247/// Session event "assistant.turn_start". Turn initialization metadata including identifier and interaction tracking
2248#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2249#[serde(rename_all = "camelCase")]
2250pub struct AssistantTurnStartData {
2251 /// CAPI interaction ID for correlating this turn with upstream telemetry
2252 #[serde(skip_serializing_if = "Option::is_none")]
2253 pub interaction_id: Option<String>,
2254 /// Model identifier used for this turn, when known
2255 #[serde(skip_serializing_if = "Option::is_none")]
2256 pub model: Option<String>,
2257 /// Identifier for this turn within the agentic loop, typically a stringified turn number
2258 pub turn_id: String,
2259}
2260
2261/// Session event "assistant.turn_retry". Metadata for an additional model inference attempt within an existing assistant turn
2262#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2263#[serde(rename_all = "camelCase")]
2264pub struct AssistantTurnRetryData {
2265 /// Model identifier used for this retry, when known
2266 #[serde(skip_serializing_if = "Option::is_none")]
2267 pub model: Option<String>,
2268 /// Provider or runtime classification that caused the retry, when known
2269 #[serde(skip_serializing_if = "Option::is_none")]
2270 pub reason: Option<String>,
2271 /// Identifier of the turn whose model inference is being retried
2272 pub turn_id: String,
2273}
2274
2275/// Session event "agent.interrupted". Metadata for work the user interrupted while the agent was running
2276#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2277#[serde(rename_all = "camelCase")]
2278pub struct AgentInterruptedData {
2279 /// What the agent was doing when the user interrupted it
2280 pub activity: AgentInterruptedActivity,
2281 /// For an interrupted model call: the provider endpoint the request targeted
2282 #[serde(skip_serializing_if = "Option::is_none")]
2283 pub api_endpoint: Option<String>,
2284 /// For an interrupted model call: whether the user interrupted before any token arrived or while the response was streaming
2285 #[serde(skip_serializing_if = "Option::is_none")]
2286 pub cancel_phase: Option<AgentInterruptedCancelPhase>,
2287 /// How long the interrupted work had been running, in milliseconds
2288 pub elapsed_ms: f64,
2289 /// For an interrupted background-agent batch: how many background sub-agents the stop swept. Counts accepted cancellations, so an agent cancelled as a cascade of its interrupted parent is covered by that parent rather than counted again.
2290 #[serde(skip_serializing_if = "Option::is_none")]
2291 pub interrupted_agent_count: Option<i64>,
2292 /// For an interrupted model call: the model the request targeted
2293 #[serde(skip_serializing_if = "Option::is_none")]
2294 pub model: Option<String>,
2295 /// For a mid-stream interrupt: the observed time to first observable output, in milliseconds. Deliberately distinct from the `ttftMs` reported on a successful model call, which measures time to first stream event.
2296 #[serde(skip_serializing_if = "Option::is_none")]
2297 pub output_ttft_ms: Option<f64>,
2298 /// For an interrupted model call: the reasoning effort the request asked for
2299 #[serde(skip_serializing_if = "Option::is_none")]
2300 pub reasoning_effort: Option<String>,
2301 /// Subset of `toolNames` whose tool metadata marks the tool name as safe to record unhashed in telemetry.
2302 #[serde(skip_serializing_if = "Option::is_none")]
2303 pub safe_tool_names: Option<Vec<String>>,
2304 /// Tool call identifiers that were still running
2305 #[serde(skip_serializing_if = "Option::is_none")]
2306 pub tool_call_ids: Option<Vec<String>>,
2307 /// Names of the tools that were still running. More than one when the model requested a parallel fan-out.
2308 #[serde(skip_serializing_if = "Option::is_none")]
2309 pub tool_names: Option<Vec<String>>,
2310 /// For an interrupted model call: the transport the request used
2311 #[serde(skip_serializing_if = "Option::is_none")]
2312 pub transport: Option<ModelCallFailureTransport>,
2313 /// Zero-based agentic-loop iteration the interrupt landed in
2314 pub turn: i64,
2315}
2316
2317/// Session event "assistant.intent". Agent intent description for current activity or plan
2318#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2319#[serde(rename_all = "camelCase")]
2320pub struct AssistantIntentData {
2321 /// Short description of what the agent is currently doing or planning to do
2322 pub intent: String,
2323}
2324
2325/// Session event "assistant.fusion_phase_started". Experimental transient HydraFusion phase/model/role signal.
2326///
2327/// <div class="warning">
2328///
2329/// **Experimental.** This type is part of an experimental wire-protocol surface
2330/// and may change or be removed in future SDK or CLI releases.
2331///
2332/// </div>
2333#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2334#[serde(rename_all = "camelCase")]
2335pub struct AssistantFusionPhaseStartedData {
2336 /// Conversation scope in which the phase executes.
2337 pub conversation_scope: FusionConversationScope,
2338 /// Identifier of the HydraFusion turn containing the phase.
2339 pub fusion_id: String,
2340 /// Concrete model executing the phase.
2341 pub model: String,
2342 /// HydraFusion orchestration pattern containing the phase.
2343 pub pattern: FusionPattern,
2344 /// Stable identifier for the concrete phase.
2345 pub phase_id: String,
2346 /// Kind of phase being executed.
2347 pub phase_kind: FusionPhaseKind,
2348 /// Semantic role assigned to the phase.
2349 pub role: String,
2350}
2351
2352/// Session event "assistant.fusion_phase_activity". Experimental content-safe activity signal for a running HydraFusion phase.
2353///
2354/// <div class="warning">
2355///
2356/// **Experimental.** This type is part of an experimental wire-protocol surface
2357/// and may change or be removed in future SDK or CLI releases.
2358///
2359/// </div>
2360#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2361#[serde(rename_all = "camelCase")]
2362pub struct AssistantFusionPhaseActivityData {
2363 /// Kind of real activity observed.
2364 pub activity: FusionPhaseActivityKind,
2365 /// Conversation scope in which the phase executes.
2366 pub conversation_scope: FusionConversationScope,
2367 /// Identifier of the HydraFusion turn containing the phase.
2368 pub fusion_id: String,
2369 /// HydraFusion orchestration pattern containing the phase.
2370 pub pattern: FusionPattern,
2371 /// Stable identifier for the concrete phase.
2372 pub phase_id: String,
2373 /// Kind of phase currently executing.
2374 pub phase_kind: FusionPhaseKind,
2375 /// Semantic role assigned to the phase.
2376 pub role: String,
2377 /// Opaque hashed correlation token for matching tool-started and tool-completed activity within this Fusion activity stream. It is not the tool call identifier exposed by tool lifecycle events.
2378 #[serde(skip_serializing_if = "Option::is_none")]
2379 pub tool_call_id: Option<String>,
2380 /// Cumulative private response bytes observed for this model call. The event never includes response text.
2381 #[serde(skip_serializing_if = "Option::is_none")]
2382 pub total_response_size_bytes: Option<i64>,
2383}
2384
2385/// Internal durable terminal request staged by a HydraFusion phase until an idempotent final commit selects it.
2386///
2387/// <div class="warning">
2388///
2389/// **Experimental.** This type is part of an experimental wire-protocol surface
2390/// and may change or be removed in future SDK or CLI releases.
2391///
2392/// </div>
2393#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2394#[serde(rename_all = "camelCase")]
2395pub(crate) struct FusionStagedTerminal {
2396 pub arguments: String,
2397 pub assistant_message: serde_json::Value,
2398 pub phase_id: String,
2399 pub tool_call_id: String,
2400 pub tool_name: String,
2401}
2402
2403/// Aggregate concrete-model usage for one HydraFusion phase.
2404///
2405/// <div class="warning">
2406///
2407/// **Experimental.** This type is part of an experimental wire-protocol surface
2408/// and may change or be removed in future SDK or CLI releases.
2409///
2410/// </div>
2411#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2412#[serde(rename_all = "camelCase")]
2413pub struct FusionPhaseUsage {
2414 /// Total cached input tokens reported for the phase.
2415 pub cached_tokens: i64,
2416 /// Total tokens written to prompt cache during the phase.
2417 #[serde(skip_serializing_if = "Option::is_none")]
2418 pub cache_write_tokens: Option<i64>,
2419 /// Total input tokens consumed by the phase.
2420 pub input_tokens: i64,
2421 /// Total output tokens produced by the phase.
2422 pub output_tokens: i64,
2423 /// Number of concrete model requests made by the phase.
2424 pub request_count: i64,
2425 /// Total normalized AI-unit cost reported for the phase, in nano-AIU.
2426 pub total_nano_aiu: f64,
2427}
2428
2429/// Session event "assistant.fusion_phase_completed". Experimental durable HydraFusion phase output and lossless replay checkpoint.
2430///
2431/// <div class="warning">
2432///
2433/// **Experimental.** This type is part of an experimental wire-protocol surface
2434/// and may change or be removed in future SDK or CLI releases.
2435///
2436/// </div>
2437#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2438#[serde(rename_all = "camelCase")]
2439pub struct AssistantFusionPhaseCompletedData {
2440 /// Provider-normalized textual output produced by the phase.
2441 pub content: String,
2442 /// Conversation scope in which the phase executed.
2443 pub conversation_scope: FusionConversationScope,
2444 /// Elapsed execution time for the phase in milliseconds.
2445 pub duration_ms: f64,
2446 /// Identifier of the HydraFusion turn containing the phase.
2447 pub fusion_id: String,
2448 /// Concrete model that executed the phase.
2449 pub model: String,
2450 /// Stable identifier for the completed phase.
2451 pub phase_id: String,
2452 /// Kind of phase that completed.
2453 pub phase_kind: FusionPhaseKind,
2454 /// Exact provider-normalized message used to reconstruct canonical model history.
2455 #[doc(hidden)]
2456 #[serde(skip_serializing_if = "Option::is_none")]
2457 pub(crate) projection_message: Option<serde_json::Value>,
2458 /// Projection action for the exact internal message.
2459 #[doc(hidden)]
2460 #[serde(skip_serializing_if = "Option::is_none")]
2461 pub(crate) projection_mode: Option<FusionProjectionMode>,
2462 /// Semantic role assigned to the completed phase.
2463 pub role: String,
2464 /// Terminal request held outside canonical state until selected by the final commit.
2465 #[doc(hidden)]
2466 #[serde(skip_serializing_if = "Option::is_none")]
2467 pub(crate) staged_terminal: Option<FusionStagedTerminal>,
2468 /// Durable outcome status of the phase.
2469 pub status: FusionPhaseStatus,
2470 /// Aggregate concrete-model usage consumed by the phase.
2471 pub usage: FusionPhaseUsage,
2472 /// Structured judge or critic verdict, when the phase produces one.
2473 pub verdict: Option<String>,
2474}
2475
2476/// Session event "assistant.fusion_phase_failed". Experimental durable typed HydraFusion phase failure and degradation transition.
2477///
2478/// <div class="warning">
2479///
2480/// **Experimental.** This type is part of an experimental wire-protocol surface
2481/// and may change or be removed in future SDK or CLI releases.
2482///
2483/// </div>
2484#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2485#[serde(rename_all = "camelCase")]
2486pub struct AssistantFusionPhaseFailedData {
2487 /// Conversation scope in which the phase executed.
2488 pub conversation_scope: FusionConversationScope,
2489 /// Identifier of the fallback phase used to continue the turn after degradation.
2490 #[serde(skip_serializing_if = "Option::is_none")]
2491 pub degraded_to_phase_id: Option<String>,
2492 /// Elapsed execution time before the phase failed, in milliseconds.
2493 pub duration_ms: f64,
2494 /// Provider or execution error detail, when available.
2495 #[serde(skip_serializing_if = "Option::is_none")]
2496 pub error_message: Option<String>,
2497 /// Identifier of the HydraFusion turn containing the phase.
2498 pub fusion_id: String,
2499 /// Concrete model that attempted the phase.
2500 pub model: String,
2501 /// Stable identifier for the failed phase.
2502 pub phase_id: String,
2503 /// Kind of phase that failed.
2504 pub phase_kind: FusionPhaseKind,
2505 /// Stable machine-readable reason for the phase failure.
2506 pub reason: String,
2507 /// Semantic role assigned to the failed phase.
2508 pub role: String,
2509 /// Durable outcome status of the phase.
2510 pub status: FusionPhaseStatus,
2511 /// Aggregate concrete-model usage consumed before the failure.
2512 pub usage: FusionPhaseUsage,
2513}
2514
2515/// Session event "assistant.server_tool_progress". Live progress signal for a provider-hosted server tool (e.g. hosted web search) while it runs, before the finalized serverTools envelope lands on the terminal assistant.message
2516#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2517#[serde(rename_all = "camelCase")]
2518pub struct AssistantServerToolProgressData {
2519 /// Kind of hosted server tool that is running. Only `web_search` is emitted today.
2520 pub kind: String,
2521 /// Position of the hosted tool call in the response output. Stable across the call's lifecycle events (unlike the provider's per-event item id, which CAPI rotates), so the host keys the live in-progress row on it.
2522 pub output_index: i64,
2523 /// Lifecycle status of the hosted call: `in_progress`, `searching`, or `completed`.
2524 pub status: String,
2525}
2526
2527/// Session event "assistant.reasoning". Assistant reasoning content for timeline display with complete thinking text
2528#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2529#[serde(rename_all = "camelCase")]
2530pub struct AssistantReasoningData {
2531 /// The complete extended thinking text from the model
2532 pub content: String,
2533 /// Unique identifier for this reasoning block
2534 pub reasoning_id: String,
2535 /// Per-request treatment/eligibility signal returned by the Copilot API in the `X-GitHub-Copilot-Request-TE` response header for the associated model call; `false` when the header was absent or unparseable.
2536 #[serde(skip_serializing_if = "Option::is_none")]
2537 pub rte: Option<bool>,
2538}
2539
2540/// Session event "assistant.reasoning_delta". Streaming reasoning delta for incremental extended thinking updates
2541#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2542#[serde(rename_all = "camelCase")]
2543pub struct AssistantReasoningDeltaData {
2544 /// Incremental text chunk to append to the reasoning content
2545 pub delta_content: String,
2546 /// Reasoning block ID this delta belongs to, matching the corresponding assistant.reasoning event
2547 pub reasoning_id: String,
2548}
2549
2550/// Session event "assistant.tool_call_delta". Streaming tool-call input delta for incremental tool-call updates
2551#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2552#[serde(rename_all = "camelCase")]
2553pub struct AssistantToolCallDeltaData {
2554 /// Raw provider tool input fragment to append for this tool call. Function/tool-use providers stream serialized JSON argument text (so newlines inside JSON string values may appear as escaped `\n` until the accumulated JSON is parsed); custom tool calls stream raw custom input.
2555 pub input_delta: String,
2556 /// Tool call ID this delta belongs to, matching the corresponding assistant.message tool request
2557 pub tool_call_id: String,
2558 /// Name of the tool being invoked, when known from the stream
2559 #[serde(skip_serializing_if = "Option::is_none")]
2560 pub tool_name: Option<String>,
2561 /// Tool call type, when known from the stream
2562 #[serde(skip_serializing_if = "Option::is_none")]
2563 pub tool_type: Option<AssistantMessageToolRequestType>,
2564}
2565
2566/// Session event "assistant.streaming_delta". Streaming response progress with cumulative byte count
2567#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2568#[serde(rename_all = "camelCase")]
2569pub struct AssistantStreamingDeltaData {
2570 /// Cumulative total bytes received from the streaming response so far
2571 pub total_response_size_bytes: i64,
2572}
2573
2574/// A source that backs one or more cited spans in the assistant's response.
2575///
2576/// <div class="warning">
2577///
2578/// **Experimental.** This type is part of an experimental wire-protocol surface
2579/// and may change or be removed in future SDK or CLI releases.
2580///
2581/// </div>
2582#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2583#[serde(rename_all = "camelCase")]
2584pub struct CitationSource {
2585 /// Stable, turn-scoped identifier for this source, referenced by CitationReference.sourceId.
2586 pub id: String,
2587 /// File path relative to the agent's workspace root, when the source is a file.
2588 #[serde(skip_serializing_if = "Option::is_none")]
2589 pub path: Option<String>,
2590 /// The system that produced this citation.
2591 pub provider: CitationProvider,
2592 /// Human-readable title of the source.
2593 #[serde(skip_serializing_if = "Option::is_none")]
2594 pub title: Option<String>,
2595 /// URL of the source, when it is a web resource.
2596 #[serde(skip_serializing_if = "Option::is_none")]
2597 pub url: Option<String>,
2598}
2599
2600/// A single citation occurrence linking a span of generated text to a supporting source.
2601///
2602/// <div class="warning">
2603///
2604/// **Experimental.** This type is part of an experimental wire-protocol surface
2605/// and may change or be removed in future SDK or CLI releases.
2606///
2607/// </div>
2608#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2609#[serde(rename_all = "camelCase")]
2610pub struct CitationReference {
2611 /// The exact text from the source that supports the cited span, when provided by the model.
2612 #[serde(skip_serializing_if = "Option::is_none")]
2613 pub cited_text: Option<String>,
2614 /// Location within the source that supports the cited span, when the provider reports one.
2615 #[serde(skip_serializing_if = "Option::is_none")]
2616 pub location: Option<serde_json::Value>,
2617 /// Provider-native citation correlation data (e.g. Anthropic search_result_index / document_index), passed through opaquely for debugging and forward compatibility.
2618 #[serde(skip_serializing_if = "Option::is_none")]
2619 pub provider_metadata: Option<serde_json::Value>,
2620 /// Identifier of the CitationSource this reference points to (CitationSource.id).
2621 pub source_id: String,
2622}
2623
2624/// A contiguous span of generated assistant text and the source references that support it.
2625///
2626/// <div class="warning">
2627///
2628/// **Experimental.** This type is part of an experimental wire-protocol surface
2629/// and may change or be removed in future SDK or CLI releases.
2630///
2631/// </div>
2632#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2633#[serde(rename_all = "camelCase")]
2634pub struct CitationSpan {
2635 /// End offset of the cited span within the final assistant message content (UTF-16 code units, zero-based, exclusive).
2636 pub end_index: i64,
2637 /// The sources that support this span of generated text.
2638 pub references: Vec<CitationReference>,
2639 /// Start offset of the cited span within the final assistant message content (UTF-16 code units, zero-based, inclusive).
2640 pub start_index: i64,
2641}
2642
2643/// Provider-agnostic citations linking spans of the assistant's response to their supporting sources.
2644///
2645/// <div class="warning">
2646///
2647/// **Experimental.** This type is part of an experimental wire-protocol surface
2648/// and may change or be removed in future SDK or CLI releases.
2649///
2650/// </div>
2651#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2652#[serde(rename_all = "camelCase")]
2653pub struct Citations {
2654 /// Deduplicated set of sources referenced by the citation spans.
2655 pub sources: Vec<CitationSource>,
2656 /// Spans of generated text annotated with the sources that support them.
2657 pub spans: Vec<CitationSpan>,
2658}
2659
2660/// Experimental attribution linking an ordinary event to the HydraFusion turn, phase, and concrete source that produced it.
2661///
2662/// <div class="warning">
2663///
2664/// **Experimental.** This type is part of an experimental wire-protocol surface
2665/// and may change or be removed in future SDK or CLI releases.
2666///
2667/// </div>
2668#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2669#[serde(rename_all = "camelCase")]
2670pub struct FusionAttribution {
2671 /// Idempotency identifier for the authoritative commit, when the event belongs to the selected output.
2672 #[serde(skip_serializing_if = "Option::is_none")]
2673 pub commit_id: Option<String>,
2674 /// Conversation scope in which the concrete phase executed.
2675 #[serde(skip_serializing_if = "Option::is_none")]
2676 pub conversation_scope: Option<String>,
2677 /// Stable identifier for the HydraFusion turn that produced the event.
2678 pub fusion_id: String,
2679 /// HydraFusion orchestration pattern selected for the turn.
2680 pub pattern: String,
2681 /// Identifier of the concrete phase that produced the event.
2682 #[serde(skip_serializing_if = "Option::is_none")]
2683 pub phase_id: Option<String>,
2684 /// Kind of concrete phase that produced the event.
2685 #[serde(skip_serializing_if = "Option::is_none")]
2686 pub phase_kind: Option<String>,
2687 /// HydraFusion routing policy used for the turn.
2688 pub policy: String,
2689 /// Semantic role assigned to the concrete phase.
2690 #[serde(skip_serializing_if = "Option::is_none")]
2691 pub role: Option<String>,
2692 /// Concrete model that produced the attributed event.
2693 #[serde(skip_serializing_if = "Option::is_none")]
2694 pub source_model: Option<String>,
2695 /// Phase whose output supplied the authoritative content, when different from the executing phase.
2696 #[serde(skip_serializing_if = "Option::is_none")]
2697 pub source_phase_id: Option<String>,
2698 /// Synthetic HydraFusion model selected for the session.
2699 pub synthetic_model: String,
2700}
2701
2702/// Neutral provider-tagged reasoning content blocks preserved verbatim for round-tripping
2703///
2704/// <div class="warning">
2705///
2706/// **Experimental.** This type is part of an experimental wire-protocol surface
2707/// and may change or be removed in future SDK or CLI releases.
2708///
2709/// </div>
2710#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2711#[serde(rename_all = "camelCase")]
2712pub struct AssistantMessageReasoningBlocks {
2713 /// Provider-native reasoning items or content blocks preserved verbatim, in order. A single response can carry several, and provider signatures or identifiers may depend on their exact content and ordering.
2714 #[serde(skip_serializing_if = "Option::is_none")]
2715 pub blocks: Option<Vec<serde_json::Value>>,
2716 /// Model provider that produced these reasoning blocks.
2717 pub provider: String,
2718}
2719
2720/// Neutral provider-tagged server-side tool-use payload (tool search, advisor) for verbatim round-tripping
2721///
2722/// <div class="warning">
2723///
2724/// **Experimental.** This type is part of an experimental wire-protocol surface
2725/// and may change or be removed in future SDK or CLI releases.
2726///
2727/// </div>
2728#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2729#[serde(rename_all = "camelCase")]
2730pub struct AssistantMessageServerTools {
2731 /// Advisor model identifier associated with the server-tool payload.
2732 #[serde(skip_serializing_if = "Option::is_none")]
2733 pub advisor_model: Option<String>,
2734 /// Provider function-call namespaces keyed by function-call identifier.
2735 #[serde(skip_serializing_if = "Option::is_none")]
2736 pub function_call_namespaces: Option<HashMap<String, String>>,
2737 /// Provider-native server-tool call and output items preserved verbatim for replay.
2738 #[serde(skip_serializing_if = "Option::is_none")]
2739 pub items: Option<Vec<serde_json::Value>>,
2740 /// Model provider that produced this server-tool payload.
2741 pub provider: String,
2742 /// Raw provider content blocks retained for verbatim round-tripping.
2743 #[serde(skip_serializing_if = "Option::is_none")]
2744 pub raw_content_blocks: Option<Vec<serde_json::Value>>,
2745}
2746
2747/// Hosted program that requested this client tool call
2748#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2749#[serde(rename_all = "camelCase")]
2750pub struct AssistantMessageToolRequestCaller {
2751 /// Provider-assigned identifier for the hosted caller.
2752 pub caller_id: String,
2753 /// Kind of hosted caller that requested the client tool call.
2754 pub r#type: AssistantMessageToolRequestCallerType,
2755}
2756
2757/// A tool invocation request from the assistant
2758#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2759#[serde(rename_all = "camelCase")]
2760pub struct AssistantMessageToolRequest {
2761 /// Arguments to pass to the tool, format depends on the tool
2762 #[serde(skip_serializing_if = "Option::is_none")]
2763 pub arguments: Option<serde_json::Value>,
2764 /// Hosted program that requested this client tool call
2765 #[serde(skip_serializing_if = "Option::is_none")]
2766 pub caller: Option<AssistantMessageToolRequestCaller>,
2767 /// Resolved intention summary describing what this specific call does
2768 #[serde(skip_serializing_if = "Option::is_none")]
2769 pub intention_summary: Option<String>,
2770 /// Name of the MCP server hosting this tool, when the tool is an MCP tool
2771 #[serde(skip_serializing_if = "Option::is_none")]
2772 pub mcp_server_name: Option<String>,
2773 /// Original tool name on the MCP server, when the tool is an MCP tool
2774 #[serde(skip_serializing_if = "Option::is_none")]
2775 pub mcp_tool_name: Option<String>,
2776 /// Name of the tool being invoked
2777 pub name: String,
2778 /// Unique identifier for this tool call
2779 pub tool_call_id: String,
2780 /// Human-readable display title for the tool
2781 #[serde(skip_serializing_if = "Option::is_none")]
2782 pub tool_title: Option<String>,
2783 /// Tool call type: "function" for standard tool calls, "custom" for grammar-based tool calls. Defaults to "function" when absent.
2784 #[serde(skip_serializing_if = "Option::is_none")]
2785 pub r#type: Option<AssistantMessageToolRequestType>,
2786}
2787
2788/// Session event "assistant.message". Assistant response containing text content, optional tool requests, and interaction metadata
2789#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2790#[serde(rename_all = "camelCase")]
2791pub struct AssistantMessageData {
2792 /// Provider's completion / response identifier; shared across all chunks of a single API call. Used to group multi-chunk assistant utterances.
2793 #[serde(skip_serializing_if = "Option::is_none")]
2794 pub api_call_id: Option<String>,
2795 /// Total messages the model call's response was split into, one per reasoning boundary. Absent for a single-message response; the last chunk is the one where chunkIndex is chunkCount - 1.
2796 #[serde(skip_serializing_if = "Option::is_none")]
2797 pub chunk_count: Option<i64>,
2798 /// Zero-based position of this message within its model call's response. Absent when the response was not split into chunks.
2799 #[serde(skip_serializing_if = "Option::is_none")]
2800 pub chunk_index: Option<i64>,
2801 /// Provider-agnostic citations linking spans of this message's content to the sources that support them. Experimental; only populated when citation emission is enabled.
2802 ///
2803 /// <div class="warning">
2804 ///
2805 /// **Experimental.** This type is part of an experimental wire-protocol surface
2806 /// and may change or be removed in future SDK or CLI releases.
2807 ///
2808 /// </div>
2809 #[serde(skip_serializing_if = "Option::is_none")]
2810 pub citations: Option<Citations>,
2811 /// Client-minted request id (x-request-id header) echoed by the server. Distinct from requestId (x-github-request-id) and serviceRequestId (x-copilot-service-request-id).
2812 #[serde(skip_serializing_if = "Option::is_none")]
2813 pub client_request_id: Option<String>,
2814 /// The assistant's text response content
2815 pub content: String,
2816 /// Encrypted reasoning content from OpenAI models. Session-bound and stripped on resume.
2817 #[serde(skip_serializing_if = "Option::is_none")]
2818 pub encrypted_content: Option<String>,
2819 /// Experimental HydraFusion source attribution for this ordinary authoritative assistant message.
2820 ///
2821 /// <div class="warning">
2822 ///
2823 /// **Experimental.** This type is part of an experimental wire-protocol surface
2824 /// and may change or be removed in future SDK or CLI releases.
2825 ///
2826 /// </div>
2827 #[serde(skip_serializing_if = "Option::is_none")]
2828 pub fusion: Option<FusionAttribution>,
2829 /// CAPI interaction ID for correlating this message with upstream telemetry
2830 #[serde(skip_serializing_if = "Option::is_none")]
2831 pub interaction_id: Option<String>,
2832 /// Unique identifier for this assistant message
2833 pub message_id: String,
2834 /// Model that produced this assistant message, if known
2835 #[serde(skip_serializing_if = "Option::is_none")]
2836 pub model: Option<String>,
2837 /// Actual output token count from the API response (completion_tokens), used for accurate token accounting
2838 #[serde(skip_serializing_if = "Option::is_none")]
2839 pub output_tokens: Option<i64>,
2840 /// Tool call ID of the parent tool invocation when this event originates from a sub-agent
2841 #[doc(hidden)]
2842 #[deprecated]
2843 #[serde(skip_serializing_if = "Option::is_none")]
2844 pub parent_tool_call_id: Option<String>,
2845 /// Generation phase for phased-output models (e.g., thinking vs. response phases)
2846 #[serde(skip_serializing_if = "Option::is_none")]
2847 pub phase: Option<String>,
2848 /// Neutral provider-tagged reasoning content blocks preserved verbatim for round-tripping. `reasoningText` and `reasoningOpaque` are a lossy derived view of these blocks, retained for display.
2849 #[serde(skip_serializing_if = "Option::is_none")]
2850 pub reasoning_blocks: Option<AssistantMessageReasoningBlocks>,
2851 /// Opaque/encrypted extended thinking data from Anthropic models. Session-bound and stripped on resume.
2852 #[serde(skip_serializing_if = "Option::is_none")]
2853 pub reasoning_opaque: Option<String>,
2854 /// Readable reasoning text from the model's extended thinking
2855 #[serde(skip_serializing_if = "Option::is_none")]
2856 pub reasoning_text: Option<String>,
2857 /// OpenAI-compatible wire field the provider used for reasoning (e.g. reasoning_content/reasoning). Populated only when non-canonical, so the dialect round-trips across turns.
2858 #[serde(skip_serializing_if = "Option::is_none")]
2859 pub reasoning_wire_field: Option<String>,
2860 /// GitHub request tracing ID (x-github-request-id header) for correlating with server-side logs
2861 #[serde(skip_serializing_if = "Option::is_none")]
2862 pub request_id: Option<RequestId>,
2863 /// Per-request treatment/eligibility signal returned by the Copilot API in the `X-GitHub-Copilot-Request-TE` response header for the associated model call; `false` when the header was absent or unparseable.
2864 #[serde(skip_serializing_if = "Option::is_none")]
2865 pub rte: Option<bool>,
2866 /// Neutral provider-tagged server-side tool-use payload (tool search, advisor) for verbatim round-tripping
2867 #[serde(skip_serializing_if = "Option::is_none")]
2868 pub server_tools: Option<AssistantMessageServerTools>,
2869 /// Copilot service request ID (x-copilot-service-request-id header) for CAPI log correlation
2870 #[serde(skip_serializing_if = "Option::is_none")]
2871 pub service_request_id: Option<String>,
2872 /// Tool invocations requested by the assistant in this message
2873 #[serde(skip_serializing_if = "Option::is_none")]
2874 pub tool_requests: Option<Vec<AssistantMessageToolRequest>>,
2875 /// Identifier for the agent loop turn that produced this message, matching the corresponding assistant.turn_start event
2876 #[serde(skip_serializing_if = "Option::is_none")]
2877 pub turn_id: Option<String>,
2878}
2879
2880/// Session event "assistant.message_start". Streaming assistant message start metadata
2881#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2882#[serde(rename_all = "camelCase")]
2883pub struct AssistantMessageStartData {
2884 /// Message ID this start event belongs to, matching subsequent deltas and assistant.message
2885 pub message_id: String,
2886 /// Generation phase this message belongs to for phased-output models
2887 #[serde(skip_serializing_if = "Option::is_none")]
2888 pub phase: Option<String>,
2889}
2890
2891/// Session event "assistant.message_delta". Streaming assistant message delta for incremental response updates
2892#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2893#[serde(rename_all = "camelCase")]
2894pub struct AssistantMessageDeltaData {
2895 /// Incremental text chunk to append to the message content
2896 pub delta_content: String,
2897 /// Message ID this delta belongs to, matching the corresponding assistant.message event
2898 pub message_id: String,
2899 /// Tool call ID of the parent tool invocation when this event originates from a sub-agent
2900 #[doc(hidden)]
2901 #[deprecated]
2902 #[serde(skip_serializing_if = "Option::is_none")]
2903 pub parent_tool_call_id: Option<String>,
2904}
2905
2906/// Session event "assistant.turn_end". Turn completion metadata including the turn identifier
2907#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2908#[serde(rename_all = "camelCase")]
2909pub struct AssistantTurnEndData {
2910 /// Model identifier used for this turn, when known
2911 #[serde(skip_serializing_if = "Option::is_none")]
2912 pub model: Option<String>,
2913 /// Identifier of the turn that has ended, matching the corresponding assistant.turn_start event
2914 pub turn_id: String,
2915}
2916
2917/// Session event "assistant.idle". Payload emitted whenever the main agent's processing loop goes idle, including while related background work (running agents or in-flight attached shell commands) is still pending and the session-level idle event is therefore deferred
2918#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2919#[serde(rename_all = "camelCase")]
2920pub struct AssistantIdleData {
2921 /// True when the preceding agentic loop was cancelled via abort signal
2922 #[serde(skip_serializing_if = "Option::is_none")]
2923 pub aborted: Option<bool>,
2924}
2925
2926/// Token usage detail for a single billing category
2927#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2928#[serde(rename_all = "camelCase")]
2929pub struct AssistantUsageCopilotUsageTokenDetail {
2930 /// Number of tokens in this billing batch
2931 pub batch_size: i64,
2932 /// Cost per batch of tokens
2933 pub cost_per_batch: i64,
2934 /// Total token count for this entry
2935 pub token_count: i64,
2936 /// Token category (e.g., "input", "output")
2937 pub token_type: String,
2938}
2939
2940/// Per-request cost and usage data from the CAPI copilot_usage response field
2941#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2942#[serde(rename_all = "camelCase")]
2943pub struct AssistantUsageCopilotUsage {
2944 /// Itemized token usage breakdown
2945 #[doc(hidden)]
2946 #[serde(skip_serializing_if = "Option::is_none")]
2947 pub(crate) token_details: Option<Vec<AssistantUsageCopilotUsageTokenDetail>>,
2948 /// Total cost in nano-AI units for this request
2949 pub total_nano_aiu: f64,
2950}
2951
2952/// Internal per-quota snapshot for assistant usage, including entitlement, consumed requests, overage, reset date, and remaining quota.
2953#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2954#[serde(rename_all = "camelCase")]
2955pub(crate) struct AssistantUsageQuotaSnapshot {
2956 /// Total requests allowed by the entitlement
2957 #[doc(hidden)]
2958 pub(crate) entitlement_requests: i64,
2959 /// Whether the user currently has quota available for use
2960 #[doc(hidden)]
2961 #[serde(skip_serializing_if = "Option::is_none")]
2962 pub(crate) has_quota: Option<bool>,
2963 /// Whether the user has an unlimited usage entitlement
2964 #[doc(hidden)]
2965 pub(crate) is_unlimited_entitlement: bool,
2966 /// Number of additional usage requests made this period
2967 #[doc(hidden)]
2968 pub(crate) overage: f64,
2969 /// Whether additional usage is allowed when quota is exhausted
2970 #[doc(hidden)]
2971 pub(crate) overage_allowed_with_exhausted_quota: bool,
2972 /// Pay-as-you-go additional-usage budget cap in AI credits (1 credit = $0.01); present only when CAPI emits a finite value
2973 #[doc(hidden)]
2974 #[serde(skip_serializing_if = "Option::is_none")]
2975 pub(crate) overage_entitlement: Option<f64>,
2976 /// Percentage of quota remaining (0 to 100)
2977 #[doc(hidden)]
2978 pub(crate) remaining_percentage: f64,
2979 /// Date when the quota resets
2980 #[doc(hidden)]
2981 #[serde(skip_serializing_if = "Option::is_none")]
2982 pub(crate) reset_date: Option<String>,
2983 /// Whether this snapshot uses token-based billing (AI-credits allocation)
2984 #[doc(hidden)]
2985 #[serde(skip_serializing_if = "Option::is_none")]
2986 pub(crate) token_based_billing: Option<bool>,
2987 /// Whether usage is still permitted after quota exhaustion
2988 #[doc(hidden)]
2989 pub(crate) usage_allowed_with_exhausted_quota: bool,
2990 /// Number of requests already consumed
2991 #[doc(hidden)]
2992 pub(crate) used_requests: i64,
2993}
2994
2995/// Session event "assistant.usage". LLM API call usage metrics including tokens, costs, quotas, and billing information
2996#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2997#[serde(rename_all = "camelCase")]
2998pub struct AssistantUsageData {
2999 /// Number of accepted speculative prediction tokens
3000 #[serde(skip_serializing_if = "Option::is_none")]
3001 pub accepted_prediction_tokens: Option<i64>,
3002 /// Completion ID from the model provider (e.g., chatcmpl-abc123)
3003 #[serde(skip_serializing_if = "Option::is_none")]
3004 pub api_call_id: Option<String>,
3005 /// API endpoint used for this model call, matching CAPI supported_endpoints vocabulary
3006 #[serde(skip_serializing_if = "Option::is_none")]
3007 pub api_endpoint: Option<AssistantUsageApiEndpoint>,
3008 /// Number of tools available to the model for this call
3009 #[doc(hidden)]
3010 #[serde(skip_serializing_if = "Option::is_none")]
3011 pub(crate) available_tool_count: Option<i64>,
3012 /// Whether the provider reported prompt-cache usage details for this call
3013 #[doc(hidden)]
3014 #[serde(skip_serializing_if = "Option::is_none")]
3015 pub(crate) cache_details_reported: Option<bool>,
3016 /// Updated prompt-cache expiration for this model call. Present only when the call establishes or refreshes known cache state.
3017 #[serde(skip_serializing_if = "Option::is_none")]
3018 pub cache_expires_at: Option<String>,
3019 /// Number of tokens read from prompt cache
3020 #[serde(skip_serializing_if = "Option::is_none")]
3021 pub cache_read_tokens: Option<i64>,
3022 /// Effective prompt-cache lifetime in seconds for this call
3023 #[doc(hidden)]
3024 #[serde(skip_serializing_if = "Option::is_none")]
3025 pub(crate) cache_ttl_seconds: Option<i64>,
3026 /// Number of tokens written to prompt cache
3027 #[serde(skip_serializing_if = "Option::is_none")]
3028 pub cache_write_tokens: Option<i64>,
3029 /// 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.
3030 #[serde(skip_serializing_if = "Option::is_none")]
3031 pub content_filter_triggered: Option<bool>,
3032 /// Per-request cost and usage data from the CAPI copilot_usage response field
3033 #[serde(skip_serializing_if = "Option::is_none")]
3034 pub copilot_usage: Option<AssistantUsageCopilotUsage>,
3035 /// Model multiplier cost for billing purposes
3036 ///
3037 /// <div class="warning">
3038 ///
3039 /// **Experimental.** This type is part of an experimental wire-protocol surface
3040 /// and may change or be removed in future SDK or CLI releases.
3041 ///
3042 /// </div>
3043 #[serde(skip_serializing_if = "Option::is_none")]
3044 pub cost: Option<f64>,
3045 /// Duration of the API call in milliseconds
3046 #[serde(skip_serializing_if = "Option::is_none")]
3047 pub duration: Option<i64>,
3048 /// 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".
3049 #[serde(skip_serializing_if = "Option::is_none")]
3050 pub finish_reason: Option<String>,
3051 /// How the prompt-cache frontier was determined for this call
3052 #[doc(hidden)]
3053 #[serde(skip_serializing_if = "Option::is_none")]
3054 pub(crate) frontier_source: Option<String>,
3055 /// Experimental HydraFusion attribution for this concrete model call's usage.
3056 ///
3057 /// <div class="warning">
3058 ///
3059 /// **Experimental.** This type is part of an experimental wire-protocol surface
3060 /// and may change or be removed in future SDK or CLI releases.
3061 ///
3062 /// </div>
3063 #[serde(skip_serializing_if = "Option::is_none")]
3064 pub fusion: Option<FusionAttribution>,
3065 /// What initiated this API call (e.g., "sub-agent", "mcp-sampling"); absent for user-initiated calls
3066 #[serde(skip_serializing_if = "Option::is_none")]
3067 pub initiator: Option<String>,
3068 /// Number of input tokens consumed
3069 #[serde(skip_serializing_if = "Option::is_none")]
3070 pub input_tokens: Option<i64>,
3071 /// Coarse classification of the interaction that produced this call, mirroring the session's per-request agent context (e.g. `conversation-agent`, `conversation-subagent`, `conversation-sampling`, `conversation-background`, `conversation-compaction`, `conversation-user`). Non-billing; lets consumers attribute a model call to a call class (e.g. sub-agent/sidekick) independently of the billing initiator. Absent when the runtime did not classify the request.
3072 #[serde(skip_serializing_if = "Option::is_none")]
3073 pub interaction_type: Option<String>,
3074 /// Average inter-token latency in milliseconds. Only available for streaming requests
3075 #[serde(skip_serializing_if = "Option::is_none")]
3076 pub inter_token_latency_ms: Option<f64>,
3077 /// Whether Auto mode was selected for this model call
3078 #[serde(skip_serializing_if = "Option::is_none")]
3079 pub is_auto: Option<bool>,
3080 /// Whether this model call used a bring-your-own-key provider
3081 #[serde(skip_serializing_if = "Option::is_none")]
3082 pub is_byok: Option<bool>,
3083 /// Requested maximum output tokens used for this model call
3084 #[serde(skip_serializing_if = "Option::is_none")]
3085 pub max_output_tokens: Option<i64>,
3086 /// Effective maximum prompt-token limit used for this model call
3087 #[serde(skip_serializing_if = "Option::is_none")]
3088 pub max_prompt_tokens: Option<i64>,
3089 /// Model identifier used for this API call
3090 pub model: String,
3091 /// Number of tool calls returned by the model
3092 #[doc(hidden)]
3093 #[serde(skip_serializing_if = "Option::is_none")]
3094 pub(crate) num_tool_calls: Option<i64>,
3095 /// Number of output tokens produced
3096 #[serde(skip_serializing_if = "Option::is_none")]
3097 pub output_tokens: Option<i64>,
3098 /// Time to first observable model output in milliseconds. Includes text, reasoning, and tool-call output; only available for streaming requests that produce observable output.
3099 #[serde(skip_serializing_if = "Option::is_none")]
3100 pub output_ttft_ms: Option<f64>,
3101 /// Parent tool call ID when this usage originates from a sub-agent
3102 #[doc(hidden)]
3103 #[deprecated]
3104 #[serde(skip_serializing_if = "Option::is_none")]
3105 pub parent_tool_call_id: Option<String>,
3106 /// GitHub request tracing ID (x-github-request-id header) for server-side log correlation
3107 #[serde(skip_serializing_if = "Option::is_none")]
3108 pub provider_call_id: Option<String>,
3109 /// Per-quota resource usage snapshots, keyed by quota identifier
3110 #[doc(hidden)]
3111 #[serde(skip_serializing_if = "Option::is_none")]
3112 pub(crate) quota_snapshots: Option<HashMap<String, AssistantUsageQuotaSnapshot>>,
3113 /// Reasoning effort level used for model calls, if applicable (e.g. "none", "low", "medium", "high", "xhigh", "max")
3114 #[serde(skip_serializing_if = "Option::is_none")]
3115 pub reasoning_effort: Option<String>,
3116 /// Reasoning summary mode used for this model call, if applicable
3117 #[serde(skip_serializing_if = "Option::is_none")]
3118 pub reasoning_summary: Option<ReasoningSummary>,
3119 /// Number of output tokens used for reasoning (e.g., chain-of-thought)
3120 #[serde(skip_serializing_if = "Option::is_none")]
3121 pub reasoning_tokens: Option<i64>,
3122 /// Number of rejected speculative prediction tokens
3123 #[serde(skip_serializing_if = "Option::is_none")]
3124 pub rejected_prediction_tokens: Option<i64>,
3125 /// Per-request treatment/eligibility signal returned by the Copilot API in the `X-GitHub-Copilot-Request-TE` response header for the associated model call; `false` when the header was absent or unparseable.
3126 #[serde(skip_serializing_if = "Option::is_none")]
3127 pub rte: Option<bool>,
3128 /// Copilot service request ID (x-copilot-service-request-id header) for CAPI log correlation
3129 #[serde(skip_serializing_if = "Option::is_none")]
3130 pub service_request_id: Option<String>,
3131 /// Time to first token in milliseconds. Only available for streaming requests
3132 #[serde(skip_serializing_if = "Option::is_none")]
3133 pub time_to_first_token_ms: Option<f64>,
3134 /// Tool-call counts keyed by tool name
3135 #[doc(hidden)]
3136 #[serde(skip_serializing_if = "Option::is_none")]
3137 pub(crate) tool_counts: Option<HashMap<String, i64>>,
3138 /// Number of tokens used by tool definitions for this call
3139 #[doc(hidden)]
3140 #[serde(skip_serializing_if = "Option::is_none")]
3141 pub(crate) tool_token_count: Option<i64>,
3142 /// Transport used for this model call (http or websocket)
3143 #[serde(skip_serializing_if = "Option::is_none")]
3144 pub transport: Option<AssistantUsageTransport>,
3145}
3146
3147/// Session event "prompt_cache_break". A detected loss of a previously cached prompt prefix
3148#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3149#[serde(rename_all = "camelCase")]
3150pub struct PromptCacheBreakData {
3151 /// Request state whose cached prefix fell short
3152 #[doc(hidden)]
3153 #[serde(skip_serializing_if = "Option::is_none")]
3154 pub(crate) after_request: Option<serde_json::Value>,
3155 /// Name of the sub-agent whose conversation broke, stamped by the parent bridge
3156 #[doc(hidden)]
3157 #[serde(skip_serializing_if = "Option::is_none")]
3158 pub(crate) agent_name: Option<String>,
3159 /// Request state that established the prior cache frontier
3160 #[doc(hidden)]
3161 #[serde(skip_serializing_if = "Option::is_none")]
3162 pub(crate) before_request: Option<serde_json::Value>,
3163 /// Names of the cache-configuration fields that changed
3164 #[doc(hidden)]
3165 #[serde(skip_serializing_if = "Option::is_none")]
3166 pub(crate) cache_config_changed_fields: Option<Vec<String>>,
3167 /// All reasons that contributed to the cache break, ordered by precedence
3168 pub contributing_reasons: Vec<String>,
3169 /// Prior cached prompt frontier in tokens
3170 pub frontier_tokens: i64,
3171 /// Model that held the prior cache frontier, when the call changed models
3172 #[doc(hidden)]
3173 #[serde(skip_serializing_if = "Option::is_none")]
3174 pub(crate) model_from: Option<String>,
3175 /// Model this call targeted, when the call changed models
3176 #[doc(hidden)]
3177 #[serde(skip_serializing_if = "Option::is_none")]
3178 pub(crate) model_to: Option<String>,
3179 /// The highest-precedence reason for the cache break
3180 pub primary_reason: String,
3181 /// Fraction of the prior cache frontier that survived
3182 pub retention_ratio: f64,
3183 /// Index of the first conversation message whose content changed
3184 #[doc(hidden)]
3185 #[serde(skip_serializing_if = "Option::is_none")]
3186 pub(crate) rewrite_message_index: Option<i64>,
3187 /// Shape of the history rewrite, for example whether the history grew or shrank
3188 #[doc(hidden)]
3189 #[serde(skip_serializing_if = "Option::is_none")]
3190 pub(crate) rewrite_shape: Option<String>,
3191 /// Subsystems that announced a history rewrite before this call, for example compaction or truncation
3192 #[doc(hidden)]
3193 #[serde(skip_serializing_if = "Option::is_none")]
3194 pub(crate) rewrite_source: Option<Vec<String>>,
3195 /// Cached prefix tokens lost since the prior call
3196 pub shortfall_tokens: i64,
3197 /// Number of cached prefix tokens that survived
3198 pub survived_tokens: i64,
3199 /// Names of the system-prompt segments whose content changed
3200 #[doc(hidden)]
3201 #[serde(skip_serializing_if = "Option::is_none")]
3202 pub(crate) system_segments_changed: Option<Vec<String>>,
3203 /// Telemetry-safe names of tools added since the prior call
3204 #[doc(hidden)]
3205 #[serde(skip_serializing_if = "Option::is_none")]
3206 pub(crate) tools_added: Option<Vec<String>>,
3207 /// Raw names of tools added since the prior call, restricted because a tool name can be user-authored
3208 #[doc(hidden)]
3209 #[serde(skip_serializing_if = "Option::is_none")]
3210 pub(crate) tools_added_raw: Option<Vec<String>>,
3211 /// Telemetry-safe names of tools whose definition changed since the prior call
3212 #[doc(hidden)]
3213 #[serde(skip_serializing_if = "Option::is_none")]
3214 pub(crate) tools_redefined: Option<Vec<String>>,
3215 /// Raw names of tools redefined since the prior call, restricted because a tool name can be user-authored
3216 #[doc(hidden)]
3217 #[serde(skip_serializing_if = "Option::is_none")]
3218 pub(crate) tools_redefined_raw: Option<Vec<String>>,
3219 /// Telemetry-safe names of tools removed since the prior call
3220 #[doc(hidden)]
3221 #[serde(skip_serializing_if = "Option::is_none")]
3222 pub(crate) tools_removed: Option<Vec<String>>,
3223 /// Raw names of tools removed since the prior call, restricted because a tool name can be user-authored
3224 #[doc(hidden)]
3225 #[serde(skip_serializing_if = "Option::is_none")]
3226 pub(crate) tools_removed_raw: Option<Vec<String>>,
3227 /// Whether the tool list kept its members but changed their order
3228 #[doc(hidden)]
3229 #[serde(skip_serializing_if = "Option::is_none")]
3230 pub(crate) tools_reordered: Option<bool>,
3231}
3232
3233/// Content-free structural summary of the failing request for diagnosing malformed 4xx calls
3234#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3235#[serde(rename_all = "camelCase")]
3236pub struct ModelCallFailureRequestFingerprint {
3237 /// Total number of image content parts
3238 pub image_part_count: i64,
3239 /// Image parts whose media type cannot be determined (rejected by strict providers)
3240 pub image_parts_missing_media_type: i64,
3241 /// Role of the final message in the request
3242 #[serde(skip_serializing_if = "Option::is_none")]
3243 pub last_message_role: Option<String>,
3244 /// Total number of messages in the request
3245 pub message_count: i64,
3246 /// Tool calls whose name is missing or empty (rejected by strict providers)
3247 pub nameless_tool_call_count: i64,
3248 /// Total number of tool calls across assistant messages
3249 pub tool_call_count: i64,
3250 /// Number of "tool" result messages in the request
3251 pub tool_result_message_count: i64,
3252}
3253
3254/// Session event "model.call_failure". Failed LLM API call metadata for telemetry
3255#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3256#[serde(rename_all = "camelCase")]
3257pub struct ModelCallFailureData {
3258 /// Completion ID from the model provider (e.g., chatcmpl-abc123)
3259 #[serde(skip_serializing_if = "Option::is_none")]
3260 pub api_call_id: Option<String>,
3261 /// API endpoint used for this model call, matching CAPI supported_endpoints vocabulary
3262 #[serde(skip_serializing_if = "Option::is_none")]
3263 pub api_endpoint: Option<AssistantUsageApiEndpoint>,
3264 /// For HTTP 400 failures only: whether the response carried a structured CAPI error envelope (structured_error, a deterministic validation failure) or no error body (bodyless, the transient gateway/proxy signature). Absent for non-400 failures.
3265 #[serde(skip_serializing_if = "Option::is_none")]
3266 pub bad_request_kind: Option<ModelCallFailureBadRequestKind>,
3267 /// Duration of the failed API call in milliseconds
3268 #[serde(skip_serializing_if = "Option::is_none")]
3269 pub duration_ms: Option<i64>,
3270 /// For HTTP 400 failures only: the `code` from the CAPI error envelope (e.g. 'model_max_prompt_tokens_exceeded') identifying which deterministic validation failure occurred. Raw server-controlled string, emitted only through restricted telemetry. Absent for bodyless or non-400 failures.
3271 #[serde(skip_serializing_if = "Option::is_none")]
3272 pub error_code: Option<String>,
3273 /// Raw provider/runtime error message for restricted telemetry
3274 #[serde(skip_serializing_if = "Option::is_none")]
3275 pub error_message: Option<String>,
3276 /// For HTTP 400 failures only: the `type` from the CAPI error envelope (e.g. 'websocket_error'), a coarser companion to errorCode for envelopes that carry no code. Raw server-controlled string, emitted only through restricted telemetry. Absent for bodyless or non-400 failures.
3277 #[serde(skip_serializing_if = "Option::is_none")]
3278 pub error_type: Option<String>,
3279 /// Whether the failure originated from an API response or the request transport
3280 #[serde(skip_serializing_if = "Option::is_none")]
3281 pub failure_kind: Option<ModelCallFailureKind>,
3282 /// Experimental HydraFusion attribution for this failed concrete model call.
3283 ///
3284 /// <div class="warning">
3285 ///
3286 /// **Experimental.** This type is part of an experimental wire-protocol surface
3287 /// and may change or be removed in future SDK or CLI releases.
3288 ///
3289 /// </div>
3290 #[serde(skip_serializing_if = "Option::is_none")]
3291 pub fusion: Option<FusionAttribution>,
3292 /// What initiated this API call (e.g., "sub-agent", "mcp-sampling"); absent for user-initiated calls
3293 #[serde(skip_serializing_if = "Option::is_none")]
3294 pub initiator: Option<String>,
3295 /// Authoritative interaction classification for the failed call, matching `assistant.usage.interactionType` (for example `conversation-agent`, `conversation-subagent`, or `conversation-sampling`). Absent when the producer cannot classify the interaction.
3296 #[serde(skip_serializing_if = "Option::is_none")]
3297 pub interaction_type: Option<String>,
3298 /// Whether the session selected Auto mode for the failed call
3299 #[serde(skip_serializing_if = "Option::is_none")]
3300 pub is_auto: Option<bool>,
3301 /// Whether the failed call used a bring-your-own-key provider
3302 #[serde(skip_serializing_if = "Option::is_none")]
3303 pub is_byok: Option<bool>,
3304 /// Effective maximum output-token limit for the failed call
3305 #[serde(skip_serializing_if = "Option::is_none")]
3306 pub max_output_tokens: Option<i64>,
3307 /// Effective maximum prompt-token limit for the failed call
3308 #[serde(skip_serializing_if = "Option::is_none")]
3309 pub max_prompt_tokens: Option<i64>,
3310 /// Model identifier used for the failed API call
3311 #[serde(skip_serializing_if = "Option::is_none")]
3312 pub model: Option<String>,
3313 /// GitHub request tracing ID (x-github-request-id header) for server-side log correlation
3314 #[serde(skip_serializing_if = "Option::is_none")]
3315 pub provider_call_id: Option<String>,
3316 /// Per-quota usage snapshots parsed from the failed response's quota headers, keyed by quota identifier. Present when the error response carried quota headers (e.g. a 402 once the additional spend limit is reached) so the UI can refresh the quota display on failure.
3317 #[doc(hidden)]
3318 #[serde(skip_serializing_if = "Option::is_none")]
3319 pub(crate) quota_snapshots: Option<HashMap<String, AssistantUsageQuotaSnapshot>>,
3320 /// Reasoning effort level used for the failed model call, if applicable
3321 #[serde(skip_serializing_if = "Option::is_none")]
3322 pub reasoning_effort: Option<String>,
3323 /// Content-free structural summary of the failing request. Contains only counts and shape flags (no prompt content), so it is safe for unrestricted telemetry. Populated only for client-error (4xx) failures.
3324 #[serde(skip_serializing_if = "Option::is_none")]
3325 pub request_fingerprint: Option<ModelCallFailureRequestFingerprint>,
3326 /// Per-request treatment/eligibility signal returned by the Copilot API in the `X-GitHub-Copilot-Request-TE` response header for the associated model call; `false` when the header was absent or unparseable.
3327 #[serde(skip_serializing_if = "Option::is_none")]
3328 pub rte: Option<bool>,
3329 /// Copilot service request ID (x-copilot-service-request-id header) for CAPI log correlation
3330 #[serde(skip_serializing_if = "Option::is_none")]
3331 pub service_request_id: Option<String>,
3332 /// Where the failed model call originated
3333 pub source: ModelCallFailureSource,
3334 /// HTTP status code from the failed request
3335 #[serde(skip_serializing_if = "Option::is_none")]
3336 pub status_code: Option<i32>,
3337 /// Transport used for the failed model call (http or websocket)
3338 #[serde(skip_serializing_if = "Option::is_none")]
3339 pub transport: Option<ModelCallFailureTransport>,
3340}
3341
3342/// Session event "model.call_finished". Final lifecycle outcome for one logical model dispatch. A logical dispatch may include internal reconnect or fallback work, so event count is not provider HTTP-request count.
3343#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3344#[serde(rename_all = "camelCase")]
3345pub struct ModelCallFinishedData {
3346 /// Whether an accepted successful response requested the exact name and command semantics of a built-in file edit tool, including an external tool explicitly replacing that built-in name. Absent when the logical dispatch did not produce an accepted response.
3347 #[serde(skip_serializing_if = "Option::is_none")]
3348 pub contains_built_in_file_edit_request: Option<bool>,
3349 /// Monotonic elapsed time spent in the logical model dispatch, including any internal transport reconnect or fallback and excluding orchestrator retry backoff, tool execution, confirmations, and post-response processing
3350 pub dispatch_duration_ms: f64,
3351 /// Version of the built-in file-edit semantic classifier used for this event
3352 pub edit_classifier_version: i64,
3353 /// Identifier of the user interaction that owns the model dispatch, matching assistant.turn_start.interactionId when available
3354 #[serde(skip_serializing_if = "Option::is_none")]
3355 pub interaction_id: Option<String>,
3356 /// Final outcome after post-response acceptance processing
3357 pub outcome: ModelCallFinishedOutcome,
3358 /// Agent-loop iteration within the interaction that initiated the model dispatch
3359 pub turn_id: String,
3360}
3361
3362/// Session event "model.call_start". Model API dispatch metadata for internal telemetry
3363#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3364#[serde(rename_all = "camelCase")]
3365pub struct ModelCallStartData {
3366 /// Experimental HydraFusion attribution for this concrete model call.
3367 ///
3368 /// <div class="warning">
3369 ///
3370 /// **Experimental.** This type is part of an experimental wire-protocol surface
3371 /// and may change or be removed in future SDK or CLI releases.
3372 ///
3373 /// </div>
3374 #[serde(skip_serializing_if = "Option::is_none")]
3375 pub fusion: Option<FusionAttribution>,
3376 /// Model identifier used for this API call, when known
3377 #[serde(skip_serializing_if = "Option::is_none")]
3378 pub model: Option<String>,
3379 /// Previous response or interaction identifier included in the model request, when present
3380 #[doc(hidden)]
3381 #[serde(skip_serializing_if = "Option::is_none")]
3382 pub(crate) previous_response_id: Option<String>,
3383 /// Identifier of the assistant turn that initiated the model call
3384 pub turn_id: String,
3385}
3386
3387/// Session event "abort". Turn abort information including the reason for termination
3388#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3389#[serde(rename_all = "camelCase")]
3390pub struct AbortData {
3391 /// Finite reason code describing why the current turn was aborted
3392 pub reason: AbortReason,
3393}
3394
3395/// Session event "tool.user_requested". User-initiated tool invocation request with tool name and arguments
3396#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3397#[serde(rename_all = "camelCase")]
3398pub struct ToolUserRequestedData {
3399 /// Arguments for the tool invocation
3400 #[serde(skip_serializing_if = "Option::is_none")]
3401 pub arguments: Option<serde_json::Value>,
3402 /// Unique identifier for this tool call
3403 pub tool_call_id: String,
3404 /// Name of the tool the user wants to invoke
3405 pub tool_name: String,
3406}
3407
3408/// Shell-aware path hints for a shell tool's command, captured at start time so consumers can snapshot a file's pre-image before the tool runs.
3409#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3410#[serde(rename_all = "camelCase")]
3411pub struct ToolExecutionStartShellToolInfo {
3412 /// The command with a redundant leading `cd` into the working directory removed, present only when there was one to remove. Computed with the same routine the shell driver applies before spawning, so a surface that renders this shows the text that actually runs. Consumers that display it should keep the original tool arguments available on demand.
3413 ///
3414 /// <div class="warning">
3415 ///
3416 /// **Experimental.** This type is part of an experimental wire-protocol surface
3417 /// and may change or be removed in future SDK or CLI releases.
3418 ///
3419 /// </div>
3420 #[serde(skip_serializing_if = "Option::is_none")]
3421 pub display_command: Option<String>,
3422 /// Whether the command includes a file write redirection (e.g., > or >>).
3423 pub has_write_file_redirection: bool,
3424 /// File paths the command may read or write, derived from the command at start time. Produced by the same shell-aware extractor as PermissionRequestShell.possiblePaths, so it is present even when the command is auto-approved and no permission request fires.
3425 pub possible_paths: Vec<String>,
3426}
3427
3428/// MCP Apps tool `_meta.ui` resource URI and visibility captured on `tool.execution_start`.
3429#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3430#[serde(rename_all = "camelCase")]
3431pub struct ToolExecutionStartToolDescriptionMetaUI {
3432 /// URI of the UI resource
3433 #[serde(skip_serializing_if = "Option::is_none")]
3434 pub resource_uri: Option<String>,
3435 /// Who can access this tool
3436 #[serde(skip_serializing_if = "Option::is_none")]
3437 pub visibility: Option<Vec<ToolExecutionStartToolDescriptionMetaUIVisibility>>,
3438}
3439
3440/// MCP Apps metadata for UI resource association
3441#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3442#[serde(rename_all = "camelCase")]
3443pub struct ToolExecutionStartToolDescriptionMeta {
3444 /// MCP Apps tool `_meta.ui` resource URI and visibility captured on `tool.execution_start`.
3445 #[serde(skip_serializing_if = "Option::is_none")]
3446 pub ui: Option<ToolExecutionStartToolDescriptionMetaUI>,
3447}
3448
3449/// Tool definition metadata, present for MCP tools with MCP Apps support
3450#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3451#[serde(rename_all = "camelCase")]
3452pub struct ToolExecutionStartToolDescription {
3453 /// MCP Apps metadata for UI resource association
3454 #[serde(rename = "_meta", skip_serializing_if = "Option::is_none")]
3455 pub meta: Option<ToolExecutionStartToolDescriptionMeta>,
3456 /// Tool description
3457 #[serde(skip_serializing_if = "Option::is_none")]
3458 pub description: Option<String>,
3459 /// Tool name
3460 pub name: String,
3461}
3462
3463/// Session event "tool.execution_start". Tool execution startup details including MCP server information when applicable
3464#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3465#[serde(rename_all = "camelCase")]
3466pub struct ToolExecutionStartData {
3467 /// Arguments passed to the tool
3468 #[serde(skip_serializing_if = "Option::is_none")]
3469 pub arguments: Option<serde_json::Value>,
3470 /// When true, the tool output should be displayed expanded (verbatim) in the CLI timeline
3471 #[serde(skip_serializing_if = "Option::is_none")]
3472 pub display_verbatim: Option<bool>,
3473 /// Experimental HydraFusion attribution for this tool execution.
3474 ///
3475 /// <div class="warning">
3476 ///
3477 /// **Experimental.** This type is part of an experimental wire-protocol surface
3478 /// and may change or be removed in future SDK or CLI releases.
3479 ///
3480 /// </div>
3481 #[serde(skip_serializing_if = "Option::is_none")]
3482 pub fusion: Option<FusionAttribution>,
3483 /// Name of the MCP server hosting this tool, when the tool is an MCP tool
3484 #[serde(skip_serializing_if = "Option::is_none")]
3485 pub mcp_server_name: Option<String>,
3486 /// Original tool name on the MCP server, when the tool is an MCP tool
3487 #[serde(skip_serializing_if = "Option::is_none")]
3488 pub mcp_tool_name: Option<String>,
3489 /// Model identifier that generated this tool call
3490 #[serde(skip_serializing_if = "Option::is_none")]
3491 pub model: Option<String>,
3492 /// Tool call ID of the parent tool invocation when this event originates from a sub-agent
3493 #[doc(hidden)]
3494 #[deprecated]
3495 #[serde(skip_serializing_if = "Option::is_none")]
3496 pub parent_tool_call_id: Option<String>,
3497 /// Per-request treatment/eligibility signal returned by the Copilot API in the `X-GitHub-Copilot-Request-TE` response header for the associated model call; `false` when the header was absent or unparseable.
3498 #[serde(skip_serializing_if = "Option::is_none")]
3499 pub rte: Option<bool>,
3500 /// Shell-tool path hints derived from the command at start time for shell tools (bash/powershell/local_shell). Produced by the same shell-aware extractor as PermissionRequestShell.possiblePaths, so it is present even when the command is auto-approved and no permission request fires. Absent for non-shell tools.
3501 #[serde(skip_serializing_if = "Option::is_none")]
3502 pub shell_tool_info: Option<ToolExecutionStartShellToolInfo>,
3503 /// Unique identifier for this tool call
3504 pub tool_call_id: String,
3505 /// Tool definition metadata, present for MCP tools with MCP Apps support
3506 #[serde(skip_serializing_if = "Option::is_none")]
3507 pub tool_description: Option<ToolExecutionStartToolDescription>,
3508 /// Name of the tool being executed
3509 pub tool_name: String,
3510 /// Identifier for the agent loop turn this tool was invoked in, matching the corresponding assistant.turn_start event
3511 #[serde(skip_serializing_if = "Option::is_none")]
3512 pub turn_id: Option<String>,
3513}
3514
3515/// Session event "tool.execution_partial_result". Streaming tool execution output for incremental result display
3516#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3517#[serde(rename_all = "camelCase")]
3518pub struct ToolExecutionPartialResultData {
3519 /// Incremental output chunk from the running tool
3520 pub partial_output: String,
3521 /// Tool call ID this partial result belongs to
3522 pub tool_call_id: String,
3523}
3524
3525/// Session event "tool.execution_progress". Tool execution progress notification with status message
3526#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3527#[serde(rename_all = "camelCase")]
3528pub struct ToolExecutionProgressData {
3529 /// Human-readable progress status message (e.g., from an MCP server)
3530 pub progress_message: String,
3531 /// Tool call ID this progress notification belongs to
3532 pub tool_call_id: String,
3533}
3534
3535/// Error details when the tool execution failed
3536#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3537#[serde(rename_all = "camelCase")]
3538pub struct ToolExecutionCompleteError {
3539 /// Machine-readable error code
3540 #[serde(skip_serializing_if = "Option::is_none")]
3541 pub code: Option<String>,
3542 /// Human-readable error message
3543 pub message: String,
3544 /// What the user must do to recover, when the runtime knows of an action. Set on sandbox policy denials, where `message` names the rule that blocked the call but never the client affordance that relaxes it.
3545 #[serde(skip_serializing_if = "Option::is_none")]
3546 pub remediation: Option<RemediationAction>,
3547}
3548
3549/// Binary result returned by a tool for the model
3550#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3551#[serde(rename_all = "camelCase")]
3552pub struct PersistedBinaryImage {
3553 /// Base64-encoded binary data
3554 pub data: String,
3555 /// Human-readable description of the binary data
3556 #[serde(skip_serializing_if = "Option::is_none")]
3557 pub description: Option<String>,
3558 /// Optional metadata from the producing tool.
3559 #[serde(skip_serializing_if = "Option::is_none")]
3560 pub metadata: Option<HashMap<String, serde_json::Value>>,
3561 /// MIME type of the binary data
3562 pub mime_type: String,
3563 /// Binary result type discriminator. Use "image" for images and "resource" for other binary data.
3564 pub r#type: PersistedBinaryImageType,
3565}
3566
3567/// A binary result whose data was omitted from persistence due to the inline size limit
3568///
3569/// <div class="warning">
3570///
3571/// **Experimental.** This type is part of an experimental wire-protocol surface
3572/// and may change or be removed in future SDK or CLI releases.
3573///
3574/// </div>
3575#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3576#[serde(rename_all = "camelCase")]
3577pub struct OmittedBinaryResult {
3578 /// Decoded byte length of the omitted binary data
3579 pub byte_length: i64,
3580 /// Human-readable description of the binary data
3581 #[serde(skip_serializing_if = "Option::is_none")]
3582 pub description: Option<String>,
3583 /// Optional metadata from the producing tool.
3584 #[serde(skip_serializing_if = "Option::is_none")]
3585 pub metadata: Option<HashMap<String, serde_json::Value>>,
3586 /// MIME type of the omitted binary data
3587 pub mime_type: String,
3588 /// Why the binary data is absent: it exceeded the inline size limit, or its asset was unavailable
3589 pub omitted_reason: OmittedBinaryOmittedReason,
3590 /// Binary result type discriminator. Use "image" for images and "resource" for other binary data.
3591 pub r#type: OmittedBinaryType,
3592}
3593
3594/// A reference to binary data persisted once on a session.binary_asset event and shared by id
3595///
3596/// <div class="warning">
3597///
3598/// **Experimental.** This type is part of an experimental wire-protocol surface
3599/// and may change or be removed in future SDK or CLI releases.
3600///
3601/// </div>
3602#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3603#[serde(rename_all = "camelCase")]
3604pub struct BinaryAssetReference {
3605 /// Content-addressed id of the session.binary_asset event that holds this binary's bytes (e.g. "sha256:...").
3606 pub asset_id: String,
3607 /// Decoded byte length of the referenced binary data
3608 pub byte_length: i64,
3609 /// Human-readable description of the binary data
3610 #[serde(skip_serializing_if = "Option::is_none")]
3611 pub description: Option<String>,
3612 /// Optional metadata from the producing tool.
3613 #[serde(skip_serializing_if = "Option::is_none")]
3614 pub metadata: Option<HashMap<String, serde_json::Value>>,
3615 /// MIME type of the referenced binary data
3616 pub mime_type: String,
3617 /// Binary result type discriminator. Use "image" for images and "resource" for other binary data.
3618 pub r#type: BinaryAssetReferenceType,
3619}
3620
3621/// A source supplied by a tool that should be made available to the model as citable content.
3622///
3623/// <div class="warning">
3624///
3625/// **Experimental.** This type is part of an experimental wire-protocol surface
3626/// and may change or be removed in future SDK or CLI releases.
3627///
3628/// </div>
3629#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3630#[serde(rename_all = "camelCase")]
3631pub struct CitableSource {
3632 /// The source text made available to the model as citable content.
3633 pub content: String,
3634 /// Stable identifier for this source within the tool result. Used for deduplication and may be used by future provider integrations to correlate response citations back to the originating source.
3635 pub id: String,
3636 /// File path relative to the agent's workspace root, when the source is a file.
3637 #[serde(skip_serializing_if = "Option::is_none")]
3638 pub path: Option<String>,
3639 /// Human-readable title of the source.
3640 #[serde(skip_serializing_if = "Option::is_none")]
3641 pub title: Option<String>,
3642 /// URL of the source, when it is a web resource.
3643 #[serde(skip_serializing_if = "Option::is_none")]
3644 pub url: Option<String>,
3645}
3646
3647/// Plain text content block
3648#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3649#[serde(rename_all = "camelCase")]
3650pub struct ToolExecutionCompleteContentText {
3651 /// The text content
3652 pub text: String,
3653 /// Content block type discriminator
3654 pub r#type: ToolExecutionCompleteContentTextType,
3655}
3656
3657/// Deprecated for shell command exit metadata. Use ToolExecutionCompleteContentShellExit instead.
3658#[doc(hidden)]
3659#[deprecated]
3660#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3661#[serde(rename_all = "camelCase")]
3662pub struct ToolExecutionCompleteContentTerminal {
3663 /// Working directory where the command was executed
3664 #[serde(skip_serializing_if = "Option::is_none")]
3665 pub cwd: Option<String>,
3666 /// Process exit code, if the command has completed
3667 #[serde(skip_serializing_if = "Option::is_none")]
3668 pub exit_code: Option<i64>,
3669 /// Terminal/shell output text
3670 pub text: String,
3671 /// Content block type discriminator
3672 pub r#type: ToolExecutionCompleteContentTerminalType,
3673}
3674
3675/// Shell command exit metadata with optional output preview
3676#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3677#[serde(rename_all = "camelCase")]
3678pub struct ToolExecutionCompleteContentShellExit {
3679 /// Working directory where the shell command was executed
3680 #[serde(skip_serializing_if = "Option::is_none")]
3681 pub cwd: Option<String>,
3682 /// Exit code from the completed shell command
3683 pub exit_code: i64,
3684 /// Path reported in the shell session's filesystem namespace when shell output exceeded the configured large-output threshold.
3685 #[serde(skip_serializing_if = "Option::is_none")]
3686 pub output_file_path: Option<String>,
3687 /// Output associated with this shell command, if available. May be partial, truncated, or a preview; not guaranteed to be full output.
3688 #[serde(skip_serializing_if = "Option::is_none")]
3689 pub output_preview: Option<String>,
3690 /// Whether outputPreview is known to be incomplete or truncated
3691 #[serde(skip_serializing_if = "Option::is_none")]
3692 pub output_truncated: Option<bool>,
3693 /// Shell id, as assigned by Copilot runtime
3694 pub shell_id: String,
3695 /// Content block type discriminator
3696 pub r#type: ToolExecutionCompleteContentShellExitType,
3697}
3698
3699/// Image content block with base64-encoded data
3700#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3701#[serde(rename_all = "camelCase")]
3702pub struct ToolExecutionCompleteContentImage {
3703 /// Base64-encoded image data
3704 pub data: String,
3705 /// MIME type of the image (e.g., image/png, image/jpeg)
3706 pub mime_type: String,
3707 /// Content block type discriminator
3708 pub r#type: ToolExecutionCompleteContentImageType,
3709}
3710
3711/// Audio content block with base64-encoded data
3712#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3713#[serde(rename_all = "camelCase")]
3714pub struct ToolExecutionCompleteContentAudio {
3715 /// Base64-encoded audio data
3716 pub data: String,
3717 /// MIME type of the audio (e.g., audio/wav, audio/mpeg)
3718 pub mime_type: String,
3719 /// Content block type discriminator
3720 pub r#type: ToolExecutionCompleteContentAudioType,
3721}
3722
3723/// Icon image for a resource
3724#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3725#[serde(rename_all = "camelCase")]
3726pub struct ToolExecutionCompleteContentResourceLinkIcon {
3727 /// MIME type of the icon image
3728 #[serde(skip_serializing_if = "Option::is_none")]
3729 pub mime_type: Option<String>,
3730 /// Available icon sizes (e.g., ['16x16', '32x32'])
3731 #[serde(skip_serializing_if = "Option::is_none")]
3732 pub sizes: Option<Vec<String>>,
3733 /// URL or path to the icon image
3734 pub src: String,
3735 /// Theme variant this icon is intended for
3736 #[serde(skip_serializing_if = "Option::is_none")]
3737 pub theme: Option<ToolExecutionCompleteContentResourceLinkIconTheme>,
3738}
3739
3740/// Resource link content block referencing an external resource
3741#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3742#[serde(rename_all = "camelCase")]
3743pub struct ToolExecutionCompleteContentResourceLink {
3744 /// Human-readable description of the resource
3745 #[serde(skip_serializing_if = "Option::is_none")]
3746 pub description: Option<String>,
3747 /// Icons associated with this resource
3748 #[serde(skip_serializing_if = "Option::is_none")]
3749 pub icons: Option<Vec<ToolExecutionCompleteContentResourceLinkIcon>>,
3750 /// MIME type of the resource content
3751 #[serde(skip_serializing_if = "Option::is_none")]
3752 pub mime_type: Option<String>,
3753 /// Resource name identifier
3754 pub name: String,
3755 /// Size of the resource in bytes
3756 #[serde(skip_serializing_if = "Option::is_none")]
3757 pub size: Option<i64>,
3758 /// Human-readable display title for the resource
3759 #[serde(skip_serializing_if = "Option::is_none")]
3760 pub title: Option<String>,
3761 /// Content block type discriminator
3762 pub r#type: ToolExecutionCompleteContentResourceLinkType,
3763 /// URI identifying the resource
3764 pub uri: String,
3765}
3766
3767/// Embedded text resource contents identified by a URI, with an optional MIME type and a text payload.
3768#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3769#[serde(rename_all = "camelCase")]
3770pub struct EmbeddedTextResourceContents {
3771 /// MIME type of the text content
3772 #[serde(skip_serializing_if = "Option::is_none")]
3773 pub mime_type: Option<String>,
3774 /// Text content of the resource
3775 pub text: String,
3776 /// URI identifying the resource
3777 pub uri: String,
3778}
3779
3780/// Embedded binary resource contents identified by a URI, with an optional MIME type and a base64-encoded blob.
3781#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3782#[serde(rename_all = "camelCase")]
3783pub struct EmbeddedBlobResourceContents {
3784 /// Base64-encoded binary content of the resource
3785 pub blob: String,
3786 /// MIME type of the blob content
3787 #[serde(skip_serializing_if = "Option::is_none")]
3788 pub mime_type: Option<String>,
3789 /// URI identifying the resource
3790 pub uri: String,
3791}
3792
3793/// Embedded resource content block with inline text or binary data
3794#[derive(Debug, Clone, Serialize, Deserialize)]
3795#[serde(rename_all = "camelCase")]
3796pub struct ToolExecutionCompleteContentResource {
3797 /// The embedded resource contents, either text or base64-encoded binary
3798 pub resource: ToolExecutionCompleteContentResourceDetails,
3799 /// Content block type discriminator
3800 pub r#type: ToolExecutionCompleteContentResourceType,
3801}
3802
3803/// CSP domain allowlists for an MCP Apps UI resource, including connect, resource, frame, and base URI domains.
3804#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3805#[serde(rename_all = "camelCase")]
3806pub struct ToolExecutionCompleteUIResourceMetaUICsp {
3807 /// Domains the UI resource may use as document base URIs.
3808 #[serde(skip_serializing_if = "Option::is_none")]
3809 pub base_uri_domains: Option<Vec<String>>,
3810 /// Domains the UI resource may connect to.
3811 #[serde(skip_serializing_if = "Option::is_none")]
3812 pub connect_domains: Option<Vec<String>>,
3813 /// Domains the UI resource may embed as nested frames.
3814 #[serde(skip_serializing_if = "Option::is_none")]
3815 pub frame_domains: Option<Vec<String>>,
3816 /// Domains from which the UI resource may load scripts, styles, images, and other resources.
3817 #[serde(skip_serializing_if = "Option::is_none")]
3818 pub resource_domains: Option<Vec<String>>,
3819}
3820
3821/// Marker object for camera permission on an MCP Apps UI resource.
3822#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3823#[serde(rename_all = "camelCase")]
3824pub struct ToolExecutionCompleteUIResourceMetaUIPermissionsCamera {}
3825
3826/// Marker object for clipboard-write permission on an MCP Apps UI resource.
3827#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3828#[serde(rename_all = "camelCase")]
3829pub struct ToolExecutionCompleteUIResourceMetaUIPermissionsClipboardWrite {}
3830
3831/// Marker object for geolocation permission on an MCP Apps UI resource.
3832#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3833#[serde(rename_all = "camelCase")]
3834pub struct ToolExecutionCompleteUIResourceMetaUIPermissionsGeolocation {}
3835
3836/// Marker object for microphone permission on an MCP Apps UI resource.
3837#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3838#[serde(rename_all = "camelCase")]
3839pub struct ToolExecutionCompleteUIResourceMetaUIPermissionsMicrophone {}
3840
3841/// Browser permission metadata for an MCP Apps UI resource, including camera, microphone, geolocation, and clipboard-write.
3842#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3843#[serde(rename_all = "camelCase")]
3844pub struct ToolExecutionCompleteUIResourceMetaUIPermissions {
3845 /// Marker object for camera permission on an MCP Apps UI resource.
3846 #[serde(skip_serializing_if = "Option::is_none")]
3847 pub camera: Option<ToolExecutionCompleteUIResourceMetaUIPermissionsCamera>,
3848 /// Marker object for clipboard-write permission on an MCP Apps UI resource.
3849 #[serde(skip_serializing_if = "Option::is_none")]
3850 pub clipboard_write: Option<ToolExecutionCompleteUIResourceMetaUIPermissionsClipboardWrite>,
3851 /// Marker object for geolocation permission on an MCP Apps UI resource.
3852 #[serde(skip_serializing_if = "Option::is_none")]
3853 pub geolocation: Option<ToolExecutionCompleteUIResourceMetaUIPermissionsGeolocation>,
3854 /// Marker object for microphone permission on an MCP Apps UI resource.
3855 #[serde(skip_serializing_if = "Option::is_none")]
3856 pub microphone: Option<ToolExecutionCompleteUIResourceMetaUIPermissionsMicrophone>,
3857}
3858
3859/// MCP Apps UI resource metadata for a completed tool result, including CSP, permissions, domain, and border preference.
3860#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3861#[serde(rename_all = "camelCase")]
3862pub struct ToolExecutionCompleteUIResourceMetaUI {
3863 /// CSP domain allowlists for an MCP Apps UI resource, including connect, resource, frame, and base URI domains.
3864 #[serde(skip_serializing_if = "Option::is_none")]
3865 pub csp: Option<ToolExecutionCompleteUIResourceMetaUICsp>,
3866 /// Optional dedicated origin for the rendered MCP Apps UI resource.
3867 #[serde(skip_serializing_if = "Option::is_none")]
3868 pub domain: Option<String>,
3869 /// Browser permission metadata for an MCP Apps UI resource, including camera, microphone, geolocation, and clipboard-write.
3870 #[serde(skip_serializing_if = "Option::is_none")]
3871 pub permissions: Option<ToolExecutionCompleteUIResourceMetaUIPermissions>,
3872 /// Whether the host should render a border around the MCP Apps UI resource.
3873 #[serde(skip_serializing_if = "Option::is_none")]
3874 pub prefers_border: Option<bool>,
3875}
3876
3877/// Resource-level UI metadata (CSP, permissions, visual preferences)
3878#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3879#[serde(rename_all = "camelCase")]
3880pub struct ToolExecutionCompleteUIResourceMeta {
3881 /// MCP Apps UI resource metadata for a completed tool result, including CSP, permissions, domain, and border preference.
3882 #[serde(skip_serializing_if = "Option::is_none")]
3883 pub ui: Option<ToolExecutionCompleteUIResourceMetaUI>,
3884}
3885
3886/// MCP Apps UI resource content for rendering in a sandboxed iframe
3887#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3888#[serde(rename_all = "camelCase")]
3889pub struct ToolExecutionCompleteUIResource {
3890 /// Resource-level UI metadata (CSP, permissions, visual preferences)
3891 #[serde(rename = "_meta", skip_serializing_if = "Option::is_none")]
3892 pub meta: Option<ToolExecutionCompleteUIResourceMeta>,
3893 /// Base64-encoded HTML content
3894 #[serde(skip_serializing_if = "Option::is_none")]
3895 pub blob: Option<String>,
3896 /// MIME type of the content
3897 pub mime_type: String,
3898 /// HTML content as a string
3899 #[serde(skip_serializing_if = "Option::is_none")]
3900 pub text: Option<String>,
3901 /// The ui:// URI of the resource
3902 pub uri: String,
3903}
3904
3905/// Tool execution result on success
3906#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3907#[serde(rename_all = "camelCase")]
3908pub struct ToolExecutionCompleteResult {
3909 /// Model-facing binary results (base64 inline or size-omitted markers) sent to the LLM for this tool call
3910 ///
3911 /// <div class="warning">
3912 ///
3913 /// **Experimental.** This type is part of an experimental wire-protocol surface
3914 /// and may change or be removed in future SDK or CLI releases.
3915 ///
3916 /// </div>
3917 #[serde(skip_serializing_if = "Option::is_none")]
3918 pub binary_results_for_llm: Option<Vec<PersistedBinaryResult>>,
3919 /// Provider-neutral source material this tool makes available to the model as citable content. Persisted so it survives session resume. Experimental.
3920 ///
3921 /// <div class="warning">
3922 ///
3923 /// **Experimental.** This type is part of an experimental wire-protocol surface
3924 /// and may change or be removed in future SDK or CLI releases.
3925 ///
3926 /// </div>
3927 #[serde(skip_serializing_if = "Option::is_none")]
3928 pub citable_sources: Option<Vec<CitableSource>>,
3929 /// Concise tool result text sent to the LLM for chat completion, potentially truncated for token efficiency
3930 pub content: String,
3931 /// Structured content blocks (text, images, audio, resources) returned by the tool in their native format
3932 #[serde(skip_serializing_if = "Option::is_none")]
3933 pub contents: Option<Vec<ToolExecutionCompleteContent>>,
3934 /// Full detailed tool result for UI/timeline display, preserving complete content such as diffs. Falls back to content when absent.
3935 #[serde(skip_serializing_if = "Option::is_none")]
3936 pub detailed_content: Option<String>,
3937 /// FIDES IFC label projected from tool ingress metadata (MCP `CallToolResult._meta` or synthesized built-in ingress labels) — persisted as `{ ifc: ... }` (only the `ifc` key, not the whole `_meta`). Persisted so the FIDES IFC label survives session resume: the engine rehydrates accumulated taint by replaying these on load. Populated for ingress sources when FIDES IFC is on. Experimental.
3938 ///
3939 /// <div class="warning">
3940 ///
3941 /// **Experimental.** This type is part of an experimental wire-protocol surface
3942 /// and may change or be removed in future SDK or CLI releases.
3943 ///
3944 /// </div>
3945 #[serde(skip_serializing_if = "Option::is_none")]
3946 pub mcp_meta: Option<serde_json::Value>,
3947 /// Structured content (arbitrary JSON) returned verbatim by the MCP tool
3948 #[serde(skip_serializing_if = "Option::is_none")]
3949 pub structured_content: Option<serde_json::Value>,
3950 /// MCP Apps UI resource content for rendering in a sandboxed iframe
3951 #[serde(skip_serializing_if = "Option::is_none")]
3952 pub ui_resource: Option<ToolExecutionCompleteUIResource>,
3953}
3954
3955/// MCP Apps tool `_meta.ui` resource URI and visibility captured on `tool.execution_complete`.
3956#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3957#[serde(rename_all = "camelCase")]
3958pub struct ToolExecutionCompleteToolDescriptionMetaUI {
3959 /// URI of the UI resource
3960 #[serde(skip_serializing_if = "Option::is_none")]
3961 pub resource_uri: Option<String>,
3962 /// Who can access this tool
3963 #[serde(skip_serializing_if = "Option::is_none")]
3964 pub visibility: Option<Vec<ToolExecutionCompleteToolDescriptionMetaUIVisibility>>,
3965}
3966
3967/// MCP Apps metadata for UI resource association
3968#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3969#[serde(rename_all = "camelCase")]
3970pub struct ToolExecutionCompleteToolDescriptionMeta {
3971 /// MCP Apps tool `_meta.ui` resource URI and visibility captured on `tool.execution_complete`.
3972 #[serde(skip_serializing_if = "Option::is_none")]
3973 pub ui: Option<ToolExecutionCompleteToolDescriptionMetaUI>,
3974}
3975
3976/// Tool definition metadata, present for MCP tools with MCP Apps support
3977#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3978#[serde(rename_all = "camelCase")]
3979pub struct ToolExecutionCompleteToolDescription {
3980 /// MCP Apps metadata for UI resource association
3981 #[serde(rename = "_meta", skip_serializing_if = "Option::is_none")]
3982 pub meta: Option<ToolExecutionCompleteToolDescriptionMeta>,
3983 /// Tool description
3984 #[serde(skip_serializing_if = "Option::is_none")]
3985 pub description: Option<String>,
3986 /// Tool name
3987 pub name: String,
3988}
3989
3990/// Session event "tool.execution_complete". Tool execution completion results including success status, detailed output, and error information
3991#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3992#[serde(rename_all = "camelCase")]
3993pub struct ToolExecutionCompleteData {
3994 /// Error details when the tool execution failed
3995 #[serde(skip_serializing_if = "Option::is_none")]
3996 pub error: Option<ToolExecutionCompleteError>,
3997 /// Experimental HydraFusion attribution for this tool completion.
3998 ///
3999 /// <div class="warning">
4000 ///
4001 /// **Experimental.** This type is part of an experimental wire-protocol surface
4002 /// and may change or be removed in future SDK or CLI releases.
4003 ///
4004 /// </div>
4005 #[serde(skip_serializing_if = "Option::is_none")]
4006 pub fusion: Option<FusionAttribution>,
4007 /// CAPI interaction ID for correlating this tool execution with upstream telemetry
4008 #[serde(skip_serializing_if = "Option::is_none")]
4009 pub interaction_id: Option<String>,
4010 /// Whether this tool call was explicitly requested by the user rather than the assistant
4011 #[serde(skip_serializing_if = "Option::is_none")]
4012 pub is_user_requested: Option<bool>,
4013 /// FIDES IFC label projected from tool ingress metadata (MCP `CallToolResult._meta` or synthesized built-in ingress labels). Persisted as `{ ifc: ... }` so the label survives session resume, including model-visible failure results. Experimental.
4014 ///
4015 /// <div class="warning">
4016 ///
4017 /// **Experimental.** This type is part of an experimental wire-protocol surface
4018 /// and may change or be removed in future SDK or CLI releases.
4019 ///
4020 /// </div>
4021 #[serde(skip_serializing_if = "Option::is_none")]
4022 pub mcp_meta: Option<serde_json::Value>,
4023 /// Model identifier that generated this tool call
4024 #[serde(skip_serializing_if = "Option::is_none")]
4025 pub model: Option<String>,
4026 /// Tool call ID of the parent tool invocation when this event originates from a sub-agent
4027 #[doc(hidden)]
4028 #[deprecated]
4029 #[serde(skip_serializing_if = "Option::is_none")]
4030 pub parent_tool_call_id: Option<String>,
4031 /// Tool execution result on success
4032 #[serde(skip_serializing_if = "Option::is_none")]
4033 pub result: Option<ToolExecutionCompleteResult>,
4034 /// Per-request treatment/eligibility signal returned by the Copilot API in the `X-GitHub-Copilot-Request-TE` response header for the associated model call; `false` when the header was absent or unparseable.
4035 #[serde(skip_serializing_if = "Option::is_none")]
4036 pub rte: Option<bool>,
4037 /// Whether this tool execution ran inside a sandbox container
4038 #[serde(skip_serializing_if = "Option::is_none")]
4039 pub sandboxed: Option<bool>,
4040 /// Whether the tool execution completed successfully
4041 pub success: bool,
4042 /// Unique identifier for the completed tool call
4043 pub tool_call_id: String,
4044 /// Tool definition metadata, present for MCP tools with MCP Apps support
4045 #[serde(skip_serializing_if = "Option::is_none")]
4046 pub tool_description: Option<ToolExecutionCompleteToolDescription>,
4047 /// Tool-specific telemetry data (e.g., CodeQL check counts, grep match counts)
4048 #[serde(skip_serializing_if = "Option::is_none")]
4049 pub tool_telemetry: Option<HashMap<String, serde_json::Value>>,
4050 /// Identifier for the agent loop turn this tool was invoked in, matching the corresponding assistant.turn_start event
4051 #[serde(skip_serializing_if = "Option::is_none")]
4052 pub turn_id: Option<String>,
4053}
4054
4055/// Session event "tool_search.activated". Persisted generic client-side tool activations restored when a session resumes.
4056#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4057#[serde(rename_all = "camelCase")]
4058pub struct ToolSearchActivatedData {
4059 /// Tool-search strategy that activated the definitions.
4060 pub strategy: String,
4061 /// Names of tool definitions activated by this search invocation.
4062 pub tool_names: Vec<String>,
4063}
4064
4065/// Session event "skill.invoked". Skill invocation details including content, allowed tools, and plugin metadata
4066#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4067#[serde(rename_all = "camelCase")]
4068pub struct SkillInvokedData {
4069 /// Tool names that should be auto-approved when this skill is active
4070 #[serde(skip_serializing_if = "Option::is_none")]
4071 pub allowed_tools: Option<Vec<String>>,
4072 /// Full content of the skill file, injected into the conversation for the model
4073 pub content: String,
4074 /// Description of the skill from its SKILL.md frontmatter
4075 #[serde(skip_serializing_if = "Option::is_none")]
4076 pub description: Option<String>,
4077 /// Whether model invocation is disabled for this skill
4078 #[serde(skip_serializing_if = "Option::is_none")]
4079 pub disable_model_invocation: Option<bool>,
4080 /// Model identifier active when the skill was invoked, when known
4081 #[serde(skip_serializing_if = "Option::is_none")]
4082 pub model: Option<String>,
4083 /// Name of the invoked skill
4084 pub name: String,
4085 /// File path to the SKILL.md definition, or an empty string for an SDK-provided skill without a filesystem identity
4086 pub path: String,
4087 /// Name of the plugin this skill originated from, when applicable
4088 #[serde(skip_serializing_if = "Option::is_none")]
4089 pub plugin_name: Option<String>,
4090 /// Version of the plugin this skill originated from, when applicable
4091 #[serde(skip_serializing_if = "Option::is_none")]
4092 pub plugin_version: Option<String>,
4093 /// 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), remote (org/enterprise skill), and sdk (SDK-provided skill)
4094 #[serde(skip_serializing_if = "Option::is_none")]
4095 pub source: Option<String>,
4096 /// 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)
4097 #[serde(skip_serializing_if = "Option::is_none")]
4098 pub trigger: Option<SkillInvokedTrigger>,
4099}
4100
4101/// Session event "sandbox.decision". Payload of `sandbox.decision`, a bounded governance record of what the process sandbox was configured to do and whether it took effect. Discriminated by `kind`.
4102#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4103#[serde(rename_all = "camelCase")]
4104pub struct SandboxDecisionData {}
4105
4106/// Session event "subagent.started". Sub-agent startup details including parent tool call and agent information
4107#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4108#[serde(rename_all = "camelCase")]
4109pub struct SubagentStartedData {
4110 /// Description of what the sub-agent does
4111 pub agent_description: String,
4112 /// Human-readable display name of the sub-agent
4113 pub agent_display_name: String,
4114 /// Internal name of the sub-agent
4115 pub agent_name: String,
4116 /// Type of the sub-agent selected at spawn time.
4117 #[serde(skip_serializing_if = "Option::is_none")]
4118 pub agent_type: Option<String>,
4119 /// Whether the sub-agent runs synchronously or in the background.
4120 #[serde(skip_serializing_if = "Option::is_none")]
4121 pub execution_mode: Option<String>,
4122 /// Root id of the factory run that spawned this sub-agent, when it was spawned by one.
4123 #[serde(skip_serializing_if = "Option::is_none")]
4124 pub factory_run_id: Option<String>,
4125 /// Model the sub-agent will run with, when known at start.
4126 #[serde(skip_serializing_if = "Option::is_none")]
4127 pub model: Option<String>,
4128 /// Task-registry ID of the spawning sub-agent. Absent when the root session spawned this child.
4129 #[serde(skip_serializing_if = "Option::is_none")]
4130 pub parent_id: Option<String>,
4131 /// Whether this sub-agent can be resumed. Currently always false.
4132 #[serde(skip_serializing_if = "Option::is_none")]
4133 pub resumable: Option<bool>,
4134 /// Tool call ID of the parent tool invocation that spawned this sub-agent
4135 pub tool_call_id: String,
4136}
4137
4138/// Session event "subagent.configured". Resolved runtime configuration for a configured sub-agent
4139#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4140#[serde(rename_all = "camelCase")]
4141pub struct SubagentConfiguredData {
4142 /// Resolved context tier, when configured for the model
4143 #[serde(skip_serializing_if = "Option::is_none")]
4144 pub context_tier: Option<String>,
4145 /// Resolved model the sub-agent will run with
4146 pub model: String,
4147 /// Whether the sub-agent accepts follow-up turns
4148 pub multi_turn: bool,
4149 /// Resolved reasoning effort, when configured for the model
4150 #[serde(skip_serializing_if = "Option::is_none")]
4151 pub reasoning_effort: Option<String>,
4152}
4153
4154/// Session event "subagent.completed". Sub-agent completion details for successful execution
4155#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4156#[serde(rename_all = "camelCase")]
4157pub struct SubagentCompletedData {
4158 /// Human-readable display name of the sub-agent
4159 pub agent_display_name: String,
4160 /// Internal name of the sub-agent
4161 pub agent_name: String,
4162 /// Whether the sub-agent was torn down by cancellation - its own abort, or an ancestor being killed - instead of finishing its work. Cancellation is not a failure, so the run still reports completion; this distinguishes a torn-down sub-agent from one that ran to the end.
4163 #[serde(skip_serializing_if = "Option::is_none")]
4164 pub cancelled: Option<bool>,
4165 /// Whether the first model actually dispatched matched the user's configured preference
4166 #[serde(skip_serializing_if = "Option::is_none")]
4167 pub configured_model_matches_actual: Option<bool>,
4168 /// Concrete model the user configured for this sub-agent via `/subagents`, when present
4169 #[serde(skip_serializing_if = "Option::is_none")]
4170 pub configured_model_preference: Option<String>,
4171 /// Wall-clock duration of the sub-agent execution in milliseconds
4172 #[serde(skip_serializing_if = "Option::is_none")]
4173 pub duration_ms: Option<i64>,
4174 /// Whether the explicit task-call model matched the user's configured preference
4175 #[serde(skip_serializing_if = "Option::is_none")]
4176 pub explicit_model_matches_preference: Option<bool>,
4177 /// Explicit model supplied by the parent agent on the task call, when present
4178 #[serde(skip_serializing_if = "Option::is_none")]
4179 pub explicit_model_override: Option<String>,
4180 /// First model for which the sub-agent started an inference request, when one was dispatched
4181 #[serde(skip_serializing_if = "Option::is_none")]
4182 pub first_dispatched_model: Option<String>,
4183 /// Model used by the sub-agent
4184 #[serde(skip_serializing_if = "Option::is_none")]
4185 pub model: Option<String>,
4186 /// Why an explicit task-call model did not become the effective model
4187 #[serde(skip_serializing_if = "Option::is_none")]
4188 pub model_override_reason: Option<String>,
4189 /// Tool call ID of the parent tool invocation that spawned this sub-agent
4190 pub tool_call_id: String,
4191 /// Total tokens (input + output) consumed by the sub-agent
4192 #[serde(skip_serializing_if = "Option::is_none")]
4193 pub total_tokens: Option<i64>,
4194 /// Total number of tool calls made by the sub-agent
4195 #[serde(skip_serializing_if = "Option::is_none")]
4196 pub total_tool_calls: Option<i64>,
4197}
4198
4199/// Session event "subagent.failed". Sub-agent failure details including error message and agent information
4200#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4201#[serde(rename_all = "camelCase")]
4202pub struct SubagentFailedData {
4203 /// Human-readable display name of the sub-agent
4204 pub agent_display_name: String,
4205 /// Internal name of the sub-agent
4206 pub agent_name: String,
4207 /// Whether the first model actually dispatched matched the user's configured preference
4208 #[serde(skip_serializing_if = "Option::is_none")]
4209 pub configured_model_matches_actual: Option<bool>,
4210 /// Concrete model the user configured for this sub-agent via `/subagents`, when present
4211 #[serde(skip_serializing_if = "Option::is_none")]
4212 pub configured_model_preference: Option<String>,
4213 /// Wall-clock duration of the sub-agent execution in milliseconds
4214 #[serde(skip_serializing_if = "Option::is_none")]
4215 pub duration_ms: Option<i64>,
4216 /// Error message describing why the sub-agent failed
4217 pub error: String,
4218 /// Whether the explicit task-call model matched the user's configured preference
4219 #[serde(skip_serializing_if = "Option::is_none")]
4220 pub explicit_model_matches_preference: Option<bool>,
4221 /// Explicit model supplied by the parent agent on the task call, when present
4222 #[serde(skip_serializing_if = "Option::is_none")]
4223 pub explicit_model_override: Option<String>,
4224 /// First model for which the sub-agent started an inference request, when one was dispatched
4225 #[serde(skip_serializing_if = "Option::is_none")]
4226 pub first_dispatched_model: Option<String>,
4227 /// Model selected for the sub-agent, when known
4228 #[serde(skip_serializing_if = "Option::is_none")]
4229 pub model: Option<String>,
4230 /// Why an explicit task-call model did not become the effective model
4231 #[serde(skip_serializing_if = "Option::is_none")]
4232 pub model_override_reason: Option<String>,
4233 /// Tool call ID of the parent tool invocation that spawned this sub-agent
4234 pub tool_call_id: String,
4235 /// Total tokens (input + output) consumed before the sub-agent failed
4236 #[serde(skip_serializing_if = "Option::is_none")]
4237 pub total_tokens: Option<i64>,
4238 /// Total number of tool calls made before the sub-agent failed
4239 #[serde(skip_serializing_if = "Option::is_none")]
4240 pub total_tool_calls: Option<i64>,
4241}
4242
4243/// Session event "subagent.selected". Custom agent selection details including name and available tools
4244#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4245#[serde(rename_all = "camelCase")]
4246pub struct SubagentSelectedData {
4247 /// Human-readable display name of the selected custom agent
4248 pub agent_display_name: String,
4249 /// Internal name of the selected custom agent
4250 pub agent_name: String,
4251 /// List of tool names available to this agent, or null for all tools
4252 pub tools: Option<Vec<String>>,
4253}
4254
4255/// Session event "subagent.deselected". Empty payload; the event signals that the custom agent was deselected, returning to the default agent
4256#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4257#[serde(rename_all = "camelCase")]
4258pub struct SubagentDeselectedData {}
4259
4260/// Session event "hook.start". Hook invocation start details including type and input data
4261#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4262#[serde(rename_all = "camelCase")]
4263pub struct HookStartData {
4264 /// Unique identifier for this hook invocation
4265 pub hook_invocation_id: String,
4266 /// Type of hook being invoked (e.g., "preToolUse", "postToolUse", "sessionStart")
4267 pub hook_type: String,
4268 /// Input data passed to the hook. For postToolUse hooks the retained copy served by session.eventLog.read (and by a resumed session) elides the tool result's inline `contents`/`uiResource` and replaces an over-long `textResultForLlm` with a `[copilot:elided ...]` marker, to keep a multi-megabyte payload out of the durable event log; the live subscription stream still delivers the full value. Read the adjacent tool.execution_complete event for the tool result itself.
4269 #[serde(skip_serializing_if = "Option::is_none")]
4270 pub input: Option<serde_json::Value>,
4271 /// Tool call ID of the parent tool invocation when this event originates from a sub-agent
4272 #[serde(skip_serializing_if = "Option::is_none")]
4273 pub parent_tool_call_id: Option<String>,
4274}
4275
4276/// Error details when the hook failed
4277#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4278#[serde(rename_all = "camelCase")]
4279pub struct HookEndError {
4280 /// Human-readable error message
4281 pub message: String,
4282 /// Source label of the hook that errored (e.g. the plugin it was loaded from), when known
4283 #[serde(skip_serializing_if = "Option::is_none")]
4284 pub source: Option<String>,
4285 /// Error stack trace, when available
4286 #[serde(skip_serializing_if = "Option::is_none")]
4287 pub stack: Option<String>,
4288}
4289
4290/// Session event "hook.end". Hook invocation completion details including output, success status, and error information
4291#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4292#[serde(rename_all = "camelCase")]
4293pub struct HookEndData {
4294 /// Error details when the hook failed
4295 #[serde(skip_serializing_if = "Option::is_none")]
4296 pub error: Option<HookEndError>,
4297 /// Identifier matching the corresponding hook.start event
4298 pub hook_invocation_id: String,
4299 /// Type of hook that was invoked (e.g., "preToolUse", "postToolUse", "sessionStart")
4300 pub hook_type: String,
4301 /// Output data produced by the hook
4302 #[serde(skip_serializing_if = "Option::is_none")]
4303 pub output: Option<serde_json::Value>,
4304 /// Tool call ID of the parent tool invocation when this event originates from a sub-agent
4305 #[serde(skip_serializing_if = "Option::is_none")]
4306 pub parent_tool_call_id: Option<String>,
4307 /// Whether the hook completed successfully
4308 pub success: bool,
4309}
4310
4311/// Session event "hook.progress". Ephemeral progress update from a running hook process
4312#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4313#[serde(rename_all = "camelCase")]
4314pub struct HookProgressData {
4315 /// Human-readable progress message from the hook process
4316 pub message: String,
4317 /// When true, this status message replaces the previous temporary one instead of accumulating
4318 #[serde(skip_serializing_if = "Option::is_none")]
4319 pub temporary: Option<bool>,
4320}
4321
4322/// Session event "session.binary_asset". Canonical bytes for a content-addressed binary asset shared by reference across events
4323#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4324#[serde(rename_all = "camelCase")]
4325pub struct SessionBinaryAssetData {
4326 /// Content-addressed id for this binary asset (e.g. "sha256:...").
4327 pub asset_id: String,
4328 /// Decoded byte length of the binary asset
4329 pub byte_length: i64,
4330 /// Base64-encoded binary data
4331 pub data: String,
4332 /// Human-readable description of the binary data
4333 #[serde(skip_serializing_if = "Option::is_none")]
4334 pub description: Option<String>,
4335 /// Optional metadata from the producing tool.
4336 #[serde(skip_serializing_if = "Option::is_none")]
4337 pub metadata: Option<HashMap<String, serde_json::Value>>,
4338 /// MIME type of the binary asset
4339 pub mime_type: String,
4340 /// Binary asset type discriminator. Use "image" for images and "resource" otherwise.
4341 pub r#type: BinaryAssetType,
4342}
4343
4344/// Metadata about the prompt template and its construction
4345#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4346#[serde(rename_all = "camelCase")]
4347pub struct SystemMessageMetadata {
4348 /// Version identifier of the prompt template used
4349 #[serde(skip_serializing_if = "Option::is_none")]
4350 pub prompt_version: Option<String>,
4351 /// Template variables used when constructing the prompt
4352 #[serde(skip_serializing_if = "Option::is_none")]
4353 pub variables: Option<HashMap<String, serde_json::Value>>,
4354}
4355
4356/// Session event "system.message". System/developer instruction content with role and optional template metadata
4357#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4358#[serde(rename_all = "camelCase")]
4359pub struct SystemMessageData {
4360 /// The system or developer prompt text sent as model input
4361 pub content: String,
4362 /// Logical interaction identifier for the model run receiving this prompt
4363 #[serde(skip_serializing_if = "Option::is_none")]
4364 pub interaction_id: Option<String>,
4365 /// Metadata about the prompt template and its construction
4366 #[serde(skip_serializing_if = "Option::is_none")]
4367 pub metadata: Option<SystemMessageMetadata>,
4368 /// Optional name identifier for the message source
4369 #[serde(skip_serializing_if = "Option::is_none")]
4370 pub name: Option<String>,
4371 /// Message role: "system" for system prompts, "developer" for developer-injected instructions
4372 pub role: SystemMessageRole,
4373}
4374
4375/// Session event "system.notification". System-generated notification for runtime events like background task completion
4376#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4377#[serde(rename_all = "camelCase")]
4378pub struct SystemNotificationData {
4379 /// The notification text, typically wrapped in <system_notification> XML tags
4380 pub content: String,
4381 /// Structured metadata identifying what triggered this notification
4382 pub kind: serde_json::Value,
4383}
4384
4385/// A parsed command identifier in a shell permission request, including whether it is read-only.
4386#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4387#[serde(rename_all = "camelCase")]
4388pub struct PermissionRequestShellCommand {
4389 /// Command identifier (e.g., executable name)
4390 pub identifier: String,
4391 /// Whether this command is read-only (no side effects)
4392 pub read_only: bool,
4393}
4394
4395/// A parsed shell command segment used for argument-aware managed policy matching.
4396#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4397#[serde(rename_all = "camelCase")]
4398pub struct PermissionRequestShellCommandSegment {
4399 /// Full text of this command segment, including arguments
4400 pub full_command_text: String,
4401 /// Command identifier (e.g., executable name)
4402 pub identifier: String,
4403}
4404
4405/// A URL that may be accessed by a command in a shell permission request.
4406#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4407#[serde(rename_all = "camelCase")]
4408pub struct PermissionRequestShellPossibleUrl {
4409 /// URL that may be accessed by the command
4410 pub url: String,
4411}
4412
4413/// Shell command permission request
4414#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4415#[serde(rename_all = "camelCase")]
4416pub struct PermissionRequestShell {
4417 /// Whether the UI can offer session-wide approval for this command pattern
4418 pub can_offer_session_approval: bool,
4419 /// Parsed command identifiers found in the command text
4420 pub commands: Vec<PermissionRequestShellCommand>,
4421 /// Parsed command segments, including arguments, used for managed policy matching
4422 #[serde(skip_serializing_if = "Option::is_none")]
4423 pub command_segments: Option<Vec<PermissionRequestShellCommandSegment>>,
4424 /// The complete shell command text to be executed
4425 pub full_command_text: String,
4426 /// Whether the command includes a file write redirection (e.g., > or >>)
4427 pub has_write_file_redirection: bool,
4428 /// Human-readable description of what the command intends to do
4429 pub intention: String,
4430 /// Permission kind discriminator
4431 pub kind: PermissionRequestShellKind,
4432 /// Whether managed policy requires a human response and forbids host auto-approval
4433 #[serde(skip_serializing_if = "Option::is_none")]
4434 pub managed_approval_required: Option<bool>,
4435 /// File paths that may be read or written by the command
4436 pub possible_paths: Vec<String>,
4437 /// URLs that may be accessed by the command
4438 pub possible_urls: Vec<PermissionRequestShellPossibleUrl>,
4439 /// True when the tool is asking to run this command outside the sandbox, either because the command detaches and cannot be sandboxed at all, or because a sandboxed run looked blocked (host opted in via sandbox.allowBypass). The model cannot ask for this; only the tool raises it. This is a request, not a grant: the command runs unsandboxed only if the user approves this permission request. Hosts should highlight the elevated risk in the approval UI.
4440 #[serde(skip_serializing_if = "Option::is_none")]
4441 pub request_sandbox_bypass: Option<bool>,
4442 /// What the tool tells the user about the bypass on offer: which policy rule blocked the call, or why it cannot be sandboxed. Only meaningful when requestSandboxBypass is true.
4443 #[serde(skip_serializing_if = "Option::is_none")]
4444 pub request_sandbox_bypass_reason: Option<String>,
4445 /// Tool call ID that triggered this permission request
4446 #[serde(skip_serializing_if = "Option::is_none")]
4447 pub tool_call_id: Option<String>,
4448 /// Optional warning message about risks of running this command
4449 #[serde(skip_serializing_if = "Option::is_none")]
4450 pub warning: Option<String>,
4451}
4452
4453/// File write permission request
4454#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4455#[serde(rename_all = "camelCase")]
4456pub struct PermissionRequestWrite {
4457 /// Whether the UI can offer session-wide approval for file write operations
4458 pub can_offer_session_approval: bool,
4459 /// Unified diff showing the proposed changes
4460 pub diff: String,
4461 /// Path of the file being written to
4462 pub file_name: String,
4463 /// Human-readable description of the intended file change
4464 pub intention: String,
4465 /// Permission kind discriminator
4466 pub kind: PermissionRequestWriteKind,
4467 /// Whether managed policy requires a human response and forbids host auto-approval
4468 #[serde(skip_serializing_if = "Option::is_none")]
4469 pub managed_approval_required: Option<bool>,
4470 /// Complete new file contents for newly created files
4471 #[serde(skip_serializing_if = "Option::is_none")]
4472 pub new_file_contents: Option<String>,
4473 /// True when a built-in file tool (apply_patch / str_replace_editor) asked to write a path the sandbox filesystem policy would block, and the host opted in via sandbox.allowBypass. This is a request, not a grant: the write happens unsandboxed only if the user approves this permission request. Hosts should highlight the elevated risk in the approval UI.
4474 #[serde(skip_serializing_if = "Option::is_none")]
4475 pub request_sandbox_bypass: Option<bool>,
4476 /// Justification for the sandbox-bypass request. Only meaningful when requestSandboxBypass is true.
4477 #[serde(skip_serializing_if = "Option::is_none")]
4478 pub request_sandbox_bypass_reason: Option<String>,
4479 /// Tool call ID that triggered this permission request
4480 #[serde(skip_serializing_if = "Option::is_none")]
4481 pub tool_call_id: Option<String>,
4482}
4483
4484/// File or directory read permission request
4485#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4486#[serde(rename_all = "camelCase")]
4487pub struct PermissionRequestRead {
4488 /// Human-readable description of why the file is being read
4489 pub intention: String,
4490 /// Permission kind discriminator
4491 pub kind: PermissionRequestReadKind,
4492 /// Whether managed policy requires a human response and forbids host auto-approval
4493 #[serde(skip_serializing_if = "Option::is_none")]
4494 pub managed_approval_required: Option<bool>,
4495 /// Path of the file or directory being read
4496 pub path: String,
4497 /// True when the tool is asking to re-run this search outside the sandbox, after a sandboxed run looked blocked (host opted in via sandbox.allowBypass). The model cannot ask for this; only the tool raises it. This is a request, not a grant: the search runs unsandboxed only if the user approves this permission request. Hosts should highlight the elevated risk in the approval UI.
4498 #[serde(skip_serializing_if = "Option::is_none")]
4499 pub request_sandbox_bypass: Option<bool>,
4500 /// What the tool tells the user about the bypass on offer: which policy rule blocked the call, or why it cannot be sandboxed. Only meaningful when requestSandboxBypass is true.
4501 #[serde(skip_serializing_if = "Option::is_none")]
4502 pub request_sandbox_bypass_reason: Option<String>,
4503 /// Tool call ID that triggered this permission request
4504 #[serde(skip_serializing_if = "Option::is_none")]
4505 pub tool_call_id: Option<String>,
4506}
4507
4508/// MCP tool invocation permission request
4509#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4510#[serde(rename_all = "camelCase")]
4511pub struct PermissionRequestMcp {
4512 /// Arguments to pass to the MCP tool
4513 #[serde(skip_serializing_if = "Option::is_none")]
4514 pub args: Option<serde_json::Value>,
4515 /// Permission kind discriminator
4516 pub kind: PermissionRequestMcpKind,
4517 /// When true, managed policy requires an explicit user decision and automatic approval must be bypassed.
4518 #[serde(skip_serializing_if = "Option::is_none")]
4519 pub managed_approval_required: Option<bool>,
4520 /// Advisory runtime permission recommendation. The SDK host remains responsible for deciding the request and may reject it.
4521 ///
4522 /// <div class="warning">
4523 ///
4524 /// **Experimental.** This type is part of an experimental wire-protocol surface
4525 /// and may change or be removed in future SDK or CLI releases.
4526 ///
4527 /// </div>
4528 #[serde(skip_serializing_if = "Option::is_none")]
4529 pub permission_recommendation: Option<PermissionRecommendation>,
4530 /// Whether this MCP tool is read-only (no side effects)
4531 pub read_only: bool,
4532 /// Name of the MCP server providing the tool
4533 pub server_name: String,
4534 /// Tool call ID that triggered this permission request
4535 #[serde(skip_serializing_if = "Option::is_none")]
4536 pub tool_call_id: Option<String>,
4537 /// Internal name of the MCP tool
4538 pub tool_name: String,
4539 /// Human-readable title of the MCP tool
4540 pub tool_title: String,
4541}
4542
4543/// URL access permission request
4544#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4545#[serde(rename_all = "camelCase")]
4546pub struct PermissionRequestUrl {
4547 /// Human-readable description of why the URL is being accessed
4548 pub intention: String,
4549 /// Permission kind discriminator
4550 pub kind: PermissionRequestUrlKind,
4551 /// Whether managed policy requires a human response and forbids host auto-approval
4552 #[serde(skip_serializing_if = "Option::is_none")]
4553 pub managed_approval_required: Option<bool>,
4554 /// Immediately preceding URL when this request is for a redirect target
4555 #[serde(skip_serializing_if = "Option::is_none")]
4556 pub redirected_from: Option<String>,
4557 /// True when the tool is asking to run this URL fetch outside the sandbox, after the network policy denied the approved URL or the sandbox proxy could not reach it (host opted in via sandbox.allowBypass). The model cannot ask for this; only the tool raises it. This is a request, not a grant: the fetch runs only if the user approves this permission request. Hosts should highlight the elevated risk in the approval UI.
4558 #[serde(skip_serializing_if = "Option::is_none")]
4559 pub request_sandbox_bypass: Option<bool>,
4560 /// What the tool tells the user about the bypass on offer: which policy rule blocked the call, or why it cannot be sandboxed. Only meaningful when requestSandboxBypass is true.
4561 #[serde(skip_serializing_if = "Option::is_none")]
4562 pub request_sandbox_bypass_reason: Option<String>,
4563 /// Tool call ID that triggered this permission request
4564 #[serde(skip_serializing_if = "Option::is_none")]
4565 pub tool_call_id: Option<String>,
4566 /// URL to be fetched
4567 pub url: String,
4568}
4569
4570/// Assisted-approval judge information attached to a permission request. Present only in assisted mode; its absence means the judge did not evaluate the request. The `recommendation` conveys the judge's disposition for this request.
4571///
4572/// <div class="warning">
4573///
4574/// **Experimental.** This type is part of an experimental wire-protocol surface
4575/// and may change or be removed in future SDK or CLI releases.
4576///
4577/// </div>
4578#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4579#[serde(rename_all = "camelCase")]
4580pub struct PermissionAssistedApproval {
4581 /// Classified cause of an `error` recommendation. Absent for every other recommendation.
4582 #[serde(skip_serializing_if = "Option::is_none")]
4583 pub failure_reason: Option<AssistedApprovalJudgeFailureReason>,
4584 /// Model id that produced the recommendation, when the judge was consulted and reported one. Absent for `excluded` (the judge was not consulted) and for failures that occurred before a model was selected.
4585 #[serde(skip_serializing_if = "Option::is_none")]
4586 pub model: Option<String>,
4587 /// Human-readable reason for the judge's recommendation, when available.
4588 #[serde(skip_serializing_if = "Option::is_none")]
4589 pub reason: Option<String>,
4590 /// The assisted-approval safety judge's outcome for this request.
4591 pub recommendation: AssistedApprovalRecommendation,
4592}
4593
4594/// Memory operation permission request
4595#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4596#[serde(rename_all = "camelCase")]
4597pub struct PermissionRequestMemory {
4598 /// Whether this is a store or vote memory operation
4599 #[serde(skip_serializing_if = "Option::is_none")]
4600 pub action: Option<PermissionRequestMemoryAction>,
4601 /// Assisted-approval judge information for this request; present only in assisted mode.
4602 ///
4603 /// <div class="warning">
4604 ///
4605 /// **Experimental.** This type is part of an experimental wire-protocol surface
4606 /// and may change or be removed in future SDK or CLI releases.
4607 ///
4608 /// </div>
4609 #[serde(skip_serializing_if = "Option::is_none")]
4610 pub assisted_approval: Option<PermissionAssistedApproval>,
4611 /// Source references for the stored fact (store only)
4612 #[serde(skip_serializing_if = "Option::is_none")]
4613 pub citations: Option<String>,
4614 /// Vote direction (vote only)
4615 #[serde(skip_serializing_if = "Option::is_none")]
4616 pub direction: Option<PermissionRequestMemoryDirection>,
4617 /// The fact being stored or voted on
4618 pub fact: String,
4619 /// Permission kind discriminator
4620 pub kind: PermissionRequestMemoryKind,
4621 /// When true, managed policy requires an explicit user decision and automatic approval must be bypassed.
4622 #[serde(skip_serializing_if = "Option::is_none")]
4623 pub managed_approval_required: Option<bool>,
4624 /// Reason for the vote (vote only)
4625 #[serde(skip_serializing_if = "Option::is_none")]
4626 pub reason: Option<String>,
4627 /// Repository name with owner associated with the stored memory (store only)
4628 #[serde(skip_serializing_if = "Option::is_none")]
4629 pub repo_nwo: Option<String>,
4630 /// Scope of the stored memory (store only)
4631 #[serde(skip_serializing_if = "Option::is_none")]
4632 pub scope: Option<PermissionRequestMemoryScope>,
4633 /// Topic or subject of the memory (store only)
4634 #[serde(skip_serializing_if = "Option::is_none")]
4635 pub subject: Option<String>,
4636 /// Tool call ID that triggered this permission request
4637 #[serde(skip_serializing_if = "Option::is_none")]
4638 pub tool_call_id: Option<String>,
4639}
4640
4641/// Custom tool invocation permission request
4642#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4643#[serde(rename_all = "camelCase")]
4644pub struct PermissionRequestCustomTool {
4645 /// Arguments to pass to the custom tool
4646 #[serde(skip_serializing_if = "Option::is_none")]
4647 pub args: Option<serde_json::Value>,
4648 /// Permission kind discriminator
4649 pub kind: PermissionRequestCustomToolKind,
4650 /// When true, managed policy requires an explicit user decision and automatic approval must be bypassed.
4651 #[serde(skip_serializing_if = "Option::is_none")]
4652 pub managed_approval_required: Option<bool>,
4653 /// Whether the tool declared that permission may be skipped unless a deny rule matches
4654 #[serde(skip_serializing_if = "Option::is_none")]
4655 pub skip_permission: Option<bool>,
4656 /// Tool call ID that triggered this permission request
4657 #[serde(skip_serializing_if = "Option::is_none")]
4658 pub tool_call_id: Option<String>,
4659 /// Description of what the custom tool does
4660 pub tool_description: String,
4661 /// Name of the custom tool
4662 pub tool_name: String,
4663}
4664
4665/// Hook confirmation permission request
4666#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4667#[serde(rename_all = "camelCase")]
4668pub struct PermissionRequestHook {
4669 /// Optional message from the hook explaining why confirmation is needed
4670 #[serde(skip_serializing_if = "Option::is_none")]
4671 pub hook_message: Option<String>,
4672 /// Permission kind discriminator
4673 pub kind: PermissionRequestHookKind,
4674 /// When true, managed policy requires an explicit user decision and automatic approval must be bypassed.
4675 #[serde(skip_serializing_if = "Option::is_none")]
4676 pub managed_approval_required: Option<bool>,
4677 /// Arguments of the tool call being gated
4678 #[serde(skip_serializing_if = "Option::is_none")]
4679 pub tool_args: Option<serde_json::Value>,
4680 /// Tool call ID that triggered this permission request
4681 #[serde(skip_serializing_if = "Option::is_none")]
4682 pub tool_call_id: Option<String>,
4683 /// Name of the tool the hook is gating
4684 pub tool_name: String,
4685}
4686
4687/// Extension management permission request
4688#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4689#[serde(rename_all = "camelCase")]
4690pub struct PermissionRequestExtensionManagement {
4691 /// Name of the extension being managed
4692 #[serde(skip_serializing_if = "Option::is_none")]
4693 pub extension_name: Option<String>,
4694 /// Permission kind discriminator
4695 pub kind: PermissionRequestExtensionManagementKind,
4696 /// When true, managed policy requires an explicit user decision and automatic approval must be bypassed.
4697 #[serde(skip_serializing_if = "Option::is_none")]
4698 pub managed_approval_required: Option<bool>,
4699 /// The extension management operation (scaffold, reload)
4700 pub operation: String,
4701 /// Tool call ID that triggered this permission request
4702 #[serde(skip_serializing_if = "Option::is_none")]
4703 pub tool_call_id: Option<String>,
4704}
4705
4706/// A declared phase shown in a factory permission prompt.
4707#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4708#[serde(rename_all = "camelCase")]
4709pub struct FactoryPermissionPhase {
4710 /// Optional phase detail
4711 #[serde(skip_serializing_if = "Option::is_none")]
4712 pub detail: Option<String>,
4713 /// Phase title
4714 pub title: String,
4715}
4716
4717/// Factory run or authoring permission request
4718#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4719#[serde(rename_all = "camelCase")]
4720pub struct PermissionRequestFactory {
4721 /// Canonical key used for scoped factory approvals
4722 pub approval_key: String,
4723 /// Whether this factory is eligible for persistent approval
4724 pub can_persist_approval: bool,
4725 /// Factory-declared AI-credit limit before any run/resume caller override is applied.
4726 #[serde(skip_serializing_if = "Option::is_none")]
4727 pub declared_max_ai_credits: Option<f64>,
4728 /// Factory-declared concurrent-subagent limit before any run/resume caller override is applied.
4729 #[serde(skip_serializing_if = "Option::is_none")]
4730 pub declared_max_concurrent_subagents: Option<i64>,
4731 /// Factory-declared total-subagent limit before any run/resume caller override is applied.
4732 #[serde(skip_serializing_if = "Option::is_none")]
4733 pub declared_max_total_subagents: Option<i64>,
4734 /// Factory-declared active-time limit in seconds before any run/resume caller override is applied.
4735 #[serde(skip_serializing_if = "Option::is_none")]
4736 pub declared_timeout_seconds: Option<f64>,
4737 /// Factory description
4738 pub description: String,
4739 /// Permission kind discriminator
4740 pub kind: PermissionRequestFactoryKind,
4741 /// When true, managed policy requires an explicit user decision and automatic approval must be bypassed.
4742 #[serde(skip_serializing_if = "Option::is_none")]
4743 pub managed_approval_required: Option<bool>,
4744 /// Effective AI-credit limit; omitted means unlimited
4745 #[serde(skip_serializing_if = "Option::is_none")]
4746 pub max_ai_credits: Option<f64>,
4747 /// Effective concurrent-subagent limit; omitted means unlimited
4748 #[serde(skip_serializing_if = "Option::is_none")]
4749 pub max_concurrent_subagents: Option<i64>,
4750 /// Effective total-subagent limit; omitted means unlimited
4751 #[serde(skip_serializing_if = "Option::is_none")]
4752 pub max_total_subagents: Option<i64>,
4753 /// Factory name
4754 pub name: String,
4755 /// Factory operation, either run or author
4756 pub operation: FactoryPermissionOperation,
4757 /// Declared factory phases
4758 pub phases: Vec<FactoryPermissionPhase>,
4759 /// Effective active-time limit in seconds; omitted means unlimited
4760 #[serde(skip_serializing_if = "Option::is_none")]
4761 pub timeout_seconds: Option<f64>,
4762 /// Tool call ID that triggered this permission request
4763 #[serde(skip_serializing_if = "Option::is_none")]
4764 pub tool_call_id: Option<String>,
4765}
4766
4767/// Extension permission access request
4768#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4769#[serde(rename_all = "camelCase")]
4770pub struct PermissionRequestExtensionPermissionAccess {
4771 /// Capabilities the extension is requesting
4772 pub capabilities: Vec<String>,
4773 /// Name of the extension requesting permission access
4774 pub extension_name: String,
4775 /// Permission kind discriminator
4776 pub kind: PermissionRequestExtensionPermissionAccessKind,
4777 /// When true, managed policy requires an explicit user decision and automatic approval must be bypassed.
4778 #[serde(skip_serializing_if = "Option::is_none")]
4779 pub managed_approval_required: Option<bool>,
4780 /// Tool call ID that triggered this permission request
4781 #[serde(skip_serializing_if = "Option::is_none")]
4782 pub tool_call_id: Option<String>,
4783}
4784
4785/// Extension sensitive environment variable access request
4786#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4787#[serde(rename_all = "camelCase")]
4788pub struct PermissionRequestExtensionEnvAccess {
4789 /// Names of the sensitive environment variables the extension is requesting. Values never appear here.
4790 pub environment_variables: Vec<String>,
4791 /// Name of the extension requesting environment variable access
4792 pub extension_name: String,
4793 /// Permission kind discriminator
4794 pub kind: PermissionRequestExtensionEnvAccessKind,
4795 /// When true, managed policy requires an explicit user decision and automatic approval must be bypassed.
4796 #[serde(skip_serializing_if = "Option::is_none")]
4797 pub managed_approval_required: Option<bool>,
4798 /// Tool call ID that triggered this permission request
4799 #[serde(skip_serializing_if = "Option::is_none")]
4800 pub tool_call_id: Option<String>,
4801}
4802
4803/// Shell command permission prompt
4804#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4805#[serde(rename_all = "camelCase")]
4806pub struct PermissionPromptRequestCommands {
4807 /// Assisted-approval judge information for this request; present only in assisted mode.
4808 ///
4809 /// <div class="warning">
4810 ///
4811 /// **Experimental.** This type is part of an experimental wire-protocol surface
4812 /// and may change or be removed in future SDK or CLI releases.
4813 ///
4814 /// </div>
4815 #[serde(skip_serializing_if = "Option::is_none")]
4816 pub assisted_approval: Option<PermissionAssistedApproval>,
4817 /// Whether the UI can offer session-wide approval for this command pattern
4818 pub can_offer_session_approval: bool,
4819 /// Command identifiers covered by this approval prompt
4820 pub command_identifiers: Vec<String>,
4821 /// The complete shell command text to be executed
4822 pub full_command_text: String,
4823 /// Human-readable description of what the command intends to do
4824 pub intention: String,
4825 /// Prompt kind discriminator
4826 pub kind: PermissionPromptRequestCommandsKind,
4827 /// Whether managed policy requires a human response and forbids host auto-approval
4828 #[serde(skip_serializing_if = "Option::is_none")]
4829 pub managed_approval_required: Option<bool>,
4830 /// Tool call ID that triggered this permission request
4831 #[serde(skip_serializing_if = "Option::is_none")]
4832 pub tool_call_id: Option<String>,
4833 /// Optional warning message about risks of running this command
4834 #[serde(skip_serializing_if = "Option::is_none")]
4835 pub warning: Option<String>,
4836}
4837
4838/// File write permission prompt
4839#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4840#[serde(rename_all = "camelCase")]
4841pub struct PermissionPromptRequestWrite {
4842 /// Assisted-approval judge information for this request; present only in assisted mode.
4843 ///
4844 /// <div class="warning">
4845 ///
4846 /// **Experimental.** This type is part of an experimental wire-protocol surface
4847 /// and may change or be removed in future SDK or CLI releases.
4848 ///
4849 /// </div>
4850 #[serde(skip_serializing_if = "Option::is_none")]
4851 pub assisted_approval: Option<PermissionAssistedApproval>,
4852 /// Whether the UI can offer session-wide approval for file write operations
4853 pub can_offer_session_approval: bool,
4854 /// Unified diff showing the proposed changes
4855 pub diff: String,
4856 /// Path of the file being written to
4857 pub file_name: String,
4858 /// Human-readable description of the intended file change
4859 pub intention: String,
4860 /// Prompt kind discriminator
4861 pub kind: PermissionPromptRequestWriteKind,
4862 /// Whether managed policy requires a human response and forbids host auto-approval
4863 #[serde(skip_serializing_if = "Option::is_none")]
4864 pub managed_approval_required: Option<bool>,
4865 /// Complete new file contents for newly created files
4866 #[serde(skip_serializing_if = "Option::is_none")]
4867 pub new_file_contents: Option<String>,
4868 /// Tool call ID that triggered this permission request
4869 #[serde(skip_serializing_if = "Option::is_none")]
4870 pub tool_call_id: Option<String>,
4871}
4872
4873/// File read permission prompt
4874#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4875#[serde(rename_all = "camelCase")]
4876pub struct PermissionPromptRequestRead {
4877 /// Assisted-approval judge information for this request; present only in assisted mode.
4878 ///
4879 /// <div class="warning">
4880 ///
4881 /// **Experimental.** This type is part of an experimental wire-protocol surface
4882 /// and may change or be removed in future SDK or CLI releases.
4883 ///
4884 /// </div>
4885 #[serde(skip_serializing_if = "Option::is_none")]
4886 pub assisted_approval: Option<PermissionAssistedApproval>,
4887 /// Human-readable description of why the file is being read
4888 pub intention: String,
4889 /// Prompt kind discriminator
4890 pub kind: PermissionPromptRequestReadKind,
4891 /// Whether managed policy requires a human response and forbids host auto-approval
4892 #[serde(skip_serializing_if = "Option::is_none")]
4893 pub managed_approval_required: Option<bool>,
4894 /// Path of the file or directory being read
4895 pub path: String,
4896 /// Tool call ID that triggered this permission request
4897 #[serde(skip_serializing_if = "Option::is_none")]
4898 pub tool_call_id: Option<String>,
4899}
4900
4901/// MCP tool invocation permission prompt
4902#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4903#[serde(rename_all = "camelCase")]
4904pub struct PermissionPromptRequestMcp {
4905 /// Arguments to pass to the MCP tool
4906 #[serde(skip_serializing_if = "Option::is_none")]
4907 pub args: Option<serde_json::Value>,
4908 /// Assisted-approval judge information for this request; present only in assisted mode.
4909 ///
4910 /// <div class="warning">
4911 ///
4912 /// **Experimental.** This type is part of an experimental wire-protocol surface
4913 /// and may change or be removed in future SDK or CLI releases.
4914 ///
4915 /// </div>
4916 #[serde(skip_serializing_if = "Option::is_none")]
4917 pub assisted_approval: Option<PermissionAssistedApproval>,
4918 /// Whether the host may offer a server-wide "approve all tools from this server" blanket. Absent is treated as true; the runtime sends false when managed policy disables bypass-permissions mode, which forbids the server-wide escalation while still allowing per-tool approval.
4919 #[serde(skip_serializing_if = "Option::is_none")]
4920 pub can_offer_server_wide_approval: Option<bool>,
4921 /// Prompt kind discriminator
4922 pub kind: PermissionPromptRequestMcpKind,
4923 /// Advisory runtime permission recommendation. The host remains responsible for deciding the request and may reject it.
4924 ///
4925 /// <div class="warning">
4926 ///
4927 /// **Experimental.** This type is part of an experimental wire-protocol surface
4928 /// and may change or be removed in future SDK or CLI releases.
4929 ///
4930 /// </div>
4931 #[serde(skip_serializing_if = "Option::is_none")]
4932 pub permission_recommendation: Option<PermissionRecommendation>,
4933 /// Name of the MCP server providing the tool
4934 pub server_name: String,
4935 /// Tool call ID that triggered this permission request
4936 #[serde(skip_serializing_if = "Option::is_none")]
4937 pub tool_call_id: Option<String>,
4938 /// Internal name of the MCP tool
4939 pub tool_name: String,
4940 /// Human-readable title of the MCP tool
4941 pub tool_title: String,
4942}
4943
4944/// URL access permission prompt
4945#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4946#[serde(rename_all = "camelCase")]
4947pub struct PermissionPromptRequestUrl {
4948 /// Assisted-approval judge information for this request; present only in assisted mode.
4949 ///
4950 /// <div class="warning">
4951 ///
4952 /// **Experimental.** This type is part of an experimental wire-protocol surface
4953 /// and may change or be removed in future SDK or CLI releases.
4954 ///
4955 /// </div>
4956 #[serde(skip_serializing_if = "Option::is_none")]
4957 pub assisted_approval: Option<PermissionAssistedApproval>,
4958 /// Human-readable description of why the URL is being accessed
4959 pub intention: String,
4960 /// Prompt kind discriminator
4961 pub kind: PermissionPromptRequestUrlKind,
4962 /// Whether managed policy requires a human response and forbids host auto-approval
4963 #[serde(skip_serializing_if = "Option::is_none")]
4964 pub managed_approval_required: Option<bool>,
4965 /// Immediately preceding URL when this prompt is for a redirect target
4966 #[serde(skip_serializing_if = "Option::is_none")]
4967 pub redirected_from: Option<String>,
4968 /// True when the tool is asking to run this URL fetch outside the sandbox, after the network policy denied the approved URL or the sandbox proxy could not reach it (host opted in via sandbox.allowBypass). The model cannot ask for this; only the tool raises it. This is a request, not a grant: the fetch runs only if the user approves this permission request. Hosts should highlight the elevated risk in the approval UI.
4969 #[serde(skip_serializing_if = "Option::is_none")]
4970 pub request_sandbox_bypass: Option<bool>,
4971 /// What the tool tells the user about the bypass on offer: which policy rule blocked the call, or why it cannot be sandboxed. Only meaningful when requestSandboxBypass is true.
4972 #[serde(skip_serializing_if = "Option::is_none")]
4973 pub request_sandbox_bypass_reason: Option<String>,
4974 /// Tool call ID that triggered this permission request
4975 #[serde(skip_serializing_if = "Option::is_none")]
4976 pub tool_call_id: Option<String>,
4977 /// URL to be fetched
4978 pub url: String,
4979}
4980
4981/// Memory operation permission prompt
4982#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4983#[serde(rename_all = "camelCase")]
4984pub struct PermissionPromptRequestMemory {
4985 /// Whether this is a store or vote memory operation
4986 #[serde(skip_serializing_if = "Option::is_none")]
4987 pub action: Option<PermissionRequestMemoryAction>,
4988 /// Assisted-approval judge information for this request; present only in assisted mode.
4989 ///
4990 /// <div class="warning">
4991 ///
4992 /// **Experimental.** This type is part of an experimental wire-protocol surface
4993 /// and may change or be removed in future SDK or CLI releases.
4994 ///
4995 /// </div>
4996 #[serde(skip_serializing_if = "Option::is_none")]
4997 pub assisted_approval: Option<PermissionAssistedApproval>,
4998 /// Source references for the stored fact (store only)
4999 #[serde(skip_serializing_if = "Option::is_none")]
5000 pub citations: Option<String>,
5001 /// Vote direction (vote only)
5002 #[serde(skip_serializing_if = "Option::is_none")]
5003 pub direction: Option<PermissionRequestMemoryDirection>,
5004 /// The fact being stored or voted on
5005 pub fact: String,
5006 /// Prompt kind discriminator
5007 pub kind: PermissionPromptRequestMemoryKind,
5008 /// Reason for the vote (vote only)
5009 #[serde(skip_serializing_if = "Option::is_none")]
5010 pub reason: Option<String>,
5011 /// Topic or subject of the memory (store only)
5012 #[serde(skip_serializing_if = "Option::is_none")]
5013 pub subject: Option<String>,
5014 /// Tool call ID that triggered this permission request
5015 #[serde(skip_serializing_if = "Option::is_none")]
5016 pub tool_call_id: Option<String>,
5017}
5018
5019/// Custom tool invocation permission prompt
5020#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5021#[serde(rename_all = "camelCase")]
5022pub struct PermissionPromptRequestCustomTool {
5023 /// Arguments to pass to the custom tool
5024 #[serde(skip_serializing_if = "Option::is_none")]
5025 pub args: Option<serde_json::Value>,
5026 /// Assisted-approval judge information for this request; present only in assisted mode.
5027 ///
5028 /// <div class="warning">
5029 ///
5030 /// **Experimental.** This type is part of an experimental wire-protocol surface
5031 /// and may change or be removed in future SDK or CLI releases.
5032 ///
5033 /// </div>
5034 #[serde(skip_serializing_if = "Option::is_none")]
5035 pub assisted_approval: Option<PermissionAssistedApproval>,
5036 /// Prompt kind discriminator
5037 pub kind: PermissionPromptRequestCustomToolKind,
5038 /// Tool call ID that triggered this permission request
5039 #[serde(skip_serializing_if = "Option::is_none")]
5040 pub tool_call_id: Option<String>,
5041 /// Description of what the custom tool does
5042 pub tool_description: String,
5043 /// Name of the custom tool
5044 pub tool_name: String,
5045}
5046
5047/// Path access permission prompt
5048#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5049#[serde(rename_all = "camelCase")]
5050pub struct PermissionPromptRequestPath {
5051 /// Underlying permission kind that needs path approval
5052 pub access_kind: PermissionPromptRequestPathAccessKind,
5053 /// Assisted-approval judge information for this request; present only in assisted mode.
5054 ///
5055 /// <div class="warning">
5056 ///
5057 /// **Experimental.** This type is part of an experimental wire-protocol surface
5058 /// and may change or be removed in future SDK or CLI releases.
5059 ///
5060 /// </div>
5061 #[serde(skip_serializing_if = "Option::is_none")]
5062 pub assisted_approval: Option<PermissionAssistedApproval>,
5063 /// Prompt kind discriminator
5064 pub kind: PermissionPromptRequestPathKind,
5065 /// File paths that require explicit approval
5066 pub paths: Vec<String>,
5067 /// Tool call ID that triggered this permission request
5068 #[serde(skip_serializing_if = "Option::is_none")]
5069 pub tool_call_id: Option<String>,
5070}
5071
5072/// Hook confirmation permission prompt
5073#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5074#[serde(rename_all = "camelCase")]
5075pub struct PermissionPromptRequestHook {
5076 /// Assisted-approval judge information for this request; present only in assisted mode.
5077 ///
5078 /// <div class="warning">
5079 ///
5080 /// **Experimental.** This type is part of an experimental wire-protocol surface
5081 /// and may change or be removed in future SDK or CLI releases.
5082 ///
5083 /// </div>
5084 #[serde(skip_serializing_if = "Option::is_none")]
5085 pub assisted_approval: Option<PermissionAssistedApproval>,
5086 /// Optional message from the hook explaining why confirmation is needed
5087 #[serde(skip_serializing_if = "Option::is_none")]
5088 pub hook_message: Option<String>,
5089 /// Prompt kind discriminator
5090 pub kind: PermissionPromptRequestHookKind,
5091 /// Arguments of the tool call being gated
5092 #[serde(skip_serializing_if = "Option::is_none")]
5093 pub tool_args: Option<serde_json::Value>,
5094 /// Tool call ID that triggered this permission request
5095 #[serde(skip_serializing_if = "Option::is_none")]
5096 pub tool_call_id: Option<String>,
5097 /// Name of the tool the hook is gating
5098 pub tool_name: String,
5099}
5100
5101/// Extension management permission prompt
5102#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5103#[serde(rename_all = "camelCase")]
5104pub struct PermissionPromptRequestExtensionManagement {
5105 /// Assisted-approval judge information for this request; present only in assisted mode.
5106 ///
5107 /// <div class="warning">
5108 ///
5109 /// **Experimental.** This type is part of an experimental wire-protocol surface
5110 /// and may change or be removed in future SDK or CLI releases.
5111 ///
5112 /// </div>
5113 #[serde(skip_serializing_if = "Option::is_none")]
5114 pub assisted_approval: Option<PermissionAssistedApproval>,
5115 /// Name of the extension being managed
5116 #[serde(skip_serializing_if = "Option::is_none")]
5117 pub extension_name: Option<String>,
5118 /// Prompt kind discriminator
5119 pub kind: PermissionPromptRequestExtensionManagementKind,
5120 /// The extension management operation (scaffold, reload)
5121 pub operation: String,
5122 /// Tool call ID that triggered this permission request
5123 #[serde(skip_serializing_if = "Option::is_none")]
5124 pub tool_call_id: Option<String>,
5125}
5126
5127/// Factory run or authoring permission prompt
5128#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5129#[serde(rename_all = "camelCase")]
5130pub struct PermissionPromptRequestFactory {
5131 /// Canonical key used for scoped factory approvals
5132 pub approval_key: String,
5133 /// Assisted-approval judge information for this request; present only in assisted mode.
5134 ///
5135 /// <div class="warning">
5136 ///
5137 /// **Experimental.** This type is part of an experimental wire-protocol surface
5138 /// and may change or be removed in future SDK or CLI releases.
5139 ///
5140 /// </div>
5141 #[serde(skip_serializing_if = "Option::is_none")]
5142 pub assisted_approval: Option<PermissionAssistedApproval>,
5143 /// Whether this factory is eligible for persistent approval
5144 pub can_persist_approval: bool,
5145 /// Factory-declared AI-credit limit before any run/resume caller override is applied.
5146 #[serde(skip_serializing_if = "Option::is_none")]
5147 pub declared_max_ai_credits: Option<f64>,
5148 /// Factory-declared concurrent-subagent limit before any run/resume caller override is applied.
5149 #[serde(skip_serializing_if = "Option::is_none")]
5150 pub declared_max_concurrent_subagents: Option<i64>,
5151 /// Factory-declared total-subagent limit before any run/resume caller override is applied.
5152 #[serde(skip_serializing_if = "Option::is_none")]
5153 pub declared_max_total_subagents: Option<i64>,
5154 /// Factory-declared active-time limit in seconds before any run/resume caller override is applied.
5155 #[serde(skip_serializing_if = "Option::is_none")]
5156 pub declared_timeout_seconds: Option<f64>,
5157 /// Factory description
5158 pub description: String,
5159 /// Prompt kind discriminator
5160 pub kind: PermissionPromptRequestFactoryKind,
5161 /// Whether managed policy requires a human response and forbids host auto-approval
5162 #[serde(skip_serializing_if = "Option::is_none")]
5163 pub managed_approval_required: Option<bool>,
5164 /// Effective AI-credit limit; omitted means unlimited
5165 #[serde(skip_serializing_if = "Option::is_none")]
5166 pub max_ai_credits: Option<f64>,
5167 /// Effective concurrent-subagent limit; omitted means unlimited
5168 #[serde(skip_serializing_if = "Option::is_none")]
5169 pub max_concurrent_subagents: Option<i64>,
5170 /// Effective total-subagent limit; omitted means unlimited
5171 #[serde(skip_serializing_if = "Option::is_none")]
5172 pub max_total_subagents: Option<i64>,
5173 /// Factory name
5174 pub name: String,
5175 /// Factory operation, either run or author
5176 pub operation: FactoryPermissionOperation,
5177 /// Declared factory phases
5178 pub phases: Vec<FactoryPermissionPhase>,
5179 /// Effective active-time limit in seconds; omitted means unlimited
5180 #[serde(skip_serializing_if = "Option::is_none")]
5181 pub timeout_seconds: Option<f64>,
5182 /// Tool call ID that triggered this permission request
5183 #[serde(skip_serializing_if = "Option::is_none")]
5184 pub tool_call_id: Option<String>,
5185}
5186
5187/// Extension permission access prompt
5188#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5189#[serde(rename_all = "camelCase")]
5190pub struct PermissionPromptRequestExtensionPermissionAccess {
5191 /// Assisted-approval judge information for this request; present only in assisted mode.
5192 ///
5193 /// <div class="warning">
5194 ///
5195 /// **Experimental.** This type is part of an experimental wire-protocol surface
5196 /// and may change or be removed in future SDK or CLI releases.
5197 ///
5198 /// </div>
5199 #[serde(skip_serializing_if = "Option::is_none")]
5200 pub assisted_approval: Option<PermissionAssistedApproval>,
5201 /// Capabilities the extension is requesting
5202 pub capabilities: Vec<String>,
5203 /// Name of the extension requesting permission access
5204 pub extension_name: String,
5205 /// Prompt kind discriminator
5206 pub kind: PermissionPromptRequestExtensionPermissionAccessKind,
5207 /// Tool call ID that triggered this permission request
5208 #[serde(skip_serializing_if = "Option::is_none")]
5209 pub tool_call_id: Option<String>,
5210}
5211
5212/// Extension sensitive environment variable access prompt
5213#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5214#[serde(rename_all = "camelCase")]
5215pub struct PermissionPromptRequestExtensionEnvAccess {
5216 /// Assisted-approval judge information for this request; present only in assisted mode.
5217 ///
5218 /// <div class="warning">
5219 ///
5220 /// **Experimental.** This type is part of an experimental wire-protocol surface
5221 /// and may change or be removed in future SDK or CLI releases.
5222 ///
5223 /// </div>
5224 #[serde(skip_serializing_if = "Option::is_none")]
5225 pub assisted_approval: Option<PermissionAssistedApproval>,
5226 /// Names of the sensitive environment variables the extension is requesting. Values never appear here.
5227 pub environment_variables: Vec<String>,
5228 /// Name of the extension requesting environment variable access
5229 pub extension_name: String,
5230 /// Prompt kind discriminator
5231 pub kind: PermissionPromptRequestExtensionEnvAccessKind,
5232 /// Tool call ID that triggered this permission request
5233 #[serde(skip_serializing_if = "Option::is_none")]
5234 pub tool_call_id: Option<String>,
5235}
5236
5237/// Session event "permission.requested". Permission request notification requiring client approval with request details
5238#[derive(Debug, Clone, Serialize, Deserialize)]
5239#[serde(rename_all = "camelCase")]
5240pub struct PermissionRequestedData {
5241 /// Agent mode captured from the owning turn when permission evaluation began.
5242 #[serde(skip_serializing_if = "Option::is_none")]
5243 pub agent_mode: Option<SessionMode>,
5244 /// Details of the permission being requested
5245 pub permission_request: PermissionRequest,
5246 /// Derived user-facing permission prompt details for UI consumers
5247 #[serde(skip_serializing_if = "Option::is_none")]
5248 pub prompt_request: Option<PermissionPromptRequest>,
5249 /// Unique identifier for this permission request; used to respond via session.respondToPermission()
5250 pub request_id: RequestId,
5251 /// When true, this permission was already resolved by a permissionRequest hook and requires no client action
5252 #[serde(skip_serializing_if = "Option::is_none")]
5253 pub resolved_by_hook: Option<bool>,
5254 /// Neutral risk metadata supplied by the tool host. Consumers may display this value but must not use it to bypass the permission decision.
5255 #[serde(skip_serializing_if = "Option::is_none")]
5256 pub risk_assessment: Option<serde_json::Value>,
5257}
5258
5259/// Permission response variant indicating the request was approved without persisting an approval rule.
5260#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5261#[serde(rename_all = "camelCase")]
5262pub struct PermissionApproved {
5263 /// The permission request was approved
5264 pub kind: PermissionApprovedKind,
5265 /// Whether a managed approval policy already handled this request
5266 #[serde(skip_serializing_if = "Option::is_none")]
5267 pub managed_approval_handled: Option<bool>,
5268}
5269
5270/// Session-scoped tool-approval rule for specific shell command identifiers.
5271#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5272#[serde(rename_all = "camelCase")]
5273pub struct UserToolSessionApprovalCommands {
5274 /// Command identifiers approved by the user
5275 pub command_identifiers: Vec<String>,
5276 /// Command approval kind
5277 pub kind: UserToolSessionApprovalCommandsKind,
5278}
5279
5280/// Session-scoped tool-approval rule for read-only filesystem operations.
5281#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5282#[serde(rename_all = "camelCase")]
5283pub struct UserToolSessionApprovalRead {
5284 /// Read approval kind
5285 pub kind: UserToolSessionApprovalReadKind,
5286}
5287
5288/// Session-scoped tool-approval rule for filesystem write operations.
5289#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5290#[serde(rename_all = "camelCase")]
5291pub struct UserToolSessionApprovalWrite {
5292 /// Write approval kind
5293 pub kind: UserToolSessionApprovalWriteKind,
5294}
5295
5296/// Session-scoped tool-approval rule for an MCP server tool, or all tools on the server when `toolName` is null.
5297#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5298#[serde(rename_all = "camelCase")]
5299pub struct UserToolSessionApprovalMcp {
5300 /// MCP tool approval kind
5301 pub kind: UserToolSessionApprovalMcpKind,
5302 /// MCP server name
5303 pub server_name: String,
5304 /// Optional MCP tool name, or null for all tools on the server
5305 pub tool_name: Option<String>,
5306}
5307
5308/// Session-scoped tool-approval rule for writes to long-term memory.
5309#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5310#[serde(rename_all = "camelCase")]
5311pub struct UserToolSessionApprovalMemory {
5312 /// Memory approval kind
5313 pub kind: UserToolSessionApprovalMemoryKind,
5314}
5315
5316/// Session-scoped tool-approval rule for a custom tool, keyed by tool name.
5317#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5318#[serde(rename_all = "camelCase")]
5319pub struct UserToolSessionApprovalCustomTool {
5320 /// Custom tool approval kind
5321 pub kind: UserToolSessionApprovalCustomToolKind,
5322 /// Custom tool name
5323 pub tool_name: String,
5324}
5325
5326/// Session-scoped tool-approval rule for extension-management operations, optionally narrowed by operation.
5327#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5328#[serde(rename_all = "camelCase")]
5329pub struct UserToolSessionApprovalExtensionManagement {
5330 /// Extension management approval kind
5331 pub kind: UserToolSessionApprovalExtensionManagementKind,
5332 /// Optional operation identifier
5333 #[serde(skip_serializing_if = "Option::is_none")]
5334 pub operation: Option<String>,
5335}
5336
5337/// Session-scoped factory approval, optionally narrowed by approval key.
5338#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5339#[serde(rename_all = "camelCase")]
5340pub struct UserToolSessionApprovalFactory {
5341 /// Optional factory operation name or canonical approval key
5342 #[serde(skip_serializing_if = "Option::is_none")]
5343 pub approval_key: Option<String>,
5344 /// Factory approval kind
5345 pub kind: UserToolSessionApprovalFactoryKind,
5346}
5347
5348/// Session-scoped tool-approval rule for an extension's permission-gated capability access, keyed by extension name.
5349#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5350#[serde(rename_all = "camelCase")]
5351pub struct UserToolSessionApprovalExtensionPermissionAccess {
5352 /// Extension name
5353 pub extension_name: String,
5354 /// Extension permission access approval kind
5355 pub kind: UserToolSessionApprovalExtensionPermissionAccessKind,
5356}
5357
5358/// Session-scoped tool-approval rule for an extension's access to sensitive environment variables, keyed by extension name and the exact set of variable names.
5359#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5360#[serde(rename_all = "camelCase")]
5361pub struct UserToolSessionApprovalExtensionEnvAccess {
5362 /// Names of the sensitive environment variables this approval covers. Values are never persisted.
5363 pub environment_variables: Vec<String>,
5364 /// Extension name
5365 pub extension_name: String,
5366 /// Extension environment access approval kind
5367 pub kind: UserToolSessionApprovalExtensionEnvAccessKind,
5368}
5369
5370/// Permission response variant that approves a request and remembers the provided approval for the rest of the session.
5371#[derive(Debug, Clone, Serialize, Deserialize)]
5372#[serde(rename_all = "camelCase")]
5373pub struct PermissionApprovedForSession {
5374 /// The approval to add as a session-scoped rule
5375 pub approval: UserToolSessionApproval,
5376 /// Approved and remembered for the rest of the session
5377 pub kind: PermissionApprovedForSessionKind,
5378 /// Whether a managed approval policy already handled this request
5379 #[serde(skip_serializing_if = "Option::is_none")]
5380 pub managed_approval_handled: Option<bool>,
5381}
5382
5383/// Permission response variant that approves a request and persists the provided approval to a project location key.
5384#[derive(Debug, Clone, Serialize, Deserialize)]
5385#[serde(rename_all = "camelCase")]
5386pub struct PermissionApprovedForLocation {
5387 /// The approval to persist for this location
5388 pub approval: UserToolSessionApproval,
5389 /// Approved and persisted for this project location
5390 pub kind: PermissionApprovedForLocationKind,
5391 /// The location key (git root or cwd) to persist the approval to
5392 pub location_key: String,
5393 /// Whether a managed approval policy already handled this request
5394 #[serde(skip_serializing_if = "Option::is_none")]
5395 pub managed_approval_handled: Option<bool>,
5396}
5397
5398/// Permission response variant indicating the request was cancelled before use, with an optional reason.
5399#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5400#[serde(rename_all = "camelCase")]
5401pub struct PermissionCancelled {
5402 /// The permission request was cancelled before a response was used
5403 pub kind: PermissionCancelledKind,
5404 /// Optional explanation of why the request was cancelled
5405 #[serde(skip_serializing_if = "Option::is_none")]
5406 pub reason: Option<String>,
5407}
5408
5409/// A permission approval or denial rule matched against a tool request, identified by a rule kind with an optional argument value.
5410#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5411#[serde(rename_all = "camelCase")]
5412pub struct PermissionRule {
5413 /// Argument value matched against the request, or null when the rule kind has no argument (e.g. 'read', 'write', 'memory').
5414 pub argument: Option<String>,
5415 /// The rule kind, such as Shell or GitHubMCP
5416 pub kind: String,
5417}
5418
5419/// Permission response variant denied because matching approval rules explicitly blocked the request.
5420#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5421#[serde(rename_all = "camelCase")]
5422pub struct PermissionDeniedByRules {
5423 /// Denied because approval rules explicitly blocked it
5424 pub kind: PermissionDeniedByRulesKind,
5425 /// Rules that denied the request
5426 pub rules: Vec<PermissionRule>,
5427}
5428
5429/// Permission response variant denied because no approval rule matched and user confirmation was unavailable.
5430#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5431#[serde(rename_all = "camelCase")]
5432pub struct PermissionDeniedNoApprovalRuleAndCouldNotRequestFromUser {
5433 /// Denied because no approval rule matched and user confirmation was unavailable
5434 pub kind: PermissionDeniedNoApprovalRuleAndCouldNotRequestFromUserKind,
5435}
5436
5437/// Permission response variant denied in an interactive user prompt, with optional feedback and force-reject flag.
5438#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5439#[serde(rename_all = "camelCase")]
5440pub struct PermissionDeniedInteractivelyByUser {
5441 /// Optional feedback from the user explaining the denial
5442 #[serde(skip_serializing_if = "Option::is_none")]
5443 pub feedback: Option<String>,
5444 /// Whether to force-reject the current agent turn
5445 #[serde(skip_serializing_if = "Option::is_none")]
5446 pub force_reject: Option<bool>,
5447 /// Denied by the user during an interactive prompt
5448 pub kind: PermissionDeniedInteractivelyByUserKind,
5449}
5450
5451/// Permission response variant denying a path under content exclusion policy, with the path and message.
5452#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5453#[serde(rename_all = "camelCase")]
5454pub struct PermissionDeniedByContentExclusionPolicy {
5455 /// Denied by the organization's content exclusion policy
5456 pub kind: PermissionDeniedByContentExclusionPolicyKind,
5457 /// Human-readable explanation of why the path was excluded
5458 pub message: String,
5459 /// File path that triggered the exclusion
5460 pub path: String,
5461}
5462
5463/// Permission response variant denied by a permission-request hook, with optional message and interrupt flag.
5464#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5465#[serde(rename_all = "camelCase")]
5466pub struct PermissionDeniedByPermissionRequestHook {
5467 /// Whether to interrupt the current agent turn
5468 #[serde(skip_serializing_if = "Option::is_none")]
5469 pub interrupt: Option<bool>,
5470 /// Denied by a permission request hook registered by an extension or plugin
5471 pub kind: PermissionDeniedByPermissionRequestHookKind,
5472 /// Optional message from the hook explaining the denial
5473 #[serde(skip_serializing_if = "Option::is_none")]
5474 pub message: Option<String>,
5475}
5476
5477/// Session event "permission.completed". Permission request completion notification signaling UI dismissal
5478#[derive(Debug, Clone, Serialize, Deserialize)]
5479#[serde(rename_all = "camelCase")]
5480pub struct PermissionCompletedData {
5481 /// Request ID of the resolved permission request; clients should dismiss any UI for this request
5482 pub request_id: RequestId,
5483 /// The result of the permission request
5484 pub result: PermissionResult,
5485 /// Optional tool call ID associated with this permission prompt; clients may use it to correlate UI created from tool-scoped prompts
5486 #[serde(skip_serializing_if = "Option::is_none")]
5487 pub tool_call_id: Option<String>,
5488}
5489
5490/// Session event "user_input.requested". User input request notification with question and optional predefined choices
5491#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5492#[serde(rename_all = "camelCase")]
5493pub struct UserInputRequestedData {
5494 /// Whether the user can provide a free-form text response in addition to predefined choices
5495 #[serde(skip_serializing_if = "Option::is_none")]
5496 pub allow_freeform: Option<bool>,
5497 /// Predefined choices for the user to select from, if applicable
5498 #[serde(skip_serializing_if = "Option::is_none")]
5499 pub choices: Option<Vec<String>>,
5500 /// The question or prompt to present to the user
5501 pub question: String,
5502 /// Unique identifier for this input request; used to respond via session.respondToUserInput()
5503 pub request_id: RequestId,
5504 /// The LLM-assigned tool call ID that triggered this request; used by remote UIs to correlate responses
5505 #[serde(skip_serializing_if = "Option::is_none")]
5506 pub tool_call_id: Option<String>,
5507}
5508
5509/// Session event "user_input.completed". User input request completion with the user's response
5510#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5511#[serde(rename_all = "camelCase")]
5512pub struct UserInputCompletedData {
5513 /// The user's answer to the input request
5514 #[serde(skip_serializing_if = "Option::is_none")]
5515 pub answer: Option<String>,
5516 /// Request ID of the resolved user input request; clients should dismiss any UI for this request
5517 pub request_id: RequestId,
5518 /// Whether the answer was typed as free-form text rather than selected from choices
5519 #[serde(skip_serializing_if = "Option::is_none")]
5520 pub was_freeform: Option<bool>,
5521}
5522
5523/// JSON Schema describing the form fields to present to the user (form mode only)
5524#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5525#[serde(rename_all = "camelCase")]
5526pub struct ElicitationRequestedSchema {
5527 /// Form field definitions, keyed by field name
5528 pub properties: HashMap<String, serde_json::Value>,
5529 /// List of required field names
5530 #[serde(skip_serializing_if = "Option::is_none")]
5531 pub required: Option<Vec<String>>,
5532 /// Schema type indicator (always 'object')
5533 pub r#type: ElicitationRequestedSchemaType,
5534}
5535
5536/// Session event "elicitation.requested". Elicitation request; may be form-based (structured input) or URL-based (browser redirect)
5537#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5538#[serde(rename_all = "camelCase")]
5539pub struct ElicitationRequestedData {
5540 /// The source that initiated the request (MCP server name, or absent for agent-initiated)
5541 #[serde(skip_serializing_if = "Option::is_none")]
5542 pub elicitation_source: Option<String>,
5543 /// Message describing what information is needed from the user
5544 pub message: String,
5545 /// Elicitation mode; "form" for structured input, "url" for browser-based. Defaults to "form" when absent.
5546 #[serde(skip_serializing_if = "Option::is_none")]
5547 pub mode: Option<ElicitationRequestedMode>,
5548 /// JSON Schema describing the form fields to present to the user (form mode only)
5549 #[serde(skip_serializing_if = "Option::is_none")]
5550 pub requested_schema: Option<ElicitationRequestedSchema>,
5551 /// Unique identifier for this elicitation request; used to respond via session.respondToElicitation()
5552 pub request_id: RequestId,
5553 /// Tool call ID from the LLM completion; used to correlate with CompletionChunk.toolCall.id for remote UIs
5554 #[serde(skip_serializing_if = "Option::is_none")]
5555 pub tool_call_id: Option<String>,
5556 /// URL to open in the user's browser (url mode only)
5557 #[serde(skip_serializing_if = "Option::is_none")]
5558 pub url: Option<String>,
5559}
5560
5561/// Session event "elicitation.completed". Elicitation request completion with the user's response
5562#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5563#[serde(rename_all = "camelCase")]
5564pub struct ElicitationCompletedData {
5565 /// The user action: "accept" (submitted form), "decline" (explicitly refused), or "cancel" (dismissed)
5566 #[serde(skip_serializing_if = "Option::is_none")]
5567 pub action: Option<ElicitationCompletedAction>,
5568 /// The submitted form data when action is 'accept'; keys match the requested schema fields
5569 #[serde(skip_serializing_if = "Option::is_none")]
5570 pub content: Option<HashMap<String, serde_json::Value>>,
5571 /// Request ID of the resolved elicitation request; clients should dismiss any UI for this request
5572 pub request_id: RequestId,
5573}
5574
5575/// Session event "sampling.requested". Sampling request from an MCP server; contains the server name and a requestId for correlation
5576#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5577#[serde(rename_all = "camelCase")]
5578pub struct SamplingRequestedData {
5579 /// The JSON-RPC request ID from the MCP protocol
5580 pub mcp_request_id: serde_json::Value,
5581 /// Unique identifier for this sampling request; used to respond via session.respondToSampling()
5582 pub request_id: RequestId,
5583 /// Name of the MCP server that initiated the sampling request
5584 pub server_name: String,
5585}
5586
5587/// Session event "sampling.completed". Sampling request completion notification signaling UI dismissal
5588#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5589#[serde(rename_all = "camelCase")]
5590pub struct SamplingCompletedData {
5591 /// Request ID of the resolved sampling request; clients should dismiss any UI for this request
5592 pub request_id: RequestId,
5593}
5594
5595/// Single HTTP header entry as a name/value pair.
5596#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5597#[serde(rename_all = "camelCase")]
5598pub struct HeaderEntry {
5599 /// HTTP response header name as observed by the runtime.
5600 pub name: String,
5601 /// HTTP response header value as observed by the runtime.
5602 pub value: String,
5603}
5604
5605/// Raw HTTP response details from the OAuth auth challenge, as observed by the runtime.
5606#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5607#[serde(rename_all = "camelCase")]
5608pub struct McpOauthHttpResponse {
5609 /// Complete UTF-8 response body for host-specific challenge handling, including an empty string for an empty body. Omitted when the complete body is not valid UTF-8; body read failures fail the HTTP operation rather than exposing a partial response.
5610 #[serde(skip_serializing_if = "Option::is_none")]
5611 pub body: Option<String>,
5612 /// HTTP response headers as observed by the runtime. Order and casing are transport-dependent, and duplicate header names may appear multiple times.
5613 pub headers: Vec<HeaderEntry>,
5614 /// HTTP status code returned with the auth challenge.
5615 pub status_code: i32,
5616}
5617
5618/// Static OAuth client configuration, if the server specifies one
5619#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5620#[serde(rename_all = "camelCase")]
5621pub struct McpOauthRequiredStaticClientConfig {
5622 /// OAuth client ID for the server
5623 pub client_id: String,
5624 /// Optional OAuth client secret for confidential static clients, when the runtime can resolve one
5625 #[serde(skip_serializing_if = "Option::is_none")]
5626 pub client_secret: Option<String>,
5627 /// 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).
5628 #[serde(skip_serializing_if = "Option::is_none")]
5629 pub grant_type: Option<McpOauthRequiredStaticClientConfigGrantType>,
5630 /// Whether this is a public OAuth client
5631 #[serde(skip_serializing_if = "Option::is_none")]
5632 pub public_client: Option<bool>,
5633}
5634
5635/// OAuth WWW-Authenticate parameters parsed from an MCP auth challenge
5636#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5637#[serde(rename_all = "camelCase")]
5638pub struct McpOauthWWWAuthenticateParams {
5639 /// OAuth error from the WWW-Authenticate error parameter, if present
5640 #[serde(skip_serializing_if = "Option::is_none")]
5641 pub error: Option<String>,
5642 /// Protected resource metadata URL from the WWW-Authenticate resource_metadata parameter, if present
5643 #[serde(skip_serializing_if = "Option::is_none")]
5644 pub resource_metadata_url: Option<String>,
5645 /// Requested OAuth scopes from the WWW-Authenticate scope parameter, if present
5646 #[serde(skip_serializing_if = "Option::is_none")]
5647 pub scope: Option<String>,
5648}
5649
5650/// Session event "mcp.oauth_required". OAuth authentication request for an MCP server
5651#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5652#[serde(rename_all = "camelCase")]
5653pub struct McpOauthRequiredData {
5654 /// Raw HTTP response details from the OAuth auth challenge, as observed by the runtime. Header order and casing are transport-dependent, and duplicate header names may appear multiple times.
5655 #[serde(skip_serializing_if = "Option::is_none")]
5656 pub http_response: Option<McpOauthHttpResponse>,
5657 /// Why the runtime is requesting host-provided OAuth credentials.
5658 pub reason: McpOauthRequestReason,
5659 /// Unique identifier for this OAuth request; used to respond via session.mcp.oauth.handlePendingRequest
5660 pub request_id: RequestId,
5661 /// Raw OAuth protected-resource metadata document fetched for the MCP server, if available
5662 #[serde(skip_serializing_if = "Option::is_none")]
5663 pub resource_metadata: Option<String>,
5664 /// Display name of the MCP server that requires OAuth
5665 pub server_name: String,
5666 /// URL of the MCP server that requires OAuth
5667 pub server_url: String,
5668 /// Static OAuth client configuration, if the server specifies one
5669 #[serde(skip_serializing_if = "Option::is_none")]
5670 pub static_client_config: Option<McpOauthRequiredStaticClientConfig>,
5671 /// OAuth WWW-Authenticate parameters parsed from the auth challenge, if available
5672 #[serde(skip_serializing_if = "Option::is_none")]
5673 pub www_authenticate_params: Option<McpOauthWWWAuthenticateParams>,
5674}
5675
5676/// Session event "mcp.oauth_completed". MCP OAuth request completion notification
5677#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5678#[serde(rename_all = "camelCase")]
5679pub struct McpOauthCompletedData {
5680 /// How the pending OAuth request was completed
5681 pub outcome: McpOauthCompletionOutcome,
5682 /// Request ID of the resolved OAuth request
5683 pub request_id: RequestId,
5684}
5685
5686/// Session event "mcp.headers_refresh_required". Dynamic headers refresh request for a remote MCP server
5687#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5688#[serde(rename_all = "camelCase")]
5689pub struct McpHeadersRefreshRequiredData {
5690 /// Why dynamic headers are being requested.
5691 pub reason: McpHeadersRefreshRequiredReason,
5692 /// Unique identifier for this headers refresh request; used to respond via session.mcp.headers.handlePendingHeadersRefreshRequest()
5693 pub request_id: RequestId,
5694 /// Display name of the remote MCP server requesting headers
5695 pub server_name: String,
5696 /// URL of the remote MCP server requesting headers
5697 pub server_url: String,
5698}
5699
5700/// Session event "mcp.headers_refresh_completed". MCP headers refresh request completion notification
5701#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5702#[serde(rename_all = "camelCase")]
5703pub struct McpHeadersRefreshCompletedData {
5704 /// How the pending MCP headers refresh request resolved.
5705 pub outcome: McpHeadersRefreshCompletedOutcome,
5706 /// Request ID of the resolved headers refresh request
5707 pub request_id: RequestId,
5708}
5709
5710/// Session event "session.custom_notification". Opaque custom notification data. Consumers may branch on source and name, but payload semantics are source-defined.
5711#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5712#[serde(rename_all = "camelCase")]
5713pub struct SessionCustomNotificationData {
5714 /// Source-defined custom notification name
5715 pub name: String,
5716 /// Source-defined JSON payload for the custom notification
5717 pub payload: serde_json::Value,
5718 /// Namespace for the custom notification producer
5719 pub source: String,
5720 /// Optional source-defined string identifiers describing the payload subject
5721 #[serde(skip_serializing_if = "Option::is_none")]
5722 pub subject: Option<HashMap<String, String>>,
5723 /// Optional source-defined payload schema version
5724 #[serde(skip_serializing_if = "Option::is_none")]
5725 pub version: Option<i64>,
5726}
5727
5728/// Session event "ui.ephemeral_query". Ordered output and terminal state for a transient query that does not modify conversation history.
5729///
5730/// <div class="warning">
5731///
5732/// **Experimental.** This type is part of an experimental wire-protocol surface
5733/// and may change or be removed in future SDK or CLI releases.
5734///
5735/// </div>
5736#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5737#[serde(rename_all = "camelCase")]
5738pub struct UiEphemeralQueryData {
5739 /// Full response text, present for the `completed` phase.
5740 #[serde(skip_serializing_if = "Option::is_none")]
5741 pub answer: Option<String>,
5742 /// Ordered text delta, present for the `chunk` phase.
5743 #[serde(skip_serializing_if = "Option::is_none")]
5744 pub chunk: Option<String>,
5745 /// Model or transport failure message, present for the `failed` phase.
5746 #[serde(skip_serializing_if = "Option::is_none")]
5747 pub error: Option<String>,
5748 /// Current query lifecycle phase.
5749 pub phase: UIEphemeralQueryPhase,
5750 /// Runtime-minted query identifier.
5751 pub request_id: RequestId,
5752}
5753
5754/// Session event "external_tool.requested". External tool invocation request for client-side tool execution
5755#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5756#[serde(rename_all = "camelCase")]
5757pub struct ExternalToolRequestedData {
5758 /// Arguments to pass to the external tool
5759 #[serde(skip_serializing_if = "Option::is_none")]
5760 pub arguments: Option<serde_json::Value>,
5761 /// Stable provider identity captured with an extension-owned tool definition; hosts use it to route the request to the same provider that was offered to the model
5762 #[serde(skip_serializing_if = "Option::is_none")]
5763 pub provider_id: Option<String>,
5764 /// Unique identifier for this request; used to respond via session.respondToExternalTool()
5765 pub request_id: RequestId,
5766 /// Session ID that this external tool request belongs to
5767 pub session_id: SessionId,
5768 /// Tool call ID assigned to this external tool invocation
5769 pub tool_call_id: String,
5770 /// Name of the external tool to invoke
5771 pub tool_name: String,
5772 /// W3C Trace Context traceparent header for the execute_tool span
5773 #[serde(skip_serializing_if = "Option::is_none")]
5774 pub traceparent: Option<String>,
5775 /// W3C Trace Context tracestate header for the execute_tool span
5776 #[serde(skip_serializing_if = "Option::is_none")]
5777 pub tracestate: Option<String>,
5778 /// Active session working directory, when known.
5779 #[serde(skip_serializing_if = "Option::is_none")]
5780 pub working_directory: Option<String>,
5781}
5782
5783/// Session event "external_tool.completed". External tool completion notification signaling UI dismissal
5784#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5785#[serde(rename_all = "camelCase")]
5786pub struct ExternalToolCompletedData {
5787 /// Request ID of the resolved external tool request; clients should dismiss any UI for this request
5788 pub request_id: RequestId,
5789}
5790
5791/// Session event "command.queued". Queued slash command dispatch request for client execution
5792#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5793#[serde(rename_all = "camelCase")]
5794pub struct CommandQueuedData {
5795 /// The slash command text to be executed (e.g., /help, /clear)
5796 pub command: String,
5797 /// Unique identifier for this request; used to respond via session.respondToQueuedCommand()
5798 pub request_id: RequestId,
5799}
5800
5801/// Session event "command.execute". Registered command dispatch request routed to the owning client
5802#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5803#[serde(rename_all = "camelCase")]
5804pub struct CommandExecuteData {
5805 /// Raw argument string after the command name
5806 pub args: String,
5807 /// The full command text (e.g., /deploy production)
5808 pub command: String,
5809 /// Command name without leading /
5810 pub command_name: String,
5811 /// Unique identifier; used to respond via session.commands.handlePendingCommand()
5812 pub request_id: RequestId,
5813}
5814
5815/// Session event "command.completed". Queued command completion notification signaling UI dismissal
5816#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5817#[serde(rename_all = "camelCase")]
5818pub struct CommandCompletedData {
5819 /// Request ID of the resolved command request; clients should dismiss any UI for this request
5820 pub request_id: RequestId,
5821}
5822
5823/// Session event "auto_mode_switch.requested". Auto mode switch request notification requiring user approval
5824#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5825#[serde(rename_all = "camelCase")]
5826pub struct AutoModeSwitchRequestedData {
5827 /// The rate limit error code that triggered this request
5828 #[serde(skip_serializing_if = "Option::is_none")]
5829 pub error_code: Option<String>,
5830 /// Unique identifier for this request; used to respond via session.respondToAutoModeSwitch()
5831 pub request_id: RequestId,
5832 /// Seconds until the rate limit resets, when known. Lets clients render a humanized reset time alongside the prompt.
5833 #[serde(skip_serializing_if = "Option::is_none")]
5834 pub retry_after_seconds: Option<i64>,
5835}
5836
5837/// Session event "auto_mode_switch.completed". Auto mode switch completion notification
5838#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5839#[serde(rename_all = "camelCase")]
5840pub struct AutoModeSwitchCompletedData {
5841 /// Request ID of the resolved request; clients should dismiss any UI for this request
5842 pub request_id: RequestId,
5843 /// The user's auto-mode-switch choice
5844 pub response: AutoModeSwitchResponse,
5845}
5846
5847/// Session event "session_limits_exhausted.requested". Session limit exhaustion notification requiring user action.
5848#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5849#[serde(rename_all = "camelCase")]
5850pub struct SessionLimitsExhaustedRequestedData {
5851 /// Configured max AI Credits for the current accounting window.
5852 pub max_ai_credits: f64,
5853 /// Unique identifier for this request; used to respond via session.ui.handlePendingSessionLimitsExhausted().
5854 pub request_id: RequestId,
5855 /// AI Credits already consumed in the current accounting window.
5856 pub used_ai_credits: f64,
5857}
5858
5859/// The user's selected action for an exhausted session limit.
5860#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5861#[serde(rename_all = "camelCase")]
5862pub struct SessionLimitsExhaustedResponse {
5863 /// Action selected by the user.
5864 pub action: SessionLimitsExhaustedResponseAction,
5865 /// AI Credits to add to the current max when action is 'add'.
5866 #[serde(skip_serializing_if = "Option::is_none")]
5867 pub additional_ai_credits: Option<f64>,
5868 /// New absolute max AI Credits when action is 'set'.
5869 #[serde(skip_serializing_if = "Option::is_none")]
5870 pub max_ai_credits: Option<f64>,
5871}
5872
5873/// Session event "session_limits_exhausted.completed". Session limit exhaustion prompt completion notification.
5874#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5875#[serde(rename_all = "camelCase")]
5876pub struct SessionLimitsExhaustedCompletedData {
5877 /// Request ID of the resolved request; clients should dismiss any UI for this request.
5878 pub request_id: RequestId,
5879 /// The user's selected session-limit action.
5880 pub response: SessionLimitsExhaustedResponse,
5881}
5882
5883/// Session event "session.auto_mode_resolved". Auto Intent resolution: the concrete model the session settled on for the first prompt of an auto-mode session, and why. Lets SDK clients render the chosen model and the full reason it was picked. The core selection fields (chosenModel/reasoningBucket/categoryScores) are stable; the routing-analytics fields (predictedLabel/confidence/candidateModels) mirror the upstream intent service and may evolve, hence the event's experimental stability.
5884///
5885/// <div class="warning">
5886///
5887/// **Experimental.** This type is part of an experimental wire-protocol surface
5888/// and may change or be removed in future SDK or CLI releases.
5889///
5890/// </div>
5891#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5892#[serde(rename_all = "camelCase")]
5893pub struct SessionAutoModeResolvedData {
5894 /// Models offered to the router for this resolution
5895 #[serde(skip_serializing_if = "Option::is_none")]
5896 pub available_models: Option<Vec<String>>,
5897 /// Ordered candidate model list the router returned, when not a fallback
5898 #[serde(skip_serializing_if = "Option::is_none")]
5899 pub candidate_models: Option<Vec<String>>,
5900 /// Per-category classifier scores (0-1) behind the bucket: the granular HYDRA capability scores (reasoning, code_gen, debugging, tool_use), or the binary needs_reasoning/no_reasoning scores when HYDRA didn't run. Lets clients show a breakdown rather than just the bucket.
5901 #[serde(skip_serializing_if = "Option::is_none")]
5902 pub category_scores: Option<HashMap<String, f64>>,
5903 /// The concrete model the session will use after any intent refinement
5904 pub chosen_model: String,
5905 /// The chosen model's score shortfall relative to the top candidate
5906 #[serde(skip_serializing_if = "Option::is_none")]
5907 pub chosen_shortfall: Option<f64>,
5908 /// Classifier confidence for the predicted label, when available
5909 #[serde(skip_serializing_if = "Option::is_none")]
5910 pub confidence: Option<f64>,
5911 /// End-to-end client wait time for the router request in milliseconds
5912 #[serde(skip_serializing_if = "Option::is_none")]
5913 pub end_to_end_latency_ms: Option<f64>,
5914 /// Whether the router fell back to the standard Auto selection
5915 #[serde(skip_serializing_if = "Option::is_none")]
5916 pub fallback: Option<bool>,
5917 /// Server-provided reason for falling back, when available
5918 #[serde(skip_serializing_if = "Option::is_none")]
5919 pub fallback_reason: Option<String>,
5920 /// Whether the routed prompt contained an image
5921 #[serde(skip_serializing_if = "Option::is_none")]
5922 pub has_image: Option<bool>,
5923 /// The predicted classifier label (e.g. `needs_reasoning`), when available
5924 #[serde(skip_serializing_if = "Option::is_none")]
5925 pub predicted_label: Option<String>,
5926 /// Coarse request-difficulty bucket, for explaining why a model was chosen ("picked X because this looks like high-reasoning work")
5927 #[serde(skip_serializing_if = "Option::is_none")]
5928 pub reasoning_bucket: Option<AutoModeResolvedReasoningBucket>,
5929 /// Server-reported router processing time in milliseconds
5930 #[serde(skip_serializing_if = "Option::is_none")]
5931 pub router_latency_ms: Option<f64>,
5932 /// The routing method the server applied, when Auto Intent ran
5933 #[serde(skip_serializing_if = "Option::is_none")]
5934 pub routing_method: Option<String>,
5935 /// Whether a sticky model choice overrode the router result
5936 #[serde(skip_serializing_if = "Option::is_none")]
5937 pub sticky_override: Option<bool>,
5938}
5939
5940/// Session event "session.managed_settings_resolved". Enterprise managed-settings resolution: the effective managed settings the session applied and which channels contributed, so SDK clients can show users what is enterprise-managed. Fires whenever managed policy is (re)applied — at session start, on resume, and on account switch. This is an ephemeral live snapshot (delivered to subscribers but not persisted to the session event log), because at session start it resolves before `session.start` is emitted. Device values take precedence over server values, then the policy helper, per ordinary key, while permissions compose restrictively across device, server, policy-helper, and SDK-client layers. The account-scoped `getManagedSettings()` API does not include session-local client injection. Marked experimental while the managed-settings surface stabilizes.
5941///
5942/// <div class="warning">
5943///
5944/// **Experimental.** This type is part of an experimental wire-protocol surface
5945/// and may change or be removed in future SDK or CLI releases.
5946///
5947/// </div>
5948#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5949#[serde(rename_all = "camelCase")]
5950pub struct SessionManagedSettingsResolvedData {
5951 /// Whether enterprise policy disables bypass-permissions ("yolo") mode for this session. Deny-wins across layers, and forced on when `failClosed` is true.
5952 pub bypass_permissions_disabled: bool,
5953 /// Whether a session-local permissions layer injected by the SDK host was present
5954 #[serde(skip_serializing_if = "Option::is_none")]
5955 pub client_managed: Option<bool>,
5956 /// Whether an actual device MDM/plist/registry/file managed-settings layer was present
5957 pub device_managed: bool,
5958 /// Whether managed policy could not be determined (e.g. a failed server fetch) and the session fell back to the fail-closed restriction. When true, restrictions such as disabling bypass-permissions are enforced even though `settings` may be absent.
5959 pub fail_closed: bool,
5960 /// The setting keys under enterprise management in the effective managed settings (e.g. `model`, `enabledPlugins`, `permissions`). Empty when no managed settings are in force.
5961 pub managed_keys: Vec<String>,
5962 /// Whether at least two managed sources supplied permission allowlists, so enforcement intersects them and the flattened settings payload omits `permissions.allow`.
5963 #[serde(skip_serializing_if = "Option::is_none")]
5964 pub permissions_allow_intersected: Option<bool>,
5965 /// Whether the policy-helper managed-settings layer was present. The policy helper is the weakest channel: it fills keys no enterprise source set and can never replace one.
5966 #[serde(skip_serializing_if = "Option::is_none")]
5967 pub policy_helper_managed: Option<bool>,
5968 /// Whether the effective sandbox policy forces the sandbox on *only* because managed policy could not be determined, rather than because the policy requires it. Lets clients tell a user whose `--no-sandbox` was overridden that the sandbox stayed on as a fail-closed fallback, instead of attributing it to an administrator who set no such policy.
5969 #[serde(skip_serializing_if = "Option::is_none")]
5970 pub sandbox_enabled_by_undetermined_policy: Option<bool>,
5971 /// Whether the server (account/org) managed-settings layer was present
5972 pub server_managed: bool,
5973 /// The effective (resolved) managed settings values, so clients can render exactly what is enforced. Absent when no managed policy is in force.
5974 #[serde(skip_serializing_if = "Option::is_none")]
5975 pub settings: Option<serde_json::Value>,
5976 /// Channel summary: `server`, `device`, `client`, or `policyHelper` when exactly one channel contributed; `mixed` when multiple channels contributed; otherwise `none`. Consult the per-channel booleans for exact provenance.
5977 pub source: ManagedSettingsResolvedSource,
5978}
5979
5980/// Session event "session.managed_settings_enforced". Runtime enforcement of enterprise managed settings: fires when the session blocks or caps a runtime action because enterprise policy governs it, so SDK clients can explain *why* an action was governed. Unlike `session.managed_settings_resolved` (which reports *what* is managed), this reports a concrete governed action — e.g. a user or host tried to turn on a bypass-permissions escalation while policy disables it. Emitted live (not persisted to the session event log) on user/host-initiated attempts only, never for silent policy application. Marked experimental while the managed-settings surface stabilizes.
5981///
5982/// <div class="warning">
5983///
5984/// **Experimental.** This type is part of an experimental wire-protocol surface
5985/// and may change or be removed in future SDK or CLI releases.
5986///
5987/// </div>
5988#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5989#[serde(rename_all = "camelCase")]
5990pub struct SessionManagedSettingsEnforcedData {
5991 /// The category of runtime action that managed policy governed.
5992 pub action: ManagedSettingsEnforcedAction,
5993 /// For a `bypass_permissions_blocked` action, which permission-escalation primitive was refused. Absent for actions without a specific escalation primitive.
5994 #[serde(skip_serializing_if = "Option::is_none")]
5995 pub escalation: Option<ManagedSettingsEnforcedEscalation>,
5996 /// Whether the enforcement was forced by fail-closed handling (managed policy could not be determined) rather than an explicit managed setting. When true, `setting` still names the restriction that was applied.
5997 pub fail_closed: bool,
5998 /// A human-readable explanation of why the action was governed, suitable for surfacing to the user.
5999 pub message: String,
6000 /// The managed setting key responsible for the enforcement (e.g. `permissions.disableBypassPermissionsMode`).
6001 pub setting: String,
6002}
6003
6004/// A single slash command available in the session, as listed by the `commands.changed` event.
6005#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6006#[serde(rename_all = "camelCase")]
6007pub struct CommandsChangedCommand {
6008 /// Optional human-readable command description.
6009 #[serde(skip_serializing_if = "Option::is_none")]
6010 pub description: Option<String>,
6011 /// Slash command name without the leading slash.
6012 pub name: String,
6013}
6014
6015/// Session event "commands.changed". SDK command registration change notification
6016#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6017#[serde(rename_all = "camelCase")]
6018pub struct CommandsChangedData {
6019 /// Current list of registered SDK commands
6020 pub commands: Vec<CommandsChangedCommand>,
6021}
6022
6023/// UI capability changes
6024#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6025#[serde(rename_all = "camelCase")]
6026pub struct CapabilitiesChangedUI {
6027 /// Whether canvas rendering is now supported
6028 #[serde(skip_serializing_if = "Option::is_none")]
6029 pub canvases: Option<bool>,
6030 /// Whether elicitation is now supported
6031 #[serde(skip_serializing_if = "Option::is_none")]
6032 pub elicitation: Option<bool>,
6033 /// Whether MCP Apps (SEP-1865) UI passthrough is now supported
6034 #[serde(skip_serializing_if = "Option::is_none")]
6035 pub mcp_apps: Option<bool>,
6036}
6037
6038/// Session event "capabilities.changed". Session capability change notification
6039#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6040#[serde(rename_all = "camelCase")]
6041pub struct CapabilitiesChangedData {
6042 /// UI capability changes
6043 #[serde(skip_serializing_if = "Option::is_none")]
6044 pub ui: Option<CapabilitiesChangedUI>,
6045}
6046
6047/// Session event "exit_plan_mode.requested". Plan approval request with plan content and available user actions
6048#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6049#[serde(rename_all = "camelCase")]
6050pub struct ExitPlanModeRequestedData {
6051 /// Available actions the user can take
6052 pub actions: Vec<ExitPlanModeAction>,
6053 /// Model the session had selected when the plan was authored, when one is known
6054 #[serde(skip_serializing_if = "Option::is_none")]
6055 pub model: Option<String>,
6056 /// Full content of the plan file
6057 pub plan_content: String,
6058 /// Recommended action to preselect for the user
6059 pub recommended_action: ExitPlanModeAction,
6060 /// Unique identifier for this request; used to respond via session.respondToExitPlanMode()
6061 pub request_id: RequestId,
6062 /// Summary of the plan that was created
6063 pub summary: String,
6064}
6065
6066/// Session event "exit_plan_mode.completed". Plan mode exit completion with the user's approval decision and optional feedback
6067#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6068#[serde(rename_all = "camelCase")]
6069pub struct ExitPlanModeCompletedData {
6070 /// Whether the plan was approved by the user
6071 #[serde(skip_serializing_if = "Option::is_none")]
6072 pub approved: Option<bool>,
6073 /// Whether edits should be auto-approved without confirmation
6074 #[serde(skip_serializing_if = "Option::is_none")]
6075 pub auto_approve_edits: Option<bool>,
6076 /// Free-form feedback from the user if they requested changes to the plan
6077 #[serde(skip_serializing_if = "Option::is_none")]
6078 pub feedback: Option<String>,
6079 /// Request ID of the resolved exit plan mode request; clients should dismiss any UI for this request
6080 pub request_id: RequestId,
6081 /// Action selected by the user
6082 #[serde(skip_serializing_if = "Option::is_none")]
6083 pub selected_action: Option<ExitPlanModeAction>,
6084}
6085
6086/// Session event "session.tools_updated". Payload of `session.tools_updated` identifying the model whose resolved tools were updated.
6087#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6088#[serde(rename_all = "camelCase")]
6089pub struct SessionToolsUpdatedData {
6090 /// Identifier of the model the resolved tools apply to.
6091 pub model: String,
6092}
6093
6094/// Session event "session.background_tasks_changed". Empty payload for `session.background_tasks_changed`, indicating background task state changed.
6095#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6096#[serde(rename_all = "camelCase")]
6097pub struct SessionBackgroundTasksChangedData {}
6098
6099/// Session event "factory.run_updated". Ephemeral invalidation signal for a changed factory run.
6100///
6101/// <div class="warning">
6102///
6103/// **Experimental.** This type is part of an experimental wire-protocol surface
6104/// and may change or be removed in future SDK or CLI releases.
6105///
6106/// </div>
6107#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6108#[serde(rename_all = "camelCase")]
6109pub struct FactoryRunUpdatedData {
6110 /// Monotonic revision now available for the run.
6111 pub revision: i64,
6112 /// Factory run identifier.
6113 pub run_id: String,
6114}
6115
6116/// Session event "factory.run_started". Ephemeral signal that a factory run attempt began executing.
6117///
6118/// <div class="warning">
6119///
6120/// **Experimental.** This type is part of an experimental wire-protocol surface
6121/// and may change or be removed in future SDK or CLI releases.
6122///
6123/// </div>
6124#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6125#[serde(rename_all = "camelCase")]
6126pub struct FactoryRunStartedData {
6127 /// Attempt number this start committed; a resumed run increments it.
6128 pub attempt: i64,
6129 /// Name of the factory this run executes. Low cardinality by construction.
6130 pub factory_name: String,
6131 /// Identifier of the factory run that started.
6132 pub run_id: String,
6133}
6134
6135/// Session event "factory.run_settled". Ephemeral signal that a factory run reached a terminal status.
6136///
6137/// <div class="warning">
6138///
6139/// **Experimental.** This type is part of an experimental wire-protocol surface
6140/// and may change or be removed in future SDK or CLI releases.
6141///
6142/// </div>
6143#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6144#[serde(rename_all = "camelCase")]
6145pub struct FactoryRunSettledData {
6146 /// AI credits this run consumed, in nano-AIU.
6147 pub consumed_nano_aiu: i64,
6148 /// Subagents this run consumed against its limits.
6149 pub consumed_subagents: i64,
6150 /// Active milliseconds accumulated across every attempt of this run.
6151 pub elapsed_ms: i64,
6152 /// Typed failure class recorded on the run, when it failed with one (e.g. `factory_limit_reached`).
6153 #[serde(skip_serializing_if = "Option::is_none")]
6154 pub failure_type: Option<String>,
6155 /// Identifier of the factory run that settled.
6156 pub run_id: String,
6157 /// Terminal status the run committed.
6158 pub status: FactoryRunSettledStatus,
6159}
6160
6161/// A single resolved skill in `session.skills_loaded`, including source, invocability, enabled state, path, and argument hint.
6162#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6163#[serde(rename_all = "camelCase")]
6164pub struct SkillsLoadedSkill {
6165 /// Optional freeform hint describing the skill's expected arguments, from the `argument-hint` frontmatter field
6166 #[serde(skip_serializing_if = "Option::is_none")]
6167 pub argument_hint: Option<String>,
6168 /// Canonical slash command name used to invoke the skill, without the leading '/'
6169 #[serde(skip_serializing_if = "Option::is_none")]
6170 pub command_name: Option<String>,
6171 /// Description of what the skill does
6172 pub description: String,
6173 /// Whether the skill is currently enabled
6174 pub enabled: bool,
6175 /// Unique identifier for the skill
6176 pub name: String,
6177 /// Absolute path to the skill file, if available
6178 #[serde(skip_serializing_if = "Option::is_none")]
6179 pub path: Option<String>,
6180 /// Source location type (e.g., project, personal-copilot, plugin, builtin, remote, sdk)
6181 pub source: SkillSource,
6182 /// Whether the skill can be invoked by the user as a slash command
6183 pub user_invocable: bool,
6184}
6185
6186/// Session event "session.skills_loaded". Payload of `session.skills_loaded` listing resolved skill metadata.
6187#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6188#[serde(rename_all = "camelCase")]
6189pub struct SessionSkillsLoadedData {
6190 /// Array of resolved skill metadata
6191 pub skills: Vec<SkillsLoadedSkill>,
6192}
6193
6194/// A single loaded custom agent in `session.custom_agents_updated`, with identity, source, tools, invocability, and authored model configuration.
6195#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6196#[serde(rename_all = "camelCase")]
6197pub struct CustomAgentsUpdatedAgent {
6198 /// Description of what the agent does
6199 pub description: String,
6200 /// Human-readable display name
6201 pub display_name: String,
6202 /// Unique identifier for the agent
6203 pub id: String,
6204 /// Model override for this agent, if set
6205 #[serde(skip_serializing_if = "Option::is_none")]
6206 pub model: Option<String>,
6207 /// Whether authored models are preferences or required constraints
6208 #[serde(skip_serializing_if = "Option::is_none")]
6209 pub model_policy: Option<AgentModelPolicy>,
6210 /// Authored model ids in priority order, if configured
6211 #[serde(skip_serializing_if = "Option::is_none")]
6212 pub models: Option<Vec<String>>,
6213 /// Internal name of the agent
6214 pub name: String,
6215 /// Source location: user, project, inherited, remote, or plugin
6216 pub source: String,
6217 /// List of tool names available to this agent, or null when all tools are available
6218 pub tools: Option<Vec<String>>,
6219 /// Whether the agent can be selected by the user
6220 pub user_invocable: bool,
6221}
6222
6223/// Session event "session.custom_agents_updated". Payload of `session.custom_agents_updated` with loaded custom agents plus non-fatal warnings and fatal errors.
6224#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6225#[serde(rename_all = "camelCase")]
6226pub struct SessionCustomAgentsUpdatedData {
6227 /// Array of loaded custom agent metadata
6228 pub agents: Vec<CustomAgentsUpdatedAgent>,
6229 /// Fatal errors from agent loading
6230 pub errors: Vec<String>,
6231 /// Non-fatal warnings from agent loading
6232 pub warnings: Vec<String>,
6233}
6234
6235/// Server-advertised metadata learned through modern discovery or legacy initialization.
6236#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6237#[serde(rename_all = "camelCase")]
6238pub struct McpServerMetadata {
6239 /// Non-empty natural-language guidance for using the server, or null when the server omitted instructions or advertised an empty string.
6240 pub instructions: Option<String>,
6241}
6242
6243/// A single MCP server status summary in `session.mcp_servers_loaded`, including name, status, source, transport, and plugin metadata.
6244#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6245#[serde(rename_all = "camelCase")]
6246pub struct McpServersLoadedServer {
6247 /// Error message if the server failed to connect
6248 #[serde(skip_serializing_if = "Option::is_none")]
6249 pub error: Option<String>,
6250 /// Server name (config key)
6251 pub name: String,
6252 /// Name of the plugin that supplied the effective MCP server config, only when source is plugin
6253 #[serde(skip_serializing_if = "Option::is_none")]
6254 pub plugin_name: Option<String>,
6255 /// Version of the plugin that supplied the effective MCP server config, only when source is plugin
6256 #[serde(skip_serializing_if = "Option::is_none")]
6257 pub plugin_version: Option<String>,
6258 /// Server-advertised metadata for a connected server. Omitted when no live connection metadata is available, including while pending or when failed, disabled, stopped, or not configured.
6259 #[serde(skip_serializing_if = "Option::is_none")]
6260 pub server_metadata: Option<McpServerMetadata>,
6261 /// Configuration source: user, workspace, plugin, or builtin
6262 #[serde(skip_serializing_if = "Option::is_none")]
6263 pub source: Option<McpServerSource>,
6264 /// Connection status: connected, failed, needs-auth, pending, disabled, stopped, or not_configured
6265 pub status: McpServerStatus,
6266 /// Transport mechanism: stdio, http, sse (deprecated), or memory (in-process MCP server)
6267 #[serde(skip_serializing_if = "Option::is_none")]
6268 pub transport: Option<McpServerTransport>,
6269}
6270
6271/// Session event "session.mcp_servers_loaded". Payload of `session.mcp_servers_loaded` listing MCP server status summaries.
6272#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6273#[serde(rename_all = "camelCase")]
6274pub struct SessionMcpServersLoadedData {
6275 /// Array of MCP server status summaries
6276 pub servers: Vec<McpServersLoadedServer>,
6277}
6278
6279/// Session event "session.mcp_server_status_changed". Payload of `session.mcp_server_status_changed` for one MCP server's status and optional failure error.
6280#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6281#[serde(rename_all = "camelCase")]
6282pub struct SessionMcpServerStatusChangedData {
6283 /// Error message if the server entered a failed state
6284 #[serde(skip_serializing_if = "Option::is_none")]
6285 pub error: Option<String>,
6286 /// Name of the MCP server whose status changed
6287 pub server_name: String,
6288 /// Connection status: connected, failed, needs-auth, pending, disabled, stopped, or not_configured
6289 pub status: McpServerStatus,
6290}
6291
6292/// Session event "session.mcp_server_removed". Payload of `session.mcp_server_removed` identifying an MCP server the graph no longer runs.
6293#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6294#[serde(rename_all = "camelCase")]
6295pub struct SessionMcpServerRemovedData {
6296 /// Name of the MCP server that was removed from the graph
6297 pub server_name: String,
6298}
6299
6300/// Session event "session.mcp_server_needs_reconnect". Payload of `session.mcp_server_needs_reconnect` identifying an MCP server whose connection must be re-established.
6301#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6302#[serde(rename_all = "camelCase")]
6303pub struct SessionMcpServerNeedsReconnectData {
6304 /// Name of the MCP server that needs to reconnect
6305 pub server_name: String,
6306}
6307
6308/// Session event "mcp.tools.list_changed". Payload identifying the MCP server associated with a list change.
6309#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6310#[serde(rename_all = "camelCase")]
6311pub struct McpToolsListChangedData {
6312 /// Name of the MCP server whose list changed
6313 pub server_name: String,
6314}
6315
6316/// Session event "mcp.resources.list_changed". Payload identifying the MCP server associated with a list change.
6317#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6318#[serde(rename_all = "camelCase")]
6319pub struct McpResourcesListChangedData {
6320 /// Name of the MCP server whose list changed
6321 pub server_name: String,
6322}
6323
6324/// Session event "mcp.prompts.list_changed". Payload identifying the MCP server associated with a list change.
6325#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6326#[serde(rename_all = "camelCase")]
6327pub struct McpPromptsListChangedData {
6328 /// Name of the MCP server whose list changed
6329 pub server_name: String,
6330}
6331
6332/// A single extension discovered by `session.extensions_loaded`, including qualified ID, source, and current status.
6333#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6334#[serde(rename_all = "camelCase")]
6335pub struct ExtensionsLoadedExtension {
6336 /// Source-qualified extension ID (e.g., 'project:my-ext', 'user:auth-helper', 'plugin:my-plugin:my-ext')
6337 pub id: String,
6338 /// Extension name (directory name)
6339 pub name: String,
6340 /// Discovery source
6341 pub source: ExtensionsLoadedExtensionSource,
6342 /// Current status: running, disabled, failed, or starting
6343 pub status: ExtensionsLoadedExtensionStatus,
6344}
6345
6346/// Session event "session.extensions_loaded". Payload of `session.extensions_loaded` listing discovered extensions and their statuses.
6347#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6348#[serde(rename_all = "camelCase")]
6349pub struct SessionExtensionsLoadedData {
6350 /// Array of discovered extensions and their status
6351 pub extensions: Vec<ExtensionsLoadedExtension>,
6352}
6353
6354/// Session event "session.canvas.opened". Payload of `session.canvas.opened` with canvas instance and provider IDs plus optional icon, title, status, URL, and input.
6355///
6356/// <div class="warning">
6357///
6358/// **Experimental.** This type is part of an experimental wire-protocol surface
6359/// and may change or be removed in future SDK or CLI releases.
6360///
6361/// </div>
6362#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6363#[serde(rename_all = "camelCase")]
6364pub struct SessionCanvasOpenedData {
6365 /// Provider-local canvas identifier
6366 pub canvas_id: String,
6367 /// Owning provider identifier
6368 pub extension_id: String,
6369 /// Owning extension display name, when available
6370 #[serde(skip_serializing_if = "Option::is_none")]
6371 pub extension_name: Option<String>,
6372 /// Host-local PNG path for the canvas icon, when supplied
6373 #[serde(skip_serializing_if = "Option::is_none")]
6374 pub icon: Option<String>,
6375 /// Input supplied when the instance was opened
6376 #[serde(skip_serializing_if = "Option::is_none")]
6377 pub input: Option<serde_json::Value>,
6378 /// Stable caller-supplied canvas instance identifier
6379 pub instance_id: String,
6380 /// Provider-supplied status text
6381 #[serde(skip_serializing_if = "Option::is_none")]
6382 pub status: Option<String>,
6383 /// Rendered title
6384 #[serde(skip_serializing_if = "Option::is_none")]
6385 pub title: Option<String>,
6386 /// URL for web-rendered canvases
6387 #[serde(skip_serializing_if = "Option::is_none")]
6388 pub url: Option<String>,
6389}
6390
6391/// A single action within a canvas declaration, with its name, optional description, and optional input schema.
6392///
6393/// <div class="warning">
6394///
6395/// **Experimental.** This type is part of an experimental wire-protocol surface
6396/// and may change or be removed in future SDK or CLI releases.
6397///
6398/// </div>
6399#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6400#[serde(rename_all = "camelCase")]
6401pub struct CanvasRegistryChangedCanvasAction {
6402 /// Action description
6403 #[serde(skip_serializing_if = "Option::is_none")]
6404 pub description: Option<String>,
6405 /// JSON Schema for action input
6406 #[serde(skip_serializing_if = "Option::is_none")]
6407 pub input_schema: Option<serde_json::Value>,
6408 /// Action name
6409 pub name: String,
6410}
6411
6412/// A single canvas declaration in `session.canvas.registry_changed`, including provider IDs, display metadata, input schema, and actions.
6413///
6414/// <div class="warning">
6415///
6416/// **Experimental.** This type is part of an experimental wire-protocol surface
6417/// and may change or be removed in future SDK or CLI releases.
6418///
6419/// </div>
6420#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6421#[serde(rename_all = "camelCase")]
6422pub struct CanvasRegistryChangedCanvas {
6423 /// Actions the agent or host may invoke
6424 #[serde(skip_serializing_if = "Option::is_none")]
6425 pub actions: Option<Vec<CanvasRegistryChangedCanvasAction>>,
6426 /// Provider-local canvas identifier
6427 pub canvas_id: String,
6428 /// Short, single-sentence description shown to the agent in canvas catalogs.
6429 pub description: String,
6430 /// Human-readable canvas name
6431 pub display_name: String,
6432 /// Owning provider identifier
6433 pub extension_id: String,
6434 /// Owning extension display name, when available
6435 #[serde(skip_serializing_if = "Option::is_none")]
6436 pub extension_name: Option<String>,
6437 /// Host-local PNG path for the canvas icon, when supplied
6438 #[serde(skip_serializing_if = "Option::is_none")]
6439 pub icon: Option<String>,
6440 /// JSON Schema for canvas open input
6441 #[serde(skip_serializing_if = "Option::is_none")]
6442 pub input_schema: Option<serde_json::Value>,
6443}
6444
6445/// Session event "session.canvas.registry_changed". Payload of `session.canvas.registry_changed` listing the canvas declarations currently available.
6446///
6447/// <div class="warning">
6448///
6449/// **Experimental.** This type is part of an experimental wire-protocol surface
6450/// and may change or be removed in future SDK or CLI releases.
6451///
6452/// </div>
6453#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6454#[serde(rename_all = "camelCase")]
6455pub struct SessionCanvasRegistryChangedData {
6456 /// Canvas declarations currently available
6457 pub canvases: Vec<CanvasRegistryChangedCanvas>,
6458}
6459
6460/// Session event "session.canvas.closed". Payload of `session.canvas.closed` with the closed canvas instance ID, provider ID, and canvas ID.
6461///
6462/// <div class="warning">
6463///
6464/// **Experimental.** This type is part of an experimental wire-protocol surface
6465/// and may change or be removed in future SDK or CLI releases.
6466///
6467/// </div>
6468#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6469#[serde(rename_all = "camelCase")]
6470pub struct SessionCanvasClosedData {
6471 /// Provider-local canvas identifier
6472 pub canvas_id: String,
6473 /// Owning provider identifier
6474 pub extension_id: String,
6475 /// Stable caller-supplied identifier of the canvas instance that was closed
6476 pub instance_id: String,
6477}
6478
6479/// Session event "session.canvas.unavailable". Transient signal that an open canvas instance's provider has dropped (for example the extension is reloading mid-session). The host should keep the panel mounted and surface a reconnecting affordance rather than tearing it down; a subsequent `session.canvas.opened` for the same instanceId clears the affordance once the provider reconnects with a fresh url. Ephemeral and never persisted, so it is never replayed on cold resume.
6480///
6481/// <div class="warning">
6482///
6483/// **Experimental.** This type is part of an experimental wire-protocol surface
6484/// and may change or be removed in future SDK or CLI releases.
6485///
6486/// </div>
6487#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6488#[serde(rename_all = "camelCase")]
6489pub struct SessionCanvasUnavailableData {
6490 /// Provider-local canvas identifier
6491 pub canvas_id: String,
6492 /// Owning provider identifier
6493 pub extension_id: String,
6494 /// Stable caller-supplied identifier of the canvas instance whose provider became unavailable
6495 pub instance_id: String,
6496}
6497
6498/// Session event "session.canvas.recorded". Durable record that a canvas instance is open, used to restore open canvases on cold session resume. Intentionally omits the transient url and availability.
6499///
6500/// <div class="warning">
6501///
6502/// **Experimental.** This type is part of an experimental wire-protocol surface
6503/// and may change or be removed in future SDK or CLI releases.
6504///
6505/// </div>
6506#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6507#[serde(rename_all = "camelCase")]
6508pub struct SessionCanvasRecordedData {
6509 /// Provider-local canvas identifier
6510 pub canvas_id: String,
6511 /// Owning provider identifier
6512 pub extension_id: String,
6513 /// Input supplied when the instance was opened
6514 #[serde(skip_serializing_if = "Option::is_none")]
6515 pub input: Option<serde_json::Value>,
6516 /// Stable caller-supplied canvas instance identifier
6517 pub instance_id: String,
6518 /// Rendered title
6519 #[serde(skip_serializing_if = "Option::is_none")]
6520 pub title: Option<String>,
6521}
6522
6523/// Session event "session.canvas.removed". Durable record that a canvas instance was closed, superseding a prior instance_recorded during resume replay.
6524///
6525/// <div class="warning">
6526///
6527/// **Experimental.** This type is part of an experimental wire-protocol surface
6528/// and may change or be removed in future SDK or CLI releases.
6529///
6530/// </div>
6531#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6532#[serde(rename_all = "camelCase")]
6533pub struct SessionCanvasRemovedData {
6534 /// Provider-local canvas identifier
6535 pub canvas_id: String,
6536 /// Owning provider identifier
6537 pub extension_id: String,
6538 /// Stable caller-supplied identifier of the canvas instance that was closed
6539 pub instance_id: String,
6540}
6541
6542/// Session event "session.extensions.attachments_pushed". Payload of `session.extensions.attachments_pushed` with extension-contributed attachments for the next send.
6543#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6544#[serde(rename_all = "camelCase")]
6545pub struct SessionExtensionsAttachmentsPushedData {
6546 /// Attachments contributed by an extension; the host should surface these as composer pills and forward them via the next session.send call.
6547 pub attachments: Vec<serde_json::Value>,
6548}
6549
6550/// Set when the underlying tools/call threw an error before returning a CallToolResult
6551#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6552#[serde(rename_all = "camelCase")]
6553pub struct McpAppToolCallCompleteError {
6554 /// Human-readable error message
6555 pub message: String,
6556}
6557
6558/// MCP App tool `_meta.ui` resource URI and SEP-1865 visibility captured with an `mcp_app.tool_call_complete` result.
6559#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6560#[serde(rename_all = "camelCase")]
6561pub struct McpAppToolCallCompleteToolMetaUI {
6562 /// `ui://` URI declared by the tool's `_meta.ui.resourceUri`
6563 #[serde(skip_serializing_if = "Option::is_none")]
6564 pub resource_uri: Option<String>,
6565 /// Tool visibility per SEP-1865 (typically a subset of `["model","app"]`)
6566 #[serde(skip_serializing_if = "Option::is_none")]
6567 pub visibility: Option<Vec<String>>,
6568}
6569
6570/// 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.
6571#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6572#[serde(rename_all = "camelCase")]
6573pub struct McpAppToolCallCompleteToolMeta {
6574 /// MCP App tool `_meta.ui` resource URI and SEP-1865 visibility captured with an `mcp_app.tool_call_complete` result.
6575 #[serde(skip_serializing_if = "Option::is_none")]
6576 pub ui: Option<McpAppToolCallCompleteToolMetaUI>,
6577}
6578
6579/// Session event "mcp_app.tool_call_complete". MCP App view called a tool on a connected MCP server (SEP-1865)
6580#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6581#[serde(rename_all = "camelCase")]
6582pub struct McpAppToolCallCompleteData {
6583 /// Arguments passed to the tool by the app view, if any
6584 #[serde(skip_serializing_if = "Option::is_none")]
6585 pub arguments: Option<HashMap<String, serde_json::Value>>,
6586 /// Wall-clock duration of the underlying tools/call in milliseconds
6587 pub duration_ms: f64,
6588 /// Set when the underlying tools/call threw an error before returning a CallToolResult
6589 #[serde(skip_serializing_if = "Option::is_none")]
6590 pub error: Option<McpAppToolCallCompleteError>,
6591 /// Standard MCP CallToolResult returned by the server. Present whether or not the call set isError.
6592 #[serde(skip_serializing_if = "Option::is_none")]
6593 pub result: Option<HashMap<String, serde_json::Value>>,
6594 /// Name of the MCP server hosting the tool
6595 pub server_name: String,
6596 /// True when the call completed without throwing AND the MCP CallToolResult did not set isError
6597 pub success: bool,
6598 /// 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.
6599 #[serde(skip_serializing_if = "Option::is_none")]
6600 pub tool_meta: Option<McpAppToolCallCompleteToolMeta>,
6601 /// MCP tool name that was invoked
6602 pub tool_name: String,
6603}
6604
6605/// Routing preference used when the session model is `auto`.
6606#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
6607pub enum AutoTier {
6608 /// Optimize for efficiency.
6609 #[serde(rename = "efficiency")]
6610 Efficiency,
6611 /// Balance efficiency and intelligence.
6612 #[serde(rename = "balance")]
6613 Balance,
6614 /// Optimize for intelligence.
6615 #[serde(rename = "intelligence")]
6616 Intelligence,
6617 /// Unknown variant for forward compatibility.
6618 #[default]
6619 #[serde(other)]
6620 Unknown,
6621}
6622
6623/// Hosting platform type of the repository (github or ado)
6624#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
6625pub enum WorkingDirectoryContextHostType {
6626 /// Repository is hosted on GitHub.
6627 #[serde(rename = "github")]
6628 GitHub,
6629 /// Repository is hosted on Azure DevOps.
6630 #[serde(rename = "ado")]
6631 Ado,
6632 /// Unknown variant for forward compatibility.
6633 #[default]
6634 #[serde(other)]
6635 Unknown,
6636}
6637
6638/// Allowed values for the `ContextTier` enumeration.
6639#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
6640pub enum ContextTier {
6641 /// Default context tier with standard context window size.
6642 #[serde(rename = "default")]
6643 Default,
6644 /// Extended context tier with a larger context window.
6645 #[serde(rename = "long_context")]
6646 LongContext,
6647 /// Unknown variant for forward compatibility.
6648 #[default]
6649 #[serde(other)]
6650 Unknown,
6651}
6652
6653/// Reasoning summary mode used for model calls, if applicable (e.g. "none", "concise", "detailed")
6654#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
6655pub enum ReasoningSummary {
6656 /// Do not request reasoning summaries from the model.
6657 #[serde(rename = "none")]
6658 None,
6659 /// Request a concise summary of the model's reasoning.
6660 #[serde(rename = "concise")]
6661 Concise,
6662 /// Request a detailed summary of the model's reasoning.
6663 #[serde(rename = "detailed")]
6664 Detailed,
6665 /// Unknown variant for forward compatibility.
6666 #[default]
6667 #[serde(other)]
6668 Unknown,
6669}
6670
6671/// Output verbosity level used for supported model calls (e.g. "low", "medium", "high")
6672#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
6673pub enum Verbosity {
6674 /// A terse response was requested.
6675 #[serde(rename = "low")]
6676 Low,
6677 /// A medium amount of response detail was requested.
6678 #[serde(rename = "medium")]
6679 Medium,
6680 /// A more detailed response was requested.
6681 #[serde(rename = "high")]
6682 High,
6683 /// Unknown variant for forward compatibility.
6684 #[default]
6685 #[serde(other)]
6686 Unknown,
6687}
6688
6689/// What the user must do to recover from a failure, named as an action rather than as one client's affordance. The runtime cannot know which affordance a client offers — a slash command, a settings pane, a link — so the accompanying message stays host-agnostic and each client renders its own copy from this value. Absent when the runtime knows of no action the user can take.
6690#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
6691pub enum RemediationAction {
6692 /// Authenticate again with the Copilot backend. The current credential is absent, expired, or rejected.
6693 #[serde(rename = "sign_in")]
6694 SignIn,
6695 /// Authenticate as a different account. The current account exists but lacks access to the requested resource.
6696 #[serde(rename = "switch_account")]
6697 SwitchAccount,
6698 /// Inspect which account is currently authenticated before deciding what to change.
6699 #[serde(rename = "show_account")]
6700 ShowAccount,
6701 /// Review or widen the sandbox policy. The blocked path or host is named by the accompanying message or by the tool result the action arrived with.
6702 #[serde(rename = "review_sandbox_policy")]
6703 ReviewSandboxPolicy,
6704 /// Permit outbound network access in the sandbox policy.
6705 #[serde(rename = "allow_sandbox_outbound")]
6706 AllowSandboxOutbound,
6707 /// Unknown variant for forward compatibility.
6708 #[default]
6709 #[serde(other)]
6710 Unknown,
6711}
6712
6713/// The session mode the agent is operating in
6714#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
6715pub enum SessionMode {
6716 /// The agent is responding interactively to the user.
6717 #[serde(rename = "interactive")]
6718 Interactive,
6719 /// The agent is preparing a plan before making changes.
6720 #[serde(rename = "plan")]
6721 Plan,
6722 /// The agent is working autonomously toward task completion.
6723 #[serde(rename = "autopilot")]
6724 Autopilot,
6725 /// Unknown variant for forward compatibility.
6726 #[default]
6727 #[serde(other)]
6728 Unknown,
6729}
6730
6731/// Who created the schedule: `user` (an explicit user action such as `/every` or `/after`) or `model` (the agent via the `manage_schedule` tool). Gates whether a scheduled skill that opted out of model invocation may fire: only user-created schedules may.
6732#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
6733pub enum ScheduleOrigin {
6734 /// The schedule was created by an explicit user action, such as `/every` or `/after`.
6735 #[serde(rename = "user")]
6736 User,
6737 /// The schedule was created by the agent via the `manage_schedule` tool.
6738 #[serde(rename = "model")]
6739 Model,
6740 /// Unknown variant for forward compatibility.
6741 #[default]
6742 #[serde(other)]
6743 Unknown,
6744}
6745
6746/// The type of operation performed on the autopilot objective state file
6747#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
6748pub enum AutopilotObjectiveChangedOperation {
6749 /// Autopilot objective state file was created for a new objective.
6750 #[serde(rename = "create")]
6751 Create,
6752 /// Autopilot objective state file was updated for an existing objective.
6753 #[serde(rename = "update")]
6754 Update,
6755 /// Autopilot objective state file was deleted or cleared.
6756 #[serde(rename = "delete")]
6757 Delete,
6758 /// Unknown variant for forward compatibility.
6759 #[default]
6760 #[serde(other)]
6761 Unknown,
6762}
6763
6764/// Current autopilot objective status, if one exists
6765#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
6766pub enum AutopilotObjectiveChangedStatus {
6767 /// Objective is active and can drive autopilot continuations.
6768 #[serde(rename = "active")]
6769 Active,
6770 /// Objective is paused and will not drive autopilot continuations.
6771 #[serde(rename = "paused")]
6772 Paused,
6773 /// Legacy objective state indicating the previous continuation cap was reached.
6774 #[serde(rename = "cap_reached")]
6775 CapReached,
6776 /// Objective was completed by the agent.
6777 #[serde(rename = "completed")]
6778 Completed,
6779 /// Unknown variant for forward compatibility.
6780 #[default]
6781 #[serde(other)]
6782 Unknown,
6783}
6784
6785/// Origin of an effective session model change.
6786#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
6787pub enum ModelChangeSource {
6788 /// The user selected a model directly with `/model <id>`.
6789 #[serde(rename = "model_command")]
6790 ModelCommand,
6791 /// The user selected the model with `/settings`.
6792 #[serde(rename = "settings_command")]
6793 SettingsCommand,
6794 /// The user selected the model with the `/config` alias.
6795 #[serde(rename = "config_command")]
6796 ConfigCommand,
6797 /// The user selected the model in the model picker, including the picker opened by bare `/model`.
6798 #[serde(rename = "model_picker")]
6799 ModelPicker,
6800 /// Organization-managed settings selected the model.
6801 #[serde(rename = "managed_settings")]
6802 ManagedSettings,
6803 /// Repository settings selected the model.
6804 #[serde(rename = "repo_settings")]
6805 RepoSettings,
6806 /// Startup model resolution selected the model.
6807 #[serde(rename = "startup")]
6808 Startup,
6809 /// Selecting an agent selected its configured model.
6810 #[serde(rename = "agent")]
6811 Agent,
6812 /// Entering, leaving, or reconfiguring plan mode selected the model.
6813 #[serde(rename = "plan_mode")]
6814 PlanMode,
6815 /// The runtime selected the model automatically, such as rate-limit recovery or refusal fallback.
6816 #[serde(rename = "automatic")]
6817 Automatic,
6818 /// An SDK or RPC caller selected the model.
6819 #[serde(rename = "sdk")]
6820 Sdk,
6821 /// Unknown variant for forward compatibility.
6822 #[default]
6823 #[serde(other)]
6824 Unknown,
6825}
6826
6827/// Terminal reason an Auto preference activation failed.
6828#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
6829pub enum AutoTierSwitchFailureReason {
6830 /// The candidate model was rejected by model policy.
6831 #[serde(rename = "policy_rejected")]
6832 PolicyRejected,
6833 /// The Auto routing request failed or returned an unusable response.
6834 #[serde(rename = "request_failed")]
6835 RequestFailed,
6836 /// The runtime could not prepare the Auto routing request.
6837 #[serde(rename = "setup_failed")]
6838 SetupFailed,
6839 /// The provider does not support Auto routing.
6840 #[serde(rename = "unsupported")]
6841 Unsupported,
6842 /// Unknown variant for forward compatibility.
6843 #[default]
6844 #[serde(other)]
6845 Unknown,
6846}
6847
6848/// Permission mode for the session.
6849///
6850/// <div class="warning">
6851///
6852/// **Experimental.** This type is part of an experimental wire-protocol surface
6853/// and may change or be removed in future SDK or CLI releases.
6854///
6855/// </div>
6856#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
6857pub enum PermissionMode {
6858 /// Permission requests follow the normal approval flow.
6859 #[serde(rename = "manual")]
6860 Manual,
6861 /// Permission requests include an LLM safety recommendation; clients may automatically approve requests judged acceptable.
6862 #[serde(rename = "assisted")]
6863 Assisted,
6864 /// Tool, path, and URL permission requests are automatically approved.
6865 #[serde(rename = "allow-all")]
6866 AllowAll,
6867 /// Unknown variant for forward compatibility.
6868 #[default]
6869 #[serde(other)]
6870 Unknown,
6871}
6872
6873/// The type of operation performed on the plan file
6874#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
6875pub enum PlanChangedOperation {
6876 /// The plan file was created.
6877 #[serde(rename = "create")]
6878 Create,
6879 /// The plan file was updated.
6880 #[serde(rename = "update")]
6881 Update,
6882 /// The plan file was deleted.
6883 #[serde(rename = "delete")]
6884 Delete,
6885 /// Unknown variant for forward compatibility.
6886 #[default]
6887 #[serde(other)]
6888 Unknown,
6889}
6890
6891/// Whether the file was newly created or updated
6892#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
6893pub enum WorkspaceFileChangedOperation {
6894 /// The workspace file was created.
6895 #[serde(rename = "create")]
6896 Create,
6897 /// The workspace file was updated.
6898 #[serde(rename = "update")]
6899 Update,
6900 /// Unknown variant for forward compatibility.
6901 #[default]
6902 #[serde(other)]
6903 Unknown,
6904}
6905
6906/// Origin type of the session being handed off
6907#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
6908pub enum HandoffSourceType {
6909 /// The handoff originated from a remote session.
6910 #[serde(rename = "remote")]
6911 Remote,
6912 /// The handoff originated from a local session.
6913 #[serde(rename = "local")]
6914 Local,
6915 /// Unknown variant for forward compatibility.
6916 #[default]
6917 #[serde(other)]
6918 Unknown,
6919}
6920
6921/// Whether the session ended normally ("routine") or due to a crash/fatal error ("error")
6922#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
6923pub enum ShutdownType {
6924 /// The session ended normally.
6925 #[serde(rename = "routine")]
6926 Routine,
6927 /// The session ended because of a crash or fatal error.
6928 #[serde(rename = "error")]
6929 Error,
6930 /// Unknown variant for forward compatibility.
6931 #[default]
6932 #[serde(other)]
6933 Unknown,
6934}
6935
6936/// What initiated a conversation compaction
6937#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
6938pub enum CompactionTrigger {
6939 /// Background compaction started automatically because context utilization crossed the background threshold.
6940 #[serde(rename = "threshold")]
6941 Threshold,
6942 /// Compaction forced by a context-limit model response (e.g. HTTP 413) before retrying the request.
6943 #[serde(rename = "context_limit_retry")]
6944 ContextLimitRetry,
6945 /// User-requested compaction, e.g. the /compact command or the history.compact API.
6946 #[serde(rename = "manual")]
6947 Manual,
6948 /// Emergency compaction triggered by high process memory usage.
6949 #[serde(rename = "memory_pressure")]
6950 MemoryPressure,
6951 /// Compaction requested while switching to a model with a smaller context window.
6952 #[serde(rename = "model_switch")]
6953 ModelSwitch,
6954 /// Unknown variant for forward compatibility.
6955 #[default]
6956 #[serde(other)]
6957 Unknown,
6958}
6959
6960/// Semantic result of evaluating a task completion request
6961#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
6962pub enum TaskCompletionOutcome {
6963 /// The completion request was accepted and the objective is complete.
6964 #[serde(rename = "completed")]
6965 Completed,
6966 /// The completion request was rejected because more work or validation remains.
6967 #[serde(rename = "continue")]
6968 Continue,
6969 /// Completion cannot proceed without intervention; the active objective is paused when one is identified.
6970 #[serde(rename = "blocked")]
6971 Blocked,
6972 /// Unknown variant for forward compatibility.
6973 #[default]
6974 #[serde(other)]
6975 Unknown,
6976}
6977
6978/// Structured terminal status from a tool completion event.
6979#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
6980pub enum CompletionReceiptToolStatus {
6981 /// The tool completed successfully.
6982 #[serde(rename = "success")]
6983 Success,
6984 /// The tool failed without a more specific structured status.
6985 #[serde(rename = "failure")]
6986 Failure,
6987 /// The tool exceeded its time budget.
6988 #[serde(rename = "timeout")]
6989 Timeout,
6990 /// The user rejected the tool call.
6991 #[serde(rename = "rejected")]
6992 Rejected,
6993 /// The permissions service denied the tool call.
6994 #[serde(rename = "denied")]
6995 Denied,
6996 /// Unknown variant for forward compatibility.
6997 #[default]
6998 #[serde(other)]
6999 Unknown,
7000}
7001
7002/// Runtime reason the completion decision was accepted.
7003#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7004pub enum CompletionReceiptStopReason {
7005 /// The model reached a natural terminal response.
7006 #[serde(rename = "natural")]
7007 Natural,
7008 /// A terminal tool ended the interaction.
7009 #[serde(rename = "terminal_tool")]
7010 TerminalTool,
7011 /// The configured agentStop continuation limit was reached.
7012 #[serde(rename = "agent_stop_block_limit")]
7013 AgentStopBlockLimit,
7014 /// Unknown variant for forward compatibility.
7015 #[default]
7016 #[serde(other)]
7017 Unknown,
7018}
7019
7020/// Kind of turn for which HydraFusion routing is running.
7021///
7022/// <div class="warning">
7023///
7024/// **Experimental.** This type is part of an experimental wire-protocol surface
7025/// and may change or be removed in future SDK or CLI releases.
7026///
7027/// </div>
7028#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7029pub enum FusionTurnKind {
7030 /// A user-message turn.
7031 #[serde(rename = "user")]
7032 User,
7033 /// A conversation-compaction turn.
7034 #[serde(rename = "compaction")]
7035 Compaction,
7036 /// Unknown variant for forward compatibility.
7037 #[default]
7038 #[serde(other)]
7039 Unknown,
7040}
7041
7042/// Server-recommended routing behavior for a later HydraFusion turn.
7043///
7044/// <div class="warning">
7045///
7046/// **Experimental.** This type is part of an experimental wire-protocol surface
7047/// and may change or be removed in future SDK or CLI releases.
7048///
7049/// </div>
7050#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7051pub enum FusionFollowUpAction {
7052 /// Reuse the durable primary model without routing.
7053 #[serde(rename = "reuse_primary")]
7054 ReusePrimary,
7055 /// Request a new routing decision.
7056 #[serde(rename = "reroute")]
7057 Reroute,
7058 /// Unknown variant for forward compatibility.
7059 #[default]
7060 #[serde(other)]
7061 Unknown,
7062}
7063
7064/// Validated HydraFusion execution pattern.
7065///
7066/// <div class="warning">
7067///
7068/// **Experimental.** This type is part of an experimental wire-protocol surface
7069/// and may change or be removed in future SDK or CLI releases.
7070///
7071/// </div>
7072#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7073pub enum FusionPattern {
7074 /// Run one primary solver phase.
7075 #[serde(rename = "single")]
7076 Single,
7077 /// Run a primary phase, a judge, and an optional repair.
7078 #[serde(rename = "cascade")]
7079 Cascade,
7080 /// Run a primary draft, a read-only critique, and a revision.
7081 #[serde(rename = "critique")]
7082 Critique,
7083 /// Unknown variant for forward compatibility.
7084 #[default]
7085 #[serde(other)]
7086 Unknown,
7087}
7088
7089/// HydraFusion phase kind.
7090///
7091/// <div class="warning">
7092///
7093/// **Experimental.** This type is part of an experimental wire-protocol surface
7094/// and may change or be removed in future SDK or CLI releases.
7095///
7096/// </div>
7097#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7098pub enum FusionPhaseKind {
7099 /// Primary solver phase.
7100 #[serde(rename = "primary")]
7101 Primary,
7102 /// Read-only cascade judge phase.
7103 #[serde(rename = "judge")]
7104 Judge,
7105 /// Cascade repair phase.
7106 #[serde(rename = "repair")]
7107 Repair,
7108 /// Initial critique-pattern draft phase.
7109 #[serde(rename = "draft")]
7110 Draft,
7111 /// Read-only critique phase.
7112 #[serde(rename = "critic")]
7113 Critic,
7114 /// Critique-pattern revision phase.
7115 #[serde(rename = "revision")]
7116 Revision,
7117 /// Follow-up phase continuing from the resolved model.
7118 #[serde(rename = "follow_up")]
7119 FollowUp,
7120 /// Unknown variant for forward compatibility.
7121 #[default]
7122 #[serde(other)]
7123 Unknown,
7124}
7125
7126/// Conversation scope in which a HydraFusion phase executes.
7127///
7128/// <div class="warning">
7129///
7130/// **Experimental.** This type is part of an experimental wire-protocol surface
7131/// and may change or be removed in future SDK or CLI releases.
7132///
7133/// </div>
7134#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7135pub enum FusionConversationScope {
7136 /// Canonical root conversation history.
7137 #[serde(rename = "root")]
7138 Root,
7139 /// Isolated read-only review history that does not enter the root conversation.
7140 #[serde(rename = "review")]
7141 Review,
7142 /// Unknown variant for forward compatibility.
7143 #[default]
7144 #[serde(other)]
7145 Unknown,
7146}
7147
7148/// The agent mode that was active when this message was sent
7149#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7150pub enum UserMessageAgentMode {
7151 /// The agent is responding interactively to the user.
7152 #[serde(rename = "interactive")]
7153 Interactive,
7154 /// The agent is preparing a plan before making changes.
7155 #[serde(rename = "plan")]
7156 Plan,
7157 /// The agent is working autonomously toward task completion.
7158 #[serde(rename = "autopilot")]
7159 Autopilot,
7160 /// The agent is in shell-focused UI mode.
7161 #[serde(rename = "shell")]
7162 Shell,
7163 /// Unknown variant for forward compatibility.
7164 #[default]
7165 #[serde(other)]
7166 Unknown,
7167}
7168
7169/// How this user message was delivered to the agentic loop, relative to whether the loop was already running. This is the timing axis only; the message's origin (human vs. system/command/schedule/skill/etc.) is carried separately by `source`. A system-injected message has a delivery too — e.g. a background-task notification waking an idle agent is `idle`, the same mechanism as a human starting a fresh turn.
7170#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7171pub enum UserMessageDelivery {
7172 /// Delivered while the loop was idle; starts its own run immediately (a human's fresh turn, or a system notification waking an idle agent).
7173 #[serde(rename = "idle")]
7174 Idle,
7175 /// Injected into the current in-flight run while the agent was busy (immediate mode).
7176 #[serde(rename = "steering")]
7177 Steering,
7178 /// Enqueued while the agent was busy; processed as its own run afterward.
7179 #[serde(rename = "queued")]
7180 Queued,
7181 /// Unknown variant for forward compatibility.
7182 #[default]
7183 #[serde(other)]
7184 Unknown,
7185}
7186
7187/// What the agent was doing when the user interrupted it.
7188#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7189pub enum AgentInterruptedActivity {
7190 /// A request to the model was open.
7191 #[serde(rename = "model_call")]
7192 ModelCall,
7193 /// The turn was sleeping between retry attempts.
7194 #[serde(rename = "retry_backoff")]
7195 RetryBackoff,
7196 /// One or more tools were executing.
7197 #[serde(rename = "tool_call")]
7198 ToolCall,
7199 /// Background sub-agents were running while the main loop was idle.
7200 #[serde(rename = "background_agent")]
7201 BackgroundAgent,
7202 /// Unknown variant for forward compatibility.
7203 #[default]
7204 #[serde(other)]
7205 Unknown,
7206}
7207
7208/// Where the interruption landed relative to the first streamed token.
7209#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7210pub enum AgentInterruptedCancelPhase {
7211 /// No output had been produced when the request was cancelled.
7212 #[serde(rename = "pre_first_token")]
7213 PreFirstToken,
7214 /// The response was already streaming when the request was cancelled.
7215 #[serde(rename = "mid_stream")]
7216 MidStream,
7217 /// Unknown variant for forward compatibility.
7218 #[default]
7219 #[serde(other)]
7220 Unknown,
7221}
7222
7223/// Transport used for a failed model call
7224#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7225pub enum ModelCallFailureTransport {
7226 /// HTTP transport, including SSE streams.
7227 #[serde(rename = "http")]
7228 Http,
7229 /// WebSocket transport.
7230 #[serde(rename = "websocket")]
7231 Websocket,
7232 /// Unknown variant for forward compatibility.
7233 #[default]
7234 #[serde(other)]
7235 Unknown,
7236}
7237
7238/// Content-safe activity observed while a HydraFusion phase is running.
7239///
7240/// <div class="warning">
7241///
7242/// **Experimental.** This type is part of an experimental wire-protocol surface
7243/// and may change or be removed in future SDK or CLI releases.
7244///
7245/// </div>
7246#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7247pub enum FusionPhaseActivityKind {
7248 /// The provider produced additional private output bytes.
7249 #[serde(rename = "model_output")]
7250 ModelOutput,
7251 /// A tool began executing inside the phase.
7252 #[serde(rename = "tool_started")]
7253 ToolStarted,
7254 /// A tool finished executing inside the phase.
7255 #[serde(rename = "tool_completed")]
7256 ToolCompleted,
7257 /// Unknown variant for forward compatibility.
7258 #[default]
7259 #[serde(other)]
7260 Unknown,
7261}
7262
7263/// How a durable phase checkpoint contributes its exact message to canonical root history.
7264///
7265/// <div class="warning">
7266///
7267/// **Experimental.** This type is part of an experimental wire-protocol surface
7268/// and may change or be removed in future SDK or CLI releases.
7269///
7270/// </div>
7271#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7272pub enum FusionProjectionMode {
7273 /// Append the exact root message immediately.
7274 #[serde(rename = "append")]
7275 Append,
7276 /// Hold a terminal message outside canonical history until the final commit selects it.
7277 #[serde(rename = "staged")]
7278 Staged,
7279 /// Do not project the checkpoint into root history.
7280 #[serde(rename = "none")]
7281 None,
7282 /// Unknown variant for forward compatibility.
7283 #[default]
7284 #[serde(other)]
7285 Unknown,
7286}
7287
7288/// Durable outcome status of a HydraFusion phase.
7289///
7290/// <div class="warning">
7291///
7292/// **Experimental.** This type is part of an experimental wire-protocol surface
7293/// and may change or be removed in future SDK or CLI releases.
7294///
7295/// </div>
7296#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7297pub enum FusionPhaseStatus {
7298 /// The phase completed successfully.
7299 #[serde(rename = "succeeded")]
7300 Succeeded,
7301 /// The phase failed.
7302 #[serde(rename = "failed")]
7303 Failed,
7304 /// The phase was cancelled.
7305 #[serde(rename = "cancelled")]
7306 Cancelled,
7307 /// Unknown variant for forward compatibility.
7308 #[default]
7309 #[serde(other)]
7310 Unknown,
7311}
7312
7313/// Tool call type: "function" for standard tool calls, "custom" for grammar-based tool calls. Defaults to "function" when absent.
7314#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7315pub enum AssistantMessageToolRequestType {
7316 /// Standard function-style tool call.
7317 #[serde(rename = "function")]
7318 Function,
7319 /// Custom grammar-based tool call.
7320 #[serde(rename = "custom")]
7321 Custom,
7322 /// Unknown variant for forward compatibility.
7323 #[default]
7324 #[serde(other)]
7325 Unknown,
7326}
7327
7328/// The system that produced a citation.
7329///
7330/// <div class="warning">
7331///
7332/// **Experimental.** This type is part of an experimental wire-protocol surface
7333/// and may change or be removed in future SDK or CLI releases.
7334///
7335/// </div>
7336#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7337pub enum CitationProvider {
7338 /// Citation produced by an Anthropic (Claude) model response.
7339 #[serde(rename = "anthropic")]
7340 Anthropic,
7341 /// Citation produced by an OpenAI model response.
7342 #[serde(rename = "openai")]
7343 Openai,
7344 /// Citation synthesized client-side by the runtime from tool output.
7345 #[serde(rename = "client")]
7346 Client,
7347 /// Unknown variant for forward compatibility.
7348 #[default]
7349 #[serde(other)]
7350 Unknown,
7351}
7352
7353/// Hosted program caller type
7354#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7355pub enum AssistantMessageToolRequestCallerType {
7356 #[serde(rename = "program")]
7357 Program,
7358 /// Unknown variant for forward compatibility.
7359 #[default]
7360 #[serde(other)]
7361 Unknown,
7362}
7363
7364/// API endpoint used for this model call, matching CAPI supported_endpoints vocabulary
7365#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7366pub enum AssistantUsageApiEndpoint {
7367 /// Chat Completions API endpoint.
7368 #[serde(rename = "/chat/completions")]
7369 ChatCompletions,
7370 /// Anthropic Messages API endpoint.
7371 #[serde(rename = "/v1/messages")]
7372 V1Messages,
7373 /// Responses API endpoint.
7374 #[serde(rename = "/responses")]
7375 Responses,
7376 /// WebSocket Responses API endpoint.
7377 #[serde(rename = "ws:/responses")]
7378 WsResponses,
7379 /// Unknown variant for forward compatibility.
7380 #[default]
7381 #[serde(other)]
7382 Unknown,
7383}
7384
7385/// Transport used for a successful model call
7386#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7387pub enum AssistantUsageTransport {
7388 /// HTTP transport, including SSE streams.
7389 #[serde(rename = "http")]
7390 Http,
7391 /// WebSocket transport.
7392 #[serde(rename = "websocket")]
7393 Websocket,
7394 /// Unknown variant for forward compatibility.
7395 #[default]
7396 #[serde(other)]
7397 Unknown,
7398}
7399
7400/// For HTTP 400 failures only: whether the response carried a structured CAPI error envelope (structured_error, a deterministic validation failure) or no error body (bodyless, the transient gateway/proxy signature). Absent for non-400 failures.
7401#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7402pub enum ModelCallFailureBadRequestKind {
7403 /// The 400 response carried no error body (transient gateway/proxy signature).
7404 #[serde(rename = "bodyless")]
7405 Bodyless,
7406 /// The 400 response carried a structured CAPI error envelope (deterministic validation failure).
7407 #[serde(rename = "structured_error")]
7408 StructuredError,
7409 /// Unknown variant for forward compatibility.
7410 #[default]
7411 #[serde(other)]
7412 Unknown,
7413}
7414
7415/// Boundary that produced a model call failure
7416#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7417pub enum ModelCallFailureKind {
7418 /// The provider returned an API error response.
7419 #[serde(rename = "api")]
7420 Api,
7421 /// The request transport failed before a usable API response completed.
7422 #[serde(rename = "transport")]
7423 Transport,
7424 /// Unknown variant for forward compatibility.
7425 #[default]
7426 #[serde(other)]
7427 Unknown,
7428}
7429
7430/// Where the failed model call originated
7431#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7432pub enum ModelCallFailureSource {
7433 /// Model call from the top-level agent.
7434 #[serde(rename = "top_level")]
7435 TopLevel,
7436 /// Model call from a sub-agent.
7437 #[serde(rename = "subagent")]
7438 Subagent,
7439 /// Model call from MCP sampling.
7440 #[serde(rename = "mcp_sampling")]
7441 McpSampling,
7442 /// Unknown variant for forward compatibility.
7443 #[default]
7444 #[serde(other)]
7445 Unknown,
7446}
7447
7448/// Final outcome of one logical model dispatch after response acceptance processing
7449#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7450pub enum ModelCallFinishedOutcome {
7451 /// The provider response was accepted for continued agent processing.
7452 #[serde(rename = "success")]
7453 Success,
7454 /// The dispatch ended with a provider or transport error.
7455 #[serde(rename = "error")]
7456 Error,
7457 /// The dispatch was cancelled before an accepted response was produced.
7458 #[serde(rename = "cancelled")]
7459 Cancelled,
7460 /// The provider response was rejected during post-response acceptance processing.
7461 #[serde(rename = "rejected")]
7462 Rejected,
7463 /// Unknown variant for forward compatibility.
7464 #[default]
7465 #[serde(other)]
7466 Unknown,
7467}
7468
7469/// Finite reason code describing why the current turn was aborted
7470#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7471pub enum AbortReason {
7472 /// The local user requested the abort, for example by pressing Ctrl+C in the CLI.
7473 #[serde(rename = "user_initiated")]
7474 UserInitiated,
7475 /// A remote command requested the abort.
7476 #[serde(rename = "remote_command")]
7477 RemoteCommand,
7478 /// An MCP server delivered a user.abort notification.
7479 #[serde(rename = "user_abort")]
7480 UserAbort,
7481 /// Autopilot stopped the run because the active objective reached its user-set --max-ai-credits limit.
7482 #[serde(rename = "autopilot_credit_limit")]
7483 AutopilotCreditLimit,
7484 /// Unknown variant for forward compatibility.
7485 #[default]
7486 #[serde(other)]
7487 Unknown,
7488}
7489
7490/// Allowed values for the `ToolExecutionStartToolDescriptionMetaUIVisibility` enumeration.
7491#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7492pub enum ToolExecutionStartToolDescriptionMetaUIVisibility {
7493 /// Tool is callable by the model (LLM tool surface)
7494 #[serde(rename = "model")]
7495 Model,
7496 /// Tool is callable by the MCP App view (iframe) via session.mcp.apps.callTool
7497 #[serde(rename = "app")]
7498 App,
7499 /// Unknown variant for forward compatibility.
7500 #[default]
7501 #[serde(other)]
7502 Unknown,
7503}
7504
7505/// Binary result type discriminator. Use "image" for images and "resource" for other binary data.
7506#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7507pub enum PersistedBinaryImageType {
7508 /// Binary image data.
7509 #[serde(rename = "image")]
7510 Image,
7511 /// Other binary resource data.
7512 #[serde(rename = "resource")]
7513 Resource,
7514 /// Unknown variant for forward compatibility.
7515 #[default]
7516 #[serde(other)]
7517 Unknown,
7518}
7519
7520/// Why the binary data is absent: it exceeded the inline size limit, or its asset was unavailable
7521#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7522pub enum OmittedBinaryOmittedReason {
7523 /// Bytes exceeded the session's inline size limit.
7524 #[serde(rename = "too_large")]
7525 TooLarge,
7526 /// The referenced binary asset could not be found (e.g. a truncated log).
7527 #[serde(rename = "asset_unavailable")]
7528 AssetUnavailable,
7529 /// Unknown variant for forward compatibility.
7530 #[default]
7531 #[serde(other)]
7532 Unknown,
7533}
7534
7535/// Binary result type discriminator. Use "image" for images and "resource" for other binary data.
7536#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7537pub enum OmittedBinaryType {
7538 /// Binary image data.
7539 #[serde(rename = "image")]
7540 Image,
7541 /// Other binary resource data.
7542 #[serde(rename = "resource")]
7543 Resource,
7544 /// Unknown variant for forward compatibility.
7545 #[default]
7546 #[serde(other)]
7547 Unknown,
7548}
7549
7550/// Binary result type discriminator. Use "image" for images and "resource" for other binary data.
7551#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7552pub enum BinaryAssetReferenceType {
7553 /// Binary image data.
7554 #[serde(rename = "image")]
7555 Image,
7556 /// Other binary resource data.
7557 #[serde(rename = "resource")]
7558 Resource,
7559 /// Unknown variant for forward compatibility.
7560 #[default]
7561 #[serde(other)]
7562 Unknown,
7563}
7564
7565/// A model-facing binary result as persisted: full inline data, a size-omitted marker, or a deduplicated asset reference
7566///
7567/// <div class="warning">
7568///
7569/// **Experimental.** This type is part of an experimental wire-protocol surface
7570/// and may change or be removed in future SDK or CLI releases.
7571///
7572/// </div>
7573#[derive(Debug, Clone, Serialize, Deserialize)]
7574#[serde(untagged)]
7575pub enum PersistedBinaryResult {
7576 PersistedBinaryImage(PersistedBinaryImage),
7577 OmittedBinaryResult(OmittedBinaryResult),
7578 BinaryAssetReference(BinaryAssetReference),
7579}
7580
7581/// Content block type discriminator
7582#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7583pub enum ToolExecutionCompleteContentTextType {
7584 #[serde(rename = "text")]
7585 #[default]
7586 Text,
7587}
7588
7589/// Content block type discriminator
7590#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7591pub enum ToolExecutionCompleteContentTerminalType {
7592 #[serde(rename = "terminal")]
7593 #[default]
7594 Terminal,
7595}
7596
7597/// Content block type discriminator
7598#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7599pub enum ToolExecutionCompleteContentShellExitType {
7600 #[serde(rename = "shell_exit")]
7601 #[default]
7602 ShellExit,
7603}
7604
7605/// Content block type discriminator
7606#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7607pub enum ToolExecutionCompleteContentImageType {
7608 #[serde(rename = "image")]
7609 #[default]
7610 Image,
7611}
7612
7613/// Content block type discriminator
7614#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7615pub enum ToolExecutionCompleteContentAudioType {
7616 #[serde(rename = "audio")]
7617 #[default]
7618 Audio,
7619}
7620
7621/// Theme variant this icon is intended for
7622#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7623pub enum ToolExecutionCompleteContentResourceLinkIconTheme {
7624 /// Icon intended for light themes.
7625 #[serde(rename = "light")]
7626 Light,
7627 /// Icon intended for dark themes.
7628 #[serde(rename = "dark")]
7629 Dark,
7630 /// Unknown variant for forward compatibility.
7631 #[default]
7632 #[serde(other)]
7633 Unknown,
7634}
7635
7636/// Content block type discriminator
7637#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7638pub enum ToolExecutionCompleteContentResourceLinkType {
7639 #[serde(rename = "resource_link")]
7640 #[default]
7641 ResourceLink,
7642}
7643
7644/// The embedded resource contents, either text or base64-encoded binary
7645#[derive(Debug, Clone, Serialize, Deserialize)]
7646#[serde(untagged)]
7647pub enum ToolExecutionCompleteContentResourceDetails {
7648 EmbeddedTextResourceContents(EmbeddedTextResourceContents),
7649 EmbeddedBlobResourceContents(EmbeddedBlobResourceContents),
7650}
7651
7652/// Content block type discriminator
7653#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7654pub enum ToolExecutionCompleteContentResourceType {
7655 #[serde(rename = "resource")]
7656 #[default]
7657 Resource,
7658}
7659
7660/// A content block within a tool result, which may be text, terminal output, image, audio, or a resource
7661#[derive(Debug, Clone, Serialize, Deserialize)]
7662#[serde(untagged)]
7663pub enum ToolExecutionCompleteContent {
7664 Text(ToolExecutionCompleteContentText),
7665 Terminal(ToolExecutionCompleteContentTerminal),
7666 ShellExit(ToolExecutionCompleteContentShellExit),
7667 Image(ToolExecutionCompleteContentImage),
7668 Audio(ToolExecutionCompleteContentAudio),
7669 ResourceLink(ToolExecutionCompleteContentResourceLink),
7670 Resource(ToolExecutionCompleteContentResource),
7671}
7672
7673/// Allowed values for the `ToolExecutionCompleteToolDescriptionMetaUIVisibility` enumeration.
7674#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7675pub enum ToolExecutionCompleteToolDescriptionMetaUIVisibility {
7676 /// Tool is callable by the model (LLM tool surface)
7677 #[serde(rename = "model")]
7678 Model,
7679 /// Tool is callable by the MCP App view (iframe) via session.mcp.apps.callTool
7680 #[serde(rename = "app")]
7681 App,
7682 /// Unknown variant for forward compatibility.
7683 #[default]
7684 #[serde(other)]
7685 Unknown,
7686}
7687
7688/// 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)
7689#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7690pub enum SkillInvokedTrigger {
7691 /// Skill invocation requested explicitly by the user, such as via a slash command or UI affordance.
7692 #[serde(rename = "user-invoked")]
7693 UserInvoked,
7694 /// Skill invocation requested by the agent.
7695 #[serde(rename = "agent-invoked")]
7696 AgentInvoked,
7697 /// Skill content loaded as part of another context, such as a configured custom agent or subagent.
7698 #[serde(rename = "context-load")]
7699 ContextLoad,
7700 /// Unknown variant for forward compatibility.
7701 #[default]
7702 #[serde(other)]
7703 Unknown,
7704}
7705
7706/// Binary asset type discriminator. Use "image" for images and "resource" otherwise.
7707#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7708pub enum BinaryAssetType {
7709 /// Binary image data.
7710 #[serde(rename = "image")]
7711 Image,
7712 /// Other binary resource data.
7713 #[serde(rename = "resource")]
7714 Resource,
7715 /// Unknown variant for forward compatibility.
7716 #[default]
7717 #[serde(other)]
7718 Unknown,
7719}
7720
7721/// Message role: "system" for system prompts, "developer" for developer-injected instructions
7722#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7723pub enum SystemMessageRole {
7724 /// System prompt message.
7725 #[serde(rename = "system")]
7726 System,
7727 /// Developer instruction message.
7728 #[serde(rename = "developer")]
7729 Developer,
7730 /// Unknown variant for forward compatibility.
7731 #[default]
7732 #[serde(other)]
7733 Unknown,
7734}
7735
7736/// Permission kind discriminator
7737#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7738pub enum PermissionRequestShellKind {
7739 #[serde(rename = "shell")]
7740 #[default]
7741 Shell,
7742}
7743
7744/// Permission kind discriminator
7745#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7746pub enum PermissionRequestWriteKind {
7747 #[serde(rename = "write")]
7748 #[default]
7749 Write,
7750}
7751
7752/// Permission kind discriminator
7753#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7754pub enum PermissionRequestReadKind {
7755 #[serde(rename = "read")]
7756 #[default]
7757 Read,
7758}
7759
7760/// Permission kind discriminator
7761#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7762pub enum PermissionRequestMcpKind {
7763 #[serde(rename = "mcp")]
7764 #[default]
7765 Mcp,
7766}
7767
7768/// Advisory recommendation the runtime attaches to a permission request whose origin it can vouch for by construction. Unlike the auto-approval judge this does not depend on auto mode and does not evaluate what the tool call does; its absence simply means the runtime has no opinion and the request follows the host's normal approval flow.
7769///
7770/// <div class="warning">
7771///
7772/// **Experimental.** This type is part of an experimental wire-protocol surface
7773/// and may change or be removed in future SDK or CLI releases.
7774///
7775/// </div>
7776#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7777pub enum PermissionRecommendation {
7778 /// The runtime vouches for the request's origin and recommends approving it without prompting. The host still owns the decision and may deny it; deny rules, managed policy, and the auto-approval safety judge all outrank this recommendation.
7779 #[serde(rename = "approve")]
7780 Approve,
7781 /// Unknown variant for forward compatibility.
7782 #[default]
7783 #[serde(other)]
7784 Unknown,
7785}
7786
7787/// Permission kind discriminator
7788#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7789pub enum PermissionRequestUrlKind {
7790 #[serde(rename = "url")]
7791 #[default]
7792 Url,
7793}
7794
7795/// Whether this is a store or vote memory operation
7796#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7797pub enum PermissionRequestMemoryAction {
7798 /// Store a new memory.
7799 #[serde(rename = "store")]
7800 Store,
7801 /// Vote on an existing memory.
7802 #[serde(rename = "vote")]
7803 Vote,
7804 /// Unknown variant for forward compatibility.
7805 #[default]
7806 #[serde(other)]
7807 Unknown,
7808}
7809
7810/// Why the assisted-approval judge produced no usable recommendation. Present only alongside an `error` recommendation, where the human-readable reason is a fixed string and therefore cannot distinguish these cases. Intended to make a judge failure reportable by a consumer that has no access to the host's logs.
7811///
7812/// <div class="warning">
7813///
7814/// **Experimental.** This type is part of an experimental wire-protocol surface
7815/// and may change or be removed in future SDK or CLI releases.
7816///
7817/// </div>
7818#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7819pub enum AssistedApprovalJudgeFailureReason {
7820 /// The judge model call exceeded its deadline.
7821 #[serde(rename = "timeout")]
7822 Timeout,
7823 /// The judge model call was cancelled before it returned.
7824 #[serde(rename = "abort")]
7825 Abort,
7826 /// The judge model call completed but returned no content.
7827 #[serde(rename = "empty_response")]
7828 EmptyResponse,
7829 /// The judge model call failed (for example a transport, authentication, or rate-limit error).
7830 #[serde(rename = "model_error")]
7831 ModelError,
7832 /// The judge model replied, but the reply carried no ALLOW/DENY verdict.
7833 #[serde(rename = "parse_error")]
7834 ParseError,
7835 /// Unknown variant for forward compatibility.
7836 #[default]
7837 #[serde(other)]
7838 Unknown,
7839}
7840
7841/// Outcome of the assisted-approval safety judge for a permission request. Present only in assisted mode; its absence means the judge did not evaluate the request.
7842///
7843/// <div class="warning">
7844///
7845/// **Experimental.** This type is part of an experimental wire-protocol surface
7846/// and may change or be removed in future SDK or CLI releases.
7847///
7848/// </div>
7849#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7850pub enum AssistedApprovalRecommendation {
7851 /// The judge evaluated the request and recommends automatically approving it.
7852 #[serde(rename = "approve")]
7853 Approve,
7854 /// The judge evaluated the request and does not recommend automatically approving it; explicit approval is required. Whether that means prompting, denying, or something else is the consumer's decision.
7855 #[serde(rename = "requireApproval")]
7856 RequireApproval,
7857 /// Assisted mode is enabled, but this request category is never automatically approvable (for example, sandbox-bypass requests), so the judge was not consulted.
7858 #[serde(rename = "excluded")]
7859 Excluded,
7860 /// The judge was consulted but did not return a usable recommendation, so the request requires explicit approval.
7861 #[serde(rename = "error")]
7862 Error,
7863 /// Unknown variant for forward compatibility.
7864 #[default]
7865 #[serde(other)]
7866 Unknown,
7867}
7868
7869/// Vote direction (vote only)
7870#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7871pub enum PermissionRequestMemoryDirection {
7872 /// Vote that the memory is useful or accurate.
7873 #[serde(rename = "upvote")]
7874 Upvote,
7875 /// Vote that the memory is incorrect or outdated.
7876 #[serde(rename = "downvote")]
7877 Downvote,
7878 /// Unknown variant for forward compatibility.
7879 #[default]
7880 #[serde(other)]
7881 Unknown,
7882}
7883
7884/// Permission kind discriminator
7885#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7886pub enum PermissionRequestMemoryKind {
7887 #[serde(rename = "memory")]
7888 #[default]
7889 Memory,
7890}
7891
7892/// Scope of a stored memory.
7893#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7894pub enum PermissionRequestMemoryScope {
7895 /// Store the memory for the current repository.
7896 #[serde(rename = "repository")]
7897 Repository,
7898 /// Store the memory for the current user.
7899 #[serde(rename = "user")]
7900 User,
7901 /// Unknown variant for forward compatibility.
7902 #[default]
7903 #[serde(other)]
7904 Unknown,
7905}
7906
7907/// Permission kind discriminator
7908#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7909pub enum PermissionRequestCustomToolKind {
7910 #[serde(rename = "custom-tool")]
7911 #[default]
7912 CustomTool,
7913}
7914
7915/// Permission kind discriminator
7916#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7917pub enum PermissionRequestHookKind {
7918 #[serde(rename = "hook")]
7919 #[default]
7920 Hook,
7921}
7922
7923/// Permission kind discriminator
7924#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7925pub enum PermissionRequestExtensionManagementKind {
7926 #[serde(rename = "extension-management")]
7927 #[default]
7928 ExtensionManagement,
7929}
7930
7931/// Permission kind discriminator
7932#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7933pub enum PermissionRequestFactoryKind {
7934 #[serde(rename = "factory")]
7935 #[default]
7936 Factory,
7937}
7938
7939/// Operation gated by a factory permission request.
7940#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7941pub enum FactoryPermissionOperation {
7942 /// Running a registered factory, which spends subagents, active time, and AI credits under the approved limits.
7943 #[serde(rename = "run")]
7944 Run,
7945 /// Authoring a factory, which writes JavaScript into a session-scoped extension and loads it.
7946 #[serde(rename = "author")]
7947 Author,
7948 /// Unknown variant for forward compatibility.
7949 #[default]
7950 #[serde(other)]
7951 Unknown,
7952}
7953
7954/// Permission kind discriminator
7955#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7956pub enum PermissionRequestExtensionPermissionAccessKind {
7957 #[serde(rename = "extension-permission-access")]
7958 #[default]
7959 ExtensionPermissionAccess,
7960}
7961
7962/// Permission kind discriminator
7963#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7964pub enum PermissionRequestExtensionEnvAccessKind {
7965 #[serde(rename = "extension-env-access")]
7966 #[default]
7967 ExtensionEnvAccess,
7968}
7969
7970/// Details of the permission being requested
7971#[derive(Debug, Clone, Serialize, Deserialize)]
7972#[serde(untagged)]
7973pub enum PermissionRequest {
7974 Shell(PermissionRequestShell),
7975 Write(PermissionRequestWrite),
7976 Read(PermissionRequestRead),
7977 Mcp(PermissionRequestMcp),
7978 Url(PermissionRequestUrl),
7979 Memory(PermissionRequestMemory),
7980 CustomTool(PermissionRequestCustomTool),
7981 Hook(PermissionRequestHook),
7982 ExtensionManagement(PermissionRequestExtensionManagement),
7983 Factory(PermissionRequestFactory),
7984 ExtensionPermissionAccess(PermissionRequestExtensionPermissionAccess),
7985 ExtensionEnvAccess(PermissionRequestExtensionEnvAccess),
7986}
7987
7988/// Prompt kind discriminator
7989#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7990pub enum PermissionPromptRequestCommandsKind {
7991 #[serde(rename = "commands")]
7992 #[default]
7993 Commands,
7994}
7995
7996/// Prompt kind discriminator
7997#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7998pub enum PermissionPromptRequestWriteKind {
7999 #[serde(rename = "write")]
8000 #[default]
8001 Write,
8002}
8003
8004/// Prompt kind discriminator
8005#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8006pub enum PermissionPromptRequestReadKind {
8007 #[serde(rename = "read")]
8008 #[default]
8009 Read,
8010}
8011
8012/// Prompt kind discriminator
8013#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8014pub enum PermissionPromptRequestMcpKind {
8015 #[serde(rename = "mcp")]
8016 #[default]
8017 Mcp,
8018}
8019
8020/// Prompt kind discriminator
8021#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8022pub enum PermissionPromptRequestUrlKind {
8023 #[serde(rename = "url")]
8024 #[default]
8025 Url,
8026}
8027
8028/// Prompt kind discriminator
8029#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8030pub enum PermissionPromptRequestMemoryKind {
8031 #[serde(rename = "memory")]
8032 #[default]
8033 Memory,
8034}
8035
8036/// Prompt kind discriminator
8037#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8038pub enum PermissionPromptRequestCustomToolKind {
8039 #[serde(rename = "custom-tool")]
8040 #[default]
8041 CustomTool,
8042}
8043
8044/// Underlying permission kind that needs path approval
8045#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8046pub enum PermissionPromptRequestPathAccessKind {
8047 /// Read access to a filesystem path.
8048 #[serde(rename = "read")]
8049 Read,
8050 /// Shell command access involving a filesystem path.
8051 #[serde(rename = "shell")]
8052 Shell,
8053 /// Write access to a filesystem path.
8054 #[serde(rename = "write")]
8055 Write,
8056 /// Unknown variant for forward compatibility.
8057 #[default]
8058 #[serde(other)]
8059 Unknown,
8060}
8061
8062/// Prompt kind discriminator
8063#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8064pub enum PermissionPromptRequestPathKind {
8065 #[serde(rename = "path")]
8066 #[default]
8067 Path,
8068}
8069
8070/// Prompt kind discriminator
8071#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8072pub enum PermissionPromptRequestHookKind {
8073 #[serde(rename = "hook")]
8074 #[default]
8075 Hook,
8076}
8077
8078/// Prompt kind discriminator
8079#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8080pub enum PermissionPromptRequestExtensionManagementKind {
8081 #[serde(rename = "extension-management")]
8082 #[default]
8083 ExtensionManagement,
8084}
8085
8086/// Prompt kind discriminator
8087#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8088pub enum PermissionPromptRequestFactoryKind {
8089 #[serde(rename = "factory")]
8090 #[default]
8091 Factory,
8092}
8093
8094/// Prompt kind discriminator
8095#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8096pub enum PermissionPromptRequestExtensionPermissionAccessKind {
8097 #[serde(rename = "extension-permission-access")]
8098 #[default]
8099 ExtensionPermissionAccess,
8100}
8101
8102/// Prompt kind discriminator
8103#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8104pub enum PermissionPromptRequestExtensionEnvAccessKind {
8105 #[serde(rename = "extension-env-access")]
8106 #[default]
8107 ExtensionEnvAccess,
8108}
8109
8110/// Derived user-facing permission prompt details for UI consumers
8111#[derive(Debug, Clone, Serialize, Deserialize)]
8112#[serde(untagged)]
8113pub enum PermissionPromptRequest {
8114 Commands(PermissionPromptRequestCommands),
8115 Write(PermissionPromptRequestWrite),
8116 Read(PermissionPromptRequestRead),
8117 Mcp(PermissionPromptRequestMcp),
8118 Url(PermissionPromptRequestUrl),
8119 Memory(PermissionPromptRequestMemory),
8120 CustomTool(PermissionPromptRequestCustomTool),
8121 Path(PermissionPromptRequestPath),
8122 Hook(PermissionPromptRequestHook),
8123 ExtensionManagement(PermissionPromptRequestExtensionManagement),
8124 Factory(PermissionPromptRequestFactory),
8125 ExtensionPermissionAccess(PermissionPromptRequestExtensionPermissionAccess),
8126 ExtensionEnvAccess(PermissionPromptRequestExtensionEnvAccess),
8127}
8128
8129/// The permission request was approved
8130#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8131pub enum PermissionApprovedKind {
8132 #[serde(rename = "approved")]
8133 #[default]
8134 Approved,
8135}
8136
8137/// Command approval kind
8138#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8139pub enum UserToolSessionApprovalCommandsKind {
8140 #[serde(rename = "commands")]
8141 #[default]
8142 Commands,
8143}
8144
8145/// Read approval kind
8146#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8147pub enum UserToolSessionApprovalReadKind {
8148 #[serde(rename = "read")]
8149 #[default]
8150 Read,
8151}
8152
8153/// Write approval kind
8154#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8155pub enum UserToolSessionApprovalWriteKind {
8156 #[serde(rename = "write")]
8157 #[default]
8158 Write,
8159}
8160
8161/// MCP tool approval kind
8162#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8163pub enum UserToolSessionApprovalMcpKind {
8164 #[serde(rename = "mcp")]
8165 #[default]
8166 Mcp,
8167}
8168
8169/// Memory approval kind
8170#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8171pub enum UserToolSessionApprovalMemoryKind {
8172 #[serde(rename = "memory")]
8173 #[default]
8174 Memory,
8175}
8176
8177/// Custom tool approval kind
8178#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8179pub enum UserToolSessionApprovalCustomToolKind {
8180 #[serde(rename = "custom-tool")]
8181 #[default]
8182 CustomTool,
8183}
8184
8185/// Extension management approval kind
8186#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8187pub enum UserToolSessionApprovalExtensionManagementKind {
8188 #[serde(rename = "extension-management")]
8189 #[default]
8190 ExtensionManagement,
8191}
8192
8193/// Factory approval kind
8194#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8195pub enum UserToolSessionApprovalFactoryKind {
8196 #[serde(rename = "factory")]
8197 #[default]
8198 Factory,
8199}
8200
8201/// Extension permission access approval kind
8202#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8203pub enum UserToolSessionApprovalExtensionPermissionAccessKind {
8204 #[serde(rename = "extension-permission-access")]
8205 #[default]
8206 ExtensionPermissionAccess,
8207}
8208
8209/// Extension environment access approval kind
8210#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8211pub enum UserToolSessionApprovalExtensionEnvAccessKind {
8212 #[serde(rename = "extension-env-access")]
8213 #[default]
8214 ExtensionEnvAccess,
8215}
8216
8217/// The approval to add as a session-scoped rule
8218#[derive(Debug, Clone, Serialize, Deserialize)]
8219#[serde(untagged)]
8220pub enum UserToolSessionApproval {
8221 Commands(UserToolSessionApprovalCommands),
8222 Read(UserToolSessionApprovalRead),
8223 Write(UserToolSessionApprovalWrite),
8224 Mcp(UserToolSessionApprovalMcp),
8225 Memory(UserToolSessionApprovalMemory),
8226 CustomTool(UserToolSessionApprovalCustomTool),
8227 ExtensionManagement(UserToolSessionApprovalExtensionManagement),
8228 Factory(UserToolSessionApprovalFactory),
8229 ExtensionPermissionAccess(UserToolSessionApprovalExtensionPermissionAccess),
8230 ExtensionEnvAccess(UserToolSessionApprovalExtensionEnvAccess),
8231}
8232
8233/// Approved and remembered for the rest of the session
8234#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8235pub enum PermissionApprovedForSessionKind {
8236 #[serde(rename = "approved-for-session")]
8237 #[default]
8238 ApprovedForSession,
8239}
8240
8241/// Approved and persisted for this project location
8242#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8243pub enum PermissionApprovedForLocationKind {
8244 #[serde(rename = "approved-for-location")]
8245 #[default]
8246 ApprovedForLocation,
8247}
8248
8249/// The permission request was cancelled before a response was used
8250#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8251pub enum PermissionCancelledKind {
8252 #[serde(rename = "cancelled")]
8253 #[default]
8254 Cancelled,
8255}
8256
8257/// Denied because approval rules explicitly blocked it
8258#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8259pub enum PermissionDeniedByRulesKind {
8260 #[serde(rename = "denied-by-rules")]
8261 #[default]
8262 DeniedByRules,
8263}
8264
8265/// Denied because no approval rule matched and user confirmation was unavailable
8266#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8267pub enum PermissionDeniedNoApprovalRuleAndCouldNotRequestFromUserKind {
8268 #[serde(rename = "denied-no-approval-rule-and-could-not-request-from-user")]
8269 #[default]
8270 DeniedNoApprovalRuleAndCouldNotRequestFromUser,
8271}
8272
8273/// Denied by the user during an interactive prompt
8274#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8275pub enum PermissionDeniedInteractivelyByUserKind {
8276 #[serde(rename = "denied-interactively-by-user")]
8277 #[default]
8278 DeniedInteractivelyByUser,
8279}
8280
8281/// Denied by the organization's content exclusion policy
8282#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8283pub enum PermissionDeniedByContentExclusionPolicyKind {
8284 #[serde(rename = "denied-by-content-exclusion-policy")]
8285 #[default]
8286 DeniedByContentExclusionPolicy,
8287}
8288
8289/// Denied by a permission request hook registered by an extension or plugin
8290#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8291pub enum PermissionDeniedByPermissionRequestHookKind {
8292 #[serde(rename = "denied-by-permission-request-hook")]
8293 #[default]
8294 DeniedByPermissionRequestHook,
8295}
8296
8297/// The result of the permission request
8298#[derive(Debug, Clone, Serialize, Deserialize)]
8299#[serde(untagged)]
8300pub enum PermissionResult {
8301 Approved(PermissionApproved),
8302 ApprovedForSession(PermissionApprovedForSession),
8303 ApprovedForLocation(PermissionApprovedForLocation),
8304 Cancelled(PermissionCancelled),
8305 DeniedByRules(PermissionDeniedByRules),
8306 DeniedNoApprovalRuleAndCouldNotRequestFromUser(
8307 PermissionDeniedNoApprovalRuleAndCouldNotRequestFromUser,
8308 ),
8309 DeniedInteractivelyByUser(PermissionDeniedInteractivelyByUser),
8310 DeniedByContentExclusionPolicy(PermissionDeniedByContentExclusionPolicy),
8311 DeniedByPermissionRequestHook(PermissionDeniedByPermissionRequestHook),
8312}
8313
8314/// Elicitation mode; "form" for structured input, "url" for browser-based. Defaults to "form" when absent.
8315#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8316pub enum ElicitationRequestedMode {
8317 /// Structured form-based elicitation.
8318 #[serde(rename = "form")]
8319 Form,
8320 /// Browser URL-based elicitation.
8321 #[serde(rename = "url")]
8322 Url,
8323 /// Unknown variant for forward compatibility.
8324 #[default]
8325 #[serde(other)]
8326 Unknown,
8327}
8328
8329/// Schema type indicator (always 'object')
8330#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8331pub enum ElicitationRequestedSchemaType {
8332 #[serde(rename = "object")]
8333 #[default]
8334 Object,
8335}
8336
8337/// The user action: "accept" (submitted form), "decline" (explicitly refused), or "cancel" (dismissed)
8338#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8339pub enum ElicitationCompletedAction {
8340 /// The user submitted the requested form.
8341 #[serde(rename = "accept")]
8342 Accept,
8343 /// The user explicitly declined the request.
8344 #[serde(rename = "decline")]
8345 Decline,
8346 /// The user dismissed the request.
8347 #[serde(rename = "cancel")]
8348 Cancel,
8349 /// Unknown variant for forward compatibility.
8350 #[default]
8351 #[serde(other)]
8352 Unknown,
8353}
8354
8355/// Reason the runtime is requesting host-provided MCP OAuth credentials
8356#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8357pub enum McpOauthRequestReason {
8358 /// Initial credentials are required before connecting to the MCP server.
8359 #[serde(rename = "initial")]
8360 Initial,
8361 /// The current host-provided credential was rejected and a replacement is requested.
8362 #[serde(rename = "refresh")]
8363 Refresh,
8364 /// The server requires a new host authorization flow before continuing.
8365 #[serde(rename = "reauth")]
8366 Reauth,
8367 /// The server requires a credential with additional scope or audience.
8368 #[serde(rename = "upscope")]
8369 Upscope,
8370 /// Unknown variant for forward compatibility.
8371 #[default]
8372 #[serde(other)]
8373 Unknown,
8374}
8375
8376/// 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).
8377#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8378pub enum McpOauthRequiredStaticClientConfigGrantType {
8379 #[serde(rename = "client_credentials")]
8380 #[default]
8381 ClientCredentials,
8382}
8383
8384/// How the pending MCP OAuth request was completed
8385#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8386pub enum McpOauthCompletionOutcome {
8387 /// The request completed with a token-backed OAuth provider.
8388 #[serde(rename = "token")]
8389 Token,
8390 /// The request completed without an OAuth provider.
8391 #[serde(rename = "cancelled")]
8392 Cancelled,
8393 /// Unknown variant for forward compatibility.
8394 #[default]
8395 #[serde(other)]
8396 Unknown,
8397}
8398
8399/// Why dynamic headers are being requested.
8400#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8401pub enum McpHeadersRefreshRequiredReason {
8402 /// The transport is making its first dynamic header request for this server.
8403 #[serde(rename = "startup")]
8404 Startup,
8405 /// The previously cached dynamic headers expired.
8406 #[serde(rename = "ttl-expired")]
8407 TtlExpired,
8408 /// The server returned 401 and stale dynamic headers were invalidated.
8409 #[serde(rename = "auth-failed")]
8410 AuthFailed,
8411 /// Unknown variant for forward compatibility.
8412 #[default]
8413 #[serde(other)]
8414 Unknown,
8415}
8416
8417/// How the pending MCP headers refresh request resolved.
8418#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8419pub enum McpHeadersRefreshCompletedOutcome {
8420 /// The host supplied dynamic headers.
8421 #[serde(rename = "headers")]
8422 Headers,
8423 /// The host responded with no dynamic headers.
8424 #[serde(rename = "none")]
8425 None,
8426 /// No response arrived within the bounded window.
8427 #[serde(rename = "timeout")]
8428 Timeout,
8429 /// Unknown variant for forward compatibility.
8430 #[default]
8431 #[serde(other)]
8432 Unknown,
8433}
8434
8435/// Lifecycle phase for a Rust-owned ephemeral query stream.
8436///
8437/// <div class="warning">
8438///
8439/// **Experimental.** This type is part of an experimental wire-protocol surface
8440/// and may change or be removed in future SDK or CLI releases.
8441///
8442/// </div>
8443#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8444pub enum UIEphemeralQueryPhase {
8445 /// The ephemeral query stream has begun.
8446 #[serde(rename = "started")]
8447 Started,
8448 /// A partial result chunk was produced by the stream.
8449 #[serde(rename = "chunk")]
8450 Chunk,
8451 /// The ephemeral query stream finished successfully.
8452 #[serde(rename = "completed")]
8453 Completed,
8454 /// The ephemeral query stream ended with an error.
8455 #[serde(rename = "failed")]
8456 Failed,
8457 /// The ephemeral query stream was cancelled before completing.
8458 #[serde(rename = "aborted")]
8459 Aborted,
8460 /// Unknown variant for forward compatibility.
8461 #[default]
8462 #[serde(other)]
8463 Unknown,
8464}
8465
8466/// The user's auto-mode-switch choice
8467#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8468pub enum AutoModeSwitchResponse {
8469 /// Switch models for this request.
8470 #[serde(rename = "yes")]
8471 Yes,
8472 /// Switch models now and keep using the replacement automatically.
8473 #[serde(rename = "yes_always")]
8474 YesAlways,
8475 /// Do not switch models.
8476 #[serde(rename = "no")]
8477 No,
8478 /// Unknown variant for forward compatibility.
8479 #[default]
8480 #[serde(other)]
8481 Unknown,
8482}
8483
8484/// User action selected for an exhausted session limit.
8485#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8486pub enum SessionLimitsExhaustedResponseAction {
8487 /// Increase the current max by an exact AI Credits amount.
8488 #[serde(rename = "add")]
8489 Add,
8490 /// Set a new absolute max AI Credits value.
8491 #[serde(rename = "set")]
8492 Set,
8493 /// Remove the current session limit.
8494 #[serde(rename = "unset")]
8495 Unset,
8496 /// Leave the limit unchanged and cancel the blocked model request.
8497 #[serde(rename = "cancel")]
8498 Cancel,
8499 /// Unknown variant for forward compatibility.
8500 #[default]
8501 #[serde(other)]
8502 Unknown,
8503}
8504
8505/// Coarse request-difficulty bucket for UX explainability
8506#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8507pub enum AutoModeResolvedReasoningBucket {
8508 /// The request looks low-reasoning; a lighter model is appropriate.
8509 #[serde(rename = "low")]
8510 Low,
8511 /// The request needs a moderate amount of reasoning.
8512 #[serde(rename = "medium")]
8513 Medium,
8514 /// The request looks high-reasoning; a stronger model is appropriate.
8515 #[serde(rename = "high")]
8516 High,
8517 /// Unknown variant for forward compatibility.
8518 #[default]
8519 #[serde(other)]
8520 Unknown,
8521}
8522
8523/// Summary of which managed-settings channels contributed to the effective session policy. Use the per-channel booleans for exact provenance.
8524#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8525pub enum ManagedSettingsResolvedSource {
8526 /// Only the server/account channel contributed.
8527 #[serde(rename = "server")]
8528 Server,
8529 /// Only the device MDM/plist/registry/file channel contributed.
8530 #[serde(rename = "device")]
8531 Device,
8532 /// Only session-local SDK-host injection contributed.
8533 #[serde(rename = "client")]
8534 Client,
8535 /// A policy helper registered by device or server policy contributed. Device registration takes priority when present.
8536 #[serde(rename = "policyHelper")]
8537 PolicyHelper,
8538 /// More than one channel contributed. Ordinary keys resolve device over server over policy helper per key, while permissions compose restrictively across all present layers.
8539 #[serde(rename = "mixed")]
8540 Mixed,
8541 /// No managed policy is in force (no channel contributed).
8542 #[serde(rename = "none")]
8543 None,
8544 /// Unknown variant for forward compatibility.
8545 #[default]
8546 #[serde(other)]
8547 Unknown,
8548}
8549
8550/// The category of runtime action that enterprise managed settings governed (blocked or capped)
8551#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8552pub enum ManagedSettingsEnforcedAction {
8553 /// An attempt to turn on a bypass-permissions ("yolo") escalation was refused or capped because policy disables bypass-permissions mode.
8554 #[serde(rename = "bypass_permissions_blocked")]
8555 BypassPermissionsBlocked,
8556 /// Unknown variant for forward compatibility.
8557 #[default]
8558 #[serde(other)]
8559 Unknown,
8560}
8561
8562/// For a `bypass_permissions_blocked` action, which permission-escalation primitive was refused
8563#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8564pub enum ManagedSettingsEnforcedEscalation {
8565 /// Full allow-all permissions — automatically approving tools, paths, and URLs.
8566 #[serde(rename = "allow_all")]
8567 AllowAll,
8568 /// Automatic approval of all tool permission requests.
8569 #[serde(rename = "approve_all")]
8570 ApproveAll,
8571 /// Assisted mode — keeps normal prompt paths and adds an LLM recommendation, distinct from allow-all.
8572 #[serde(rename = "assisted_approval")]
8573 AssistedApproval,
8574 /// Unrestricted filesystem access outside the session's allowed directories.
8575 #[serde(rename = "unrestricted_paths")]
8576 UnrestrictedPaths,
8577 /// Unrestricted URL fetch access.
8578 #[serde(rename = "unrestricted_urls")]
8579 UnrestrictedUrls,
8580 /// A server-wide MCP "Always Allow" (or `--allow-tool <server>`) blanket that would auto-approve every tool from an MCP server. Capped to per-tool approval; each tool still prompts.
8581 #[serde(rename = "server_wide_mcp_approval")]
8582 ServerWideMcpApproval,
8583 /// Unknown variant for forward compatibility.
8584 #[default]
8585 #[serde(other)]
8586 Unknown,
8587}
8588
8589/// Exit plan mode action
8590#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8591pub enum ExitPlanModeAction {
8592 /// Exit plan mode without starting implementation.
8593 #[serde(rename = "exit_only")]
8594 ExitOnly,
8595 /// Exit plan mode and continue in interactive mode.
8596 #[serde(rename = "interactive")]
8597 Interactive,
8598 /// Exit plan mode and continue autonomously.
8599 #[serde(rename = "autopilot")]
8600 Autopilot,
8601 /// Exit plan mode and continue with parallel autonomous workers.
8602 #[serde(rename = "autopilot_fleet")]
8603 AutopilotFleet,
8604 /// Unknown variant for forward compatibility.
8605 #[default]
8606 #[serde(other)]
8607 Unknown,
8608}
8609
8610/// Terminal status a factory run committed. A settled run is never `pending` or `running`, so those two members of the run-status domain are deliberately absent.
8611#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8612pub enum FactoryRunSettledStatus {
8613 /// The factory body resolved and its result was committed.
8614 #[serde(rename = "completed")]
8615 Completed,
8616 /// The run was stopped by a limit, an approval refusal or another policy decision.
8617 #[serde(rename = "halted")]
8618 Halted,
8619 /// The run was cancelled by its caller or by session disposal.
8620 #[serde(rename = "cancelled")]
8621 Cancelled,
8622 /// The run failed, with `failureType` carrying the class when it has one.
8623 #[serde(rename = "error")]
8624 Error,
8625 /// Unknown variant for forward compatibility.
8626 #[default]
8627 #[serde(other)]
8628 Unknown,
8629}
8630
8631/// Source location type (e.g., project, personal-copilot, plugin, builtin, sdk)
8632#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8633pub enum SkillSource {
8634 /// Skill defined in the current project's skill directories.
8635 #[serde(rename = "project")]
8636 Project,
8637 /// Skill discovered from a parent directory in the current workspace tree.
8638 #[serde(rename = "inherited")]
8639 Inherited,
8640 /// Skill defined in the user's Copilot skill directory.
8641 #[serde(rename = "personal-copilot")]
8642 PersonalCopilot,
8643 /// Skill defined in the user's personal agents skill directory.
8644 #[serde(rename = "personal-agents")]
8645 PersonalAgents,
8646 /// Skill provided by an installed plugin.
8647 #[serde(rename = "plugin")]
8648 Plugin,
8649 /// Skill loaded from a configured custom skill directory.
8650 #[serde(rename = "custom")]
8651 Custom,
8652 /// Skill bundled with the runtime.
8653 #[serde(rename = "builtin")]
8654 Builtin,
8655 /// Pathless skill supplied lazily by an SDK skill provider.
8656 #[serde(rename = "sdk")]
8657 Sdk,
8658 /// Unknown variant for forward compatibility.
8659 #[default]
8660 #[serde(other)]
8661 Unknown,
8662}
8663
8664/// Whether configured models are advisory preferences or required constraints
8665#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8666pub enum AgentModelPolicy {
8667 /// Treat the authored models as advisory preferences that callers may override.
8668 #[serde(rename = "preferred")]
8669 Preferred,
8670 /// Require subagent execution to use one of the authored models.
8671 #[serde(rename = "required")]
8672 Required,
8673 /// Unknown variant for forward compatibility.
8674 #[default]
8675 #[serde(other)]
8676 Unknown,
8677}
8678
8679/// Configuration source: user, workspace, plugin, or builtin
8680#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8681pub enum McpServerSource {
8682 /// Server configured in the user's global MCP configuration.
8683 #[serde(rename = "user")]
8684 User,
8685 /// Server configured by the current workspace.
8686 #[serde(rename = "workspace")]
8687 Workspace,
8688 /// Server contributed by an installed plugin.
8689 #[serde(rename = "plugin")]
8690 Plugin,
8691 /// Server bundled with the runtime.
8692 #[serde(rename = "builtin")]
8693 Builtin,
8694 /// Unknown variant for forward compatibility.
8695 #[default]
8696 #[serde(other)]
8697 Unknown,
8698}
8699
8700/// Connection status: connected, failed, needs-auth, pending, disabled, stopped, or not_configured
8701#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8702pub enum McpServerStatus {
8703 /// The server is connected and available.
8704 #[serde(rename = "connected")]
8705 Connected,
8706 /// The server failed to connect or initialize.
8707 #[serde(rename = "failed")]
8708 Failed,
8709 /// The server requires authentication before it can connect.
8710 #[serde(rename = "needs-auth")]
8711 NeedsAuth,
8712 /// The server connection is still being established.
8713 #[serde(rename = "pending")]
8714 Pending,
8715 /// The server is configured but disabled.
8716 #[serde(rename = "disabled")]
8717 Disabled,
8718 /// The server was intentionally stopped and can be restarted on demand when policy permits; a server quarantined by restrictive managed policy stays stopped and cannot be restarted until the policy allows it.
8719 #[serde(rename = "stopped")]
8720 Stopped,
8721 /// The server is not configured for this session.
8722 #[serde(rename = "not_configured")]
8723 NotConfigured,
8724 /// Unknown variant for forward compatibility.
8725 #[default]
8726 #[serde(other)]
8727 Unknown,
8728}
8729
8730/// Transport mechanism: stdio, http, sse (deprecated), or memory (in-process MCP server)
8731#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8732pub enum McpServerTransport {
8733 /// Server communicates over stdio with a local child process.
8734 #[serde(rename = "stdio")]
8735 Stdio,
8736 /// Server communicates over streamable HTTP.
8737 #[serde(rename = "http")]
8738 Http,
8739 /// Server communicates over Server-Sent Events (deprecated).
8740 #[serde(rename = "sse")]
8741 Sse,
8742 /// Server is backed by an in-memory runtime implementation.
8743 #[serde(rename = "memory")]
8744 Memory,
8745 /// Unknown variant for forward compatibility.
8746 #[default]
8747 #[serde(other)]
8748 Unknown,
8749}
8750
8751/// Discovery source
8752#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8753pub enum ExtensionsLoadedExtensionSource {
8754 /// Extension discovered from the current project.
8755 #[serde(rename = "project")]
8756 Project,
8757 /// Extension discovered from the user's extension directory.
8758 #[serde(rename = "user")]
8759 User,
8760 /// Extension contributed by an installed plugin.
8761 #[serde(rename = "plugin")]
8762 Plugin,
8763 /// Extension discovered from the current session's state directory.
8764 #[serde(rename = "session")]
8765 Session,
8766 /// Unknown variant for forward compatibility.
8767 #[default]
8768 #[serde(other)]
8769 Unknown,
8770}
8771
8772/// Current status: running, disabled, failed, or starting
8773#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8774pub enum ExtensionsLoadedExtensionStatus {
8775 /// The extension process is running.
8776 #[serde(rename = "running")]
8777 Running,
8778 /// The extension is installed but disabled.
8779 #[serde(rename = "disabled")]
8780 Disabled,
8781 /// The extension failed to start or crashed.
8782 #[serde(rename = "failed")]
8783 Failed,
8784 /// The extension process is starting.
8785 #[serde(rename = "starting")]
8786 Starting,
8787 /// Unknown variant for forward compatibility.
8788 #[default]
8789 #[serde(other)]
8790 Unknown,
8791}