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.indexed_search")]
37 SessionIndexedSearch,
38 #[serde(rename = "session.warning")]
39 SessionWarning,
40 #[serde(rename = "session.model_change")]
41 SessionModelChange,
42 ///
43 /// <div class="warning">
44 ///
45 /// **Experimental.** This type is part of an experimental wire-protocol surface
46 /// and may change or be removed in future SDK or CLI releases.
47 ///
48 /// </div>
49 #[serde(rename = "session.auto_tier_recommendation")]
50 SessionAutoTierRecommendation,
51 #[serde(rename = "session.auto_tier_switch_failed")]
52 SessionAutoTierSwitchFailed,
53 #[serde(rename = "session.mode_changed")]
54 SessionModeChanged,
55 #[serde(rename = "session.mode_notice_delivered")]
56 SessionModeNoticeDelivered,
57 #[serde(rename = "session.session_limits_changed")]
58 SessionSessionLimitsChanged,
59 ///
60 /// <div class="warning">
61 ///
62 /// **Experimental.** This type is part of an experimental wire-protocol surface
63 /// and may change or be removed in future SDK or CLI releases.
64 ///
65 /// </div>
66 #[serde(rename = "session.permissions_changed")]
67 SessionPermissionsChanged,
68 #[serde(rename = "session.plan_changed")]
69 SessionPlanChanged,
70 #[serde(rename = "session.todos_changed")]
71 SessionTodosChanged,
72 #[serde(rename = "session.workspace_file_changed")]
73 SessionWorkspaceFileChanged,
74 #[serde(rename = "session.handoff")]
75 SessionHandoff,
76 #[serde(rename = "session.truncation")]
77 SessionTruncation,
78 #[serde(rename = "session.snapshot_rewind")]
79 SessionSnapshotRewind,
80 #[serde(rename = "session.shutdown")]
81 SessionShutdown,
82 #[serde(rename = "session.usage_checkpoint")]
83 SessionUsageCheckpoint,
84 #[serde(rename = "session.context_changed")]
85 SessionContextChanged,
86 #[serde(rename = "session.usage_info")]
87 SessionUsageInfo,
88 #[serde(rename = "session.context_cleared")]
89 SessionContextCleared,
90 #[serde(rename = "session.compaction_start")]
91 SessionCompactionStart,
92 #[serde(rename = "session.compaction_complete")]
93 SessionCompactionComplete,
94 #[serde(rename = "session.task_complete")]
95 SessionTaskComplete,
96 ///
97 /// <div class="warning">
98 ///
99 /// **Experimental.** This type is part of an experimental wire-protocol surface
100 /// and may change or be removed in future SDK or CLI releases.
101 ///
102 /// </div>
103 #[serde(rename = "session.completion_receipt")]
104 SessionCompletionReceipt,
105 ///
106 /// <div class="warning">
107 ///
108 /// **Experimental.** This type is part of an experimental wire-protocol surface
109 /// and may change or be removed in future SDK or CLI releases.
110 ///
111 /// </div>
112 #[serde(rename = "session.fusion_route_started")]
113 SessionFusionRouteStarted,
114 ///
115 /// <div class="warning">
116 ///
117 /// **Experimental.** This type is part of an experimental wire-protocol surface
118 /// and may change or be removed in future SDK or CLI releases.
119 ///
120 /// </div>
121 #[serde(rename = "session.fusion_route_failed")]
122 SessionFusionRouteFailed,
123 ///
124 /// <div class="warning">
125 ///
126 /// **Experimental.** This type is part of an experimental wire-protocol surface
127 /// and may change or be removed in future SDK or CLI releases.
128 ///
129 /// </div>
130 #[serde(rename = "session.fusion_resolved")]
131 SessionFusionResolved,
132 ///
133 /// <div class="warning">
134 ///
135 /// **Experimental.** This type is part of an experimental wire-protocol surface
136 /// and may change or be removed in future SDK or CLI releases.
137 ///
138 /// </div>
139 #[serde(rename = "session.fusion_completed")]
140 SessionFusionCompleted,
141 #[serde(rename = "session.permission_recovery")]
142 SessionPermissionRecovery,
143 #[serde(rename = "user.message")]
144 UserMessage,
145 #[serde(rename = "pending_messages.modified")]
146 PendingMessagesModified,
147 #[serde(rename = "assistant.turn_start")]
148 AssistantTurnStart,
149 #[serde(rename = "assistant.turn_retry")]
150 AssistantTurnRetry,
151 #[serde(rename = "agent.interrupted")]
152 AgentInterrupted,
153 #[serde(rename = "assistant.intent")]
154 AssistantIntent,
155 ///
156 /// <div class="warning">
157 ///
158 /// **Experimental.** This type is part of an experimental wire-protocol surface
159 /// and may change or be removed in future SDK or CLI releases.
160 ///
161 /// </div>
162 #[serde(rename = "assistant.fusion_phase_started")]
163 AssistantFusionPhaseStarted,
164 ///
165 /// <div class="warning">
166 ///
167 /// **Experimental.** This type is part of an experimental wire-protocol surface
168 /// and may change or be removed in future SDK or CLI releases.
169 ///
170 /// </div>
171 #[serde(rename = "assistant.fusion_phase_activity")]
172 AssistantFusionPhaseActivity,
173 ///
174 /// <div class="warning">
175 ///
176 /// **Experimental.** This type is part of an experimental wire-protocol surface
177 /// and may change or be removed in future SDK or CLI releases.
178 ///
179 /// </div>
180 #[serde(rename = "assistant.fusion_phase_completed")]
181 AssistantFusionPhaseCompleted,
182 ///
183 /// <div class="warning">
184 ///
185 /// **Experimental.** This type is part of an experimental wire-protocol surface
186 /// and may change or be removed in future SDK or CLI releases.
187 ///
188 /// </div>
189 #[serde(rename = "assistant.fusion_phase_failed")]
190 AssistantFusionPhaseFailed,
191 #[serde(rename = "assistant.server_tool_progress")]
192 AssistantServerToolProgress,
193 #[serde(rename = "assistant.reasoning")]
194 AssistantReasoning,
195 #[serde(rename = "assistant.reasoning_delta")]
196 AssistantReasoningDelta,
197 #[serde(rename = "assistant.tool_call_delta")]
198 AssistantToolCallDelta,
199 #[serde(rename = "assistant.streaming_delta")]
200 AssistantStreamingDelta,
201 #[serde(rename = "assistant.message")]
202 AssistantMessage,
203 #[serde(rename = "assistant.message_start")]
204 AssistantMessageStart,
205 #[serde(rename = "assistant.message_delta")]
206 AssistantMessageDelta,
207 #[serde(rename = "assistant.turn_end")]
208 AssistantTurnEnd,
209 #[serde(rename = "assistant.idle")]
210 AssistantIdle,
211 #[serde(rename = "assistant.usage")]
212 AssistantUsage,
213 #[serde(rename = "prompt_cache_break")]
214 PromptCacheBreak,
215 #[serde(rename = "model.call_failure")]
216 ModelCallFailure,
217 #[serde(rename = "model.call_finished")]
218 ModelCallFinished,
219 #[serde(rename = "model.call_start")]
220 ModelCallStart,
221 #[serde(rename = "abort")]
222 Abort,
223 #[serde(rename = "tool.user_requested")]
224 ToolUserRequested,
225 #[serde(rename = "tool.execution_start")]
226 ToolExecutionStart,
227 #[serde(rename = "tool.execution_partial_result")]
228 ToolExecutionPartialResult,
229 #[serde(rename = "tool.execution_progress")]
230 ToolExecutionProgress,
231 #[serde(rename = "tool.execution_complete")]
232 ToolExecutionComplete,
233 #[serde(rename = "tool_search.activated")]
234 ToolSearchActivated,
235 #[serde(rename = "skill.invoked")]
236 SkillInvoked,
237 ///
238 /// <div class="warning">
239 ///
240 /// **Experimental.** This type is part of an experimental wire-protocol surface
241 /// and may change or be removed in future SDK or CLI releases.
242 ///
243 /// </div>
244 #[serde(rename = "skill.invoked_ref")]
245 SkillInvokedRef,
246 ///
247 /// <div class="warning">
248 ///
249 /// **Experimental.** This type is part of an experimental wire-protocol surface
250 /// and may change or be removed in future SDK or CLI releases.
251 ///
252 /// </div>
253 #[serde(rename = "skill.context_delivered")]
254 SkillContextDelivered,
255 ///
256 /// <div class="warning">
257 ///
258 /// **Experimental.** This type is part of an experimental wire-protocol surface
259 /// and may change or be removed in future SDK or CLI releases.
260 ///
261 /// </div>
262 #[serde(rename = "skill.context_delivered_ref")]
263 SkillContextDeliveredRef,
264 #[serde(rename = "sandbox.decision")]
265 SandboxDecision,
266 #[serde(rename = "subagent.started")]
267 SubagentStarted,
268 #[serde(rename = "subagent.configured")]
269 SubagentConfigured,
270 #[serde(rename = "subagent.completed")]
271 SubagentCompleted,
272 #[serde(rename = "subagent.failed")]
273 SubagentFailed,
274 #[serde(rename = "subagent.selected")]
275 SubagentSelected,
276 #[serde(rename = "subagent.deselected")]
277 SubagentDeselected,
278 #[serde(rename = "hook.start")]
279 HookStart,
280 #[serde(rename = "hook.end")]
281 HookEnd,
282 #[serde(rename = "hook.progress")]
283 HookProgress,
284 ///
285 /// <div class="warning">
286 ///
287 /// **Experimental.** This type is part of an experimental wire-protocol surface
288 /// and may change or be removed in future SDK or CLI releases.
289 ///
290 /// </div>
291 #[serde(rename = "session.binary_asset")]
292 SessionBinaryAsset,
293 #[serde(rename = "system.message")]
294 SystemMessage,
295 #[serde(rename = "system.notification")]
296 SystemNotification,
297 #[serde(rename = "permission.requested")]
298 PermissionRequested,
299 #[serde(rename = "permission.completed")]
300 PermissionCompleted,
301 ///
302 /// <div class="warning">
303 ///
304 /// **Experimental.** This type is part of an experimental wire-protocol surface
305 /// and may change or be removed in future SDK or CLI releases.
306 ///
307 /// </div>
308 #[serde(rename = "permission.carriedForward")]
309 PermissionCarriedForward,
310 ///
311 /// <div class="warning">
312 ///
313 /// **Experimental.** This type is part of an experimental wire-protocol surface
314 /// and may change or be removed in future SDK or CLI releases.
315 ///
316 /// </div>
317 #[serde(rename = "permission.messageAuthorization")]
318 PermissionMessageAuthorization,
319 ///
320 /// <div class="warning">
321 ///
322 /// **Experimental.** This type is part of an experimental wire-protocol surface
323 /// and may change or be removed in future SDK or CLI releases.
324 ///
325 /// </div>
326 #[serde(rename = "permission.messageAuthorizationRead")]
327 PermissionMessageAuthorizationRead,
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 = "permission.messageAuthorizationDegraded")]
336 PermissionMessageAuthorizationDegraded,
337 ///
338 /// <div class="warning">
339 ///
340 /// **Experimental.** This type is part of an experimental wire-protocol surface
341 /// and may change or be removed in future SDK or CLI releases.
342 ///
343 /// </div>
344 #[serde(rename = "permission.assentDetected")]
345 PermissionAssentDetected,
346 ///
347 /// <div class="warning">
348 ///
349 /// **Experimental.** This type is part of an experimental wire-protocol surface
350 /// and may change or be removed in future SDK or CLI releases.
351 ///
352 /// </div>
353 #[serde(rename = "permission.contextualAuthorization")]
354 PermissionContextualAuthorization,
355 #[serde(rename = "user_input.requested")]
356 UserInputRequested,
357 #[serde(rename = "user_input.completed")]
358 UserInputCompleted,
359 #[serde(rename = "elicitation.requested")]
360 ElicitationRequested,
361 #[serde(rename = "elicitation.completed")]
362 ElicitationCompleted,
363 #[serde(rename = "sampling.requested")]
364 SamplingRequested,
365 #[serde(rename = "sampling.completed")]
366 SamplingCompleted,
367 #[serde(rename = "mcp.oauth_required")]
368 McpOauthRequired,
369 #[serde(rename = "mcp.oauth_completed")]
370 McpOauthCompleted,
371 #[serde(rename = "mcp.headers_refresh_required")]
372 McpHeadersRefreshRequired,
373 #[serde(rename = "mcp.headers_refresh_completed")]
374 McpHeadersRefreshCompleted,
375 #[serde(rename = "session.custom_notification")]
376 SessionCustomNotification,
377 ///
378 /// <div class="warning">
379 ///
380 /// **Experimental.** This type is part of an experimental wire-protocol surface
381 /// and may change or be removed in future SDK or CLI releases.
382 ///
383 /// </div>
384 #[serde(rename = "ui.ephemeral_query")]
385 UiEphemeralQuery,
386 #[serde(rename = "external_tool.requested")]
387 ExternalToolRequested,
388 #[serde(rename = "external_tool.completed")]
389 ExternalToolCompleted,
390 #[serde(rename = "command.queued")]
391 CommandQueued,
392 #[serde(rename = "command.execute")]
393 CommandExecute,
394 #[serde(rename = "command.completed")]
395 CommandCompleted,
396 #[serde(rename = "auto_mode_switch.requested")]
397 AutoModeSwitchRequested,
398 #[serde(rename = "auto_mode_switch.completed")]
399 AutoModeSwitchCompleted,
400 #[serde(rename = "session_limits_exhausted.requested")]
401 SessionLimitsExhaustedRequested,
402 #[serde(rename = "session_limits_exhausted.completed")]
403 SessionLimitsExhaustedCompleted,
404 ///
405 /// <div class="warning">
406 ///
407 /// **Experimental.** This type is part of an experimental wire-protocol surface
408 /// and may change or be removed in future SDK or CLI releases.
409 ///
410 /// </div>
411 #[serde(rename = "session.auto_mode_resolved")]
412 SessionAutoModeResolved,
413 ///
414 /// <div class="warning">
415 ///
416 /// **Experimental.** This type is part of an experimental wire-protocol surface
417 /// and may change or be removed in future SDK or CLI releases.
418 ///
419 /// </div>
420 #[serde(rename = "session.managed_settings_resolved")]
421 SessionManagedSettingsResolved,
422 ///
423 /// <div class="warning">
424 ///
425 /// **Experimental.** This type is part of an experimental wire-protocol surface
426 /// and may change or be removed in future SDK or CLI releases.
427 ///
428 /// </div>
429 #[serde(rename = "session.managed_settings_enforced")]
430 SessionManagedSettingsEnforced,
431 #[serde(rename = "commands.changed")]
432 CommandsChanged,
433 #[serde(rename = "capabilities.changed")]
434 CapabilitiesChanged,
435 #[serde(rename = "exit_plan_mode.requested")]
436 ExitPlanModeRequested,
437 #[serde(rename = "exit_plan_mode.completed")]
438 ExitPlanModeCompleted,
439 #[serde(rename = "session.tools_updated")]
440 SessionToolsUpdated,
441 #[serde(rename = "session.background_tasks_changed")]
442 SessionBackgroundTasksChanged,
443 ///
444 /// <div class="warning">
445 ///
446 /// **Experimental.** This type is part of an experimental wire-protocol surface
447 /// and may change or be removed in future SDK or CLI releases.
448 ///
449 /// </div>
450 #[serde(rename = "factory.run_updated")]
451 FactoryRunUpdated,
452 ///
453 /// <div class="warning">
454 ///
455 /// **Experimental.** This type is part of an experimental wire-protocol surface
456 /// and may change or be removed in future SDK or CLI releases.
457 ///
458 /// </div>
459 #[serde(rename = "factory.run_started")]
460 FactoryRunStarted,
461 ///
462 /// <div class="warning">
463 ///
464 /// **Experimental.** This type is part of an experimental wire-protocol surface
465 /// and may change or be removed in future SDK or CLI releases.
466 ///
467 /// </div>
468 #[serde(rename = "factory.run_settled")]
469 FactoryRunSettled,
470 #[serde(rename = "session.skills_loaded")]
471 SessionSkillsLoaded,
472 #[serde(rename = "session.custom_agents_updated")]
473 SessionCustomAgentsUpdated,
474 #[serde(rename = "session.mcp_servers_loaded")]
475 SessionMcpServersLoaded,
476 #[serde(rename = "session.mcp_server_status_changed")]
477 SessionMcpServerStatusChanged,
478 #[serde(rename = "session.mcp_server_removed")]
479 SessionMcpServerRemoved,
480 #[serde(rename = "session.mcp_server_needs_reconnect")]
481 SessionMcpServerNeedsReconnect,
482 #[serde(rename = "mcp.tools.list_changed")]
483 McpToolsListChanged,
484 #[serde(rename = "mcp.resources.list_changed")]
485 McpResourcesListChanged,
486 #[serde(rename = "mcp.prompts.list_changed")]
487 McpPromptsListChanged,
488 #[serde(rename = "session.extensions_loaded")]
489 SessionExtensionsLoaded,
490 ///
491 /// <div class="warning">
492 ///
493 /// **Experimental.** This type is part of an experimental wire-protocol surface
494 /// and may change or be removed in future SDK or CLI releases.
495 ///
496 /// </div>
497 #[serde(rename = "session.canvas.opened")]
498 SessionCanvasOpened,
499 ///
500 /// <div class="warning">
501 ///
502 /// **Experimental.** This type is part of an experimental wire-protocol surface
503 /// and may change or be removed in future SDK or CLI releases.
504 ///
505 /// </div>
506 #[serde(rename = "session.canvas.registry_changed")]
507 SessionCanvasRegistryChanged,
508 ///
509 /// <div class="warning">
510 ///
511 /// **Experimental.** This type is part of an experimental wire-protocol surface
512 /// and may change or be removed in future SDK or CLI releases.
513 ///
514 /// </div>
515 #[serde(rename = "session.canvas.closed")]
516 SessionCanvasClosed,
517 ///
518 /// <div class="warning">
519 ///
520 /// **Experimental.** This type is part of an experimental wire-protocol surface
521 /// and may change or be removed in future SDK or CLI releases.
522 ///
523 /// </div>
524 #[serde(rename = "session.canvas.unavailable")]
525 SessionCanvasUnavailable,
526 ///
527 /// <div class="warning">
528 ///
529 /// **Experimental.** This type is part of an experimental wire-protocol surface
530 /// and may change or be removed in future SDK or CLI releases.
531 ///
532 /// </div>
533 #[serde(rename = "session.canvas.recorded")]
534 SessionCanvasRecorded,
535 ///
536 /// <div class="warning">
537 ///
538 /// **Experimental.** This type is part of an experimental wire-protocol surface
539 /// and may change or be removed in future SDK or CLI releases.
540 ///
541 /// </div>
542 #[serde(rename = "session.canvas.removed")]
543 SessionCanvasRemoved,
544 #[serde(rename = "session.extensions.attachments_pushed")]
545 SessionExtensionsAttachmentsPushed,
546 #[serde(rename = "mcp_app.tool_call_complete")]
547 McpAppToolCallComplete,
548 /// Unknown event type for forward compatibility.
549 #[default]
550 #[serde(other)]
551 Unknown,
552}
553
554/// Typed session event data, discriminated by the event `type` field.
555///
556/// Use with [`TypedSessionEvent`] for fully typed event handling.
557#[derive(Debug, Clone, Serialize, Deserialize)]
558#[serde(tag = "type", content = "data")]
559pub enum SessionEventData {
560 #[serde(rename = "session.start")]
561 SessionStart(SessionStartData),
562 #[serde(rename = "session.resume")]
563 SessionResume(SessionResumeData),
564 #[serde(rename = "session.remote_steerable_changed")]
565 SessionRemoteSteerableChanged(SessionRemoteSteerableChangedData),
566 #[serde(rename = "session.error")]
567 SessionError(SessionErrorData),
568 #[serde(rename = "session.idle")]
569 SessionIdle(SessionIdleData),
570 #[serde(rename = "session.title_changed")]
571 SessionTitleChanged(SessionTitleChangedData),
572 #[serde(rename = "session.schedule_created")]
573 SessionScheduleCreated(SessionScheduleCreatedData),
574 #[serde(rename = "session.schedule_cancelled")]
575 SessionScheduleCancelled(SessionScheduleCancelledData),
576 #[serde(rename = "session.schedule_rearmed")]
577 SessionScheduleRearmed(SessionScheduleRearmedData),
578 #[serde(rename = "session.autopilot_objective_changed")]
579 SessionAutopilotObjectiveChanged(SessionAutopilotObjectiveChangedData),
580 #[serde(rename = "session.info")]
581 SessionInfo(SessionInfoData),
582 #[serde(rename = "session.indexed_search")]
583 SessionIndexedSearch(SessionIndexedSearchData),
584 #[serde(rename = "session.warning")]
585 SessionWarning(SessionWarningData),
586 #[serde(rename = "session.model_change")]
587 SessionModelChange(SessionModelChangeData),
588 ///
589 /// <div class="warning">
590 ///
591 /// **Experimental.** This type is part of an experimental wire-protocol surface
592 /// and may change or be removed in future SDK or CLI releases.
593 ///
594 /// </div>
595 #[serde(rename = "session.auto_tier_recommendation")]
596 SessionAutoTierRecommendation(SessionAutoTierRecommendationData),
597 #[serde(rename = "session.auto_tier_switch_failed")]
598 SessionAutoTierSwitchFailed(SessionAutoTierSwitchFailedData),
599 #[serde(rename = "session.mode_changed")]
600 SessionModeChanged(SessionModeChangedData),
601 #[serde(rename = "session.mode_notice_delivered")]
602 SessionModeNoticeDelivered(SessionModeNoticeDeliveredData),
603 #[serde(rename = "session.session_limits_changed")]
604 SessionSessionLimitsChanged(SessionSessionLimitsChangedData),
605 ///
606 /// <div class="warning">
607 ///
608 /// **Experimental.** This type is part of an experimental wire-protocol surface
609 /// and may change or be removed in future SDK or CLI releases.
610 ///
611 /// </div>
612 #[serde(rename = "session.permissions_changed")]
613 SessionPermissionsChanged(SessionPermissionsChangedData),
614 #[serde(rename = "session.plan_changed")]
615 SessionPlanChanged(SessionPlanChangedData),
616 #[serde(rename = "session.todos_changed")]
617 SessionTodosChanged(SessionTodosChangedData),
618 #[serde(rename = "session.workspace_file_changed")]
619 SessionWorkspaceFileChanged(SessionWorkspaceFileChangedData),
620 #[serde(rename = "session.handoff")]
621 SessionHandoff(SessionHandoffData),
622 #[serde(rename = "session.truncation")]
623 SessionTruncation(SessionTruncationData),
624 #[serde(rename = "session.snapshot_rewind")]
625 SessionSnapshotRewind(SessionSnapshotRewindData),
626 #[serde(rename = "session.shutdown")]
627 SessionShutdown(SessionShutdownData),
628 #[serde(rename = "session.usage_checkpoint")]
629 SessionUsageCheckpoint(SessionUsageCheckpointData),
630 #[serde(rename = "session.context_changed")]
631 SessionContextChanged(SessionContextChangedData),
632 #[serde(rename = "session.usage_info")]
633 SessionUsageInfo(SessionUsageInfoData),
634 #[serde(rename = "session.context_cleared")]
635 SessionContextCleared(SessionContextClearedData),
636 #[serde(rename = "session.compaction_start")]
637 SessionCompactionStart(SessionCompactionStartData),
638 #[serde(rename = "session.compaction_complete")]
639 SessionCompactionComplete(SessionCompactionCompleteData),
640 #[serde(rename = "session.task_complete")]
641 SessionTaskComplete(SessionTaskCompleteData),
642 ///
643 /// <div class="warning">
644 ///
645 /// **Experimental.** This type is part of an experimental wire-protocol surface
646 /// and may change or be removed in future SDK or CLI releases.
647 ///
648 /// </div>
649 #[serde(rename = "session.completion_receipt")]
650 SessionCompletionReceipt(SessionCompletionReceiptData),
651 ///
652 /// <div class="warning">
653 ///
654 /// **Experimental.** This type is part of an experimental wire-protocol surface
655 /// and may change or be removed in future SDK or CLI releases.
656 ///
657 /// </div>
658 #[serde(rename = "session.fusion_route_started")]
659 SessionFusionRouteStarted(SessionFusionRouteStartedData),
660 ///
661 /// <div class="warning">
662 ///
663 /// **Experimental.** This type is part of an experimental wire-protocol surface
664 /// and may change or be removed in future SDK or CLI releases.
665 ///
666 /// </div>
667 #[serde(rename = "session.fusion_route_failed")]
668 SessionFusionRouteFailed(SessionFusionRouteFailedData),
669 ///
670 /// <div class="warning">
671 ///
672 /// **Experimental.** This type is part of an experimental wire-protocol surface
673 /// and may change or be removed in future SDK or CLI releases.
674 ///
675 /// </div>
676 #[serde(rename = "session.fusion_resolved")]
677 SessionFusionResolved(SessionFusionResolvedData),
678 ///
679 /// <div class="warning">
680 ///
681 /// **Experimental.** This type is part of an experimental wire-protocol surface
682 /// and may change or be removed in future SDK or CLI releases.
683 ///
684 /// </div>
685 #[serde(rename = "session.fusion_completed")]
686 SessionFusionCompleted(SessionFusionCompletedData),
687 #[serde(rename = "session.permission_recovery")]
688 SessionPermissionRecovery(SessionPermissionRecoveryData),
689 #[serde(rename = "user.message")]
690 UserMessage(UserMessageData),
691 #[serde(rename = "pending_messages.modified")]
692 PendingMessagesModified(PendingMessagesModifiedData),
693 #[serde(rename = "assistant.turn_start")]
694 AssistantTurnStart(AssistantTurnStartData),
695 #[serde(rename = "assistant.turn_retry")]
696 AssistantTurnRetry(AssistantTurnRetryData),
697 #[serde(rename = "agent.interrupted")]
698 AgentInterrupted(AgentInterruptedData),
699 #[serde(rename = "assistant.intent")]
700 AssistantIntent(AssistantIntentData),
701 ///
702 /// <div class="warning">
703 ///
704 /// **Experimental.** This type is part of an experimental wire-protocol surface
705 /// and may change or be removed in future SDK or CLI releases.
706 ///
707 /// </div>
708 #[serde(rename = "assistant.fusion_phase_started")]
709 AssistantFusionPhaseStarted(AssistantFusionPhaseStartedData),
710 ///
711 /// <div class="warning">
712 ///
713 /// **Experimental.** This type is part of an experimental wire-protocol surface
714 /// and may change or be removed in future SDK or CLI releases.
715 ///
716 /// </div>
717 #[serde(rename = "assistant.fusion_phase_activity")]
718 AssistantFusionPhaseActivity(AssistantFusionPhaseActivityData),
719 ///
720 /// <div class="warning">
721 ///
722 /// **Experimental.** This type is part of an experimental wire-protocol surface
723 /// and may change or be removed in future SDK or CLI releases.
724 ///
725 /// </div>
726 #[serde(rename = "assistant.fusion_phase_completed")]
727 AssistantFusionPhaseCompleted(AssistantFusionPhaseCompletedData),
728 ///
729 /// <div class="warning">
730 ///
731 /// **Experimental.** This type is part of an experimental wire-protocol surface
732 /// and may change or be removed in future SDK or CLI releases.
733 ///
734 /// </div>
735 #[serde(rename = "assistant.fusion_phase_failed")]
736 AssistantFusionPhaseFailed(AssistantFusionPhaseFailedData),
737 #[serde(rename = "assistant.server_tool_progress")]
738 AssistantServerToolProgress(AssistantServerToolProgressData),
739 #[serde(rename = "assistant.reasoning")]
740 AssistantReasoning(AssistantReasoningData),
741 #[serde(rename = "assistant.reasoning_delta")]
742 AssistantReasoningDelta(AssistantReasoningDeltaData),
743 #[serde(rename = "assistant.tool_call_delta")]
744 AssistantToolCallDelta(AssistantToolCallDeltaData),
745 #[serde(rename = "assistant.streaming_delta")]
746 AssistantStreamingDelta(AssistantStreamingDeltaData),
747 #[serde(rename = "assistant.message")]
748 AssistantMessage(AssistantMessageData),
749 #[serde(rename = "assistant.message_start")]
750 AssistantMessageStart(AssistantMessageStartData),
751 #[serde(rename = "assistant.message_delta")]
752 AssistantMessageDelta(AssistantMessageDeltaData),
753 #[serde(rename = "assistant.turn_end")]
754 AssistantTurnEnd(AssistantTurnEndData),
755 #[serde(rename = "assistant.idle")]
756 AssistantIdle(AssistantIdleData),
757 #[serde(rename = "assistant.usage")]
758 AssistantUsage(AssistantUsageData),
759 #[serde(rename = "prompt_cache_break")]
760 PromptCacheBreak(PromptCacheBreakData),
761 #[serde(rename = "model.call_failure")]
762 ModelCallFailure(ModelCallFailureData),
763 #[serde(rename = "model.call_finished")]
764 ModelCallFinished(ModelCallFinishedData),
765 #[serde(rename = "model.call_start")]
766 ModelCallStart(ModelCallStartData),
767 #[serde(rename = "abort")]
768 Abort(AbortData),
769 #[serde(rename = "tool.user_requested")]
770 ToolUserRequested(ToolUserRequestedData),
771 #[serde(rename = "tool.execution_start")]
772 ToolExecutionStart(ToolExecutionStartData),
773 #[serde(rename = "tool.execution_partial_result")]
774 ToolExecutionPartialResult(ToolExecutionPartialResultData),
775 #[serde(rename = "tool.execution_progress")]
776 ToolExecutionProgress(ToolExecutionProgressData),
777 #[serde(rename = "tool.execution_complete")]
778 ToolExecutionComplete(ToolExecutionCompleteData),
779 #[serde(rename = "tool_search.activated")]
780 ToolSearchActivated(ToolSearchActivatedData),
781 #[serde(rename = "skill.invoked")]
782 SkillInvoked(SkillInvokedData),
783 #[serde(rename = "skill.invoked_ref")]
784 SkillInvokedRef(SkillInvokedRefData),
785 #[serde(rename = "skill.context_delivered")]
786 SkillContextDelivered(SkillContextDeliveredData),
787 #[serde(rename = "skill.context_delivered_ref")]
788 SkillContextDeliveredRef(SkillContextDeliveredRefData),
789 #[serde(rename = "sandbox.decision")]
790 SandboxDecision(SandboxDecisionData),
791 #[serde(rename = "subagent.started")]
792 SubagentStarted(SubagentStartedData),
793 #[serde(rename = "subagent.configured")]
794 SubagentConfigured(SubagentConfiguredData),
795 #[serde(rename = "subagent.completed")]
796 SubagentCompleted(SubagentCompletedData),
797 #[serde(rename = "subagent.failed")]
798 SubagentFailed(SubagentFailedData),
799 #[serde(rename = "subagent.selected")]
800 SubagentSelected(SubagentSelectedData),
801 #[serde(rename = "subagent.deselected")]
802 SubagentDeselected(SubagentDeselectedData),
803 #[serde(rename = "hook.start")]
804 HookStart(HookStartData),
805 #[serde(rename = "hook.end")]
806 HookEnd(HookEndData),
807 #[serde(rename = "hook.progress")]
808 HookProgress(HookProgressData),
809 #[serde(rename = "session.binary_asset")]
810 SessionBinaryAsset(SessionBinaryAssetData),
811 #[serde(rename = "system.message")]
812 SystemMessage(SystemMessageData),
813 #[serde(rename = "system.notification")]
814 SystemNotification(SystemNotificationData),
815 #[serde(rename = "permission.requested")]
816 PermissionRequested(PermissionRequestedData),
817 #[serde(rename = "permission.completed")]
818 PermissionCompleted(PermissionCompletedData),
819 ///
820 /// <div class="warning">
821 ///
822 /// **Experimental.** This type is part of an experimental wire-protocol surface
823 /// and may change or be removed in future SDK or CLI releases.
824 ///
825 /// </div>
826 #[serde(rename = "permission.carriedForward")]
827 PermissionCarriedForward(PermissionCarriedForwardData),
828 ///
829 /// <div class="warning">
830 ///
831 /// **Experimental.** This type is part of an experimental wire-protocol surface
832 /// and may change or be removed in future SDK or CLI releases.
833 ///
834 /// </div>
835 #[serde(rename = "permission.messageAuthorization")]
836 PermissionMessageAuthorization(PermissionMessageAuthorizationData),
837 ///
838 /// <div class="warning">
839 ///
840 /// **Experimental.** This type is part of an experimental wire-protocol surface
841 /// and may change or be removed in future SDK or CLI releases.
842 ///
843 /// </div>
844 #[serde(rename = "permission.messageAuthorizationRead")]
845 PermissionMessageAuthorizationRead(PermissionMessageAuthorizationReadData),
846 ///
847 /// <div class="warning">
848 ///
849 /// **Experimental.** This type is part of an experimental wire-protocol surface
850 /// and may change or be removed in future SDK or CLI releases.
851 ///
852 /// </div>
853 #[serde(rename = "permission.messageAuthorizationDegraded")]
854 PermissionMessageAuthorizationDegraded(PermissionMessageAuthorizationDegradedData),
855 ///
856 /// <div class="warning">
857 ///
858 /// **Experimental.** This type is part of an experimental wire-protocol surface
859 /// and may change or be removed in future SDK or CLI releases.
860 ///
861 /// </div>
862 #[serde(rename = "permission.assentDetected")]
863 PermissionAssentDetected(PermissionAssentDetectedData),
864 ///
865 /// <div class="warning">
866 ///
867 /// **Experimental.** This type is part of an experimental wire-protocol surface
868 /// and may change or be removed in future SDK or CLI releases.
869 ///
870 /// </div>
871 #[serde(rename = "permission.contextualAuthorization")]
872 PermissionContextualAuthorization(PermissionContextualAuthorizationData),
873 #[serde(rename = "user_input.requested")]
874 UserInputRequested(UserInputRequestedData),
875 #[serde(rename = "user_input.completed")]
876 UserInputCompleted(UserInputCompletedData),
877 #[serde(rename = "elicitation.requested")]
878 ElicitationRequested(ElicitationRequestedData),
879 #[serde(rename = "elicitation.completed")]
880 ElicitationCompleted(ElicitationCompletedData),
881 #[serde(rename = "sampling.requested")]
882 SamplingRequested(SamplingRequestedData),
883 #[serde(rename = "sampling.completed")]
884 SamplingCompleted(SamplingCompletedData),
885 #[serde(rename = "mcp.oauth_required")]
886 McpOauthRequired(McpOauthRequiredData),
887 #[serde(rename = "mcp.oauth_completed")]
888 McpOauthCompleted(McpOauthCompletedData),
889 #[serde(rename = "mcp.headers_refresh_required")]
890 McpHeadersRefreshRequired(McpHeadersRefreshRequiredData),
891 #[serde(rename = "mcp.headers_refresh_completed")]
892 McpHeadersRefreshCompleted(McpHeadersRefreshCompletedData),
893 #[serde(rename = "session.custom_notification")]
894 SessionCustomNotification(SessionCustomNotificationData),
895 ///
896 /// <div class="warning">
897 ///
898 /// **Experimental.** This type is part of an experimental wire-protocol surface
899 /// and may change or be removed in future SDK or CLI releases.
900 ///
901 /// </div>
902 #[serde(rename = "ui.ephemeral_query")]
903 UiEphemeralQuery(UiEphemeralQueryData),
904 #[serde(rename = "external_tool.requested")]
905 ExternalToolRequested(ExternalToolRequestedData),
906 #[serde(rename = "external_tool.completed")]
907 ExternalToolCompleted(ExternalToolCompletedData),
908 #[serde(rename = "command.queued")]
909 CommandQueued(CommandQueuedData),
910 #[serde(rename = "command.execute")]
911 CommandExecute(CommandExecuteData),
912 #[serde(rename = "command.completed")]
913 CommandCompleted(CommandCompletedData),
914 #[serde(rename = "auto_mode_switch.requested")]
915 AutoModeSwitchRequested(AutoModeSwitchRequestedData),
916 #[serde(rename = "auto_mode_switch.completed")]
917 AutoModeSwitchCompleted(AutoModeSwitchCompletedData),
918 #[serde(rename = "session_limits_exhausted.requested")]
919 SessionLimitsExhaustedRequested(SessionLimitsExhaustedRequestedData),
920 #[serde(rename = "session_limits_exhausted.completed")]
921 SessionLimitsExhaustedCompleted(SessionLimitsExhaustedCompletedData),
922 ///
923 /// <div class="warning">
924 ///
925 /// **Experimental.** This type is part of an experimental wire-protocol surface
926 /// and may change or be removed in future SDK or CLI releases.
927 ///
928 /// </div>
929 #[serde(rename = "session.auto_mode_resolved")]
930 SessionAutoModeResolved(SessionAutoModeResolvedData),
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.managed_settings_resolved")]
939 SessionManagedSettingsResolved(SessionManagedSettingsResolvedData),
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.managed_settings_enforced")]
948 SessionManagedSettingsEnforced(SessionManagedSettingsEnforcedData),
949 #[serde(rename = "commands.changed")]
950 CommandsChanged(CommandsChangedData),
951 #[serde(rename = "capabilities.changed")]
952 CapabilitiesChanged(CapabilitiesChangedData),
953 #[serde(rename = "exit_plan_mode.requested")]
954 ExitPlanModeRequested(ExitPlanModeRequestedData),
955 #[serde(rename = "exit_plan_mode.completed")]
956 ExitPlanModeCompleted(ExitPlanModeCompletedData),
957 #[serde(rename = "session.tools_updated")]
958 SessionToolsUpdated(SessionToolsUpdatedData),
959 #[serde(rename = "session.background_tasks_changed")]
960 SessionBackgroundTasksChanged(SessionBackgroundTasksChangedData),
961 ///
962 /// <div class="warning">
963 ///
964 /// **Experimental.** This type is part of an experimental wire-protocol surface
965 /// and may change or be removed in future SDK or CLI releases.
966 ///
967 /// </div>
968 #[serde(rename = "factory.run_updated")]
969 FactoryRunUpdated(FactoryRunUpdatedData),
970 ///
971 /// <div class="warning">
972 ///
973 /// **Experimental.** This type is part of an experimental wire-protocol surface
974 /// and may change or be removed in future SDK or CLI releases.
975 ///
976 /// </div>
977 #[serde(rename = "factory.run_started")]
978 FactoryRunStarted(FactoryRunStartedData),
979 ///
980 /// <div class="warning">
981 ///
982 /// **Experimental.** This type is part of an experimental wire-protocol surface
983 /// and may change or be removed in future SDK or CLI releases.
984 ///
985 /// </div>
986 #[serde(rename = "factory.run_settled")]
987 FactoryRunSettled(FactoryRunSettledData),
988 #[serde(rename = "session.skills_loaded")]
989 SessionSkillsLoaded(SessionSkillsLoadedData),
990 #[serde(rename = "session.custom_agents_updated")]
991 SessionCustomAgentsUpdated(SessionCustomAgentsUpdatedData),
992 #[serde(rename = "session.mcp_servers_loaded")]
993 SessionMcpServersLoaded(SessionMcpServersLoadedData),
994 #[serde(rename = "session.mcp_server_status_changed")]
995 SessionMcpServerStatusChanged(SessionMcpServerStatusChangedData),
996 #[serde(rename = "session.mcp_server_removed")]
997 SessionMcpServerRemoved(SessionMcpServerRemovedData),
998 #[serde(rename = "session.mcp_server_needs_reconnect")]
999 SessionMcpServerNeedsReconnect(SessionMcpServerNeedsReconnectData),
1000 #[serde(rename = "mcp.tools.list_changed")]
1001 McpToolsListChanged(McpToolsListChangedData),
1002 #[serde(rename = "mcp.resources.list_changed")]
1003 McpResourcesListChanged(McpResourcesListChangedData),
1004 #[serde(rename = "mcp.prompts.list_changed")]
1005 McpPromptsListChanged(McpPromptsListChangedData),
1006 #[serde(rename = "session.extensions_loaded")]
1007 SessionExtensionsLoaded(SessionExtensionsLoadedData),
1008 ///
1009 /// <div class="warning">
1010 ///
1011 /// **Experimental.** This type is part of an experimental wire-protocol surface
1012 /// and may change or be removed in future SDK or CLI releases.
1013 ///
1014 /// </div>
1015 #[serde(rename = "session.canvas.opened")]
1016 SessionCanvasOpened(SessionCanvasOpenedData),
1017 ///
1018 /// <div class="warning">
1019 ///
1020 /// **Experimental.** This type is part of an experimental wire-protocol surface
1021 /// and may change or be removed in future SDK or CLI releases.
1022 ///
1023 /// </div>
1024 #[serde(rename = "session.canvas.registry_changed")]
1025 SessionCanvasRegistryChanged(SessionCanvasRegistryChangedData),
1026 ///
1027 /// <div class="warning">
1028 ///
1029 /// **Experimental.** This type is part of an experimental wire-protocol surface
1030 /// and may change or be removed in future SDK or CLI releases.
1031 ///
1032 /// </div>
1033 #[serde(rename = "session.canvas.closed")]
1034 SessionCanvasClosed(SessionCanvasClosedData),
1035 ///
1036 /// <div class="warning">
1037 ///
1038 /// **Experimental.** This type is part of an experimental wire-protocol surface
1039 /// and may change or be removed in future SDK or CLI releases.
1040 ///
1041 /// </div>
1042 #[serde(rename = "session.canvas.unavailable")]
1043 SessionCanvasUnavailable(SessionCanvasUnavailableData),
1044 ///
1045 /// <div class="warning">
1046 ///
1047 /// **Experimental.** This type is part of an experimental wire-protocol surface
1048 /// and may change or be removed in future SDK or CLI releases.
1049 ///
1050 /// </div>
1051 #[serde(rename = "session.canvas.recorded")]
1052 SessionCanvasRecorded(SessionCanvasRecordedData),
1053 ///
1054 /// <div class="warning">
1055 ///
1056 /// **Experimental.** This type is part of an experimental wire-protocol surface
1057 /// and may change or be removed in future SDK or CLI releases.
1058 ///
1059 /// </div>
1060 #[serde(rename = "session.canvas.removed")]
1061 SessionCanvasRemoved(SessionCanvasRemovedData),
1062 #[serde(rename = "session.extensions.attachments_pushed")]
1063 SessionExtensionsAttachmentsPushed(SessionExtensionsAttachmentsPushedData),
1064 #[serde(rename = "mcp_app.tool_call_complete")]
1065 McpAppToolCallComplete(McpAppToolCallCompleteData),
1066}
1067
1068/// A session event with typed data payload.
1069///
1070/// The common event fields (id, timestamp, parentId, ephemeral, agentId)
1071/// are available directly. The event-specific data is in the `payload`
1072/// field as a [`SessionEventData`] enum.
1073#[derive(Debug, Clone, Serialize, Deserialize)]
1074#[serde(rename_all = "camelCase")]
1075pub struct TypedSessionEvent {
1076 /// Unique event identifier (UUID v4).
1077 pub id: String,
1078 /// ISO 8601 timestamp when the event was created.
1079 pub timestamp: String,
1080 /// ID of the preceding event in the chain.
1081 #[serde(skip_serializing_if = "Option::is_none")]
1082 pub parent_id: Option<String>,
1083 /// When true, the event is transient and not persisted.
1084 #[serde(skip_serializing_if = "Option::is_none")]
1085 pub ephemeral: Option<bool>,
1086 /// Sub-agent instance identifier. Absent for events from the root /
1087 /// main agent and session-level events.
1088 #[serde(skip_serializing_if = "Option::is_none")]
1089 pub agent_id: Option<String>,
1090 /// The typed event payload (discriminated by event type).
1091 #[serde(flatten)]
1092 pub payload: SessionEventData,
1093}
1094
1095/// Working directory and git context at session start
1096#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1097#[serde(rename_all = "camelCase")]
1098pub struct WorkingDirectoryContext {
1099 /// Base commit of current git branch at session start time
1100 #[serde(skip_serializing_if = "Option::is_none")]
1101 pub base_commit: Option<String>,
1102 /// Current git branch name
1103 #[serde(skip_serializing_if = "Option::is_none")]
1104 pub branch: Option<String>,
1105 /// Current working directory path
1106 pub cwd: String,
1107 /// Root directory of the git repository, resolved via git rev-parse
1108 #[serde(skip_serializing_if = "Option::is_none")]
1109 pub git_root: Option<String>,
1110 /// Head commit of current git branch at session start time
1111 #[serde(skip_serializing_if = "Option::is_none")]
1112 pub head_commit: Option<String>,
1113 /// Hosting platform type of the repository (github or ado)
1114 #[serde(skip_serializing_if = "Option::is_none")]
1115 pub host_type: Option<WorkingDirectoryContextHostType>,
1116 /// 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).
1117 #[serde(skip_serializing_if = "Option::is_none")]
1118 pub pending_git_context: Option<bool>,
1119 /// Repository identifier derived from the git remote URL ("owner/name" for GitHub, "org/project/repo" for Azure DevOps)
1120 #[serde(skip_serializing_if = "Option::is_none")]
1121 pub repository: Option<String>,
1122 /// Raw host string from the git remote URL (e.g. "github.com", "mycompany.ghe.com", "dev.azure.com")
1123 #[serde(skip_serializing_if = "Option::is_none")]
1124 pub repository_host: Option<String>,
1125}
1126
1127/// Per-session configuration for the built-in GitHub MCP server
1128#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1129#[serde(rename_all = "camelCase")]
1130pub struct GitHubMcpToolConfig {
1131 /// Additional GitHub MCP tools requested by the session
1132 #[serde(skip_serializing_if = "Option::is_none")]
1133 pub additional_tools: Option<Vec<String>>,
1134 /// Additional GitHub MCP toolsets requested by the session
1135 #[serde(skip_serializing_if = "Option::is_none")]
1136 pub additional_toolsets: Option<Vec<String>>,
1137 /// Whether to use the read-write endpoint and request all toolsets
1138 #[serde(skip_serializing_if = "Option::is_none")]
1139 pub enable_all_tools: Option<bool>,
1140 /// Whether to request the GitHub MCP insiders build
1141 #[serde(skip_serializing_if = "Option::is_none")]
1142 pub enable_insiders_mode: Option<bool>,
1143}
1144
1145/// Optional session limits.
1146#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1147#[serde(rename_all = "camelCase")]
1148pub struct SessionLimitsConfig {
1149 /// Maximum AI Credits allowed across the session's current accounting window.
1150 #[serde(skip_serializing_if = "Option::is_none")]
1151 pub max_ai_credits: Option<f64>,
1152}
1153
1154/// Session event "session.start". Session initialization metadata including context and configuration
1155#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1156#[serde(rename_all = "camelCase")]
1157pub struct SessionStartData {
1158 /// Whether the session was already in use by another client at start time
1159 #[serde(skip_serializing_if = "Option::is_none")]
1160 pub already_in_use: Option<bool>,
1161 /// Auto routing preference selected at session creation time
1162 #[serde(skip_serializing_if = "Option::is_none")]
1163 pub auto_tier: Option<AutoTier>,
1164 /// Working directory and git context at session start
1165 #[serde(skip_serializing_if = "Option::is_none")]
1166 pub context: Option<WorkingDirectoryContext>,
1167 /// Context tier selected at session creation time for models with tiered context pricing; null when no tier is selected (e.g., non-tiered model)
1168 #[serde(skip_serializing_if = "Option::is_none")]
1169 pub context_tier: Option<ContextTier>,
1170 /// Version string of the Copilot application
1171 pub copilot_version: String,
1172 /// 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.
1173 #[serde(skip_serializing_if = "Option::is_none")]
1174 pub detached_from_spawning_parent_session_id: Option<String>,
1175 /// Per-session GitHub MCP override persisted for cold resume
1176 #[serde(skip_serializing_if = "Option::is_none")]
1177 pub github_mcp_tool_config: Option<GitHubMcpToolConfig>,
1178 /// Identifier of the software producing the events (e.g., "copilot-agent")
1179 pub producer: String,
1180 /// Reasoning effort level used for model calls, if applicable (e.g. "none", "low", "medium", "high", "xhigh", "max")
1181 #[serde(skip_serializing_if = "Option::is_none")]
1182 pub reasoning_effort: Option<String>,
1183 /// Reasoning summary mode used for model calls, if applicable (e.g. "none", "concise", "detailed")
1184 #[serde(skip_serializing_if = "Option::is_none")]
1185 pub reasoning_summary: Option<ReasoningSummary>,
1186 /// Whether this session supports remote steering via GitHub
1187 #[serde(skip_serializing_if = "Option::is_none")]
1188 pub remote_steerable: Option<bool>,
1189 /// Model selected at session creation time, if any
1190 #[serde(skip_serializing_if = "Option::is_none")]
1191 pub selected_model: Option<String>,
1192 /// Unique identifier for the session
1193 pub session_id: SessionId,
1194 /// Session limits configured at session creation time, if any
1195 #[serde(skip_serializing_if = "Option::is_none")]
1196 pub session_limits: Option<SessionLimitsConfig>,
1197 /// ISO 8601 timestamp when the session was created
1198 pub start_time: String,
1199 /// Output verbosity level used for model calls, if applicable (e.g. "low", "medium", "high")
1200 #[serde(skip_serializing_if = "Option::is_none")]
1201 pub verbosity: Option<Verbosity>,
1202 /// Schema version number for the session event format
1203 pub version: i64,
1204}
1205
1206/// Session event "session.resume". Session resume metadata including current context and event count
1207#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1208#[serde(rename_all = "camelCase")]
1209pub struct SessionResumeData {
1210 /// Whether the session was already in use by another client at resume time
1211 #[serde(skip_serializing_if = "Option::is_none")]
1212 pub already_in_use: Option<bool>,
1213 /// Auto routing preference active at resume time
1214 #[serde(skip_serializing_if = "Option::is_none")]
1215 pub auto_tier: Option<AutoTier>,
1216 /// Updated working directory and git context at resume time
1217 #[serde(skip_serializing_if = "Option::is_none")]
1218 pub context: Option<WorkingDirectoryContext>,
1219 /// Context tier currently selected at resume time; null when no tier is active
1220 #[serde(skip_serializing_if = "Option::is_none")]
1221 pub context_tier: Option<ContextTier>,
1222 /// 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.
1223 #[serde(skip_serializing_if = "Option::is_none")]
1224 pub continue_pending_work: Option<bool>,
1225 /// Total number of persisted events in the session at the time of resume
1226 pub event_count: i64,
1227 /// 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
1228 #[serde(skip_serializing_if = "Option::is_none")]
1229 pub events_file_size_bytes: Option<i64>,
1230 /// Reasoning effort level used for model calls, if applicable (e.g. "none", "low", "medium", "high", "xhigh", "max")
1231 #[serde(skip_serializing_if = "Option::is_none")]
1232 pub reasoning_effort: Option<String>,
1233 /// Reasoning summary mode used for model calls, if applicable (e.g. "none", "concise", "detailed")
1234 #[serde(skip_serializing_if = "Option::is_none")]
1235 pub reasoning_summary: Option<ReasoningSummary>,
1236 /// Whether this session supports remote steering via GitHub
1237 #[serde(skip_serializing_if = "Option::is_none")]
1238 pub remote_steerable: Option<bool>,
1239 /// ISO 8601 timestamp when the session was resumed
1240 pub resume_time: String,
1241 /// Model currently selected at resume time
1242 #[serde(skip_serializing_if = "Option::is_none")]
1243 pub selected_model: Option<String>,
1244 /// Session limits currently configured at resume time; null when no limits are active
1245 #[serde(skip_serializing_if = "Option::is_none")]
1246 pub session_limits: Option<SessionLimitsConfig>,
1247 /// 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.
1248 #[serde(skip_serializing_if = "Option::is_none")]
1249 pub session_was_active: Option<bool>,
1250 /// Output verbosity level used for model calls, if applicable (e.g. "low", "medium", "high")
1251 #[serde(skip_serializing_if = "Option::is_none")]
1252 pub verbosity: Option<Verbosity>,
1253}
1254
1255/// Session event "session.remote_steerable_changed". Notifies that the session's remote steering capability has changed
1256#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1257#[serde(rename_all = "camelCase")]
1258pub struct SessionRemoteSteerableChangedData {
1259 /// Whether this session now supports remote steering via GitHub
1260 pub remote_steerable: bool,
1261}
1262
1263/// Session event "session.error". Error details for timeline display including message and optional diagnostic information
1264#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1265#[serde(rename_all = "camelCase")]
1266pub struct SessionErrorData {
1267 /// 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.
1268 #[serde(skip_serializing_if = "Option::is_none")]
1269 pub eligible_for_auto_switch: Option<bool>,
1270 /// 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"`).
1271 #[serde(skip_serializing_if = "Option::is_none")]
1272 pub error_code: Option<String>,
1273 /// Category of error (e.g., "authentication", "authorization", "quota", "rate_limit", "context_limit", "query")
1274 pub error_type: String,
1275 /// Human-readable error message
1276 pub message: String,
1277 /// GitHub request tracing ID (x-github-request-id header) for correlating with server-side logs
1278 #[serde(skip_serializing_if = "Option::is_none")]
1279 pub provider_call_id: Option<String>,
1280 /// 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.
1281 #[serde(skip_serializing_if = "Option::is_none")]
1282 pub remediation: Option<RemediationAction>,
1283 /// Copilot service request ID (x-copilot-service-request-id header) for CAPI log correlation
1284 #[serde(skip_serializing_if = "Option::is_none")]
1285 pub service_request_id: Option<String>,
1286 /// Error stack trace, when available
1287 #[serde(skip_serializing_if = "Option::is_none")]
1288 pub stack: Option<String>,
1289 /// HTTP status code from the upstream request, if applicable
1290 #[serde(skip_serializing_if = "Option::is_none")]
1291 pub status_code: Option<i32>,
1292 /// Optional URL associated with this error that the user can open in a browser
1293 #[serde(skip_serializing_if = "Option::is_none")]
1294 pub url: Option<String>,
1295}
1296
1297/// Session event "session.idle". Payload indicating the session is idle with no background agents or attached shell commands in flight
1298#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1299#[serde(rename_all = "camelCase")]
1300pub struct SessionIdleData {
1301 /// True when the preceding agentic loop was cancelled via abort signal
1302 #[serde(skip_serializing_if = "Option::is_none")]
1303 pub aborted: Option<bool>,
1304 /// 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.
1305 #[serde(skip_serializing_if = "Option::is_none")]
1306 pub mode: Option<SessionMode>,
1307}
1308
1309/// Session event "session.title_changed". Session title change payload containing the new display title
1310#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1311#[serde(rename_all = "camelCase")]
1312pub struct SessionTitleChangedData {
1313 /// The new display title for the session
1314 pub title: String,
1315}
1316
1317/// Session event "session.schedule_created". Scheduled prompt registered via /every or /after
1318#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1319#[serde(rename_all = "camelCase")]
1320pub struct SessionScheduleCreatedData {
1321 /// Absolute fire time (epoch milliseconds) for a one-shot calendar schedule
1322 #[serde(skip_serializing_if = "Option::is_none")]
1323 pub at: Option<i64>,
1324 /// 5-field cron expression for a recurring calendar schedule, evaluated in `tz`
1325 #[serde(skip_serializing_if = "Option::is_none")]
1326 pub cron: Option<String>,
1327 /// 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)
1328 #[serde(skip_serializing_if = "Option::is_none")]
1329 pub display_prompt: Option<String>,
1330 /// Sequential id assigned to the scheduled prompt within the session
1331 pub id: i64,
1332 /// Interval between ticks in milliseconds (relative-interval schedules)
1333 #[serde(skip_serializing_if = "Option::is_none")]
1334 pub interval_ms: Option<i64>,
1335 /// 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.
1336 #[serde(skip_serializing_if = "Option::is_none")]
1337 pub origin: Option<ScheduleOrigin>,
1338 /// Prompt text that gets enqueued on every tick
1339 pub prompt: String,
1340 /// Whether the schedule re-arms after each tick (`/every`) or fires once (`/after`)
1341 #[serde(skip_serializing_if = "Option::is_none")]
1342 pub recurring: Option<bool>,
1343 /// 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.
1344 #[serde(skip_serializing_if = "Option::is_none")]
1345 pub self_paced: Option<bool>,
1346 /// IANA timezone the `cron` expression is evaluated in
1347 #[serde(skip_serializing_if = "Option::is_none")]
1348 pub tz: Option<String>,
1349}
1350
1351/// Session event "session.schedule_cancelled". Scheduled prompt cancelled from the schedule manager dialog
1352#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1353#[serde(rename_all = "camelCase")]
1354pub struct SessionScheduleCancelledData {
1355 /// Id of the scheduled prompt that was cancelled
1356 pub id: i64,
1357}
1358
1359/// Session event "session.schedule_rearmed". Self-paced schedule re-armed for its next run
1360#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1361#[serde(rename_all = "camelCase")]
1362pub struct SessionScheduleRearmedData {
1363 /// Id of the self-paced schedule that was re-armed
1364 pub id: i64,
1365 /// Absolute time (epoch milliseconds) the model armed the next run to fire
1366 pub next_run_at: i64,
1367}
1368
1369/// Session event "session.autopilot_objective_changed". Autopilot objective state file operation details indicating what changed
1370#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1371#[serde(rename_all = "camelCase")]
1372pub struct SessionAutopilotObjectiveChangedData {
1373 /// Current autopilot objective id, if one exists
1374 #[serde(skip_serializing_if = "Option::is_none")]
1375 pub id: Option<i64>,
1376 /// The type of operation performed on the autopilot objective state file
1377 pub operation: AutopilotObjectiveChangedOperation,
1378 /// Current autopilot objective status, if one exists
1379 #[serde(skip_serializing_if = "Option::is_none")]
1380 pub status: Option<AutopilotObjectiveChangedStatus>,
1381}
1382
1383/// Session event "session.info". Informational message for timeline display with categorization
1384#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1385#[serde(rename_all = "camelCase")]
1386pub struct SessionInfoData {
1387 /// Category of informational message (e.g., "notification", "timing", "context_window", "mcp", "snapshot", "configuration", "authentication", "model")
1388 pub info_type: String,
1389 /// Human-readable informational message for display in the timeline
1390 pub message: String,
1391 /// Optional actionable tip displayed with this message
1392 #[serde(skip_serializing_if = "Option::is_none")]
1393 pub tip: Option<String>,
1394 /// Optional URL associated with this message that the user can open in a browser
1395 #[serde(skip_serializing_if = "Option::is_none")]
1396 pub url: Option<String>,
1397}
1398
1399#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1400#[serde(rename_all = "camelCase")]
1401pub struct IndexedSearchDataStatus {
1402 /// Indexed-search event variant discriminator.
1403 pub kind: IndexedSearchDataStatusKind,
1404 /// Current indexed-search state for this session activation.
1405 pub state: IndexedSearchState,
1406}
1407
1408#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1409#[serde(rename_all = "camelCase")]
1410pub struct IndexedSearchDataStartup {
1411 /// Why indexed search was disabled, when applicable.
1412 #[serde(skip_serializing_if = "Option::is_none")]
1413 pub disabled_reason: Option<IndexedSearchDisabledReason>,
1414 /// Whether the repository meets the automatic indexing file-count threshold, when known.
1415 #[serde(skip_serializing_if = "Option::is_none")]
1416 pub eligible: Option<bool>,
1417 /// Startup failure details. May contain sensitive user data; restricted telemetry only.
1418 #[serde(skip_serializing_if = "Option::is_none")]
1419 pub error_message: Option<String>,
1420 /// Number of text files counted in the repository.
1421 #[serde(skip_serializing_if = "Option::is_none")]
1422 pub file_count: Option<f64>,
1423 /// Whether indexed search was explicitly enabled through the environment.
1424 pub forced_by_env: bool,
1425 /// Indexed-search event variant discriminator.
1426 pub kind: IndexedSearchDataStartupKind,
1427 /// Outcome of this startup attempt.
1428 pub outcome: IndexedSearchOutcome,
1429 /// Wall-clock duration of startup in milliseconds.
1430 pub startup_duration_ms: f64,
1431 /// Whether waiting for index readiness was requested, including skipped attempts.
1432 pub warm_start: bool,
1433}
1434
1435#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1436#[serde(rename_all = "camelCase")]
1437pub struct IndexedSearchDataServerError {
1438 /// Server failure details. May contain sensitive user data; restricted telemetry only.
1439 #[serde(skip_serializing_if = "Option::is_none")]
1440 pub error_message: Option<String>,
1441 /// Category of the server failure.
1442 pub error_type: IndexedSearchErrorType,
1443 /// Process exit code, when available.
1444 #[serde(skip_serializing_if = "Option::is_none")]
1445 pub exit_code: Option<f64>,
1446 /// Indexed-search event variant discriminator.
1447 pub kind: IndexedSearchDataServerErrorKind,
1448}
1449
1450#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1451#[serde(rename_all = "camelCase")]
1452pub struct IndexedSearchDataIncremental {
1453 /// Number of added files.
1454 #[serde(skip_serializing_if = "Option::is_none")]
1455 pub added_file_count: Option<f64>,
1456 /// Number of modified files.
1457 #[serde(skip_serializing_if = "Option::is_none")]
1458 pub changed_file_count: Option<f64>,
1459 /// Number of deleted files.
1460 #[serde(skip_serializing_if = "Option::is_none")]
1461 pub deleted_file_count: Option<f64>,
1462 /// Indexed-search event variant discriminator.
1463 pub kind: IndexedSearchDataIncrementalKind,
1464 /// Phase of the incremental index update.
1465 pub phase: IndexedSearchIncrementalPhase,
1466 /// Total number of detected changes.
1467 #[serde(skip_serializing_if = "Option::is_none")]
1468 pub total_change_count: Option<f64>,
1469 /// Total incremental indexing duration in milliseconds.
1470 #[serde(skip_serializing_if = "Option::is_none")]
1471 pub total_duration_ms: Option<f64>,
1472 /// Index update duration in milliseconds.
1473 #[serde(skip_serializing_if = "Option::is_none")]
1474 pub update_duration_ms: Option<f64>,
1475 /// Workspace scan duration in milliseconds.
1476 #[serde(skip_serializing_if = "Option::is_none")]
1477 pub walk_duration_ms: Option<f64>,
1478}
1479
1480/// Session event "session.warning". Warning message for timeline display with categorization
1481#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1482#[serde(rename_all = "camelCase")]
1483pub struct SessionWarningData {
1484 /// Human-readable warning message for display in the timeline
1485 pub message: String,
1486 /// 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.
1487 #[serde(skip_serializing_if = "Option::is_none")]
1488 pub remediation: Option<RemediationAction>,
1489 /// Optional URL associated with this warning that the user can open in a browser
1490 #[serde(skip_serializing_if = "Option::is_none")]
1491 pub url: Option<String>,
1492 /// Category of warning (e.g., "subscription", "policy", "mcp")
1493 pub warning_type: String,
1494}
1495
1496/// Session event "session.model_change". Model change details including previous and new model identifiers
1497#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1498#[serde(rename_all = "camelCase")]
1499pub struct SessionModelChangeData {
1500 /// Committed Auto preference after the model configuration change, when applicable.
1501 #[serde(skip_serializing_if = "Option::is_none")]
1502 pub auto_tier: Option<AutoTier>,
1503 /// 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.
1504 #[serde(skip_serializing_if = "Option::is_none")]
1505 pub cause: Option<String>,
1506 /// Context tier after the model change; null explicitly clears a previously selected tier
1507 #[serde(skip_serializing_if = "Option::is_none")]
1508 pub context_tier: Option<ContextTier>,
1509 /// Newly selected model identifier
1510 pub new_model: String,
1511 /// Previously committed Auto preference, when one was explicitly selected.
1512 #[serde(skip_serializing_if = "Option::is_none")]
1513 pub previous_auto_tier: Option<AutoTier>,
1514 /// Model that was previously selected, if any
1515 #[serde(skip_serializing_if = "Option::is_none")]
1516 pub previous_model: Option<String>,
1517 /// Reasoning effort level before the model change, if applicable
1518 #[serde(skip_serializing_if = "Option::is_none")]
1519 pub previous_reasoning_effort: Option<String>,
1520 /// Reasoning summary mode before the model change, if applicable
1521 #[serde(skip_serializing_if = "Option::is_none")]
1522 pub previous_reasoning_summary: Option<ReasoningSummary>,
1523 /// Output verbosity level before the model change, if applicable
1524 #[serde(skip_serializing_if = "Option::is_none")]
1525 pub previous_verbosity: Option<Verbosity>,
1526 /// Reasoning effort level after the model change, if applicable
1527 #[serde(skip_serializing_if = "Option::is_none")]
1528 pub reasoning_effort: Option<String>,
1529 /// Reasoning summary mode after the model change, if applicable
1530 #[serde(skip_serializing_if = "Option::is_none")]
1531 pub reasoning_summary: Option<ReasoningSummary>,
1532 /// Origin of the effective model change, when known.
1533 #[serde(skip_serializing_if = "Option::is_none")]
1534 pub source: Option<ModelChangeSource>,
1535 /// Output verbosity level after the model change, if applicable
1536 #[serde(skip_serializing_if = "Option::is_none")]
1537 pub verbosity: Option<Verbosity>,
1538}
1539
1540/// Session event "session.auto_tier_recommendation". Live-only Auto preference recommendation from Copilot API after a successful Auto model call.
1541///
1542/// <div class="warning">
1543///
1544/// **Experimental.** This type is part of an experimental wire-protocol surface
1545/// and may change or be removed in future SDK or CLI releases.
1546///
1547/// </div>
1548#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1549#[serde(rename_all = "camelCase")]
1550pub struct SessionAutoTierRecommendationData {
1551 /// Recommended Auto preference.
1552 pub recommended_auto_tier: RecommendedAutoTier,
1553}
1554
1555/// 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.
1556#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1557#[serde(rename_all = "camelCase")]
1558pub struct SessionAutoTierSwitchFailedData {
1559 /// Auto preference that remains effective after the failed request.
1560 #[serde(skip_serializing_if = "Option::is_none")]
1561 pub effective_auto_tier: Option<AutoTier>,
1562 /// Low-cardinality failure outcome reported by Auto resolution.
1563 pub reason: AutoTierSwitchFailureReason,
1564 /// Auto preference that failed to activate, or null when returning to provider-default routing failed.
1565 pub requested_auto_tier: Option<AutoTier>,
1566}
1567
1568/// Session event "session.mode_changed". Agent mode change details including previous and new modes
1569#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1570#[serde(rename_all = "camelCase")]
1571pub struct SessionModeChangedData {
1572 /// The session mode the agent is operating in
1573 pub new_mode: SessionMode,
1574 /// The session mode the agent is operating in
1575 pub previous_mode: SessionMode,
1576}
1577
1578/// 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.
1579#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1580#[serde(rename_all = "camelCase")]
1581pub struct SessionModeNoticeDeliveredData {
1582 /// Model-visible transition notice persisted for a mid-turn delivery
1583 #[serde(skip_serializing_if = "Option::is_none")]
1584 pub content: Option<String>,
1585 /// Mode established by the delivered transition notice
1586 pub mode: SessionMode,
1587}
1588
1589/// Session event "session.session_limits_changed". Session limits update details. Null clears the limits.
1590#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1591#[serde(rename_all = "camelCase")]
1592pub struct SessionSessionLimitsChangedData {
1593 /// Current session limits, or null when no limits are active
1594 pub session_limits: Option<SessionLimitsConfig>,
1595}
1596
1597/// Session event "session.permissions_changed". Permission-mode transition details.
1598///
1599/// <div class="warning">
1600///
1601/// **Experimental.** This type is part of an experimental wire-protocol surface
1602/// and may change or be removed in future SDK or CLI releases.
1603///
1604/// </div>
1605#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1606#[serde(rename_all = "camelCase")]
1607pub struct SessionPermissionsChangedData {
1608 /// Explicit LLM judge model override used by assisted mode; omitted when the provider default applies
1609 ///
1610 /// <div class="warning">
1611 ///
1612 /// **Experimental.** This type is part of an experimental wire-protocol surface
1613 /// and may change or be removed in future SDK or CLI releases.
1614 ///
1615 /// </div>
1616 #[serde(skip_serializing_if = "Option::is_none")]
1617 pub assisted_approval_model: Option<String>,
1618 /// Permission mode after the change
1619 ///
1620 /// <div class="warning">
1621 ///
1622 /// **Experimental.** This type is part of an experimental wire-protocol surface
1623 /// and may change or be removed in future SDK or CLI releases.
1624 ///
1625 /// </div>
1626 #[serde(skip_serializing_if = "Option::is_none")]
1627 pub mode: Option<PermissionMode>,
1628 /// Permission mode before the change
1629 ///
1630 /// <div class="warning">
1631 ///
1632 /// **Experimental.** This type is part of an experimental wire-protocol surface
1633 /// and may change or be removed in future SDK or CLI releases.
1634 ///
1635 /// </div>
1636 #[serde(skip_serializing_if = "Option::is_none")]
1637 pub previous_mode: Option<PermissionMode>,
1638}
1639
1640/// Session event "session.plan_changed". Plan file operation details indicating what changed
1641#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1642#[serde(rename_all = "camelCase")]
1643pub struct SessionPlanChangedData {
1644 /// The type of operation performed on the plan file
1645 pub operation: PlanChangedOperation,
1646}
1647
1648/// 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.
1649#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1650#[serde(rename_all = "camelCase")]
1651pub struct SessionTodosChangedData {}
1652
1653/// Session event "session.workspace_file_changed". Workspace file change details including path and operation type
1654#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1655#[serde(rename_all = "camelCase")]
1656pub struct SessionWorkspaceFileChangedData {
1657 /// Whether the file was newly created or updated
1658 pub operation: WorkspaceFileChangedOperation,
1659 /// Relative path within the session workspace files directory
1660 pub path: String,
1661}
1662
1663/// Repository context for the handed-off session
1664#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1665#[serde(rename_all = "camelCase")]
1666pub struct HandoffRepository {
1667 /// Git branch name, if applicable
1668 #[serde(skip_serializing_if = "Option::is_none")]
1669 pub branch: Option<String>,
1670 /// Repository name
1671 pub name: String,
1672 /// Repository owner (user or organization)
1673 pub owner: String,
1674}
1675
1676/// Session event "session.handoff". Session handoff metadata including source, context, and repository information
1677#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1678#[serde(rename_all = "camelCase")]
1679pub struct SessionHandoffData {
1680 /// Additional context information for the handoff
1681 #[serde(skip_serializing_if = "Option::is_none")]
1682 pub context: Option<String>,
1683 /// ISO 8601 timestamp when the handoff occurred
1684 pub handoff_time: String,
1685 /// GitHub host URL for the source session (e.g., https://github.com or https://tenant.ghe.com)
1686 #[serde(skip_serializing_if = "Option::is_none")]
1687 pub host: Option<String>,
1688 /// Session ID of the remote session being handed off
1689 #[serde(skip_serializing_if = "Option::is_none")]
1690 pub remote_session_id: Option<SessionId>,
1691 /// Repository context for the handed-off session
1692 #[serde(skip_serializing_if = "Option::is_none")]
1693 pub repository: Option<HandoffRepository>,
1694 /// Origin type of the session being handed off
1695 pub source_type: HandoffSourceType,
1696 /// Summary of the work done in the source session
1697 #[serde(skip_serializing_if = "Option::is_none")]
1698 pub summary: Option<String>,
1699}
1700
1701/// Session event "session.truncation". Conversation truncation statistics including token counts and removed content metrics
1702#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1703#[serde(rename_all = "camelCase")]
1704pub struct SessionTruncationData {
1705 /// Number of messages removed by truncation
1706 pub messages_removed_during_truncation: i64,
1707 /// Identifier of the component that performed truncation (e.g., "BasicTruncator")
1708 pub performed_by: String,
1709 /// Number of conversation messages after truncation
1710 pub post_truncation_messages_length: i64,
1711 /// Total tokens in conversation messages after truncation
1712 pub post_truncation_tokens_in_messages: i64,
1713 /// Number of conversation messages before truncation
1714 pub pre_truncation_messages_length: i64,
1715 /// Total tokens in conversation messages before truncation
1716 pub pre_truncation_tokens_in_messages: i64,
1717 /// Maximum token count for the model's context window
1718 pub token_limit: i64,
1719 /// Number of tokens removed by truncation
1720 pub tokens_removed_during_truncation: i64,
1721}
1722
1723/// Session event "session.snapshot_rewind". Session rewind details including target event and count of removed events
1724#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1725#[serde(rename_all = "camelCase")]
1726pub struct SessionSnapshotRewindData {
1727 /// Number of events that were removed by the rewind
1728 pub events_removed: i64,
1729 /// Event ID that was rewound to; this event and all after it were removed
1730 pub up_to_event_id: String,
1731}
1732
1733/// Request count and cost metrics
1734#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1735#[serde(rename_all = "camelCase")]
1736pub struct ShutdownModelMetricRequests {
1737 /// Cumulative cost multiplier for requests to this model
1738 ///
1739 /// <div class="warning">
1740 ///
1741 /// **Experimental.** This type is part of an experimental wire-protocol surface
1742 /// and may change or be removed in future SDK or CLI releases.
1743 ///
1744 /// </div>
1745 #[serde(skip_serializing_if = "Option::is_none")]
1746 pub cost: Option<f64>,
1747 /// Total number of API requests made to this model
1748 ///
1749 /// <div class="warning">
1750 ///
1751 /// **Experimental.** This type is part of an experimental wire-protocol surface
1752 /// and may change or be removed in future SDK or CLI releases.
1753 ///
1754 /// </div>
1755 #[serde(skip_serializing_if = "Option::is_none")]
1756 pub count: Option<i64>,
1757}
1758
1759/// A token-type entry in a shutdown model metric, storing the accumulated token count.
1760#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1761#[serde(rename_all = "camelCase")]
1762pub struct ShutdownModelMetricTokenDetail {
1763 /// Accumulated token count for this token type
1764 pub token_count: i64,
1765}
1766
1767/// Token usage breakdown
1768#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1769#[serde(rename_all = "camelCase")]
1770pub struct ShutdownModelMetricUsage {
1771 /// Total tokens read from prompt cache across all requests
1772 pub cache_read_tokens: i64,
1773 /// Total tokens written to prompt cache across all requests
1774 pub cache_write_tokens: i64,
1775 /// Total input tokens consumed across all requests to this model
1776 pub input_tokens: i64,
1777 /// Total output tokens produced across all requests to this model
1778 pub output_tokens: i64,
1779 /// Total reasoning tokens produced across all requests to this model
1780 #[serde(skip_serializing_if = "Option::is_none")]
1781 pub reasoning_tokens: Option<i64>,
1782}
1783
1784/// Per-model shutdown metrics with request counts, token usage, nano-AI units, and token details.
1785#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1786#[serde(rename_all = "camelCase")]
1787pub struct ShutdownModelMetric {
1788 /// Request count and cost metrics
1789 pub requests: ShutdownModelMetricRequests,
1790 /// Token count details per type
1791 #[serde(skip_serializing_if = "Option::is_none")]
1792 pub token_details: Option<HashMap<String, ShutdownModelMetricTokenDetail>>,
1793 /// Accumulated nano-AI units cost for this model
1794 ///
1795 /// <div class="warning">
1796 ///
1797 /// **Experimental.** This type is part of an experimental wire-protocol surface
1798 /// and may change or be removed in future SDK or CLI releases.
1799 ///
1800 /// </div>
1801 #[serde(skip_serializing_if = "Option::is_none")]
1802 pub total_nano_aiu: Option<f64>,
1803 /// Token usage breakdown
1804 pub usage: ShutdownModelMetricUsage,
1805}
1806
1807/// Usage attributed to one agent instance at session shutdown.
1808#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1809#[serde(rename_all = "camelCase")]
1810pub struct ShutdownAgentMetric {
1811 /// 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.
1812 #[serde(skip_serializing_if = "Option::is_none")]
1813 pub agent_display_name: Option<String>,
1814 /// Configured agent name, when this is a subagent
1815 #[serde(skip_serializing_if = "Option::is_none")]
1816 pub agent_name: Option<String>,
1817 /// Per-model usage for this agent, keyed by model identifier
1818 pub model_metrics: HashMap<String, ShutdownModelMetric>,
1819 /// Time spent in model API calls by this agent, in milliseconds
1820 pub total_api_duration_ms: i64,
1821 /// Accumulated nano-AI units cost for this agent
1822 pub total_nano_aiu: f64,
1823}
1824
1825/// Aggregate code change metrics for the session
1826#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1827#[serde(rename_all = "camelCase")]
1828pub struct ShutdownCodeChanges {
1829 /// List of file paths that were modified during the session
1830 pub files_modified: Vec<String>,
1831 /// Total number of lines added during the session
1832 pub lines_added: i64,
1833 /// Total number of lines removed during the session
1834 pub lines_removed: i64,
1835}
1836
1837/// A session-wide shutdown token-type entry storing the accumulated token count.
1838#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1839#[serde(rename_all = "camelCase")]
1840pub struct ShutdownTokenDetail {
1841 /// Accumulated token count for this token type
1842 pub token_count: i64,
1843}
1844
1845/// Session event "session.shutdown". Session termination metrics including usage statistics, code changes, and shutdown reason
1846#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1847#[serde(rename_all = "camelCase")]
1848pub struct SessionShutdownData {
1849 /// Per-agent usage breakdown, keyed by agent instance identifier. The main conversation uses the stable key `main`.
1850 #[serde(skip_serializing_if = "Option::is_none")]
1851 pub agent_metrics: Option<HashMap<String, ShutdownAgentMetric>>,
1852 /// Aggregate code change metrics for the session
1853 pub code_changes: ShutdownCodeChanges,
1854 /// Non-system message token count at shutdown
1855 #[serde(skip_serializing_if = "Option::is_none")]
1856 pub conversation_tokens: Option<i64>,
1857 /// Model that was selected at the time of shutdown
1858 #[serde(skip_serializing_if = "Option::is_none")]
1859 pub current_model: Option<String>,
1860 /// Total tokens in context window at shutdown
1861 #[serde(skip_serializing_if = "Option::is_none")]
1862 pub current_tokens: Option<i64>,
1863 /// Error description when shutdownType is "error"
1864 #[serde(skip_serializing_if = "Option::is_none")]
1865 pub error_reason: Option<String>,
1866 /// 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
1867 #[serde(skip_serializing_if = "Option::is_none")]
1868 pub events_file_size_bytes: Option<i64>,
1869 /// Per-model usage breakdown, keyed by model identifier
1870 pub model_metrics: HashMap<String, ShutdownModelMetric>,
1871 /// Unix timestamp (milliseconds) when the session started
1872 pub session_start_time: i64,
1873 /// Whether the session ended normally ("routine") or due to a crash/fatal error ("error")
1874 pub shutdown_type: ShutdownType,
1875 /// System message token count at shutdown
1876 #[serde(skip_serializing_if = "Option::is_none")]
1877 pub system_tokens: Option<i64>,
1878 /// Session-wide per-token-type accumulated token counts
1879 #[serde(skip_serializing_if = "Option::is_none")]
1880 pub token_details: Option<HashMap<String, ShutdownTokenDetail>>,
1881 /// Tool definitions token count at shutdown
1882 #[serde(skip_serializing_if = "Option::is_none")]
1883 pub tool_definitions_tokens: Option<i64>,
1884 /// Cumulative time spent in API calls during the session, in milliseconds
1885 pub total_api_duration_ms: i64,
1886 /// Session-wide accumulated nano-AI units cost
1887 ///
1888 /// <div class="warning">
1889 ///
1890 /// **Experimental.** This type is part of an experimental wire-protocol surface
1891 /// and may change or be removed in future SDK or CLI releases.
1892 ///
1893 /// </div>
1894 #[serde(skip_serializing_if = "Option::is_none")]
1895 pub total_nano_aiu: Option<f64>,
1896 /// Total number of premium API requests used during the session
1897 #[doc(hidden)]
1898 #[serde(skip_serializing_if = "Option::is_none")]
1899 pub(crate) total_premium_requests: Option<f64>,
1900}
1901
1902/// Internal prompt-cache expiration state for one model
1903#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1904#[serde(rename_all = "camelCase")]
1905pub(crate) struct UsageCheckpointModelCacheState {
1906 /// Latest known prompt-cache expiration
1907 pub cache_expires_at: String,
1908 /// Retained cache lifetime in seconds, used to refresh expiration after a cache read
1909 #[doc(hidden)]
1910 pub(crate) cache_ttl_seconds: i64,
1911 /// Model identifier associated with this cache state
1912 pub model_id: String,
1913}
1914
1915/// Session event "session.usage_checkpoint". Durable session usage checkpoint for reconstructing aggregate accounting on resume
1916#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1917#[serde(rename_all = "camelCase")]
1918pub struct SessionUsageCheckpointData {
1919 /// Internal per-model prompt-cache state used to restore expiration tracking on resume
1920 #[doc(hidden)]
1921 #[serde(skip_serializing_if = "Option::is_none")]
1922 pub(crate) model_cache_state: Option<Vec<UsageCheckpointModelCacheState>>,
1923 /// Internal per-conversation prompt-cache-break detector baselines restored on resume
1924 #[doc(hidden)]
1925 #[serde(skip_serializing_if = "Option::is_none")]
1926 pub(crate) prompt_cache_break_state: Option<Vec<serde_json::Value>>,
1927 /// Session-wide accumulated nano-AI units cost at checkpoint time
1928 pub total_nano_aiu: f64,
1929 /// Total number of premium API requests used at checkpoint time
1930 #[doc(hidden)]
1931 #[serde(skip_serializing_if = "Option::is_none")]
1932 pub(crate) total_premium_requests: Option<f64>,
1933}
1934
1935/// Session event "session.context_changed". Updated working directory and git context after the change
1936#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1937#[serde(rename_all = "camelCase")]
1938pub struct SessionContextChangedData {
1939 /// Base commit of current git branch at session start time
1940 #[serde(skip_serializing_if = "Option::is_none")]
1941 pub base_commit: Option<String>,
1942 /// Current git branch name
1943 #[serde(skip_serializing_if = "Option::is_none")]
1944 pub branch: Option<String>,
1945 /// Current working directory path
1946 pub cwd: String,
1947 /// Root directory of the git repository, resolved via git rev-parse
1948 #[serde(skip_serializing_if = "Option::is_none")]
1949 pub git_root: Option<String>,
1950 /// Head commit of current git branch at session start time
1951 #[serde(skip_serializing_if = "Option::is_none")]
1952 pub head_commit: Option<String>,
1953 /// Hosting platform type of the repository (github or ado)
1954 #[serde(skip_serializing_if = "Option::is_none")]
1955 pub host_type: Option<WorkingDirectoryContextHostType>,
1956 /// 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).
1957 #[serde(skip_serializing_if = "Option::is_none")]
1958 pub pending_git_context: Option<bool>,
1959 /// Repository identifier derived from the git remote URL ("owner/name" for GitHub, "org/project/repo" for Azure DevOps)
1960 #[serde(skip_serializing_if = "Option::is_none")]
1961 pub repository: Option<String>,
1962 /// Raw host string from the git remote URL (e.g. "github.com", "mycompany.ghe.com", "dev.azure.com")
1963 #[serde(skip_serializing_if = "Option::is_none")]
1964 pub repository_host: Option<String>,
1965}
1966
1967/// Session event "session.usage_info". Current context window usage statistics including token and message counts
1968#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1969#[serde(rename_all = "camelCase")]
1970pub struct SessionUsageInfoData {
1971 /// Token count from non-system messages (user, assistant, tool)
1972 #[serde(skip_serializing_if = "Option::is_none")]
1973 pub conversation_tokens: Option<i64>,
1974 /// Current number of tokens in the context window
1975 pub current_tokens: i64,
1976 /// Whether this is the first usage_info event emitted in this session
1977 #[serde(skip_serializing_if = "Option::is_none")]
1978 pub is_initial: Option<bool>,
1979 /// Current number of messages in the conversation
1980 pub messages_length: i64,
1981 /// Token count from system message(s)
1982 #[serde(skip_serializing_if = "Option::is_none")]
1983 pub system_tokens: Option<i64>,
1984 /// Maximum token count for the model's context window
1985 pub token_limit: i64,
1986 /// Token count from tool definitions
1987 #[serde(skip_serializing_if = "Option::is_none")]
1988 pub tool_definitions_tokens: Option<i64>,
1989}
1990
1991/// Session event "session.context_cleared". Context-cleared details emitted when the host clears the conversation (the session.history.clearContext RPC / Session.clearContextMessages)
1992#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1993#[serde(rename_all = "camelCase")]
1994pub struct SessionContextClearedData {
1995 /// Optional initial message set after clearing
1996 #[serde(skip_serializing_if = "Option::is_none")]
1997 pub initial_message: Option<String>,
1998 /// Number of conversation messages that were cleared
1999 pub messages_cleared: i64,
2000}
2001
2002/// Session event "session.compaction_start". Context window breakdown at the start of LLM-powered conversation compaction
2003#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2004#[serde(rename_all = "camelCase")]
2005pub struct SessionCompactionStartData {
2006 /// Token count from non-system messages (user, assistant, tool) at compaction start
2007 #[serde(skip_serializing_if = "Option::is_none")]
2008 pub conversation_tokens: Option<i64>,
2009 /// Total context tokens (system + conversation + tool definitions) at compaction start, when known
2010 #[serde(skip_serializing_if = "Option::is_none")]
2011 pub current_tokens: Option<i64>,
2012 /// Model identifier used for compaction, when known
2013 #[serde(skip_serializing_if = "Option::is_none")]
2014 pub model: Option<String>,
2015 /// Token count from system message(s) at compaction start
2016 #[serde(skip_serializing_if = "Option::is_none")]
2017 pub system_tokens: Option<i64>,
2018 /// Model context window token limit the compaction is targeting, when known
2019 #[serde(skip_serializing_if = "Option::is_none")]
2020 pub token_limit: Option<i64>,
2021 /// Token count from tool definitions at compaction start
2022 #[serde(skip_serializing_if = "Option::is_none")]
2023 pub tool_definitions_tokens: Option<i64>,
2024 /// What initiated this compaction, when known
2025 #[serde(skip_serializing_if = "Option::is_none")]
2026 pub trigger: Option<CompactionTrigger>,
2027}
2028
2029/// Token usage detail for a single billing category
2030#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2031#[serde(rename_all = "camelCase")]
2032pub struct CompactionCompleteCompactionTokensUsedCopilotUsageTokenDetail {
2033 /// Number of tokens in this billing batch
2034 pub batch_size: i64,
2035 /// Cost per batch of tokens
2036 pub cost_per_batch: i64,
2037 /// Model responsible for this billing entry
2038 #[serde(skip_serializing_if = "Option::is_none")]
2039 pub model: Option<String>,
2040 /// Total token count for this entry
2041 pub token_count: i64,
2042 /// Token category (e.g., "input", "output")
2043 pub token_type: String,
2044}
2045
2046/// Per-request cost and usage data from the CAPI copilot_usage response field
2047#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2048#[serde(rename_all = "camelCase")]
2049pub(crate) struct CompactionCompleteCompactionTokensUsedCopilotUsage {
2050 /// Default billing model for token details that do not identify their own model
2051 #[doc(hidden)]
2052 #[serde(skip_serializing_if = "Option::is_none")]
2053 pub(crate) model: Option<String>,
2054 /// Itemized token usage breakdown
2055 #[doc(hidden)]
2056 #[serde(skip_serializing_if = "Option::is_none")]
2057 pub(crate) token_details:
2058 Option<Vec<CompactionCompleteCompactionTokensUsedCopilotUsageTokenDetail>>,
2059 /// Total cost in nano-AI units for this request
2060 pub total_nano_aiu: f64,
2061}
2062
2063/// Token usage breakdown for the compaction LLM call (aligned with assistant.usage format)
2064#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2065#[serde(rename_all = "camelCase")]
2066pub struct CompactionCompleteCompactionTokensUsed {
2067 /// Cached input tokens reused in the compaction LLM call
2068 #[serde(skip_serializing_if = "Option::is_none")]
2069 pub cache_read_tokens: Option<i64>,
2070 /// Tokens written to prompt cache in the compaction LLM call
2071 #[serde(skip_serializing_if = "Option::is_none")]
2072 pub cache_write_tokens: Option<i64>,
2073 /// Per-request cost and usage data from the CAPI copilot_usage response field
2074 #[doc(hidden)]
2075 #[serde(skip_serializing_if = "Option::is_none")]
2076 pub(crate) copilot_usage: Option<CompactionCompleteCompactionTokensUsedCopilotUsage>,
2077 /// Duration of the compaction LLM call in milliseconds
2078 #[serde(skip_serializing_if = "Option::is_none")]
2079 pub duration: Option<i64>,
2080 /// Input tokens consumed by the compaction LLM call
2081 #[serde(skip_serializing_if = "Option::is_none")]
2082 pub input_tokens: Option<i64>,
2083 /// Model identifier used for the compaction LLM call
2084 #[serde(skip_serializing_if = "Option::is_none")]
2085 pub model: Option<String>,
2086 /// Output tokens produced by the compaction LLM call
2087 #[serde(skip_serializing_if = "Option::is_none")]
2088 pub output_tokens: Option<i64>,
2089}
2090
2091/// Original request-level and effective conversation reasoning effort for a Responses history boundary
2092#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2093#[serde(rename_all = "camelCase")]
2094pub struct ResponsesReasoning {
2095 /// Effective effort selected before this message, independent of the response-level reasoning field
2096 pub effort: String,
2097 /// Original request-level effort, retained while replaying this conversation prefix
2098 pub initial_effort: String,
2099 /// Provider model whose reasoning settings this boundary records
2100 pub model: String,
2101}
2102
2103/// Session event "session.compaction_complete". Conversation compaction results including success status, metrics, and optional error details
2104#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2105#[serde(rename_all = "camelCase")]
2106pub struct SessionCompactionCompleteData {
2107 /// Authoritative active-factory reminder appended to the compacted context
2108 #[doc(hidden)]
2109 #[serde(skip_serializing_if = "Option::is_none")]
2110 pub(crate) active_factory_summary: Option<String>,
2111 /// Canonical model identifier used for model-specific behavior when replaying compaction
2112 #[serde(skip_serializing_if = "Option::is_none")]
2113 pub behavior_model_id: Option<String>,
2114 /// Checkpoint snapshot number created for recovery
2115 #[serde(skip_serializing_if = "Option::is_none")]
2116 pub checkpoint_number: Option<i64>,
2117 /// File path where the checkpoint was stored
2118 #[serde(skip_serializing_if = "Option::is_none")]
2119 pub checkpoint_path: Option<String>,
2120 /// Token usage breakdown for the compaction LLM call (aligned with assistant.usage format)
2121 #[serde(skip_serializing_if = "Option::is_none")]
2122 pub compaction_tokens_used: Option<CompactionCompleteCompactionTokensUsed>,
2123 /// Token count from non-system messages (user, assistant, tool) after compaction
2124 #[serde(skip_serializing_if = "Option::is_none")]
2125 pub conversation_tokens: Option<i64>,
2126 /// User-supplied focus instructions provided to a manual `/compact` invocation. Omitted for automatic compaction and for manual compaction with no focus text.
2127 #[serde(skip_serializing_if = "Option::is_none")]
2128 pub custom_instructions: Option<String>,
2129 /// Error message if compaction failed
2130 #[serde(skip_serializing_if = "Option::is_none")]
2131 pub error: Option<String>,
2132 /// Number of messages removed during compaction
2133 #[serde(skip_serializing_if = "Option::is_none")]
2134 pub messages_removed: Option<i64>,
2135 /// Total tokens in conversation after compaction
2136 #[serde(skip_serializing_if = "Option::is_none")]
2137 pub post_compaction_tokens: Option<i64>,
2138 /// Number of messages before compaction
2139 #[serde(skip_serializing_if = "Option::is_none")]
2140 pub pre_compaction_messages_length: Option<i64>,
2141 /// Total tokens in conversation before compaction
2142 #[serde(skip_serializing_if = "Option::is_none")]
2143 pub pre_compaction_tokens: Option<i64>,
2144 /// GitHub request tracing ID (x-github-request-id header) for the compaction LLM call
2145 #[serde(skip_serializing_if = "Option::is_none")]
2146 pub request_id: Option<RequestId>,
2147 /// Reasoning baseline on the replacement summary, preserved when replay skips the compacted history
2148 #[serde(skip_serializing_if = "Option::is_none")]
2149 pub responses_reasoning: Option<ResponsesReasoning>,
2150 /// Copilot service request ID (x-copilot-service-request-id header) for the compaction LLM call
2151 #[serde(skip_serializing_if = "Option::is_none")]
2152 pub service_request_id: Option<String>,
2153 /// 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).
2154 #[serde(skip_serializing_if = "Option::is_none")]
2155 pub status_code: Option<i64>,
2156 /// Whether compaction completed successfully
2157 pub success: bool,
2158 /// LLM-generated summary of the compacted conversation history
2159 #[serde(skip_serializing_if = "Option::is_none")]
2160 pub summary_content: Option<String>,
2161 /// Token count from system message(s) after compaction
2162 #[serde(skip_serializing_if = "Option::is_none")]
2163 pub system_tokens: Option<i64>,
2164 /// Model context window token limit the compaction was targeting, when known
2165 #[serde(skip_serializing_if = "Option::is_none")]
2166 pub token_limit: Option<i64>,
2167 /// Number of tokens removed during compaction
2168 #[serde(skip_serializing_if = "Option::is_none")]
2169 pub tokens_removed: Option<i64>,
2170 /// Token count from tool definitions after compaction
2171 #[serde(skip_serializing_if = "Option::is_none")]
2172 pub tool_definitions_tokens: Option<i64>,
2173 /// What initiated this compaction, when known
2174 #[serde(skip_serializing_if = "Option::is_none")]
2175 pub trigger: Option<CompactionTrigger>,
2176}
2177
2178#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2179#[serde(rename_all = "camelCase")]
2180pub struct PermissionRecoveryAttempt {
2181 /// Unique identifier for this attempt record
2182 pub attempt_id: String,
2183 /// How the runtime handled this attempt
2184 pub disposition: PermissionRecoveryAttemptDisposition,
2185 /// One-based position of this attempt in the episode
2186 pub ordinal: i64,
2187 /// Controlled permission request kind, such as shell, path, URL, or tool
2188 pub permission_kind: String,
2189 /// Controlled reason for the attempt disposition
2190 pub reason: PermissionRecoveryAttemptReason,
2191 /// Relationship between this attempt and earlier attempts in the episode
2192 pub relation: PermissionRecoveryAttemptRelation,
2193 /// SHA-256 fingerprint of normalized request data; raw permission arguments are not included
2194 pub request_fingerprint: String,
2195 /// Tool-call identifier associated with this attempt, when available
2196 #[serde(skip_serializing_if = "Option::is_none")]
2197 pub tool_call_id: Option<String>,
2198}
2199
2200/// Authoritative snapshot of an Autopilot permission-recovery episode
2201#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2202#[serde(rename_all = "camelCase")]
2203pub struct PermissionRecoveryData {
2204 /// Ordered privacy-safe record of permission attempts and the successful alternative, when any
2205 pub attempts: Vec<PermissionRecoveryAttempt>,
2206 /// Stable identifier shared by every transition in this recovery episode
2207 pub episode_id: String,
2208 /// Maximum number of distinct autonomous permission attempts allowed before escalation
2209 pub max_attempts: i64,
2210 /// Policy selected from the current client's response capability; mode or client changes may update it during recovery
2211 pub on_blocked: PermissionRecoveryOnBlocked,
2212 /// Controlled reason for the latest episode transition
2213 pub reason: PermissionRecoveryReason,
2214 /// Current lifecycle state of the recovery episode
2215 pub status: PermissionRecoveryStatus,
2216}
2217
2218/// Structured reason that the task cannot continue without intervention
2219///
2220/// <div class="warning">
2221///
2222/// **Experimental.** This type is part of an experimental wire-protocol surface
2223/// and may change or be removed in future SDK or CLI releases.
2224///
2225/// </div>
2226#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2227#[serde(rename_all = "camelCase")]
2228pub struct TaskBlocker {
2229 /// Category of intervention that blocked the task
2230 pub kind: TaskBlockerKind,
2231 /// Permission-recovery episode that produced this blocker
2232 pub permission_recovery: PermissionRecoveryData,
2233 /// Controlled reason for the current blocked state
2234 pub reason: PermissionRecoveryReason,
2235 /// Whether a later user response or steering message can resume the task
2236 pub resumable: bool,
2237}
2238
2239/// Session event "session.task_complete". Task completion notification with summary from the agent
2240#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2241#[serde(rename_all = "camelCase")]
2242pub struct SessionTaskCompleteData {
2243 /// Structured blocker details when outcome is blocked
2244 #[serde(skip_serializing_if = "Option::is_none")]
2245 pub blocker: Option<TaskBlocker>,
2246 /// Active autopilot objective ID evaluated by the completion reviewer
2247 #[serde(skip_serializing_if = "Option::is_none")]
2248 pub objective_id: Option<i64>,
2249 /// Semantic completion decision. Absent on legacy events and invalid tool calls
2250 #[serde(skip_serializing_if = "Option::is_none")]
2251 pub outcome: Option<TaskCompletionOutcome>,
2252 /// 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
2253 #[serde(skip_serializing_if = "Option::is_none")]
2254 pub reason: Option<String>,
2255 /// Whether the task was accepted as complete. False when validation failed or completion was rejected or blocked by the reviewer
2256 #[serde(skip_serializing_if = "Option::is_none")]
2257 pub success: Option<bool>,
2258 /// Summary of the completed task, provided by the agent
2259 #[serde(skip_serializing_if = "Option::is_none")]
2260 pub summary: Option<String>,
2261}
2262
2263/// Inclusive durable event range summarized by a completion receipt.
2264#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2265#[serde(rename_all = "camelCase")]
2266pub struct CompletionReceiptEventRange {
2267 /// 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.
2268 pub end_event_id: String,
2269 /// Identifier of the user message that starts the covered exchange.
2270 pub start_event_id: String,
2271}
2272
2273/// Final structured tool completion in the covered event range.
2274#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2275#[serde(rename_all = "camelCase")]
2276pub struct CompletionReceiptFinalTool {
2277 /// Process exit code from a structured shell result, when available.
2278 #[serde(skip_serializing_if = "Option::is_none")]
2279 pub exit_code: Option<i64>,
2280 /// Structured success or failure status from the tool completion event.
2281 pub status: CompletionReceiptToolStatus,
2282 /// Unique identifier of the completed tool call.
2283 pub tool_call_id: String,
2284 /// Tool name from the matching tool execution start event, when available.
2285 #[serde(skip_serializing_if = "Option::is_none")]
2286 pub tool_name: Option<String>,
2287}
2288
2289/// Session event "session.completion_receipt". Behavior-neutral record of structured runtime facts present when an agent completion decision is accepted.
2290///
2291/// <div class="warning">
2292///
2293/// **Experimental.** This type is part of an experimental wire-protocol surface
2294/// and may change or be removed in future SDK or CLI releases.
2295///
2296/// </div>
2297#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2298#[serde(rename_all = "camelCase")]
2299pub struct SessionCompletionReceiptData {
2300 /// One-based accepted completion receipt ordinal in the durable session history.
2301 pub attempt: i64,
2302 /// Inclusive durable event range summarized by this receipt.
2303 pub event_range: CompletionReceiptEventRange,
2304 /// Number of failed structured tool completions in the covered range.
2305 pub failed_tool_count: i64,
2306 /// Final structured tool completion in the covered range, when one exists.
2307 #[serde(skip_serializing_if = "Option::is_none")]
2308 pub final_tool: Option<CompletionReceiptFinalTool>,
2309 /// Version of the completion receipt payload.
2310 pub schema_version: i64,
2311 /// 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.
2312 pub source_event_id: String,
2313 /// Runtime reason the completion decision was accepted.
2314 pub stop_reason: CompletionReceiptStopReason,
2315 /// Number of successful structured tool completions in the covered range.
2316 pub successful_tool_count: i64,
2317}
2318
2319/// Session event "session.fusion_route_started". Experimental transient signal that HydraFusion routing has started for an eligible turn.
2320///
2321/// <div class="warning">
2322///
2323/// **Experimental.** This type is part of an experimental wire-protocol surface
2324/// and may change or be removed in future SDK or CLI releases.
2325///
2326/// </div>
2327#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2328#[serde(rename_all = "camelCase")]
2329pub struct SessionFusionRouteStartedData {
2330 /// Identifier for this routing attempt before a durable Fusion turn exists.
2331 pub attempt_id: String,
2332 /// HydraFusion routing policy requested for the turn.
2333 #[serde(skip_serializing_if = "Option::is_none")]
2334 pub policy: Option<String>,
2335 /// Synthetic HydraFusion model selected for the session.
2336 #[serde(skip_serializing_if = "Option::is_none")]
2337 pub synthetic_model: Option<String>,
2338 /// Kind of turn being routed.
2339 pub turn_kind: FusionTurnKind,
2340}
2341
2342/// Session event "session.fusion_route_failed". Experimental durable HydraFusion routing failure and the deterministic concrete fallback selected for the turn.
2343///
2344/// <div class="warning">
2345///
2346/// **Experimental.** This type is part of an experimental wire-protocol surface
2347/// and may change or be removed in future SDK or CLI releases.
2348///
2349/// </div>
2350#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2351#[serde(rename_all = "camelCase")]
2352pub struct SessionFusionRouteFailedData {
2353 /// Identifier of the routing attempt that failed.
2354 pub attempt_id: String,
2355 /// Provider or validation error detail, when available.
2356 #[serde(skip_serializing_if = "Option::is_none")]
2357 pub error_message: Option<String>,
2358 /// Concrete model selected as the deterministic fallback.
2359 pub fallback_model: String,
2360 /// HydraFusion routing policy requested for the turn.
2361 pub policy: String,
2362 /// Stable machine-readable reason for the routing failure.
2363 pub reason: String,
2364 /// Elapsed routing time in milliseconds before the failure.
2365 #[serde(skip_serializing_if = "Option::is_none")]
2366 pub routing_latency_ms: Option<f64>,
2367 /// Synthetic HydraFusion model selected for the session.
2368 pub synthetic_model: String,
2369}
2370
2371/// Durable server recommendation for subsequent HydraFusion turns.
2372///
2373/// <div class="warning">
2374///
2375/// **Experimental.** This type is part of an experimental wire-protocol surface
2376/// and may change or be removed in future SDK or CLI releases.
2377///
2378/// </div>
2379#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2380#[serde(rename_all = "camelCase")]
2381pub struct FusionFollowUpRecommendation {
2382 /// Recommended routing action for the next compaction turn.
2383 pub compaction_turn: FusionFollowUpAction,
2384 /// Recommended routing action for the next user-message turn.
2385 pub user_turn: FusionFollowUpAction,
2386}
2387
2388/// Presentation-neutral phase planned for a HydraFusion turn.
2389///
2390/// <div class="warning">
2391///
2392/// **Experimental.** This type is part of an experimental wire-protocol surface
2393/// and may change or be removed in future SDK or CLI releases.
2394///
2395/// </div>
2396#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2397#[serde(rename_all = "camelCase")]
2398pub struct FusionPhasePlanStep {
2399 /// Whether the phase executes only when an earlier phase requests it.
2400 pub conditional: bool,
2401 /// Kind of phase that may execute.
2402 pub kind: FusionPhaseKind,
2403 /// Semantic role assigned to the phase.
2404 pub role: String,
2405 /// Conversation scope in which the phase executes.
2406 pub scope: FusionConversationScope,
2407}
2408
2409/// Validated HydraFusion routing capability scores.
2410///
2411/// <div class="warning">
2412///
2413/// **Experimental.** This type is part of an experimental wire-protocol surface
2414/// and may change or be removed in future SDK or CLI releases.
2415///
2416/// </div>
2417#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2418#[serde(rename_all = "camelCase")]
2419pub struct FusionScores {
2420 /// Code-generation capability score returned by the authenticated router.
2421 pub code_gen: f64,
2422 /// Debugging capability score returned by the authenticated router.
2423 pub debugging: f64,
2424 /// Reasoning capability score returned by the authenticated router.
2425 pub reasoning: f64,
2426 /// Tool-use capability score returned by the authenticated router.
2427 pub tool_use: f64,
2428}
2429
2430/// Session event "session.fusion_resolved". Experimental durable validated HydraFusion route and turn policy.
2431///
2432/// <div class="warning">
2433///
2434/// **Experimental.** This type is part of an experimental wire-protocol surface
2435/// and may change or be removed in future SDK or CLI releases.
2436///
2437/// </div>
2438#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2439#[serde(rename_all = "camelCase")]
2440pub struct SessionFusionResolvedData {
2441 /// Version of the validated HydraFusion event contract.
2442 pub contract_version: i64,
2443 /// Concrete model used when the planned primary model cannot execute.
2444 pub fallback_model: String,
2445 /// Router recommendation controlling reuse or rerouting on later turns.
2446 #[serde(skip_serializing_if = "Option::is_none")]
2447 pub follow_up: Option<FusionFollowUpRecommendation>,
2448 /// Concrete model recommended for eligible follow-up turns.
2449 pub follow_up_model: String,
2450 /// Stable identifier for the resolved HydraFusion turn.
2451 pub fusion_id: String,
2452 /// Version of the executable model universe used for selection.
2453 #[serde(skip_serializing_if = "Option::is_none")]
2454 pub model_universe_version: Option<String>,
2455 /// Validated orchestration pattern selected for the turn.
2456 pub pattern: FusionPattern,
2457 /// Presentation-neutral phase plan for clients that render workflow progress.
2458 ///
2459 /// <div class="warning">
2460 ///
2461 /// **Experimental.** This type is part of an experimental wire-protocol surface
2462 /// and may change or be removed in future SDK or CLI releases.
2463 ///
2464 /// </div>
2465 #[serde(skip_serializing_if = "Option::is_none")]
2466 pub phase_plan: Option<Vec<FusionPhasePlanStep>>,
2467 /// Version of the validated execution-plan format.
2468 #[serde(skip_serializing_if = "Option::is_none")]
2469 pub plan_version: Option<String>,
2470 /// HydraFusion routing policy used to resolve the plan.
2471 pub policy: String,
2472 /// Version of the local routing policy.
2473 #[serde(skip_serializing_if = "Option::is_none")]
2474 pub policy_version: Option<String>,
2475 /// Concrete model selected for the primary solver phase.
2476 pub primary_model: String,
2477 /// Router implementation that supplied the plan.
2478 #[serde(skip_serializing_if = "Option::is_none")]
2479 pub route_source: Option<String>,
2480 /// Elapsed time in milliseconds required to resolve and validate the route.
2481 #[serde(skip_serializing_if = "Option::is_none")]
2482 pub routing_latency_ms: Option<f64>,
2483 /// Identifier of the local policy rule that matched.
2484 #[serde(skip_serializing_if = "Option::is_none")]
2485 pub rule_id: Option<String>,
2486 /// Zero-based index of the local policy rule that matched.
2487 #[serde(skip_serializing_if = "Option::is_none")]
2488 pub rule_index: Option<i64>,
2489 /// Human-readable name of the local policy rule that matched.
2490 #[serde(skip_serializing_if = "Option::is_none")]
2491 pub rule_name: Option<String>,
2492 /// Validated capability scores used to select the route.
2493 #[serde(skip_serializing_if = "Option::is_none")]
2494 pub scores: Option<FusionScores>,
2495 /// Concrete model selected for the review or judge phase, when required.
2496 pub secondary_model: Option<String>,
2497 /// Synthetic HydraFusion model selected for the session.
2498 pub synthetic_model: String,
2499 /// Identifier of the session turn associated with the route.
2500 pub turn_id: String,
2501}
2502
2503/// Session event "session.fusion_completed". Experimental durable aggregate outcome of a HydraFusion turn.
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 struct SessionFusionCompletedData {
2514 /// Total cached input tokens reported across all phases.
2515 pub cached_tokens: i64,
2516 /// Total tokens written to prompt cache across all phases.
2517 #[serde(skip_serializing_if = "Option::is_none")]
2518 pub cache_write_tokens: Option<i64>,
2519 /// Idempotency identifier for the authoritative final commit.
2520 pub commit_id: String,
2521 /// Reason the turn used a degraded route, when applicable.
2522 pub degraded_reason: Option<String>,
2523 /// Total elapsed execution time for the HydraFusion turn in milliseconds.
2524 pub duration_ms: f64,
2525 /// Concrete model that supplied the authoritative final content.
2526 pub final_source_model: Option<String>,
2527 /// Phase whose output supplied the authoritative final content.
2528 pub final_source_phase_id: Option<String>,
2529 /// Concrete model recommended for eligible follow-up turns.
2530 pub follow_up_model: String,
2531 /// Stable identifier for the completed HydraFusion turn.
2532 pub fusion_id: String,
2533 /// Total input tokens consumed across all phases.
2534 pub input_tokens: i64,
2535 /// Stable aggregate outcome of the HydraFusion turn.
2536 pub outcome: String,
2537 /// Total output tokens produced across all phases.
2538 pub output_tokens: i64,
2539 /// HydraFusion orchestration pattern executed for the turn.
2540 pub pattern: FusionPattern,
2541 /// Number of concrete phases attempted by the turn.
2542 pub phase_count: i64,
2543 /// Total concrete model requests made across all phases.
2544 pub request_count: i64,
2545 /// Synthetic HydraFusion model selected for the session.
2546 pub synthetic_model: String,
2547 /// Total normalized AI-unit cost reported across all phases, in nano-AIU.
2548 pub total_nano_aiu: f64,
2549 /// Identifier of the session turn associated with the completion.
2550 pub turn_id: String,
2551}
2552
2553/// Session event "session.permission_recovery". Authoritative snapshot of an Autopilot permission-recovery episode
2554#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2555#[serde(rename_all = "camelCase")]
2556pub struct SessionPermissionRecoveryData {
2557 /// Ordered privacy-safe record of permission attempts and the successful alternative, when any
2558 pub attempts: Vec<PermissionRecoveryAttempt>,
2559 /// Stable identifier shared by every transition in this recovery episode
2560 pub episode_id: String,
2561 /// Maximum number of distinct autonomous permission attempts allowed before escalation
2562 pub max_attempts: i64,
2563 /// Policy selected from the current client's response capability; mode or client changes may update it during recovery
2564 pub on_blocked: PermissionRecoveryOnBlocked,
2565 /// Controlled reason for the latest episode transition
2566 pub reason: PermissionRecoveryReason,
2567 /// Current lifecycle state of the recovery episode
2568 pub status: PermissionRecoveryStatus,
2569}
2570
2571/// Session event "user.message". Payload of `user.message` with displayed and model-transformed content, attachments, source/delivery metadata, mode, and telemetry IDs.
2572#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2573#[serde(rename_all = "camelCase")]
2574pub struct UserMessageData {
2575 /// The agent mode that was active when this message was sent
2576 #[serde(skip_serializing_if = "Option::is_none")]
2577 pub agent_mode: Option<UserMessageAgentMode>,
2578 /// Files, selections, or GitHub references attached to the message
2579 #[serde(skip_serializing_if = "Option::is_none")]
2580 pub attachments: Option<Vec<serde_json::Value>>,
2581 /// The user's message text as displayed in the timeline
2582 pub content: String,
2583 /// 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.
2584 #[serde(skip_serializing_if = "Option::is_none")]
2585 pub delivery: Option<UserMessageDelivery>,
2586 /// CAPI interaction ID for correlating this user message with its turn
2587 #[serde(skip_serializing_if = "Option::is_none")]
2588 pub interaction_id: Option<String>,
2589 /// 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.
2590 #[serde(skip_serializing_if = "Option::is_none")]
2591 pub is_autopilot_continuation: Option<bool>,
2592 /// Stable identity of the logical user message, matching the ID returned by send and retained by pending queue snapshots
2593 #[serde(skip_serializing_if = "Option::is_none")]
2594 pub message_id: Option<String>,
2595 /// 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
2596 #[serde(skip_serializing_if = "Option::is_none")]
2597 pub native_document_path_fallback_paths: Option<Vec<String>>,
2598 /// Parent agent task ID for background telemetry correlated to this user turn
2599 #[serde(skip_serializing_if = "Option::is_none")]
2600 pub parent_agent_task_id: Option<String>,
2601 /// Responses reasoning settings anchored before this model-facing message, for cache-stable history replay
2602 #[serde(skip_serializing_if = "Option::is_none")]
2603 pub responses_reasoning: Option<ResponsesReasoning>,
2604 /// 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)
2605 #[serde(skip_serializing_if = "Option::is_none")]
2606 pub source: Option<String>,
2607 /// Normalized document MIME types that were sent natively instead of through tagged_files XML
2608 #[serde(skip_serializing_if = "Option::is_none")]
2609 pub supported_native_document_mime_types: Option<Vec<String>>,
2610 /// Transformed version of the message sent to the model, with XML wrapping, timestamps, and other augmentations for prompt caching
2611 #[serde(skip_serializing_if = "Option::is_none")]
2612 pub transformed_content: Option<String>,
2613 /// The agent-loop turn ID that consumed this message; absent when no agent-loop turn consumed it
2614 #[serde(skip_serializing_if = "Option::is_none")]
2615 pub turn_id: Option<String>,
2616}
2617
2618/// Session event "pending_messages.modified". Empty payload; the event signals that the pending message queue has changed
2619#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2620#[serde(rename_all = "camelCase")]
2621pub struct PendingMessagesModifiedData {}
2622
2623/// Session event "assistant.turn_start". Turn initialization metadata including identifier and interaction tracking
2624#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2625#[serde(rename_all = "camelCase")]
2626pub struct AssistantTurnStartData {
2627 /// CAPI interaction ID for correlating this turn with upstream telemetry
2628 #[serde(skip_serializing_if = "Option::is_none")]
2629 pub interaction_id: Option<String>,
2630 /// Model identifier used for this turn, when known
2631 #[serde(skip_serializing_if = "Option::is_none")]
2632 pub model: Option<String>,
2633 /// Identifier for this turn within the agentic loop, typically a stringified turn number
2634 pub turn_id: String,
2635}
2636
2637/// Session event "assistant.turn_retry". Metadata for an additional model inference attempt within an existing assistant turn
2638#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2639#[serde(rename_all = "camelCase")]
2640pub struct AssistantTurnRetryData {
2641 /// Model identifier used for this retry, when known
2642 #[serde(skip_serializing_if = "Option::is_none")]
2643 pub model: Option<String>,
2644 /// Provider or runtime classification that caused the retry, when known
2645 #[serde(skip_serializing_if = "Option::is_none")]
2646 pub reason: Option<String>,
2647 /// Identifier of the turn whose model inference is being retried
2648 pub turn_id: String,
2649}
2650
2651/// Session event "agent.interrupted". Metadata for work the user interrupted while the agent was running
2652#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2653#[serde(rename_all = "camelCase")]
2654pub struct AgentInterruptedData {
2655 /// What the agent was doing when the user interrupted it
2656 pub activity: AgentInterruptedActivity,
2657 /// For an interrupted model call: the provider endpoint the request targeted
2658 #[serde(skip_serializing_if = "Option::is_none")]
2659 pub api_endpoint: Option<String>,
2660 /// For an interrupted model call: whether the user interrupted before any token arrived or while the response was streaming
2661 #[serde(skip_serializing_if = "Option::is_none")]
2662 pub cancel_phase: Option<AgentInterruptedCancelPhase>,
2663 /// How long the interrupted work had been running, in milliseconds
2664 pub elapsed_ms: f64,
2665 /// 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.
2666 #[serde(skip_serializing_if = "Option::is_none")]
2667 pub interrupted_agent_count: Option<i64>,
2668 /// For an interrupted model call: the model the request targeted
2669 #[serde(skip_serializing_if = "Option::is_none")]
2670 pub model: Option<String>,
2671 /// 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.
2672 #[serde(skip_serializing_if = "Option::is_none")]
2673 pub output_ttft_ms: Option<f64>,
2674 /// For an interrupted model call: the reasoning effort the request asked for
2675 #[serde(skip_serializing_if = "Option::is_none")]
2676 pub reasoning_effort: Option<String>,
2677 /// Subset of `toolNames` whose tool metadata marks the tool name as safe to record unhashed in telemetry.
2678 #[serde(skip_serializing_if = "Option::is_none")]
2679 pub safe_tool_names: Option<Vec<String>>,
2680 /// Tool call identifiers that were still running
2681 #[serde(skip_serializing_if = "Option::is_none")]
2682 pub tool_call_ids: Option<Vec<String>>,
2683 /// Names of the tools that were still running. More than one when the model requested a parallel fan-out.
2684 #[serde(skip_serializing_if = "Option::is_none")]
2685 pub tool_names: Option<Vec<String>>,
2686 /// For an interrupted model call: the transport the request used
2687 #[serde(skip_serializing_if = "Option::is_none")]
2688 pub transport: Option<ModelCallFailureTransport>,
2689 /// Zero-based agentic-loop iteration the interrupt landed in
2690 pub turn: i64,
2691}
2692
2693/// Session event "assistant.intent". Agent intent description for current activity or plan
2694#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2695#[serde(rename_all = "camelCase")]
2696pub struct AssistantIntentData {
2697 /// Short description of what the agent is currently doing or planning to do
2698 pub intent: String,
2699}
2700
2701/// Session event "assistant.fusion_phase_started". Experimental transient HydraFusion phase/model/role signal.
2702///
2703/// <div class="warning">
2704///
2705/// **Experimental.** This type is part of an experimental wire-protocol surface
2706/// and may change or be removed in future SDK or CLI releases.
2707///
2708/// </div>
2709#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2710#[serde(rename_all = "camelCase")]
2711pub struct AssistantFusionPhaseStartedData {
2712 /// Conversation scope in which the phase executes.
2713 pub conversation_scope: FusionConversationScope,
2714 /// Identifier of the HydraFusion turn containing the phase.
2715 pub fusion_id: String,
2716 /// Concrete model executing the phase.
2717 pub model: String,
2718 /// HydraFusion orchestration pattern containing the phase.
2719 pub pattern: FusionPattern,
2720 /// Stable identifier for the concrete phase.
2721 pub phase_id: String,
2722 /// Kind of phase being executed.
2723 pub phase_kind: FusionPhaseKind,
2724 /// Semantic role assigned to the phase.
2725 pub role: String,
2726}
2727
2728/// Session event "assistant.fusion_phase_activity". Experimental content-safe activity signal for a running HydraFusion phase.
2729///
2730/// <div class="warning">
2731///
2732/// **Experimental.** This type is part of an experimental wire-protocol surface
2733/// and may change or be removed in future SDK or CLI releases.
2734///
2735/// </div>
2736#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2737#[serde(rename_all = "camelCase")]
2738pub struct AssistantFusionPhaseActivityData {
2739 /// Kind of real activity observed.
2740 pub activity: FusionPhaseActivityKind,
2741 /// Conversation scope in which the phase executes.
2742 pub conversation_scope: FusionConversationScope,
2743 /// Identifier of the HydraFusion turn containing the phase.
2744 pub fusion_id: String,
2745 /// HydraFusion orchestration pattern containing the phase.
2746 pub pattern: FusionPattern,
2747 /// Stable identifier for the concrete phase.
2748 pub phase_id: String,
2749 /// Kind of phase currently executing.
2750 pub phase_kind: FusionPhaseKind,
2751 /// Semantic role assigned to the phase.
2752 pub role: String,
2753 /// 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.
2754 #[serde(skip_serializing_if = "Option::is_none")]
2755 pub tool_call_id: Option<String>,
2756 /// Cumulative private response bytes observed for this model call. The event never includes response text.
2757 #[serde(skip_serializing_if = "Option::is_none")]
2758 pub total_response_size_bytes: Option<i64>,
2759}
2760
2761/// Internal durable terminal request staged by a HydraFusion phase until an idempotent final commit selects it.
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(crate) struct FusionStagedTerminal {
2772 pub arguments: String,
2773 pub assistant_message: serde_json::Value,
2774 pub phase_id: String,
2775 pub tool_call_id: String,
2776 pub tool_name: String,
2777}
2778
2779/// Aggregate concrete-model usage for one HydraFusion phase.
2780///
2781/// <div class="warning">
2782///
2783/// **Experimental.** This type is part of an experimental wire-protocol surface
2784/// and may change or be removed in future SDK or CLI releases.
2785///
2786/// </div>
2787#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2788#[serde(rename_all = "camelCase")]
2789pub struct FusionPhaseUsage {
2790 /// Total cached input tokens reported for the phase.
2791 pub cached_tokens: i64,
2792 /// Total tokens written to prompt cache during the phase.
2793 #[serde(skip_serializing_if = "Option::is_none")]
2794 pub cache_write_tokens: Option<i64>,
2795 /// Total input tokens consumed by the phase.
2796 pub input_tokens: i64,
2797 /// Total output tokens produced by the phase.
2798 pub output_tokens: i64,
2799 /// Number of concrete model requests made by the phase.
2800 pub request_count: i64,
2801 /// Total normalized AI-unit cost reported for the phase, in nano-AIU.
2802 pub total_nano_aiu: f64,
2803}
2804
2805/// Session event "assistant.fusion_phase_completed". Experimental durable HydraFusion phase output and lossless replay checkpoint.
2806///
2807/// <div class="warning">
2808///
2809/// **Experimental.** This type is part of an experimental wire-protocol surface
2810/// and may change or be removed in future SDK or CLI releases.
2811///
2812/// </div>
2813#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2814#[serde(rename_all = "camelCase")]
2815pub struct AssistantFusionPhaseCompletedData {
2816 /// Provider-normalized textual output produced by the phase.
2817 pub content: String,
2818 /// Conversation scope in which the phase executed.
2819 pub conversation_scope: FusionConversationScope,
2820 /// Elapsed execution time for the phase in milliseconds.
2821 pub duration_ms: f64,
2822 /// Identifier of the HydraFusion turn containing the phase.
2823 pub fusion_id: String,
2824 /// Concrete model that executed the phase.
2825 pub model: String,
2826 /// Stable identifier for the completed phase.
2827 pub phase_id: String,
2828 /// Kind of phase that completed.
2829 pub phase_kind: FusionPhaseKind,
2830 /// Exact provider-normalized message used to reconstruct canonical model history.
2831 #[doc(hidden)]
2832 #[serde(skip_serializing_if = "Option::is_none")]
2833 pub(crate) projection_message: Option<serde_json::Value>,
2834 /// Projection action for the exact internal message.
2835 #[doc(hidden)]
2836 #[serde(skip_serializing_if = "Option::is_none")]
2837 pub(crate) projection_mode: Option<FusionProjectionMode>,
2838 /// Semantic role assigned to the completed phase.
2839 pub role: String,
2840 /// Terminal request held outside canonical state until selected by the final commit.
2841 #[doc(hidden)]
2842 #[serde(skip_serializing_if = "Option::is_none")]
2843 pub(crate) staged_terminal: Option<FusionStagedTerminal>,
2844 /// Durable outcome status of the phase.
2845 pub status: FusionPhaseStatus,
2846 /// Aggregate concrete-model usage consumed by the phase.
2847 pub usage: FusionPhaseUsage,
2848 /// Structured judge or critic verdict, when the phase produces one.
2849 pub verdict: Option<String>,
2850}
2851
2852/// Session event "assistant.fusion_phase_failed". Experimental durable typed HydraFusion phase failure and degradation transition.
2853///
2854/// <div class="warning">
2855///
2856/// **Experimental.** This type is part of an experimental wire-protocol surface
2857/// and may change or be removed in future SDK or CLI releases.
2858///
2859/// </div>
2860#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2861#[serde(rename_all = "camelCase")]
2862pub struct AssistantFusionPhaseFailedData {
2863 /// Conversation scope in which the phase executed.
2864 pub conversation_scope: FusionConversationScope,
2865 /// Identifier of the fallback phase used to continue the turn after degradation.
2866 #[serde(skip_serializing_if = "Option::is_none")]
2867 pub degraded_to_phase_id: Option<String>,
2868 /// Elapsed execution time before the phase failed, in milliseconds.
2869 pub duration_ms: f64,
2870 /// Provider or execution error detail, when available.
2871 #[serde(skip_serializing_if = "Option::is_none")]
2872 pub error_message: Option<String>,
2873 /// Identifier of the HydraFusion turn containing the phase.
2874 pub fusion_id: String,
2875 /// Concrete model that attempted the phase.
2876 pub model: String,
2877 /// Stable identifier for the failed phase.
2878 pub phase_id: String,
2879 /// Kind of phase that failed.
2880 pub phase_kind: FusionPhaseKind,
2881 /// Stable machine-readable reason for the phase failure.
2882 pub reason: String,
2883 /// Semantic role assigned to the failed phase.
2884 pub role: String,
2885 /// Durable outcome status of the phase.
2886 pub status: FusionPhaseStatus,
2887 /// Aggregate concrete-model usage consumed before the failure.
2888 pub usage: FusionPhaseUsage,
2889}
2890
2891/// 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
2892#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2893#[serde(rename_all = "camelCase")]
2894pub struct AssistantServerToolProgressData {
2895 /// Kind of hosted server tool that is running. Only `web_search` is emitted today.
2896 pub kind: String,
2897 /// 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.
2898 pub output_index: i64,
2899 /// Lifecycle status of the hosted call: `in_progress`, `searching`, or `completed`.
2900 pub status: String,
2901}
2902
2903/// Session event "assistant.reasoning". Assistant reasoning content for timeline display with complete thinking text
2904#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2905#[serde(rename_all = "camelCase")]
2906pub struct AssistantReasoningData {
2907 /// The complete extended thinking text from the model
2908 pub content: String,
2909 /// Unique identifier for this reasoning block
2910 pub reasoning_id: String,
2911 /// 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.
2912 #[serde(skip_serializing_if = "Option::is_none")]
2913 pub rte: Option<bool>,
2914}
2915
2916/// Session event "assistant.reasoning_delta". Streaming reasoning delta for incremental extended thinking updates
2917#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2918#[serde(rename_all = "camelCase")]
2919pub struct AssistantReasoningDeltaData {
2920 /// Incremental text chunk to append to the reasoning content
2921 pub delta_content: String,
2922 /// Reasoning block ID this delta belongs to, matching the corresponding assistant.reasoning event
2923 pub reasoning_id: String,
2924}
2925
2926/// Session event "assistant.tool_call_delta". Streaming tool-call input delta for incremental tool-call updates
2927#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2928#[serde(rename_all = "camelCase")]
2929pub struct AssistantToolCallDeltaData {
2930 /// 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.
2931 pub input_delta: String,
2932 /// Tool call ID this delta belongs to, matching the corresponding assistant.message tool request
2933 pub tool_call_id: String,
2934 /// Name of the tool being invoked, when known from the stream
2935 #[serde(skip_serializing_if = "Option::is_none")]
2936 pub tool_name: Option<String>,
2937 /// Tool call type, when known from the stream
2938 #[serde(skip_serializing_if = "Option::is_none")]
2939 pub tool_type: Option<AssistantMessageToolRequestType>,
2940}
2941
2942/// Session event "assistant.streaming_delta". Streaming response progress with cumulative byte count
2943#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2944#[serde(rename_all = "camelCase")]
2945pub struct AssistantStreamingDeltaData {
2946 /// Cumulative total bytes received from the streaming response so far
2947 pub total_response_size_bytes: i64,
2948}
2949
2950/// A source that backs one or more cited spans in the assistant's response.
2951///
2952/// <div class="warning">
2953///
2954/// **Experimental.** This type is part of an experimental wire-protocol surface
2955/// and may change or be removed in future SDK or CLI releases.
2956///
2957/// </div>
2958#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2959#[serde(rename_all = "camelCase")]
2960pub struct CitationSource {
2961 /// Stable, turn-scoped identifier for this source, referenced by CitationReference.sourceId.
2962 pub id: String,
2963 /// File path relative to the agent's workspace root, when the source is a file.
2964 #[serde(skip_serializing_if = "Option::is_none")]
2965 pub path: Option<String>,
2966 /// The system that produced this citation.
2967 pub provider: CitationProvider,
2968 /// Human-readable title of the source.
2969 #[serde(skip_serializing_if = "Option::is_none")]
2970 pub title: Option<String>,
2971 /// URL of the source, when it is a web resource.
2972 #[serde(skip_serializing_if = "Option::is_none")]
2973 pub url: Option<String>,
2974}
2975
2976/// A single citation occurrence linking a span of generated text to a supporting source.
2977///
2978/// <div class="warning">
2979///
2980/// **Experimental.** This type is part of an experimental wire-protocol surface
2981/// and may change or be removed in future SDK or CLI releases.
2982///
2983/// </div>
2984#[derive(Debug, Clone, Default, Serialize, Deserialize)]
2985#[serde(rename_all = "camelCase")]
2986pub struct CitationReference {
2987 /// The exact text from the source that supports the cited span, when provided by the model.
2988 #[serde(skip_serializing_if = "Option::is_none")]
2989 pub cited_text: Option<String>,
2990 /// Location within the source that supports the cited span, when the provider reports one.
2991 #[serde(skip_serializing_if = "Option::is_none")]
2992 pub location: Option<serde_json::Value>,
2993 /// Provider-native citation correlation data (e.g. Anthropic search_result_index / document_index), passed through opaquely for debugging and forward compatibility.
2994 #[serde(skip_serializing_if = "Option::is_none")]
2995 pub provider_metadata: Option<serde_json::Value>,
2996 /// Identifier of the CitationSource this reference points to (CitationSource.id).
2997 pub source_id: String,
2998}
2999
3000/// A contiguous span of generated assistant text and the source references that support it.
3001///
3002/// <div class="warning">
3003///
3004/// **Experimental.** This type is part of an experimental wire-protocol surface
3005/// and may change or be removed in future SDK or CLI releases.
3006///
3007/// </div>
3008#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3009#[serde(rename_all = "camelCase")]
3010pub struct CitationSpan {
3011 /// End offset of the cited span within the final assistant message content (UTF-16 code units, zero-based, exclusive).
3012 pub end_index: i64,
3013 /// The sources that support this span of generated text.
3014 pub references: Vec<CitationReference>,
3015 /// Start offset of the cited span within the final assistant message content (UTF-16 code units, zero-based, inclusive).
3016 pub start_index: i64,
3017}
3018
3019/// Provider-agnostic citations linking spans of the assistant's response to their supporting sources.
3020///
3021/// <div class="warning">
3022///
3023/// **Experimental.** This type is part of an experimental wire-protocol surface
3024/// and may change or be removed in future SDK or CLI releases.
3025///
3026/// </div>
3027#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3028#[serde(rename_all = "camelCase")]
3029pub struct Citations {
3030 /// Deduplicated set of sources referenced by the citation spans.
3031 pub sources: Vec<CitationSource>,
3032 /// Spans of generated text annotated with the sources that support them.
3033 pub spans: Vec<CitationSpan>,
3034}
3035
3036/// Experimental attribution linking an ordinary event to the HydraFusion turn, phase, and concrete source that produced it.
3037///
3038/// <div class="warning">
3039///
3040/// **Experimental.** This type is part of an experimental wire-protocol surface
3041/// and may change or be removed in future SDK or CLI releases.
3042///
3043/// </div>
3044#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3045#[serde(rename_all = "camelCase")]
3046pub struct FusionAttribution {
3047 /// Idempotency identifier for the authoritative commit, when the event belongs to the selected output.
3048 #[serde(skip_serializing_if = "Option::is_none")]
3049 pub commit_id: Option<String>,
3050 /// Conversation scope in which the concrete phase executed.
3051 #[serde(skip_serializing_if = "Option::is_none")]
3052 pub conversation_scope: Option<String>,
3053 /// Stable identifier for the HydraFusion turn that produced the event.
3054 pub fusion_id: String,
3055 /// HydraFusion orchestration pattern selected for the turn.
3056 pub pattern: String,
3057 /// Identifier of the concrete phase that produced the event.
3058 #[serde(skip_serializing_if = "Option::is_none")]
3059 pub phase_id: Option<String>,
3060 /// Kind of concrete phase that produced the event.
3061 #[serde(skip_serializing_if = "Option::is_none")]
3062 pub phase_kind: Option<String>,
3063 /// HydraFusion routing policy used for the turn.
3064 pub policy: String,
3065 /// Semantic role assigned to the concrete phase.
3066 #[serde(skip_serializing_if = "Option::is_none")]
3067 pub role: Option<String>,
3068 /// Concrete model that produced the attributed event.
3069 #[serde(skip_serializing_if = "Option::is_none")]
3070 pub source_model: Option<String>,
3071 /// Phase whose output supplied the authoritative content, when different from the executing phase.
3072 #[serde(skip_serializing_if = "Option::is_none")]
3073 pub source_phase_id: Option<String>,
3074 /// Synthetic HydraFusion model selected for the session.
3075 pub synthetic_model: String,
3076}
3077
3078/// Neutral provider-tagged reasoning content blocks preserved verbatim for round-tripping
3079///
3080/// <div class="warning">
3081///
3082/// **Experimental.** This type is part of an experimental wire-protocol surface
3083/// and may change or be removed in future SDK or CLI releases.
3084///
3085/// </div>
3086#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3087#[serde(rename_all = "camelCase")]
3088pub struct AssistantMessageReasoningBlocks {
3089 /// 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.
3090 #[serde(skip_serializing_if = "Option::is_none")]
3091 pub blocks: Option<Vec<serde_json::Value>>,
3092 /// Model provider that produced these reasoning blocks.
3093 pub provider: String,
3094}
3095
3096/// Neutral provider-tagged server-side tool-use payload (tool search, advisor) for verbatim round-tripping
3097///
3098/// <div class="warning">
3099///
3100/// **Experimental.** This type is part of an experimental wire-protocol surface
3101/// and may change or be removed in future SDK or CLI releases.
3102///
3103/// </div>
3104#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3105#[serde(rename_all = "camelCase")]
3106pub struct AssistantMessageServerTools {
3107 /// Advisor model identifier associated with the server-tool payload.
3108 #[serde(skip_serializing_if = "Option::is_none")]
3109 pub advisor_model: Option<String>,
3110 /// Provider function-call namespaces keyed by function-call identifier.
3111 #[serde(skip_serializing_if = "Option::is_none")]
3112 pub function_call_namespaces: Option<HashMap<String, String>>,
3113 /// Provider-native server-tool call and output items preserved verbatim for replay.
3114 #[serde(skip_serializing_if = "Option::is_none")]
3115 pub items: Option<Vec<serde_json::Value>>,
3116 /// Model provider that produced this server-tool payload.
3117 pub provider: String,
3118 /// Raw provider content blocks retained for verbatim round-tripping.
3119 #[serde(skip_serializing_if = "Option::is_none")]
3120 pub raw_content_blocks: Option<Vec<serde_json::Value>>,
3121}
3122
3123/// Hosted program that requested this client tool call
3124#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3125#[serde(rename_all = "camelCase")]
3126pub struct AssistantMessageToolRequestCaller {
3127 /// Provider-assigned identifier for the hosted caller.
3128 pub caller_id: String,
3129 /// Kind of hosted caller that requested the client tool call.
3130 pub r#type: AssistantMessageToolRequestCallerType,
3131}
3132
3133/// A tool invocation request from the assistant
3134#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3135#[serde(rename_all = "camelCase")]
3136pub struct AssistantMessageToolRequest {
3137 /// Arguments to pass to the tool, format depends on the tool
3138 #[serde(skip_serializing_if = "Option::is_none")]
3139 pub arguments: Option<serde_json::Value>,
3140 /// Hosted program that requested this client tool call
3141 #[serde(skip_serializing_if = "Option::is_none")]
3142 pub caller: Option<AssistantMessageToolRequestCaller>,
3143 /// Resolved intention summary describing what this specific call does
3144 #[serde(skip_serializing_if = "Option::is_none")]
3145 pub intention_summary: Option<String>,
3146 /// Name of the MCP server hosting this tool, when the tool is an MCP tool
3147 #[serde(skip_serializing_if = "Option::is_none")]
3148 pub mcp_server_name: Option<String>,
3149 /// Original tool name on the MCP server, when the tool is an MCP tool
3150 #[serde(skip_serializing_if = "Option::is_none")]
3151 pub mcp_tool_name: Option<String>,
3152 /// Name of the tool being invoked
3153 pub name: String,
3154 /// Unique identifier for this tool call
3155 pub tool_call_id: String,
3156 /// Human-readable display title for the tool
3157 #[serde(skip_serializing_if = "Option::is_none")]
3158 pub tool_title: Option<String>,
3159 /// Tool call type: "function" for standard tool calls, "custom" for grammar-based tool calls. Defaults to "function" when absent.
3160 #[serde(skip_serializing_if = "Option::is_none")]
3161 pub r#type: Option<AssistantMessageToolRequestType>,
3162}
3163
3164/// Session event "assistant.message". Assistant response containing text content, optional tool requests, and interaction metadata
3165#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3166#[serde(rename_all = "camelCase")]
3167pub struct AssistantMessageData {
3168 /// Provider's completion / response identifier; shared across all chunks of a single API call. Used to group multi-chunk assistant utterances.
3169 #[serde(skip_serializing_if = "Option::is_none")]
3170 pub api_call_id: Option<String>,
3171 /// 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.
3172 #[serde(skip_serializing_if = "Option::is_none")]
3173 pub chunk_count: Option<i64>,
3174 /// Zero-based position of this message within its model call's response. Absent when the response was not split into chunks.
3175 #[serde(skip_serializing_if = "Option::is_none")]
3176 pub chunk_index: Option<i64>,
3177 /// Provider-agnostic citations linking spans of this message's content to the sources that support them. Experimental; only populated when citation emission is enabled.
3178 ///
3179 /// <div class="warning">
3180 ///
3181 /// **Experimental.** This type is part of an experimental wire-protocol surface
3182 /// and may change or be removed in future SDK or CLI releases.
3183 ///
3184 /// </div>
3185 #[serde(skip_serializing_if = "Option::is_none")]
3186 pub citations: Option<Citations>,
3187 /// 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).
3188 #[serde(skip_serializing_if = "Option::is_none")]
3189 pub client_request_id: Option<String>,
3190 /// The assistant's text response content
3191 pub content: String,
3192 /// Encrypted reasoning content from OpenAI models. Session-bound and stripped on resume.
3193 #[serde(skip_serializing_if = "Option::is_none")]
3194 pub encrypted_content: Option<String>,
3195 /// Experimental HydraFusion source attribution for this ordinary authoritative assistant message.
3196 ///
3197 /// <div class="warning">
3198 ///
3199 /// **Experimental.** This type is part of an experimental wire-protocol surface
3200 /// and may change or be removed in future SDK or CLI releases.
3201 ///
3202 /// </div>
3203 #[serde(skip_serializing_if = "Option::is_none")]
3204 pub fusion: Option<FusionAttribution>,
3205 /// CAPI interaction ID for correlating this message with upstream telemetry
3206 #[serde(skip_serializing_if = "Option::is_none")]
3207 pub interaction_id: Option<String>,
3208 /// Unique identifier for this assistant message
3209 pub message_id: String,
3210 /// Model that produced this assistant message, if known
3211 #[serde(skip_serializing_if = "Option::is_none")]
3212 pub model: Option<String>,
3213 /// Logical ID of the primary user message that initiated this run, matching the messageId returned by session.send (or the last messageId of session.sendMessages). Stable across model/tool iterations, steering messages, and stop-hook corrections. Subagent runs use their own initiating message ID, not the parent's. Absent for runs without an associated initiating message, such as empty batches.
3214 #[serde(skip_serializing_if = "Option::is_none")]
3215 pub originating_message_id: Option<String>,
3216 /// Actual output token count from the API response (completion_tokens), used for accurate token accounting
3217 #[serde(skip_serializing_if = "Option::is_none")]
3218 pub output_tokens: Option<i64>,
3219 /// Tool call ID of the parent tool invocation when this event originates from a sub-agent
3220 #[doc(hidden)]
3221 #[deprecated]
3222 #[serde(skip_serializing_if = "Option::is_none")]
3223 pub parent_tool_call_id: Option<String>,
3224 /// Generation phase for phased-output models (e.g., thinking vs. response phases)
3225 #[serde(skip_serializing_if = "Option::is_none")]
3226 pub phase: Option<String>,
3227 /// 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.
3228 #[serde(skip_serializing_if = "Option::is_none")]
3229 pub reasoning_blocks: Option<AssistantMessageReasoningBlocks>,
3230 /// Opaque/encrypted extended thinking data from Anthropic models. Session-bound and stripped on resume.
3231 #[serde(skip_serializing_if = "Option::is_none")]
3232 pub reasoning_opaque: Option<String>,
3233 /// Readable reasoning text from the model's extended thinking
3234 #[serde(skip_serializing_if = "Option::is_none")]
3235 pub reasoning_text: Option<String>,
3236 /// 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.
3237 #[serde(skip_serializing_if = "Option::is_none")]
3238 pub reasoning_wire_field: Option<String>,
3239 /// GitHub request tracing ID (x-github-request-id header) for correlating with server-side logs
3240 #[serde(skip_serializing_if = "Option::is_none")]
3241 pub request_id: Option<RequestId>,
3242 /// 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.
3243 #[serde(skip_serializing_if = "Option::is_none")]
3244 pub rte: Option<bool>,
3245 /// Neutral provider-tagged server-side tool-use payload (tool search, advisor) for verbatim round-tripping
3246 #[serde(skip_serializing_if = "Option::is_none")]
3247 pub server_tools: Option<AssistantMessageServerTools>,
3248 /// Copilot service request ID (x-copilot-service-request-id header) for CAPI log correlation
3249 #[serde(skip_serializing_if = "Option::is_none")]
3250 pub service_request_id: Option<String>,
3251 /// Tool invocations requested by the assistant in this message
3252 #[serde(skip_serializing_if = "Option::is_none")]
3253 pub tool_requests: Option<Vec<AssistantMessageToolRequest>>,
3254 /// Identifier for the agent loop turn that produced this message, matching the corresponding assistant.turn_start event
3255 #[serde(skip_serializing_if = "Option::is_none")]
3256 pub turn_id: Option<String>,
3257}
3258
3259/// Session event "assistant.message_start". Streaming assistant message start metadata
3260#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3261#[serde(rename_all = "camelCase")]
3262pub struct AssistantMessageStartData {
3263 /// Message ID this start event belongs to, matching subsequent deltas and assistant.message
3264 pub message_id: String,
3265 /// Generation phase this message belongs to for phased-output models
3266 #[serde(skip_serializing_if = "Option::is_none")]
3267 pub phase: Option<String>,
3268}
3269
3270/// Session event "assistant.message_delta". Streaming assistant message delta for incremental response updates
3271#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3272#[serde(rename_all = "camelCase")]
3273pub struct AssistantMessageDeltaData {
3274 /// Incremental text chunk to append to the message content
3275 pub delta_content: String,
3276 /// Message ID this delta belongs to, matching the corresponding assistant.message event
3277 pub message_id: String,
3278 /// Tool call ID of the parent tool invocation when this event originates from a sub-agent
3279 #[doc(hidden)]
3280 #[deprecated]
3281 #[serde(skip_serializing_if = "Option::is_none")]
3282 pub parent_tool_call_id: Option<String>,
3283}
3284
3285/// Session event "assistant.turn_end". Turn completion metadata including the turn identifier
3286#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3287#[serde(rename_all = "camelCase")]
3288pub struct AssistantTurnEndData {
3289 /// Model identifier used for this turn, when known
3290 #[serde(skip_serializing_if = "Option::is_none")]
3291 pub model: Option<String>,
3292 /// Identifier of the turn that has ended, matching the corresponding assistant.turn_start event
3293 pub turn_id: String,
3294}
3295
3296/// 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
3297#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3298#[serde(rename_all = "camelCase")]
3299pub struct AssistantIdleData {
3300 /// True when the preceding agentic loop was cancelled via abort signal
3301 #[serde(skip_serializing_if = "Option::is_none")]
3302 pub aborted: Option<bool>,
3303}
3304
3305/// Token usage detail for a single billing category
3306#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3307#[serde(rename_all = "camelCase")]
3308pub struct AssistantUsageCopilotUsageTokenDetail {
3309 /// Number of tokens in this billing batch
3310 pub batch_size: i64,
3311 /// Cost per batch of tokens
3312 pub cost_per_batch: i64,
3313 /// Model responsible for this billing entry
3314 #[serde(skip_serializing_if = "Option::is_none")]
3315 pub model: Option<String>,
3316 /// Total token count for this entry
3317 pub token_count: i64,
3318 /// Token category (e.g., "input", "output")
3319 pub token_type: String,
3320}
3321
3322/// Per-request cost and usage data from the CAPI copilot_usage response field
3323#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3324#[serde(rename_all = "camelCase")]
3325pub struct AssistantUsageCopilotUsage {
3326 /// Default billing model for token details that do not identify their own model
3327 #[serde(skip_serializing_if = "Option::is_none")]
3328 pub model: Option<String>,
3329 /// Itemized token usage breakdown
3330 #[doc(hidden)]
3331 #[serde(skip_serializing_if = "Option::is_none")]
3332 pub(crate) token_details: Option<Vec<AssistantUsageCopilotUsageTokenDetail>>,
3333 /// Total cost in nano-AI units for this request
3334 pub total_nano_aiu: f64,
3335}
3336
3337/// Internal per-quota snapshot for assistant usage, including entitlement, consumed requests, overage, reset date, and remaining quota.
3338#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3339#[serde(rename_all = "camelCase")]
3340pub(crate) struct AssistantUsageQuotaSnapshot {
3341 /// Total requests allowed by the entitlement
3342 #[doc(hidden)]
3343 pub(crate) entitlement_requests: i64,
3344 /// Whether the user currently has quota available for use
3345 #[doc(hidden)]
3346 #[serde(skip_serializing_if = "Option::is_none")]
3347 pub(crate) has_quota: Option<bool>,
3348 /// Whether the user has an unlimited usage entitlement
3349 #[doc(hidden)]
3350 pub(crate) is_unlimited_entitlement: bool,
3351 /// Number of additional usage requests made this period
3352 #[doc(hidden)]
3353 pub(crate) overage: f64,
3354 /// Whether additional usage is allowed when quota is exhausted
3355 #[doc(hidden)]
3356 pub(crate) overage_allowed_with_exhausted_quota: bool,
3357 /// Pay-as-you-go additional-usage budget cap in AI credits (1 credit = $0.01); present only when CAPI emits a finite value
3358 #[doc(hidden)]
3359 #[serde(skip_serializing_if = "Option::is_none")]
3360 pub(crate) overage_entitlement: Option<f64>,
3361 /// Percentage of quota remaining (0 to 100)
3362 #[doc(hidden)]
3363 pub(crate) remaining_percentage: f64,
3364 /// Date when the quota resets
3365 #[doc(hidden)]
3366 #[serde(skip_serializing_if = "Option::is_none")]
3367 pub(crate) reset_date: Option<String>,
3368 /// Whether this snapshot uses token-based billing (AI-credits allocation)
3369 #[doc(hidden)]
3370 #[serde(skip_serializing_if = "Option::is_none")]
3371 pub(crate) token_based_billing: Option<bool>,
3372 /// Whether usage is still permitted after quota exhaustion
3373 #[doc(hidden)]
3374 pub(crate) usage_allowed_with_exhausted_quota: bool,
3375 /// Number of requests already consumed
3376 #[doc(hidden)]
3377 pub(crate) used_requests: i64,
3378}
3379
3380/// Session event "assistant.usage". LLM API call usage metrics including tokens, costs, quotas, and billing information
3381#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3382#[serde(rename_all = "camelCase")]
3383pub struct AssistantUsageData {
3384 /// Number of accepted speculative prediction tokens
3385 #[serde(skip_serializing_if = "Option::is_none")]
3386 pub accepted_prediction_tokens: Option<i64>,
3387 /// Completion ID from the model provider (e.g., chatcmpl-abc123)
3388 #[serde(skip_serializing_if = "Option::is_none")]
3389 pub api_call_id: Option<String>,
3390 /// API endpoint used for this model call, matching CAPI supported_endpoints vocabulary
3391 #[serde(skip_serializing_if = "Option::is_none")]
3392 pub api_endpoint: Option<AssistantUsageApiEndpoint>,
3393 /// Number of tools available to the model for this call
3394 #[doc(hidden)]
3395 #[serde(skip_serializing_if = "Option::is_none")]
3396 pub(crate) available_tool_count: Option<i64>,
3397 /// Whether the provider reported prompt-cache usage details for this call
3398 #[doc(hidden)]
3399 #[serde(skip_serializing_if = "Option::is_none")]
3400 pub(crate) cache_details_reported: Option<bool>,
3401 /// Updated prompt-cache expiration for this model call. Present only when the call establishes or refreshes known cache state.
3402 #[serde(skip_serializing_if = "Option::is_none")]
3403 pub cache_expires_at: Option<String>,
3404 /// Number of tokens read from prompt cache
3405 #[serde(skip_serializing_if = "Option::is_none")]
3406 pub cache_read_tokens: Option<i64>,
3407 /// Effective prompt-cache lifetime in seconds for this call
3408 #[doc(hidden)]
3409 #[serde(skip_serializing_if = "Option::is_none")]
3410 pub(crate) cache_ttl_seconds: Option<i64>,
3411 /// Number of tokens written to prompt cache
3412 #[serde(skip_serializing_if = "Option::is_none")]
3413 pub cache_write_tokens: Option<i64>,
3414 /// 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.
3415 #[serde(skip_serializing_if = "Option::is_none")]
3416 pub content_filter_triggered: Option<bool>,
3417 /// Per-request cost and usage data from the CAPI copilot_usage response field
3418 #[serde(skip_serializing_if = "Option::is_none")]
3419 pub copilot_usage: Option<AssistantUsageCopilotUsage>,
3420 /// Model multiplier cost for billing purposes
3421 ///
3422 /// <div class="warning">
3423 ///
3424 /// **Experimental.** This type is part of an experimental wire-protocol surface
3425 /// and may change or be removed in future SDK or CLI releases.
3426 ///
3427 /// </div>
3428 #[serde(skip_serializing_if = "Option::is_none")]
3429 pub cost: Option<f64>,
3430 /// Duration of the API call in milliseconds
3431 #[serde(skip_serializing_if = "Option::is_none")]
3432 pub duration: Option<i64>,
3433 /// 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".
3434 #[serde(skip_serializing_if = "Option::is_none")]
3435 pub finish_reason: Option<String>,
3436 /// How the prompt-cache frontier was determined for this call
3437 #[doc(hidden)]
3438 #[serde(skip_serializing_if = "Option::is_none")]
3439 pub(crate) frontier_source: Option<String>,
3440 /// Experimental HydraFusion attribution for this concrete model call's usage.
3441 ///
3442 /// <div class="warning">
3443 ///
3444 /// **Experimental.** This type is part of an experimental wire-protocol surface
3445 /// and may change or be removed in future SDK or CLI releases.
3446 ///
3447 /// </div>
3448 #[serde(skip_serializing_if = "Option::is_none")]
3449 pub fusion: Option<FusionAttribution>,
3450 /// What initiated this API call (e.g., "sub-agent", "mcp-sampling"); absent for user-initiated calls
3451 #[serde(skip_serializing_if = "Option::is_none")]
3452 pub initiator: Option<String>,
3453 /// Number of input tokens consumed
3454 #[serde(skip_serializing_if = "Option::is_none")]
3455 pub input_tokens: Option<i64>,
3456 /// 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.
3457 #[serde(skip_serializing_if = "Option::is_none")]
3458 pub interaction_type: Option<String>,
3459 /// Average inter-token latency in milliseconds. Only available for streaming requests
3460 #[serde(skip_serializing_if = "Option::is_none")]
3461 pub inter_token_latency_ms: Option<f64>,
3462 /// Whether Auto mode was selected for this model call
3463 #[serde(skip_serializing_if = "Option::is_none")]
3464 pub is_auto: Option<bool>,
3465 /// Whether this model call used a bring-your-own-key provider
3466 #[serde(skip_serializing_if = "Option::is_none")]
3467 pub is_byok: Option<bool>,
3468 /// Requested maximum output tokens used for this model call
3469 #[serde(skip_serializing_if = "Option::is_none")]
3470 pub max_output_tokens: Option<i64>,
3471 /// Effective maximum prompt-token limit used for this model call
3472 #[serde(skip_serializing_if = "Option::is_none")]
3473 pub max_prompt_tokens: Option<i64>,
3474 /// Model identifier used for this API call
3475 pub model: String,
3476 /// Number of tool calls returned by the model
3477 #[doc(hidden)]
3478 #[serde(skip_serializing_if = "Option::is_none")]
3479 pub(crate) num_tool_calls: Option<i64>,
3480 /// Number of output tokens produced
3481 #[serde(skip_serializing_if = "Option::is_none")]
3482 pub output_tokens: Option<i64>,
3483 /// Time to first observable model output in milliseconds. Includes text, reasoning, and tool-call output; only available for streaming requests that produce observable output.
3484 #[serde(skip_serializing_if = "Option::is_none")]
3485 pub output_ttft_ms: Option<f64>,
3486 /// Parent tool call ID when this usage originates from a sub-agent
3487 #[doc(hidden)]
3488 #[deprecated]
3489 #[serde(skip_serializing_if = "Option::is_none")]
3490 pub parent_tool_call_id: Option<String>,
3491 /// GitHub request tracing ID (x-github-request-id header) for server-side log correlation
3492 #[serde(skip_serializing_if = "Option::is_none")]
3493 pub provider_call_id: Option<String>,
3494 /// Per-quota resource usage snapshots, keyed by quota identifier
3495 #[doc(hidden)]
3496 #[serde(skip_serializing_if = "Option::is_none")]
3497 pub(crate) quota_snapshots: Option<HashMap<String, AssistantUsageQuotaSnapshot>>,
3498 /// Reasoning effort level used for model calls, if applicable (e.g. "none", "low", "medium", "high", "xhigh", "max")
3499 #[serde(skip_serializing_if = "Option::is_none")]
3500 pub reasoning_effort: Option<String>,
3501 /// Reasoning summary mode used for this model call, if applicable
3502 #[serde(skip_serializing_if = "Option::is_none")]
3503 pub reasoning_summary: Option<ReasoningSummary>,
3504 /// Number of output tokens used for reasoning (e.g., chain-of-thought)
3505 #[serde(skip_serializing_if = "Option::is_none")]
3506 pub reasoning_tokens: Option<i64>,
3507 /// Number of rejected speculative prediction tokens
3508 #[serde(skip_serializing_if = "Option::is_none")]
3509 pub rejected_prediction_tokens: Option<i64>,
3510 /// 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.
3511 #[serde(skip_serializing_if = "Option::is_none")]
3512 pub rte: Option<bool>,
3513 /// Copilot service request ID (x-copilot-service-request-id header) for CAPI log correlation
3514 #[serde(skip_serializing_if = "Option::is_none")]
3515 pub service_request_id: Option<String>,
3516 /// Number of prior thinking blocks the provider dropped while transforming the request
3517 #[doc(hidden)]
3518 #[serde(skip_serializing_if = "Option::is_none")]
3519 pub(crate) thinking_dropped_blocks: Option<i64>,
3520 /// Recognized provider-reported reasons for dropped thinking blocks, in response order
3521 #[doc(hidden)]
3522 #[serde(skip_serializing_if = "Option::is_none")]
3523 pub(crate) thinking_dropped_reasons: Option<Vec<String>>,
3524 /// Time to first token in milliseconds. Only available for streaming requests
3525 #[serde(skip_serializing_if = "Option::is_none")]
3526 pub time_to_first_token_ms: Option<f64>,
3527 /// Tool-call counts keyed by tool name
3528 #[doc(hidden)]
3529 #[serde(skip_serializing_if = "Option::is_none")]
3530 pub(crate) tool_counts: Option<HashMap<String, i64>>,
3531 /// Number of tokens used by tool definitions for this call
3532 #[doc(hidden)]
3533 #[serde(skip_serializing_if = "Option::is_none")]
3534 pub(crate) tool_token_count: Option<i64>,
3535 /// Transport used for this model call (http or websocket)
3536 #[serde(skip_serializing_if = "Option::is_none")]
3537 pub transport: Option<AssistantUsageTransport>,
3538}
3539
3540/// Session event "prompt_cache_break". A detected loss of a previously cached prompt prefix
3541#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3542#[serde(rename_all = "camelCase")]
3543pub struct PromptCacheBreakData {
3544 /// Request state whose cached prefix fell short
3545 #[doc(hidden)]
3546 #[serde(skip_serializing_if = "Option::is_none")]
3547 pub(crate) after_request: Option<serde_json::Value>,
3548 /// Name of the sub-agent whose conversation broke, stamped by the parent bridge
3549 #[doc(hidden)]
3550 #[serde(skip_serializing_if = "Option::is_none")]
3551 pub(crate) agent_name: Option<String>,
3552 /// Request state that established the prior cache frontier
3553 #[doc(hidden)]
3554 #[serde(skip_serializing_if = "Option::is_none")]
3555 pub(crate) before_request: Option<serde_json::Value>,
3556 /// Names of the cache-configuration fields that changed
3557 #[doc(hidden)]
3558 #[serde(skip_serializing_if = "Option::is_none")]
3559 pub(crate) cache_config_changed_fields: Option<Vec<String>>,
3560 /// All reasons that contributed to the cache break, ordered by precedence
3561 pub contributing_reasons: Vec<String>,
3562 /// Prior cached prompt frontier in tokens
3563 pub frontier_tokens: i64,
3564 /// Model that held the prior cache frontier, when the call changed models
3565 #[doc(hidden)]
3566 #[serde(skip_serializing_if = "Option::is_none")]
3567 pub(crate) model_from: Option<String>,
3568 /// Model this call targeted, when the call changed models
3569 #[doc(hidden)]
3570 #[serde(skip_serializing_if = "Option::is_none")]
3571 pub(crate) model_to: Option<String>,
3572 /// The highest-precedence reason for the cache break
3573 pub primary_reason: String,
3574 /// Fraction of the prior cache frontier that survived
3575 pub retention_ratio: f64,
3576 /// Index of the first conversation message whose content changed
3577 #[doc(hidden)]
3578 #[serde(skip_serializing_if = "Option::is_none")]
3579 pub(crate) rewrite_message_index: Option<i64>,
3580 /// Shape of the history rewrite, for example whether the history grew or shrank
3581 #[doc(hidden)]
3582 #[serde(skip_serializing_if = "Option::is_none")]
3583 pub(crate) rewrite_shape: Option<String>,
3584 /// Subsystems that announced a history rewrite before this call, for example compaction or truncation
3585 #[doc(hidden)]
3586 #[serde(skip_serializing_if = "Option::is_none")]
3587 pub(crate) rewrite_source: Option<Vec<String>>,
3588 /// Cached prefix tokens lost since the prior call
3589 pub shortfall_tokens: i64,
3590 /// Number of cached prefix tokens that survived
3591 pub survived_tokens: i64,
3592 /// Names of the system-prompt segments whose content changed
3593 #[doc(hidden)]
3594 #[serde(skip_serializing_if = "Option::is_none")]
3595 pub(crate) system_segments_changed: Option<Vec<String>>,
3596 /// Telemetry-safe names of tools added since the prior call
3597 #[doc(hidden)]
3598 #[serde(skip_serializing_if = "Option::is_none")]
3599 pub(crate) tools_added: Option<Vec<String>>,
3600 /// Raw names of tools added since the prior call, restricted because a tool name can be user-authored
3601 #[doc(hidden)]
3602 #[serde(skip_serializing_if = "Option::is_none")]
3603 pub(crate) tools_added_raw: Option<Vec<String>>,
3604 /// Telemetry-safe names of tools whose definition changed since the prior call
3605 #[doc(hidden)]
3606 #[serde(skip_serializing_if = "Option::is_none")]
3607 pub(crate) tools_redefined: Option<Vec<String>>,
3608 /// Raw names of tools redefined since the prior call, restricted because a tool name can be user-authored
3609 #[doc(hidden)]
3610 #[serde(skip_serializing_if = "Option::is_none")]
3611 pub(crate) tools_redefined_raw: Option<Vec<String>>,
3612 /// Telemetry-safe names of tools removed since the prior call
3613 #[doc(hidden)]
3614 #[serde(skip_serializing_if = "Option::is_none")]
3615 pub(crate) tools_removed: Option<Vec<String>>,
3616 /// Raw names of tools removed since the prior call, restricted because a tool name can be user-authored
3617 #[doc(hidden)]
3618 #[serde(skip_serializing_if = "Option::is_none")]
3619 pub(crate) tools_removed_raw: Option<Vec<String>>,
3620 /// Whether the tool list kept its members but changed their order
3621 #[doc(hidden)]
3622 #[serde(skip_serializing_if = "Option::is_none")]
3623 pub(crate) tools_reordered: Option<bool>,
3624}
3625
3626/// Content-free structural summary of the failing request for diagnosing malformed 4xx calls
3627#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3628#[serde(rename_all = "camelCase")]
3629pub struct ModelCallFailureRequestFingerprint {
3630 /// Total number of image content parts
3631 pub image_part_count: i64,
3632 /// Image parts whose media type cannot be determined (rejected by strict providers)
3633 pub image_parts_missing_media_type: i64,
3634 /// Role of the final message in the request
3635 #[serde(skip_serializing_if = "Option::is_none")]
3636 pub last_message_role: Option<String>,
3637 /// Total number of messages in the request
3638 pub message_count: i64,
3639 /// Tool calls whose name is missing or empty (rejected by strict providers)
3640 pub nameless_tool_call_count: i64,
3641 /// Total number of tool calls across assistant messages
3642 pub tool_call_count: i64,
3643 /// Number of "tool" result messages in the request
3644 pub tool_result_message_count: i64,
3645}
3646
3647/// Session event "model.call_failure". Failed LLM API call metadata for telemetry
3648#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3649#[serde(rename_all = "camelCase")]
3650pub struct ModelCallFailureData {
3651 /// Completion ID from the model provider (e.g., chatcmpl-abc123)
3652 #[serde(skip_serializing_if = "Option::is_none")]
3653 pub api_call_id: Option<String>,
3654 /// API endpoint used for this model call, matching CAPI supported_endpoints vocabulary
3655 #[serde(skip_serializing_if = "Option::is_none")]
3656 pub api_endpoint: Option<AssistantUsageApiEndpoint>,
3657 /// 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.
3658 #[serde(skip_serializing_if = "Option::is_none")]
3659 pub bad_request_kind: Option<ModelCallFailureBadRequestKind>,
3660 /// Duration of the failed API call in milliseconds
3661 #[serde(skip_serializing_if = "Option::is_none")]
3662 pub duration_ms: Option<i64>,
3663 /// 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.
3664 #[serde(skip_serializing_if = "Option::is_none")]
3665 pub error_code: Option<String>,
3666 /// Raw provider/runtime error message for restricted telemetry
3667 #[serde(skip_serializing_if = "Option::is_none")]
3668 pub error_message: Option<String>,
3669 /// 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.
3670 #[serde(skip_serializing_if = "Option::is_none")]
3671 pub error_type: Option<String>,
3672 /// Whether the failure originated from an API response or the request transport
3673 #[serde(skip_serializing_if = "Option::is_none")]
3674 pub failure_kind: Option<ModelCallFailureKind>,
3675 /// Experimental HydraFusion attribution for this failed concrete model call.
3676 ///
3677 /// <div class="warning">
3678 ///
3679 /// **Experimental.** This type is part of an experimental wire-protocol surface
3680 /// and may change or be removed in future SDK or CLI releases.
3681 ///
3682 /// </div>
3683 #[serde(skip_serializing_if = "Option::is_none")]
3684 pub fusion: Option<FusionAttribution>,
3685 /// What initiated this API call (e.g., "sub-agent", "mcp-sampling"); absent for user-initiated calls
3686 #[serde(skip_serializing_if = "Option::is_none")]
3687 pub initiator: Option<String>,
3688 /// 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.
3689 #[serde(skip_serializing_if = "Option::is_none")]
3690 pub interaction_type: Option<String>,
3691 /// Whether the session selected Auto mode for the failed call
3692 #[serde(skip_serializing_if = "Option::is_none")]
3693 pub is_auto: Option<bool>,
3694 /// Whether the failed call used a bring-your-own-key provider
3695 #[serde(skip_serializing_if = "Option::is_none")]
3696 pub is_byok: Option<bool>,
3697 /// Effective maximum output-token limit for the failed call
3698 #[serde(skip_serializing_if = "Option::is_none")]
3699 pub max_output_tokens: Option<i64>,
3700 /// Effective maximum prompt-token limit for the failed call
3701 #[serde(skip_serializing_if = "Option::is_none")]
3702 pub max_prompt_tokens: Option<i64>,
3703 /// Model identifier used for the failed API call
3704 #[serde(skip_serializing_if = "Option::is_none")]
3705 pub model: Option<String>,
3706 /// GitHub request tracing ID (x-github-request-id header) for server-side log correlation
3707 #[serde(skip_serializing_if = "Option::is_none")]
3708 pub provider_call_id: Option<String>,
3709 /// 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.
3710 #[doc(hidden)]
3711 #[serde(skip_serializing_if = "Option::is_none")]
3712 pub(crate) quota_snapshots: Option<HashMap<String, AssistantUsageQuotaSnapshot>>,
3713 /// Reasoning effort level used for the failed model call, if applicable
3714 #[serde(skip_serializing_if = "Option::is_none")]
3715 pub reasoning_effort: Option<String>,
3716 /// 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.
3717 #[serde(skip_serializing_if = "Option::is_none")]
3718 pub request_fingerprint: Option<ModelCallFailureRequestFingerprint>,
3719 /// 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.
3720 #[serde(skip_serializing_if = "Option::is_none")]
3721 pub rte: Option<bool>,
3722 /// Copilot service request ID (x-copilot-service-request-id header) for CAPI log correlation
3723 #[serde(skip_serializing_if = "Option::is_none")]
3724 pub service_request_id: Option<String>,
3725 /// Where the failed model call originated
3726 pub source: ModelCallFailureSource,
3727 /// HTTP status code from the failed request
3728 #[serde(skip_serializing_if = "Option::is_none")]
3729 pub status_code: Option<i32>,
3730 /// Transport used for the failed model call (http or websocket)
3731 #[serde(skip_serializing_if = "Option::is_none")]
3732 pub transport: Option<ModelCallFailureTransport>,
3733}
3734
3735/// 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.
3736#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3737#[serde(rename_all = "camelCase")]
3738pub struct ModelCallFinishedData {
3739 /// 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.
3740 #[serde(skip_serializing_if = "Option::is_none")]
3741 pub contains_built_in_file_edit_request: Option<bool>,
3742 /// 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
3743 pub dispatch_duration_ms: f64,
3744 /// Version of the built-in file-edit semantic classifier used for this event
3745 pub edit_classifier_version: i64,
3746 /// Identifier of the user interaction that owns the model dispatch, matching assistant.turn_start.interactionId when available
3747 #[serde(skip_serializing_if = "Option::is_none")]
3748 pub interaction_id: Option<String>,
3749 /// Final outcome after post-response acceptance processing
3750 pub outcome: ModelCallFinishedOutcome,
3751 /// Agent-loop iteration within the interaction that initiated the model dispatch
3752 pub turn_id: String,
3753}
3754
3755/// Session event "model.call_start". Model API dispatch metadata for internal telemetry
3756#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3757#[serde(rename_all = "camelCase")]
3758pub struct ModelCallStartData {
3759 /// Experimental HydraFusion attribution for this concrete model call.
3760 ///
3761 /// <div class="warning">
3762 ///
3763 /// **Experimental.** This type is part of an experimental wire-protocol surface
3764 /// and may change or be removed in future SDK or CLI releases.
3765 ///
3766 /// </div>
3767 #[serde(skip_serializing_if = "Option::is_none")]
3768 pub fusion: Option<FusionAttribution>,
3769 /// Model identifier used for this API call, when known
3770 #[serde(skip_serializing_if = "Option::is_none")]
3771 pub model: Option<String>,
3772 /// Previous response or interaction identifier included in the model request, when present
3773 #[doc(hidden)]
3774 #[serde(skip_serializing_if = "Option::is_none")]
3775 pub(crate) previous_response_id: Option<String>,
3776 /// Identifier of the assistant turn that initiated the model call
3777 pub turn_id: String,
3778}
3779
3780/// Session event "abort". Turn abort information including the reason for termination
3781#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3782#[serde(rename_all = "camelCase")]
3783pub struct AbortData {
3784 /// Finite reason code describing why the current turn was aborted
3785 pub reason: AbortReason,
3786}
3787
3788/// Session event "tool.user_requested". User-initiated tool invocation request with tool name and arguments
3789#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3790#[serde(rename_all = "camelCase")]
3791pub struct ToolUserRequestedData {
3792 /// Arguments for the tool invocation
3793 #[serde(skip_serializing_if = "Option::is_none")]
3794 pub arguments: Option<serde_json::Value>,
3795 /// Unique identifier for this tool call
3796 pub tool_call_id: String,
3797 /// Name of the tool the user wants to invoke
3798 pub tool_name: String,
3799}
3800
3801/// 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.
3802#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3803#[serde(rename_all = "camelCase")]
3804pub struct ToolExecutionStartShellToolInfo {
3805 /// 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.
3806 ///
3807 /// <div class="warning">
3808 ///
3809 /// **Experimental.** This type is part of an experimental wire-protocol surface
3810 /// and may change or be removed in future SDK or CLI releases.
3811 ///
3812 /// </div>
3813 #[serde(skip_serializing_if = "Option::is_none")]
3814 pub display_command: Option<String>,
3815 /// Whether the command includes a file write redirection (e.g., > or >>).
3816 pub has_write_file_redirection: bool,
3817 /// 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.
3818 pub possible_paths: Vec<String>,
3819}
3820
3821/// MCP Apps tool `_meta.ui` resource URI and visibility captured on `tool.execution_start`.
3822#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3823#[serde(rename_all = "camelCase")]
3824pub struct ToolExecutionStartToolDescriptionMetaUI {
3825 /// URI of the UI resource
3826 #[serde(skip_serializing_if = "Option::is_none")]
3827 pub resource_uri: Option<String>,
3828 /// Who can access this tool
3829 #[serde(skip_serializing_if = "Option::is_none")]
3830 pub visibility: Option<Vec<ToolExecutionStartToolDescriptionMetaUIVisibility>>,
3831}
3832
3833/// MCP Apps metadata for UI resource association
3834#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3835#[serde(rename_all = "camelCase")]
3836pub struct ToolExecutionStartToolDescriptionMeta {
3837 /// MCP Apps tool `_meta.ui` resource URI and visibility captured on `tool.execution_start`.
3838 #[serde(skip_serializing_if = "Option::is_none")]
3839 pub ui: Option<ToolExecutionStartToolDescriptionMetaUI>,
3840}
3841
3842/// Tool definition metadata, present for MCP tools with MCP Apps support
3843#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3844#[serde(rename_all = "camelCase")]
3845pub struct ToolExecutionStartToolDescription {
3846 /// MCP Apps metadata for UI resource association
3847 #[serde(rename = "_meta", skip_serializing_if = "Option::is_none")]
3848 pub meta: Option<ToolExecutionStartToolDescriptionMeta>,
3849 /// Tool description
3850 #[serde(skip_serializing_if = "Option::is_none")]
3851 pub description: Option<String>,
3852 /// Tool name
3853 pub name: String,
3854}
3855
3856/// Session event "tool.execution_start". Tool execution startup details including MCP server information when applicable
3857#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3858#[serde(rename_all = "camelCase")]
3859pub struct ToolExecutionStartData {
3860 /// Arguments passed to the tool
3861 #[serde(skip_serializing_if = "Option::is_none")]
3862 pub arguments: Option<serde_json::Value>,
3863 /// When true, the tool output should be displayed expanded (verbatim) in the CLI timeline
3864 #[serde(skip_serializing_if = "Option::is_none")]
3865 pub display_verbatim: Option<bool>,
3866 /// Experimental HydraFusion attribution for this tool execution.
3867 ///
3868 /// <div class="warning">
3869 ///
3870 /// **Experimental.** This type is part of an experimental wire-protocol surface
3871 /// and may change or be removed in future SDK or CLI releases.
3872 ///
3873 /// </div>
3874 #[serde(skip_serializing_if = "Option::is_none")]
3875 pub fusion: Option<FusionAttribution>,
3876 /// Preferred lookup name for the MCP server hosting this tool: the configured (namespaced) config-map key when the tool carries one, otherwise the display name from `mcpServerName`. Present when the tool is an MCP tool; this is the name unrestricted provenance telemetry hashes so it joins with `mcp_server_setup`, which keys off the configured name too.
3877 #[serde(skip_serializing_if = "Option::is_none")]
3878 pub mcp_config_server_name: Option<String>,
3879 /// Where the MCP server's configuration came from (`user`, `workspace`, `plugin`, or `builtin`), when the tool is an MCP tool and the server is configured
3880 #[serde(skip_serializing_if = "Option::is_none")]
3881 pub mcp_config_source: Option<McpServerSource>,
3882 /// Name of the MCP server hosting this tool, when the tool is an MCP tool
3883 #[serde(skip_serializing_if = "Option::is_none")]
3884 pub mcp_server_name: Option<String>,
3885 /// Original tool name on the MCP server, when the tool is an MCP tool
3886 #[serde(skip_serializing_if = "Option::is_none")]
3887 pub mcp_tool_name: Option<String>,
3888 /// Transport the MCP server hosting this tool is connected over, when the tool is an MCP tool and the server is configured
3889 #[serde(skip_serializing_if = "Option::is_none")]
3890 pub mcp_transport: Option<McpServerTransport>,
3891 /// Model identifier that generated this tool call
3892 #[serde(skip_serializing_if = "Option::is_none")]
3893 pub model: Option<String>,
3894 /// Tool call ID of the parent tool invocation when this event originates from a sub-agent
3895 #[doc(hidden)]
3896 #[deprecated]
3897 #[serde(skip_serializing_if = "Option::is_none")]
3898 pub parent_tool_call_id: Option<String>,
3899 /// 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.
3900 #[serde(skip_serializing_if = "Option::is_none")]
3901 pub rte: Option<bool>,
3902 /// 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.
3903 #[serde(skip_serializing_if = "Option::is_none")]
3904 pub shell_tool_info: Option<ToolExecutionStartShellToolInfo>,
3905 /// Unique identifier for this tool call
3906 pub tool_call_id: String,
3907 /// Tool definition metadata, present for MCP tools with MCP Apps support
3908 #[serde(skip_serializing_if = "Option::is_none")]
3909 pub tool_description: Option<ToolExecutionStartToolDescription>,
3910 /// Name of the tool being executed
3911 pub tool_name: String,
3912 /// Identifier for the agent loop turn this tool was invoked in, matching the corresponding assistant.turn_start event
3913 #[serde(skip_serializing_if = "Option::is_none")]
3914 pub turn_id: Option<String>,
3915}
3916
3917/// Session event "tool.execution_partial_result". Streaming tool execution output for incremental result display
3918#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3919#[serde(rename_all = "camelCase")]
3920pub struct ToolExecutionPartialResultData {
3921 /// Incremental output chunk from the running tool
3922 pub partial_output: String,
3923 /// Tool call ID this partial result belongs to
3924 pub tool_call_id: String,
3925}
3926
3927/// Session event "tool.execution_progress". Tool execution progress notification with status message
3928#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3929#[serde(rename_all = "camelCase")]
3930pub struct ToolExecutionProgressData {
3931 /// Human-readable progress status message (e.g., from an MCP server)
3932 pub progress_message: String,
3933 /// Tool call ID this progress notification belongs to
3934 pub tool_call_id: String,
3935}
3936
3937/// Error details when the tool execution failed
3938#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3939#[serde(rename_all = "camelCase")]
3940pub struct ToolExecutionCompleteError {
3941 /// Machine-readable error code
3942 #[serde(skip_serializing_if = "Option::is_none")]
3943 pub code: Option<String>,
3944 /// Human-readable error message
3945 pub message: String,
3946 /// 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.
3947 #[serde(skip_serializing_if = "Option::is_none")]
3948 pub remediation: Option<RemediationAction>,
3949}
3950
3951/// Binary result returned by a tool for the model
3952#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3953#[serde(rename_all = "camelCase")]
3954pub struct PersistedBinaryImage {
3955 /// Base64-encoded binary data
3956 pub data: String,
3957 /// Human-readable description of the binary data
3958 #[serde(skip_serializing_if = "Option::is_none")]
3959 pub description: Option<String>,
3960 /// Optional metadata from the producing tool.
3961 #[serde(skip_serializing_if = "Option::is_none")]
3962 pub metadata: Option<HashMap<String, serde_json::Value>>,
3963 /// MIME type of the binary data
3964 pub mime_type: String,
3965 /// Binary result type discriminator. Use "image" for images and "resource" for other binary data.
3966 pub r#type: PersistedBinaryImageType,
3967}
3968
3969/// A binary result whose data was omitted from persistence due to the inline size limit
3970///
3971/// <div class="warning">
3972///
3973/// **Experimental.** This type is part of an experimental wire-protocol surface
3974/// and may change or be removed in future SDK or CLI releases.
3975///
3976/// </div>
3977#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3978#[serde(rename_all = "camelCase")]
3979pub struct OmittedBinaryResult {
3980 /// Decoded byte length of the omitted binary data
3981 pub byte_length: i64,
3982 /// Human-readable description of the binary data
3983 #[serde(skip_serializing_if = "Option::is_none")]
3984 pub description: Option<String>,
3985 /// Optional metadata from the producing tool.
3986 #[serde(skip_serializing_if = "Option::is_none")]
3987 pub metadata: Option<HashMap<String, serde_json::Value>>,
3988 /// MIME type of the omitted binary data
3989 pub mime_type: String,
3990 /// Why the binary data is absent: it exceeded the inline size limit, or its asset was unavailable
3991 pub omitted_reason: OmittedBinaryOmittedReason,
3992 /// Binary result type discriminator. Use "image" for images and "resource" for other binary data.
3993 pub r#type: OmittedBinaryType,
3994}
3995
3996/// A reference to binary data persisted once on a session.binary_asset event and shared by id
3997///
3998/// <div class="warning">
3999///
4000/// **Experimental.** This type is part of an experimental wire-protocol surface
4001/// and may change or be removed in future SDK or CLI releases.
4002///
4003/// </div>
4004#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4005#[serde(rename_all = "camelCase")]
4006pub struct BinaryAssetReference {
4007 /// Content-addressed id of the session.binary_asset event that holds this binary's bytes (e.g. "sha256:...").
4008 pub asset_id: String,
4009 /// Decoded byte length of the referenced binary data
4010 pub byte_length: i64,
4011 /// Human-readable description of the binary data
4012 #[serde(skip_serializing_if = "Option::is_none")]
4013 pub description: Option<String>,
4014 /// Optional metadata from the producing tool.
4015 #[serde(skip_serializing_if = "Option::is_none")]
4016 pub metadata: Option<HashMap<String, serde_json::Value>>,
4017 /// MIME type of the referenced binary data
4018 pub mime_type: String,
4019 /// Binary result type discriminator. Use "image" for images and "resource" for other binary data.
4020 pub r#type: BinaryAssetReferenceType,
4021}
4022
4023/// A source supplied by a tool that should be made available to the model as citable content.
4024///
4025/// <div class="warning">
4026///
4027/// **Experimental.** This type is part of an experimental wire-protocol surface
4028/// and may change or be removed in future SDK or CLI releases.
4029///
4030/// </div>
4031#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4032#[serde(rename_all = "camelCase")]
4033pub struct CitableSource {
4034 /// The source text made available to the model as citable content.
4035 pub content: String,
4036 /// 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.
4037 pub id: String,
4038 /// File path relative to the agent's workspace root, when the source is a file.
4039 #[serde(skip_serializing_if = "Option::is_none")]
4040 pub path: Option<String>,
4041 /// Human-readable title of the source.
4042 #[serde(skip_serializing_if = "Option::is_none")]
4043 pub title: Option<String>,
4044 /// URL of the source, when it is a web resource.
4045 #[serde(skip_serializing_if = "Option::is_none")]
4046 pub url: Option<String>,
4047}
4048
4049/// Plain text content block
4050#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4051#[serde(rename_all = "camelCase")]
4052pub struct ToolExecutionCompleteContentText {
4053 /// The text content
4054 pub text: String,
4055 /// Content block type discriminator
4056 pub r#type: ToolExecutionCompleteContentTextType,
4057}
4058
4059/// Deprecated for shell command exit metadata. Use ToolExecutionCompleteContentShellExit instead.
4060#[doc(hidden)]
4061#[deprecated]
4062#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4063#[serde(rename_all = "camelCase")]
4064pub struct ToolExecutionCompleteContentTerminal {
4065 /// Working directory where the command was executed
4066 #[serde(skip_serializing_if = "Option::is_none")]
4067 pub cwd: Option<String>,
4068 /// Process exit code, if the command has completed
4069 #[serde(skip_serializing_if = "Option::is_none")]
4070 pub exit_code: Option<i64>,
4071 /// Terminal/shell output text
4072 pub text: String,
4073 /// Content block type discriminator
4074 pub r#type: ToolExecutionCompleteContentTerminalType,
4075}
4076
4077/// Shell command exit metadata with optional output preview
4078#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4079#[serde(rename_all = "camelCase")]
4080pub struct ToolExecutionCompleteContentShellExit {
4081 /// Working directory where the shell command was executed
4082 #[serde(skip_serializing_if = "Option::is_none")]
4083 pub cwd: Option<String>,
4084 /// Exit code from the completed shell command
4085 pub exit_code: i64,
4086 /// Path reported in the shell session's filesystem namespace when shell output exceeded the configured large-output threshold.
4087 #[serde(skip_serializing_if = "Option::is_none")]
4088 pub output_file_path: Option<String>,
4089 /// Output associated with this shell command, if available. May be partial, truncated, or a preview; not guaranteed to be full output.
4090 #[serde(skip_serializing_if = "Option::is_none")]
4091 pub output_preview: Option<String>,
4092 /// Whether outputPreview is known to be incomplete or truncated
4093 #[serde(skip_serializing_if = "Option::is_none")]
4094 pub output_truncated: Option<bool>,
4095 /// Shell id, as assigned by Copilot runtime
4096 pub shell_id: String,
4097 /// Content block type discriminator
4098 pub r#type: ToolExecutionCompleteContentShellExitType,
4099}
4100
4101/// Image content block with base64-encoded data
4102#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4103#[serde(rename_all = "camelCase")]
4104pub struct ToolExecutionCompleteContentImage {
4105 /// Base64-encoded image data
4106 pub data: String,
4107 /// MIME type of the image (e.g., image/png, image/jpeg)
4108 pub mime_type: String,
4109 /// Content block type discriminator
4110 pub r#type: ToolExecutionCompleteContentImageType,
4111}
4112
4113/// Audio content block with base64-encoded data
4114#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4115#[serde(rename_all = "camelCase")]
4116pub struct ToolExecutionCompleteContentAudio {
4117 /// Base64-encoded audio data
4118 pub data: String,
4119 /// MIME type of the audio (e.g., audio/wav, audio/mpeg)
4120 pub mime_type: String,
4121 /// Content block type discriminator
4122 pub r#type: ToolExecutionCompleteContentAudioType,
4123}
4124
4125/// Icon image for a resource
4126#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4127#[serde(rename_all = "camelCase")]
4128pub struct ToolExecutionCompleteContentResourceLinkIcon {
4129 /// MIME type of the icon image
4130 #[serde(skip_serializing_if = "Option::is_none")]
4131 pub mime_type: Option<String>,
4132 /// Available icon sizes (e.g., ['16x16', '32x32'])
4133 #[serde(skip_serializing_if = "Option::is_none")]
4134 pub sizes: Option<Vec<String>>,
4135 /// URL or path to the icon image
4136 pub src: String,
4137 /// Theme variant this icon is intended for
4138 #[serde(skip_serializing_if = "Option::is_none")]
4139 pub theme: Option<ToolExecutionCompleteContentResourceLinkIconTheme>,
4140}
4141
4142/// Resource link content block referencing an external resource
4143#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4144#[serde(rename_all = "camelCase")]
4145pub struct ToolExecutionCompleteContentResourceLink {
4146 /// Human-readable description of the resource
4147 #[serde(skip_serializing_if = "Option::is_none")]
4148 pub description: Option<String>,
4149 /// Icons associated with this resource
4150 #[serde(skip_serializing_if = "Option::is_none")]
4151 pub icons: Option<Vec<ToolExecutionCompleteContentResourceLinkIcon>>,
4152 /// MIME type of the resource content
4153 #[serde(skip_serializing_if = "Option::is_none")]
4154 pub mime_type: Option<String>,
4155 /// Resource name identifier
4156 pub name: String,
4157 /// Size of the resource in bytes
4158 #[serde(skip_serializing_if = "Option::is_none")]
4159 pub size: Option<i64>,
4160 /// Human-readable display title for the resource
4161 #[serde(skip_serializing_if = "Option::is_none")]
4162 pub title: Option<String>,
4163 /// Content block type discriminator
4164 pub r#type: ToolExecutionCompleteContentResourceLinkType,
4165 /// URI identifying the resource
4166 pub uri: String,
4167}
4168
4169/// Embedded text resource contents identified by a URI, with an optional MIME type and a text payload.
4170#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4171#[serde(rename_all = "camelCase")]
4172pub struct EmbeddedTextResourceContents {
4173 /// MIME type of the text content
4174 #[serde(skip_serializing_if = "Option::is_none")]
4175 pub mime_type: Option<String>,
4176 /// Text content of the resource
4177 pub text: String,
4178 /// URI identifying the resource
4179 pub uri: String,
4180}
4181
4182/// Embedded binary resource contents identified by a URI, with an optional MIME type and a base64-encoded blob.
4183#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4184#[serde(rename_all = "camelCase")]
4185pub struct EmbeddedBlobResourceContents {
4186 /// Base64-encoded binary content of the resource
4187 pub blob: String,
4188 /// MIME type of the blob content
4189 #[serde(skip_serializing_if = "Option::is_none")]
4190 pub mime_type: Option<String>,
4191 /// URI identifying the resource
4192 pub uri: String,
4193}
4194
4195/// Embedded resource content block with inline text or binary data
4196#[derive(Debug, Clone, Serialize, Deserialize)]
4197#[serde(rename_all = "camelCase")]
4198pub struct ToolExecutionCompleteContentResource {
4199 /// The embedded resource contents, either text or base64-encoded binary
4200 pub resource: ToolExecutionCompleteContentResourceDetails,
4201 /// Content block type discriminator
4202 pub r#type: ToolExecutionCompleteContentResourceType,
4203}
4204
4205/// CSP domain allowlists for an MCP Apps UI resource, including connect, resource, frame, and base URI domains.
4206#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4207#[serde(rename_all = "camelCase")]
4208pub struct ToolExecutionCompleteUIResourceMetaUICsp {
4209 /// Domains the UI resource may use as document base URIs.
4210 #[serde(skip_serializing_if = "Option::is_none")]
4211 pub base_uri_domains: Option<Vec<String>>,
4212 /// Domains the UI resource may connect to.
4213 #[serde(skip_serializing_if = "Option::is_none")]
4214 pub connect_domains: Option<Vec<String>>,
4215 /// Domains the UI resource may embed as nested frames.
4216 #[serde(skip_serializing_if = "Option::is_none")]
4217 pub frame_domains: Option<Vec<String>>,
4218 /// Domains from which the UI resource may load scripts, styles, images, and other resources.
4219 #[serde(skip_serializing_if = "Option::is_none")]
4220 pub resource_domains: Option<Vec<String>>,
4221}
4222
4223/// Marker object for camera permission on an MCP Apps UI resource.
4224#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4225#[serde(rename_all = "camelCase")]
4226pub struct ToolExecutionCompleteUIResourceMetaUIPermissionsCamera {}
4227
4228/// Marker object for clipboard-write permission on an MCP Apps UI resource.
4229#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4230#[serde(rename_all = "camelCase")]
4231pub struct ToolExecutionCompleteUIResourceMetaUIPermissionsClipboardWrite {}
4232
4233/// Marker object for geolocation permission on an MCP Apps UI resource.
4234#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4235#[serde(rename_all = "camelCase")]
4236pub struct ToolExecutionCompleteUIResourceMetaUIPermissionsGeolocation {}
4237
4238/// Marker object for microphone permission on an MCP Apps UI resource.
4239#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4240#[serde(rename_all = "camelCase")]
4241pub struct ToolExecutionCompleteUIResourceMetaUIPermissionsMicrophone {}
4242
4243/// Browser permission metadata for an MCP Apps UI resource, including camera, microphone, geolocation, and clipboard-write.
4244#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4245#[serde(rename_all = "camelCase")]
4246pub struct ToolExecutionCompleteUIResourceMetaUIPermissions {
4247 /// Marker object for camera permission on an MCP Apps UI resource.
4248 #[serde(skip_serializing_if = "Option::is_none")]
4249 pub camera: Option<ToolExecutionCompleteUIResourceMetaUIPermissionsCamera>,
4250 /// Marker object for clipboard-write permission on an MCP Apps UI resource.
4251 #[serde(skip_serializing_if = "Option::is_none")]
4252 pub clipboard_write: Option<ToolExecutionCompleteUIResourceMetaUIPermissionsClipboardWrite>,
4253 /// Marker object for geolocation permission on an MCP Apps UI resource.
4254 #[serde(skip_serializing_if = "Option::is_none")]
4255 pub geolocation: Option<ToolExecutionCompleteUIResourceMetaUIPermissionsGeolocation>,
4256 /// Marker object for microphone permission on an MCP Apps UI resource.
4257 #[serde(skip_serializing_if = "Option::is_none")]
4258 pub microphone: Option<ToolExecutionCompleteUIResourceMetaUIPermissionsMicrophone>,
4259}
4260
4261/// MCP Apps UI resource metadata for a completed tool result, including CSP, permissions, domain, and border preference.
4262#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4263#[serde(rename_all = "camelCase")]
4264pub struct ToolExecutionCompleteUIResourceMetaUI {
4265 /// CSP domain allowlists for an MCP Apps UI resource, including connect, resource, frame, and base URI domains.
4266 #[serde(skip_serializing_if = "Option::is_none")]
4267 pub csp: Option<ToolExecutionCompleteUIResourceMetaUICsp>,
4268 /// Optional dedicated origin for the rendered MCP Apps UI resource.
4269 #[serde(skip_serializing_if = "Option::is_none")]
4270 pub domain: Option<String>,
4271 /// Browser permission metadata for an MCP Apps UI resource, including camera, microphone, geolocation, and clipboard-write.
4272 #[serde(skip_serializing_if = "Option::is_none")]
4273 pub permissions: Option<ToolExecutionCompleteUIResourceMetaUIPermissions>,
4274 /// Whether the host should render a border around the MCP Apps UI resource.
4275 #[serde(skip_serializing_if = "Option::is_none")]
4276 pub prefers_border: Option<bool>,
4277}
4278
4279/// Resource-level UI metadata (CSP, permissions, visual preferences)
4280#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4281#[serde(rename_all = "camelCase")]
4282pub struct ToolExecutionCompleteUIResourceMeta {
4283 /// MCP Apps UI resource metadata for a completed tool result, including CSP, permissions, domain, and border preference.
4284 #[serde(skip_serializing_if = "Option::is_none")]
4285 pub ui: Option<ToolExecutionCompleteUIResourceMetaUI>,
4286}
4287
4288/// MCP Apps UI resource content for rendering in a sandboxed iframe
4289#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4290#[serde(rename_all = "camelCase")]
4291pub struct ToolExecutionCompleteUIResource {
4292 /// Resource-level UI metadata (CSP, permissions, visual preferences)
4293 #[serde(rename = "_meta", skip_serializing_if = "Option::is_none")]
4294 pub meta: Option<ToolExecutionCompleteUIResourceMeta>,
4295 /// Base64-encoded HTML content
4296 #[serde(skip_serializing_if = "Option::is_none")]
4297 pub blob: Option<String>,
4298 /// MIME type of the content
4299 pub mime_type: String,
4300 /// HTML content as a string
4301 #[serde(skip_serializing_if = "Option::is_none")]
4302 pub text: Option<String>,
4303 /// The ui:// URI of the resource
4304 pub uri: String,
4305}
4306
4307/// Tool execution result on success
4308#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4309#[serde(rename_all = "camelCase")]
4310pub struct ToolExecutionCompleteResult {
4311 /// Model-facing binary results (base64 inline or size-omitted markers) sent to the LLM for this tool call
4312 ///
4313 /// <div class="warning">
4314 ///
4315 /// **Experimental.** This type is part of an experimental wire-protocol surface
4316 /// and may change or be removed in future SDK or CLI releases.
4317 ///
4318 /// </div>
4319 #[serde(skip_serializing_if = "Option::is_none")]
4320 pub binary_results_for_llm: Option<Vec<PersistedBinaryResult>>,
4321 /// Provider-neutral source material this tool makes available to the model as citable content. Persisted so it survives session resume. Experimental.
4322 ///
4323 /// <div class="warning">
4324 ///
4325 /// **Experimental.** This type is part of an experimental wire-protocol surface
4326 /// and may change or be removed in future SDK or CLI releases.
4327 ///
4328 /// </div>
4329 #[serde(skip_serializing_if = "Option::is_none")]
4330 pub citable_sources: Option<Vec<CitableSource>>,
4331 /// Concise tool result text sent to the LLM for chat completion, potentially truncated for token efficiency
4332 pub content: String,
4333 /// Structured content blocks (text, images, audio, resources) returned by the tool in their native format
4334 #[serde(skip_serializing_if = "Option::is_none")]
4335 pub contents: Option<Vec<ToolExecutionCompleteContent>>,
4336 /// Detailed tool result for UI/timeline display, preserving complete content such as diffs for most tools. Successful skill invocations intentionally use the concise model-facing content here; the authoritative skill body is carried by the corresponding skill invocation event. Falls back to content when absent.
4337 #[serde(skip_serializing_if = "Option::is_none")]
4338 pub detailed_content: Option<String>,
4339 /// 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.
4340 ///
4341 /// <div class="warning">
4342 ///
4343 /// **Experimental.** This type is part of an experimental wire-protocol surface
4344 /// and may change or be removed in future SDK or CLI releases.
4345 ///
4346 /// </div>
4347 #[serde(skip_serializing_if = "Option::is_none")]
4348 pub mcp_meta: Option<serde_json::Value>,
4349 /// Structured content (arbitrary JSON) returned verbatim by the MCP tool
4350 #[serde(skip_serializing_if = "Option::is_none")]
4351 pub structured_content: Option<serde_json::Value>,
4352 /// MCP Apps UI resource content for rendering in a sandboxed iframe
4353 #[serde(skip_serializing_if = "Option::is_none")]
4354 pub ui_resource: Option<ToolExecutionCompleteUIResource>,
4355}
4356
4357/// Experimental shell completion facts retained independently of the full tool result.
4358///
4359/// <div class="warning">
4360///
4361/// **Experimental.** This type is part of an experimental wire-protocol surface
4362/// and may change or be removed in future SDK or CLI releases.
4363///
4364/// </div>
4365#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4366#[serde(rename_all = "camelCase")]
4367pub struct ToolExecutionCompleteShellExecution {
4368 /// Process exit code reported by the shell driver.
4369 pub exit_code: i64,
4370}
4371
4372/// MCP Apps tool `_meta.ui` resource URI and visibility captured on `tool.execution_complete`.
4373#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4374#[serde(rename_all = "camelCase")]
4375pub struct ToolExecutionCompleteToolDescriptionMetaUI {
4376 /// URI of the UI resource
4377 #[serde(skip_serializing_if = "Option::is_none")]
4378 pub resource_uri: Option<String>,
4379 /// Who can access this tool
4380 #[serde(skip_serializing_if = "Option::is_none")]
4381 pub visibility: Option<Vec<ToolExecutionCompleteToolDescriptionMetaUIVisibility>>,
4382}
4383
4384/// MCP Apps metadata for UI resource association
4385#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4386#[serde(rename_all = "camelCase")]
4387pub struct ToolExecutionCompleteToolDescriptionMeta {
4388 /// MCP Apps tool `_meta.ui` resource URI and visibility captured on `tool.execution_complete`.
4389 #[serde(skip_serializing_if = "Option::is_none")]
4390 pub ui: Option<ToolExecutionCompleteToolDescriptionMetaUI>,
4391}
4392
4393/// Tool definition metadata, present for MCP tools with MCP Apps support
4394#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4395#[serde(rename_all = "camelCase")]
4396pub struct ToolExecutionCompleteToolDescription {
4397 /// MCP Apps metadata for UI resource association
4398 #[serde(rename = "_meta", skip_serializing_if = "Option::is_none")]
4399 pub meta: Option<ToolExecutionCompleteToolDescriptionMeta>,
4400 /// Tool description
4401 #[serde(skip_serializing_if = "Option::is_none")]
4402 pub description: Option<String>,
4403 /// Tool name
4404 pub name: String,
4405}
4406
4407/// Session event "tool.execution_complete". Tool execution completion results including success status, detailed output, and error information
4408#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4409#[serde(rename_all = "camelCase")]
4410pub struct ToolExecutionCompleteData {
4411 /// Error details when the tool execution failed
4412 #[serde(skip_serializing_if = "Option::is_none")]
4413 pub error: Option<ToolExecutionCompleteError>,
4414 /// Experimental HydraFusion attribution for this tool completion.
4415 ///
4416 /// <div class="warning">
4417 ///
4418 /// **Experimental.** This type is part of an experimental wire-protocol surface
4419 /// and may change or be removed in future SDK or CLI releases.
4420 ///
4421 /// </div>
4422 #[serde(skip_serializing_if = "Option::is_none")]
4423 pub fusion: Option<FusionAttribution>,
4424 /// CAPI interaction ID for correlating this tool execution with upstream telemetry
4425 #[serde(skip_serializing_if = "Option::is_none")]
4426 pub interaction_id: Option<String>,
4427 /// Whether this tool call was explicitly requested by the user rather than the assistant
4428 #[serde(skip_serializing_if = "Option::is_none")]
4429 pub is_user_requested: Option<bool>,
4430 /// 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.
4431 ///
4432 /// <div class="warning">
4433 ///
4434 /// **Experimental.** This type is part of an experimental wire-protocol surface
4435 /// and may change or be removed in future SDK or CLI releases.
4436 ///
4437 /// </div>
4438 #[serde(skip_serializing_if = "Option::is_none")]
4439 pub mcp_meta: Option<serde_json::Value>,
4440 /// Model identifier that generated this tool call
4441 #[serde(skip_serializing_if = "Option::is_none")]
4442 pub model: Option<String>,
4443 /// Tool call ID of the parent tool invocation when this event originates from a sub-agent
4444 #[doc(hidden)]
4445 #[deprecated]
4446 #[serde(skip_serializing_if = "Option::is_none")]
4447 pub parent_tool_call_id: Option<String>,
4448 /// Tool execution result on success
4449 #[serde(skip_serializing_if = "Option::is_none")]
4450 pub result: Option<ToolExecutionCompleteResult>,
4451 /// 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.
4452 #[serde(skip_serializing_if = "Option::is_none")]
4453 pub rte: Option<bool>,
4454 /// Whether this tool execution ran inside a sandbox container
4455 #[serde(skip_serializing_if = "Option::is_none")]
4456 pub sandboxed: Option<bool>,
4457 /// Experimental shell completion facts captured before the persisted result contents are stripped.
4458 ///
4459 /// <div class="warning">
4460 ///
4461 /// **Experimental.** This type is part of an experimental wire-protocol surface
4462 /// and may change or be removed in future SDK or CLI releases.
4463 ///
4464 /// </div>
4465 #[serde(skip_serializing_if = "Option::is_none")]
4466 pub shell_execution: Option<ToolExecutionCompleteShellExecution>,
4467 /// Whether the tool execution completed successfully
4468 pub success: bool,
4469 /// Unique identifier for the completed tool call
4470 pub tool_call_id: String,
4471 /// Tool definition metadata, present for MCP tools with MCP Apps support
4472 #[serde(skip_serializing_if = "Option::is_none")]
4473 pub tool_description: Option<ToolExecutionCompleteToolDescription>,
4474 /// Tool-specific telemetry data (e.g., CodeQL check counts, grep match counts)
4475 #[serde(skip_serializing_if = "Option::is_none")]
4476 pub tool_telemetry: Option<HashMap<String, serde_json::Value>>,
4477 /// Identifier for the agent loop turn this tool was invoked in, matching the corresponding assistant.turn_start event
4478 #[serde(skip_serializing_if = "Option::is_none")]
4479 pub turn_id: Option<String>,
4480}
4481
4482/// Session event "tool_search.activated". Persisted generic client-side tool activations restored when a session resumes.
4483#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4484#[serde(rename_all = "camelCase")]
4485pub struct ToolSearchActivatedData {
4486 /// Tool-search strategy that activated the definitions.
4487 pub strategy: String,
4488 /// Names of tool definitions activated by this search invocation.
4489 pub tool_names: Vec<String>,
4490}
4491
4492/// Session event "skill.invoked". Skill invocation details including content, allowed tools, and plugin metadata
4493#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4494#[serde(rename_all = "camelCase")]
4495pub struct SkillInvokedData {
4496 /// Tool names that should be auto-approved when this skill is active
4497 #[serde(skip_serializing_if = "Option::is_none")]
4498 pub allowed_tools: Option<Vec<String>>,
4499 /// Full content of the skill file, injected into the conversation for the model
4500 pub content: String,
4501 /// Description of the skill from its SKILL.md frontmatter
4502 #[serde(skip_serializing_if = "Option::is_none")]
4503 pub description: Option<String>,
4504 /// Whether model invocation is disabled for this skill
4505 #[serde(skip_serializing_if = "Option::is_none")]
4506 pub disable_model_invocation: Option<bool>,
4507 /// Projected chat-message count when the skill was invoked. New writers persist this so replay does not need to reconstruct superseded history; readers derive it for legacy events when absent.
4508 #[serde(skip_serializing_if = "Option::is_none")]
4509 pub invoked_at_turn: Option<i64>,
4510 /// Model identifier active when the skill was invoked, when known
4511 #[serde(skip_serializing_if = "Option::is_none")]
4512 pub model: Option<String>,
4513 /// Name of the invoked skill
4514 pub name: String,
4515 /// File path to the SKILL.md definition, or an empty string for an SDK-provided skill without a filesystem identity
4516 pub path: String,
4517 /// Name of the plugin this skill originated from, when applicable
4518 #[serde(skip_serializing_if = "Option::is_none")]
4519 pub plugin_name: Option<String>,
4520 /// Version of the plugin this skill originated from, when applicable
4521 #[serde(skip_serializing_if = "Option::is_none")]
4522 pub plugin_version: Option<String>,
4523 /// 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)
4524 #[serde(skip_serializing_if = "Option::is_none")]
4525 pub source: Option<String>,
4526 /// 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)
4527 #[serde(skip_serializing_if = "Option::is_none")]
4528 pub trigger: Option<SkillInvokedTrigger>,
4529}
4530
4531/// Session event "skill.invoked_ref". Internal durable skill invocation receipt whose content resolves from an earlier inline skill event in the same session.
4532#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4533#[serde(rename_all = "camelCase")]
4534pub struct SkillInvokedRefData {
4535 /// Tool names that should be auto-approved when this skill is active
4536 #[serde(skip_serializing_if = "Option::is_none")]
4537 pub allowed_tools: Option<Vec<String>>,
4538 /// Content identifier of an earlier inline skill event in this session, in the prefixed form `sha256:<lowercase hex digest>` over the UTF-8 bytes of that event's `content`
4539 pub content_id: String,
4540 /// UTF-16 code unit length of the referenced skill content. Derived from the referenced body and validated against it when the reference is expanded; a reference whose length disagrees with the body it names is rejected instead of expanded
4541 pub content_length: i64,
4542 /// Description of the skill from its SKILL.md frontmatter
4543 #[serde(skip_serializing_if = "Option::is_none")]
4544 pub description: Option<String>,
4545 /// Whether model invocation is disabled for this skill
4546 #[serde(skip_serializing_if = "Option::is_none")]
4547 pub disable_model_invocation: Option<bool>,
4548 /// Projected chat-message count when the skill was invoked. Preserved from the inline event data when the authored body is deduplicated.
4549 #[serde(skip_serializing_if = "Option::is_none")]
4550 pub invoked_at_turn: Option<i64>,
4551 /// Model identifier active when the skill was invoked, when known
4552 #[serde(skip_serializing_if = "Option::is_none")]
4553 pub model: Option<String>,
4554 /// Name of the invoked skill
4555 pub name: String,
4556 /// File path to the SKILL.md definition, or an empty string for an SDK-provided skill without a filesystem identity
4557 pub path: String,
4558 /// Name of the plugin this skill originated from, when applicable
4559 #[serde(skip_serializing_if = "Option::is_none")]
4560 pub plugin_name: Option<String>,
4561 /// Version of the plugin this skill originated from, when applicable
4562 #[serde(skip_serializing_if = "Option::is_none")]
4563 pub plugin_version: Option<String>,
4564 /// Source identifier for where the skill was discovered
4565 #[serde(skip_serializing_if = "Option::is_none")]
4566 pub source: Option<String>,
4567 /// What triggered the skill invocation
4568 #[serde(skip_serializing_if = "Option::is_none")]
4569 pub trigger: Option<SkillInvokedTrigger>,
4570}
4571
4572/// Session event "skill.context_delivered". Exact skill context delivered to the model during a tool phase. This is not a user submission or another skill invocation.
4573#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4574#[serde(rename_all = "camelCase")]
4575pub struct SkillContextDeliveredData {
4576 /// Exact model-facing skill wrapper, including its invocation-time file context
4577 pub content: String,
4578 /// Interaction that delivered this context, when known
4579 #[serde(skip_serializing_if = "Option::is_none")]
4580 pub interaction_id: Option<String>,
4581 /// Unmodified injection provenance, in the form skill-`<invocation-name>`
4582 pub source: String,
4583}
4584
4585/// Session event "skill.context_delivered_ref". Internal durable receipt that reconstructs exact model-visible skill context from earlier session content.
4586#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4587#[serde(rename_all = "camelCase")]
4588pub struct SkillContextDeliveredRefData {
4589 /// Content identifier of an earlier inline skill event in this session, in the prefixed form `sha256:<lowercase hex digest>` over the UTF-8 bytes of that event's `content`
4590 pub content_id: String,
4591 /// Interaction that delivered this context, when known
4592 #[serde(skip_serializing_if = "Option::is_none")]
4593 pub interaction_id: Option<String>,
4594 /// Exact text preceding the referenced content in the delivered wrapper
4595 #[serde(skip_serializing_if = "Option::is_none")]
4596 pub prefix: Option<String>,
4597 /// Unmodified injection provenance, in the form skill-`<invocation-name>`
4598 pub source: String,
4599 /// Exact text following the referenced content in the delivered wrapper
4600 #[serde(skip_serializing_if = "Option::is_none")]
4601 pub suffix: Option<String>,
4602}
4603
4604/// Effective sandbox filesystem rules, in policy order. Only populated when content capture is enabled, since these are real host paths.
4605#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4606#[serde(rename_all = "camelCase")]
4607pub struct SandboxFilesystemPolicyDetails {
4608 /// Paths the sandboxed process may not access at all
4609 pub denied_paths: Vec<String>,
4610 /// Paths the sandboxed process may read but not write
4611 pub readonly_paths: Vec<String>,
4612 /// Paths the sandboxed process may read and write
4613 pub readwrite_paths: Vec<String>,
4614}
4615
4616#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4617#[serde(rename_all = "camelCase")]
4618pub struct SandboxDecisionDataPolicyResolved {
4619 /// Whether the current working directory was granted automatically
4620 pub add_current_working_directory: bool,
4621 /// Whether callers may opt an individual command out of the sandbox
4622 pub allow_bypass: bool,
4623 /// Whether the sandboxed process may reach loopback and private-range addresses
4624 pub allow_local_network: bool,
4625 /// Whether the sandboxed process may open outbound network connections
4626 pub allow_outbound: bool,
4627 /// Process-containment implementation backing the sandbox
4628 pub backend: SandboxBackend,
4629 /// Enforcement mechanism this decision describes
4630 pub control: SandboxControl,
4631 /// Why enforcement is weaker than configured, when it is
4632 #[serde(skip_serializing_if = "Option::is_none")]
4633 pub degradation_reason: Option<SandboxDegradationReason>,
4634 /// Number of denied path rules in the effective policy
4635 pub denied_paths_count: i64,
4636 /// Effective filesystem rules. Populated only when content capture is enabled; the counts above are always present.
4637 #[serde(skip_serializing_if = "Option::is_none")]
4638 pub effective_filesystem_policy: Option<SandboxFilesystemPolicyDetails>,
4639 /// Runtime subsystem that applied the policy
4640 pub enforcement_point: SandboxEnforcementPoint,
4641 /// Whether the sandbox policy permits GitHub CLI credentials inside the sandbox. A policy capability, not proof that a credential was injected into this spawn: injection is per-command
4642 pub gh_auth: bool,
4643 /// Whether the sandbox policy permits git credentials inside the sandbox. A policy capability, not proof that a credential was injected into this spawn: injection is per-command
4644 pub git_auth: bool,
4645 /// Whether the macOS keychain was reachable from inside the sandbox. Always false on other platforms.
4646 pub keychain_access: bool,
4647 /// Sandbox decision variant discriminator.
4648 pub kind: SandboxDecisionDataPolicyResolvedKind,
4649 /// Whether the resolved policy is fully active or degraded
4650 pub outcome: SandboxOutcome,
4651 /// Host platform the sandbox is running on
4652 pub platform: SandboxPlatform,
4653 /// Whether the policy came from built-in defaults or user configuration
4654 pub policy_source: SandboxPolicySource,
4655 /// Whether outbound traffic is unproxied, routed through a loopback proxy, or routed through an external proxy
4656 pub proxy_mode: SandboxProxyMode,
4657 /// Number of read-only path rules in the effective policy
4658 pub readonly_paths_count: i64,
4659 /// Number of read-write path rules in the effective policy
4660 pub readwrite_paths_count: i64,
4661 /// Internal tool-call ID, used only to correlate the decision with its owning span. Omitted when the decision is not attributable to a tool call.
4662 #[serde(skip_serializing_if = "Option::is_none")]
4663 pub tool_call_id: Option<String>,
4664}
4665
4666#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4667#[serde(rename_all = "camelCase")]
4668pub struct SandboxDecisionDataSpawnCompleted {
4669 /// Process-containment implementation backing the sandbox
4670 pub backend: SandboxBackend,
4671 /// Enforcement mechanism this decision describes
4672 pub control: SandboxControl,
4673 /// Why enforcement is weaker than configured, when it is
4674 #[serde(skip_serializing_if = "Option::is_none")]
4675 pub degradation_reason: Option<SandboxDegradationReason>,
4676 /// Wall-clock time spent spawning the sandboxed process, in milliseconds
4677 pub duration_ms: f64,
4678 /// Runtime subsystem that applied the policy
4679 pub enforcement_point: SandboxEnforcementPoint,
4680 /// Sandbox decision variant discriminator.
4681 pub kind: SandboxDecisionDataSpawnCompletedKind,
4682 /// Whether the sandboxed process launched under the named backend. Not the exit status of the command that ran inside it.
4683 pub outcome: SandboxOutcome,
4684 /// Host platform the sandbox is running on
4685 pub platform: SandboxPlatform,
4686 /// Internal tool-call ID, used only to correlate the decision with its owning span. Omitted when the decision is not attributable to a tool call.
4687 #[serde(skip_serializing_if = "Option::is_none")]
4688 pub tool_call_id: Option<String>,
4689}
4690
4691#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4692#[serde(rename_all = "camelCase")]
4693pub struct SandboxDecisionDataEnforcementState {
4694 /// Runtime observation backing the state. Omitted for `inactive`, which has nothing to attest.
4695 #[serde(skip_serializing_if = "Option::is_none")]
4696 pub attestation: Option<SandboxAttestation>,
4697 /// Containment backend that engaged. `unsupported` for any state other than `engaged`, since no backend is known to have run.
4698 pub backend: SandboxBackend,
4699 /// Command the enforcement governed. Populated only when content capture is enabled, and only for shell commands; MCP, LSP, and search command lines are runtime plumbing.
4700 #[serde(skip_serializing_if = "Option::is_none")]
4701 pub command: Option<String>,
4702 /// Enforcement mechanism this decision describes
4703 pub control: SandboxControl,
4704 /// Runtime subsystem whose enforcement this describes
4705 pub enforcement_point: SandboxEnforcementPoint,
4706 /// Sandbox decision variant discriminator.
4707 pub kind: SandboxDecisionDataEnforcementStateKind,
4708 /// Observed enforcement state: `engaged`, `inactive`, or `failed`. Derived from runtime evidence, never from the configured posture or the compile-time target platform.
4709 pub outcome: SandboxOutcome,
4710 /// Host platform the sandbox is running on
4711 pub platform: SandboxPlatform,
4712 /// Internal tool-call ID, used only to correlate the decision with its owning span. Omitted when the decision is not attributable to a tool call.
4713 #[serde(skip_serializing_if = "Option::is_none")]
4714 pub tool_call_id: Option<String>,
4715}
4716
4717/// An enforcement check refused a specific access. Emitted per refusal with no deduplication, including when policy permits the caller to bypass the denial. Carries no backend: the built-in checks that produce this run in-process against the effective policy.
4718#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4719#[serde(rename_all = "camelCase")]
4720pub struct SandboxDecisionDataAccessDenied {
4721 /// Runtime observation backing the denial.
4722 pub attestation: SandboxAttestation,
4723 /// Command whose execution the denial arose from. Populated only when content capture is enabled.
4724 #[serde(skip_serializing_if = "Option::is_none")]
4725 pub command: Option<String>,
4726 /// How strong the evidence behind this denial is. Lets an analysis separate denials the sandbox recorded from ones inferred from output text, which otherwise look identical.
4727 #[serde(skip_serializing_if = "Option::is_none")]
4728 pub confidence: Option<SandboxDenialConfidence>,
4729 /// Sandbox control the denial belongs to. Follows from `denialClass`.
4730 pub control: SandboxControl,
4731 /// Bounded class of the refused access.
4732 pub denial_class: SandboxDenialClass,
4733 /// Resource the check refused, when identified and content capture is enabled.
4734 #[serde(skip_serializing_if = "Option::is_none")]
4735 pub denied_resource: Option<String>,
4736 /// Runtime subsystem that performed the check
4737 pub enforcement_point: SandboxEnforcementPoint,
4738 /// Sandbox decision variant discriminator.
4739 pub kind: SandboxDecisionDataAccessDeniedKind,
4740 /// Always `denied`.
4741 pub outcome: SandboxOutcome,
4742 /// Host operating-system family
4743 pub platform: SandboxPlatform,
4744 /// Executable image associated with the captured denial, normalized to a basename. Populated only when content capture is enabled.
4745 #[serde(skip_serializing_if = "Option::is_none")]
4746 pub process_name: Option<String>,
4747 /// Tool call the denial belongs to, for span correlation only. Never exported as a telemetry attribute or metric dimension.
4748 #[serde(skip_serializing_if = "Option::is_none")]
4749 pub tool_call_id: Option<String>,
4750}
4751
4752/// A request to run outside the process sandbox was resolved. This is what makes an `inactive` `enforcement_state` readable: without it, a command that ran unsandboxed because a person approved a bypass looks identical to one that ran unsandboxed because the session never had a sandbox. Reported only when a sandbox was in force, since bypassing a disabled sandbox bypasses nothing. Carries neither backend nor attestation: the verdict comes from the runtime's own permission flow or the local escalation prompt, not from a containment backend and not from the built-in policy check, so `source` is what records where it came from.
4753#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4754#[serde(rename_all = "camelCase")]
4755pub struct SandboxDecisionDataBypassDecided {
4756 /// Command the verdict governs. Populated only when content capture is enabled.
4757 #[serde(skip_serializing_if = "Option::is_none")]
4758 pub command: Option<String>,
4759 /// How strong the evidence behind `denialClass` was. Present exactly when `denialClass` is, so a verdict that relaxed the sandbox on a guess is distinguishable from one that relaxed it on a recorded refusal. Named to match `access_denied`, which reports the same pair.
4760 #[serde(skip_serializing_if = "Option::is_none")]
4761 pub confidence: Option<SandboxDenialConfidence>,
4762 /// Always `bypass`.
4763 pub control: SandboxControl,
4764 /// Bounded class of the access whose refusal raised this escalation. Omitted for a pre-execution bypass, such as a detached command that cannot be sandboxed and therefore resolves no denial.
4765 #[serde(skip_serializing_if = "Option::is_none")]
4766 pub denial_class: Option<SandboxDenialClass>,
4767 /// Resource whose refusal raised this escalation. Populated only when content capture is enabled.
4768 #[serde(skip_serializing_if = "Option::is_none")]
4769 pub denied_resource: Option<String>,
4770 /// Runtime subsystem the bypass applies to
4771 pub enforcement_point: SandboxEnforcementPoint,
4772 /// Sandbox decision variant discriminator.
4773 pub kind: SandboxDecisionDataBypassDecidedKind,
4774 /// Whether the bypass was granted: `approved` or `declined`. `declined` also covers the cases where nobody answered, since the sandboxed denial stands either way.
4775 pub outcome: SandboxOutcome,
4776 /// Host operating-system family
4777 pub platform: SandboxPlatform,
4778 /// Executable image associated with the denial that raised this escalation, normalized to a basename. Populated only when content capture is enabled.
4779 #[serde(skip_serializing_if = "Option::is_none")]
4780 pub process_name: Option<String>,
4781 /// Where the request originated. Orthogonal to `outcome`.
4782 pub source: SandboxBypassSource,
4783 /// Tool call the decision belongs to, for span correlation only. Never exported as a telemetry attribute or metric dimension.
4784 #[serde(skip_serializing_if = "Option::is_none")]
4785 pub tool_call_id: Option<String>,
4786}
4787
4788/// A permissive retry was resolved. Distinct from `bypass_decided` because this rung never requests a run outside the process sandbox: it relaxes the process container for one run while the sandbox, and with it the network policy, stays attached. Reported for both outcomes, so an escalation the user declined still leaves evidence that the runtime asked and that the sandboxed denial stood.
4789#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4790#[serde(rename_all = "camelCase")]
4791pub struct SandboxDecisionDataPermissiveRetryDecided {
4792 /// Command the verdict governs. Populated only when content capture is enabled.
4793 #[serde(skip_serializing_if = "Option::is_none")]
4794 pub command: Option<String>,
4795 /// How strong the evidence behind `denialClass` was. Present exactly when `denialClass` is.
4796 #[serde(skip_serializing_if = "Option::is_none")]
4797 pub confidence: Option<SandboxDenialConfidence>,
4798 /// Always `process`: the process container is what this rung relaxes, and the network control is deliberately untouched.
4799 pub control: SandboxControl,
4800 /// Bounded class of the access whose refusal raised this escalation.
4801 #[serde(skip_serializing_if = "Option::is_none")]
4802 pub denial_class: Option<SandboxDenialClass>,
4803 /// Resource whose refusal raised this escalation. Populated only when content capture is enabled.
4804 #[serde(skip_serializing_if = "Option::is_none")]
4805 pub denied_resource: Option<String>,
4806 /// Runtime subsystem the retry applies to
4807 pub enforcement_point: SandboxEnforcementPoint,
4808 /// Sandbox decision variant discriminator.
4809 pub kind: SandboxDecisionDataPermissiveRetryDecidedKind,
4810 /// Whether the permissive retry was granted: `approved` or `declined`. `declined` also covers the cases where nobody answered, since the sandboxed denial stands either way.
4811 pub outcome: SandboxOutcome,
4812 /// Host operating-system family
4813 pub platform: SandboxPlatform,
4814 /// Executable image associated with the denial that raised this escalation, normalized to a basename. Populated only when content capture is enabled.
4815 #[serde(skip_serializing_if = "Option::is_none")]
4816 pub process_name: Option<String>,
4817 /// Where the request originated. Orthogonal to `outcome`.
4818 pub source: SandboxBypassSource,
4819 /// Tool call the decision belongs to, for span correlation only. Never exported as a telemetry attribute or metric dimension.
4820 #[serde(skip_serializing_if = "Option::is_none")]
4821 pub tool_call_id: Option<String>,
4822}
4823
4824/// An approved permissive retry finished. `succeeded` means the retry exited successfully without another correlated sandbox denial; `failed` means it failed or remained blocked and may therefore be followed by a full bypass.
4825#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4826#[serde(rename_all = "camelCase")]
4827pub struct SandboxDecisionDataPermissiveRetryCompleted {
4828 /// Command the retry executed. Populated only when content capture is enabled.
4829 #[serde(skip_serializing_if = "Option::is_none")]
4830 pub command: Option<String>,
4831 /// How strong the evidence behind `denialClass` was.
4832 #[serde(skip_serializing_if = "Option::is_none")]
4833 pub confidence: Option<SandboxDenialConfidence>,
4834 /// Always `process`: the retry changes process-container enforcement while leaving network policy attached.
4835 pub control: SandboxControl,
4836 /// Bounded class of the access whose refusal raised the permissive retry.
4837 #[serde(skip_serializing_if = "Option::is_none")]
4838 pub denial_class: Option<SandboxDenialClass>,
4839 /// Resource whose refusal raised the retry. Populated only when content capture is enabled.
4840 #[serde(skip_serializing_if = "Option::is_none")]
4841 pub denied_resource: Option<String>,
4842 /// Runtime subsystem that ran the retry
4843 pub enforcement_point: SandboxEnforcementPoint,
4844 /// Sandbox decision variant discriminator.
4845 pub kind: SandboxDecisionDataPermissiveRetryCompletedKind,
4846 /// Whether the permissive retry completed successfully: `succeeded` or `failed`.
4847 pub outcome: SandboxOutcome,
4848 /// Host operating-system family
4849 pub platform: SandboxPlatform,
4850 /// Executable image associated with the denial that raised the retry, normalized to a basename. Populated only when content capture is enabled.
4851 #[serde(skip_serializing_if = "Option::is_none")]
4852 pub process_name: Option<String>,
4853 /// Tool call the completion belongs to, for span correlation only. Never exported as a telemetry attribute or metric dimension.
4854 #[serde(skip_serializing_if = "Option::is_none")]
4855 pub tool_call_id: Option<String>,
4856}
4857
4858/// Session event "subagent.started". Sub-agent startup details including parent tool call and agent information
4859#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4860#[serde(rename_all = "camelCase")]
4861pub struct SubagentStartedData {
4862 /// Description of what the sub-agent does
4863 pub agent_description: String,
4864 /// Human-readable display name of the sub-agent
4865 pub agent_display_name: String,
4866 /// Internal name of the sub-agent
4867 pub agent_name: String,
4868 /// Type of the sub-agent selected at spawn time.
4869 #[serde(skip_serializing_if = "Option::is_none")]
4870 pub agent_type: Option<String>,
4871 /// Whether the sub-agent runs synchronously or in the background.
4872 #[serde(skip_serializing_if = "Option::is_none")]
4873 pub execution_mode: Option<String>,
4874 /// Root id of the factory run that spawned this sub-agent, when it was spawned by one.
4875 #[serde(skip_serializing_if = "Option::is_none")]
4876 pub factory_run_id: Option<String>,
4877 /// Model the sub-agent will run with, when known at start.
4878 #[serde(skip_serializing_if = "Option::is_none")]
4879 pub model: Option<String>,
4880 /// Authority or runtime mechanism responsible for sub-agent model selection, when known at start.
4881 #[serde(skip_serializing_if = "Option::is_none")]
4882 pub model_selection_source: Option<SubagentModelSelectionSource>,
4883 /// Task-registry ID of the spawning sub-agent. Absent when the root session spawned this child.
4884 #[serde(skip_serializing_if = "Option::is_none")]
4885 pub parent_id: Option<String>,
4886 /// Whether this sub-agent can be resumed. Currently always false.
4887 #[serde(skip_serializing_if = "Option::is_none")]
4888 pub resumable: Option<bool>,
4889 /// 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.
4890 #[serde(skip_serializing_if = "Option::is_none")]
4891 pub task_model_source: Option<SubagentTaskModelSource>,
4892 /// Tool call ID of the parent tool invocation that spawned this sub-agent
4893 pub tool_call_id: String,
4894}
4895
4896/// Session event "subagent.configured". Resolved runtime configuration for a configured sub-agent
4897#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4898#[serde(rename_all = "camelCase")]
4899pub struct SubagentConfiguredData {
4900 /// Resolved context tier, when configured for the model
4901 #[serde(skip_serializing_if = "Option::is_none")]
4902 pub context_tier: Option<String>,
4903 /// Resolved model the sub-agent will run with
4904 pub model: String,
4905 /// Whether the sub-agent accepts follow-up turns
4906 pub multi_turn: bool,
4907 /// Resolved reasoning effort, when configured for the model
4908 #[serde(skip_serializing_if = "Option::is_none")]
4909 pub reasoning_effort: Option<String>,
4910}
4911
4912/// Session event "subagent.completed". Sub-agent completion details for successful execution
4913#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4914#[serde(rename_all = "camelCase")]
4915pub struct SubagentCompletedData {
4916 /// Human-readable display name of the sub-agent
4917 pub agent_display_name: String,
4918 /// Internal name of the sub-agent
4919 pub agent_name: String,
4920 /// 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.
4921 #[serde(skip_serializing_if = "Option::is_none")]
4922 pub cancelled: Option<bool>,
4923 /// Whether the first model actually dispatched matched the user's configured preference
4924 #[serde(skip_serializing_if = "Option::is_none")]
4925 pub configured_model_matches_actual: Option<bool>,
4926 /// Concrete model the user configured for this sub-agent via `/subagents`, when present
4927 #[serde(skip_serializing_if = "Option::is_none")]
4928 pub configured_model_preference: Option<String>,
4929 /// Wall-clock duration of the sub-agent execution in milliseconds
4930 #[serde(skip_serializing_if = "Option::is_none")]
4931 pub duration_ms: Option<i64>,
4932 /// Whether the explicit task-call model matched the user's configured preference
4933 #[serde(skip_serializing_if = "Option::is_none")]
4934 pub explicit_model_matches_preference: Option<bool>,
4935 /// Explicit model supplied by the parent agent on the task call, when present
4936 #[serde(skip_serializing_if = "Option::is_none")]
4937 pub explicit_model_override: Option<String>,
4938 /// First model for which the sub-agent started an inference request, when one was dispatched
4939 #[serde(skip_serializing_if = "Option::is_none")]
4940 pub first_dispatched_model: Option<String>,
4941 /// Model used by the sub-agent
4942 #[serde(skip_serializing_if = "Option::is_none")]
4943 pub model: Option<String>,
4944 /// Why an explicit task-call model did not become the effective model
4945 #[serde(skip_serializing_if = "Option::is_none")]
4946 pub model_override_reason: Option<String>,
4947 /// Authority or runtime mechanism responsible for sub-agent model selection
4948 #[serde(skip_serializing_if = "Option::is_none")]
4949 pub model_selection_source: Option<SubagentModelSelectionSource>,
4950 /// Tool call ID of the parent tool invocation that spawned this sub-agent
4951 pub tool_call_id: String,
4952 /// Total tokens (input + output) consumed by the sub-agent
4953 #[serde(skip_serializing_if = "Option::is_none")]
4954 pub total_tokens: Option<i64>,
4955 /// Total number of tool calls made by the sub-agent
4956 #[serde(skip_serializing_if = "Option::is_none")]
4957 pub total_tool_calls: Option<i64>,
4958}
4959
4960/// Session event "subagent.failed". Sub-agent failure details including error message and agent information
4961#[derive(Debug, Clone, Default, Serialize, Deserialize)]
4962#[serde(rename_all = "camelCase")]
4963pub struct SubagentFailedData {
4964 /// Human-readable display name of the sub-agent
4965 pub agent_display_name: String,
4966 /// Internal name of the sub-agent
4967 pub agent_name: String,
4968 /// Whether the first model actually dispatched matched the user's configured preference
4969 #[serde(skip_serializing_if = "Option::is_none")]
4970 pub configured_model_matches_actual: Option<bool>,
4971 /// Concrete model the user configured for this sub-agent via `/subagents`, when present
4972 #[serde(skip_serializing_if = "Option::is_none")]
4973 pub configured_model_preference: Option<String>,
4974 /// Wall-clock duration of the sub-agent execution in milliseconds
4975 #[serde(skip_serializing_if = "Option::is_none")]
4976 pub duration_ms: Option<i64>,
4977 /// Error message describing why the sub-agent failed
4978 pub error: String,
4979 /// Whether the explicit task-call model matched the user's configured preference
4980 #[serde(skip_serializing_if = "Option::is_none")]
4981 pub explicit_model_matches_preference: Option<bool>,
4982 /// Explicit model supplied by the parent agent on the task call, when present
4983 #[serde(skip_serializing_if = "Option::is_none")]
4984 pub explicit_model_override: Option<String>,
4985 /// First model for which the sub-agent started an inference request, when one was dispatched
4986 #[serde(skip_serializing_if = "Option::is_none")]
4987 pub first_dispatched_model: Option<String>,
4988 /// Model selected for the sub-agent, when known
4989 #[serde(skip_serializing_if = "Option::is_none")]
4990 pub model: Option<String>,
4991 /// Why an explicit task-call model did not become the effective model
4992 #[serde(skip_serializing_if = "Option::is_none")]
4993 pub model_override_reason: Option<String>,
4994 /// Authority or runtime mechanism responsible for sub-agent model selection
4995 #[serde(skip_serializing_if = "Option::is_none")]
4996 pub model_selection_source: Option<SubagentModelSelectionSource>,
4997 /// Tool call ID of the parent tool invocation that spawned this sub-agent
4998 pub tool_call_id: String,
4999 /// Total tokens (input + output) consumed before the sub-agent failed
5000 #[serde(skip_serializing_if = "Option::is_none")]
5001 pub total_tokens: Option<i64>,
5002 /// Total number of tool calls made before the sub-agent failed
5003 #[serde(skip_serializing_if = "Option::is_none")]
5004 pub total_tool_calls: Option<i64>,
5005}
5006
5007/// Session event "subagent.selected". Custom agent selection details including name and available tools
5008#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5009#[serde(rename_all = "camelCase")]
5010pub struct SubagentSelectedData {
5011 /// Human-readable display name of the selected custom agent
5012 pub agent_display_name: String,
5013 /// Internal name of the selected custom agent
5014 pub agent_name: String,
5015 /// List of tool names available to this agent, or null for all tools
5016 pub tools: Option<Vec<String>>,
5017}
5018
5019/// Session event "subagent.deselected". Empty payload; the event signals that the custom agent was deselected, returning to the default agent
5020#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5021#[serde(rename_all = "camelCase")]
5022pub struct SubagentDeselectedData {}
5023
5024/// Session event "hook.start". Hook invocation start details including type and input data
5025#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5026#[serde(rename_all = "camelCase")]
5027pub struct HookStartData {
5028 /// Unique identifier for this hook invocation
5029 pub hook_invocation_id: String,
5030 /// Type of hook being invoked (e.g., "preToolUse", "postToolUse", "sessionStart")
5031 pub hook_type: String,
5032 /// Input data passed to the hook. For postToolUse hooks the retained copy served by session.eventLog.read (and by a resumed session) drops the tool result's inline `contents`/`uiResource`/`skillInvocation` and replaces duplicated text result fields with a `[copilot:elided ...]` marker; the live subscription stream still delivers the full value. Canonical tool output remains in the adjacent tool.execution_complete event, while an invoked skill's authoritative body remains in its skill invocation event.
5033 #[serde(skip_serializing_if = "Option::is_none")]
5034 pub input: Option<serde_json::Value>,
5035 /// Tool call ID of the parent tool invocation when this event originates from a sub-agent
5036 #[serde(skip_serializing_if = "Option::is_none")]
5037 pub parent_tool_call_id: Option<String>,
5038}
5039
5040/// Error details when the hook failed
5041#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5042#[serde(rename_all = "camelCase")]
5043pub struct HookEndError {
5044 /// Human-readable error message
5045 pub message: String,
5046 /// Source label of the hook that errored (e.g. the plugin it was loaded from), when known
5047 #[serde(skip_serializing_if = "Option::is_none")]
5048 pub source: Option<String>,
5049 /// Error stack trace, when available
5050 #[serde(skip_serializing_if = "Option::is_none")]
5051 pub stack: Option<String>,
5052}
5053
5054/// Session event "hook.end". Hook invocation completion details including output, success status, and error information
5055#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5056#[serde(rename_all = "camelCase")]
5057pub struct HookEndData {
5058 /// Error details when the hook failed
5059 #[serde(skip_serializing_if = "Option::is_none")]
5060 pub error: Option<HookEndError>,
5061 /// Identifier matching the corresponding hook.start event
5062 pub hook_invocation_id: String,
5063 /// Type of hook that was invoked (e.g., "preToolUse", "postToolUse", "sessionStart")
5064 pub hook_type: String,
5065 /// Output data produced by the hook. Durable and resumed postToolUse receipts may omit messages owned by a successful skill invocation and replace an unchanged skill sessionLog copy with an elision marker; hook-modified or re-sourced values are preserved, and the authoritative body remains in the skill invocation event.
5066 #[serde(skip_serializing_if = "Option::is_none")]
5067 pub output: Option<serde_json::Value>,
5068 /// Tool call ID of the parent tool invocation when this event originates from a sub-agent
5069 #[serde(skip_serializing_if = "Option::is_none")]
5070 pub parent_tool_call_id: Option<String>,
5071 /// Whether the hook completed successfully
5072 pub success: bool,
5073}
5074
5075/// Session event "hook.progress". Ephemeral progress update from a running hook process
5076#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5077#[serde(rename_all = "camelCase")]
5078pub struct HookProgressData {
5079 /// Human-readable progress message from the hook process
5080 pub message: String,
5081 /// When true, this status message replaces the previous temporary one instead of accumulating
5082 #[serde(skip_serializing_if = "Option::is_none")]
5083 pub temporary: Option<bool>,
5084}
5085
5086/// Session event "session.binary_asset". Canonical bytes for a content-addressed binary asset shared by reference across events
5087#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5088#[serde(rename_all = "camelCase")]
5089pub struct SessionBinaryAssetData {
5090 /// Content-addressed id for this binary asset (e.g. "sha256:...").
5091 pub asset_id: String,
5092 /// Decoded byte length of the binary asset
5093 pub byte_length: i64,
5094 /// Base64-encoded binary data
5095 pub data: String,
5096 /// Human-readable description of the binary data
5097 #[serde(skip_serializing_if = "Option::is_none")]
5098 pub description: Option<String>,
5099 /// Optional metadata from the producing tool.
5100 #[serde(skip_serializing_if = "Option::is_none")]
5101 pub metadata: Option<HashMap<String, serde_json::Value>>,
5102 /// MIME type of the binary asset
5103 pub mime_type: String,
5104 /// Binary asset type discriminator. Use "image" for images and "resource" otherwise.
5105 pub r#type: BinaryAssetType,
5106}
5107
5108/// Metadata about the prompt template and its construction
5109#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5110#[serde(rename_all = "camelCase")]
5111pub struct SystemMessageMetadata {
5112 /// Version identifier of the prompt template used
5113 #[serde(skip_serializing_if = "Option::is_none")]
5114 pub prompt_version: Option<String>,
5115 /// Template variables used when constructing the prompt
5116 #[serde(skip_serializing_if = "Option::is_none")]
5117 pub variables: Option<HashMap<String, serde_json::Value>>,
5118}
5119
5120/// Session event "system.message". System/developer instruction content with role and optional template metadata
5121#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5122#[serde(rename_all = "camelCase")]
5123pub struct SystemMessageData {
5124 /// The system or developer prompt text sent as model input
5125 pub content: String,
5126 /// Logical interaction identifier for the model run receiving this prompt
5127 #[serde(skip_serializing_if = "Option::is_none")]
5128 pub interaction_id: Option<String>,
5129 /// Metadata about the prompt template and its construction
5130 #[serde(skip_serializing_if = "Option::is_none")]
5131 pub metadata: Option<SystemMessageMetadata>,
5132 /// Optional name identifier for the message source
5133 #[serde(skip_serializing_if = "Option::is_none")]
5134 pub name: Option<String>,
5135 /// Message role: "system" for system prompts, "developer" for developer-injected instructions
5136 pub role: SystemMessageRole,
5137}
5138
5139/// Session event "system.notification". System-generated notification for runtime events like background task completion
5140#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5141#[serde(rename_all = "camelCase")]
5142pub struct SystemNotificationData {
5143 /// The notification text, typically wrapped in `<system_notification>` XML tags
5144 pub content: String,
5145 /// Structured metadata identifying what triggered this notification
5146 pub kind: serde_json::Value,
5147 /// Responses reasoning settings anchored before this model-facing message, for cache-stable history replay
5148 #[serde(skip_serializing_if = "Option::is_none")]
5149 pub responses_reasoning: Option<ResponsesReasoning>,
5150}
5151
5152/// A parsed command identifier in a shell permission request, including whether it is read-only.
5153#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5154#[serde(rename_all = "camelCase")]
5155pub struct PermissionRequestShellCommand {
5156 /// Command identifier (e.g., executable name)
5157 pub identifier: String,
5158 /// Whether this command is read-only (no side effects)
5159 pub read_only: bool,
5160}
5161
5162/// A parsed shell command segment used for argument-aware managed policy matching.
5163#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5164#[serde(rename_all = "camelCase")]
5165pub struct PermissionRequestShellCommandSegment {
5166 /// Full text of this command segment, including arguments
5167 pub full_command_text: String,
5168 /// Command identifier (e.g., executable name)
5169 pub identifier: String,
5170}
5171
5172/// A URL that may be accessed by a command in a shell permission request.
5173#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5174#[serde(rename_all = "camelCase")]
5175pub struct PermissionRequestShellPossibleUrl {
5176 /// URL that may be accessed by the command
5177 pub url: String,
5178}
5179
5180/// Shell command permission request
5181#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5182#[serde(rename_all = "camelCase")]
5183pub struct PermissionRequestShell {
5184 /// Whether the UI can offer session-wide approval for this command pattern
5185 pub can_offer_session_approval: bool,
5186 /// Parsed command identifiers found in the command text
5187 pub commands: Vec<PermissionRequestShellCommand>,
5188 /// Parsed command segments, including arguments, used for managed policy matching
5189 #[serde(skip_serializing_if = "Option::is_none")]
5190 pub command_segments: Option<Vec<PermissionRequestShellCommandSegment>>,
5191 /// The complete shell command text to be executed
5192 pub full_command_text: String,
5193 /// Whether the command includes a file write redirection (e.g., > or >>)
5194 pub has_write_file_redirection: bool,
5195 /// Human-readable description of what the command intends to do
5196 pub intention: String,
5197 /// Permission kind discriminator
5198 pub kind: PermissionRequestShellKind,
5199 /// Whether managed policy requires a human response and forbids host auto-approval
5200 #[serde(skip_serializing_if = "Option::is_none")]
5201 pub managed_approval_required: Option<bool>,
5202 /// File paths that may be read or written by the command
5203 pub possible_paths: Vec<String>,
5204 /// URLs that may be accessed by the command
5205 pub possible_urls: Vec<PermissionRequestShellPossibleUrl>,
5206 /// 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.
5207 #[serde(skip_serializing_if = "Option::is_none")]
5208 pub request_sandbox_bypass: Option<bool>,
5209 /// 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.
5210 #[serde(skip_serializing_if = "Option::is_none")]
5211 pub request_sandbox_bypass_reason: Option<String>,
5212 /// 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.
5213 #[serde(skip_serializing_if = "Option::is_none")]
5214 pub request_sandbox_permissive: Option<bool>,
5215 /// 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.
5216 ///
5217 /// <div class="warning">
5218 ///
5219 /// **Experimental.** This type is part of an experimental wire-protocol surface
5220 /// and may change or be removed in future SDK or CLI releases.
5221 ///
5222 /// </div>
5223 #[serde(skip_serializing_if = "Option::is_none")]
5224 pub resolved_paths: Option<HashMap<String, String>>,
5225 /// Runtime-resolved canonical working directory the command runs in, used for authorization identity checks. Internal and experimental; clients should not display it.
5226 ///
5227 /// <div class="warning">
5228 ///
5229 /// **Experimental.** This type is part of an experimental wire-protocol surface
5230 /// and may change or be removed in future SDK or CLI releases.
5231 ///
5232 /// </div>
5233 #[serde(skip_serializing_if = "Option::is_none")]
5234 pub resolved_working_directory: Option<String>,
5235 /// Tool call ID that triggered this permission request
5236 #[serde(skip_serializing_if = "Option::is_none")]
5237 pub tool_call_id: Option<String>,
5238 /// Optional warning message about risks of running this command
5239 #[serde(skip_serializing_if = "Option::is_none")]
5240 pub warning: Option<String>,
5241}
5242
5243/// File write permission request
5244#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5245#[serde(rename_all = "camelCase")]
5246pub struct PermissionRequestWrite {
5247 /// Whether the UI can offer session-wide approval for file write operations
5248 pub can_offer_session_approval: bool,
5249 /// Unified diff showing the proposed changes
5250 pub diff: String,
5251 /// Path of the file being written to
5252 pub file_name: String,
5253 /// Human-readable description of the intended file change
5254 pub intention: String,
5255 /// Permission kind discriminator
5256 pub kind: PermissionRequestWriteKind,
5257 /// Whether managed policy requires a human response and forbids host auto-approval
5258 #[serde(skip_serializing_if = "Option::is_none")]
5259 pub managed_approval_required: Option<bool>,
5260 /// Complete new file contents for newly created files
5261 #[serde(skip_serializing_if = "Option::is_none")]
5262 pub new_file_contents: Option<String>,
5263 /// 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.
5264 #[serde(skip_serializing_if = "Option::is_none")]
5265 pub request_sandbox_bypass: Option<bool>,
5266 /// Justification for the sandbox-bypass request. Only meaningful when requestSandboxBypass is true.
5267 #[serde(skip_serializing_if = "Option::is_none")]
5268 pub request_sandbox_bypass_reason: Option<String>,
5269 /// Runtime-resolved canonical path used for authorization identity checks. Internal and experimental; clients should continue to display fileName.
5270 ///
5271 /// <div class="warning">
5272 ///
5273 /// **Experimental.** This type is part of an experimental wire-protocol surface
5274 /// and may change or be removed in future SDK or CLI releases.
5275 ///
5276 /// </div>
5277 #[serde(skip_serializing_if = "Option::is_none")]
5278 pub resolved_path: Option<String>,
5279 /// Tool call ID that triggered this permission request
5280 #[serde(skip_serializing_if = "Option::is_none")]
5281 pub tool_call_id: Option<String>,
5282}
5283
5284/// File or directory read permission request
5285#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5286#[serde(rename_all = "camelCase")]
5287pub struct PermissionRequestRead {
5288 /// Human-readable description of why the file is being read
5289 pub intention: String,
5290 /// Permission kind discriminator
5291 pub kind: PermissionRequestReadKind,
5292 /// Whether managed policy requires a human response and forbids host auto-approval
5293 #[serde(skip_serializing_if = "Option::is_none")]
5294 pub managed_approval_required: Option<bool>,
5295 /// Path of the file or directory being read
5296 pub path: String,
5297 /// 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.
5298 #[serde(skip_serializing_if = "Option::is_none")]
5299 pub request_sandbox_bypass: Option<bool>,
5300 /// 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.
5301 #[serde(skip_serializing_if = "Option::is_none")]
5302 pub request_sandbox_bypass_reason: Option<String>,
5303 /// Runtime-resolved canonical path used for authorization identity checks. Internal and experimental; clients should continue to display path.
5304 ///
5305 /// <div class="warning">
5306 ///
5307 /// **Experimental.** This type is part of an experimental wire-protocol surface
5308 /// and may change or be removed in future SDK or CLI releases.
5309 ///
5310 /// </div>
5311 #[serde(skip_serializing_if = "Option::is_none")]
5312 pub resolved_path: Option<String>,
5313 /// Tool call ID that triggered this permission request
5314 #[serde(skip_serializing_if = "Option::is_none")]
5315 pub tool_call_id: Option<String>,
5316}
5317
5318/// MCP tool invocation permission request
5319#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5320#[serde(rename_all = "camelCase")]
5321pub struct PermissionRequestMcp {
5322 /// Arguments to pass to the MCP tool
5323 #[serde(skip_serializing_if = "Option::is_none")]
5324 pub args: Option<serde_json::Value>,
5325 /// Permission kind discriminator
5326 pub kind: PermissionRequestMcpKind,
5327 /// When true, managed policy requires an explicit user decision and automatic approval must be bypassed.
5328 #[serde(skip_serializing_if = "Option::is_none")]
5329 pub managed_approval_required: Option<bool>,
5330 /// Advisory runtime permission recommendation. The SDK host remains responsible for deciding the request and may reject it.
5331 ///
5332 /// <div class="warning">
5333 ///
5334 /// **Experimental.** This type is part of an experimental wire-protocol surface
5335 /// and may change or be removed in future SDK or CLI releases.
5336 ///
5337 /// </div>
5338 #[serde(skip_serializing_if = "Option::is_none")]
5339 pub permission_recommendation: Option<PermissionRecommendation>,
5340 /// Whether this MCP tool is read-only (no side effects)
5341 pub read_only: bool,
5342 /// Name of the MCP server providing the tool
5343 pub server_name: String,
5344 /// Tool call ID that triggered this permission request
5345 #[serde(skip_serializing_if = "Option::is_none")]
5346 pub tool_call_id: Option<String>,
5347 /// Internal name of the MCP tool
5348 pub tool_name: String,
5349 /// Human-readable title of the MCP tool
5350 pub tool_title: String,
5351}
5352
5353/// URL access permission request
5354#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5355#[serde(rename_all = "camelCase")]
5356pub struct PermissionRequestUrl {
5357 /// Human-readable description of why the URL is being accessed
5358 pub intention: String,
5359 /// Permission kind discriminator
5360 pub kind: PermissionRequestUrlKind,
5361 /// Whether managed policy requires a human response and forbids host auto-approval
5362 #[serde(skip_serializing_if = "Option::is_none")]
5363 pub managed_approval_required: Option<bool>,
5364 /// Immediately preceding URL when this request is for a redirect target
5365 #[serde(skip_serializing_if = "Option::is_none")]
5366 pub redirected_from: Option<String>,
5367 /// 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.
5368 #[serde(skip_serializing_if = "Option::is_none")]
5369 pub request_sandbox_bypass: Option<bool>,
5370 /// 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.
5371 #[serde(skip_serializing_if = "Option::is_none")]
5372 pub request_sandbox_bypass_reason: Option<String>,
5373 /// Tool call ID that triggered this permission request
5374 #[serde(skip_serializing_if = "Option::is_none")]
5375 pub tool_call_id: Option<String>,
5376 /// URL to be fetched
5377 pub url: String,
5378}
5379
5380/// Bounded runtime attribution, independent of free-text rationale. Telemetry revalidates this vocabulary before standard collection.
5381#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5382#[serde(rename_all = "camelCase")]
5383pub struct PermissionApprovalEvaluation {
5384 /// Stage that produced this attribution.
5385 pub evaluation_stage: PermissionApprovalEvaluationEvaluationStage,
5386 /// Whether the request invoked the judge interface. A cached recommendation retains the original attempt fact. Omitted means unknown, including inherited outcomes.
5387 #[serde(skip_serializing_if = "Option::is_none")]
5388 pub judge_attempted: Option<bool>,
5389 /// Status of the local judge interface, not proof of a model network call.
5390 pub judge_status: PermissionApprovalEvaluationJudgeStatus,
5391 /// Machine-readable runtime gate reason, never a command, path or human rationale.
5392 pub reason_code: PermissionApprovalEvaluationReasonCode,
5393}
5394
5395/// 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.
5396///
5397/// <div class="warning">
5398///
5399/// **Experimental.** This type is part of an experimental wire-protocol surface
5400/// and may change or be removed in future SDK or CLI releases.
5401///
5402/// </div>
5403#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5404#[serde(rename_all = "camelCase")]
5405pub struct PermissionAssistedApproval {
5406 /// Runtime reason and judge-call metadata. Absent on older events; missing metadata means unknown, not that the judge was skipped.
5407 #[serde(skip_serializing_if = "Option::is_none")]
5408 pub evaluation: Option<PermissionApprovalEvaluation>,
5409 /// Classified cause of an `error` recommendation. Absent for every other recommendation.
5410 #[serde(skip_serializing_if = "Option::is_none")]
5411 pub failure_reason: Option<AssistedApprovalJudgeFailureReason>,
5412 /// 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.
5413 #[serde(skip_serializing_if = "Option::is_none")]
5414 pub model: Option<String>,
5415 /// Human-readable reason for the judge's recommendation, when available.
5416 #[serde(skip_serializing_if = "Option::is_none")]
5417 pub reason: Option<String>,
5418 /// The assisted-approval safety judge's outcome for this request.
5419 pub recommendation: AssistedApprovalRecommendation,
5420}
5421
5422/// Memory operation permission request
5423#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5424#[serde(rename_all = "camelCase")]
5425pub struct PermissionRequestMemory {
5426 /// Whether this is a store or vote memory operation
5427 #[serde(skip_serializing_if = "Option::is_none")]
5428 pub action: Option<PermissionRequestMemoryAction>,
5429 /// Assisted-approval judge information for this request; present only in assisted mode.
5430 ///
5431 /// <div class="warning">
5432 ///
5433 /// **Experimental.** This type is part of an experimental wire-protocol surface
5434 /// and may change or be removed in future SDK or CLI releases.
5435 ///
5436 /// </div>
5437 #[serde(skip_serializing_if = "Option::is_none")]
5438 pub assisted_approval: Option<PermissionAssistedApproval>,
5439 /// Source references for the stored fact (store only)
5440 #[serde(skip_serializing_if = "Option::is_none")]
5441 pub citations: Option<String>,
5442 /// Vote direction (vote only)
5443 #[serde(skip_serializing_if = "Option::is_none")]
5444 pub direction: Option<PermissionRequestMemoryDirection>,
5445 /// The fact being stored or voted on
5446 pub fact: String,
5447 /// Permission kind discriminator
5448 pub kind: PermissionRequestMemoryKind,
5449 /// When true, managed policy requires an explicit user decision and automatic approval must be bypassed.
5450 #[serde(skip_serializing_if = "Option::is_none")]
5451 pub managed_approval_required: Option<bool>,
5452 /// Reason for the vote (vote only)
5453 #[serde(skip_serializing_if = "Option::is_none")]
5454 pub reason: Option<String>,
5455 /// Repository name with owner associated with the stored memory (store only)
5456 #[serde(skip_serializing_if = "Option::is_none")]
5457 pub repo_nwo: Option<String>,
5458 /// Scope of the stored memory (store only)
5459 #[serde(skip_serializing_if = "Option::is_none")]
5460 pub scope: Option<PermissionRequestMemoryScope>,
5461 /// Topic or subject of the memory (store only)
5462 #[serde(skip_serializing_if = "Option::is_none")]
5463 pub subject: Option<String>,
5464 /// Tool call ID that triggered this permission request
5465 #[serde(skip_serializing_if = "Option::is_none")]
5466 pub tool_call_id: Option<String>,
5467}
5468
5469/// Custom tool invocation permission request
5470#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5471#[serde(rename_all = "camelCase")]
5472pub struct PermissionRequestCustomTool {
5473 /// Arguments to pass to the custom tool
5474 #[serde(skip_serializing_if = "Option::is_none")]
5475 pub args: Option<serde_json::Value>,
5476 /// Permission kind discriminator
5477 pub kind: PermissionRequestCustomToolKind,
5478 /// When true, managed policy requires an explicit user decision and automatic approval must be bypassed.
5479 #[serde(skip_serializing_if = "Option::is_none")]
5480 pub managed_approval_required: Option<bool>,
5481 /// Whether the tool declared that permission may be skipped unless a deny rule matches
5482 #[serde(skip_serializing_if = "Option::is_none")]
5483 pub skip_permission: Option<bool>,
5484 /// Tool call ID that triggered this permission request
5485 #[serde(skip_serializing_if = "Option::is_none")]
5486 pub tool_call_id: Option<String>,
5487 /// Description of what the custom tool does
5488 pub tool_description: String,
5489 /// Name of the custom tool
5490 pub tool_name: String,
5491}
5492
5493/// Hook confirmation permission request
5494#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5495#[serde(rename_all = "camelCase")]
5496pub struct PermissionRequestHook {
5497 /// Optional message from the hook explaining why confirmation is needed
5498 #[serde(skip_serializing_if = "Option::is_none")]
5499 pub hook_message: Option<String>,
5500 /// Permission kind discriminator
5501 pub kind: PermissionRequestHookKind,
5502 /// When true, managed policy requires an explicit user decision and automatic approval must be bypassed.
5503 #[serde(skip_serializing_if = "Option::is_none")]
5504 pub managed_approval_required: Option<bool>,
5505 /// Arguments of the tool call being gated
5506 #[serde(skip_serializing_if = "Option::is_none")]
5507 pub tool_args: Option<serde_json::Value>,
5508 /// Tool call ID that triggered this permission request
5509 #[serde(skip_serializing_if = "Option::is_none")]
5510 pub tool_call_id: Option<String>,
5511 /// Name of the tool the hook is gating
5512 pub tool_name: String,
5513}
5514
5515/// Extension management permission request
5516#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5517#[serde(rename_all = "camelCase")]
5518pub struct PermissionRequestExtensionManagement {
5519 /// Name of the extension being managed
5520 #[serde(skip_serializing_if = "Option::is_none")]
5521 pub extension_name: Option<String>,
5522 /// Permission kind discriminator
5523 pub kind: PermissionRequestExtensionManagementKind,
5524 /// When true, managed policy requires an explicit user decision and automatic approval must be bypassed.
5525 #[serde(skip_serializing_if = "Option::is_none")]
5526 pub managed_approval_required: Option<bool>,
5527 /// The extension management operation (scaffold, reload)
5528 pub operation: String,
5529 /// Tool call ID that triggered this permission request
5530 #[serde(skip_serializing_if = "Option::is_none")]
5531 pub tool_call_id: Option<String>,
5532}
5533
5534/// A declared phase shown in a factory permission prompt.
5535#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5536#[serde(rename_all = "camelCase")]
5537pub struct FactoryPermissionPhase {
5538 /// Optional phase detail
5539 #[serde(skip_serializing_if = "Option::is_none")]
5540 pub detail: Option<String>,
5541 /// Phase title
5542 pub title: String,
5543}
5544
5545/// Factory run or authoring permission request
5546#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5547#[serde(rename_all = "camelCase")]
5548pub struct PermissionRequestFactory {
5549 /// Canonical key used for scoped factory approvals
5550 pub approval_key: String,
5551 /// Whether this factory is eligible for persistent approval
5552 pub can_persist_approval: bool,
5553 /// Factory-declared AI-credit limit before any run/resume caller override is applied.
5554 #[serde(skip_serializing_if = "Option::is_none")]
5555 pub declared_max_ai_credits: Option<f64>,
5556 /// Factory-declared concurrent-subagent limit before any run/resume caller override is applied.
5557 #[serde(skip_serializing_if = "Option::is_none")]
5558 pub declared_max_concurrent_subagents: Option<i64>,
5559 /// Factory-declared total-subagent limit before any run/resume caller override is applied.
5560 #[serde(skip_serializing_if = "Option::is_none")]
5561 pub declared_max_total_subagents: Option<i64>,
5562 /// Factory-declared active-time limit in seconds before any run/resume caller override is applied.
5563 #[serde(skip_serializing_if = "Option::is_none")]
5564 pub declared_timeout_seconds: Option<f64>,
5565 /// Factory description
5566 pub description: String,
5567 /// Permission kind discriminator
5568 pub kind: PermissionRequestFactoryKind,
5569 /// When true, managed policy requires an explicit user decision and automatic approval must be bypassed.
5570 #[serde(skip_serializing_if = "Option::is_none")]
5571 pub managed_approval_required: Option<bool>,
5572 /// Effective AI-credit limit; omitted means unlimited
5573 #[serde(skip_serializing_if = "Option::is_none")]
5574 pub max_ai_credits: Option<f64>,
5575 /// Effective concurrent-subagent limit; omitted means unlimited
5576 #[serde(skip_serializing_if = "Option::is_none")]
5577 pub max_concurrent_subagents: Option<i64>,
5578 /// Effective total-subagent limit; omitted means unlimited
5579 #[serde(skip_serializing_if = "Option::is_none")]
5580 pub max_total_subagents: Option<i64>,
5581 /// Factory name
5582 pub name: String,
5583 /// Factory operation, either run or author
5584 pub operation: FactoryPermissionOperation,
5585 /// Declared factory phases
5586 pub phases: Vec<FactoryPermissionPhase>,
5587 /// Effective active-time limit in seconds; omitted means unlimited
5588 #[serde(skip_serializing_if = "Option::is_none")]
5589 pub timeout_seconds: Option<f64>,
5590 /// Tool call ID that triggered this permission request
5591 #[serde(skip_serializing_if = "Option::is_none")]
5592 pub tool_call_id: Option<String>,
5593}
5594
5595/// Extension permission access request
5596#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5597#[serde(rename_all = "camelCase")]
5598pub struct PermissionRequestExtensionPermissionAccess {
5599 /// Capabilities the extension is requesting
5600 pub capabilities: Vec<String>,
5601 /// Name of the extension requesting permission access
5602 pub extension_name: String,
5603 /// Permission kind discriminator
5604 pub kind: PermissionRequestExtensionPermissionAccessKind,
5605 /// When true, managed policy requires an explicit user decision and automatic approval must be bypassed.
5606 #[serde(skip_serializing_if = "Option::is_none")]
5607 pub managed_approval_required: Option<bool>,
5608 /// Tool call ID that triggered this permission request
5609 #[serde(skip_serializing_if = "Option::is_none")]
5610 pub tool_call_id: Option<String>,
5611}
5612
5613/// Extension sensitive environment variable access request
5614#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5615#[serde(rename_all = "camelCase")]
5616pub struct PermissionRequestExtensionEnvAccess {
5617 /// Names of the sensitive environment variables the extension is requesting. Values never appear here.
5618 pub environment_variables: Vec<String>,
5619 /// Name of the extension requesting environment variable access
5620 pub extension_name: String,
5621 /// Permission kind discriminator
5622 pub kind: PermissionRequestExtensionEnvAccessKind,
5623 /// When true, managed policy requires an explicit user decision and automatic approval must be bypassed.
5624 #[serde(skip_serializing_if = "Option::is_none")]
5625 pub managed_approval_required: Option<bool>,
5626 /// Tool call ID that triggered this permission request
5627 #[serde(skip_serializing_if = "Option::is_none")]
5628 pub tool_call_id: Option<String>,
5629}
5630
5631/// Shell command permission prompt
5632#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5633#[serde(rename_all = "camelCase")]
5634pub struct PermissionPromptRequestCommands {
5635 /// Assisted-approval judge information for this request; present only in assisted mode.
5636 ///
5637 /// <div class="warning">
5638 ///
5639 /// **Experimental.** This type is part of an experimental wire-protocol surface
5640 /// and may change or be removed in future SDK or CLI releases.
5641 ///
5642 /// </div>
5643 #[serde(skip_serializing_if = "Option::is_none")]
5644 pub assisted_approval: Option<PermissionAssistedApproval>,
5645 /// Whether the UI can offer session-wide approval for this command pattern
5646 pub can_offer_session_approval: bool,
5647 /// Command identifiers covered by this approval prompt
5648 pub command_identifiers: Vec<String>,
5649 /// The complete shell command text to be executed
5650 pub full_command_text: String,
5651 /// Human-readable description of what the command intends to do
5652 pub intention: String,
5653 /// Prompt kind discriminator
5654 pub kind: PermissionPromptRequestCommandsKind,
5655 /// Whether managed policy requires a human response and forbids host auto-approval
5656 #[serde(skip_serializing_if = "Option::is_none")]
5657 pub managed_approval_required: Option<bool>,
5658 /// True when the shell command is requesting sandbox escalation. This is a request, not a grant.
5659 #[serde(skip_serializing_if = "Option::is_none")]
5660 pub request_sandbox_bypass: Option<bool>,
5661 /// Reason for the sandbox escalation request.
5662 #[serde(skip_serializing_if = "Option::is_none")]
5663 pub request_sandbox_bypass_reason: Option<String>,
5664 /// 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.
5665 #[serde(skip_serializing_if = "Option::is_none")]
5666 pub request_sandbox_permissive: Option<bool>,
5667 /// Tool call ID that triggered this permission request
5668 #[serde(skip_serializing_if = "Option::is_none")]
5669 pub tool_call_id: Option<String>,
5670 /// Optional warning message about risks of running this command
5671 #[serde(skip_serializing_if = "Option::is_none")]
5672 pub warning: Option<String>,
5673}
5674
5675/// File write permission prompt
5676#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5677#[serde(rename_all = "camelCase")]
5678pub struct PermissionPromptRequestWrite {
5679 /// Assisted-approval judge information for this request; present only in assisted mode.
5680 ///
5681 /// <div class="warning">
5682 ///
5683 /// **Experimental.** This type is part of an experimental wire-protocol surface
5684 /// and may change or be removed in future SDK or CLI releases.
5685 ///
5686 /// </div>
5687 #[serde(skip_serializing_if = "Option::is_none")]
5688 pub assisted_approval: Option<PermissionAssistedApproval>,
5689 /// Whether the UI can offer session-wide approval for file write operations
5690 pub can_offer_session_approval: bool,
5691 /// Unified diff showing the proposed changes
5692 pub diff: String,
5693 /// Path of the file being written to
5694 pub file_name: String,
5695 /// Human-readable description of the intended file change
5696 pub intention: String,
5697 /// Prompt kind discriminator
5698 pub kind: PermissionPromptRequestWriteKind,
5699 /// Whether managed policy requires a human response and forbids host auto-approval
5700 #[serde(skip_serializing_if = "Option::is_none")]
5701 pub managed_approval_required: Option<bool>,
5702 /// Complete new file contents for newly created files
5703 #[serde(skip_serializing_if = "Option::is_none")]
5704 pub new_file_contents: Option<String>,
5705 /// Runtime-resolved canonical path used for authorization identity checks. Internal and experimental; clients should continue to display fileName.
5706 ///
5707 /// <div class="warning">
5708 ///
5709 /// **Experimental.** This type is part of an experimental wire-protocol surface
5710 /// and may change or be removed in future SDK or CLI releases.
5711 ///
5712 /// </div>
5713 #[serde(skip_serializing_if = "Option::is_none")]
5714 pub resolved_path: Option<String>,
5715 /// Tool call ID that triggered this permission request
5716 #[serde(skip_serializing_if = "Option::is_none")]
5717 pub tool_call_id: Option<String>,
5718}
5719
5720/// File read permission prompt
5721#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5722#[serde(rename_all = "camelCase")]
5723pub struct PermissionPromptRequestRead {
5724 /// Assisted-approval judge information for this request; present only in assisted mode.
5725 ///
5726 /// <div class="warning">
5727 ///
5728 /// **Experimental.** This type is part of an experimental wire-protocol surface
5729 /// and may change or be removed in future SDK or CLI releases.
5730 ///
5731 /// </div>
5732 #[serde(skip_serializing_if = "Option::is_none")]
5733 pub assisted_approval: Option<PermissionAssistedApproval>,
5734 /// Human-readable description of why the file is being read
5735 pub intention: String,
5736 /// Prompt kind discriminator
5737 pub kind: PermissionPromptRequestReadKind,
5738 /// Whether managed policy requires a human response and forbids host auto-approval
5739 #[serde(skip_serializing_if = "Option::is_none")]
5740 pub managed_approval_required: Option<bool>,
5741 /// Path of the file or directory being read
5742 pub path: String,
5743 /// Runtime-resolved canonical path used for authorization identity checks. Internal and experimental; clients should continue to display path.
5744 ///
5745 /// <div class="warning">
5746 ///
5747 /// **Experimental.** This type is part of an experimental wire-protocol surface
5748 /// and may change or be removed in future SDK or CLI releases.
5749 ///
5750 /// </div>
5751 #[serde(skip_serializing_if = "Option::is_none")]
5752 pub resolved_path: Option<String>,
5753 /// Tool call ID that triggered this permission request
5754 #[serde(skip_serializing_if = "Option::is_none")]
5755 pub tool_call_id: Option<String>,
5756}
5757
5758/// MCP tool invocation permission prompt
5759#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5760#[serde(rename_all = "camelCase")]
5761pub struct PermissionPromptRequestMcp {
5762 /// Arguments to pass to the MCP tool
5763 #[serde(skip_serializing_if = "Option::is_none")]
5764 pub args: Option<serde_json::Value>,
5765 /// Assisted-approval judge information for this request; present only in assisted mode.
5766 ///
5767 /// <div class="warning">
5768 ///
5769 /// **Experimental.** This type is part of an experimental wire-protocol surface
5770 /// and may change or be removed in future SDK or CLI releases.
5771 ///
5772 /// </div>
5773 #[serde(skip_serializing_if = "Option::is_none")]
5774 pub assisted_approval: Option<PermissionAssistedApproval>,
5775 /// 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.
5776 #[serde(skip_serializing_if = "Option::is_none")]
5777 pub can_offer_server_wide_approval: Option<bool>,
5778 /// Prompt kind discriminator
5779 pub kind: PermissionPromptRequestMcpKind,
5780 /// Advisory runtime permission recommendation. The host remains responsible for deciding the request and may reject it.
5781 ///
5782 /// <div class="warning">
5783 ///
5784 /// **Experimental.** This type is part of an experimental wire-protocol surface
5785 /// and may change or be removed in future SDK or CLI releases.
5786 ///
5787 /// </div>
5788 #[serde(skip_serializing_if = "Option::is_none")]
5789 pub permission_recommendation: Option<PermissionRecommendation>,
5790 /// Name of the MCP server providing the tool
5791 pub server_name: String,
5792 /// Tool call ID that triggered this permission request
5793 #[serde(skip_serializing_if = "Option::is_none")]
5794 pub tool_call_id: Option<String>,
5795 /// Internal name of the MCP tool
5796 pub tool_name: String,
5797 /// Human-readable title of the MCP tool
5798 pub tool_title: String,
5799}
5800
5801/// URL access permission prompt
5802#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5803#[serde(rename_all = "camelCase")]
5804pub struct PermissionPromptRequestUrl {
5805 /// Assisted-approval judge information for this request; present only in assisted mode.
5806 ///
5807 /// <div class="warning">
5808 ///
5809 /// **Experimental.** This type is part of an experimental wire-protocol surface
5810 /// and may change or be removed in future SDK or CLI releases.
5811 ///
5812 /// </div>
5813 #[serde(skip_serializing_if = "Option::is_none")]
5814 pub assisted_approval: Option<PermissionAssistedApproval>,
5815 /// Human-readable description of why the URL is being accessed
5816 pub intention: String,
5817 /// Prompt kind discriminator
5818 pub kind: PermissionPromptRequestUrlKind,
5819 /// Whether managed policy requires a human response and forbids host auto-approval
5820 #[serde(skip_serializing_if = "Option::is_none")]
5821 pub managed_approval_required: Option<bool>,
5822 /// Immediately preceding URL when this prompt is for a redirect target
5823 #[serde(skip_serializing_if = "Option::is_none")]
5824 pub redirected_from: Option<String>,
5825 /// 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.
5826 #[serde(skip_serializing_if = "Option::is_none")]
5827 pub request_sandbox_bypass: Option<bool>,
5828 /// 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.
5829 #[serde(skip_serializing_if = "Option::is_none")]
5830 pub request_sandbox_bypass_reason: Option<String>,
5831 /// Tool call ID that triggered this permission request
5832 #[serde(skip_serializing_if = "Option::is_none")]
5833 pub tool_call_id: Option<String>,
5834 /// URL to be fetched
5835 pub url: String,
5836}
5837
5838/// Memory operation permission prompt
5839#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5840#[serde(rename_all = "camelCase")]
5841pub struct PermissionPromptRequestMemory {
5842 /// Whether this is a store or vote memory operation
5843 #[serde(skip_serializing_if = "Option::is_none")]
5844 pub action: Option<PermissionRequestMemoryAction>,
5845 /// Assisted-approval judge information for this request; present only in assisted mode.
5846 ///
5847 /// <div class="warning">
5848 ///
5849 /// **Experimental.** This type is part of an experimental wire-protocol surface
5850 /// and may change or be removed in future SDK or CLI releases.
5851 ///
5852 /// </div>
5853 #[serde(skip_serializing_if = "Option::is_none")]
5854 pub assisted_approval: Option<PermissionAssistedApproval>,
5855 /// Source references for the stored fact (store only)
5856 #[serde(skip_serializing_if = "Option::is_none")]
5857 pub citations: Option<String>,
5858 /// Vote direction (vote only)
5859 #[serde(skip_serializing_if = "Option::is_none")]
5860 pub direction: Option<PermissionRequestMemoryDirection>,
5861 /// The fact being stored or voted on
5862 pub fact: String,
5863 /// Prompt kind discriminator
5864 pub kind: PermissionPromptRequestMemoryKind,
5865 /// Reason for the vote (vote only)
5866 #[serde(skip_serializing_if = "Option::is_none")]
5867 pub reason: Option<String>,
5868 /// Topic or subject of the memory (store only)
5869 #[serde(skip_serializing_if = "Option::is_none")]
5870 pub subject: Option<String>,
5871 /// Tool call ID that triggered this permission request
5872 #[serde(skip_serializing_if = "Option::is_none")]
5873 pub tool_call_id: Option<String>,
5874}
5875
5876/// Custom tool invocation permission prompt
5877#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5878#[serde(rename_all = "camelCase")]
5879pub struct PermissionPromptRequestCustomTool {
5880 /// Arguments to pass to the custom tool
5881 #[serde(skip_serializing_if = "Option::is_none")]
5882 pub args: Option<serde_json::Value>,
5883 /// Assisted-approval judge information for this request; present only in assisted mode.
5884 ///
5885 /// <div class="warning">
5886 ///
5887 /// **Experimental.** This type is part of an experimental wire-protocol surface
5888 /// and may change or be removed in future SDK or CLI releases.
5889 ///
5890 /// </div>
5891 #[serde(skip_serializing_if = "Option::is_none")]
5892 pub assisted_approval: Option<PermissionAssistedApproval>,
5893 /// Prompt kind discriminator
5894 pub kind: PermissionPromptRequestCustomToolKind,
5895 /// Tool call ID that triggered this permission request
5896 #[serde(skip_serializing_if = "Option::is_none")]
5897 pub tool_call_id: Option<String>,
5898 /// Description of what the custom tool does
5899 pub tool_description: String,
5900 /// Name of the custom tool
5901 pub tool_name: String,
5902}
5903
5904/// Path access permission prompt
5905#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5906#[serde(rename_all = "camelCase")]
5907pub struct PermissionPromptRequestPath {
5908 /// Underlying permission kind that needs path approval
5909 pub access_kind: PermissionPromptRequestPathAccessKind,
5910 /// Assisted-approval judge information for this request; present only in assisted mode.
5911 ///
5912 /// <div class="warning">
5913 ///
5914 /// **Experimental.** This type is part of an experimental wire-protocol surface
5915 /// and may change or be removed in future SDK or CLI releases.
5916 ///
5917 /// </div>
5918 #[serde(skip_serializing_if = "Option::is_none")]
5919 pub assisted_approval: Option<PermissionAssistedApproval>,
5920 /// Prompt kind discriminator
5921 pub kind: PermissionPromptRequestPathKind,
5922 /// File paths that require explicit approval
5923 pub paths: Vec<String>,
5924 /// Tool call ID that triggered this permission request
5925 #[serde(skip_serializing_if = "Option::is_none")]
5926 pub tool_call_id: Option<String>,
5927}
5928
5929/// Hook confirmation permission prompt
5930#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5931#[serde(rename_all = "camelCase")]
5932pub struct PermissionPromptRequestHook {
5933 /// Assisted-approval judge information for this request; present only in assisted mode.
5934 ///
5935 /// <div class="warning">
5936 ///
5937 /// **Experimental.** This type is part of an experimental wire-protocol surface
5938 /// and may change or be removed in future SDK or CLI releases.
5939 ///
5940 /// </div>
5941 #[serde(skip_serializing_if = "Option::is_none")]
5942 pub assisted_approval: Option<PermissionAssistedApproval>,
5943 /// Optional message from the hook explaining why confirmation is needed
5944 #[serde(skip_serializing_if = "Option::is_none")]
5945 pub hook_message: Option<String>,
5946 /// Prompt kind discriminator
5947 pub kind: PermissionPromptRequestHookKind,
5948 /// Arguments of the tool call being gated
5949 #[serde(skip_serializing_if = "Option::is_none")]
5950 pub tool_args: Option<serde_json::Value>,
5951 /// Tool call ID that triggered this permission request
5952 #[serde(skip_serializing_if = "Option::is_none")]
5953 pub tool_call_id: Option<String>,
5954 /// Name of the tool the hook is gating
5955 pub tool_name: String,
5956}
5957
5958/// Extension management permission prompt
5959#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5960#[serde(rename_all = "camelCase")]
5961pub struct PermissionPromptRequestExtensionManagement {
5962 /// Assisted-approval judge information for this request; present only in assisted mode.
5963 ///
5964 /// <div class="warning">
5965 ///
5966 /// **Experimental.** This type is part of an experimental wire-protocol surface
5967 /// and may change or be removed in future SDK or CLI releases.
5968 ///
5969 /// </div>
5970 #[serde(skip_serializing_if = "Option::is_none")]
5971 pub assisted_approval: Option<PermissionAssistedApproval>,
5972 /// Name of the extension being managed
5973 #[serde(skip_serializing_if = "Option::is_none")]
5974 pub extension_name: Option<String>,
5975 /// Prompt kind discriminator
5976 pub kind: PermissionPromptRequestExtensionManagementKind,
5977 /// The extension management operation (scaffold, reload)
5978 pub operation: String,
5979 /// Tool call ID that triggered this permission request
5980 #[serde(skip_serializing_if = "Option::is_none")]
5981 pub tool_call_id: Option<String>,
5982}
5983
5984/// Factory run or authoring permission prompt
5985#[derive(Debug, Clone, Default, Serialize, Deserialize)]
5986#[serde(rename_all = "camelCase")]
5987pub struct PermissionPromptRequestFactory {
5988 /// Canonical key used for scoped factory approvals
5989 pub approval_key: String,
5990 /// Assisted-approval judge information for this request; present only in assisted mode.
5991 ///
5992 /// <div class="warning">
5993 ///
5994 /// **Experimental.** This type is part of an experimental wire-protocol surface
5995 /// and may change or be removed in future SDK or CLI releases.
5996 ///
5997 /// </div>
5998 #[serde(skip_serializing_if = "Option::is_none")]
5999 pub assisted_approval: Option<PermissionAssistedApproval>,
6000 /// Whether this factory is eligible for persistent approval
6001 pub can_persist_approval: bool,
6002 /// Factory-declared AI-credit limit before any run/resume caller override is applied.
6003 #[serde(skip_serializing_if = "Option::is_none")]
6004 pub declared_max_ai_credits: Option<f64>,
6005 /// Factory-declared concurrent-subagent limit before any run/resume caller override is applied.
6006 #[serde(skip_serializing_if = "Option::is_none")]
6007 pub declared_max_concurrent_subagents: Option<i64>,
6008 /// Factory-declared total-subagent limit before any run/resume caller override is applied.
6009 #[serde(skip_serializing_if = "Option::is_none")]
6010 pub declared_max_total_subagents: Option<i64>,
6011 /// Factory-declared active-time limit in seconds before any run/resume caller override is applied.
6012 #[serde(skip_serializing_if = "Option::is_none")]
6013 pub declared_timeout_seconds: Option<f64>,
6014 /// Factory description
6015 pub description: String,
6016 /// Prompt kind discriminator
6017 pub kind: PermissionPromptRequestFactoryKind,
6018 /// Whether managed policy requires a human response and forbids host auto-approval
6019 #[serde(skip_serializing_if = "Option::is_none")]
6020 pub managed_approval_required: Option<bool>,
6021 /// Effective AI-credit limit; omitted means unlimited
6022 #[serde(skip_serializing_if = "Option::is_none")]
6023 pub max_ai_credits: Option<f64>,
6024 /// Effective concurrent-subagent limit; omitted means unlimited
6025 #[serde(skip_serializing_if = "Option::is_none")]
6026 pub max_concurrent_subagents: Option<i64>,
6027 /// Effective total-subagent limit; omitted means unlimited
6028 #[serde(skip_serializing_if = "Option::is_none")]
6029 pub max_total_subagents: Option<i64>,
6030 /// Factory name
6031 pub name: String,
6032 /// Factory operation, either run or author
6033 pub operation: FactoryPermissionOperation,
6034 /// Declared factory phases
6035 pub phases: Vec<FactoryPermissionPhase>,
6036 /// Effective active-time limit in seconds; omitted means unlimited
6037 #[serde(skip_serializing_if = "Option::is_none")]
6038 pub timeout_seconds: Option<f64>,
6039 /// Tool call ID that triggered this permission request
6040 #[serde(skip_serializing_if = "Option::is_none")]
6041 pub tool_call_id: Option<String>,
6042}
6043
6044/// Extension permission access prompt
6045#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6046#[serde(rename_all = "camelCase")]
6047pub struct PermissionPromptRequestExtensionPermissionAccess {
6048 /// Assisted-approval judge information for this request; present only in assisted mode.
6049 ///
6050 /// <div class="warning">
6051 ///
6052 /// **Experimental.** This type is part of an experimental wire-protocol surface
6053 /// and may change or be removed in future SDK or CLI releases.
6054 ///
6055 /// </div>
6056 #[serde(skip_serializing_if = "Option::is_none")]
6057 pub assisted_approval: Option<PermissionAssistedApproval>,
6058 /// Capabilities the extension is requesting
6059 pub capabilities: Vec<String>,
6060 /// Name of the extension requesting permission access
6061 pub extension_name: String,
6062 /// Prompt kind discriminator
6063 pub kind: PermissionPromptRequestExtensionPermissionAccessKind,
6064 /// Tool call ID that triggered this permission request
6065 #[serde(skip_serializing_if = "Option::is_none")]
6066 pub tool_call_id: Option<String>,
6067}
6068
6069/// Extension sensitive environment variable access prompt
6070#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6071#[serde(rename_all = "camelCase")]
6072pub struct PermissionPromptRequestExtensionEnvAccess {
6073 /// Assisted-approval judge information for this request; present only in assisted mode.
6074 ///
6075 /// <div class="warning">
6076 ///
6077 /// **Experimental.** This type is part of an experimental wire-protocol surface
6078 /// and may change or be removed in future SDK or CLI releases.
6079 ///
6080 /// </div>
6081 #[serde(skip_serializing_if = "Option::is_none")]
6082 pub assisted_approval: Option<PermissionAssistedApproval>,
6083 /// Names of the sensitive environment variables the extension is requesting. Values never appear here.
6084 pub environment_variables: Vec<String>,
6085 /// Name of the extension requesting environment variable access
6086 pub extension_name: String,
6087 /// Prompt kind discriminator
6088 pub kind: PermissionPromptRequestExtensionEnvAccessKind,
6089 /// Tool call ID that triggered this permission request
6090 #[serde(skip_serializing_if = "Option::is_none")]
6091 pub tool_call_id: Option<String>,
6092}
6093
6094/// Session event "permission.requested". Permission request notification requiring client approval with request details
6095#[derive(Debug, Clone, Serialize, Deserialize)]
6096#[serde(rename_all = "camelCase")]
6097pub struct PermissionRequestedData {
6098 /// Agent mode captured from the owning turn when permission evaluation began.
6099 #[serde(skip_serializing_if = "Option::is_none")]
6100 pub agent_mode: Option<SessionMode>,
6101 /// Permission mode captured when evaluation began. Absent on historical events.
6102 #[serde(skip_serializing_if = "Option::is_none")]
6103 pub permission_mode: Option<PermissionMode>,
6104 /// Details of the permission being requested
6105 pub permission_request: PermissionRequest,
6106 /// Derived user-facing permission prompt details for UI consumers
6107 #[serde(skip_serializing_if = "Option::is_none")]
6108 pub prompt_request: Option<PermissionPromptRequest>,
6109 /// Permission-recovery episode that authorized this request to surface for interactive attention
6110 #[serde(skip_serializing_if = "Option::is_none")]
6111 pub recovery_episode_id: Option<String>,
6112 /// Unique identifier for this permission request; used to respond via session.respondToPermission()
6113 pub request_id: RequestId,
6114 /// When true, this permission was already resolved by a permissionRequest hook and requires no client action
6115 #[serde(skip_serializing_if = "Option::is_none")]
6116 pub resolved_by_hook: Option<bool>,
6117 /// Neutral risk metadata supplied by the tool host. Consumers may display this value but must not use it to bypass the permission decision.
6118 #[serde(skip_serializing_if = "Option::is_none")]
6119 pub risk_assessment: Option<serde_json::Value>,
6120}
6121
6122/// Permission response variant indicating the request was approved without persisting an approval rule.
6123#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6124#[serde(rename_all = "camelCase")]
6125pub struct PermissionApproved {
6126 /// The permission request was approved
6127 pub kind: PermissionApprovedKind,
6128 /// Whether a managed approval policy already handled this request
6129 #[serde(skip_serializing_if = "Option::is_none")]
6130 pub managed_approval_handled: Option<bool>,
6131}
6132
6133/// Session-scoped tool-approval rule for specific shell command identifiers.
6134#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6135#[serde(rename_all = "camelCase")]
6136pub struct UserToolSessionApprovalCommands {
6137 /// Command identifiers approved by the user
6138 pub command_identifiers: Vec<String>,
6139 /// Command approval kind
6140 pub kind: UserToolSessionApprovalCommandsKind,
6141}
6142
6143/// Session-scoped tool-approval rule for read-only filesystem operations.
6144#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6145#[serde(rename_all = "camelCase")]
6146pub struct UserToolSessionApprovalRead {
6147 /// Read approval kind
6148 pub kind: UserToolSessionApprovalReadKind,
6149}
6150
6151/// Session-scoped tool-approval rule for filesystem write operations.
6152#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6153#[serde(rename_all = "camelCase")]
6154pub struct UserToolSessionApprovalWrite {
6155 /// Write approval kind
6156 pub kind: UserToolSessionApprovalWriteKind,
6157}
6158
6159/// Session-scoped tool-approval rule for an MCP server tool, or all tools on the server when `toolName` is null.
6160#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6161#[serde(rename_all = "camelCase")]
6162pub struct UserToolSessionApprovalMcp {
6163 /// MCP tool approval kind
6164 pub kind: UserToolSessionApprovalMcpKind,
6165 /// MCP server name
6166 pub server_name: String,
6167 /// Optional MCP tool name, or null for all tools on the server
6168 pub tool_name: Option<String>,
6169}
6170
6171/// Session-scoped tool-approval rule for writes to long-term memory.
6172#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6173#[serde(rename_all = "camelCase")]
6174pub struct UserToolSessionApprovalMemory {
6175 /// Memory approval kind
6176 pub kind: UserToolSessionApprovalMemoryKind,
6177}
6178
6179/// Session-scoped tool-approval rule for a custom tool, keyed by tool name.
6180#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6181#[serde(rename_all = "camelCase")]
6182pub struct UserToolSessionApprovalCustomTool {
6183 /// Custom tool approval kind
6184 pub kind: UserToolSessionApprovalCustomToolKind,
6185 /// Custom tool name
6186 pub tool_name: String,
6187}
6188
6189/// Session-scoped tool-approval rule for extension-management operations, optionally narrowed by operation.
6190#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6191#[serde(rename_all = "camelCase")]
6192pub struct UserToolSessionApprovalExtensionManagement {
6193 /// Extension management approval kind
6194 pub kind: UserToolSessionApprovalExtensionManagementKind,
6195 /// Optional operation identifier
6196 #[serde(skip_serializing_if = "Option::is_none")]
6197 pub operation: Option<String>,
6198}
6199
6200/// Session-scoped factory approval, optionally narrowed by approval key.
6201#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6202#[serde(rename_all = "camelCase")]
6203pub struct UserToolSessionApprovalFactory {
6204 /// Optional factory operation name or canonical approval key
6205 #[serde(skip_serializing_if = "Option::is_none")]
6206 pub approval_key: Option<String>,
6207 /// Factory approval kind
6208 pub kind: UserToolSessionApprovalFactoryKind,
6209}
6210
6211/// Session-scoped tool-approval rule for an extension's permission-gated capability access, keyed by extension name.
6212#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6213#[serde(rename_all = "camelCase")]
6214pub struct UserToolSessionApprovalExtensionPermissionAccess {
6215 /// Extension name
6216 pub extension_name: String,
6217 /// Extension permission access approval kind
6218 pub kind: UserToolSessionApprovalExtensionPermissionAccessKind,
6219}
6220
6221/// 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.
6222#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6223#[serde(rename_all = "camelCase")]
6224pub struct UserToolSessionApprovalExtensionEnvAccess {
6225 /// Names of the sensitive environment variables this approval covers. Values are never persisted.
6226 pub environment_variables: Vec<String>,
6227 /// Extension name
6228 pub extension_name: String,
6229 /// Extension environment access approval kind
6230 pub kind: UserToolSessionApprovalExtensionEnvAccessKind,
6231}
6232
6233/// Permission response variant that approves a request and remembers the provided approval for the rest of the session.
6234#[derive(Debug, Clone, Serialize, Deserialize)]
6235#[serde(rename_all = "camelCase")]
6236pub struct PermissionApprovedForSession {
6237 /// The approval to add as a session-scoped rule
6238 pub approval: UserToolSessionApproval,
6239 /// Approved and remembered for the rest of the session
6240 pub kind: PermissionApprovedForSessionKind,
6241 /// Whether a managed approval policy already handled this request
6242 #[serde(skip_serializing_if = "Option::is_none")]
6243 pub managed_approval_handled: Option<bool>,
6244}
6245
6246/// Permission response variant that approves a request and persists the provided approval to a project location key.
6247#[derive(Debug, Clone, Serialize, Deserialize)]
6248#[serde(rename_all = "camelCase")]
6249pub struct PermissionApprovedForLocation {
6250 /// The approval to persist for this location
6251 pub approval: UserToolSessionApproval,
6252 /// Approved and persisted for this project location
6253 pub kind: PermissionApprovedForLocationKind,
6254 /// The location key (git root or cwd) to persist the approval to
6255 pub location_key: String,
6256 /// Whether a managed approval policy already handled this request
6257 #[serde(skip_serializing_if = "Option::is_none")]
6258 pub managed_approval_handled: Option<bool>,
6259}
6260
6261/// Permission response variant indicating the request was cancelled before use, with an optional reason.
6262#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6263#[serde(rename_all = "camelCase")]
6264pub struct PermissionCancelled {
6265 /// The permission request was cancelled before a response was used
6266 pub kind: PermissionCancelledKind,
6267 /// Optional explanation of why the request was cancelled
6268 #[serde(skip_serializing_if = "Option::is_none")]
6269 pub reason: Option<String>,
6270}
6271
6272/// A permission approval or denial rule matched against a tool request, identified by a rule kind with an optional argument value.
6273#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6274#[serde(rename_all = "camelCase")]
6275pub struct PermissionRule {
6276 /// Argument value matched against the request, or null when the rule kind has no argument (e.g. 'read', 'write', 'memory').
6277 pub argument: Option<String>,
6278 /// The rule kind, such as Shell or GitHubMCP
6279 pub kind: String,
6280}
6281
6282/// Permission response variant denied because matching approval rules explicitly blocked the request.
6283#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6284#[serde(rename_all = "camelCase")]
6285pub struct PermissionDeniedByRules {
6286 /// Denied because approval rules explicitly blocked it
6287 pub kind: PermissionDeniedByRulesKind,
6288 /// Rules that denied the request
6289 pub rules: Vec<PermissionRule>,
6290}
6291
6292/// Permission response variant denied because no approval rule matched and user confirmation was unavailable.
6293#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6294#[serde(rename_all = "camelCase")]
6295pub struct PermissionDeniedNoApprovalRuleAndCouldNotRequestFromUser {
6296 /// Denied because no approval rule matched and user confirmation was unavailable
6297 pub kind: PermissionDeniedNoApprovalRuleAndCouldNotRequestFromUserKind,
6298}
6299
6300/// Permission response variant denied in an interactive user prompt, with optional feedback and force-reject flag.
6301#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6302#[serde(rename_all = "camelCase")]
6303pub struct PermissionDeniedInteractivelyByUser {
6304 /// Optional feedback from the user explaining the denial
6305 #[serde(skip_serializing_if = "Option::is_none")]
6306 pub feedback: Option<String>,
6307 /// Whether to force-reject the current agent turn
6308 #[serde(skip_serializing_if = "Option::is_none")]
6309 pub force_reject: Option<bool>,
6310 /// Denied by the user during an interactive prompt
6311 pub kind: PermissionDeniedInteractivelyByUserKind,
6312}
6313
6314/// Permission response variant denying a path under content exclusion policy, with the path and message.
6315#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6316#[serde(rename_all = "camelCase")]
6317pub struct PermissionDeniedByContentExclusionPolicy {
6318 /// Denied by the organization's content exclusion policy
6319 pub kind: PermissionDeniedByContentExclusionPolicyKind,
6320 /// Human-readable explanation of why the path was excluded
6321 pub message: String,
6322 /// File path that triggered the exclusion
6323 pub path: String,
6324}
6325
6326/// Permission response variant denied by a permission-request hook, with optional message and interrupt flag.
6327#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6328#[serde(rename_all = "camelCase")]
6329pub struct PermissionDeniedByPermissionRequestHook {
6330 /// Whether to interrupt the current agent turn
6331 #[serde(skip_serializing_if = "Option::is_none")]
6332 pub interrupt: Option<bool>,
6333 /// Denied by a permission request hook registered by an extension or plugin
6334 pub kind: PermissionDeniedByPermissionRequestHookKind,
6335 /// Optional message from the hook explaining the denial
6336 #[serde(skip_serializing_if = "Option::is_none")]
6337 pub message: Option<String>,
6338}
6339
6340/// Session event "permission.completed". Permission request completion notification signaling UI dismissal
6341#[derive(Debug, Clone, Serialize, Deserialize)]
6342#[serde(rename_all = "camelCase")]
6343pub struct PermissionCompletedData {
6344 /// Atomic structured blocked outcome when this permission response ended an Autopilot recovery episode unsuccessfully
6345 #[serde(skip_serializing_if = "Option::is_none")]
6346 pub blocker: Option<TaskBlocker>,
6347 /// 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.
6348 ///
6349 /// <div class="warning">
6350 ///
6351 /// **Experimental.** This type is part of an experimental wire-protocol surface
6352 /// and may change or be removed in future SDK or CLI releases.
6353 ///
6354 /// </div>
6355 #[serde(skip_serializing_if = "Option::is_none")]
6356 pub decision_source: Option<PermissionDecisionSource>,
6357 /// Permission-recovery episode settled by this response, when the request was escalated by Autopilot
6358 #[serde(skip_serializing_if = "Option::is_none")]
6359 pub recovery_episode_id: Option<String>,
6360 /// Request ID of the resolved permission request; clients should dismiss any UI for this request
6361 pub request_id: RequestId,
6362 /// The result of the permission request
6363 pub result: PermissionResult,
6364 /// Optional tool call ID associated with this permission prompt; clients may use it to correlate UI created from tool-scoped prompts
6365 #[serde(skip_serializing_if = "Option::is_none")]
6366 pub tool_call_id: Option<String>,
6367}
6368
6369/// 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.
6370///
6371/// <div class="warning">
6372///
6373/// **Experimental.** This type is part of an experimental wire-protocol surface
6374/// and may change or be removed in future SDK or CLI releases.
6375///
6376/// </div>
6377#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6378#[serde(rename_all = "camelCase")]
6379pub struct PermissionCarriedForwardData {
6380 /// Always `authorization_carry_forward`. Stated explicitly so a consumer reading this event cannot mistake it for a human, host-policy, or assisted-approval decision.
6381 ///
6382 /// <div class="warning">
6383 ///
6384 /// **Experimental.** This type is part of an experimental wire-protocol surface
6385 /// and may change or be removed in future SDK or CLI releases.
6386 ///
6387 /// </div>
6388 pub decision_source: PermissionDecisionSource,
6389 /// Identity of the prior authorization record that contained the proposal.
6390 ///
6391 /// <div class="warning">
6392 ///
6393 /// **Experimental.** This type is part of an experimental wire-protocol surface
6394 /// and may change or be removed in future SDK or CLI releases.
6395 ///
6396 /// </div>
6397 pub record_id: String,
6398 /// Authorization edge minted for this admission. Not a prompt id: no prompt was raised, so no client should expect a request with this id.
6399 ///
6400 /// <div class="warning">
6401 ///
6402 /// **Experimental.** This type is part of an experimental wire-protocol surface
6403 /// and may change or be removed in future SDK or CLI releases.
6404 ///
6405 /// </div>
6406 pub request_id: RequestId,
6407 /// 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.
6408 ///
6409 /// <div class="warning">
6410 ///
6411 /// **Experimental.** This type is part of an experimental wire-protocol surface
6412 /// and may change or be removed in future SDK or CLI releases.
6413 ///
6414 /// </div>
6415 pub tool_call_id: String,
6416}
6417
6418/// 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.
6419///
6420/// <div class="warning">
6421///
6422/// **Experimental.** This type is part of an experimental wire-protocol surface
6423/// and may change or be removed in future SDK or CLI releases.
6424///
6425/// </div>
6426#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6427#[serde(rename_all = "camelCase")]
6428pub struct PermissionMessageAuthorizationData {
6429 /// The kind of effect authorized, as an action-class identifier.
6430 ///
6431 /// <div class="warning">
6432 ///
6433 /// **Experimental.** This type is part of an experimental wire-protocol surface
6434 /// and may change or be removed in future SDK or CLI releases.
6435 ///
6436 /// </div>
6437 pub action_class: String,
6438 /// Whether the claim granted or denied authority.
6439 ///
6440 /// <div class="warning">
6441 ///
6442 /// **Experimental.** This type is part of an experimental wire-protocol surface
6443 /// and may change or be removed in future SDK or CLI releases.
6444 ///
6445 /// </div>
6446 pub polarity: PermissionMessageAuthorizationPolarity,
6447 /// Deterministic identity of the record, derived from the turn and span offsets so re-extracting the same span mints nothing new.
6448 ///
6449 /// <div class="warning">
6450 ///
6451 /// **Experimental.** This type is part of an experimental wire-protocol surface
6452 /// and may change or be removed in future SDK or CLI releases.
6453 ///
6454 /// </div>
6455 pub record_id: String,
6456 /// End byte offset of the authorizing span within the turn.
6457 ///
6458 /// <div class="warning">
6459 ///
6460 /// **Experimental.** This type is part of an experimental wire-protocol surface
6461 /// and may change or be removed in future SDK or CLI releases.
6462 ///
6463 /// </div>
6464 pub span_end: i64,
6465 /// Start byte offset of the authorizing span within the turn.
6466 ///
6467 /// <div class="warning">
6468 ///
6469 /// **Experimental.** This type is part of an experimental wire-protocol surface
6470 /// and may change or be removed in future SDK or CLI releases.
6471 ///
6472 /// </div>
6473 pub span_start: i64,
6474 /// Concrete named targets that appear verbatim inside the span.
6475 ///
6476 /// <div class="warning">
6477 ///
6478 /// **Experimental.** This type is part of an experimental wire-protocol surface
6479 /// and may change or be removed in future SDK or CLI releases.
6480 ///
6481 /// </div>
6482 #[serde(skip_serializing_if = "Option::is_none")]
6483 pub target_members: Option<Vec<String>>,
6484 /// The task the permission is scoped to, when the human named one.
6485 ///
6486 /// <div class="warning">
6487 ///
6488 /// **Experimental.** This type is part of an experimental wire-protocol surface
6489 /// and may change or be removed in future SDK or CLI releases.
6490 ///
6491 /// </div>
6492 #[serde(skip_serializing_if = "Option::is_none")]
6493 pub task: Option<String>,
6494 /// The human turn the quoted span was read from.
6495 ///
6496 /// <div class="warning">
6497 ///
6498 /// **Experimental.** This type is part of an experimental wire-protocol surface
6499 /// and may change or be removed in future SDK or CLI releases.
6500 ///
6501 /// </div>
6502 pub turn_index: i64,
6503 /// 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.
6504 ///
6505 /// <div class="warning">
6506 ///
6507 /// **Experimental.** This type is part of an experimental wire-protocol surface
6508 /// and may change or be removed in future SDK or CLI releases.
6509 ///
6510 /// </div>
6511 #[serde(skip_serializing_if = "Option::is_none")]
6512 pub world: Option<serde_json::Value>,
6513}
6514
6515/// 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. Also records whether that pass activates ongoing extraction; contextual-assent-only passes do not, so unrelated future messages remain outside extraction.
6516///
6517/// <div class="warning">
6518///
6519/// **Experimental.** This type is part of an experimental wire-protocol surface
6520/// and may change or be removed in future SDK or CLI releases.
6521///
6522/// </div>
6523#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6524#[serde(rename_all = "camelCase")]
6525pub struct PermissionMessageAuthorizationReadData {
6526 /// Whether this read activates ongoing message-backed extraction. False for a contextual-assent-only pass while auto-approval is off, so unrelated future messages remain outside extraction.
6527 ///
6528 /// <div class="warning">
6529 ///
6530 /// **Experimental.** This type is part of an experimental wire-protocol surface
6531 /// and may change or be removed in future SDK or CLI releases.
6532 ///
6533 /// </div>
6534 #[serde(skip_serializing_if = "Option::is_none")]
6535 pub activates_extraction: Option<bool>,
6536 /// The human turn that was read by the proposer.
6537 ///
6538 /// <div class="warning">
6539 ///
6540 /// **Experimental.** This type is part of an experimental wire-protocol surface
6541 /// and may change or be removed in future SDK or CLI releases.
6542 ///
6543 /// </div>
6544 pub turn_index: i64,
6545}
6546
6547/// 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.
6548///
6549/// <div class="warning">
6550///
6551/// **Experimental.** This type is part of an experimental wire-protocol surface
6552/// and may change or be removed in future SDK or CLI releases.
6553///
6554/// </div>
6555#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6556#[serde(rename_all = "camelCase")]
6557pub struct PermissionMessageAuthorizationDegradedData {
6558 /// The human turn that could not be represented safely.
6559 ///
6560 /// <div class="warning">
6561 ///
6562 /// **Experimental.** This type is part of an experimental wire-protocol surface
6563 /// and may change or be removed in future SDK or CLI releases.
6564 ///
6565 /// </div>
6566 pub turn_index: i64,
6567}
6568
6569/// Session event "permission.assentDetected". Records that deterministic text recognition found likely assent in the human turn immediately following a root Autopilot permission request that was blocked because no interactive response was available. This event grants no authority; its model-facing projection only suggests retrying the unchanged operation.
6570///
6571/// <div class="warning">
6572///
6573/// **Experimental.** This type is part of an experimental wire-protocol surface
6574/// and may change or be removed in future SDK or CLI releases.
6575///
6576/// </div>
6577#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6578#[serde(rename_all = "camelCase")]
6579pub struct PermissionAssentDetectedData {
6580 /// Permission request the likely assent may refer to. The runtime derives this from the preceding durable blocker; the human message and extraction model do not choose it.
6581 ///
6582 /// <div class="warning">
6583 ///
6584 /// **Experimental.** This type is part of an experimental wire-protocol surface
6585 /// and may change or be removed in future SDK or CLI releases.
6586 ///
6587 /// </div>
6588 pub request_id: RequestId,
6589 /// Human turn whose text triggered the deterministic assent recognizer.
6590 ///
6591 /// <div class="warning">
6592 ///
6593 /// **Experimental.** This type is part of an experimental wire-protocol surface
6594 /// and may change or be removed in future SDK or CLI releases.
6595 ///
6596 /// </div>
6597 pub turn_index: i64,
6598}
6599
6600/// Session event "permission.contextualAuthorization". Freezes a blinded contextual authorization proposal whose verbatim human span was deterministically bound to the immediately preceding blocked permission request. The event carries no action fields; replay re-derives the exact action from the earlier permission request and mints a one-shot message grant only when the binding and span still verify.
6601///
6602/// <div class="warning">
6603///
6604/// **Experimental.** This type is part of an experimental wire-protocol surface
6605/// and may change or be removed in future SDK or CLI releases.
6606///
6607/// </div>
6608#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6609#[serde(rename_all = "camelCase")]
6610pub struct PermissionContextualAuthorizationData {
6611 /// Whether the contextual human span granted or denied authority.
6612 ///
6613 /// <div class="warning">
6614 ///
6615 /// **Experimental.** This type is part of an experimental wire-protocol surface
6616 /// and may change or be removed in future SDK or CLI releases.
6617 ///
6618 /// </div>
6619 pub polarity: PermissionMessageAuthorizationPolarity,
6620 /// Deterministic identity of the contextual message grant.
6621 ///
6622 /// <div class="warning">
6623 ///
6624 /// **Experimental.** This type is part of an experimental wire-protocol surface
6625 /// and may change or be removed in future SDK or CLI releases.
6626 ///
6627 /// </div>
6628 pub record_id: String,
6629 /// Original blocked permission request selected by deterministic event ordering, never by the extraction model.
6630 ///
6631 /// <div class="warning">
6632 ///
6633 /// **Experimental.** This type is part of an experimental wire-protocol surface
6634 /// and may change or be removed in future SDK or CLI releases.
6635 ///
6636 /// </div>
6637 pub request_id: RequestId,
6638 /// End byte offset of the contextual decision span within the turn.
6639 ///
6640 /// <div class="warning">
6641 ///
6642 /// **Experimental.** This type is part of an experimental wire-protocol surface
6643 /// and may change or be removed in future SDK or CLI releases.
6644 ///
6645 /// </div>
6646 pub span_end: i64,
6647 /// Start byte offset of the contextual decision span within the turn.
6648 ///
6649 /// <div class="warning">
6650 ///
6651 /// **Experimental.** This type is part of an experimental wire-protocol surface
6652 /// and may change or be removed in future SDK or CLI releases.
6653 ///
6654 /// </div>
6655 pub span_start: i64,
6656 /// Human turn containing the contextual decision.
6657 ///
6658 /// <div class="warning">
6659 ///
6660 /// **Experimental.** This type is part of an experimental wire-protocol surface
6661 /// and may change or be removed in future SDK or CLI releases.
6662 ///
6663 /// </div>
6664 pub turn_index: i64,
6665}
6666
6667/// Session event "user_input.requested". User input request notification with question and optional predefined choices
6668#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6669#[serde(rename_all = "camelCase")]
6670pub struct UserInputRequestedData {
6671 /// Whether the user can provide a free-form text response in addition to predefined choices
6672 #[serde(skip_serializing_if = "Option::is_none")]
6673 pub allow_freeform: Option<bool>,
6674 /// Predefined choices for the user to select from, if applicable
6675 #[serde(skip_serializing_if = "Option::is_none")]
6676 pub choices: Option<Vec<String>>,
6677 /// The question or prompt to present to the user
6678 pub question: String,
6679 /// Unique identifier for this input request; used to respond via session.respondToUserInput()
6680 pub request_id: RequestId,
6681 /// The LLM-assigned tool call ID that triggered this request; used by remote UIs to correlate responses
6682 #[serde(skip_serializing_if = "Option::is_none")]
6683 pub tool_call_id: Option<String>,
6684}
6685
6686/// Session event "user_input.completed". User input request completion with the user's response
6687#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6688#[serde(rename_all = "camelCase")]
6689pub struct UserInputCompletedData {
6690 /// The user's answer to the input request
6691 #[serde(skip_serializing_if = "Option::is_none")]
6692 pub answer: Option<String>,
6693 /// Request ID of the resolved user input request; clients should dismiss any UI for this request
6694 pub request_id: RequestId,
6695 /// Whether the answer was typed as free-form text rather than selected from choices
6696 #[serde(skip_serializing_if = "Option::is_none")]
6697 pub was_freeform: Option<bool>,
6698}
6699
6700/// JSON Schema describing the form fields to present to the user (form mode only)
6701#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6702#[serde(rename_all = "camelCase")]
6703pub struct ElicitationRequestedSchema {
6704 /// Form field definitions, keyed by field name
6705 pub properties: HashMap<String, serde_json::Value>,
6706 /// List of required field names
6707 #[serde(skip_serializing_if = "Option::is_none")]
6708 pub required: Option<Vec<String>>,
6709 /// Schema type indicator (always 'object')
6710 pub r#type: ElicitationRequestedSchemaType,
6711}
6712
6713/// Session event "elicitation.requested". Elicitation request; may be form-based (structured input) or URL-based (browser redirect)
6714#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6715#[serde(rename_all = "camelCase")]
6716pub struct ElicitationRequestedData {
6717 /// The source that initiated the request (MCP server name, or absent for agent-initiated)
6718 #[serde(skip_serializing_if = "Option::is_none")]
6719 pub elicitation_source: Option<String>,
6720 /// Message describing what information is needed from the user
6721 pub message: String,
6722 /// Elicitation mode; "form" for structured input, "url" for browser-based. Defaults to "form" when absent.
6723 #[serde(skip_serializing_if = "Option::is_none")]
6724 pub mode: Option<ElicitationRequestedMode>,
6725 /// JSON Schema describing the form fields to present to the user (form mode only)
6726 #[serde(skip_serializing_if = "Option::is_none")]
6727 pub requested_schema: Option<ElicitationRequestedSchema>,
6728 /// Unique identifier for this elicitation request; used to respond via session.respondToElicitation()
6729 pub request_id: RequestId,
6730 /// Tool call ID from the LLM completion; used to correlate with CompletionChunk.toolCall.id for remote UIs
6731 #[serde(skip_serializing_if = "Option::is_none")]
6732 pub tool_call_id: Option<String>,
6733 /// URL to open in the user's browser (url mode only)
6734 #[serde(skip_serializing_if = "Option::is_none")]
6735 pub url: Option<String>,
6736}
6737
6738/// Session event "elicitation.completed". Elicitation request completion with the user's response
6739#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6740#[serde(rename_all = "camelCase")]
6741pub struct ElicitationCompletedData {
6742 /// The user action: "accept" (submitted form), "decline" (explicitly refused), or "cancel" (dismissed)
6743 #[serde(skip_serializing_if = "Option::is_none")]
6744 pub action: Option<ElicitationCompletedAction>,
6745 /// The submitted form data when action is 'accept'; keys match the requested schema fields
6746 #[serde(skip_serializing_if = "Option::is_none")]
6747 pub content: Option<HashMap<String, serde_json::Value>>,
6748 /// Request ID of the resolved elicitation request; clients should dismiss any UI for this request
6749 pub request_id: RequestId,
6750}
6751
6752/// Session event "sampling.requested". Sampling request from an MCP server; contains the server name and a requestId for correlation
6753#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6754#[serde(rename_all = "camelCase")]
6755pub struct SamplingRequestedData {
6756 /// The JSON-RPC request ID from the MCP protocol
6757 pub mcp_request_id: serde_json::Value,
6758 /// Unique identifier for this sampling request; used to respond via session.respondToSampling()
6759 pub request_id: RequestId,
6760 /// Name of the MCP server that initiated the sampling request
6761 pub server_name: String,
6762}
6763
6764/// Session event "sampling.completed". Sampling request completion notification signaling UI dismissal
6765#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6766#[serde(rename_all = "camelCase")]
6767pub struct SamplingCompletedData {
6768 /// Request ID of the resolved sampling request; clients should dismiss any UI for this request
6769 pub request_id: RequestId,
6770}
6771
6772/// Single HTTP header entry as a name/value pair.
6773#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6774#[serde(rename_all = "camelCase")]
6775pub struct HeaderEntry {
6776 /// HTTP response header name as observed by the runtime.
6777 pub name: String,
6778 /// HTTP response header value as observed by the runtime.
6779 pub value: String,
6780}
6781
6782/// Raw HTTP response details from the OAuth auth challenge, as observed by the runtime.
6783#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6784#[serde(rename_all = "camelCase")]
6785pub struct McpOauthHttpResponse {
6786 /// 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.
6787 #[serde(skip_serializing_if = "Option::is_none")]
6788 pub body: Option<String>,
6789 /// HTTP response headers as observed by the runtime. Order and casing are transport-dependent, and duplicate header names may appear multiple times.
6790 pub headers: Vec<HeaderEntry>,
6791 /// HTTP status code returned with the auth challenge.
6792 pub status_code: i32,
6793}
6794
6795/// Static OAuth client configuration, if the server specifies one
6796#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6797#[serde(rename_all = "camelCase")]
6798pub struct McpOauthRequiredStaticClientConfig {
6799 /// OAuth client ID for the server
6800 pub client_id: String,
6801 /// Optional OAuth client secret for confidential static clients, when the runtime can resolve one
6802 #[serde(skip_serializing_if = "Option::is_none")]
6803 pub client_secret: Option<String>,
6804 /// 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).
6805 #[serde(skip_serializing_if = "Option::is_none")]
6806 pub grant_type: Option<McpOauthRequiredStaticClientConfigGrantType>,
6807 /// Whether this is a public OAuth client
6808 #[serde(skip_serializing_if = "Option::is_none")]
6809 pub public_client: Option<bool>,
6810}
6811
6812/// OAuth WWW-Authenticate parameters parsed from an MCP auth challenge
6813#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6814#[serde(rename_all = "camelCase")]
6815pub struct McpOauthWWWAuthenticateParams {
6816 /// OAuth error from the WWW-Authenticate error parameter, if present
6817 #[serde(skip_serializing_if = "Option::is_none")]
6818 pub error: Option<String>,
6819 /// Protected resource metadata URL from the WWW-Authenticate resource_metadata parameter, if present
6820 #[serde(skip_serializing_if = "Option::is_none")]
6821 pub resource_metadata_url: Option<String>,
6822 /// Requested OAuth scopes from the WWW-Authenticate scope parameter, if present
6823 #[serde(skip_serializing_if = "Option::is_none")]
6824 pub scope: Option<String>,
6825}
6826
6827/// Session event "mcp.oauth_required". OAuth authentication request for an MCP server
6828#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6829#[serde(rename_all = "camelCase")]
6830pub struct McpOauthRequiredData {
6831 /// 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.
6832 #[serde(skip_serializing_if = "Option::is_none")]
6833 pub http_response: Option<McpOauthHttpResponse>,
6834 /// Why the runtime is requesting host-provided OAuth credentials.
6835 pub reason: McpOauthRequestReason,
6836 /// Unique identifier for this OAuth request; used to respond via session.mcp.oauth.handlePendingRequest
6837 pub request_id: RequestId,
6838 /// Raw OAuth protected-resource metadata document fetched for the MCP server, if available
6839 #[serde(skip_serializing_if = "Option::is_none")]
6840 pub resource_metadata: Option<String>,
6841 /// Display name of the MCP server that requires OAuth
6842 pub server_name: String,
6843 /// URL of the MCP server that requires OAuth
6844 pub server_url: String,
6845 /// Static OAuth client configuration, if the server specifies one
6846 #[serde(skip_serializing_if = "Option::is_none")]
6847 pub static_client_config: Option<McpOauthRequiredStaticClientConfig>,
6848 /// OAuth WWW-Authenticate parameters parsed from the auth challenge, if available
6849 #[serde(skip_serializing_if = "Option::is_none")]
6850 pub www_authenticate_params: Option<McpOauthWWWAuthenticateParams>,
6851}
6852
6853/// Session event "mcp.oauth_completed". MCP OAuth request completion notification
6854#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6855#[serde(rename_all = "camelCase")]
6856pub struct McpOauthCompletedData {
6857 /// How the pending OAuth request was completed
6858 pub outcome: McpOauthCompletionOutcome,
6859 /// Request ID of the resolved OAuth request
6860 pub request_id: RequestId,
6861}
6862
6863/// Session event "mcp.headers_refresh_required". Dynamic headers refresh request for a remote MCP server
6864#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6865#[serde(rename_all = "camelCase")]
6866pub struct McpHeadersRefreshRequiredData {
6867 /// Why dynamic headers are being requested.
6868 pub reason: McpHeadersRefreshRequiredReason,
6869 /// Unique identifier for this headers refresh request; used to respond via session.mcp.headers.handlePendingHeadersRefreshRequest()
6870 pub request_id: RequestId,
6871 /// Display name of the remote MCP server requesting headers
6872 pub server_name: String,
6873 /// URL of the remote MCP server requesting headers
6874 pub server_url: String,
6875}
6876
6877/// Session event "mcp.headers_refresh_completed". MCP headers refresh request completion notification
6878#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6879#[serde(rename_all = "camelCase")]
6880pub struct McpHeadersRefreshCompletedData {
6881 /// How the pending MCP headers refresh request resolved.
6882 pub outcome: McpHeadersRefreshCompletedOutcome,
6883 /// Request ID of the resolved headers refresh request
6884 pub request_id: RequestId,
6885}
6886
6887/// Session event "session.custom_notification". Opaque custom notification data. Consumers may branch on source and name, but payload semantics are source-defined.
6888#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6889#[serde(rename_all = "camelCase")]
6890pub struct SessionCustomNotificationData {
6891 /// Source-defined custom notification name
6892 pub name: String,
6893 /// Source-defined JSON payload for the custom notification
6894 pub payload: serde_json::Value,
6895 /// Namespace for the custom notification producer
6896 pub source: String,
6897 /// Optional source-defined string identifiers describing the payload subject
6898 #[serde(skip_serializing_if = "Option::is_none")]
6899 pub subject: Option<HashMap<String, String>>,
6900 /// Optional source-defined payload schema version
6901 #[serde(skip_serializing_if = "Option::is_none")]
6902 pub version: Option<i64>,
6903}
6904
6905/// Session event "ui.ephemeral_query". Ordered output and terminal state for a transient query that does not modify conversation history.
6906///
6907/// <div class="warning">
6908///
6909/// **Experimental.** This type is part of an experimental wire-protocol surface
6910/// and may change or be removed in future SDK or CLI releases.
6911///
6912/// </div>
6913#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6914#[serde(rename_all = "camelCase")]
6915pub struct UiEphemeralQueryData {
6916 /// Full response text, present for the `completed` phase.
6917 #[serde(skip_serializing_if = "Option::is_none")]
6918 pub answer: Option<String>,
6919 /// Ordered text delta, present for the `chunk` phase.
6920 #[serde(skip_serializing_if = "Option::is_none")]
6921 pub chunk: Option<String>,
6922 /// Model or transport failure message, present for the `failed` phase.
6923 #[serde(skip_serializing_if = "Option::is_none")]
6924 pub error: Option<String>,
6925 /// Current query lifecycle phase.
6926 pub phase: UIEphemeralQueryPhase,
6927 /// Runtime-minted query identifier.
6928 pub request_id: RequestId,
6929}
6930
6931/// Session event "external_tool.requested". External tool invocation request for client-side tool execution
6932#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6933#[serde(rename_all = "camelCase")]
6934pub struct ExternalToolRequestedData {
6935 /// Arguments to pass to the external tool
6936 #[serde(skip_serializing_if = "Option::is_none")]
6937 pub arguments: Option<serde_json::Value>,
6938 /// 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
6939 #[serde(skip_serializing_if = "Option::is_none")]
6940 pub provider_id: Option<String>,
6941 /// Unique identifier for this request; used to respond via session.respondToExternalTool()
6942 pub request_id: RequestId,
6943 /// Session ID that this external tool request belongs to
6944 pub session_id: SessionId,
6945 /// Tool call ID assigned to this external tool invocation
6946 pub tool_call_id: String,
6947 /// Name of the external tool to invoke
6948 pub tool_name: String,
6949 /// W3C Trace Context traceparent header for the execute_tool span
6950 #[serde(skip_serializing_if = "Option::is_none")]
6951 pub traceparent: Option<String>,
6952 /// W3C Trace Context tracestate header for the execute_tool span
6953 #[serde(skip_serializing_if = "Option::is_none")]
6954 pub tracestate: Option<String>,
6955 /// Active session working directory, when known.
6956 #[serde(skip_serializing_if = "Option::is_none")]
6957 pub working_directory: Option<String>,
6958}
6959
6960/// Session event "external_tool.completed". External tool completion notification signaling UI dismissal
6961#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6962#[serde(rename_all = "camelCase")]
6963pub struct ExternalToolCompletedData {
6964 /// Request ID of the resolved external tool request; clients should dismiss any UI for this request
6965 pub request_id: RequestId,
6966}
6967
6968/// Session event "command.queued". Queued slash command dispatch request for client execution
6969#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6970#[serde(rename_all = "camelCase")]
6971pub struct CommandQueuedData {
6972 /// The slash command text to be executed (e.g., /help, /clear)
6973 pub command: String,
6974 /// Unique identifier for this request; used to respond via session.respondToQueuedCommand()
6975 pub request_id: RequestId,
6976}
6977
6978/// Session event "command.execute". Registered command dispatch request routed to the owning client
6979#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6980#[serde(rename_all = "camelCase")]
6981pub struct CommandExecuteData {
6982 /// Raw argument string after the command name
6983 pub args: String,
6984 /// The full command text (e.g., /deploy production)
6985 pub command: String,
6986 /// Command name without leading /
6987 pub command_name: String,
6988 /// Unique identifier; used to respond via session.commands.handlePendingCommand()
6989 pub request_id: RequestId,
6990}
6991
6992/// Session event "command.completed". Queued command completion notification signaling UI dismissal
6993#[derive(Debug, Clone, Default, Serialize, Deserialize)]
6994#[serde(rename_all = "camelCase")]
6995pub struct CommandCompletedData {
6996 /// Request ID of the resolved command request; clients should dismiss any UI for this request
6997 pub request_id: RequestId,
6998}
6999
7000/// Session event "auto_mode_switch.requested". Auto mode switch request notification requiring user approval
7001#[derive(Debug, Clone, Default, Serialize, Deserialize)]
7002#[serde(rename_all = "camelCase")]
7003pub struct AutoModeSwitchRequestedData {
7004 /// The rate limit error code that triggered this request
7005 #[serde(skip_serializing_if = "Option::is_none")]
7006 pub error_code: Option<String>,
7007 /// Unique identifier for this request; used to respond via session.respondToAutoModeSwitch()
7008 pub request_id: RequestId,
7009 /// Seconds until the rate limit resets, when known. Lets clients render a humanized reset time alongside the prompt.
7010 #[serde(skip_serializing_if = "Option::is_none")]
7011 pub retry_after_seconds: Option<i64>,
7012}
7013
7014/// Session event "auto_mode_switch.completed". Auto mode switch completion notification
7015#[derive(Debug, Clone, Default, Serialize, Deserialize)]
7016#[serde(rename_all = "camelCase")]
7017pub struct AutoModeSwitchCompletedData {
7018 /// Request ID of the resolved request; clients should dismiss any UI for this request
7019 pub request_id: RequestId,
7020 /// The user's auto-mode-switch choice
7021 pub response: AutoModeSwitchResponse,
7022}
7023
7024/// Session event "session_limits_exhausted.requested". Session limit exhaustion notification requiring user action.
7025#[derive(Debug, Clone, Default, Serialize, Deserialize)]
7026#[serde(rename_all = "camelCase")]
7027pub struct SessionLimitsExhaustedRequestedData {
7028 /// Configured max AI Credits for the current accounting window.
7029 pub max_ai_credits: f64,
7030 /// Unique identifier for this request; used to respond via session.ui.handlePendingSessionLimitsExhausted().
7031 pub request_id: RequestId,
7032 /// AI Credits already consumed in the current accounting window.
7033 pub used_ai_credits: f64,
7034}
7035
7036/// The user's selected action for an exhausted session limit.
7037#[derive(Debug, Clone, Default, Serialize, Deserialize)]
7038#[serde(rename_all = "camelCase")]
7039pub struct SessionLimitsExhaustedResponse {
7040 /// Action selected by the user.
7041 pub action: SessionLimitsExhaustedResponseAction,
7042 /// AI Credits to add to the current max when action is 'add'.
7043 #[serde(skip_serializing_if = "Option::is_none")]
7044 pub additional_ai_credits: Option<f64>,
7045 /// New absolute max AI Credits when action is 'set'.
7046 #[serde(skip_serializing_if = "Option::is_none")]
7047 pub max_ai_credits: Option<f64>,
7048}
7049
7050/// Session event "session_limits_exhausted.completed". Session limit exhaustion prompt completion notification.
7051#[derive(Debug, Clone, Default, Serialize, Deserialize)]
7052#[serde(rename_all = "camelCase")]
7053pub struct SessionLimitsExhaustedCompletedData {
7054 /// Request ID of the resolved request; clients should dismiss any UI for this request.
7055 pub request_id: RequestId,
7056 /// The user's selected session-limit action.
7057 pub response: SessionLimitsExhaustedResponse,
7058}
7059
7060/// 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.
7061///
7062/// <div class="warning">
7063///
7064/// **Experimental.** This type is part of an experimental wire-protocol surface
7065/// and may change or be removed in future SDK or CLI releases.
7066///
7067/// </div>
7068#[derive(Debug, Clone, Default, Serialize, Deserialize)]
7069#[serde(rename_all = "camelCase")]
7070pub struct SessionAutoModeResolvedData {
7071 /// Models offered to the router for this resolution
7072 #[serde(skip_serializing_if = "Option::is_none")]
7073 pub available_models: Option<Vec<String>>,
7074 /// Ordered candidate model list the router returned, when not a fallback
7075 #[serde(skip_serializing_if = "Option::is_none")]
7076 pub candidate_models: Option<Vec<String>>,
7077 /// 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.
7078 #[serde(skip_serializing_if = "Option::is_none")]
7079 pub category_scores: Option<HashMap<String, f64>>,
7080 /// The concrete model the session will use after any intent refinement
7081 pub chosen_model: String,
7082 /// The chosen model's score shortfall relative to the top candidate
7083 #[serde(skip_serializing_if = "Option::is_none")]
7084 pub chosen_shortfall: Option<f64>,
7085 /// Classifier confidence for the predicted label, when available
7086 #[serde(skip_serializing_if = "Option::is_none")]
7087 pub confidence: Option<f64>,
7088 /// End-to-end client wait time for the router request in milliseconds
7089 #[serde(skip_serializing_if = "Option::is_none")]
7090 pub end_to_end_latency_ms: Option<f64>,
7091 /// Whether the router fell back to the standard Auto selection
7092 #[serde(skip_serializing_if = "Option::is_none")]
7093 pub fallback: Option<bool>,
7094 /// Server-provided reason for falling back, when available
7095 #[serde(skip_serializing_if = "Option::is_none")]
7096 pub fallback_reason: Option<String>,
7097 /// Whether the routed prompt contained an image
7098 #[serde(skip_serializing_if = "Option::is_none")]
7099 pub has_image: Option<bool>,
7100 /// The predicted classifier label (e.g. `needs_reasoning`), when available
7101 #[serde(skip_serializing_if = "Option::is_none")]
7102 pub predicted_label: Option<String>,
7103 /// Coarse request-difficulty bucket, for explaining why a model was chosen ("picked X because this looks like high-reasoning work")
7104 #[serde(skip_serializing_if = "Option::is_none")]
7105 pub reasoning_bucket: Option<AutoModeResolvedReasoningBucket>,
7106 /// Server-reported router processing time in milliseconds
7107 #[serde(skip_serializing_if = "Option::is_none")]
7108 pub router_latency_ms: Option<f64>,
7109 /// The routing method the server applied, when Auto Intent ran
7110 #[serde(skip_serializing_if = "Option::is_none")]
7111 pub routing_method: Option<String>,
7112 /// Whether a sticky model choice overrode the router result
7113 #[serde(skip_serializing_if = "Option::is_none")]
7114 pub sticky_override: Option<bool>,
7115}
7116
7117/// 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.
7118///
7119/// <div class="warning">
7120///
7121/// **Experimental.** This type is part of an experimental wire-protocol surface
7122/// and may change or be removed in future SDK or CLI releases.
7123///
7124/// </div>
7125#[derive(Debug, Clone, Default, Serialize, Deserialize)]
7126#[serde(rename_all = "camelCase")]
7127pub struct SessionManagedSettingsResolvedData {
7128 /// Whether enterprise policy disables bypass-permissions ("yolo") mode for this session. Deny-wins across layers, and forced on when `failClosed` is true.
7129 pub bypass_permissions_disabled: bool,
7130 /// Whether a session-local permissions layer injected by the SDK host was present
7131 #[serde(skip_serializing_if = "Option::is_none")]
7132 pub client_managed: Option<bool>,
7133 /// Whether an actual device MDM/plist/registry/file managed-settings layer was present
7134 pub device_managed: bool,
7135 /// 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.
7136 pub fail_closed: bool,
7137 /// The setting keys under enterprise management in the effective managed settings (e.g. `model`, `enabledPlugins`, `permissions`). Empty when no managed settings are in force.
7138 pub managed_keys: Vec<String>,
7139 /// Whether at least two managed sources supplied permission allowlists, so enforcement intersects them and the flattened settings payload omits `permissions.allow`.
7140 #[serde(skip_serializing_if = "Option::is_none")]
7141 pub permissions_allow_intersected: Option<bool>,
7142 /// 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.
7143 #[serde(skip_serializing_if = "Option::is_none")]
7144 pub policy_helper_managed: Option<bool>,
7145 /// 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.
7146 #[serde(skip_serializing_if = "Option::is_none")]
7147 pub sandbox_enabled_by_undetermined_policy: Option<bool>,
7148 /// Whether the server (account/org) managed-settings layer was present
7149 pub server_managed: bool,
7150 /// The effective (resolved) managed settings values, so clients can render exactly what is enforced. Absent when no managed policy is in force.
7151 #[serde(skip_serializing_if = "Option::is_none")]
7152 pub settings: Option<serde_json::Value>,
7153 /// 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.
7154 pub source: ManagedSettingsResolvedSource,
7155}
7156
7157/// 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.
7158///
7159/// <div class="warning">
7160///
7161/// **Experimental.** This type is part of an experimental wire-protocol surface
7162/// and may change or be removed in future SDK or CLI releases.
7163///
7164/// </div>
7165#[derive(Debug, Clone, Default, Serialize, Deserialize)]
7166#[serde(rename_all = "camelCase")]
7167pub struct SessionManagedSettingsEnforcedData {
7168 /// The category of runtime action that managed policy governed.
7169 pub action: ManagedSettingsEnforcedAction,
7170 /// For a `bypass_permissions_blocked` action, which permission-escalation primitive was refused. Absent for actions without a specific escalation primitive.
7171 #[serde(skip_serializing_if = "Option::is_none")]
7172 pub escalation: Option<ManagedSettingsEnforcedEscalation>,
7173 /// 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.
7174 pub fail_closed: bool,
7175 /// A human-readable explanation of why the action was governed, suitable for surfacing to the user.
7176 pub message: String,
7177 /// The managed setting key responsible for the enforcement (e.g. `permissions.disableBypassPermissionsMode`).
7178 pub setting: String,
7179}
7180
7181/// A single slash command available in the session, as listed by the `commands.changed` event.
7182#[derive(Debug, Clone, Default, Serialize, Deserialize)]
7183#[serde(rename_all = "camelCase")]
7184pub struct CommandsChangedCommand {
7185 /// Optional human-readable command description.
7186 #[serde(skip_serializing_if = "Option::is_none")]
7187 pub description: Option<String>,
7188 /// Slash command name without the leading slash.
7189 pub name: String,
7190}
7191
7192/// Session event "commands.changed". SDK command registration change notification
7193#[derive(Debug, Clone, Default, Serialize, Deserialize)]
7194#[serde(rename_all = "camelCase")]
7195pub struct CommandsChangedData {
7196 /// Current list of registered SDK commands
7197 pub commands: Vec<CommandsChangedCommand>,
7198}
7199
7200/// UI capability changes
7201#[derive(Debug, Clone, Default, Serialize, Deserialize)]
7202#[serde(rename_all = "camelCase")]
7203pub struct CapabilitiesChangedUI {
7204 /// Whether canvas rendering is now supported
7205 #[serde(skip_serializing_if = "Option::is_none")]
7206 pub canvases: Option<bool>,
7207 /// Whether elicitation is now supported
7208 #[serde(skip_serializing_if = "Option::is_none")]
7209 pub elicitation: Option<bool>,
7210 /// Whether MCP Apps (SEP-1865) UI passthrough is now supported
7211 #[serde(skip_serializing_if = "Option::is_none")]
7212 pub mcp_apps: Option<bool>,
7213}
7214
7215/// Session event "capabilities.changed". Session capability change notification
7216#[derive(Debug, Clone, Default, Serialize, Deserialize)]
7217#[serde(rename_all = "camelCase")]
7218pub struct CapabilitiesChangedData {
7219 /// UI capability changes
7220 #[serde(skip_serializing_if = "Option::is_none")]
7221 pub ui: Option<CapabilitiesChangedUI>,
7222}
7223
7224/// Session event "exit_plan_mode.requested". Plan approval request with plan content and available user actions
7225#[derive(Debug, Clone, Default, Serialize, Deserialize)]
7226#[serde(rename_all = "camelCase")]
7227pub struct ExitPlanModeRequestedData {
7228 /// Available actions the user can take
7229 pub actions: Vec<ExitPlanModeAction>,
7230 /// Model the session had selected when the plan was authored, when one is known
7231 #[serde(skip_serializing_if = "Option::is_none")]
7232 pub model: Option<String>,
7233 /// Full content of the plan file
7234 pub plan_content: String,
7235 /// Recommended action to preselect for the user
7236 pub recommended_action: ExitPlanModeAction,
7237 /// Unique identifier for this request; used to respond via session.respondToExitPlanMode()
7238 pub request_id: RequestId,
7239 /// Summary of the plan that was created
7240 pub summary: String,
7241}
7242
7243/// Session event "exit_plan_mode.completed". Plan mode exit completion with the user's approval decision and optional feedback
7244#[derive(Debug, Clone, Default, Serialize, Deserialize)]
7245#[serde(rename_all = "camelCase")]
7246pub struct ExitPlanModeCompletedData {
7247 /// Whether the plan was approved by the user
7248 #[serde(skip_serializing_if = "Option::is_none")]
7249 pub approved: Option<bool>,
7250 /// Whether edits should be auto-approved without confirmation
7251 #[serde(skip_serializing_if = "Option::is_none")]
7252 pub auto_approve_edits: Option<bool>,
7253 /// Free-form feedback from the user if they requested changes to the plan
7254 #[serde(skip_serializing_if = "Option::is_none")]
7255 pub feedback: Option<String>,
7256 /// Request ID of the resolved exit plan mode request; clients should dismiss any UI for this request
7257 pub request_id: RequestId,
7258 /// Action selected by the user
7259 #[serde(skip_serializing_if = "Option::is_none")]
7260 pub selected_action: Option<ExitPlanModeAction>,
7261}
7262
7263/// Session event "session.tools_updated". Payload of `session.tools_updated` identifying the model whose resolved tools were updated.
7264#[derive(Debug, Clone, Default, Serialize, Deserialize)]
7265#[serde(rename_all = "camelCase")]
7266pub struct SessionToolsUpdatedData {
7267 /// Identifier of the model the resolved tools apply to.
7268 pub model: String,
7269}
7270
7271/// Session event "session.background_tasks_changed". Empty payload for `session.background_tasks_changed`, indicating background task state changed.
7272#[derive(Debug, Clone, Default, Serialize, Deserialize)]
7273#[serde(rename_all = "camelCase")]
7274pub struct SessionBackgroundTasksChangedData {}
7275
7276/// Session event "factory.run_updated". Ephemeral invalidation signal for a changed factory run.
7277///
7278/// <div class="warning">
7279///
7280/// **Experimental.** This type is part of an experimental wire-protocol surface
7281/// and may change or be removed in future SDK or CLI releases.
7282///
7283/// </div>
7284#[derive(Debug, Clone, Default, Serialize, Deserialize)]
7285#[serde(rename_all = "camelCase")]
7286pub struct FactoryRunUpdatedData {
7287 /// Monotonic revision now available for the run.
7288 pub revision: i64,
7289 /// Factory run identifier.
7290 pub run_id: String,
7291}
7292
7293/// Session event "factory.run_started". Ephemeral signal that a factory run attempt began executing.
7294///
7295/// <div class="warning">
7296///
7297/// **Experimental.** This type is part of an experimental wire-protocol surface
7298/// and may change or be removed in future SDK or CLI releases.
7299///
7300/// </div>
7301#[derive(Debug, Clone, Default, Serialize, Deserialize)]
7302#[serde(rename_all = "camelCase")]
7303pub struct FactoryRunStartedData {
7304 /// Attempt number this start committed; a resumed run increments it.
7305 pub attempt: i64,
7306 /// Name of the factory this run executes. Low cardinality by construction.
7307 pub factory_name: String,
7308 /// Identifier of the factory run that started.
7309 pub run_id: String,
7310}
7311
7312/// Session event "factory.run_settled". Ephemeral signal that a factory run reached a terminal status.
7313///
7314/// <div class="warning">
7315///
7316/// **Experimental.** This type is part of an experimental wire-protocol surface
7317/// and may change or be removed in future SDK or CLI releases.
7318///
7319/// </div>
7320#[derive(Debug, Clone, Default, Serialize, Deserialize)]
7321#[serde(rename_all = "camelCase")]
7322pub struct FactoryRunSettledData {
7323 /// AI credits this run consumed, in nano-AIU.
7324 pub consumed_nano_aiu: i64,
7325 /// Subagents this run consumed against its limits.
7326 pub consumed_subagents: i64,
7327 /// Active milliseconds accumulated across every attempt of this run.
7328 pub elapsed_ms: i64,
7329 /// Typed failure class recorded on the run, when it failed with one (e.g. `factory_limit_reached`).
7330 #[serde(skip_serializing_if = "Option::is_none")]
7331 pub failure_type: Option<String>,
7332 /// Identifier of the factory run that settled.
7333 pub run_id: String,
7334 /// Terminal status the run committed.
7335 pub status: FactoryRunSettledStatus,
7336}
7337
7338/// A single resolved skill in `session.skills_loaded`, including source, invocability, enabled state, path, and argument hint.
7339#[derive(Debug, Clone, Default, Serialize, Deserialize)]
7340#[serde(rename_all = "camelCase")]
7341pub struct SkillsLoadedSkill {
7342 /// Optional freeform hint describing the skill's expected arguments, from the `argument-hint` frontmatter field
7343 #[serde(skip_serializing_if = "Option::is_none")]
7344 pub argument_hint: Option<String>,
7345 /// Canonical slash command name used to invoke the skill, without the leading '/'
7346 #[serde(skip_serializing_if = "Option::is_none")]
7347 pub command_name: Option<String>,
7348 /// Description of what the skill does
7349 pub description: String,
7350 /// Whether the skill is currently enabled
7351 pub enabled: bool,
7352 /// Unique identifier for the skill
7353 pub name: String,
7354 /// Absolute path to the skill file, if available
7355 #[serde(skip_serializing_if = "Option::is_none")]
7356 pub path: Option<String>,
7357 /// Source location type (e.g., project, personal-copilot, plugin, builtin, remote, sdk)
7358 pub source: SkillSource,
7359 /// Whether the skill can be invoked by the user as a slash command
7360 pub user_invocable: bool,
7361}
7362
7363/// Session event "session.skills_loaded". Payload of `session.skills_loaded` listing resolved skill metadata.
7364#[derive(Debug, Clone, Default, Serialize, Deserialize)]
7365#[serde(rename_all = "camelCase")]
7366pub struct SessionSkillsLoadedData {
7367 /// Array of resolved skill metadata
7368 pub skills: Vec<SkillsLoadedSkill>,
7369}
7370
7371/// A single loaded custom agent in `session.custom_agents_updated`, with identity, source, tools, invocability, and authored model configuration.
7372#[derive(Debug, Clone, Default, Serialize, Deserialize)]
7373#[serde(rename_all = "camelCase")]
7374pub struct CustomAgentsUpdatedAgent {
7375 /// Description of what the agent does
7376 pub description: String,
7377 /// Whether model-driven invocation is disabled for this agent.
7378 #[serde(skip_serializing_if = "Option::is_none")]
7379 pub disable_model_invocation: Option<bool>,
7380 /// Human-readable display name
7381 pub display_name: String,
7382 /// Unique identifier for the agent
7383 pub id: String,
7384 /// Model override for this agent, if set
7385 #[serde(skip_serializing_if = "Option::is_none")]
7386 pub model: Option<String>,
7387 /// Whether authored models are preferences or required constraints
7388 #[serde(skip_serializing_if = "Option::is_none")]
7389 pub model_policy: Option<AgentModelPolicy>,
7390 /// Authored model ids in priority order, if configured
7391 #[serde(skip_serializing_if = "Option::is_none")]
7392 pub models: Option<Vec<String>>,
7393 /// Internal name of the agent
7394 pub name: String,
7395 /// Source location: user, project, inherited, remote, or plugin
7396 pub source: String,
7397 /// List of tool names available to this agent, or null when all tools are available
7398 pub tools: Option<Vec<String>>,
7399 /// Whether the agent can be selected by the user
7400 pub user_invocable: bool,
7401}
7402
7403/// Session event "session.custom_agents_updated". Payload of `session.custom_agents_updated` with loaded custom agents plus non-fatal warnings and fatal errors.
7404#[derive(Debug, Clone, Default, Serialize, Deserialize)]
7405#[serde(rename_all = "camelCase")]
7406pub struct SessionCustomAgentsUpdatedData {
7407 /// Array of loaded custom agent metadata
7408 pub agents: Vec<CustomAgentsUpdatedAgent>,
7409 /// Fatal errors from agent loading
7410 pub errors: Vec<String>,
7411 /// Non-fatal warnings from agent loading
7412 pub warnings: Vec<String>,
7413}
7414
7415/// Server-advertised metadata learned through modern discovery or legacy initialization.
7416#[derive(Debug, Clone, Default, Serialize, Deserialize)]
7417#[serde(rename_all = "camelCase")]
7418pub struct McpServerMetadata {
7419 /// Non-empty natural-language guidance for using the server, or null when the server omitted instructions or advertised an empty string.
7420 pub instructions: Option<String>,
7421}
7422
7423/// A single MCP server status summary in `session.mcp_servers_loaded`, including name, status, source, transport, and plugin metadata.
7424#[derive(Debug, Clone, Default, Serialize, Deserialize)]
7425#[serde(rename_all = "camelCase")]
7426pub struct McpServersLoadedServer {
7427 /// Human-readable display name supplied by a managed server catalog.
7428 #[serde(skip_serializing_if = "Option::is_none")]
7429 pub display_name: Option<String>,
7430 /// Error message if the server failed to connect
7431 #[serde(skip_serializing_if = "Option::is_none")]
7432 pub error: Option<String>,
7433 /// Server name (config key)
7434 pub name: String,
7435 /// Name of the plugin that supplied the effective MCP server config, only when source is plugin
7436 #[serde(skip_serializing_if = "Option::is_none")]
7437 pub plugin_name: Option<String>,
7438 /// Version of the plugin that supplied the effective MCP server config, only when source is plugin
7439 #[serde(skip_serializing_if = "Option::is_none")]
7440 pub plugin_version: Option<String>,
7441 /// 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.
7442 #[serde(skip_serializing_if = "Option::is_none")]
7443 pub server_metadata: Option<McpServerMetadata>,
7444 /// Configuration source: user, workspace, plugin, builtin, or managed
7445 #[serde(skip_serializing_if = "Option::is_none")]
7446 pub source: Option<McpServerSource>,
7447 /// Connection status: connected, failed, needs-auth, pending, disabled, stopped, or not_configured
7448 pub status: McpServerStatus,
7449 /// Transport mechanism: stdio, http, sse (deprecated), or memory (in-process MCP server)
7450 #[serde(skip_serializing_if = "Option::is_none")]
7451 pub transport: Option<McpServerTransport>,
7452}
7453
7454/// Session event "session.mcp_servers_loaded". Payload of `session.mcp_servers_loaded` listing MCP server status summaries.
7455#[derive(Debug, Clone, Default, Serialize, Deserialize)]
7456#[serde(rename_all = "camelCase")]
7457pub struct SessionMcpServersLoadedData {
7458 /// Array of MCP server status summaries
7459 pub servers: Vec<McpServersLoadedServer>,
7460}
7461
7462/// Session event "session.mcp_server_status_changed". Payload of `session.mcp_server_status_changed` for one MCP server's status and optional failure error.
7463#[derive(Debug, Clone, Default, Serialize, Deserialize)]
7464#[serde(rename_all = "camelCase")]
7465pub struct SessionMcpServerStatusChangedData {
7466 /// Error message if the server entered a failed state
7467 #[serde(skip_serializing_if = "Option::is_none")]
7468 pub error: Option<String>,
7469 /// Name of the MCP server whose status changed
7470 pub server_name: String,
7471 /// Connection status: connected, failed, needs-auth, pending, disabled, stopped, or not_configured
7472 pub status: McpServerStatus,
7473}
7474
7475/// Session event "session.mcp_server_removed". Payload of `session.mcp_server_removed` identifying an MCP server the graph no longer runs.
7476#[derive(Debug, Clone, Default, Serialize, Deserialize)]
7477#[serde(rename_all = "camelCase")]
7478pub struct SessionMcpServerRemovedData {
7479 /// Name of the MCP server that was removed from the graph
7480 pub server_name: String,
7481}
7482
7483/// Session event "session.mcp_server_needs_reconnect". Payload of `session.mcp_server_needs_reconnect` identifying an MCP server whose connection must be re-established.
7484#[derive(Debug, Clone, Default, Serialize, Deserialize)]
7485#[serde(rename_all = "camelCase")]
7486pub struct SessionMcpServerNeedsReconnectData {
7487 /// Name of the MCP server that needs to reconnect
7488 pub server_name: String,
7489}
7490
7491/// Session event "mcp.tools.list_changed". Payload identifying the MCP server associated with a list change.
7492#[derive(Debug, Clone, Default, Serialize, Deserialize)]
7493#[serde(rename_all = "camelCase")]
7494pub struct McpToolsListChangedData {
7495 /// Name of the MCP server whose list changed
7496 pub server_name: String,
7497}
7498
7499/// Session event "mcp.resources.list_changed". Payload identifying the MCP server associated with a list change.
7500#[derive(Debug, Clone, Default, Serialize, Deserialize)]
7501#[serde(rename_all = "camelCase")]
7502pub struct McpResourcesListChangedData {
7503 /// Name of the MCP server whose list changed
7504 pub server_name: String,
7505}
7506
7507/// Session event "mcp.prompts.list_changed". Payload identifying the MCP server associated with a list change.
7508#[derive(Debug, Clone, Default, Serialize, Deserialize)]
7509#[serde(rename_all = "camelCase")]
7510pub struct McpPromptsListChangedData {
7511 /// Name of the MCP server whose list changed
7512 pub server_name: String,
7513}
7514
7515/// A single extension discovered by `session.extensions_loaded`, including qualified ID, source, and current status.
7516#[derive(Debug, Clone, Default, Serialize, Deserialize)]
7517#[serde(rename_all = "camelCase")]
7518pub struct ExtensionsLoadedExtension {
7519 /// Source-qualified extension ID (e.g., 'project:my-ext', 'user:auth-helper', 'plugin:my-plugin:my-ext')
7520 pub id: String,
7521 /// Extension name (directory name)
7522 pub name: String,
7523 /// Discovery source
7524 pub source: ExtensionsLoadedExtensionSource,
7525 /// Current status: running, disabled, failed, or starting
7526 pub status: ExtensionsLoadedExtensionStatus,
7527}
7528
7529/// Session event "session.extensions_loaded". Payload of `session.extensions_loaded` listing discovered extensions and their statuses.
7530#[derive(Debug, Clone, Default, Serialize, Deserialize)]
7531#[serde(rename_all = "camelCase")]
7532pub struct SessionExtensionsLoadedData {
7533 /// Array of discovered extensions and their status
7534 pub extensions: Vec<ExtensionsLoadedExtension>,
7535}
7536
7537/// Session event "session.canvas.opened". Payload of `session.canvas.opened` with canvas instance and provider IDs plus optional icon, title, status, URL, and input.
7538///
7539/// <div class="warning">
7540///
7541/// **Experimental.** This type is part of an experimental wire-protocol surface
7542/// and may change or be removed in future SDK or CLI releases.
7543///
7544/// </div>
7545#[derive(Debug, Clone, Default, Serialize, Deserialize)]
7546#[serde(rename_all = "camelCase")]
7547pub struct SessionCanvasOpenedData {
7548 /// Provider-local canvas identifier
7549 pub canvas_id: String,
7550 /// Owning provider identifier
7551 pub extension_id: String,
7552 /// Owning extension display name, when available
7553 #[serde(skip_serializing_if = "Option::is_none")]
7554 pub extension_name: Option<String>,
7555 /// Host-local PNG path for the canvas icon, when supplied
7556 #[serde(skip_serializing_if = "Option::is_none")]
7557 pub icon: Option<String>,
7558 /// Input supplied when the instance was opened
7559 #[serde(skip_serializing_if = "Option::is_none")]
7560 pub input: Option<serde_json::Value>,
7561 /// Stable caller-supplied canvas instance identifier
7562 pub instance_id: String,
7563 /// Provider-supplied status text
7564 #[serde(skip_serializing_if = "Option::is_none")]
7565 pub status: Option<String>,
7566 /// Rendered title
7567 #[serde(skip_serializing_if = "Option::is_none")]
7568 pub title: Option<String>,
7569 /// URL for web-rendered canvases
7570 #[serde(skip_serializing_if = "Option::is_none")]
7571 pub url: Option<String>,
7572}
7573
7574/// A single action within a canvas declaration, with its name, optional description, and optional input schema.
7575///
7576/// <div class="warning">
7577///
7578/// **Experimental.** This type is part of an experimental wire-protocol surface
7579/// and may change or be removed in future SDK or CLI releases.
7580///
7581/// </div>
7582#[derive(Debug, Clone, Default, Serialize, Deserialize)]
7583#[serde(rename_all = "camelCase")]
7584pub struct CanvasRegistryChangedCanvasAction {
7585 /// Action description
7586 #[serde(skip_serializing_if = "Option::is_none")]
7587 pub description: Option<String>,
7588 /// JSON Schema for action input
7589 #[serde(skip_serializing_if = "Option::is_none")]
7590 pub input_schema: Option<serde_json::Value>,
7591 /// Action name
7592 pub name: String,
7593}
7594
7595/// A single canvas declaration in `session.canvas.registry_changed`, including provider IDs, display metadata, input schema, and actions.
7596///
7597/// <div class="warning">
7598///
7599/// **Experimental.** This type is part of an experimental wire-protocol surface
7600/// and may change or be removed in future SDK or CLI releases.
7601///
7602/// </div>
7603#[derive(Debug, Clone, Default, Serialize, Deserialize)]
7604#[serde(rename_all = "camelCase")]
7605pub struct CanvasRegistryChangedCanvas {
7606 /// Actions the agent or host may invoke
7607 #[serde(skip_serializing_if = "Option::is_none")]
7608 pub actions: Option<Vec<CanvasRegistryChangedCanvasAction>>,
7609 /// Provider-local canvas identifier
7610 pub canvas_id: String,
7611 /// Short, single-sentence description shown to the agent in canvas catalogs.
7612 pub description: String,
7613 /// Human-readable canvas name
7614 pub display_name: String,
7615 /// Owning provider identifier
7616 pub extension_id: String,
7617 /// Owning extension display name, when available
7618 #[serde(skip_serializing_if = "Option::is_none")]
7619 pub extension_name: Option<String>,
7620 /// Host-local PNG path for the canvas icon, when supplied
7621 #[serde(skip_serializing_if = "Option::is_none")]
7622 pub icon: Option<String>,
7623 /// JSON Schema for canvas open input
7624 #[serde(skip_serializing_if = "Option::is_none")]
7625 pub input_schema: Option<serde_json::Value>,
7626}
7627
7628/// Session event "session.canvas.registry_changed". Payload of `session.canvas.registry_changed` listing the canvas declarations currently available.
7629///
7630/// <div class="warning">
7631///
7632/// **Experimental.** This type is part of an experimental wire-protocol surface
7633/// and may change or be removed in future SDK or CLI releases.
7634///
7635/// </div>
7636#[derive(Debug, Clone, Default, Serialize, Deserialize)]
7637#[serde(rename_all = "camelCase")]
7638pub struct SessionCanvasRegistryChangedData {
7639 /// Canvas declarations currently available
7640 pub canvases: Vec<CanvasRegistryChangedCanvas>,
7641}
7642
7643/// Session event "session.canvas.closed". Payload of `session.canvas.closed` with the closed canvas instance ID, provider ID, and canvas ID.
7644///
7645/// <div class="warning">
7646///
7647/// **Experimental.** This type is part of an experimental wire-protocol surface
7648/// and may change or be removed in future SDK or CLI releases.
7649///
7650/// </div>
7651#[derive(Debug, Clone, Default, Serialize, Deserialize)]
7652#[serde(rename_all = "camelCase")]
7653pub struct SessionCanvasClosedData {
7654 /// Provider-local canvas identifier
7655 pub canvas_id: String,
7656 /// Owning provider identifier
7657 pub extension_id: String,
7658 /// Stable caller-supplied identifier of the canvas instance that was closed
7659 pub instance_id: String,
7660}
7661
7662/// 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.
7663///
7664/// <div class="warning">
7665///
7666/// **Experimental.** This type is part of an experimental wire-protocol surface
7667/// and may change or be removed in future SDK or CLI releases.
7668///
7669/// </div>
7670#[derive(Debug, Clone, Default, Serialize, Deserialize)]
7671#[serde(rename_all = "camelCase")]
7672pub struct SessionCanvasUnavailableData {
7673 /// Provider-local canvas identifier
7674 pub canvas_id: String,
7675 /// Owning provider identifier
7676 pub extension_id: String,
7677 /// Stable caller-supplied identifier of the canvas instance whose provider became unavailable
7678 pub instance_id: String,
7679}
7680
7681/// 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.
7682///
7683/// <div class="warning">
7684///
7685/// **Experimental.** This type is part of an experimental wire-protocol surface
7686/// and may change or be removed in future SDK or CLI releases.
7687///
7688/// </div>
7689#[derive(Debug, Clone, Default, Serialize, Deserialize)]
7690#[serde(rename_all = "camelCase")]
7691pub struct SessionCanvasRecordedData {
7692 /// Provider-local canvas identifier
7693 pub canvas_id: String,
7694 /// Owning provider identifier
7695 pub extension_id: String,
7696 /// Input supplied when the instance was opened
7697 #[serde(skip_serializing_if = "Option::is_none")]
7698 pub input: Option<serde_json::Value>,
7699 /// Stable caller-supplied canvas instance identifier
7700 pub instance_id: String,
7701 /// Rendered title
7702 #[serde(skip_serializing_if = "Option::is_none")]
7703 pub title: Option<String>,
7704}
7705
7706/// Session event "session.canvas.removed". Durable record that a canvas instance was closed, superseding a prior instance_recorded during resume replay.
7707///
7708/// <div class="warning">
7709///
7710/// **Experimental.** This type is part of an experimental wire-protocol surface
7711/// and may change or be removed in future SDK or CLI releases.
7712///
7713/// </div>
7714#[derive(Debug, Clone, Default, Serialize, Deserialize)]
7715#[serde(rename_all = "camelCase")]
7716pub struct SessionCanvasRemovedData {
7717 /// Provider-local canvas identifier
7718 pub canvas_id: String,
7719 /// Owning provider identifier
7720 pub extension_id: String,
7721 /// Stable caller-supplied identifier of the canvas instance that was closed
7722 pub instance_id: String,
7723}
7724
7725/// Session event "session.extensions.attachments_pushed". Payload of `session.extensions.attachments_pushed` with extension-contributed attachments for the next send.
7726#[derive(Debug, Clone, Default, Serialize, Deserialize)]
7727#[serde(rename_all = "camelCase")]
7728pub struct SessionExtensionsAttachmentsPushedData {
7729 /// Attachments contributed by an extension; the host should surface these as composer pills and forward them via the next session.send call.
7730 pub attachments: Vec<serde_json::Value>,
7731}
7732
7733/// Set when the underlying tools/call threw an error before returning a CallToolResult
7734#[derive(Debug, Clone, Default, Serialize, Deserialize)]
7735#[serde(rename_all = "camelCase")]
7736pub struct McpAppToolCallCompleteError {
7737 /// Human-readable error message
7738 pub message: String,
7739}
7740
7741/// MCP App tool `_meta.ui` resource URI and SEP-1865 visibility captured with an `mcp_app.tool_call_complete` result.
7742#[derive(Debug, Clone, Default, Serialize, Deserialize)]
7743#[serde(rename_all = "camelCase")]
7744pub struct McpAppToolCallCompleteToolMetaUI {
7745 /// `ui://` URI declared by the tool's `_meta.ui.resourceUri`
7746 #[serde(skip_serializing_if = "Option::is_none")]
7747 pub resource_uri: Option<String>,
7748 /// Tool visibility per SEP-1865 (typically a subset of `["model","app"]`)
7749 #[serde(skip_serializing_if = "Option::is_none")]
7750 pub visibility: Option<Vec<String>>,
7751}
7752
7753/// 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.
7754#[derive(Debug, Clone, Default, Serialize, Deserialize)]
7755#[serde(rename_all = "camelCase")]
7756pub struct McpAppToolCallCompleteToolMeta {
7757 /// MCP App tool `_meta.ui` resource URI and SEP-1865 visibility captured with an `mcp_app.tool_call_complete` result.
7758 #[serde(skip_serializing_if = "Option::is_none")]
7759 pub ui: Option<McpAppToolCallCompleteToolMetaUI>,
7760}
7761
7762/// Session event "mcp_app.tool_call_complete". MCP App view called a tool on a connected MCP server (SEP-1865)
7763#[derive(Debug, Clone, Default, Serialize, Deserialize)]
7764#[serde(rename_all = "camelCase")]
7765pub struct McpAppToolCallCompleteData {
7766 /// Arguments passed to the tool by the app view, if any
7767 #[serde(skip_serializing_if = "Option::is_none")]
7768 pub arguments: Option<HashMap<String, serde_json::Value>>,
7769 /// Wall-clock duration of the underlying tools/call in milliseconds
7770 pub duration_ms: f64,
7771 /// Set when the underlying tools/call threw an error before returning a CallToolResult
7772 #[serde(skip_serializing_if = "Option::is_none")]
7773 pub error: Option<McpAppToolCallCompleteError>,
7774 /// Standard MCP CallToolResult returned by the server. Present whether or not the call set isError.
7775 #[serde(skip_serializing_if = "Option::is_none")]
7776 pub result: Option<HashMap<String, serde_json::Value>>,
7777 /// Name of the MCP server hosting the tool
7778 pub server_name: String,
7779 /// True when the call completed without throwing AND the MCP CallToolResult did not set isError
7780 pub success: bool,
7781 /// 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.
7782 #[serde(skip_serializing_if = "Option::is_none")]
7783 pub tool_meta: Option<McpAppToolCallCompleteToolMeta>,
7784 /// MCP tool name that was invoked
7785 pub tool_name: String,
7786}
7787
7788/// Session event "session.indexed_search". Transient indexed-search status and diagnostics from the live runtime service. Never persisted or used to infer activation from session history.
7789pub type SessionIndexedSearchData = IndexedSearchData;
7790
7791/// 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.
7792#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7793pub enum AutoTier {
7794 /// Optimize for efficiency.
7795 #[serde(rename = "efficiency")]
7796 Efficiency,
7797 /// Balance efficiency and intelligence.
7798 #[serde(rename = "balance")]
7799 Balance,
7800 /// Optimize for intelligence.
7801 #[serde(rename = "intelligence")]
7802 Intelligence,
7803 /// Integrator-only preset that optimizes for latency.
7804 #[serde(rename = "fast")]
7805 Fast,
7806 /// Unknown variant for forward compatibility.
7807 #[default]
7808 #[serde(other)]
7809 Unknown,
7810}
7811
7812/// Hosting platform type of the repository (github or ado)
7813#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7814pub enum WorkingDirectoryContextHostType {
7815 /// Repository is hosted on GitHub.
7816 #[serde(rename = "github")]
7817 GitHub,
7818 /// Repository is hosted on Azure DevOps.
7819 #[serde(rename = "ado")]
7820 Ado,
7821 /// Unknown variant for forward compatibility.
7822 #[default]
7823 #[serde(other)]
7824 Unknown,
7825}
7826
7827/// Allowed values for the `ContextTier` enumeration.
7828#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7829pub enum ContextTier {
7830 /// Default context tier with standard context window size.
7831 #[serde(rename = "default")]
7832 Default,
7833 /// Extended context tier with a larger context window.
7834 #[serde(rename = "long_context")]
7835 LongContext,
7836 /// Unknown variant for forward compatibility.
7837 #[default]
7838 #[serde(other)]
7839 Unknown,
7840}
7841
7842/// Reasoning summary mode used for model calls, if applicable (e.g. "none", "concise", "detailed")
7843#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7844pub enum ReasoningSummary {
7845 /// Do not request reasoning summaries from the model.
7846 #[serde(rename = "none")]
7847 None,
7848 /// Request a concise summary of the model's reasoning.
7849 #[serde(rename = "concise")]
7850 Concise,
7851 /// Request a detailed summary of the model's reasoning.
7852 #[serde(rename = "detailed")]
7853 Detailed,
7854 /// Unknown variant for forward compatibility.
7855 #[default]
7856 #[serde(other)]
7857 Unknown,
7858}
7859
7860/// Output verbosity level used for supported model calls (e.g. "low", "medium", "high")
7861#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7862pub enum Verbosity {
7863 /// A terse response was requested.
7864 #[serde(rename = "low")]
7865 Low,
7866 /// A medium amount of response detail was requested.
7867 #[serde(rename = "medium")]
7868 Medium,
7869 /// A more detailed response was requested.
7870 #[serde(rename = "high")]
7871 High,
7872 /// Unknown variant for forward compatibility.
7873 #[default]
7874 #[serde(other)]
7875 Unknown,
7876}
7877
7878/// 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.
7879#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7880pub enum RemediationAction {
7881 /// Authenticate again with the Copilot backend. The current credential is absent, expired, or rejected.
7882 #[serde(rename = "sign_in")]
7883 SignIn,
7884 /// Authenticate as a different account. The current account exists but lacks access to the requested resource.
7885 #[serde(rename = "switch_account")]
7886 SwitchAccount,
7887 /// Inspect which account is currently authenticated before deciding what to change.
7888 #[serde(rename = "show_account")]
7889 ShowAccount,
7890 /// 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.
7891 #[serde(rename = "review_sandbox_policy")]
7892 ReviewSandboxPolicy,
7893 /// Permit outbound network access in the sandbox policy.
7894 #[serde(rename = "allow_sandbox_outbound")]
7895 AllowSandboxOutbound,
7896 /// Unknown variant for forward compatibility.
7897 #[default]
7898 #[serde(other)]
7899 Unknown,
7900}
7901
7902/// The session mode the agent is operating in
7903#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7904pub enum SessionMode {
7905 /// The agent is responding interactively to the user.
7906 #[serde(rename = "interactive")]
7907 Interactive,
7908 /// The agent is preparing a plan before making changes.
7909 #[serde(rename = "plan")]
7910 Plan,
7911 /// The agent is working autonomously toward task completion.
7912 #[serde(rename = "autopilot")]
7913 Autopilot,
7914 /// Unknown variant for forward compatibility.
7915 #[default]
7916 #[serde(other)]
7917 Unknown,
7918}
7919
7920/// 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.
7921#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7922pub enum ScheduleOrigin {
7923 /// The schedule was created by an explicit user action, such as `/every` or `/after`.
7924 #[serde(rename = "user")]
7925 User,
7926 /// The schedule was created by the agent via the `manage_schedule` tool.
7927 #[serde(rename = "model")]
7928 Model,
7929 /// Unknown variant for forward compatibility.
7930 #[default]
7931 #[serde(other)]
7932 Unknown,
7933}
7934
7935/// The type of operation performed on the autopilot objective state file
7936#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7937pub enum AutopilotObjectiveChangedOperation {
7938 /// Autopilot objective state file was created for a new objective.
7939 #[serde(rename = "create")]
7940 Create,
7941 /// Autopilot objective state file was updated for an existing objective.
7942 #[serde(rename = "update")]
7943 Update,
7944 /// Autopilot objective state file was deleted or cleared.
7945 #[serde(rename = "delete")]
7946 Delete,
7947 /// Unknown variant for forward compatibility.
7948 #[default]
7949 #[serde(other)]
7950 Unknown,
7951}
7952
7953/// Current autopilot objective status, if one exists
7954#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7955pub enum AutopilotObjectiveChangedStatus {
7956 /// Objective is active and can drive autopilot continuations.
7957 #[serde(rename = "active")]
7958 Active,
7959 /// Objective is paused and will not drive autopilot continuations.
7960 #[serde(rename = "paused")]
7961 Paused,
7962 /// Legacy objective state indicating the previous continuation cap was reached.
7963 #[serde(rename = "cap_reached")]
7964 CapReached,
7965 /// Objective was completed by the agent.
7966 #[serde(rename = "completed")]
7967 Completed,
7968 /// Unknown variant for forward compatibility.
7969 #[default]
7970 #[serde(other)]
7971 Unknown,
7972}
7973
7974/// Indexed-search event variant discriminator.
7975#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7976pub enum IndexedSearchDataStatusKind {
7977 #[serde(rename = "status")]
7978 #[default]
7979 Status,
7980}
7981
7982/// Live indexed-search state for this session activation, never inferred from persisted history.
7983#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
7984pub enum IndexedSearchState {
7985 /// Indexed search is not active for this session.
7986 #[serde(rename = "disabled")]
7987 Disabled,
7988 /// Indexed-search startup is in progress.
7989 #[serde(rename = "starting")]
7990 Starting,
7991 /// The indexed-search server started successfully; its index may still be warming.
7992 #[serde(rename = "enabled")]
7993 Enabled,
7994 /// The indexed-search server and its index are ready.
7995 #[serde(rename = "ready")]
7996 Ready,
7997 /// Indexed-search startup or the active server failed.
7998 #[serde(rename = "failed")]
7999 Failed,
8000 /// Unknown variant for forward compatibility.
8001 #[default]
8002 #[serde(other)]
8003 Unknown,
8004}
8005
8006/// Configuration, policy, or workspace condition that disabled indexed search.
8007#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8008pub enum IndexedSearchDisabledReason {
8009 /// Indexed search was explicitly disabled by the environment.
8010 #[serde(rename = "use_tgrep_false")]
8011 UseTgrepFalse,
8012 /// Search uses the external ripgrep binary instead of bundled search.
8013 #[serde(rename = "use_builtin_ripgrep_false")]
8014 UseBuiltinRipgrepFalse,
8015 /// Organization policy disables indexed search.
8016 #[serde(rename = "organization")]
8017 Organization,
8018 /// Authentication has not resolved organization policy.
8019 #[serde(rename = "organization_policy_auth_pending")]
8020 OrganizationPolicyAuthPending,
8021 /// Organization policy could not be determined.
8022 #[serde(rename = "organization_policy_unknown")]
8023 OrganizationPolicyUnknown,
8024 /// The workspace uses a virtualized or network filesystem.
8025 #[serde(rename = "virtual_filesystem")]
8026 VirtualFilesystem,
8027 /// The workspace is inside a Windows cloud-sync root.
8028 #[serde(rename = "cloud_sync_root")]
8029 CloudSyncRoot,
8030 /// The Windows cloud-sync safety check failed.
8031 #[serde(rename = "cloud_sync_detection_failed")]
8032 CloudSyncDetectionFailed,
8033 /// The workspace is not available on the runtime's local filesystem.
8034 #[serde(rename = "workspace_not_local")]
8035 WorkspaceNotLocal,
8036 /// Unknown variant for forward compatibility.
8037 #[default]
8038 #[serde(other)]
8039 Unknown,
8040}
8041
8042/// Indexed-search event variant discriminator.
8043#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8044pub enum IndexedSearchDataStartupKind {
8045 #[serde(rename = "startup")]
8046 #[default]
8047 Startup,
8048}
8049
8050/// Result of an indexed-search startup attempt.
8051#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8052pub enum IndexedSearchOutcome {
8053 /// A new indexed-search server was started.
8054 #[serde(rename = "started")]
8055 Started,
8056 /// The repository has too few files for automatic indexing.
8057 #[serde(rename = "skipped_below_threshold")]
8058 SkippedBelowThreshold,
8059 /// No Git repository was found and indexing was not forced.
8060 #[serde(rename = "skipped_no_gitroot")]
8061 SkippedNoGitroot,
8062 /// Configuration, policy, or workspace safety disabled indexing.
8063 #[serde(rename = "skipped_disabled")]
8064 SkippedDisabled,
8065 /// An existing indexed-search server was reused.
8066 #[serde(rename = "reused_existing")]
8067 ReusedExisting,
8068 /// The startup attempt failed.
8069 #[serde(rename = "failed")]
8070 Failed,
8071 /// Unknown variant for forward compatibility.
8072 #[default]
8073 #[serde(other)]
8074 Unknown,
8075}
8076
8077/// Category of an indexed-search server failure.
8078#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8079pub enum IndexedSearchErrorType {
8080 /// The indexed-search server could not be spawned.
8081 #[serde(rename = "spawn_error")]
8082 SpawnError,
8083 /// The indexed-search server exited unexpectedly.
8084 #[serde(rename = "unexpected_exit")]
8085 UnexpectedExit,
8086 /// The indexed-search server was terminated by a signal.
8087 #[serde(rename = "killed_by_signal")]
8088 KilledBySignal,
8089 /// Unknown variant for forward compatibility.
8090 #[default]
8091 #[serde(other)]
8092 Unknown,
8093}
8094
8095/// Indexed-search event variant discriminator.
8096#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8097pub enum IndexedSearchDataServerErrorKind {
8098 #[serde(rename = "server_error")]
8099 #[default]
8100 ServerError,
8101}
8102
8103/// Indexed-search event variant discriminator.
8104#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8105pub enum IndexedSearchDataIncrementalKind {
8106 #[serde(rename = "incremental")]
8107 #[default]
8108 Incremental,
8109}
8110
8111/// Phase of an incremental indexed-search update.
8112#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8113pub enum IndexedSearchIncrementalPhase {
8114 /// A workspace scan found changes to index.
8115 #[serde(rename = "changes_detected")]
8116 ChangesDetected,
8117 /// The incremental index update completed.
8118 #[serde(rename = "updated")]
8119 Updated,
8120 /// Unknown variant for forward compatibility.
8121 #[default]
8122 #[serde(other)]
8123 Unknown,
8124}
8125
8126/// Transient indexed-search status and diagnostics from the live runtime service. Never persisted or used to infer activation from session history.
8127#[derive(Debug, Clone, Serialize, Deserialize)]
8128#[serde(untagged)]
8129pub enum IndexedSearchData {
8130 Status(IndexedSearchDataStatus),
8131 Startup(IndexedSearchDataStartup),
8132 ServerError(IndexedSearchDataServerError),
8133 Incremental(IndexedSearchDataIncremental),
8134}
8135
8136/// Origin of an effective session model change.
8137#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8138pub enum ModelChangeSource {
8139 /// The user selected a model directly with `/model <id>`.
8140 #[serde(rename = "model_command")]
8141 ModelCommand,
8142 /// The user selected the model with `/settings`.
8143 #[serde(rename = "settings_command")]
8144 SettingsCommand,
8145 /// The user selected the model with the `/config` alias.
8146 #[serde(rename = "config_command")]
8147 ConfigCommand,
8148 /// The user selected the model in the model picker, including the picker opened by bare `/model`.
8149 #[serde(rename = "model_picker")]
8150 ModelPicker,
8151 /// Organization-managed settings selected the model.
8152 #[serde(rename = "managed_settings")]
8153 ManagedSettings,
8154 /// Repository settings selected the model.
8155 #[serde(rename = "repo_settings")]
8156 RepoSettings,
8157 /// Startup model resolution selected the model.
8158 #[serde(rename = "startup")]
8159 Startup,
8160 /// Selecting an agent selected its configured model.
8161 #[serde(rename = "agent")]
8162 Agent,
8163 /// Entering, leaving, or reconfiguring plan mode selected the model.
8164 #[serde(rename = "plan_mode")]
8165 PlanMode,
8166 /// The runtime selected the model automatically, such as rate-limit recovery or refusal fallback.
8167 #[serde(rename = "automatic")]
8168 Automatic,
8169 /// The user selected the promoted model from the changeboarding card or its keyboard shortcut.
8170 #[serde(rename = "changeboarding_shortcut")]
8171 ChangeboardingShortcut,
8172 /// An SDK or RPC caller selected the model.
8173 #[serde(rename = "sdk")]
8174 Sdk,
8175 /// Unknown variant for forward compatibility.
8176 #[default]
8177 #[serde(other)]
8178 Unknown,
8179}
8180
8181/// Auto preferences that Copilot API can recommend.
8182#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8183pub enum RecommendedAutoTier {
8184 /// Optimize for efficiency.
8185 #[serde(rename = "efficiency")]
8186 Efficiency,
8187 /// Balance efficiency and intelligence.
8188 #[serde(rename = "balance")]
8189 Balance,
8190 /// Optimize for intelligence.
8191 #[serde(rename = "intelligence")]
8192 Intelligence,
8193 /// Unknown variant for forward compatibility.
8194 #[default]
8195 #[serde(other)]
8196 Unknown,
8197}
8198
8199/// Terminal reason an Auto preference activation failed.
8200#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8201pub enum AutoTierSwitchFailureReason {
8202 /// The candidate model was rejected by model policy.
8203 #[serde(rename = "policy_rejected")]
8204 PolicyRejected,
8205 /// The Auto routing request failed or returned an unusable response.
8206 #[serde(rename = "request_failed")]
8207 RequestFailed,
8208 /// The runtime could not prepare the Auto routing request.
8209 #[serde(rename = "setup_failed")]
8210 SetupFailed,
8211 /// The provider does not support Auto routing.
8212 #[serde(rename = "unsupported")]
8213 Unsupported,
8214 /// Unknown variant for forward compatibility.
8215 #[default]
8216 #[serde(other)]
8217 Unknown,
8218}
8219
8220/// Permission mode for the session.
8221///
8222/// <div class="warning">
8223///
8224/// **Experimental.** This type is part of an experimental wire-protocol surface
8225/// and may change or be removed in future SDK or CLI releases.
8226///
8227/// </div>
8228#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8229pub enum PermissionMode {
8230 /// Permission requests follow the normal approval flow.
8231 #[serde(rename = "manual")]
8232 Manual,
8233 /// Permission requests include an LLM safety recommendation; clients may automatically approve requests judged acceptable.
8234 #[serde(rename = "assisted")]
8235 Assisted,
8236 /// Tool, path, and URL permission requests are automatically approved.
8237 #[serde(rename = "allow-all")]
8238 AllowAll,
8239 /// Unknown variant for forward compatibility.
8240 #[default]
8241 #[serde(other)]
8242 Unknown,
8243}
8244
8245/// The type of operation performed on the plan file
8246#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8247pub enum PlanChangedOperation {
8248 /// The plan file was created.
8249 #[serde(rename = "create")]
8250 Create,
8251 /// The plan file was updated.
8252 #[serde(rename = "update")]
8253 Update,
8254 /// The plan file was deleted.
8255 #[serde(rename = "delete")]
8256 Delete,
8257 /// Unknown variant for forward compatibility.
8258 #[default]
8259 #[serde(other)]
8260 Unknown,
8261}
8262
8263/// Whether the file was newly created or updated
8264#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8265pub enum WorkspaceFileChangedOperation {
8266 /// The workspace file was created.
8267 #[serde(rename = "create")]
8268 Create,
8269 /// The workspace file was updated.
8270 #[serde(rename = "update")]
8271 Update,
8272 /// Unknown variant for forward compatibility.
8273 #[default]
8274 #[serde(other)]
8275 Unknown,
8276}
8277
8278/// Origin type of the session being handed off
8279#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8280pub enum HandoffSourceType {
8281 /// The handoff originated from a remote session.
8282 #[serde(rename = "remote")]
8283 Remote,
8284 /// The handoff originated from a local session.
8285 #[serde(rename = "local")]
8286 Local,
8287 /// Unknown variant for forward compatibility.
8288 #[default]
8289 #[serde(other)]
8290 Unknown,
8291}
8292
8293/// Whether the session ended normally ("routine") or due to a crash/fatal error ("error")
8294#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8295pub enum ShutdownType {
8296 /// The session ended normally.
8297 #[serde(rename = "routine")]
8298 Routine,
8299 /// The session ended because of a crash or fatal error.
8300 #[serde(rename = "error")]
8301 Error,
8302 /// Unknown variant for forward compatibility.
8303 #[default]
8304 #[serde(other)]
8305 Unknown,
8306}
8307
8308/// What initiated a conversation compaction
8309#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8310pub enum CompactionTrigger {
8311 /// Background compaction started automatically because context utilization crossed the background threshold.
8312 #[serde(rename = "threshold")]
8313 Threshold,
8314 /// Compaction forced by a context-limit model response (e.g. HTTP 413) before retrying the request.
8315 #[serde(rename = "context_limit_retry")]
8316 ContextLimitRetry,
8317 /// User-requested compaction, e.g. the /compact command or the history.compact API.
8318 #[serde(rename = "manual")]
8319 Manual,
8320 /// Emergency compaction triggered by high process memory usage.
8321 #[serde(rename = "memory_pressure")]
8322 MemoryPressure,
8323 /// Compaction requested while switching to a model with a smaller context window.
8324 #[serde(rename = "model_switch")]
8325 ModelSwitch,
8326 /// Unknown variant for forward compatibility.
8327 #[default]
8328 #[serde(other)]
8329 Unknown,
8330}
8331
8332/// Category of structured task blocker
8333#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8334pub enum TaskBlockerKind {
8335 /// Autopilot permission recovery requires intervention or has no safe autonomous path.
8336 #[serde(rename = "permission_recovery")]
8337 PermissionRecovery,
8338 /// Unknown variant for forward compatibility.
8339 #[default]
8340 #[serde(other)]
8341 Unknown,
8342}
8343
8344/// Runtime handling applied to a recovery attempt
8345#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8346pub enum PermissionRecoveryAttemptDisposition {
8347 /// The request was denied without prompting so the agent could try an alternative.
8348 #[serde(rename = "deferred")]
8349 Deferred,
8350 /// The request was surfaced to an interactive responder.
8351 #[serde(rename = "prompted")]
8352 Prompted,
8353 /// The interactive responder approved the request.
8354 #[serde(rename = "approved")]
8355 Approved,
8356 /// The interactive responder denied the request or became unavailable.
8357 #[serde(rename = "denied")]
8358 Denied,
8359 /// The request exhausted unattended recovery and produced a blocked outcome.
8360 #[serde(rename = "blocked")]
8361 Blocked,
8362 /// A tool call succeeded as an equivalent alternative.
8363 #[serde(rename = "succeeded")]
8364 Succeeded,
8365 /// Unknown variant for forward compatibility.
8366 #[default]
8367 #[serde(other)]
8368 Unknown,
8369}
8370
8371/// Controlled reason for an individual attempt disposition
8372#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8373pub enum PermissionRecoveryAttemptReason {
8374 /// The attempt required permission that Assisted Permissions could not grant.
8375 #[serde(rename = "permission_required")]
8376 PermissionRequired,
8377 /// The request repeated an earlier attempt.
8378 #[serde(rename = "repeated_attempt")]
8379 RepeatedAttempt,
8380 /// The request exceeded the bounded number of distinct attempts.
8381 #[serde(rename = "attempts_exhausted")]
8382 AttemptsExhausted,
8383 /// The interactive responder approved the request.
8384 #[serde(rename = "permission_approved")]
8385 PermissionApproved,
8386 /// The interactive responder denied the request.
8387 #[serde(rename = "permission_denied")]
8388 PermissionDenied,
8389 /// The interactive responder became unavailable.
8390 #[serde(rename = "responder_unavailable")]
8391 ResponderUnavailable,
8392 /// The tool call succeeded without the blocked permission.
8393 #[serde(rename = "equivalent_alternative_succeeded")]
8394 EquivalentAlternativeSucceeded,
8395 /// Unknown variant for forward compatibility.
8396 #[default]
8397 #[serde(other)]
8398 Unknown,
8399}
8400
8401/// Relationship of an attempt to earlier permission requests
8402#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8403pub enum PermissionRecoveryAttemptRelation {
8404 /// The first denied permission request in the episode.
8405 #[serde(rename = "initial")]
8406 Initial,
8407 /// A request equivalent to an earlier attempt.
8408 #[serde(rename = "retry")]
8409 Retry,
8410 /// A distinct request or a successful alternative tool call.
8411 #[serde(rename = "alternative")]
8412 Alternative,
8413 /// Unknown variant for forward compatibility.
8414 #[default]
8415 #[serde(other)]
8416 Unknown,
8417}
8418
8419/// Action selected when autonomous recovery cannot continue
8420#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8421pub enum PermissionRecoveryOnBlocked {
8422 /// Surface the existing permission prompt to a response-capable client.
8423 #[serde(rename = "ask")]
8424 Ask,
8425 /// Return a structured unsuccessful blocked outcome because no responder is available.
8426 #[serde(rename = "fail")]
8427 Fail,
8428 /// Unknown variant for forward compatibility.
8429 #[default]
8430 #[serde(other)]
8431 Unknown,
8432}
8433
8434/// Controlled reason for a permission-recovery episode transition
8435#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8436pub enum PermissionRecoveryReason {
8437 /// An action required permission that Assisted Permissions could not grant.
8438 #[serde(rename = "permission_required")]
8439 PermissionRequired,
8440 /// The agent repeated an equivalent permission request instead of making progress.
8441 #[serde(rename = "repeated_attempt")]
8442 RepeatedAttempt,
8443 /// The bounded number of distinct permission attempts was exhausted.
8444 #[serde(rename = "attempts_exhausted")]
8445 AttemptsExhausted,
8446 /// A responder approved the escalated permission request.
8447 #[serde(rename = "permission_approved")]
8448 PermissionApproved,
8449 /// A responder denied the escalated permission request.
8450 #[serde(rename = "permission_denied")]
8451 PermissionDenied,
8452 /// The response-capable client became unavailable while escalation was pending.
8453 #[serde(rename = "responder_unavailable")]
8454 ResponderUnavailable,
8455 /// A later tool call succeeded without requiring the blocked permission.
8456 #[serde(rename = "equivalent_alternative_succeeded")]
8457 EquivalentAlternativeSucceeded,
8458 /// Unknown variant for forward compatibility.
8459 #[default]
8460 #[serde(other)]
8461 Unknown,
8462}
8463
8464/// Lifecycle state of a permission-recovery episode
8465#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8466pub enum PermissionRecoveryStatus {
8467 /// Autopilot may try a bounded equivalent alternative.
8468 #[serde(rename = "recovering")]
8469 Recovering,
8470 /// An interactive permission response is required.
8471 #[serde(rename = "awaiting_approval")]
8472 AwaitingApproval,
8473 /// The episode ended through approval or a successful equivalent alternative.
8474 #[serde(rename = "resolved")]
8475 Resolved,
8476 /// No autonomous path remains and the task requires intervention.
8477 #[serde(rename = "blocked")]
8478 Blocked,
8479 /// Unknown variant for forward compatibility.
8480 #[default]
8481 #[serde(other)]
8482 Unknown,
8483}
8484
8485/// Semantic result of evaluating a task completion request
8486#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8487pub enum TaskCompletionOutcome {
8488 /// The completion request was accepted and the objective is complete.
8489 #[serde(rename = "completed")]
8490 Completed,
8491 /// The completion request was rejected because more work or validation remains.
8492 #[serde(rename = "continue")]
8493 Continue,
8494 /// Completion cannot proceed without intervention; the active objective is paused when one is identified.
8495 #[serde(rename = "blocked")]
8496 Blocked,
8497 /// Unknown variant for forward compatibility.
8498 #[default]
8499 #[serde(other)]
8500 Unknown,
8501}
8502
8503/// Structured terminal status from a tool completion event.
8504#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8505pub enum CompletionReceiptToolStatus {
8506 /// The tool completed successfully.
8507 #[serde(rename = "success")]
8508 Success,
8509 /// The tool failed without a more specific structured status.
8510 #[serde(rename = "failure")]
8511 Failure,
8512 /// The tool exceeded its time budget.
8513 #[serde(rename = "timeout")]
8514 Timeout,
8515 /// The user rejected the tool call.
8516 #[serde(rename = "rejected")]
8517 Rejected,
8518 /// The permissions service denied the tool call.
8519 #[serde(rename = "denied")]
8520 Denied,
8521 /// Unknown variant for forward compatibility.
8522 #[default]
8523 #[serde(other)]
8524 Unknown,
8525}
8526
8527/// Runtime reason the completion decision was accepted.
8528#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8529pub enum CompletionReceiptStopReason {
8530 /// The model reached a natural terminal response.
8531 #[serde(rename = "natural")]
8532 Natural,
8533 /// A terminal tool ended the interaction.
8534 #[serde(rename = "terminal_tool")]
8535 TerminalTool,
8536 /// The configured agentStop continuation limit was reached.
8537 #[serde(rename = "agent_stop_block_limit")]
8538 AgentStopBlockLimit,
8539 /// Unknown variant for forward compatibility.
8540 #[default]
8541 #[serde(other)]
8542 Unknown,
8543}
8544
8545/// Kind of turn for which HydraFusion routing is running.
8546///
8547/// <div class="warning">
8548///
8549/// **Experimental.** This type is part of an experimental wire-protocol surface
8550/// and may change or be removed in future SDK or CLI releases.
8551///
8552/// </div>
8553#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8554pub enum FusionTurnKind {
8555 /// A user-message turn.
8556 #[serde(rename = "user")]
8557 User,
8558 /// A conversation-compaction turn.
8559 #[serde(rename = "compaction")]
8560 Compaction,
8561 /// Unknown variant for forward compatibility.
8562 #[default]
8563 #[serde(other)]
8564 Unknown,
8565}
8566
8567/// Server-recommended routing behavior for a later HydraFusion turn.
8568///
8569/// <div class="warning">
8570///
8571/// **Experimental.** This type is part of an experimental wire-protocol surface
8572/// and may change or be removed in future SDK or CLI releases.
8573///
8574/// </div>
8575#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8576pub enum FusionFollowUpAction {
8577 /// Reuse the durable primary model without routing.
8578 #[serde(rename = "reuse_primary")]
8579 ReusePrimary,
8580 /// Request a new routing decision.
8581 #[serde(rename = "reroute")]
8582 Reroute,
8583 /// Unknown variant for forward compatibility.
8584 #[default]
8585 #[serde(other)]
8586 Unknown,
8587}
8588
8589/// Validated HydraFusion execution pattern.
8590///
8591/// <div class="warning">
8592///
8593/// **Experimental.** This type is part of an experimental wire-protocol surface
8594/// and may change or be removed in future SDK or CLI releases.
8595///
8596/// </div>
8597#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8598pub enum FusionPattern {
8599 /// Run one primary solver phase.
8600 #[serde(rename = "single")]
8601 Single,
8602 /// Run a primary phase, a judge, and an optional repair.
8603 #[serde(rename = "cascade")]
8604 Cascade,
8605 /// Run a primary draft, a read-only critique, and a revision.
8606 #[serde(rename = "critique")]
8607 Critique,
8608 /// Unknown variant for forward compatibility.
8609 #[default]
8610 #[serde(other)]
8611 Unknown,
8612}
8613
8614/// HydraFusion phase kind.
8615///
8616/// <div class="warning">
8617///
8618/// **Experimental.** This type is part of an experimental wire-protocol surface
8619/// and may change or be removed in future SDK or CLI releases.
8620///
8621/// </div>
8622#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8623pub enum FusionPhaseKind {
8624 /// Primary solver phase.
8625 #[serde(rename = "primary")]
8626 Primary,
8627 /// Read-only cascade judge phase.
8628 #[serde(rename = "judge")]
8629 Judge,
8630 /// Cascade repair phase.
8631 #[serde(rename = "repair")]
8632 Repair,
8633 /// Initial critique-pattern draft phase.
8634 #[serde(rename = "draft")]
8635 Draft,
8636 /// Read-only critique phase.
8637 #[serde(rename = "critic")]
8638 Critic,
8639 /// Critique-pattern revision phase.
8640 #[serde(rename = "revision")]
8641 Revision,
8642 /// Follow-up phase continuing from the resolved model.
8643 #[serde(rename = "follow_up")]
8644 FollowUp,
8645 /// Unknown variant for forward compatibility.
8646 #[default]
8647 #[serde(other)]
8648 Unknown,
8649}
8650
8651/// Conversation scope in which a HydraFusion phase executes.
8652///
8653/// <div class="warning">
8654///
8655/// **Experimental.** This type is part of an experimental wire-protocol surface
8656/// and may change or be removed in future SDK or CLI releases.
8657///
8658/// </div>
8659#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8660pub enum FusionConversationScope {
8661 /// Canonical root conversation history.
8662 #[serde(rename = "root")]
8663 Root,
8664 /// Isolated read-only review history that does not enter the root conversation.
8665 #[serde(rename = "review")]
8666 Review,
8667 /// Unknown variant for forward compatibility.
8668 #[default]
8669 #[serde(other)]
8670 Unknown,
8671}
8672
8673/// The agent mode that was active when this message was sent
8674#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8675pub enum UserMessageAgentMode {
8676 /// The agent is responding interactively to the user.
8677 #[serde(rename = "interactive")]
8678 Interactive,
8679 /// The agent is preparing a plan before making changes.
8680 #[serde(rename = "plan")]
8681 Plan,
8682 /// The agent is working autonomously toward task completion.
8683 #[serde(rename = "autopilot")]
8684 Autopilot,
8685 /// The agent is in shell-focused UI mode.
8686 #[serde(rename = "shell")]
8687 Shell,
8688 /// Unknown variant for forward compatibility.
8689 #[default]
8690 #[serde(other)]
8691 Unknown,
8692}
8693
8694/// 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.
8695#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8696pub enum UserMessageDelivery {
8697 /// Delivered while the loop was idle; starts its own run immediately (a human's fresh turn, or a system notification waking an idle agent).
8698 #[serde(rename = "idle")]
8699 Idle,
8700 /// Injected into the current in-flight run while the agent was busy (immediate mode).
8701 #[serde(rename = "steering")]
8702 Steering,
8703 /// Enqueued while the agent was busy; processed as its own run afterward.
8704 #[serde(rename = "queued")]
8705 Queued,
8706 /// Unknown variant for forward compatibility.
8707 #[default]
8708 #[serde(other)]
8709 Unknown,
8710}
8711
8712/// What the agent was doing when the user interrupted it.
8713#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8714pub enum AgentInterruptedActivity {
8715 /// A request to the model was open.
8716 #[serde(rename = "model_call")]
8717 ModelCall,
8718 /// The turn was sleeping between retry attempts.
8719 #[serde(rename = "retry_backoff")]
8720 RetryBackoff,
8721 /// One or more tools were executing.
8722 #[serde(rename = "tool_call")]
8723 ToolCall,
8724 /// Background sub-agents were running while the main loop was idle.
8725 #[serde(rename = "background_agent")]
8726 BackgroundAgent,
8727 /// Unknown variant for forward compatibility.
8728 #[default]
8729 #[serde(other)]
8730 Unknown,
8731}
8732
8733/// Where the interruption landed relative to the first streamed token.
8734#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8735pub enum AgentInterruptedCancelPhase {
8736 /// No output had been produced when the request was cancelled.
8737 #[serde(rename = "pre_first_token")]
8738 PreFirstToken,
8739 /// The response was already streaming when the request was cancelled.
8740 #[serde(rename = "mid_stream")]
8741 MidStream,
8742 /// Unknown variant for forward compatibility.
8743 #[default]
8744 #[serde(other)]
8745 Unknown,
8746}
8747
8748/// Transport used for a failed model call
8749#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8750pub enum ModelCallFailureTransport {
8751 /// HTTP transport, including SSE streams.
8752 #[serde(rename = "http")]
8753 Http,
8754 /// WebSocket transport.
8755 #[serde(rename = "websocket")]
8756 Websocket,
8757 /// Unknown variant for forward compatibility.
8758 #[default]
8759 #[serde(other)]
8760 Unknown,
8761}
8762
8763/// Content-safe activity observed while a HydraFusion phase is running.
8764///
8765/// <div class="warning">
8766///
8767/// **Experimental.** This type is part of an experimental wire-protocol surface
8768/// and may change or be removed in future SDK or CLI releases.
8769///
8770/// </div>
8771#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8772pub enum FusionPhaseActivityKind {
8773 /// The provider produced additional private output bytes.
8774 #[serde(rename = "model_output")]
8775 ModelOutput,
8776 /// A tool began executing inside the phase.
8777 #[serde(rename = "tool_started")]
8778 ToolStarted,
8779 /// A tool finished executing inside the phase.
8780 #[serde(rename = "tool_completed")]
8781 ToolCompleted,
8782 /// Unknown variant for forward compatibility.
8783 #[default]
8784 #[serde(other)]
8785 Unknown,
8786}
8787
8788/// How a durable phase checkpoint contributes its exact message to canonical root history.
8789///
8790/// <div class="warning">
8791///
8792/// **Experimental.** This type is part of an experimental wire-protocol surface
8793/// and may change or be removed in future SDK or CLI releases.
8794///
8795/// </div>
8796#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8797pub enum FusionProjectionMode {
8798 /// Append the exact root message immediately.
8799 #[serde(rename = "append")]
8800 Append,
8801 /// Hold a terminal message outside canonical history until the final commit selects it.
8802 #[serde(rename = "staged")]
8803 Staged,
8804 /// Do not project the checkpoint into root history.
8805 #[serde(rename = "none")]
8806 None,
8807 /// Unknown variant for forward compatibility.
8808 #[default]
8809 #[serde(other)]
8810 Unknown,
8811}
8812
8813/// Durable outcome status of a HydraFusion phase.
8814///
8815/// <div class="warning">
8816///
8817/// **Experimental.** This type is part of an experimental wire-protocol surface
8818/// and may change or be removed in future SDK or CLI releases.
8819///
8820/// </div>
8821#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8822pub enum FusionPhaseStatus {
8823 /// The phase completed successfully.
8824 #[serde(rename = "succeeded")]
8825 Succeeded,
8826 /// The phase failed.
8827 #[serde(rename = "failed")]
8828 Failed,
8829 /// The phase was cancelled.
8830 #[serde(rename = "cancelled")]
8831 Cancelled,
8832 /// Unknown variant for forward compatibility.
8833 #[default]
8834 #[serde(other)]
8835 Unknown,
8836}
8837
8838/// Tool call type: "function" for standard tool calls, "custom" for grammar-based tool calls. Defaults to "function" when absent.
8839#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8840pub enum AssistantMessageToolRequestType {
8841 /// Standard function-style tool call.
8842 #[serde(rename = "function")]
8843 Function,
8844 /// Custom grammar-based tool call.
8845 #[serde(rename = "custom")]
8846 Custom,
8847 /// Unknown variant for forward compatibility.
8848 #[default]
8849 #[serde(other)]
8850 Unknown,
8851}
8852
8853/// The system that produced a citation.
8854///
8855/// <div class="warning">
8856///
8857/// **Experimental.** This type is part of an experimental wire-protocol surface
8858/// and may change or be removed in future SDK or CLI releases.
8859///
8860/// </div>
8861#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8862pub enum CitationProvider {
8863 /// Citation produced by an Anthropic (Claude) model response.
8864 #[serde(rename = "anthropic")]
8865 Anthropic,
8866 /// Citation produced by an OpenAI model response.
8867 #[serde(rename = "openai")]
8868 Openai,
8869 /// Citation synthesized client-side by the runtime from tool output.
8870 #[serde(rename = "client")]
8871 Client,
8872 /// Unknown variant for forward compatibility.
8873 #[default]
8874 #[serde(other)]
8875 Unknown,
8876}
8877
8878/// Hosted program caller type
8879#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8880pub enum AssistantMessageToolRequestCallerType {
8881 #[serde(rename = "program")]
8882 Program,
8883 /// Unknown variant for forward compatibility.
8884 #[default]
8885 #[serde(other)]
8886 Unknown,
8887}
8888
8889/// API endpoint used for this model call, matching CAPI supported_endpoints vocabulary
8890#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8891pub enum AssistantUsageApiEndpoint {
8892 /// Chat Completions API endpoint.
8893 #[serde(rename = "/chat/completions")]
8894 ChatCompletions,
8895 /// Anthropic Messages API endpoint.
8896 #[serde(rename = "/v1/messages")]
8897 V1Messages,
8898 /// Responses API endpoint.
8899 #[serde(rename = "/responses")]
8900 Responses,
8901 /// WebSocket Responses API endpoint.
8902 #[serde(rename = "ws:/responses")]
8903 WsResponses,
8904 /// Unknown variant for forward compatibility.
8905 #[default]
8906 #[serde(other)]
8907 Unknown,
8908}
8909
8910/// Transport used for a successful model call
8911#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8912pub enum AssistantUsageTransport {
8913 /// HTTP transport, including SSE streams.
8914 #[serde(rename = "http")]
8915 Http,
8916 /// WebSocket transport.
8917 #[serde(rename = "websocket")]
8918 Websocket,
8919 /// Unknown variant for forward compatibility.
8920 #[default]
8921 #[serde(other)]
8922 Unknown,
8923}
8924
8925/// 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.
8926#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8927pub enum ModelCallFailureBadRequestKind {
8928 /// The 400 response carried no error body (transient gateway/proxy signature).
8929 #[serde(rename = "bodyless")]
8930 Bodyless,
8931 /// The 400 response carried a structured CAPI error envelope (deterministic validation failure).
8932 #[serde(rename = "structured_error")]
8933 StructuredError,
8934 /// Unknown variant for forward compatibility.
8935 #[default]
8936 #[serde(other)]
8937 Unknown,
8938}
8939
8940/// Boundary that produced a model call failure
8941#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8942pub enum ModelCallFailureKind {
8943 /// The provider returned an API error response.
8944 #[serde(rename = "api")]
8945 Api,
8946 /// The request transport failed before a usable API response completed.
8947 #[serde(rename = "transport")]
8948 Transport,
8949 /// Unknown variant for forward compatibility.
8950 #[default]
8951 #[serde(other)]
8952 Unknown,
8953}
8954
8955/// Where the failed model call originated
8956#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8957pub enum ModelCallFailureSource {
8958 /// Model call from the top-level agent.
8959 #[serde(rename = "top_level")]
8960 TopLevel,
8961 /// Model call from a sub-agent.
8962 #[serde(rename = "subagent")]
8963 Subagent,
8964 /// Model call from MCP sampling.
8965 #[serde(rename = "mcp_sampling")]
8966 McpSampling,
8967 /// Unknown variant for forward compatibility.
8968 #[default]
8969 #[serde(other)]
8970 Unknown,
8971}
8972
8973/// Final outcome of one logical model dispatch after response acceptance processing
8974#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8975pub enum ModelCallFinishedOutcome {
8976 /// The provider response was accepted for continued agent processing.
8977 #[serde(rename = "success")]
8978 Success,
8979 /// The dispatch ended with a provider or transport error.
8980 #[serde(rename = "error")]
8981 Error,
8982 /// The dispatch was cancelled before an accepted response was produced.
8983 #[serde(rename = "cancelled")]
8984 Cancelled,
8985 /// The provider response was rejected during post-response acceptance processing.
8986 #[serde(rename = "rejected")]
8987 Rejected,
8988 /// Unknown variant for forward compatibility.
8989 #[default]
8990 #[serde(other)]
8991 Unknown,
8992}
8993
8994/// Finite reason code describing why the current turn was aborted
8995#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
8996pub enum AbortReason {
8997 /// The local user requested the abort, for example by pressing Ctrl+C in the CLI.
8998 #[serde(rename = "user_initiated")]
8999 UserInitiated,
9000 /// A remote command requested the abort.
9001 #[serde(rename = "remote_command")]
9002 RemoteCommand,
9003 /// An MCP server delivered a user.abort notification.
9004 #[serde(rename = "user_abort")]
9005 UserAbort,
9006 /// Autopilot stopped the run because the active objective reached its user-set --max-ai-credits limit.
9007 #[serde(rename = "autopilot_credit_limit")]
9008 AutopilotCreditLimit,
9009 /// Unknown variant for forward compatibility.
9010 #[default]
9011 #[serde(other)]
9012 Unknown,
9013}
9014
9015/// Configuration source: user, workspace, plugin, builtin, or managed
9016#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
9017pub enum McpServerSource {
9018 /// Server configured in the user's global MCP configuration.
9019 #[serde(rename = "user")]
9020 User,
9021 /// Server configured by the current workspace.
9022 #[serde(rename = "workspace")]
9023 Workspace,
9024 /// Server contributed by an installed plugin.
9025 #[serde(rename = "plugin")]
9026 Plugin,
9027 /// Server bundled with the runtime.
9028 #[serde(rename = "builtin")]
9029 Builtin,
9030 /// Server supplied by a trusted host-managed catalog.
9031 #[serde(rename = "managed")]
9032 Managed,
9033 /// Unknown variant for forward compatibility.
9034 #[default]
9035 #[serde(other)]
9036 Unknown,
9037}
9038
9039/// Transport mechanism: stdio, http, sse (deprecated), or memory (in-process MCP server)
9040#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
9041pub enum McpServerTransport {
9042 /// Server communicates over stdio with a local child process.
9043 #[serde(rename = "stdio")]
9044 Stdio,
9045 /// Server communicates over streamable HTTP.
9046 #[serde(rename = "http")]
9047 Http,
9048 /// Server communicates over Server-Sent Events (deprecated).
9049 #[serde(rename = "sse")]
9050 Sse,
9051 /// Server is backed by an in-memory runtime implementation.
9052 #[serde(rename = "memory")]
9053 Memory,
9054 /// Unknown variant for forward compatibility.
9055 #[default]
9056 #[serde(other)]
9057 Unknown,
9058}
9059
9060/// Allowed values for the `ToolExecutionStartToolDescriptionMetaUIVisibility` enumeration.
9061#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
9062pub enum ToolExecutionStartToolDescriptionMetaUIVisibility {
9063 /// Tool is callable by the model (LLM tool surface)
9064 #[serde(rename = "model")]
9065 Model,
9066 /// Tool is callable by the MCP App view (iframe) via session.mcp.apps.callTool
9067 #[serde(rename = "app")]
9068 App,
9069 /// Unknown variant for forward compatibility.
9070 #[default]
9071 #[serde(other)]
9072 Unknown,
9073}
9074
9075/// Binary result type discriminator. Use "image" for images and "resource" for other binary data.
9076#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
9077pub enum PersistedBinaryImageType {
9078 /// Binary image data.
9079 #[serde(rename = "image")]
9080 Image,
9081 /// Other binary resource data.
9082 #[serde(rename = "resource")]
9083 Resource,
9084 /// Unknown variant for forward compatibility.
9085 #[default]
9086 #[serde(other)]
9087 Unknown,
9088}
9089
9090/// Why the binary data is absent: it exceeded the inline size limit, or its asset was unavailable
9091#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
9092pub enum OmittedBinaryOmittedReason {
9093 /// Bytes exceeded the session's inline size limit.
9094 #[serde(rename = "too_large")]
9095 TooLarge,
9096 /// The referenced binary asset could not be found (e.g. a truncated log).
9097 #[serde(rename = "asset_unavailable")]
9098 AssetUnavailable,
9099 /// Unknown variant for forward compatibility.
9100 #[default]
9101 #[serde(other)]
9102 Unknown,
9103}
9104
9105/// Binary result type discriminator. Use "image" for images and "resource" for other binary data.
9106#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
9107pub enum OmittedBinaryType {
9108 /// Binary image data.
9109 #[serde(rename = "image")]
9110 Image,
9111 /// Other binary resource data.
9112 #[serde(rename = "resource")]
9113 Resource,
9114 /// Unknown variant for forward compatibility.
9115 #[default]
9116 #[serde(other)]
9117 Unknown,
9118}
9119
9120/// Binary result type discriminator. Use "image" for images and "resource" for other binary data.
9121#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
9122pub enum BinaryAssetReferenceType {
9123 /// Binary image data.
9124 #[serde(rename = "image")]
9125 Image,
9126 /// Other binary resource data.
9127 #[serde(rename = "resource")]
9128 Resource,
9129 /// Unknown variant for forward compatibility.
9130 #[default]
9131 #[serde(other)]
9132 Unknown,
9133}
9134
9135/// A model-facing binary result as persisted: full inline data, a size-omitted marker, or a deduplicated asset reference
9136///
9137/// <div class="warning">
9138///
9139/// **Experimental.** This type is part of an experimental wire-protocol surface
9140/// and may change or be removed in future SDK or CLI releases.
9141///
9142/// </div>
9143#[derive(Debug, Clone, Serialize, Deserialize)]
9144#[serde(untagged)]
9145pub enum PersistedBinaryResult {
9146 PersistedBinaryImage(PersistedBinaryImage),
9147 OmittedBinaryResult(OmittedBinaryResult),
9148 BinaryAssetReference(BinaryAssetReference),
9149}
9150
9151/// Content block type discriminator
9152#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
9153pub enum ToolExecutionCompleteContentTextType {
9154 #[serde(rename = "text")]
9155 #[default]
9156 Text,
9157}
9158
9159/// Content block type discriminator
9160#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
9161pub enum ToolExecutionCompleteContentTerminalType {
9162 #[serde(rename = "terminal")]
9163 #[default]
9164 Terminal,
9165}
9166
9167/// Content block type discriminator
9168#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
9169pub enum ToolExecutionCompleteContentShellExitType {
9170 #[serde(rename = "shell_exit")]
9171 #[default]
9172 ShellExit,
9173}
9174
9175/// Content block type discriminator
9176#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
9177pub enum ToolExecutionCompleteContentImageType {
9178 #[serde(rename = "image")]
9179 #[default]
9180 Image,
9181}
9182
9183/// Content block type discriminator
9184#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
9185pub enum ToolExecutionCompleteContentAudioType {
9186 #[serde(rename = "audio")]
9187 #[default]
9188 Audio,
9189}
9190
9191/// Theme variant this icon is intended for
9192#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
9193pub enum ToolExecutionCompleteContentResourceLinkIconTheme {
9194 /// Icon intended for light themes.
9195 #[serde(rename = "light")]
9196 Light,
9197 /// Icon intended for dark themes.
9198 #[serde(rename = "dark")]
9199 Dark,
9200 /// Unknown variant for forward compatibility.
9201 #[default]
9202 #[serde(other)]
9203 Unknown,
9204}
9205
9206/// Content block type discriminator
9207#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
9208pub enum ToolExecutionCompleteContentResourceLinkType {
9209 #[serde(rename = "resource_link")]
9210 #[default]
9211 ResourceLink,
9212}
9213
9214/// The embedded resource contents, either text or base64-encoded binary
9215#[derive(Debug, Clone, Serialize, Deserialize)]
9216#[serde(untagged)]
9217pub enum ToolExecutionCompleteContentResourceDetails {
9218 EmbeddedTextResourceContents(EmbeddedTextResourceContents),
9219 EmbeddedBlobResourceContents(EmbeddedBlobResourceContents),
9220}
9221
9222/// Content block type discriminator
9223#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
9224pub enum ToolExecutionCompleteContentResourceType {
9225 #[serde(rename = "resource")]
9226 #[default]
9227 Resource,
9228}
9229
9230/// A content block within a tool result, which may be text, terminal output, image, audio, or a resource
9231#[derive(Debug, Clone, Serialize, Deserialize)]
9232#[serde(untagged)]
9233pub enum ToolExecutionCompleteContent {
9234 Text(ToolExecutionCompleteContentText),
9235 Terminal(ToolExecutionCompleteContentTerminal),
9236 ShellExit(ToolExecutionCompleteContentShellExit),
9237 Image(ToolExecutionCompleteContentImage),
9238 Audio(ToolExecutionCompleteContentAudio),
9239 ResourceLink(ToolExecutionCompleteContentResourceLink),
9240 Resource(ToolExecutionCompleteContentResource),
9241}
9242
9243/// Allowed values for the `ToolExecutionCompleteToolDescriptionMetaUIVisibility` enumeration.
9244#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
9245pub enum ToolExecutionCompleteToolDescriptionMetaUIVisibility {
9246 /// Tool is callable by the model (LLM tool surface)
9247 #[serde(rename = "model")]
9248 Model,
9249 /// Tool is callable by the MCP App view (iframe) via session.mcp.apps.callTool
9250 #[serde(rename = "app")]
9251 App,
9252 /// Unknown variant for forward compatibility.
9253 #[default]
9254 #[serde(other)]
9255 Unknown,
9256}
9257
9258/// 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)
9259#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
9260pub enum SkillInvokedTrigger {
9261 /// Skill invocation requested explicitly by the user, such as via a slash command or UI affordance.
9262 #[serde(rename = "user-invoked")]
9263 UserInvoked,
9264 /// Skill invocation requested by the agent.
9265 #[serde(rename = "agent-invoked")]
9266 AgentInvoked,
9267 /// Skill content loaded as part of another context, such as a configured custom agent or subagent.
9268 #[serde(rename = "context-load")]
9269 ContextLoad,
9270 /// Unknown variant for forward compatibility.
9271 #[default]
9272 #[serde(other)]
9273 Unknown,
9274}
9275
9276/// Process-containment backend selected for the host platform
9277#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
9278pub enum SandboxBackend {
9279 /// Apple Seatbelt process sandbox.
9280 #[serde(rename = "seatbelt")]
9281 Seatbelt,
9282 /// Linux Bubblewrap process sandbox.
9283 #[serde(rename = "bubblewrap")]
9284 Bubblewrap,
9285 /// Windows ProcessContainer sandbox.
9286 #[serde(rename = "process_container")]
9287 ProcessContainer,
9288 /// No supported process-containment backend is available.
9289 #[serde(rename = "unsupported")]
9290 Unsupported,
9291 /// Unknown variant for forward compatibility.
9292 #[default]
9293 #[serde(other)]
9294 Unknown,
9295}
9296
9297/// Customer-controllable sandbox governance area
9298#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
9299pub enum SandboxControl {
9300 /// Process containment and sandbox spawn behavior.
9301 #[serde(rename = "process")]
9302 Process,
9303 /// Filesystem read, write, and deny policy.
9304 #[serde(rename = "filesystem")]
9305 Filesystem,
9306 /// Outbound and local-network access policy.
9307 #[serde(rename = "network")]
9308 Network,
9309 /// Selection of the sandbox or built-in enforcement route.
9310 #[serde(rename = "routing")]
9311 Routing,
9312 /// Decisions to run outside the process sandbox, whether requested by the model or resolved by a person.
9313 #[serde(rename = "bypass")]
9314 Bypass,
9315 /// Credential and keychain capability injection.
9316 #[serde(rename = "credentials")]
9317 Credentials,
9318 /// Host-platform and backend support behavior.
9319 #[serde(rename = "platform")]
9320 Platform,
9321 /// Unknown variant for forward compatibility.
9322 #[default]
9323 #[serde(other)]
9324 Unknown,
9325}
9326
9327/// Finite reason why sandbox enforcement is weaker than configured
9328#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
9329pub enum SandboxDegradationReason {
9330 /// The selected backend cannot enforce per-path deny rules.
9331 #[serde(rename = "denied_paths_unsupported")]
9332 DeniedPathsUnsupported,
9333 /// The host platform has no supported process-containment backend.
9334 #[serde(rename = "unsupported_platform")]
9335 UnsupportedPlatform,
9336 /// Unknown variant for forward compatibility.
9337 #[default]
9338 #[serde(other)]
9339 Unknown,
9340}
9341
9342/// Runtime boundary that enforced or routed a sandbox decision
9343#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
9344pub enum SandboxEnforcementPoint {
9345 /// Shell command process containment.
9346 #[serde(rename = "shell")]
9347 Shell,
9348 /// Built-in filesystem policy enforcement.
9349 #[serde(rename = "builtin_filesystem")]
9350 BuiltinFilesystem,
9351 /// Search-tool sandbox or policy enforcement.
9352 #[serde(rename = "search")]
9353 Search,
9354 /// Web-fetch network policy enforcement.
9355 #[serde(rename = "web_fetch")]
9356 WebFetch,
9357 /// Model Context Protocol server routing.
9358 #[serde(rename = "mcp")]
9359 Mcp,
9360 /// Language server process routing.
9361 #[serde(rename = "lsp")]
9362 Lsp,
9363 /// Unknown variant for forward compatibility.
9364 #[default]
9365 #[serde(other)]
9366 Unknown,
9367}
9368
9369/// Sandbox decision variant discriminator.
9370#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
9371pub enum SandboxDecisionDataPolicyResolvedKind {
9372 #[serde(rename = "policy_resolved")]
9373 #[default]
9374 PolicyResolved,
9375}
9376
9377/// Finite result of a sandbox decision. Each `SandboxDecisionData` variant uses a disjoint subset: `policy_resolved` is `resolved | degraded`, `spawn_completed` and `permissive_retry_completed` are `succeeded | failed`, `enforcement_state` is `engaged | inactive | failed`, `access_denied` is `denied`, and escalation decisions are `approved | declined`.
9378#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
9379pub enum SandboxOutcome {
9380 /// The sandbox policy resolved successfully. Describes configuration only and makes no claim that a backend engaged.
9381 #[serde(rename = "resolved")]
9382 Resolved,
9383 /// No sandbox governed the workload.
9384 #[serde(rename = "inactive")]
9385 Inactive,
9386 /// A runtime-owned containment backend accepted the workload. Evidence of engagement, not of verified containment for the workload's lifetime.
9387 #[serde(rename = "engaged")]
9388 Engaged,
9389 /// The sandbox operation completed successfully.
9390 #[serde(rename = "succeeded")]
9391 Succeeded,
9392 /// The sandbox operation failed.
9393 #[serde(rename = "failed")]
9394 Failed,
9395 /// The sandbox is active with one or more controls weakened by platform limitations or an explicitly selected relaxed mode.
9396 #[serde(rename = "degraded")]
9397 Degraded,
9398 /// An enforcement check refused the requested access.
9399 #[serde(rename = "denied")]
9400 Denied,
9401 /// A request to run outside the process sandbox was granted.
9402 #[serde(rename = "approved")]
9403 Approved,
9404 /// A request to run outside the process sandbox was not granted.
9405 #[serde(rename = "declined")]
9406 Declined,
9407 /// Unknown variant for forward compatibility.
9408 #[default]
9409 #[serde(other)]
9410 Unknown,
9411}
9412
9413/// Host operating-system family used for sandbox enforcement
9414#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
9415pub enum SandboxPlatform {
9416 /// Apple macOS host.
9417 #[serde(rename = "macos")]
9418 Macos,
9419 /// Linux host.
9420 #[serde(rename = "linux")]
9421 Linux,
9422 /// Microsoft Windows host.
9423 #[serde(rename = "windows")]
9424 Windows,
9425 /// Host platform outside the explicitly supported families.
9426 #[serde(rename = "other")]
9427 Other,
9428 /// Unknown variant for forward compatibility.
9429 #[default]
9430 #[serde(other)]
9431 Unknown,
9432}
9433
9434/// Origin of the effective sandbox policy
9435#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
9436pub enum SandboxPolicySource {
9437 /// Runtime default sandbox policy.
9438 #[serde(rename = "default_policy")]
9439 DefaultPolicy,
9440 /// User-configured sandbox policy merged with runtime-required grants.
9441 #[serde(rename = "user_policy")]
9442 UserPolicy,
9443 /// Unknown variant for forward compatibility.
9444 #[default]
9445 #[serde(other)]
9446 Unknown,
9447}
9448
9449/// Bounded classification of effective sandbox proxy routing
9450#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
9451pub enum SandboxProxyMode {
9452 /// No sandbox proxy is configured.
9453 #[serde(rename = "none")]
9454 None,
9455 /// Traffic routes through a loopback proxy.
9456 #[serde(rename = "loopback")]
9457 Loopback,
9458 /// Traffic routes through a non-loopback proxy endpoint.
9459 #[serde(rename = "external")]
9460 External,
9461 /// Unknown variant for forward compatibility.
9462 #[default]
9463 #[serde(other)]
9464 Unknown,
9465}
9466
9467/// Sandbox decision variant discriminator.
9468#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
9469pub enum SandboxDecisionDataSpawnCompletedKind {
9470 #[serde(rename = "spawn_completed")]
9471 #[default]
9472 SpawnCompleted,
9473}
9474
9475/// Runtime observation backing an enforcement-state or denial claim. Absent on `enforcement_state` when no observation backs the state.
9476#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
9477pub enum SandboxAttestation {
9478 /// A containment backend accepted and applied the spawn request.
9479 #[serde(rename = "spawn_succeeded")]
9480 SpawnSucceeded,
9481 /// The spawn was refused for lack of a usable containment backend.
9482 #[serde(rename = "unsupported")]
9483 Unsupported,
9484 /// A runtime-owned policy check ran and returned a verdict. Attests the check, not that the caller honoured it.
9485 #[serde(rename = "builtin_policy_checked")]
9486 BuiltinPolicyChecked,
9487 /// Unknown variant for forward compatibility.
9488 #[default]
9489 #[serde(other)]
9490 Unknown,
9491}
9492
9493/// Sandbox decision variant discriminator.
9494#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
9495pub enum SandboxDecisionDataEnforcementStateKind {
9496 #[serde(rename = "enforcement_state")]
9497 #[default]
9498 EnforcementState,
9499}
9500
9501/// How strong the evidence behind a denial is. A denial the sandbox itself recorded is a fact; one inferred from a command's output text is a judgement, and an analysis that cannot tell them apart will treat a false positive as enforcement.
9502#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
9503pub enum SandboxDenialConfidence {
9504 /// The sandbox's own denial capture recorded the refused access. The strongest evidence available: the kernel observed it, not the runtime.
9505 #[serde(rename = "captured")]
9506 Captured,
9507 /// The command named a path that the effective policy independently denies. No capture confirmed it, but the policy did.
9508 #[serde(rename = "policy_corroborated")]
9509 PolicyCorroborated,
9510 /// The failure carried a fingerprint the sandbox itself emits, so the sandbox is known to have refused something even though the resource was not confirmed.
9511 #[serde(rename = "sandbox_reported")]
9512 SandboxReported,
9513 /// Classified from the command's own output text alone. The weakest evidence: a command that merely prints sandbox-like wording reaches this level.
9514 #[serde(rename = "output_classified")]
9515 OutputClassified,
9516 /// Unknown variant for forward compatibility.
9517 #[default]
9518 #[serde(other)]
9519 Unknown,
9520}
9521
9522/// Bounded class of access an enforcement check refused. Raw resources, commands, and process names accompany it only when content capture is enabled; diagnostic text and matched rules are never exported.
9523#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
9524pub enum SandboxDenialClass {
9525 /// A read was refused because the effective policy does not grant it.
9526 #[serde(rename = "filesystem_read")]
9527 FilesystemRead,
9528 /// A write was refused. Distinct from `filesystem_read` because a read-only grant denies writes to a path it otherwise permits.
9529 #[serde(rename = "filesystem_write")]
9530 FilesystemWrite,
9531 /// A process could not start because the sandbox refused a required process-scoped resource. Currently emitted for the Windows MSYS `BaseNamedObjects` fork failure confirmed by learning-mode capture.
9532 #[serde(rename = "process_startup")]
9533 ProcessStartup,
9534 /// Windows registry access was refused and correlated with capture evidence.
9535 #[serde(rename = "registry_access")]
9536 RegistryAccess,
9537 /// Windows ALPC or RPC access was refused and correlated with capture evidence.
9538 #[serde(rename = "ipc_access")]
9539 IpcAccess,
9540 /// Access to another Windows process was refused and correlated with capture evidence.
9541 #[serde(rename = "process_access")]
9542 ProcessAccess,
9543 /// Windows job-object access was refused and correlated with capture evidence.
9544 #[serde(rename = "job_access")]
9545 JobAccess,
9546 /// Windows UI-handle access was refused and correlated with capture evidence.
9547 #[serde(rename = "ui_access")]
9548 UiAccess,
9549 /// Windows service-control-manager access was refused and correlated with capture evidence.
9550 #[serde(rename = "service_access")]
9551 ServiceAccess,
9552 /// An outbound connection was refused by `network.allowOutbound`.
9553 #[serde(rename = "network_outbound")]
9554 NetworkOutbound,
9555 /// A connection to a local or loopback destination was refused by `network.allowLocalNetwork`.
9556 #[serde(rename = "network_local")]
9557 NetworkLocal,
9558 /// A destination was refused by the sandbox host allow/deny rules.
9559 #[serde(rename = "network_host")]
9560 NetworkHost,
9561 /// The sandbox's denial capture recorded a refusal its record does not attribute to a more specific control: an unclassified resource (registry, COM, section object) or an AppContainer capability with no network meaning. Deliberately generic — the capture proves the denial happened, and naming a narrower class than the record supports would be a guess.
9562 #[serde(rename = "other_access")]
9563 OtherAccess,
9564 /// Unknown variant for forward compatibility.
9565 #[default]
9566 #[serde(other)]
9567 Unknown,
9568}
9569
9570/// Sandbox decision variant discriminator.
9571#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
9572pub enum SandboxDecisionDataAccessDeniedKind {
9573 #[serde(rename = "access_denied")]
9574 #[default]
9575 AccessDenied,
9576}
9577
9578/// Sandbox decision variant discriminator.
9579#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
9580pub enum SandboxDecisionDataBypassDecidedKind {
9581 #[serde(rename = "bypass_decided")]
9582 #[default]
9583 BypassDecided,
9584}
9585
9586/// Where a request to run outside the process sandbox originated. Orthogonal to the outcome: the same verdict means a different thing depending on where the request came from.
9587#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
9588pub enum SandboxBypassSource {
9589 /// No longer produced. The model could once ask for a bypass in the tool call itself; no tool exposes that parameter now. Retained so historical events still deserialize.
9590 #[serde(rename = "model_requested")]
9591 ModelRequested,
9592 /// The runtime raised the prompt itself — either after a sandboxed attempt looked blocked, or before a run the sandbox cannot enforce at all, such as a detached command — and a person answered it. In the second case nothing had executed when the decision was made.
9593 #[serde(rename = "user_prompted")]
9594 UserPrompted,
9595 /// The runtime raised the prompt itself — after a sandboxed attempt looked blocked, or before a run it cannot enforce — but the permission flow produced no confirmed human answer. This includes unavailable or unreadable prompts, cancellation, and automated rule, hook, or content-exclusion denials.
9596 #[serde(rename = "prompt_unavailable")]
9597 PromptUnavailable,
9598 /// Unknown variant for forward compatibility.
9599 #[default]
9600 #[serde(other)]
9601 Unknown,
9602}
9603
9604/// Sandbox decision variant discriminator.
9605#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
9606pub enum SandboxDecisionDataPermissiveRetryDecidedKind {
9607 #[serde(rename = "permissive_retry_decided")]
9608 #[default]
9609 PermissiveRetryDecided,
9610}
9611
9612/// Sandbox decision variant discriminator.
9613#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
9614pub enum SandboxDecisionDataPermissiveRetryCompletedKind {
9615 #[serde(rename = "permissive_retry_completed")]
9616 #[default]
9617 PermissiveRetryCompleted,
9618}
9619
9620/// 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`.
9621#[derive(Debug, Clone, Serialize, Deserialize)]
9622#[serde(untagged)]
9623pub enum SandboxDecisionData {
9624 PolicyResolved(SandboxDecisionDataPolicyResolved),
9625 SpawnCompleted(SandboxDecisionDataSpawnCompleted),
9626 EnforcementState(SandboxDecisionDataEnforcementState),
9627 AccessDenied(SandboxDecisionDataAccessDenied),
9628 BypassDecided(SandboxDecisionDataBypassDecided),
9629 PermissiveRetryDecided(SandboxDecisionDataPermissiveRetryDecided),
9630 PermissiveRetryCompleted(SandboxDecisionDataPermissiveRetryCompleted),
9631}
9632
9633/// Authority or runtime mechanism responsible for sub-agent model selection.
9634#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
9635pub enum SubagentModelSelectionSource {
9636 /// Explicit model supplied by the parent agent on the task call and selected for dispatch.
9637 #[serde(rename = "explicit_override")]
9638 ExplicitOverride,
9639 /// Required model policy configured for the sub-agent.
9640 #[serde(rename = "configured_required")]
9641 ConfiguredRequired,
9642 /// Non-required model preference configured for the sub-agent.
9643 #[serde(rename = "configured_preference")]
9644 ConfiguredPreference,
9645 /// Complementary-model default selected for the sub-agent.
9646 #[serde(rename = "complementary_default")]
9647 ComplementaryDefault,
9648 /// Model inherited from the parent session.
9649 #[serde(rename = "session_inheritance")]
9650 SessionInheritance,
9651 /// Default model declared by the agent definition.
9652 #[serde(rename = "agent_definition_default")]
9653 AgentDefinitionDefault,
9654 /// Runtime policy, Auto mode, or an experiment selected the model.
9655 #[serde(rename = "runtime_policy")]
9656 RuntimePolicy,
9657 /// Unknown variant for forward compatibility.
9658 #[default]
9659 #[serde(other)]
9660 Unknown,
9661}
9662
9663/// Where the model input for a task-tool sub-agent came from.
9664#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
9665pub enum SubagentTaskModelSource {
9666 /// The spawning agent supplied the task tool's model argument.
9667 #[serde(rename = "task_argument")]
9668 TaskArgument,
9669 /// The task omitted a model and the per-sub-agent settings entry supplied a concrete one.
9670 #[serde(rename = "subagent_configuration")]
9671 SubagentConfiguration,
9672 /// The task omitted a model and the user-defined custom agent's definition supplied one.
9673 #[serde(rename = "custom_agent_definition")]
9674 CustomAgentDefinition,
9675 /// Neither the task call, the per-sub-agent settings entry, nor a custom agent definition supplied a model.
9676 #[serde(rename = "unset")]
9677 Unset,
9678 /// Unknown variant for forward compatibility.
9679 #[default]
9680 #[serde(other)]
9681 Unknown,
9682}
9683
9684/// Binary asset type discriminator. Use "image" for images and "resource" otherwise.
9685#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
9686pub enum BinaryAssetType {
9687 /// Binary image data.
9688 #[serde(rename = "image")]
9689 Image,
9690 /// Other binary resource data.
9691 #[serde(rename = "resource")]
9692 Resource,
9693 /// Unknown variant for forward compatibility.
9694 #[default]
9695 #[serde(other)]
9696 Unknown,
9697}
9698
9699/// Message role: "system" for system prompts, "developer" for developer-injected instructions
9700#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
9701pub enum SystemMessageRole {
9702 /// System prompt message.
9703 #[serde(rename = "system")]
9704 System,
9705 /// Developer instruction message.
9706 #[serde(rename = "developer")]
9707 Developer,
9708 /// Unknown variant for forward compatibility.
9709 #[default]
9710 #[serde(other)]
9711 Unknown,
9712}
9713
9714/// Permission kind discriminator
9715#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
9716pub enum PermissionRequestShellKind {
9717 #[serde(rename = "shell")]
9718 #[default]
9719 Shell,
9720}
9721
9722/// Permission kind discriminator
9723#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
9724pub enum PermissionRequestWriteKind {
9725 #[serde(rename = "write")]
9726 #[default]
9727 Write,
9728}
9729
9730/// Permission kind discriminator
9731#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
9732pub enum PermissionRequestReadKind {
9733 #[serde(rename = "read")]
9734 #[default]
9735 Read,
9736}
9737
9738/// Permission kind discriminator
9739#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
9740pub enum PermissionRequestMcpKind {
9741 #[serde(rename = "mcp")]
9742 #[default]
9743 Mcp,
9744}
9745
9746/// 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.
9747///
9748/// <div class="warning">
9749///
9750/// **Experimental.** This type is part of an experimental wire-protocol surface
9751/// and may change or be removed in future SDK or CLI releases.
9752///
9753/// </div>
9754#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
9755pub enum PermissionRecommendation {
9756 /// 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.
9757 #[serde(rename = "approve")]
9758 Approve,
9759 /// Unknown variant for forward compatibility.
9760 #[default]
9761 #[serde(other)]
9762 Unknown,
9763}
9764
9765/// Permission kind discriminator
9766#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
9767pub enum PermissionRequestUrlKind {
9768 #[serde(rename = "url")]
9769 #[default]
9770 Url,
9771}
9772
9773/// Whether this is a store or vote memory operation
9774#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
9775pub enum PermissionRequestMemoryAction {
9776 /// Store a new memory.
9777 #[serde(rename = "store")]
9778 Store,
9779 /// Vote on an existing memory.
9780 #[serde(rename = "vote")]
9781 Vote,
9782 /// Unknown variant for forward compatibility.
9783 #[default]
9784 #[serde(other)]
9785 Unknown,
9786}
9787
9788/// Stage that produced this attribution.
9789#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
9790pub enum PermissionApprovalEvaluationEvaluationStage {
9791 /// The attribution stage is unknown.
9792 #[serde(rename = "unknown")]
9793 UnknownValue,
9794 /// The request resolved before assisted-approval evaluation.
9795 #[serde(rename = "not_reached")]
9796 NotReached,
9797 /// A runtime gate skipped the judge.
9798 #[serde(rename = "pre_judge")]
9799 PreJudge,
9800 /// The judge interface produced the evaluation.
9801 #[serde(rename = "judge")]
9802 Judge,
9803 /// A cached recommendation or another request's outcome was reused.
9804 #[serde(rename = "reuse")]
9805 Reuse,
9806 /// Unknown variant for forward compatibility.
9807 #[default]
9808 #[serde(other)]
9809 Unknown,
9810}
9811
9812/// Status of the local judge interface, not proof of a model network call.
9813#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
9814pub enum PermissionApprovalEvaluationJudgeStatus {
9815 /// No authoritative attribution is available.
9816 #[serde(rename = "unknown")]
9817 UnknownValue,
9818 /// This evaluation did not invoke the judge interface.
9819 #[serde(rename = "not_called")]
9820 NotCalled,
9821 /// The judge interface returned a usable verdict.
9822 #[serde(rename = "completed")]
9823 Completed,
9824 /// The judge interface returned an error.
9825 #[serde(rename = "failed")]
9826 Failed,
9827 /// This evaluation reused a cached recommendation.
9828 #[serde(rename = "cached")]
9829 Cached,
9830 /// This request inherited another decision without local judge attribution.
9831 #[serde(rename = "inherited")]
9832 Inherited,
9833 /// Unknown variant for forward compatibility.
9834 #[default]
9835 #[serde(other)]
9836 Unknown,
9837}
9838
9839/// Machine-readable runtime gate reason, never a command, path or human rationale.
9840#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
9841pub enum PermissionApprovalEvaluationReasonCode {
9842 /// Attribution is missing or outside the supported vocabulary.
9843 #[serde(rename = "unknown")]
9844 UnknownValue,
9845 /// The request resolved before assisted-approval evaluation.
9846 #[serde(rename = "not-reached")]
9847 NotReached,
9848 /// Assisted approval was inactive for this request.
9849 #[serde(rename = "inactive")]
9850 Inactive,
9851 /// The judge was skipped because authorization extraction could not safely establish a complete recent history.
9852 #[serde(rename = "authorization-history-incomplete")]
9853 AuthorizationHistoryIncomplete,
9854 /// Managed policy required a human decision.
9855 #[serde(rename = "managed-approval-required")]
9856 ManagedApprovalRequired,
9857 /// The request asked to bypass sandbox restrictions.
9858 #[serde(rename = "sandbox-bypass")]
9859 SandboxBypass,
9860 /// An action field exceeded the judge input limit.
9861 #[serde(rename = "action-too-long")]
9862 ActionTooLong,
9863 /// The script path was not authorized for inspection.
9864 #[serde(rename = "path-not-authorized")]
9865 PathNotAuthorized,
9866 /// The script working directory was invalid.
9867 #[serde(rename = "invalid-working-directory")]
9868 InvalidWorkingDirectory,
9869 /// The script snapshot could not be read.
9870 #[serde(rename = "unreadable")]
9871 Unreadable,
9872 /// The script path was not a regular file.
9873 #[serde(rename = "not-regular-file")]
9874 NotRegularFile,
9875 /// The script snapshot exceeded the size limit.
9876 #[serde(rename = "too-large")]
9877 TooLarge,
9878 /// The script snapshot was not UTF-8.
9879 #[serde(rename = "non-utf8")]
9880 NonUtf8,
9881 /// The script interpreter could not be inspected.
9882 #[serde(rename = "interpreter-unavailable")]
9883 InterpreterUnavailable,
9884 /// The interpreter snapshot exceeded the size limit.
9885 #[serde(rename = "interpreter-too-large")]
9886 InterpreterTooLarge,
9887 /// The shell environment could not be reviewed.
9888 #[serde(rename = "shell-environment-unreviewable")]
9889 ShellEnvironmentUnreviewable,
9890 /// A script path could not be represented for review.
9891 #[serde(rename = "unrepresentable-path")]
9892 UnrepresentablePath,
9893 /// An interpreter wrapped a script that could not be reviewed.
9894 #[serde(rename = "interpreter-wrapped-script")]
9895 InterpreterWrappedScript,
9896 /// The script invocation could not be reviewed.
9897 #[serde(rename = "unreviewable-script-invocation")]
9898 UnreviewableScriptInvocation,
9899 /// The script argument binding could not be reviewed.
9900 #[serde(rename = "argument-binding-unreviewable")]
9901 ArgumentBindingUnreviewable,
9902 /// The script review metadata was malformed.
9903 #[serde(rename = "malformed-script-action-review")]
9904 MalformedScriptActionReview,
9905 /// The script snapshot manifest was malformed.
9906 #[serde(rename = "malformed-script-action-manifest")]
9907 MalformedScriptActionManifest,
9908 /// Script review was unavailable.
9909 #[serde(rename = "unavailable")]
9910 Unavailable,
9911 /// The judge interface returned a usable verdict.
9912 #[serde(rename = "judge-verdict")]
9913 JudgeVerdict,
9914 /// The judge interface returned an error.
9915 #[serde(rename = "judge-error")]
9916 JudgeError,
9917 /// The request inherited an outcome from another decision.
9918 #[serde(rename = "inherited")]
9919 Inherited,
9920 /// Unknown variant for forward compatibility.
9921 #[default]
9922 #[serde(other)]
9923 Unknown,
9924}
9925
9926/// 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.
9927///
9928/// <div class="warning">
9929///
9930/// **Experimental.** This type is part of an experimental wire-protocol surface
9931/// and may change or be removed in future SDK or CLI releases.
9932///
9933/// </div>
9934#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
9935pub enum AssistedApprovalJudgeFailureReason {
9936 /// The judge model call exceeded its deadline.
9937 #[serde(rename = "timeout")]
9938 Timeout,
9939 /// The judge model call was cancelled before it returned.
9940 #[serde(rename = "abort")]
9941 Abort,
9942 /// The judge model call completed but returned no content.
9943 #[serde(rename = "empty_response")]
9944 EmptyResponse,
9945 /// The judge model call failed (for example a transport, authentication, or rate-limit error).
9946 #[serde(rename = "model_error")]
9947 ModelError,
9948 /// The judge model replied, but the reply carried no ALLOW/DENY verdict.
9949 #[serde(rename = "parse_error")]
9950 ParseError,
9951 /// Unknown variant for forward compatibility.
9952 #[default]
9953 #[serde(other)]
9954 Unknown,
9955}
9956
9957/// 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.
9958///
9959/// <div class="warning">
9960///
9961/// **Experimental.** This type is part of an experimental wire-protocol surface
9962/// and may change or be removed in future SDK or CLI releases.
9963///
9964/// </div>
9965#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
9966pub enum AssistedApprovalRecommendation {
9967 /// The judge evaluated the request and recommends automatically approving it.
9968 #[serde(rename = "approve")]
9969 Approve,
9970 /// 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.
9971 #[serde(rename = "requireApproval")]
9972 RequireApproval,
9973 /// Assisted mode is enabled, but this request category is never automatically approvable (for example, sandbox-bypass requests), so the judge was not consulted.
9974 #[serde(rename = "excluded")]
9975 Excluded,
9976 /// The judge was consulted but did not return a usable recommendation, so the request requires explicit approval.
9977 #[serde(rename = "error")]
9978 Error,
9979 /// Unknown variant for forward compatibility.
9980 #[default]
9981 #[serde(other)]
9982 Unknown,
9983}
9984
9985/// Vote direction (vote only)
9986#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
9987pub enum PermissionRequestMemoryDirection {
9988 /// Vote that the memory is useful or accurate.
9989 #[serde(rename = "upvote")]
9990 Upvote,
9991 /// Vote that the memory is incorrect or outdated.
9992 #[serde(rename = "downvote")]
9993 Downvote,
9994 /// Unknown variant for forward compatibility.
9995 #[default]
9996 #[serde(other)]
9997 Unknown,
9998}
9999
10000/// Permission kind discriminator
10001#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10002pub enum PermissionRequestMemoryKind {
10003 #[serde(rename = "memory")]
10004 #[default]
10005 Memory,
10006}
10007
10008/// Scope of a stored memory.
10009#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10010pub enum PermissionRequestMemoryScope {
10011 /// Store the memory for the current repository.
10012 #[serde(rename = "repository")]
10013 Repository,
10014 /// Store the memory for the current user.
10015 #[serde(rename = "user")]
10016 User,
10017 /// Unknown variant for forward compatibility.
10018 #[default]
10019 #[serde(other)]
10020 Unknown,
10021}
10022
10023/// Permission kind discriminator
10024#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10025pub enum PermissionRequestCustomToolKind {
10026 #[serde(rename = "custom-tool")]
10027 #[default]
10028 CustomTool,
10029}
10030
10031/// Permission kind discriminator
10032#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10033pub enum PermissionRequestHookKind {
10034 #[serde(rename = "hook")]
10035 #[default]
10036 Hook,
10037}
10038
10039/// Permission kind discriminator
10040#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10041pub enum PermissionRequestExtensionManagementKind {
10042 #[serde(rename = "extension-management")]
10043 #[default]
10044 ExtensionManagement,
10045}
10046
10047/// Permission kind discriminator
10048#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10049pub enum PermissionRequestFactoryKind {
10050 #[serde(rename = "factory")]
10051 #[default]
10052 Factory,
10053}
10054
10055/// Operation gated by a factory permission request.
10056#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10057pub enum FactoryPermissionOperation {
10058 /// Running a registered factory, which spends subagents, active time, and AI credits under the approved limits.
10059 #[serde(rename = "run")]
10060 Run,
10061 /// Authoring a factory, which writes JavaScript into a session-scoped extension and loads it.
10062 #[serde(rename = "author")]
10063 Author,
10064 /// Unknown variant for forward compatibility.
10065 #[default]
10066 #[serde(other)]
10067 Unknown,
10068}
10069
10070/// Permission kind discriminator
10071#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10072pub enum PermissionRequestExtensionPermissionAccessKind {
10073 #[serde(rename = "extension-permission-access")]
10074 #[default]
10075 ExtensionPermissionAccess,
10076}
10077
10078/// Permission kind discriminator
10079#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10080pub enum PermissionRequestExtensionEnvAccessKind {
10081 #[serde(rename = "extension-env-access")]
10082 #[default]
10083 ExtensionEnvAccess,
10084}
10085
10086/// Details of the permission being requested
10087#[derive(Debug, Clone, Serialize, Deserialize)]
10088#[serde(untagged)]
10089pub enum PermissionRequest {
10090 Shell(PermissionRequestShell),
10091 Write(PermissionRequestWrite),
10092 Read(PermissionRequestRead),
10093 Mcp(PermissionRequestMcp),
10094 Url(PermissionRequestUrl),
10095 Memory(PermissionRequestMemory),
10096 CustomTool(PermissionRequestCustomTool),
10097 Hook(PermissionRequestHook),
10098 ExtensionManagement(PermissionRequestExtensionManagement),
10099 Factory(PermissionRequestFactory),
10100 ExtensionPermissionAccess(PermissionRequestExtensionPermissionAccess),
10101 ExtensionEnvAccess(PermissionRequestExtensionEnvAccess),
10102}
10103
10104/// Prompt kind discriminator
10105#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10106pub enum PermissionPromptRequestCommandsKind {
10107 #[serde(rename = "commands")]
10108 #[default]
10109 Commands,
10110}
10111
10112/// Prompt kind discriminator
10113#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10114pub enum PermissionPromptRequestWriteKind {
10115 #[serde(rename = "write")]
10116 #[default]
10117 Write,
10118}
10119
10120/// Prompt kind discriminator
10121#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10122pub enum PermissionPromptRequestReadKind {
10123 #[serde(rename = "read")]
10124 #[default]
10125 Read,
10126}
10127
10128/// Prompt kind discriminator
10129#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10130pub enum PermissionPromptRequestMcpKind {
10131 #[serde(rename = "mcp")]
10132 #[default]
10133 Mcp,
10134}
10135
10136/// Prompt kind discriminator
10137#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10138pub enum PermissionPromptRequestUrlKind {
10139 #[serde(rename = "url")]
10140 #[default]
10141 Url,
10142}
10143
10144/// Prompt kind discriminator
10145#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10146pub enum PermissionPromptRequestMemoryKind {
10147 #[serde(rename = "memory")]
10148 #[default]
10149 Memory,
10150}
10151
10152/// Prompt kind discriminator
10153#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10154pub enum PermissionPromptRequestCustomToolKind {
10155 #[serde(rename = "custom-tool")]
10156 #[default]
10157 CustomTool,
10158}
10159
10160/// Underlying permission kind that needs path approval
10161#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10162pub enum PermissionPromptRequestPathAccessKind {
10163 /// Read access to a filesystem path.
10164 #[serde(rename = "read")]
10165 Read,
10166 /// Shell command access involving a filesystem path.
10167 #[serde(rename = "shell")]
10168 Shell,
10169 /// Write access to a filesystem path.
10170 #[serde(rename = "write")]
10171 Write,
10172 /// Unknown variant for forward compatibility.
10173 #[default]
10174 #[serde(other)]
10175 Unknown,
10176}
10177
10178/// Prompt kind discriminator
10179#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10180pub enum PermissionPromptRequestPathKind {
10181 #[serde(rename = "path")]
10182 #[default]
10183 Path,
10184}
10185
10186/// Prompt kind discriminator
10187#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10188pub enum PermissionPromptRequestHookKind {
10189 #[serde(rename = "hook")]
10190 #[default]
10191 Hook,
10192}
10193
10194/// Prompt kind discriminator
10195#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10196pub enum PermissionPromptRequestExtensionManagementKind {
10197 #[serde(rename = "extension-management")]
10198 #[default]
10199 ExtensionManagement,
10200}
10201
10202/// Prompt kind discriminator
10203#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10204pub enum PermissionPromptRequestFactoryKind {
10205 #[serde(rename = "factory")]
10206 #[default]
10207 Factory,
10208}
10209
10210/// Prompt kind discriminator
10211#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10212pub enum PermissionPromptRequestExtensionPermissionAccessKind {
10213 #[serde(rename = "extension-permission-access")]
10214 #[default]
10215 ExtensionPermissionAccess,
10216}
10217
10218/// Prompt kind discriminator
10219#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10220pub enum PermissionPromptRequestExtensionEnvAccessKind {
10221 #[serde(rename = "extension-env-access")]
10222 #[default]
10223 ExtensionEnvAccess,
10224}
10225
10226/// Derived user-facing permission prompt details for UI consumers
10227#[derive(Debug, Clone, Serialize, Deserialize)]
10228#[serde(untagged)]
10229pub enum PermissionPromptRequest {
10230 Commands(PermissionPromptRequestCommands),
10231 Write(PermissionPromptRequestWrite),
10232 Read(PermissionPromptRequestRead),
10233 Mcp(PermissionPromptRequestMcp),
10234 Url(PermissionPromptRequestUrl),
10235 Memory(PermissionPromptRequestMemory),
10236 CustomTool(PermissionPromptRequestCustomTool),
10237 Path(PermissionPromptRequestPath),
10238 Hook(PermissionPromptRequestHook),
10239 ExtensionManagement(PermissionPromptRequestExtensionManagement),
10240 Factory(PermissionPromptRequestFactory),
10241 ExtensionPermissionAccess(PermissionPromptRequestExtensionPermissionAccess),
10242 ExtensionEnvAccess(PermissionPromptRequestExtensionEnvAccess),
10243}
10244
10245/// Controlled reason or actor responsible for a permission response.
10246#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10247pub enum PermissionDecisionSource {
10248 /// The response followed the assisted-approval judge recommendation.
10249 #[serde(rename = "assisted_approval")]
10250 AssistedApproval,
10251 /// A human supplied the response through an interactive prompt.
10252 #[serde(rename = "human_response")]
10253 HumanResponse,
10254 /// The host applied a standing policy or override rather than a judge recommendation or human decision.
10255 #[serde(rename = "host_policy")]
10256 HostPolicy,
10257 /// The host denied the request because no interactive user response was available.
10258 #[serde(rename = "unattended_fallback")]
10259 UnattendedFallback,
10260 /// 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.
10261 #[serde(rename = "authorization_carry_forward")]
10262 AuthorizationCarryForward,
10263 /// Unknown variant for forward compatibility.
10264 #[default]
10265 #[serde(other)]
10266 Unknown,
10267}
10268
10269/// The permission request was approved
10270#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10271pub enum PermissionApprovedKind {
10272 #[serde(rename = "approved")]
10273 #[default]
10274 Approved,
10275}
10276
10277/// Command approval kind
10278#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10279pub enum UserToolSessionApprovalCommandsKind {
10280 #[serde(rename = "commands")]
10281 #[default]
10282 Commands,
10283}
10284
10285/// Read approval kind
10286#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10287pub enum UserToolSessionApprovalReadKind {
10288 #[serde(rename = "read")]
10289 #[default]
10290 Read,
10291}
10292
10293/// Write approval kind
10294#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10295pub enum UserToolSessionApprovalWriteKind {
10296 #[serde(rename = "write")]
10297 #[default]
10298 Write,
10299}
10300
10301/// MCP tool approval kind
10302#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10303pub enum UserToolSessionApprovalMcpKind {
10304 #[serde(rename = "mcp")]
10305 #[default]
10306 Mcp,
10307}
10308
10309/// Memory approval kind
10310#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10311pub enum UserToolSessionApprovalMemoryKind {
10312 #[serde(rename = "memory")]
10313 #[default]
10314 Memory,
10315}
10316
10317/// Custom tool approval kind
10318#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10319pub enum UserToolSessionApprovalCustomToolKind {
10320 #[serde(rename = "custom-tool")]
10321 #[default]
10322 CustomTool,
10323}
10324
10325/// Extension management approval kind
10326#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10327pub enum UserToolSessionApprovalExtensionManagementKind {
10328 #[serde(rename = "extension-management")]
10329 #[default]
10330 ExtensionManagement,
10331}
10332
10333/// Factory approval kind
10334#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10335pub enum UserToolSessionApprovalFactoryKind {
10336 #[serde(rename = "factory")]
10337 #[default]
10338 Factory,
10339}
10340
10341/// Extension permission access approval kind
10342#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10343pub enum UserToolSessionApprovalExtensionPermissionAccessKind {
10344 #[serde(rename = "extension-permission-access")]
10345 #[default]
10346 ExtensionPermissionAccess,
10347}
10348
10349/// Extension environment access approval kind
10350#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10351pub enum UserToolSessionApprovalExtensionEnvAccessKind {
10352 #[serde(rename = "extension-env-access")]
10353 #[default]
10354 ExtensionEnvAccess,
10355}
10356
10357/// The approval to add as a session-scoped rule
10358#[derive(Debug, Clone, Serialize, Deserialize)]
10359#[serde(untagged)]
10360pub enum UserToolSessionApproval {
10361 Commands(UserToolSessionApprovalCommands),
10362 Read(UserToolSessionApprovalRead),
10363 Write(UserToolSessionApprovalWrite),
10364 Mcp(UserToolSessionApprovalMcp),
10365 Memory(UserToolSessionApprovalMemory),
10366 CustomTool(UserToolSessionApprovalCustomTool),
10367 ExtensionManagement(UserToolSessionApprovalExtensionManagement),
10368 Factory(UserToolSessionApprovalFactory),
10369 ExtensionPermissionAccess(UserToolSessionApprovalExtensionPermissionAccess),
10370 ExtensionEnvAccess(UserToolSessionApprovalExtensionEnvAccess),
10371}
10372
10373/// Approved and remembered for the rest of the session
10374#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10375pub enum PermissionApprovedForSessionKind {
10376 #[serde(rename = "approved-for-session")]
10377 #[default]
10378 ApprovedForSession,
10379}
10380
10381/// Approved and persisted for this project location
10382#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10383pub enum PermissionApprovedForLocationKind {
10384 #[serde(rename = "approved-for-location")]
10385 #[default]
10386 ApprovedForLocation,
10387}
10388
10389/// The permission request was cancelled before a response was used
10390#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10391pub enum PermissionCancelledKind {
10392 #[serde(rename = "cancelled")]
10393 #[default]
10394 Cancelled,
10395}
10396
10397/// Denied because approval rules explicitly blocked it
10398#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10399pub enum PermissionDeniedByRulesKind {
10400 #[serde(rename = "denied-by-rules")]
10401 #[default]
10402 DeniedByRules,
10403}
10404
10405/// Denied because no approval rule matched and user confirmation was unavailable
10406#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10407pub enum PermissionDeniedNoApprovalRuleAndCouldNotRequestFromUserKind {
10408 #[serde(rename = "denied-no-approval-rule-and-could-not-request-from-user")]
10409 #[default]
10410 DeniedNoApprovalRuleAndCouldNotRequestFromUser,
10411}
10412
10413/// Denied by the user during an interactive prompt
10414#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10415pub enum PermissionDeniedInteractivelyByUserKind {
10416 #[serde(rename = "denied-interactively-by-user")]
10417 #[default]
10418 DeniedInteractivelyByUser,
10419}
10420
10421/// Denied by the organization's content exclusion policy
10422#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10423pub enum PermissionDeniedByContentExclusionPolicyKind {
10424 #[serde(rename = "denied-by-content-exclusion-policy")]
10425 #[default]
10426 DeniedByContentExclusionPolicy,
10427}
10428
10429/// Denied by a permission request hook registered by an extension or plugin
10430#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10431pub enum PermissionDeniedByPermissionRequestHookKind {
10432 #[serde(rename = "denied-by-permission-request-hook")]
10433 #[default]
10434 DeniedByPermissionRequestHook,
10435}
10436
10437/// The result of the permission request
10438#[derive(Debug, Clone, Serialize, Deserialize)]
10439#[serde(untagged)]
10440pub enum PermissionResult {
10441 Approved(PermissionApproved),
10442 ApprovedForSession(PermissionApprovedForSession),
10443 ApprovedForLocation(PermissionApprovedForLocation),
10444 Cancelled(PermissionCancelled),
10445 DeniedByRules(PermissionDeniedByRules),
10446 DeniedNoApprovalRuleAndCouldNotRequestFromUser(
10447 PermissionDeniedNoApprovalRuleAndCouldNotRequestFromUser,
10448 ),
10449 DeniedInteractivelyByUser(PermissionDeniedInteractivelyByUser),
10450 DeniedByContentExclusionPolicy(PermissionDeniedByContentExclusionPolicy),
10451 DeniedByPermissionRequestHook(PermissionDeniedByPermissionRequestHook),
10452}
10453
10454/// Which direction a message-backed authorization claim moves authority in.
10455///
10456/// <div class="warning">
10457///
10458/// **Experimental.** This type is part of an experimental wire-protocol surface
10459/// and may change or be removed in future SDK or CLI releases.
10460///
10461/// </div>
10462#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10463pub enum PermissionMessageAuthorizationPolarity {
10464 /// The human's words authorized an effect.
10465 #[serde(rename = "grant")]
10466 Grant,
10467 /// The human's words refused an effect.
10468 #[serde(rename = "denial")]
10469 Denial,
10470 /// Unknown variant for forward compatibility.
10471 #[default]
10472 #[serde(other)]
10473 Unknown,
10474}
10475
10476/// Elicitation mode; "form" for structured input, "url" for browser-based. Defaults to "form" when absent.
10477#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10478pub enum ElicitationRequestedMode {
10479 /// Structured form-based elicitation.
10480 #[serde(rename = "form")]
10481 Form,
10482 /// Browser URL-based elicitation.
10483 #[serde(rename = "url")]
10484 Url,
10485 /// Unknown variant for forward compatibility.
10486 #[default]
10487 #[serde(other)]
10488 Unknown,
10489}
10490
10491/// Schema type indicator (always 'object')
10492#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10493pub enum ElicitationRequestedSchemaType {
10494 #[serde(rename = "object")]
10495 #[default]
10496 Object,
10497}
10498
10499/// The user action: "accept" (submitted form), "decline" (explicitly refused), or "cancel" (dismissed)
10500#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10501pub enum ElicitationCompletedAction {
10502 /// The user submitted the requested form.
10503 #[serde(rename = "accept")]
10504 Accept,
10505 /// The user explicitly declined the request.
10506 #[serde(rename = "decline")]
10507 Decline,
10508 /// The user dismissed the request.
10509 #[serde(rename = "cancel")]
10510 Cancel,
10511 /// Unknown variant for forward compatibility.
10512 #[default]
10513 #[serde(other)]
10514 Unknown,
10515}
10516
10517/// Reason the runtime is requesting host-provided MCP OAuth credentials
10518#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10519pub enum McpOauthRequestReason {
10520 /// Initial credentials are required before connecting to the MCP server.
10521 #[serde(rename = "initial")]
10522 Initial,
10523 /// The current host-provided credential was rejected and a replacement is requested.
10524 #[serde(rename = "refresh")]
10525 Refresh,
10526 /// The server requires a new host authorization flow before continuing.
10527 #[serde(rename = "reauth")]
10528 Reauth,
10529 /// The server requires a credential with additional scope or audience.
10530 #[serde(rename = "upscope")]
10531 Upscope,
10532 /// Unknown variant for forward compatibility.
10533 #[default]
10534 #[serde(other)]
10535 Unknown,
10536}
10537
10538/// 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).
10539#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10540pub enum McpOauthRequiredStaticClientConfigGrantType {
10541 #[serde(rename = "client_credentials")]
10542 #[default]
10543 ClientCredentials,
10544}
10545
10546/// How the pending MCP OAuth request was completed
10547#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10548pub enum McpOauthCompletionOutcome {
10549 /// The request completed with a token-backed OAuth provider.
10550 #[serde(rename = "token")]
10551 Token,
10552 /// The request completed without an OAuth provider.
10553 #[serde(rename = "cancelled")]
10554 Cancelled,
10555 /// Unknown variant for forward compatibility.
10556 #[default]
10557 #[serde(other)]
10558 Unknown,
10559}
10560
10561/// Why dynamic headers are being requested.
10562#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10563pub enum McpHeadersRefreshRequiredReason {
10564 /// The transport is making its first dynamic header request for this server.
10565 #[serde(rename = "startup")]
10566 Startup,
10567 /// The previously cached dynamic headers expired.
10568 #[serde(rename = "ttl-expired")]
10569 TtlExpired,
10570 /// The server returned 401 and stale dynamic headers were invalidated.
10571 #[serde(rename = "auth-failed")]
10572 AuthFailed,
10573 /// Unknown variant for forward compatibility.
10574 #[default]
10575 #[serde(other)]
10576 Unknown,
10577}
10578
10579/// How the pending MCP headers refresh request resolved.
10580#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10581pub enum McpHeadersRefreshCompletedOutcome {
10582 /// The host supplied dynamic headers.
10583 #[serde(rename = "headers")]
10584 Headers,
10585 /// The host responded with no dynamic headers.
10586 #[serde(rename = "none")]
10587 None,
10588 /// The host credential broker rejected or failed the refresh.
10589 #[serde(rename = "error")]
10590 Error,
10591 /// No response arrived within the bounded window.
10592 #[serde(rename = "timeout")]
10593 Timeout,
10594 /// Unknown variant for forward compatibility.
10595 #[default]
10596 #[serde(other)]
10597 Unknown,
10598}
10599
10600/// Lifecycle phase for a Rust-owned ephemeral query stream.
10601///
10602/// <div class="warning">
10603///
10604/// **Experimental.** This type is part of an experimental wire-protocol surface
10605/// and may change or be removed in future SDK or CLI releases.
10606///
10607/// </div>
10608#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10609pub enum UIEphemeralQueryPhase {
10610 /// The ephemeral query stream has begun.
10611 #[serde(rename = "started")]
10612 Started,
10613 /// A partial result chunk was produced by the stream.
10614 #[serde(rename = "chunk")]
10615 Chunk,
10616 /// The ephemeral query stream finished successfully.
10617 #[serde(rename = "completed")]
10618 Completed,
10619 /// The ephemeral query stream ended with an error.
10620 #[serde(rename = "failed")]
10621 Failed,
10622 /// The ephemeral query stream was cancelled before completing.
10623 #[serde(rename = "aborted")]
10624 Aborted,
10625 /// Unknown variant for forward compatibility.
10626 #[default]
10627 #[serde(other)]
10628 Unknown,
10629}
10630
10631/// The user's auto-mode-switch choice
10632#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10633pub enum AutoModeSwitchResponse {
10634 /// Switch models for this request.
10635 #[serde(rename = "yes")]
10636 Yes,
10637 /// Switch models now and keep using the replacement automatically.
10638 #[serde(rename = "yes_always")]
10639 YesAlways,
10640 /// Do not switch models.
10641 #[serde(rename = "no")]
10642 No,
10643 /// Unknown variant for forward compatibility.
10644 #[default]
10645 #[serde(other)]
10646 Unknown,
10647}
10648
10649/// User action selected for an exhausted session limit.
10650#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10651pub enum SessionLimitsExhaustedResponseAction {
10652 /// Increase the current max by an exact AI Credits amount.
10653 #[serde(rename = "add")]
10654 Add,
10655 /// Set a new absolute max AI Credits value.
10656 #[serde(rename = "set")]
10657 Set,
10658 /// Remove the current session limit.
10659 #[serde(rename = "unset")]
10660 Unset,
10661 /// Leave the limit unchanged and cancel the blocked model request.
10662 #[serde(rename = "cancel")]
10663 Cancel,
10664 /// Unknown variant for forward compatibility.
10665 #[default]
10666 #[serde(other)]
10667 Unknown,
10668}
10669
10670/// Coarse request-difficulty bucket for UX explainability
10671#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10672pub enum AutoModeResolvedReasoningBucket {
10673 /// The request looks low-reasoning; a lighter model is appropriate.
10674 #[serde(rename = "low")]
10675 Low,
10676 /// The request needs a moderate amount of reasoning.
10677 #[serde(rename = "medium")]
10678 Medium,
10679 /// The request looks high-reasoning; a stronger model is appropriate.
10680 #[serde(rename = "high")]
10681 High,
10682 /// Unknown variant for forward compatibility.
10683 #[default]
10684 #[serde(other)]
10685 Unknown,
10686}
10687
10688/// Summary of which managed-settings channels contributed to the effective session policy. Use the per-channel booleans for exact provenance.
10689#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10690pub enum ManagedSettingsResolvedSource {
10691 /// Only the server/account channel contributed.
10692 #[serde(rename = "server")]
10693 Server,
10694 /// Only the device MDM/plist/registry/file channel contributed.
10695 #[serde(rename = "device")]
10696 Device,
10697 /// Only session-local SDK-host injection contributed.
10698 #[serde(rename = "client")]
10699 Client,
10700 /// A policy helper registered by device or server policy contributed. Device registration takes priority when present.
10701 #[serde(rename = "policyHelper")]
10702 PolicyHelper,
10703 /// More than one channel contributed. Ordinary keys resolve device over server over policy helper per key, while permissions compose restrictively across all present layers.
10704 #[serde(rename = "mixed")]
10705 Mixed,
10706 /// No managed policy is in force (no channel contributed).
10707 #[serde(rename = "none")]
10708 None,
10709 /// Unknown variant for forward compatibility.
10710 #[default]
10711 #[serde(other)]
10712 Unknown,
10713}
10714
10715/// The category of runtime action that enterprise managed settings governed (blocked or capped)
10716#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10717pub enum ManagedSettingsEnforcedAction {
10718 /// An attempt to turn on a bypass-permissions ("yolo") escalation was refused or capped because policy disables bypass-permissions mode.
10719 #[serde(rename = "bypass_permissions_blocked")]
10720 BypassPermissionsBlocked,
10721 /// Unknown variant for forward compatibility.
10722 #[default]
10723 #[serde(other)]
10724 Unknown,
10725}
10726
10727/// For a `bypass_permissions_blocked` action, which permission-escalation primitive was refused
10728#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10729pub enum ManagedSettingsEnforcedEscalation {
10730 /// Full allow-all permissions — automatically approving tools, paths, and URLs.
10731 #[serde(rename = "allow_all")]
10732 AllowAll,
10733 /// Automatic approval of all tool permission requests.
10734 #[serde(rename = "approve_all")]
10735 ApproveAll,
10736 /// Assisted mode — keeps normal prompt paths and adds an LLM recommendation, distinct from allow-all.
10737 #[serde(rename = "assisted_approval")]
10738 AssistedApproval,
10739 /// Unrestricted filesystem access outside the session's allowed directories.
10740 #[serde(rename = "unrestricted_paths")]
10741 UnrestrictedPaths,
10742 /// Unrestricted URL fetch access.
10743 #[serde(rename = "unrestricted_urls")]
10744 UnrestrictedUrls,
10745 /// 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.
10746 #[serde(rename = "server_wide_mcp_approval")]
10747 ServerWideMcpApproval,
10748 /// Unknown variant for forward compatibility.
10749 #[default]
10750 #[serde(other)]
10751 Unknown,
10752}
10753
10754/// Exit plan mode action
10755#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10756pub enum ExitPlanModeAction {
10757 /// Exit plan mode without starting implementation.
10758 #[serde(rename = "exit_only")]
10759 ExitOnly,
10760 /// Exit plan mode and continue in interactive mode.
10761 #[serde(rename = "interactive")]
10762 Interactive,
10763 /// Exit plan mode and continue autonomously.
10764 #[serde(rename = "autopilot")]
10765 Autopilot,
10766 /// Exit plan mode and continue with parallel autonomous workers.
10767 #[serde(rename = "autopilot_fleet")]
10768 AutopilotFleet,
10769 /// Unknown variant for forward compatibility.
10770 #[default]
10771 #[serde(other)]
10772 Unknown,
10773}
10774
10775/// 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.
10776#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10777pub enum FactoryRunSettledStatus {
10778 /// The factory body resolved and its result was committed.
10779 #[serde(rename = "completed")]
10780 Completed,
10781 /// The run was stopped by a limit, an approval refusal or another policy decision.
10782 #[serde(rename = "halted")]
10783 Halted,
10784 /// The attempt paused intentionally while preserving resumable run state.
10785 #[serde(rename = "paused")]
10786 Paused,
10787 /// The run was cancelled by its caller or by session disposal.
10788 #[serde(rename = "cancelled")]
10789 Cancelled,
10790 /// The run failed, with `failureType` carrying the class when it has one.
10791 #[serde(rename = "error")]
10792 Error,
10793 /// Unknown variant for forward compatibility.
10794 #[default]
10795 #[serde(other)]
10796 Unknown,
10797}
10798
10799/// Source location type (e.g., project, personal-copilot, plugin, builtin, sdk)
10800#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10801pub enum SkillSource {
10802 /// Skill defined in the current project's skill directories.
10803 #[serde(rename = "project")]
10804 Project,
10805 /// Skill discovered from a parent directory in the current workspace tree.
10806 #[serde(rename = "inherited")]
10807 Inherited,
10808 /// Skill defined in the user's Copilot skill directory.
10809 #[serde(rename = "personal-copilot")]
10810 PersonalCopilot,
10811 /// Skill defined in the user's personal agents skill directory.
10812 #[serde(rename = "personal-agents")]
10813 PersonalAgents,
10814 /// Skill provided by an installed plugin.
10815 #[serde(rename = "plugin")]
10816 Plugin,
10817 /// Skill loaded from a configured custom skill directory.
10818 #[serde(rename = "custom")]
10819 Custom,
10820 /// Skill bundled with the runtime.
10821 #[serde(rename = "builtin")]
10822 Builtin,
10823 /// Pathless skill supplied lazily by an SDK skill provider.
10824 #[serde(rename = "sdk")]
10825 Sdk,
10826 /// Unknown variant for forward compatibility.
10827 #[default]
10828 #[serde(other)]
10829 Unknown,
10830}
10831
10832/// Whether configured models are advisory preferences or required constraints
10833#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10834pub enum AgentModelPolicy {
10835 /// Treat the authored models as advisory preferences that callers may override.
10836 #[serde(rename = "preferred")]
10837 Preferred,
10838 /// Require subagent execution to use one of the authored models.
10839 #[serde(rename = "required")]
10840 Required,
10841 /// Unknown variant for forward compatibility.
10842 #[default]
10843 #[serde(other)]
10844 Unknown,
10845}
10846
10847/// Connection status: connected, failed, needs-auth, pending, disabled, stopped, or not_configured
10848#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10849pub enum McpServerStatus {
10850 /// The server is connected and available.
10851 #[serde(rename = "connected")]
10852 Connected,
10853 /// The server failed to connect or initialize.
10854 #[serde(rename = "failed")]
10855 Failed,
10856 /// The server requires authentication before it can connect.
10857 #[serde(rename = "needs-auth")]
10858 NeedsAuth,
10859 /// The server connection is still being established.
10860 #[serde(rename = "pending")]
10861 Pending,
10862 /// The server is configured but disabled.
10863 #[serde(rename = "disabled")]
10864 Disabled,
10865 /// 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.
10866 #[serde(rename = "stopped")]
10867 Stopped,
10868 /// The server is not configured for this session.
10869 #[serde(rename = "not_configured")]
10870 NotConfigured,
10871 /// Unknown variant for forward compatibility.
10872 #[default]
10873 #[serde(other)]
10874 Unknown,
10875}
10876
10877/// Discovery source
10878#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10879pub enum ExtensionsLoadedExtensionSource {
10880 /// Extension discovered from the current project.
10881 #[serde(rename = "project")]
10882 Project,
10883 /// Extension discovered from the user's extension directory.
10884 #[serde(rename = "user")]
10885 User,
10886 /// Extension contributed by an installed plugin.
10887 #[serde(rename = "plugin")]
10888 Plugin,
10889 /// Extension discovered from the current session's state directory.
10890 #[serde(rename = "session")]
10891 Session,
10892 /// Unknown variant for forward compatibility.
10893 #[default]
10894 #[serde(other)]
10895 Unknown,
10896}
10897
10898/// Current status: running, disabled, failed, or starting
10899#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
10900pub enum ExtensionsLoadedExtensionStatus {
10901 /// The extension process is running.
10902 #[serde(rename = "running")]
10903 Running,
10904 /// The extension is installed but disabled.
10905 #[serde(rename = "disabled")]
10906 Disabled,
10907 /// The extension failed to start or crashed.
10908 #[serde(rename = "failed")]
10909 Failed,
10910 /// The extension process is starting.
10911 #[serde(rename = "starting")]
10912 Starting,
10913 /// Unknown variant for forward compatibility.
10914 #[default]
10915 #[serde(other)]
10916 Unknown,
10917}