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