/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. *--------------------------------------------------------------------------------------------*/ // AUTO-GENERATED FILE - DO NOT EDIT // Generated from: session-events.schema.json using System.Diagnostics; using System.Text.Json; using System.Text.Json.Serialization; namespace GitHub.Copilot.SDK; /// /// Provides the base class from which all session events derive. /// [DebuggerDisplay("{DebuggerDisplay,nq}")] [JsonPolymorphic( TypeDiscriminatorPropertyName = "type", UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FailSerialization)] [JsonDerivedType(typeof(AbortEvent), "abort")] [JsonDerivedType(typeof(AssistantIntentEvent), "assistant.intent")] [JsonDerivedType(typeof(AssistantMessageEvent), "assistant.message")] [JsonDerivedType(typeof(AssistantMessageDeltaEvent), "assistant.message_delta")] [JsonDerivedType(typeof(AssistantReasoningEvent), "assistant.reasoning")] [JsonDerivedType(typeof(AssistantReasoningDeltaEvent), "assistant.reasoning_delta")] [JsonDerivedType(typeof(AssistantStreamingDeltaEvent), "assistant.streaming_delta")] [JsonDerivedType(typeof(AssistantTurnEndEvent), "assistant.turn_end")] [JsonDerivedType(typeof(AssistantTurnStartEvent), "assistant.turn_start")] [JsonDerivedType(typeof(AssistantUsageEvent), "assistant.usage")] [JsonDerivedType(typeof(CommandCompletedEvent), "command.completed")] [JsonDerivedType(typeof(CommandQueuedEvent), "command.queued")] [JsonDerivedType(typeof(ElicitationCompletedEvent), "elicitation.completed")] [JsonDerivedType(typeof(ElicitationRequestedEvent), "elicitation.requested")] [JsonDerivedType(typeof(ExitPlanModeCompletedEvent), "exit_plan_mode.completed")] [JsonDerivedType(typeof(ExitPlanModeRequestedEvent), "exit_plan_mode.requested")] [JsonDerivedType(typeof(ExternalToolCompletedEvent), "external_tool.completed")] [JsonDerivedType(typeof(ExternalToolRequestedEvent), "external_tool.requested")] [JsonDerivedType(typeof(HookEndEvent), "hook.end")] [JsonDerivedType(typeof(HookStartEvent), "hook.start")] [JsonDerivedType(typeof(PendingMessagesModifiedEvent), "pending_messages.modified")] [JsonDerivedType(typeof(PermissionCompletedEvent), "permission.completed")] [JsonDerivedType(typeof(PermissionRequestedEvent), "permission.requested")] [JsonDerivedType(typeof(SessionBackgroundTasksChangedEvent), "session.background_tasks_changed")] [JsonDerivedType(typeof(SessionCompactionCompleteEvent), "session.compaction_complete")] [JsonDerivedType(typeof(SessionCompactionStartEvent), "session.compaction_start")] [JsonDerivedType(typeof(SessionContextChangedEvent), "session.context_changed")] [JsonDerivedType(typeof(SessionErrorEvent), "session.error")] [JsonDerivedType(typeof(SessionHandoffEvent), "session.handoff")] [JsonDerivedType(typeof(SessionIdleEvent), "session.idle")] [JsonDerivedType(typeof(SessionInfoEvent), "session.info")] [JsonDerivedType(typeof(SessionModeChangedEvent), "session.mode_changed")] [JsonDerivedType(typeof(SessionModelChangeEvent), "session.model_change")] [JsonDerivedType(typeof(SessionPlanChangedEvent), "session.plan_changed")] [JsonDerivedType(typeof(SessionResumeEvent), "session.resume")] [JsonDerivedType(typeof(SessionShutdownEvent), "session.shutdown")] [JsonDerivedType(typeof(SessionSnapshotRewindEvent), "session.snapshot_rewind")] [JsonDerivedType(typeof(SessionStartEvent), "session.start")] [JsonDerivedType(typeof(SessionTaskCompleteEvent), "session.task_complete")] [JsonDerivedType(typeof(SessionTitleChangedEvent), "session.title_changed")] [JsonDerivedType(typeof(SessionToolsUpdatedEvent), "session.tools_updated")] [JsonDerivedType(typeof(SessionTruncationEvent), "session.truncation")] [JsonDerivedType(typeof(SessionUsageInfoEvent), "session.usage_info")] [JsonDerivedType(typeof(SessionWarningEvent), "session.warning")] [JsonDerivedType(typeof(SessionWorkspaceFileChangedEvent), "session.workspace_file_changed")] [JsonDerivedType(typeof(SkillInvokedEvent), "skill.invoked")] [JsonDerivedType(typeof(SubagentCompletedEvent), "subagent.completed")] [JsonDerivedType(typeof(SubagentDeselectedEvent), "subagent.deselected")] [JsonDerivedType(typeof(SubagentFailedEvent), "subagent.failed")] [JsonDerivedType(typeof(SubagentSelectedEvent), "subagent.selected")] [JsonDerivedType(typeof(SubagentStartedEvent), "subagent.started")] [JsonDerivedType(typeof(SystemMessageEvent), "system.message")] [JsonDerivedType(typeof(SystemNotificationEvent), "system.notification")] [JsonDerivedType(typeof(ToolExecutionCompleteEvent), "tool.execution_complete")] [JsonDerivedType(typeof(ToolExecutionPartialResultEvent), "tool.execution_partial_result")] [JsonDerivedType(typeof(ToolExecutionProgressEvent), "tool.execution_progress")] [JsonDerivedType(typeof(ToolExecutionStartEvent), "tool.execution_start")] [JsonDerivedType(typeof(ToolUserRequestedEvent), "tool.user_requested")] [JsonDerivedType(typeof(UserInputCompletedEvent), "user_input.completed")] [JsonDerivedType(typeof(UserInputRequestedEvent), "user_input.requested")] [JsonDerivedType(typeof(UserMessageEvent), "user.message")] public abstract partial class SessionEvent { /// Unique event identifier (UUID v4), generated when the event is emitted. [JsonPropertyName("id")] public Guid Id { get; set; } /// ISO 8601 timestamp when the event was created. [JsonPropertyName("timestamp")] public DateTimeOffset Timestamp { get; set; } /// ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event. [JsonPropertyName("parentId")] public Guid? ParentId { get; set; } /// When true, the event is transient and not persisted to the session event log on disk. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("ephemeral")] public bool? Ephemeral { get; set; } /// /// The event type discriminator. /// [JsonIgnore] public abstract string Type { get; } /// Deserializes a JSON string into a . public static SessionEvent FromJson(string json) => JsonSerializer.Deserialize(json, SessionEventsJsonContext.Default.SessionEvent)!; /// Serializes this event to a JSON string. public string ToJson() => JsonSerializer.Serialize(this, SessionEventsJsonContext.Default.SessionEvent); [DebuggerBrowsable(DebuggerBrowsableState.Never)] private string DebuggerDisplay => ToJson(); } /// Session initialization metadata including context and configuration. /// Represents the session.start event. public partial class SessionStartEvent : SessionEvent { /// [JsonIgnore] public override string Type => "session.start"; /// The session.start event payload. [JsonPropertyName("data")] public required SessionStartData Data { get; set; } } /// Session resume metadata including current context and event count. /// Represents the session.resume event. public partial class SessionResumeEvent : SessionEvent { /// [JsonIgnore] public override string Type => "session.resume"; /// The session.resume event payload. [JsonPropertyName("data")] public required SessionResumeData Data { get; set; } } /// Error details for timeline display including message and optional diagnostic information. /// Represents the session.error event. public partial class SessionErrorEvent : SessionEvent { /// [JsonIgnore] public override string Type => "session.error"; /// The session.error event payload. [JsonPropertyName("data")] public required SessionErrorData Data { get; set; } } /// Payload indicating the agent is idle; includes any background tasks still in flight. /// Represents the session.idle event. public partial class SessionIdleEvent : SessionEvent { /// [JsonIgnore] public override string Type => "session.idle"; /// The session.idle event payload. [JsonPropertyName("data")] public required SessionIdleData Data { get; set; } } /// Session title change payload containing the new display title. /// Represents the session.title_changed event. public partial class SessionTitleChangedEvent : SessionEvent { /// [JsonIgnore] public override string Type => "session.title_changed"; /// The session.title_changed event payload. [JsonPropertyName("data")] public required SessionTitleChangedData Data { get; set; } } /// Informational message for timeline display with categorization. /// Represents the session.info event. public partial class SessionInfoEvent : SessionEvent { /// [JsonIgnore] public override string Type => "session.info"; /// The session.info event payload. [JsonPropertyName("data")] public required SessionInfoData Data { get; set; } } /// Warning message for timeline display with categorization. /// Represents the session.warning event. public partial class SessionWarningEvent : SessionEvent { /// [JsonIgnore] public override string Type => "session.warning"; /// The session.warning event payload. [JsonPropertyName("data")] public required SessionWarningData Data { get; set; } } /// Model change details including previous and new model identifiers. /// Represents the session.model_change event. public partial class SessionModelChangeEvent : SessionEvent { /// [JsonIgnore] public override string Type => "session.model_change"; /// The session.model_change event payload. [JsonPropertyName("data")] public required SessionModelChangeData Data { get; set; } } /// Agent mode change details including previous and new modes. /// Represents the session.mode_changed event. public partial class SessionModeChangedEvent : SessionEvent { /// [JsonIgnore] public override string Type => "session.mode_changed"; /// The session.mode_changed event payload. [JsonPropertyName("data")] public required SessionModeChangedData Data { get; set; } } /// Plan file operation details indicating what changed. /// Represents the session.plan_changed event. public partial class SessionPlanChangedEvent : SessionEvent { /// [JsonIgnore] public override string Type => "session.plan_changed"; /// The session.plan_changed event payload. [JsonPropertyName("data")] public required SessionPlanChangedData Data { get; set; } } /// Workspace file change details including path and operation type. /// Represents the session.workspace_file_changed event. public partial class SessionWorkspaceFileChangedEvent : SessionEvent { /// [JsonIgnore] public override string Type => "session.workspace_file_changed"; /// The session.workspace_file_changed event payload. [JsonPropertyName("data")] public required SessionWorkspaceFileChangedData Data { get; set; } } /// Session handoff metadata including source, context, and repository information. /// Represents the session.handoff event. public partial class SessionHandoffEvent : SessionEvent { /// [JsonIgnore] public override string Type => "session.handoff"; /// The session.handoff event payload. [JsonPropertyName("data")] public required SessionHandoffData Data { get; set; } } /// Conversation truncation statistics including token counts and removed content metrics. /// Represents the session.truncation event. public partial class SessionTruncationEvent : SessionEvent { /// [JsonIgnore] public override string Type => "session.truncation"; /// The session.truncation event payload. [JsonPropertyName("data")] public required SessionTruncationData Data { get; set; } } /// Session rewind details including target event and count of removed events. /// Represents the session.snapshot_rewind event. public partial class SessionSnapshotRewindEvent : SessionEvent { /// [JsonIgnore] public override string Type => "session.snapshot_rewind"; /// The session.snapshot_rewind event payload. [JsonPropertyName("data")] public required SessionSnapshotRewindData Data { get; set; } } /// Session termination metrics including usage statistics, code changes, and shutdown reason. /// Represents the session.shutdown event. public partial class SessionShutdownEvent : SessionEvent { /// [JsonIgnore] public override string Type => "session.shutdown"; /// The session.shutdown event payload. [JsonPropertyName("data")] public required SessionShutdownData Data { get; set; } } /// Updated working directory and git context after the change. /// Represents the session.context_changed event. public partial class SessionContextChangedEvent : SessionEvent { /// [JsonIgnore] public override string Type => "session.context_changed"; /// The session.context_changed event payload. [JsonPropertyName("data")] public required SessionContextChangedData Data { get; set; } } /// Current context window usage statistics including token and message counts. /// Represents the session.usage_info event. public partial class SessionUsageInfoEvent : SessionEvent { /// [JsonIgnore] public override string Type => "session.usage_info"; /// The session.usage_info event payload. [JsonPropertyName("data")] public required SessionUsageInfoData Data { get; set; } } /// Empty payload; the event signals that LLM-powered conversation compaction has begun. /// Represents the session.compaction_start event. public partial class SessionCompactionStartEvent : SessionEvent { /// [JsonIgnore] public override string Type => "session.compaction_start"; /// The session.compaction_start event payload. [JsonPropertyName("data")] public required SessionCompactionStartData Data { get; set; } } /// Conversation compaction results including success status, metrics, and optional error details. /// Represents the session.compaction_complete event. public partial class SessionCompactionCompleteEvent : SessionEvent { /// [JsonIgnore] public override string Type => "session.compaction_complete"; /// The session.compaction_complete event payload. [JsonPropertyName("data")] public required SessionCompactionCompleteData Data { get; set; } } /// Task completion notification with optional summary from the agent. /// Represents the session.task_complete event. public partial class SessionTaskCompleteEvent : SessionEvent { /// [JsonIgnore] public override string Type => "session.task_complete"; /// The session.task_complete event payload. [JsonPropertyName("data")] public required SessionTaskCompleteData Data { get; set; } } /// User message content with optional attachments, source information, and interaction metadata. /// Represents the user.message event. public partial class UserMessageEvent : SessionEvent { /// [JsonIgnore] public override string Type => "user.message"; /// The user.message event payload. [JsonPropertyName("data")] public required UserMessageData Data { get; set; } } /// Empty payload; the event signals that the pending message queue has changed. /// Represents the pending_messages.modified event. public partial class PendingMessagesModifiedEvent : SessionEvent { /// [JsonIgnore] public override string Type => "pending_messages.modified"; /// The pending_messages.modified event payload. [JsonPropertyName("data")] public required PendingMessagesModifiedData Data { get; set; } } /// Turn initialization metadata including identifier and interaction tracking. /// Represents the assistant.turn_start event. public partial class AssistantTurnStartEvent : SessionEvent { /// [JsonIgnore] public override string Type => "assistant.turn_start"; /// The assistant.turn_start event payload. [JsonPropertyName("data")] public required AssistantTurnStartData Data { get; set; } } /// Agent intent description for current activity or plan. /// Represents the assistant.intent event. public partial class AssistantIntentEvent : SessionEvent { /// [JsonIgnore] public override string Type => "assistant.intent"; /// The assistant.intent event payload. [JsonPropertyName("data")] public required AssistantIntentData Data { get; set; } } /// Assistant reasoning content for timeline display with complete thinking text. /// Represents the assistant.reasoning event. public partial class AssistantReasoningEvent : SessionEvent { /// [JsonIgnore] public override string Type => "assistant.reasoning"; /// The assistant.reasoning event payload. [JsonPropertyName("data")] public required AssistantReasoningData Data { get; set; } } /// Streaming reasoning delta for incremental extended thinking updates. /// Represents the assistant.reasoning_delta event. public partial class AssistantReasoningDeltaEvent : SessionEvent { /// [JsonIgnore] public override string Type => "assistant.reasoning_delta"; /// The assistant.reasoning_delta event payload. [JsonPropertyName("data")] public required AssistantReasoningDeltaData Data { get; set; } } /// Streaming response progress with cumulative byte count. /// Represents the assistant.streaming_delta event. public partial class AssistantStreamingDeltaEvent : SessionEvent { /// [JsonIgnore] public override string Type => "assistant.streaming_delta"; /// The assistant.streaming_delta event payload. [JsonPropertyName("data")] public required AssistantStreamingDeltaData Data { get; set; } } /// Assistant response containing text content, optional tool requests, and interaction metadata. /// Represents the assistant.message event. public partial class AssistantMessageEvent : SessionEvent { /// [JsonIgnore] public override string Type => "assistant.message"; /// The assistant.message event payload. [JsonPropertyName("data")] public required AssistantMessageData Data { get; set; } } /// Streaming assistant message delta for incremental response updates. /// Represents the assistant.message_delta event. public partial class AssistantMessageDeltaEvent : SessionEvent { /// [JsonIgnore] public override string Type => "assistant.message_delta"; /// The assistant.message_delta event payload. [JsonPropertyName("data")] public required AssistantMessageDeltaData Data { get; set; } } /// Turn completion metadata including the turn identifier. /// Represents the assistant.turn_end event. public partial class AssistantTurnEndEvent : SessionEvent { /// [JsonIgnore] public override string Type => "assistant.turn_end"; /// The assistant.turn_end event payload. [JsonPropertyName("data")] public required AssistantTurnEndData Data { get; set; } } /// LLM API call usage metrics including tokens, costs, quotas, and billing information. /// Represents the assistant.usage event. public partial class AssistantUsageEvent : SessionEvent { /// [JsonIgnore] public override string Type => "assistant.usage"; /// The assistant.usage event payload. [JsonPropertyName("data")] public required AssistantUsageData Data { get; set; } } /// Turn abort information including the reason for termination. /// Represents the abort event. public partial class AbortEvent : SessionEvent { /// [JsonIgnore] public override string Type => "abort"; /// The abort event payload. [JsonPropertyName("data")] public required AbortData Data { get; set; } } /// User-initiated tool invocation request with tool name and arguments. /// Represents the tool.user_requested event. public partial class ToolUserRequestedEvent : SessionEvent { /// [JsonIgnore] public override string Type => "tool.user_requested"; /// The tool.user_requested event payload. [JsonPropertyName("data")] public required ToolUserRequestedData Data { get; set; } } /// Tool execution startup details including MCP server information when applicable. /// Represents the tool.execution_start event. public partial class ToolExecutionStartEvent : SessionEvent { /// [JsonIgnore] public override string Type => "tool.execution_start"; /// The tool.execution_start event payload. [JsonPropertyName("data")] public required ToolExecutionStartData Data { get; set; } } /// Streaming tool execution output for incremental result display. /// Represents the tool.execution_partial_result event. public partial class ToolExecutionPartialResultEvent : SessionEvent { /// [JsonIgnore] public override string Type => "tool.execution_partial_result"; /// The tool.execution_partial_result event payload. [JsonPropertyName("data")] public required ToolExecutionPartialResultData Data { get; set; } } /// Tool execution progress notification with status message. /// Represents the tool.execution_progress event. public partial class ToolExecutionProgressEvent : SessionEvent { /// [JsonIgnore] public override string Type => "tool.execution_progress"; /// The tool.execution_progress event payload. [JsonPropertyName("data")] public required ToolExecutionProgressData Data { get; set; } } /// Tool execution completion results including success status, detailed output, and error information. /// Represents the tool.execution_complete event. public partial class ToolExecutionCompleteEvent : SessionEvent { /// [JsonIgnore] public override string Type => "tool.execution_complete"; /// The tool.execution_complete event payload. [JsonPropertyName("data")] public required ToolExecutionCompleteData Data { get; set; } } /// Skill invocation details including content, allowed tools, and plugin metadata. /// Represents the skill.invoked event. public partial class SkillInvokedEvent : SessionEvent { /// [JsonIgnore] public override string Type => "skill.invoked"; /// The skill.invoked event payload. [JsonPropertyName("data")] public required SkillInvokedData Data { get; set; } } /// Sub-agent startup details including parent tool call and agent information. /// Represents the subagent.started event. public partial class SubagentStartedEvent : SessionEvent { /// [JsonIgnore] public override string Type => "subagent.started"; /// The subagent.started event payload. [JsonPropertyName("data")] public required SubagentStartedData Data { get; set; } } /// Sub-agent completion details for successful execution. /// Represents the subagent.completed event. public partial class SubagentCompletedEvent : SessionEvent { /// [JsonIgnore] public override string Type => "subagent.completed"; /// The subagent.completed event payload. [JsonPropertyName("data")] public required SubagentCompletedData Data { get; set; } } /// Sub-agent failure details including error message and agent information. /// Represents the subagent.failed event. public partial class SubagentFailedEvent : SessionEvent { /// [JsonIgnore] public override string Type => "subagent.failed"; /// The subagent.failed event payload. [JsonPropertyName("data")] public required SubagentFailedData Data { get; set; } } /// Custom agent selection details including name and available tools. /// Represents the subagent.selected event. public partial class SubagentSelectedEvent : SessionEvent { /// [JsonIgnore] public override string Type => "subagent.selected"; /// The subagent.selected event payload. [JsonPropertyName("data")] public required SubagentSelectedData Data { get; set; } } /// Empty payload; the event signals that the custom agent was deselected, returning to the default agent. /// Represents the subagent.deselected event. public partial class SubagentDeselectedEvent : SessionEvent { /// [JsonIgnore] public override string Type => "subagent.deselected"; /// The subagent.deselected event payload. [JsonPropertyName("data")] public required SubagentDeselectedData Data { get; set; } } /// Hook invocation start details including type and input data. /// Represents the hook.start event. public partial class HookStartEvent : SessionEvent { /// [JsonIgnore] public override string Type => "hook.start"; /// The hook.start event payload. [JsonPropertyName("data")] public required HookStartData Data { get; set; } } /// Hook invocation completion details including output, success status, and error information. /// Represents the hook.end event. public partial class HookEndEvent : SessionEvent { /// [JsonIgnore] public override string Type => "hook.end"; /// The hook.end event payload. [JsonPropertyName("data")] public required HookEndData Data { get; set; } } /// System or developer message content with role and optional template metadata. /// Represents the system.message event. public partial class SystemMessageEvent : SessionEvent { /// [JsonIgnore] public override string Type => "system.message"; /// The system.message event payload. [JsonPropertyName("data")] public required SystemMessageData Data { get; set; } } /// System-generated notification for runtime events like background task completion. /// Represents the system.notification event. public partial class SystemNotificationEvent : SessionEvent { /// [JsonIgnore] public override string Type => "system.notification"; /// The system.notification event payload. [JsonPropertyName("data")] public required SystemNotificationData Data { get; set; } } /// Permission request notification requiring client approval with request details. /// Represents the permission.requested event. public partial class PermissionRequestedEvent : SessionEvent { /// [JsonIgnore] public override string Type => "permission.requested"; /// The permission.requested event payload. [JsonPropertyName("data")] public required PermissionRequestedData Data { get; set; } } /// Permission request completion notification signaling UI dismissal. /// Represents the permission.completed event. public partial class PermissionCompletedEvent : SessionEvent { /// [JsonIgnore] public override string Type => "permission.completed"; /// The permission.completed event payload. [JsonPropertyName("data")] public required PermissionCompletedData Data { get; set; } } /// User input request notification with question and optional predefined choices. /// Represents the user_input.requested event. public partial class UserInputRequestedEvent : SessionEvent { /// [JsonIgnore] public override string Type => "user_input.requested"; /// The user_input.requested event payload. [JsonPropertyName("data")] public required UserInputRequestedData Data { get; set; } } /// User input request completion notification signaling UI dismissal. /// Represents the user_input.completed event. public partial class UserInputCompletedEvent : SessionEvent { /// [JsonIgnore] public override string Type => "user_input.completed"; /// The user_input.completed event payload. [JsonPropertyName("data")] public required UserInputCompletedData Data { get; set; } } /// Structured form elicitation request with JSON schema definition for form fields. /// Represents the elicitation.requested event. public partial class ElicitationRequestedEvent : SessionEvent { /// [JsonIgnore] public override string Type => "elicitation.requested"; /// The elicitation.requested event payload. [JsonPropertyName("data")] public required ElicitationRequestedData Data { get; set; } } /// Elicitation request completion notification signaling UI dismissal. /// Represents the elicitation.completed event. public partial class ElicitationCompletedEvent : SessionEvent { /// [JsonIgnore] public override string Type => "elicitation.completed"; /// The elicitation.completed event payload. [JsonPropertyName("data")] public required ElicitationCompletedData Data { get; set; } } /// External tool invocation request for client-side tool execution. /// Represents the external_tool.requested event. public partial class ExternalToolRequestedEvent : SessionEvent { /// [JsonIgnore] public override string Type => "external_tool.requested"; /// The external_tool.requested event payload. [JsonPropertyName("data")] public required ExternalToolRequestedData Data { get; set; } } /// External tool completion notification signaling UI dismissal. /// Represents the external_tool.completed event. public partial class ExternalToolCompletedEvent : SessionEvent { /// [JsonIgnore] public override string Type => "external_tool.completed"; /// The external_tool.completed event payload. [JsonPropertyName("data")] public required ExternalToolCompletedData Data { get; set; } } /// Queued slash command dispatch request for client execution. /// Represents the command.queued event. public partial class CommandQueuedEvent : SessionEvent { /// [JsonIgnore] public override string Type => "command.queued"; /// The command.queued event payload. [JsonPropertyName("data")] public required CommandQueuedData Data { get; set; } } /// Queued command completion notification signaling UI dismissal. /// Represents the command.completed event. public partial class CommandCompletedEvent : SessionEvent { /// [JsonIgnore] public override string Type => "command.completed"; /// The command.completed event payload. [JsonPropertyName("data")] public required CommandCompletedData Data { get; set; } } /// Plan approval request with plan content and available user actions. /// Represents the exit_plan_mode.requested event. public partial class ExitPlanModeRequestedEvent : SessionEvent { /// [JsonIgnore] public override string Type => "exit_plan_mode.requested"; /// The exit_plan_mode.requested event payload. [JsonPropertyName("data")] public required ExitPlanModeRequestedData Data { get; set; } } /// Plan mode exit completion notification signaling UI dismissal. /// Represents the exit_plan_mode.completed event. public partial class ExitPlanModeCompletedEvent : SessionEvent { /// [JsonIgnore] public override string Type => "exit_plan_mode.completed"; /// The exit_plan_mode.completed event payload. [JsonPropertyName("data")] public required ExitPlanModeCompletedData Data { get; set; } } /// Represents the session.tools_updated event. public partial class SessionToolsUpdatedEvent : SessionEvent { /// [JsonIgnore] public override string Type => "session.tools_updated"; /// The session.tools_updated event payload. [JsonPropertyName("data")] public required SessionToolsUpdatedData Data { get; set; } } /// Represents the session.background_tasks_changed event. public partial class SessionBackgroundTasksChangedEvent : SessionEvent { /// [JsonIgnore] public override string Type => "session.background_tasks_changed"; /// The session.background_tasks_changed event payload. [JsonPropertyName("data")] public required SessionBackgroundTasksChangedData Data { get; set; } } /// Session initialization metadata including context and configuration. public partial class SessionStartData { /// Unique identifier for the session. [JsonPropertyName("sessionId")] public required string SessionId { get; set; } /// Schema version number for the session event format. [JsonPropertyName("version")] public required double Version { get; set; } /// Identifier of the software producing the events (e.g., "copilot-agent"). [JsonPropertyName("producer")] public required string Producer { get; set; } /// Version string of the Copilot application. [JsonPropertyName("copilotVersion")] public required string CopilotVersion { get; set; } /// ISO 8601 timestamp when the session was created. [JsonPropertyName("startTime")] public required DateTimeOffset StartTime { get; set; } /// Model selected at session creation time, if any. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("selectedModel")] public string? SelectedModel { get; set; } /// Reasoning effort level used for model calls, if applicable (e.g. "low", "medium", "high", "xhigh"). [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("reasoningEffort")] public string? ReasoningEffort { get; set; } /// Working directory and git context at session start. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("context")] public SessionStartDataContext? Context { get; set; } /// Whether the session was already in use by another client at start time. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("alreadyInUse")] public bool? AlreadyInUse { get; set; } } /// Session resume metadata including current context and event count. public partial class SessionResumeData { /// ISO 8601 timestamp when the session was resumed. [JsonPropertyName("resumeTime")] public required DateTimeOffset ResumeTime { get; set; } /// Total number of persisted events in the session at the time of resume. [JsonPropertyName("eventCount")] public required double EventCount { get; set; } /// Model currently selected at resume time. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("selectedModel")] public string? SelectedModel { get; set; } /// Reasoning effort level used for model calls, if applicable (e.g. "low", "medium", "high", "xhigh"). [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("reasoningEffort")] public string? ReasoningEffort { get; set; } /// Updated working directory and git context at resume time. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("context")] public SessionResumeDataContext? Context { get; set; } /// Whether the session was already in use by another client at resume time. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("alreadyInUse")] public bool? AlreadyInUse { get; set; } } /// Error details for timeline display including message and optional diagnostic information. public partial class SessionErrorData { /// Category of error (e.g., "authentication", "authorization", "quota", "rate_limit", "query"). [JsonPropertyName("errorType")] public required string ErrorType { get; set; } /// Human-readable error message. [JsonPropertyName("message")] public required string Message { get; set; } /// Error stack trace, when available. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("stack")] public string? Stack { get; set; } /// HTTP status code from the upstream request, if applicable. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("statusCode")] public double? StatusCode { get; set; } /// GitHub request tracing ID (x-github-request-id header) for correlating with server-side logs. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("providerCallId")] public string? ProviderCallId { get; set; } } /// Payload indicating the agent is idle; includes any background tasks still in flight. public partial class SessionIdleData { /// Background tasks still running when the agent became idle. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("backgroundTasks")] public SessionIdleDataBackgroundTasks? BackgroundTasks { get; set; } } /// Session title change payload containing the new display title. public partial class SessionTitleChangedData { /// The new display title for the session. [JsonPropertyName("title")] public required string Title { get; set; } } /// Informational message for timeline display with categorization. public partial class SessionInfoData { /// Category of informational message (e.g., "notification", "timing", "context_window", "mcp", "snapshot", "configuration", "authentication", "model"). [JsonPropertyName("infoType")] public required string InfoType { get; set; } /// Human-readable informational message for display in the timeline. [JsonPropertyName("message")] public required string Message { get; set; } } /// Warning message for timeline display with categorization. public partial class SessionWarningData { /// Category of warning (e.g., "subscription", "policy", "mcp"). [JsonPropertyName("warningType")] public required string WarningType { get; set; } /// Human-readable warning message for display in the timeline. [JsonPropertyName("message")] public required string Message { get; set; } } /// Model change details including previous and new model identifiers. public partial class SessionModelChangeData { /// Model that was previously selected, if any. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("previousModel")] public string? PreviousModel { get; set; } /// Newly selected model identifier. [JsonPropertyName("newModel")] public required string NewModel { get; set; } /// Reasoning effort level before the model change, if applicable. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("previousReasoningEffort")] public string? PreviousReasoningEffort { get; set; } /// Reasoning effort level after the model change, if applicable. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("reasoningEffort")] public string? ReasoningEffort { get; set; } } /// Agent mode change details including previous and new modes. public partial class SessionModeChangedData { /// Agent mode before the change (e.g., "interactive", "plan", "autopilot"). [JsonPropertyName("previousMode")] public required string PreviousMode { get; set; } /// Agent mode after the change (e.g., "interactive", "plan", "autopilot"). [JsonPropertyName("newMode")] public required string NewMode { get; set; } } /// Plan file operation details indicating what changed. public partial class SessionPlanChangedData { /// The type of operation performed on the plan file. [JsonPropertyName("operation")] public required SessionPlanChangedDataOperation Operation { get; set; } } /// Workspace file change details including path and operation type. public partial class SessionWorkspaceFileChangedData { /// Relative path within the session workspace files directory. [JsonPropertyName("path")] public required string Path { get; set; } /// Whether the file was newly created or updated. [JsonPropertyName("operation")] public required SessionWorkspaceFileChangedDataOperation Operation { get; set; } } /// Session handoff metadata including source, context, and repository information. public partial class SessionHandoffData { /// ISO 8601 timestamp when the handoff occurred. [JsonPropertyName("handoffTime")] public required DateTimeOffset HandoffTime { get; set; } /// Origin type of the session being handed off. [JsonPropertyName("sourceType")] public required SessionHandoffDataSourceType SourceType { get; set; } /// Repository context for the handed-off session. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("repository")] public SessionHandoffDataRepository? Repository { get; set; } /// Additional context information for the handoff. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("context")] public string? Context { get; set; } /// Summary of the work done in the source session. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("summary")] public string? Summary { get; set; } /// Session ID of the remote session being handed off. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("remoteSessionId")] public string? RemoteSessionId { get; set; } } /// Conversation truncation statistics including token counts and removed content metrics. public partial class SessionTruncationData { /// Maximum token count for the model's context window. [JsonPropertyName("tokenLimit")] public required double TokenLimit { get; set; } /// Total tokens in conversation messages before truncation. [JsonPropertyName("preTruncationTokensInMessages")] public required double PreTruncationTokensInMessages { get; set; } /// Number of conversation messages before truncation. [JsonPropertyName("preTruncationMessagesLength")] public required double PreTruncationMessagesLength { get; set; } /// Total tokens in conversation messages after truncation. [JsonPropertyName("postTruncationTokensInMessages")] public required double PostTruncationTokensInMessages { get; set; } /// Number of conversation messages after truncation. [JsonPropertyName("postTruncationMessagesLength")] public required double PostTruncationMessagesLength { get; set; } /// Number of tokens removed by truncation. [JsonPropertyName("tokensRemovedDuringTruncation")] public required double TokensRemovedDuringTruncation { get; set; } /// Number of messages removed by truncation. [JsonPropertyName("messagesRemovedDuringTruncation")] public required double MessagesRemovedDuringTruncation { get; set; } /// Identifier of the component that performed truncation (e.g., "BasicTruncator"). [JsonPropertyName("performedBy")] public required string PerformedBy { get; set; } } /// Session rewind details including target event and count of removed events. public partial class SessionSnapshotRewindData { /// Event ID that was rewound to; all events after this one were removed. [JsonPropertyName("upToEventId")] public required string UpToEventId { get; set; } /// Number of events that were removed by the rewind. [JsonPropertyName("eventsRemoved")] public required double EventsRemoved { get; set; } } /// Session termination metrics including usage statistics, code changes, and shutdown reason. public partial class SessionShutdownData { /// Whether the session ended normally ("routine") or due to a crash/fatal error ("error"). [JsonPropertyName("shutdownType")] public required SessionShutdownDataShutdownType ShutdownType { get; set; } /// Error description when shutdownType is "error". [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("errorReason")] public string? ErrorReason { get; set; } /// Total number of premium API requests used during the session. [JsonPropertyName("totalPremiumRequests")] public required double TotalPremiumRequests { get; set; } /// Cumulative time spent in API calls during the session, in milliseconds. [JsonPropertyName("totalApiDurationMs")] public required double TotalApiDurationMs { get; set; } /// Unix timestamp (milliseconds) when the session started. [JsonPropertyName("sessionStartTime")] public required double SessionStartTime { get; set; } /// Aggregate code change metrics for the session. [JsonPropertyName("codeChanges")] public required SessionShutdownDataCodeChanges CodeChanges { get; set; } /// Per-model usage breakdown, keyed by model identifier. [JsonPropertyName("modelMetrics")] public required Dictionary ModelMetrics { get; set; } /// Model that was selected at the time of shutdown. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("currentModel")] public string? CurrentModel { get; set; } } /// Updated working directory and git context after the change. public partial class SessionContextChangedData { /// Current working directory path. [JsonPropertyName("cwd")] public required string Cwd { get; set; } /// Root directory of the git repository, resolved via git rev-parse. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("gitRoot")] public string? GitRoot { get; set; } /// Repository identifier derived from the git remote URL ("owner/name" for GitHub, "org/project/repo" for Azure DevOps). [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("repository")] public string? Repository { get; set; } /// Hosting platform type of the repository (github or ado). [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("hostType")] public SessionStartDataContextHostType? HostType { get; set; } /// Current git branch name. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("branch")] public string? Branch { get; set; } /// Head commit of current git branch at session start time. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("headCommit")] public string? HeadCommit { get; set; } /// Base commit of current git branch at session start time. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("baseCommit")] public string? BaseCommit { get; set; } } /// Current context window usage statistics including token and message counts. public partial class SessionUsageInfoData { /// Maximum token count for the model's context window. [JsonPropertyName("tokenLimit")] public required double TokenLimit { get; set; } /// Current number of tokens in the context window. [JsonPropertyName("currentTokens")] public required double CurrentTokens { get; set; } /// Current number of messages in the conversation. [JsonPropertyName("messagesLength")] public required double MessagesLength { get; set; } } /// Empty payload; the event signals that LLM-powered conversation compaction has begun. public partial class SessionCompactionStartData { } /// Conversation compaction results including success status, metrics, and optional error details. public partial class SessionCompactionCompleteData { /// Whether compaction completed successfully. [JsonPropertyName("success")] public required bool Success { get; set; } /// Error message if compaction failed. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("error")] public string? Error { get; set; } /// Total tokens in conversation before compaction. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("preCompactionTokens")] public double? PreCompactionTokens { get; set; } /// Total tokens in conversation after compaction. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("postCompactionTokens")] public double? PostCompactionTokens { get; set; } /// Number of messages before compaction. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("preCompactionMessagesLength")] public double? PreCompactionMessagesLength { get; set; } /// Number of messages removed during compaction. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("messagesRemoved")] public double? MessagesRemoved { get; set; } /// Number of tokens removed during compaction. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("tokensRemoved")] public double? TokensRemoved { get; set; } /// LLM-generated summary of the compacted conversation history. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("summaryContent")] public string? SummaryContent { get; set; } /// Checkpoint snapshot number created for recovery. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("checkpointNumber")] public double? CheckpointNumber { get; set; } /// File path where the checkpoint was stored. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("checkpointPath")] public string? CheckpointPath { get; set; } /// Token usage breakdown for the compaction LLM call. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("compactionTokensUsed")] public SessionCompactionCompleteDataCompactionTokensUsed? CompactionTokensUsed { get; set; } /// GitHub request tracing ID (x-github-request-id header) for the compaction LLM call. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("requestId")] public string? RequestId { get; set; } } /// Task completion notification with optional summary from the agent. public partial class SessionTaskCompleteData { /// Optional summary of the completed task, provided by the agent. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("summary")] public string? Summary { get; set; } } /// User message content with optional attachments, source information, and interaction metadata. public partial class UserMessageData { /// The user's message text as displayed in the timeline. [JsonPropertyName("content")] public required string Content { get; set; } /// Transformed version of the message sent to the model, with XML wrapping, timestamps, and other augmentations for prompt caching. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("transformedContent")] public string? TransformedContent { get; set; } /// Files, selections, or GitHub references attached to the message. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("attachments")] public UserMessageDataAttachmentsItem[]? Attachments { get; set; } /// Origin of this message, used for timeline filtering and telemetry (e.g., "user", "autopilot", "skill", or "command"). [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("source")] public UserMessageDataSource? Source { get; set; } /// The agent mode that was active when this message was sent. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("agentMode")] public UserMessageDataAgentMode? AgentMode { get; set; } /// CAPI interaction ID for correlating this user message with its turn. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("interactionId")] public string? InteractionId { get; set; } } /// Empty payload; the event signals that the pending message queue has changed. public partial class PendingMessagesModifiedData { } /// Turn initialization metadata including identifier and interaction tracking. public partial class AssistantTurnStartData { /// Identifier for this turn within the agentic loop, typically a stringified turn number. [JsonPropertyName("turnId")] public required string TurnId { get; set; } /// CAPI interaction ID for correlating this turn with upstream telemetry. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("interactionId")] public string? InteractionId { get; set; } } /// Agent intent description for current activity or plan. public partial class AssistantIntentData { /// Short description of what the agent is currently doing or planning to do. [JsonPropertyName("intent")] public required string Intent { get; set; } } /// Assistant reasoning content for timeline display with complete thinking text. public partial class AssistantReasoningData { /// Unique identifier for this reasoning block. [JsonPropertyName("reasoningId")] public required string ReasoningId { get; set; } /// The complete extended thinking text from the model. [JsonPropertyName("content")] public required string Content { get; set; } } /// Streaming reasoning delta for incremental extended thinking updates. public partial class AssistantReasoningDeltaData { /// Reasoning block ID this delta belongs to, matching the corresponding assistant.reasoning event. [JsonPropertyName("reasoningId")] public required string ReasoningId { get; set; } /// Incremental text chunk to append to the reasoning content. [JsonPropertyName("deltaContent")] public required string DeltaContent { get; set; } } /// Streaming response progress with cumulative byte count. public partial class AssistantStreamingDeltaData { /// Cumulative total bytes received from the streaming response so far. [JsonPropertyName("totalResponseSizeBytes")] public required double TotalResponseSizeBytes { get; set; } } /// Assistant response containing text content, optional tool requests, and interaction metadata. public partial class AssistantMessageData { /// Unique identifier for this assistant message. [JsonPropertyName("messageId")] public required string MessageId { get; set; } /// The assistant's text response content. [JsonPropertyName("content")] public required string Content { get; set; } /// Tool invocations requested by the assistant in this message. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("toolRequests")] public AssistantMessageDataToolRequestsItem[]? ToolRequests { get; set; } /// Opaque/encrypted extended thinking data from Anthropic models. Session-bound and stripped on resume. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("reasoningOpaque")] public string? ReasoningOpaque { get; set; } /// Readable reasoning text from the model's extended thinking. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("reasoningText")] public string? ReasoningText { get; set; } /// Encrypted reasoning content from OpenAI models. Session-bound and stripped on resume. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("encryptedContent")] public string? EncryptedContent { get; set; } /// Generation phase for phased-output models (e.g., thinking vs. response phases). [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("phase")] public string? Phase { get; set; } /// Actual output token count from the API response (completion_tokens), used for accurate token accounting. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("outputTokens")] public double? OutputTokens { get; set; } /// CAPI interaction ID for correlating this message with upstream telemetry. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("interactionId")] public string? InteractionId { get; set; } /// Tool call ID of the parent tool invocation when this event originates from a sub-agent. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("parentToolCallId")] public string? ParentToolCallId { get; set; } } /// Streaming assistant message delta for incremental response updates. public partial class AssistantMessageDeltaData { /// Message ID this delta belongs to, matching the corresponding assistant.message event. [JsonPropertyName("messageId")] public required string MessageId { get; set; } /// Incremental text chunk to append to the message content. [JsonPropertyName("deltaContent")] public required string DeltaContent { get; set; } /// Tool call ID of the parent tool invocation when this event originates from a sub-agent. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("parentToolCallId")] public string? ParentToolCallId { get; set; } } /// Turn completion metadata including the turn identifier. public partial class AssistantTurnEndData { /// Identifier of the turn that has ended, matching the corresponding assistant.turn_start event. [JsonPropertyName("turnId")] public required string TurnId { get; set; } } /// LLM API call usage metrics including tokens, costs, quotas, and billing information. public partial class AssistantUsageData { /// Model identifier used for this API call. [JsonPropertyName("model")] public required string Model { get; set; } /// Number of input tokens consumed. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("inputTokens")] public double? InputTokens { get; set; } /// Number of output tokens produced. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("outputTokens")] public double? OutputTokens { get; set; } /// Number of tokens read from prompt cache. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("cacheReadTokens")] public double? CacheReadTokens { get; set; } /// Number of tokens written to prompt cache. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("cacheWriteTokens")] public double? CacheWriteTokens { get; set; } /// Model multiplier cost for billing purposes. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("cost")] public double? Cost { get; set; } /// Duration of the API call in milliseconds. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("duration")] public double? Duration { get; set; } /// What initiated this API call (e.g., "sub-agent"); absent for user-initiated calls. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("initiator")] public string? Initiator { get; set; } /// Completion ID from the model provider (e.g., chatcmpl-abc123). [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("apiCallId")] public string? ApiCallId { get; set; } /// GitHub request tracing ID (x-github-request-id header) for server-side log correlation. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("providerCallId")] public string? ProviderCallId { get; set; } /// Parent tool call ID when this usage originates from a sub-agent. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("parentToolCallId")] public string? ParentToolCallId { get; set; } /// Per-quota resource usage snapshots, keyed by quota identifier. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("quotaSnapshots")] public Dictionary? QuotaSnapshots { get; set; } /// Per-request cost and usage data from the CAPI copilot_usage response field. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("copilotUsage")] public AssistantUsageDataCopilotUsage? CopilotUsage { get; set; } /// Reasoning effort level used for model calls, if applicable (e.g. "low", "medium", "high", "xhigh"). [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("reasoningEffort")] public string? ReasoningEffort { get; set; } } /// Turn abort information including the reason for termination. public partial class AbortData { /// Reason the current turn was aborted (e.g., "user initiated"). [JsonPropertyName("reason")] public required string Reason { get; set; } } /// User-initiated tool invocation request with tool name and arguments. public partial class ToolUserRequestedData { /// Unique identifier for this tool call. [JsonPropertyName("toolCallId")] public required string ToolCallId { get; set; } /// Name of the tool the user wants to invoke. [JsonPropertyName("toolName")] public required string ToolName { get; set; } /// Arguments for the tool invocation. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("arguments")] public object? Arguments { get; set; } } /// Tool execution startup details including MCP server information when applicable. public partial class ToolExecutionStartData { /// Unique identifier for this tool call. [JsonPropertyName("toolCallId")] public required string ToolCallId { get; set; } /// Name of the tool being executed. [JsonPropertyName("toolName")] public required string ToolName { get; set; } /// Arguments passed to the tool. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("arguments")] public object? Arguments { get; set; } /// Name of the MCP server hosting this tool, when the tool is an MCP tool. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("mcpServerName")] public string? McpServerName { get; set; } /// Original tool name on the MCP server, when the tool is an MCP tool. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("mcpToolName")] public string? McpToolName { get; set; } /// Tool call ID of the parent tool invocation when this event originates from a sub-agent. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("parentToolCallId")] public string? ParentToolCallId { get; set; } } /// Streaming tool execution output for incremental result display. public partial class ToolExecutionPartialResultData { /// Tool call ID this partial result belongs to. [JsonPropertyName("toolCallId")] public required string ToolCallId { get; set; } /// Incremental output chunk from the running tool. [JsonPropertyName("partialOutput")] public required string PartialOutput { get; set; } } /// Tool execution progress notification with status message. public partial class ToolExecutionProgressData { /// Tool call ID this progress notification belongs to. [JsonPropertyName("toolCallId")] public required string ToolCallId { get; set; } /// Human-readable progress status message (e.g., from an MCP server). [JsonPropertyName("progressMessage")] public required string ProgressMessage { get; set; } } /// Tool execution completion results including success status, detailed output, and error information. public partial class ToolExecutionCompleteData { /// Unique identifier for the completed tool call. [JsonPropertyName("toolCallId")] public required string ToolCallId { get; set; } /// Whether the tool execution completed successfully. [JsonPropertyName("success")] public required bool Success { get; set; } /// Model identifier that generated this tool call. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("model")] public string? Model { get; set; } /// CAPI interaction ID for correlating this tool execution with upstream telemetry. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("interactionId")] public string? InteractionId { get; set; } /// Whether this tool call was explicitly requested by the user rather than the assistant. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("isUserRequested")] public bool? IsUserRequested { get; set; } /// Tool execution result on success. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("result")] public ToolExecutionCompleteDataResult? Result { get; set; } /// Error details when the tool execution failed. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("error")] public ToolExecutionCompleteDataError? Error { get; set; } /// Tool-specific telemetry data (e.g., CodeQL check counts, grep match counts). [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("toolTelemetry")] public Dictionary? ToolTelemetry { get; set; } /// Tool call ID of the parent tool invocation when this event originates from a sub-agent. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("parentToolCallId")] public string? ParentToolCallId { get; set; } } /// Skill invocation details including content, allowed tools, and plugin metadata. public partial class SkillInvokedData { /// Name of the invoked skill. [JsonPropertyName("name")] public required string Name { get; set; } /// File path to the SKILL.md definition. [JsonPropertyName("path")] public required string Path { get; set; } /// Full content of the skill file, injected into the conversation for the model. [JsonPropertyName("content")] public required string Content { get; set; } /// Tool names that should be auto-approved when this skill is active. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("allowedTools")] public string[]? AllowedTools { get; set; } /// Name of the plugin this skill originated from, when applicable. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("pluginName")] public string? PluginName { get; set; } /// Version of the plugin this skill originated from, when applicable. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("pluginVersion")] public string? PluginVersion { get; set; } } /// Sub-agent startup details including parent tool call and agent information. public partial class SubagentStartedData { /// Tool call ID of the parent tool invocation that spawned this sub-agent. [JsonPropertyName("toolCallId")] public required string ToolCallId { get; set; } /// Internal name of the sub-agent. [JsonPropertyName("agentName")] public required string AgentName { get; set; } /// Human-readable display name of the sub-agent. [JsonPropertyName("agentDisplayName")] public required string AgentDisplayName { get; set; } /// Description of what the sub-agent does. [JsonPropertyName("agentDescription")] public required string AgentDescription { get; set; } } /// Sub-agent completion details for successful execution. public partial class SubagentCompletedData { /// Tool call ID of the parent tool invocation that spawned this sub-agent. [JsonPropertyName("toolCallId")] public required string ToolCallId { get; set; } /// Internal name of the sub-agent. [JsonPropertyName("agentName")] public required string AgentName { get; set; } /// Human-readable display name of the sub-agent. [JsonPropertyName("agentDisplayName")] public required string AgentDisplayName { get; set; } } /// Sub-agent failure details including error message and agent information. public partial class SubagentFailedData { /// Tool call ID of the parent tool invocation that spawned this sub-agent. [JsonPropertyName("toolCallId")] public required string ToolCallId { get; set; } /// Internal name of the sub-agent. [JsonPropertyName("agentName")] public required string AgentName { get; set; } /// Human-readable display name of the sub-agent. [JsonPropertyName("agentDisplayName")] public required string AgentDisplayName { get; set; } /// Error message describing why the sub-agent failed. [JsonPropertyName("error")] public required string Error { get; set; } } /// Custom agent selection details including name and available tools. public partial class SubagentSelectedData { /// Internal name of the selected custom agent. [JsonPropertyName("agentName")] public required string AgentName { get; set; } /// Human-readable display name of the selected custom agent. [JsonPropertyName("agentDisplayName")] public required string AgentDisplayName { get; set; } /// List of tool names available to this agent, or null for all tools. [JsonPropertyName("tools")] public string[]? Tools { get; set; } } /// Empty payload; the event signals that the custom agent was deselected, returning to the default agent. public partial class SubagentDeselectedData { } /// Hook invocation start details including type and input data. public partial class HookStartData { /// Unique identifier for this hook invocation. [JsonPropertyName("hookInvocationId")] public required string HookInvocationId { get; set; } /// Type of hook being invoked (e.g., "preToolUse", "postToolUse", "sessionStart"). [JsonPropertyName("hookType")] public required string HookType { get; set; } /// Input data passed to the hook. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("input")] public object? Input { get; set; } } /// Hook invocation completion details including output, success status, and error information. public partial class HookEndData { /// Identifier matching the corresponding hook.start event. [JsonPropertyName("hookInvocationId")] public required string HookInvocationId { get; set; } /// Type of hook that was invoked (e.g., "preToolUse", "postToolUse", "sessionStart"). [JsonPropertyName("hookType")] public required string HookType { get; set; } /// Output data produced by the hook. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("output")] public object? Output { get; set; } /// Whether the hook completed successfully. [JsonPropertyName("success")] public required bool Success { get; set; } /// Error details when the hook failed. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("error")] public HookEndDataError? Error { get; set; } } /// System or developer message content with role and optional template metadata. public partial class SystemMessageData { /// The system or developer prompt text. [JsonPropertyName("content")] public required string Content { get; set; } /// Message role: "system" for system prompts, "developer" for developer-injected instructions. [JsonPropertyName("role")] public required SystemMessageDataRole Role { get; set; } /// Optional name identifier for the message source. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("name")] public string? Name { get; set; } /// Metadata about the prompt template and its construction. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("metadata")] public SystemMessageDataMetadata? Metadata { get; set; } } /// System-generated notification for runtime events like background task completion. public partial class SystemNotificationData { /// The notification text, typically wrapped in <system_notification> XML tags. [JsonPropertyName("content")] public required string Content { get; set; } /// Structured metadata identifying what triggered this notification. [JsonPropertyName("kind")] public required SystemNotificationDataKind Kind { get; set; } } /// Permission request notification requiring client approval with request details. public partial class PermissionRequestedData { /// Unique identifier for this permission request; used to respond via session.respondToPermission(). [JsonPropertyName("requestId")] public required string RequestId { get; set; } /// Details of the permission being requested. [JsonPropertyName("permissionRequest")] public required PermissionRequest PermissionRequest { get; set; } } /// Permission request completion notification signaling UI dismissal. public partial class PermissionCompletedData { /// Request ID of the resolved permission request; clients should dismiss any UI for this request. [JsonPropertyName("requestId")] public required string RequestId { get; set; } /// The result of the permission request. [JsonPropertyName("result")] public required PermissionCompletedDataResult Result { get; set; } } /// User input request notification with question and optional predefined choices. public partial class UserInputRequestedData { /// Unique identifier for this input request; used to respond via session.respondToUserInput(). [JsonPropertyName("requestId")] public required string RequestId { get; set; } /// The question or prompt to present to the user. [JsonPropertyName("question")] public required string Question { get; set; } /// Predefined choices for the user to select from, if applicable. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("choices")] public string[]? Choices { get; set; } /// Whether the user can provide a free-form text response in addition to predefined choices. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("allowFreeform")] public bool? AllowFreeform { get; set; } } /// User input request completion notification signaling UI dismissal. public partial class UserInputCompletedData { /// Request ID of the resolved user input request; clients should dismiss any UI for this request. [JsonPropertyName("requestId")] public required string RequestId { get; set; } } /// Structured form elicitation request with JSON schema definition for form fields. public partial class ElicitationRequestedData { /// Unique identifier for this elicitation request; used to respond via session.respondToElicitation(). [JsonPropertyName("requestId")] public required string RequestId { get; set; } /// Message describing what information is needed from the user. [JsonPropertyName("message")] public required string Message { get; set; } /// Elicitation mode; currently only "form" is supported. Defaults to "form" when absent. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("mode")] public string? Mode { get; set; } /// JSON Schema describing the form fields to present to the user. [JsonPropertyName("requestedSchema")] public required ElicitationRequestedDataRequestedSchema RequestedSchema { get; set; } } /// Elicitation request completion notification signaling UI dismissal. public partial class ElicitationCompletedData { /// Request ID of the resolved elicitation request; clients should dismiss any UI for this request. [JsonPropertyName("requestId")] public required string RequestId { get; set; } } /// External tool invocation request for client-side tool execution. public partial class ExternalToolRequestedData { /// Unique identifier for this request; used to respond via session.respondToExternalTool(). [JsonPropertyName("requestId")] public required string RequestId { get; set; } /// Session ID that this external tool request belongs to. [JsonPropertyName("sessionId")] public required string SessionId { get; set; } /// Tool call ID assigned to this external tool invocation. [JsonPropertyName("toolCallId")] public required string ToolCallId { get; set; } /// Name of the external tool to invoke. [JsonPropertyName("toolName")] public required string ToolName { get; set; } /// Arguments to pass to the external tool. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("arguments")] public object? Arguments { get; set; } /// W3C Trace Context traceparent header for the execute_tool span. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("traceparent")] public string? Traceparent { get; set; } /// W3C Trace Context tracestate header for the execute_tool span. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("tracestate")] public string? Tracestate { get; set; } } /// External tool completion notification signaling UI dismissal. public partial class ExternalToolCompletedData { /// Request ID of the resolved external tool request; clients should dismiss any UI for this request. [JsonPropertyName("requestId")] public required string RequestId { get; set; } } /// Queued slash command dispatch request for client execution. public partial class CommandQueuedData { /// Unique identifier for this request; used to respond via session.respondToQueuedCommand(). [JsonPropertyName("requestId")] public required string RequestId { get; set; } /// The slash command text to be executed (e.g., /help, /clear). [JsonPropertyName("command")] public required string Command { get; set; } } /// Queued command completion notification signaling UI dismissal. public partial class CommandCompletedData { /// Request ID of the resolved command request; clients should dismiss any UI for this request. [JsonPropertyName("requestId")] public required string RequestId { get; set; } } /// Plan approval request with plan content and available user actions. public partial class ExitPlanModeRequestedData { /// Unique identifier for this request; used to respond via session.respondToExitPlanMode(). [JsonPropertyName("requestId")] public required string RequestId { get; set; } /// Summary of the plan that was created. [JsonPropertyName("summary")] public required string Summary { get; set; } /// Full content of the plan file. [JsonPropertyName("planContent")] public required string PlanContent { get; set; } /// Available actions the user can take (e.g., approve, edit, reject). [JsonPropertyName("actions")] public required string[] Actions { get; set; } /// The recommended action for the user to take. [JsonPropertyName("recommendedAction")] public required string RecommendedAction { get; set; } } /// Plan mode exit completion notification signaling UI dismissal. public partial class ExitPlanModeCompletedData { /// Request ID of the resolved exit plan mode request; clients should dismiss any UI for this request. [JsonPropertyName("requestId")] public required string RequestId { get; set; } } /// Event payload for . public partial class SessionToolsUpdatedData { /// Gets or sets the model value. [JsonPropertyName("model")] public required string Model { get; set; } } /// Event payload for . public partial class SessionBackgroundTasksChangedData { } /// Working directory and git context at session start. /// Nested data type for SessionStartDataContext. public partial class SessionStartDataContext { /// Current working directory path. [JsonPropertyName("cwd")] public required string Cwd { get; set; } /// Root directory of the git repository, resolved via git rev-parse. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("gitRoot")] public string? GitRoot { get; set; } /// Repository identifier derived from the git remote URL ("owner/name" for GitHub, "org/project/repo" for Azure DevOps). [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("repository")] public string? Repository { get; set; } /// Hosting platform type of the repository (github or ado). [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("hostType")] public SessionStartDataContextHostType? HostType { get; set; } /// Current git branch name. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("branch")] public string? Branch { get; set; } /// Head commit of current git branch at session start time. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("headCommit")] public string? HeadCommit { get; set; } /// Base commit of current git branch at session start time. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("baseCommit")] public string? BaseCommit { get; set; } } /// Updated working directory and git context at resume time. /// Nested data type for SessionResumeDataContext. public partial class SessionResumeDataContext { /// Current working directory path. [JsonPropertyName("cwd")] public required string Cwd { get; set; } /// Root directory of the git repository, resolved via git rev-parse. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("gitRoot")] public string? GitRoot { get; set; } /// Repository identifier derived from the git remote URL ("owner/name" for GitHub, "org/project/repo" for Azure DevOps). [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("repository")] public string? Repository { get; set; } /// Hosting platform type of the repository (github or ado). [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("hostType")] public SessionStartDataContextHostType? HostType { get; set; } /// Current git branch name. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("branch")] public string? Branch { get; set; } /// Head commit of current git branch at session start time. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("headCommit")] public string? HeadCommit { get; set; } /// Base commit of current git branch at session start time. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("baseCommit")] public string? BaseCommit { get; set; } } /// A background agent task. /// Nested data type for SessionIdleDataBackgroundTasksAgentsItem. public partial class SessionIdleDataBackgroundTasksAgentsItem { /// Unique identifier of the background agent. [JsonPropertyName("agentId")] public required string AgentId { get; set; } /// Type of the background agent. [JsonPropertyName("agentType")] public required string AgentType { get; set; } /// Human-readable description of the agent task. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("description")] public string? Description { get; set; } } /// A background shell command. /// Nested data type for SessionIdleDataBackgroundTasksShellsItem. public partial class SessionIdleDataBackgroundTasksShellsItem { /// Unique identifier of the background shell. [JsonPropertyName("shellId")] public required string ShellId { get; set; } /// Human-readable description of the shell command. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("description")] public string? Description { get; set; } } /// Background tasks still running when the agent became idle. /// Nested data type for SessionIdleDataBackgroundTasks. public partial class SessionIdleDataBackgroundTasks { /// Currently running background agents. [JsonPropertyName("agents")] public required SessionIdleDataBackgroundTasksAgentsItem[] Agents { get; set; } /// Currently running background shell commands. [JsonPropertyName("shells")] public required SessionIdleDataBackgroundTasksShellsItem[] Shells { get; set; } } /// Repository context for the handed-off session. /// Nested data type for SessionHandoffDataRepository. public partial class SessionHandoffDataRepository { /// Repository owner (user or organization). [JsonPropertyName("owner")] public required string Owner { get; set; } /// Repository name. [JsonPropertyName("name")] public required string Name { get; set; } /// Git branch name, if applicable. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("branch")] public string? Branch { get; set; } } /// Aggregate code change metrics for the session. /// Nested data type for SessionShutdownDataCodeChanges. public partial class SessionShutdownDataCodeChanges { /// Total number of lines added during the session. [JsonPropertyName("linesAdded")] public required double LinesAdded { get; set; } /// Total number of lines removed during the session. [JsonPropertyName("linesRemoved")] public required double LinesRemoved { get; set; } /// List of file paths that were modified during the session. [JsonPropertyName("filesModified")] public required string[] FilesModified { get; set; } } /// Token usage breakdown for the compaction LLM call. /// Nested data type for SessionCompactionCompleteDataCompactionTokensUsed. public partial class SessionCompactionCompleteDataCompactionTokensUsed { /// Input tokens consumed by the compaction LLM call. [JsonPropertyName("input")] public required double Input { get; set; } /// Output tokens produced by the compaction LLM call. [JsonPropertyName("output")] public required double Output { get; set; } /// Cached input tokens reused in the compaction LLM call. [JsonPropertyName("cachedInput")] public required double CachedInput { get; set; } } /// Optional line range to scope the attachment to a specific section of the file. /// Nested data type for UserMessageDataAttachmentsItemFileLineRange. public partial class UserMessageDataAttachmentsItemFileLineRange { /// Start line number (1-based). [JsonPropertyName("start")] public required double Start { get; set; } /// End line number (1-based, inclusive). [JsonPropertyName("end")] public required double End { get; set; } } /// File attachment. /// The file variant of . public partial class UserMessageDataAttachmentsItemFile : UserMessageDataAttachmentsItem { /// [JsonIgnore] public override string Type => "file"; /// Absolute file path. [JsonPropertyName("path")] public required string Path { get; set; } /// User-facing display name for the attachment. [JsonPropertyName("displayName")] public required string DisplayName { get; set; } /// Optional line range to scope the attachment to a specific section of the file. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("lineRange")] public UserMessageDataAttachmentsItemFileLineRange? LineRange { get; set; } } /// Directory attachment. /// The directory variant of . public partial class UserMessageDataAttachmentsItemDirectory : UserMessageDataAttachmentsItem { /// [JsonIgnore] public override string Type => "directory"; /// Absolute directory path. [JsonPropertyName("path")] public required string Path { get; set; } /// User-facing display name for the attachment. [JsonPropertyName("displayName")] public required string DisplayName { get; set; } } /// Start position of the selection. /// Nested data type for UserMessageDataAttachmentsItemSelectionSelectionStart. public partial class UserMessageDataAttachmentsItemSelectionSelectionStart { /// Start line number (0-based). [JsonPropertyName("line")] public required double Line { get; set; } /// Start character offset within the line (0-based). [JsonPropertyName("character")] public required double Character { get; set; } } /// End position of the selection. /// Nested data type for UserMessageDataAttachmentsItemSelectionSelectionEnd. public partial class UserMessageDataAttachmentsItemSelectionSelectionEnd { /// End line number (0-based). [JsonPropertyName("line")] public required double Line { get; set; } /// End character offset within the line (0-based). [JsonPropertyName("character")] public required double Character { get; set; } } /// Position range of the selection within the file. /// Nested data type for UserMessageDataAttachmentsItemSelectionSelection. public partial class UserMessageDataAttachmentsItemSelectionSelection { /// Start position of the selection. [JsonPropertyName("start")] public required UserMessageDataAttachmentsItemSelectionSelectionStart Start { get; set; } /// End position of the selection. [JsonPropertyName("end")] public required UserMessageDataAttachmentsItemSelectionSelectionEnd End { get; set; } } /// Code selection attachment from an editor. /// The selection variant of . public partial class UserMessageDataAttachmentsItemSelection : UserMessageDataAttachmentsItem { /// [JsonIgnore] public override string Type => "selection"; /// Absolute path to the file containing the selection. [JsonPropertyName("filePath")] public required string FilePath { get; set; } /// User-facing display name for the selection. [JsonPropertyName("displayName")] public required string DisplayName { get; set; } /// The selected text content. [JsonPropertyName("text")] public required string Text { get; set; } /// Position range of the selection within the file. [JsonPropertyName("selection")] public required UserMessageDataAttachmentsItemSelectionSelection Selection { get; set; } } /// GitHub issue, pull request, or discussion reference. /// The github_reference variant of . public partial class UserMessageDataAttachmentsItemGithubReference : UserMessageDataAttachmentsItem { /// [JsonIgnore] public override string Type => "github_reference"; /// Issue, pull request, or discussion number. [JsonPropertyName("number")] public required double Number { get; set; } /// Title of the referenced item. [JsonPropertyName("title")] public required string Title { get; set; } /// Type of GitHub reference. [JsonPropertyName("referenceType")] public required UserMessageDataAttachmentsItemGithubReferenceReferenceType ReferenceType { get; set; } /// Current state of the referenced item (e.g., open, closed, merged). [JsonPropertyName("state")] public required string State { get; set; } /// URL to the referenced item on GitHub. [JsonPropertyName("url")] public required string Url { get; set; } } /// Blob attachment with inline base64-encoded data. /// The blob variant of . public partial class UserMessageDataAttachmentsItemBlob : UserMessageDataAttachmentsItem { /// [JsonIgnore] public override string Type => "blob"; /// Base64-encoded content. [JsonPropertyName("data")] public required string Data { get; set; } /// MIME type of the inline data. [JsonPropertyName("mimeType")] public required string MimeType { get; set; } /// User-facing display name for the attachment. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("displayName")] public string? DisplayName { get; set; } } /// A user message attachment — a file, directory, code selection, blob, or GitHub reference. /// Polymorphic base type discriminated by type. [JsonPolymorphic( TypeDiscriminatorPropertyName = "type", UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToBaseType)] [JsonDerivedType(typeof(UserMessageDataAttachmentsItemFile), "file")] [JsonDerivedType(typeof(UserMessageDataAttachmentsItemDirectory), "directory")] [JsonDerivedType(typeof(UserMessageDataAttachmentsItemSelection), "selection")] [JsonDerivedType(typeof(UserMessageDataAttachmentsItemGithubReference), "github_reference")] [JsonDerivedType(typeof(UserMessageDataAttachmentsItemBlob), "blob")] public partial class UserMessageDataAttachmentsItem { /// The type discriminator. [JsonPropertyName("type")] public virtual string Type { get; set; } = string.Empty; } /// A tool invocation request from the assistant. /// Nested data type for AssistantMessageDataToolRequestsItem. public partial class AssistantMessageDataToolRequestsItem { /// Unique identifier for this tool call. [JsonPropertyName("toolCallId")] public required string ToolCallId { get; set; } /// Name of the tool being invoked. [JsonPropertyName("name")] public required string Name { get; set; } /// Arguments to pass to the tool, format depends on the tool. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("arguments")] public object? Arguments { get; set; } /// Tool call type: "function" for standard tool calls, "custom" for grammar-based tool calls. Defaults to "function" when absent. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("type")] public AssistantMessageDataToolRequestsItemType? Type { get; set; } /// Human-readable display title for the tool. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("toolTitle")] public string? ToolTitle { get; set; } /// Resolved intention summary describing what this specific call does. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("intentionSummary")] public string? IntentionSummary { get; set; } } /// Token usage detail for a single billing category. /// Nested data type for AssistantUsageDataCopilotUsageTokenDetailsItem. public partial class AssistantUsageDataCopilotUsageTokenDetailsItem { /// Number of tokens in this billing batch. [JsonPropertyName("batchSize")] public required double BatchSize { get; set; } /// Cost per batch of tokens. [JsonPropertyName("costPerBatch")] public required double CostPerBatch { get; set; } /// Total token count for this entry. [JsonPropertyName("tokenCount")] public required double TokenCount { get; set; } /// Token category (e.g., "input", "output"). [JsonPropertyName("tokenType")] public required string TokenType { get; set; } } /// Per-request cost and usage data from the CAPI copilot_usage response field. /// Nested data type for AssistantUsageDataCopilotUsage. public partial class AssistantUsageDataCopilotUsage { /// Itemized token usage breakdown. [JsonPropertyName("tokenDetails")] public required AssistantUsageDataCopilotUsageTokenDetailsItem[] TokenDetails { get; set; } /// Total cost in nano-AIU (AI Units) for this request. [JsonPropertyName("totalNanoAiu")] public required double TotalNanoAiu { get; set; } } /// Plain text content block. /// The text variant of . public partial class ToolExecutionCompleteDataResultContentsItemText : ToolExecutionCompleteDataResultContentsItem { /// [JsonIgnore] public override string Type => "text"; /// The text content. [JsonPropertyName("text")] public required string Text { get; set; } } /// Terminal/shell output content block with optional exit code and working directory. /// The terminal variant of . public partial class ToolExecutionCompleteDataResultContentsItemTerminal : ToolExecutionCompleteDataResultContentsItem { /// [JsonIgnore] public override string Type => "terminal"; /// Terminal/shell output text. [JsonPropertyName("text")] public required string Text { get; set; } /// Process exit code, if the command has completed. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("exitCode")] public double? ExitCode { get; set; } /// Working directory where the command was executed. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("cwd")] public string? Cwd { get; set; } } /// Image content block with base64-encoded data. /// The image variant of . public partial class ToolExecutionCompleteDataResultContentsItemImage : ToolExecutionCompleteDataResultContentsItem { /// [JsonIgnore] public override string Type => "image"; /// Base64-encoded image data. [JsonPropertyName("data")] public required string Data { get; set; } /// MIME type of the image (e.g., image/png, image/jpeg). [JsonPropertyName("mimeType")] public required string MimeType { get; set; } } /// Audio content block with base64-encoded data. /// The audio variant of . public partial class ToolExecutionCompleteDataResultContentsItemAudio : ToolExecutionCompleteDataResultContentsItem { /// [JsonIgnore] public override string Type => "audio"; /// Base64-encoded audio data. [JsonPropertyName("data")] public required string Data { get; set; } /// MIME type of the audio (e.g., audio/wav, audio/mpeg). [JsonPropertyName("mimeType")] public required string MimeType { get; set; } } /// Icon image for a resource. /// Nested data type for ToolExecutionCompleteDataResultContentsItemResourceLinkIconsItem. public partial class ToolExecutionCompleteDataResultContentsItemResourceLinkIconsItem { /// URL or path to the icon image. [JsonPropertyName("src")] public required string Src { get; set; } /// MIME type of the icon image. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("mimeType")] public string? MimeType { get; set; } /// Available icon sizes (e.g., ['16x16', '32x32']). [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("sizes")] public string[]? Sizes { get; set; } /// Theme variant this icon is intended for. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("theme")] public ToolExecutionCompleteDataResultContentsItemResourceLinkIconsItemTheme? Theme { get; set; } } /// Resource link content block referencing an external resource. /// The resource_link variant of . public partial class ToolExecutionCompleteDataResultContentsItemResourceLink : ToolExecutionCompleteDataResultContentsItem { /// [JsonIgnore] public override string Type => "resource_link"; /// Icons associated with this resource. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("icons")] public ToolExecutionCompleteDataResultContentsItemResourceLinkIconsItem[]? Icons { get; set; } /// Resource name identifier. [JsonPropertyName("name")] public required string Name { get; set; } /// Human-readable display title for the resource. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("title")] public string? Title { get; set; } /// URI identifying the resource. [JsonPropertyName("uri")] public required string Uri { get; set; } /// Human-readable description of the resource. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("description")] public string? Description { get; set; } /// MIME type of the resource content. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("mimeType")] public string? MimeType { get; set; } /// Size of the resource in bytes. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("size")] public double? Size { get; set; } } /// Embedded resource content block with inline text or binary data. /// The resource variant of . public partial class ToolExecutionCompleteDataResultContentsItemResource : ToolExecutionCompleteDataResultContentsItem { /// [JsonIgnore] public override string Type => "resource"; /// The embedded resource contents, either text or base64-encoded binary. [JsonPropertyName("resource")] public required object Resource { get; set; } } /// A content block within a tool result, which may be text, terminal output, image, audio, or a resource. /// Polymorphic base type discriminated by type. [JsonPolymorphic( TypeDiscriminatorPropertyName = "type", UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToBaseType)] [JsonDerivedType(typeof(ToolExecutionCompleteDataResultContentsItemText), "text")] [JsonDerivedType(typeof(ToolExecutionCompleteDataResultContentsItemTerminal), "terminal")] [JsonDerivedType(typeof(ToolExecutionCompleteDataResultContentsItemImage), "image")] [JsonDerivedType(typeof(ToolExecutionCompleteDataResultContentsItemAudio), "audio")] [JsonDerivedType(typeof(ToolExecutionCompleteDataResultContentsItemResourceLink), "resource_link")] [JsonDerivedType(typeof(ToolExecutionCompleteDataResultContentsItemResource), "resource")] public partial class ToolExecutionCompleteDataResultContentsItem { /// The type discriminator. [JsonPropertyName("type")] public virtual string Type { get; set; } = string.Empty; } /// Tool execution result on success. /// Nested data type for ToolExecutionCompleteDataResult. public partial class ToolExecutionCompleteDataResult { /// Concise tool result text sent to the LLM for chat completion, potentially truncated for token efficiency. [JsonPropertyName("content")] public required string Content { get; set; } /// Full detailed tool result for UI/timeline display, preserving complete content such as diffs. Falls back to content when absent. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("detailedContent")] public string? DetailedContent { get; set; } /// Structured content blocks (text, images, audio, resources) returned by the tool in their native format. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("contents")] public ToolExecutionCompleteDataResultContentsItem[]? Contents { get; set; } } /// Error details when the tool execution failed. /// Nested data type for ToolExecutionCompleteDataError. public partial class ToolExecutionCompleteDataError { /// Human-readable error message. [JsonPropertyName("message")] public required string Message { get; set; } /// Machine-readable error code. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("code")] public string? Code { get; set; } } /// Error details when the hook failed. /// Nested data type for HookEndDataError. public partial class HookEndDataError { /// Human-readable error message. [JsonPropertyName("message")] public required string Message { get; set; } /// Error stack trace, when available. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("stack")] public string? Stack { get; set; } } /// Metadata about the prompt template and its construction. /// Nested data type for SystemMessageDataMetadata. public partial class SystemMessageDataMetadata { /// Version identifier of the prompt template used. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("promptVersion")] public string? PromptVersion { get; set; } /// Template variables used when constructing the prompt. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("variables")] public Dictionary? Variables { get; set; } } /// The agent_completed variant of . public partial class SystemNotificationDataKindAgentCompleted : SystemNotificationDataKind { /// [JsonIgnore] public override string Type => "agent_completed"; /// Unique identifier of the background agent. [JsonPropertyName("agentId")] public required string AgentId { get; set; } /// Type of the agent (e.g., explore, task, general-purpose). [JsonPropertyName("agentType")] public required string AgentType { get; set; } /// Whether the agent completed successfully or failed. [JsonPropertyName("status")] public required SystemNotificationDataKindAgentCompletedStatus Status { get; set; } /// Human-readable description of the agent task. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("description")] public string? Description { get; set; } /// The full prompt given to the background agent. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("prompt")] public string? Prompt { get; set; } } /// The shell_completed variant of . public partial class SystemNotificationDataKindShellCompleted : SystemNotificationDataKind { /// [JsonIgnore] public override string Type => "shell_completed"; /// Unique identifier of the shell session. [JsonPropertyName("shellId")] public required string ShellId { get; set; } /// Exit code of the shell command, if available. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("exitCode")] public double? ExitCode { get; set; } /// Human-readable description of the command. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("description")] public string? Description { get; set; } } /// The shell_detached_completed variant of . public partial class SystemNotificationDataKindShellDetachedCompleted : SystemNotificationDataKind { /// [JsonIgnore] public override string Type => "shell_detached_completed"; /// Unique identifier of the detached shell session. [JsonPropertyName("shellId")] public required string ShellId { get; set; } /// Human-readable description of the command. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("description")] public string? Description { get; set; } } /// Structured metadata identifying what triggered this notification. /// Polymorphic base type discriminated by type. [JsonPolymorphic( TypeDiscriminatorPropertyName = "type", UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToBaseType)] [JsonDerivedType(typeof(SystemNotificationDataKindAgentCompleted), "agent_completed")] [JsonDerivedType(typeof(SystemNotificationDataKindShellCompleted), "shell_completed")] [JsonDerivedType(typeof(SystemNotificationDataKindShellDetachedCompleted), "shell_detached_completed")] public partial class SystemNotificationDataKind { /// The type discriminator. [JsonPropertyName("type")] public virtual string Type { get; set; } = string.Empty; } /// Nested data type for PermissionRequestShellCommandsItem. public partial class PermissionRequestShellCommandsItem { /// Command identifier (e.g., executable name). [JsonPropertyName("identifier")] public required string Identifier { get; set; } /// Whether this command is read-only (no side effects). [JsonPropertyName("readOnly")] public required bool ReadOnly { get; set; } } /// Nested data type for PermissionRequestShellPossibleUrlsItem. public partial class PermissionRequestShellPossibleUrlsItem { /// URL that may be accessed by the command. [JsonPropertyName("url")] public required string Url { get; set; } } /// Shell command permission request. /// The shell variant of . public partial class PermissionRequestShell : PermissionRequest { /// [JsonIgnore] public override string Kind => "shell"; /// Tool call ID that triggered this permission request. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("toolCallId")] public string? ToolCallId { get; set; } /// The complete shell command text to be executed. [JsonPropertyName("fullCommandText")] public required string FullCommandText { get; set; } /// Human-readable description of what the command intends to do. [JsonPropertyName("intention")] public required string Intention { get; set; } /// Parsed command identifiers found in the command text. [JsonPropertyName("commands")] public required PermissionRequestShellCommandsItem[] Commands { get; set; } /// File paths that may be read or written by the command. [JsonPropertyName("possiblePaths")] public required string[] PossiblePaths { get; set; } /// URLs that may be accessed by the command. [JsonPropertyName("possibleUrls")] public required PermissionRequestShellPossibleUrlsItem[] PossibleUrls { get; set; } /// Whether the command includes a file write redirection (e.g., > or >>). [JsonPropertyName("hasWriteFileRedirection")] public required bool HasWriteFileRedirection { get; set; } /// Whether the UI can offer session-wide approval for this command pattern. [JsonPropertyName("canOfferSessionApproval")] public required bool CanOfferSessionApproval { get; set; } /// Optional warning message about risks of running this command. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("warning")] public string? Warning { get; set; } } /// File write permission request. /// The write variant of . public partial class PermissionRequestWrite : PermissionRequest { /// [JsonIgnore] public override string Kind => "write"; /// Tool call ID that triggered this permission request. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("toolCallId")] public string? ToolCallId { get; set; } /// Human-readable description of the intended file change. [JsonPropertyName("intention")] public required string Intention { get; set; } /// Path of the file being written to. [JsonPropertyName("fileName")] public required string FileName { get; set; } /// Unified diff showing the proposed changes. [JsonPropertyName("diff")] public required string Diff { get; set; } /// Complete new file contents for newly created files. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("newFileContents")] public string? NewFileContents { get; set; } } /// File or directory read permission request. /// The read variant of . public partial class PermissionRequestRead : PermissionRequest { /// [JsonIgnore] public override string Kind => "read"; /// Tool call ID that triggered this permission request. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("toolCallId")] public string? ToolCallId { get; set; } /// Human-readable description of why the file is being read. [JsonPropertyName("intention")] public required string Intention { get; set; } /// Path of the file or directory being read. [JsonPropertyName("path")] public required string Path { get; set; } } /// MCP tool invocation permission request. /// The mcp variant of . public partial class PermissionRequestMcp : PermissionRequest { /// [JsonIgnore] public override string Kind => "mcp"; /// Tool call ID that triggered this permission request. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("toolCallId")] public string? ToolCallId { get; set; } /// Name of the MCP server providing the tool. [JsonPropertyName("serverName")] public required string ServerName { get; set; } /// Internal name of the MCP tool. [JsonPropertyName("toolName")] public required string ToolName { get; set; } /// Human-readable title of the MCP tool. [JsonPropertyName("toolTitle")] public required string ToolTitle { get; set; } /// Arguments to pass to the MCP tool. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("args")] public object? Args { get; set; } /// Whether this MCP tool is read-only (no side effects). [JsonPropertyName("readOnly")] public required bool ReadOnly { get; set; } } /// URL access permission request. /// The url variant of . public partial class PermissionRequestUrl : PermissionRequest { /// [JsonIgnore] public override string Kind => "url"; /// Tool call ID that triggered this permission request. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("toolCallId")] public string? ToolCallId { get; set; } /// Human-readable description of why the URL is being accessed. [JsonPropertyName("intention")] public required string Intention { get; set; } /// URL to be fetched. [JsonPropertyName("url")] public required string Url { get; set; } } /// Memory storage permission request. /// The memory variant of . public partial class PermissionRequestMemory : PermissionRequest { /// [JsonIgnore] public override string Kind => "memory"; /// Tool call ID that triggered this permission request. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("toolCallId")] public string? ToolCallId { get; set; } /// Topic or subject of the memory being stored. [JsonPropertyName("subject")] public required string Subject { get; set; } /// The fact or convention being stored. [JsonPropertyName("fact")] public required string Fact { get; set; } /// Source references for the stored fact. [JsonPropertyName("citations")] public required string Citations { get; set; } } /// Custom tool invocation permission request. /// The custom-tool variant of . public partial class PermissionRequestCustomTool : PermissionRequest { /// [JsonIgnore] public override string Kind => "custom-tool"; /// Tool call ID that triggered this permission request. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("toolCallId")] public string? ToolCallId { get; set; } /// Name of the custom tool. [JsonPropertyName("toolName")] public required string ToolName { get; set; } /// Description of what the custom tool does. [JsonPropertyName("toolDescription")] public required string ToolDescription { get; set; } /// Arguments to pass to the custom tool. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("args")] public object? Args { get; set; } } /// Hook confirmation permission request. /// The hook variant of . public partial class PermissionRequestHook : PermissionRequest { /// [JsonIgnore] public override string Kind => "hook"; /// Tool call ID that triggered this permission request. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("toolCallId")] public string? ToolCallId { get; set; } /// Name of the tool the hook is gating. [JsonPropertyName("toolName")] public required string ToolName { get; set; } /// Arguments of the tool call being gated. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("toolArgs")] public object? ToolArgs { get; set; } /// Optional message from the hook explaining why confirmation is needed. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("hookMessage")] public string? HookMessage { get; set; } } /// Details of the permission being requested. /// Polymorphic base type discriminated by kind. [JsonPolymorphic( TypeDiscriminatorPropertyName = "kind", UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToBaseType)] [JsonDerivedType(typeof(PermissionRequestShell), "shell")] [JsonDerivedType(typeof(PermissionRequestWrite), "write")] [JsonDerivedType(typeof(PermissionRequestRead), "read")] [JsonDerivedType(typeof(PermissionRequestMcp), "mcp")] [JsonDerivedType(typeof(PermissionRequestUrl), "url")] [JsonDerivedType(typeof(PermissionRequestMemory), "memory")] [JsonDerivedType(typeof(PermissionRequestCustomTool), "custom-tool")] [JsonDerivedType(typeof(PermissionRequestHook), "hook")] public partial class PermissionRequest { /// The type discriminator. [JsonPropertyName("kind")] public virtual string Kind { get; set; } = string.Empty; } /// The result of the permission request. /// Nested data type for PermissionCompletedDataResult. public partial class PermissionCompletedDataResult { /// The outcome of the permission request. [JsonPropertyName("kind")] public required PermissionCompletedDataResultKind Kind { get; set; } } /// JSON Schema describing the form fields to present to the user. /// Nested data type for ElicitationRequestedDataRequestedSchema. public partial class ElicitationRequestedDataRequestedSchema { /// Schema type indicator (always 'object'). [JsonPropertyName("type")] public required string Type { get; set; } /// Form field definitions, keyed by field name. [JsonPropertyName("properties")] public required Dictionary Properties { get; set; } /// List of required field names. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("required")] public string[]? Required { get; set; } } /// Hosting platform type of the repository (github or ado). [JsonConverter(typeof(JsonStringEnumConverter))] public enum SessionStartDataContextHostType { /// The github variant. [JsonStringEnumMemberName("github")] Github, /// The ado variant. [JsonStringEnumMemberName("ado")] Ado, } /// The type of operation performed on the plan file. [JsonConverter(typeof(JsonStringEnumConverter))] public enum SessionPlanChangedDataOperation { /// The create variant. [JsonStringEnumMemberName("create")] Create, /// The update variant. [JsonStringEnumMemberName("update")] Update, /// The delete variant. [JsonStringEnumMemberName("delete")] Delete, } /// Whether the file was newly created or updated. [JsonConverter(typeof(JsonStringEnumConverter))] public enum SessionWorkspaceFileChangedDataOperation { /// The create variant. [JsonStringEnumMemberName("create")] Create, /// The update variant. [JsonStringEnumMemberName("update")] Update, } /// Origin type of the session being handed off. [JsonConverter(typeof(JsonStringEnumConverter))] public enum SessionHandoffDataSourceType { /// The remote variant. [JsonStringEnumMemberName("remote")] Remote, /// The local variant. [JsonStringEnumMemberName("local")] Local, } /// Whether the session ended normally ("routine") or due to a crash/fatal error ("error"). [JsonConverter(typeof(JsonStringEnumConverter))] public enum SessionShutdownDataShutdownType { /// The routine variant. [JsonStringEnumMemberName("routine")] Routine, /// The error variant. [JsonStringEnumMemberName("error")] Error, } /// Type of GitHub reference. [JsonConverter(typeof(JsonStringEnumConverter))] public enum UserMessageDataAttachmentsItemGithubReferenceReferenceType { /// The issue variant. [JsonStringEnumMemberName("issue")] Issue, /// The pr variant. [JsonStringEnumMemberName("pr")] Pr, /// The discussion variant. [JsonStringEnumMemberName("discussion")] Discussion, } /// Origin of this message, used for timeline filtering and telemetry (e.g., "user", "autopilot", "skill", or "command"). [JsonConverter(typeof(JsonStringEnumConverter))] public enum UserMessageDataSource { /// The user variant. [JsonStringEnumMemberName("user")] User, /// The autopilot variant. [JsonStringEnumMemberName("autopilot")] Autopilot, /// The skill variant. [JsonStringEnumMemberName("skill")] Skill, /// The system variant. [JsonStringEnumMemberName("system")] System, /// The command variant. [JsonStringEnumMemberName("command")] Command, /// The immediate-prompt variant. [JsonStringEnumMemberName("immediate-prompt")] ImmediatePrompt, /// The jit-instruction variant. [JsonStringEnumMemberName("jit-instruction")] JitInstruction, /// The snippy-blocking variant. [JsonStringEnumMemberName("snippy-blocking")] SnippyBlocking, /// The thinking-exhausted-continuation variant. [JsonStringEnumMemberName("thinking-exhausted-continuation")] ThinkingExhaustedContinuation, /// The other variant. [JsonStringEnumMemberName("other")] Other, } /// The agent mode that was active when this message was sent. [JsonConverter(typeof(JsonStringEnumConverter))] public enum UserMessageDataAgentMode { /// The interactive variant. [JsonStringEnumMemberName("interactive")] Interactive, /// The plan variant. [JsonStringEnumMemberName("plan")] Plan, /// The autopilot variant. [JsonStringEnumMemberName("autopilot")] Autopilot, /// The shell variant. [JsonStringEnumMemberName("shell")] Shell, } /// Tool call type: "function" for standard tool calls, "custom" for grammar-based tool calls. Defaults to "function" when absent. [JsonConverter(typeof(JsonStringEnumConverter))] public enum AssistantMessageDataToolRequestsItemType { /// The function variant. [JsonStringEnumMemberName("function")] Function, /// The custom variant. [JsonStringEnumMemberName("custom")] Custom, } /// Theme variant this icon is intended for. [JsonConverter(typeof(JsonStringEnumConverter))] public enum ToolExecutionCompleteDataResultContentsItemResourceLinkIconsItemTheme { /// The light variant. [JsonStringEnumMemberName("light")] Light, /// The dark variant. [JsonStringEnumMemberName("dark")] Dark, } /// Message role: "system" for system prompts, "developer" for developer-injected instructions. [JsonConverter(typeof(JsonStringEnumConverter))] public enum SystemMessageDataRole { /// The system variant. [JsonStringEnumMemberName("system")] System, /// The developer variant. [JsonStringEnumMemberName("developer")] Developer, } /// Whether the agent completed successfully or failed. [JsonConverter(typeof(JsonStringEnumConverter))] public enum SystemNotificationDataKindAgentCompletedStatus { /// The completed variant. [JsonStringEnumMemberName("completed")] Completed, /// The failed variant. [JsonStringEnumMemberName("failed")] Failed, } /// The outcome of the permission request. [JsonConverter(typeof(JsonStringEnumConverter))] public enum PermissionCompletedDataResultKind { /// The approved variant. [JsonStringEnumMemberName("approved")] Approved, /// The denied-by-rules variant. [JsonStringEnumMemberName("denied-by-rules")] DeniedByRules, /// The denied-no-approval-rule-and-could-not-request-from-user variant. [JsonStringEnumMemberName("denied-no-approval-rule-and-could-not-request-from-user")] DeniedNoApprovalRuleAndCouldNotRequestFromUser, /// The denied-interactively-by-user variant. [JsonStringEnumMemberName("denied-interactively-by-user")] DeniedInteractivelyByUser, /// The denied-by-content-exclusion-policy variant. [JsonStringEnumMemberName("denied-by-content-exclusion-policy")] DeniedByContentExclusionPolicy, } [JsonSourceGenerationOptions( JsonSerializerDefaults.Web, AllowOutOfOrderMetadataProperties = true, NumberHandling = JsonNumberHandling.AllowReadingFromString, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)] [JsonSerializable(typeof(AbortData))] [JsonSerializable(typeof(AbortEvent))] [JsonSerializable(typeof(AssistantIntentData))] [JsonSerializable(typeof(AssistantIntentEvent))] [JsonSerializable(typeof(AssistantMessageData))] [JsonSerializable(typeof(AssistantMessageDataToolRequestsItem))] [JsonSerializable(typeof(AssistantMessageDeltaData))] [JsonSerializable(typeof(AssistantMessageDeltaEvent))] [JsonSerializable(typeof(AssistantMessageEvent))] [JsonSerializable(typeof(AssistantReasoningData))] [JsonSerializable(typeof(AssistantReasoningDeltaData))] [JsonSerializable(typeof(AssistantReasoningDeltaEvent))] [JsonSerializable(typeof(AssistantReasoningEvent))] [JsonSerializable(typeof(AssistantStreamingDeltaData))] [JsonSerializable(typeof(AssistantStreamingDeltaEvent))] [JsonSerializable(typeof(AssistantTurnEndData))] [JsonSerializable(typeof(AssistantTurnEndEvent))] [JsonSerializable(typeof(AssistantTurnStartData))] [JsonSerializable(typeof(AssistantTurnStartEvent))] [JsonSerializable(typeof(AssistantUsageData))] [JsonSerializable(typeof(AssistantUsageDataCopilotUsage))] [JsonSerializable(typeof(AssistantUsageDataCopilotUsageTokenDetailsItem))] [JsonSerializable(typeof(AssistantUsageEvent))] [JsonSerializable(typeof(CommandCompletedData))] [JsonSerializable(typeof(CommandCompletedEvent))] [JsonSerializable(typeof(CommandQueuedData))] [JsonSerializable(typeof(CommandQueuedEvent))] [JsonSerializable(typeof(ElicitationCompletedData))] [JsonSerializable(typeof(ElicitationCompletedEvent))] [JsonSerializable(typeof(ElicitationRequestedData))] [JsonSerializable(typeof(ElicitationRequestedDataRequestedSchema))] [JsonSerializable(typeof(ElicitationRequestedEvent))] [JsonSerializable(typeof(ExitPlanModeCompletedData))] [JsonSerializable(typeof(ExitPlanModeCompletedEvent))] [JsonSerializable(typeof(ExitPlanModeRequestedData))] [JsonSerializable(typeof(ExitPlanModeRequestedEvent))] [JsonSerializable(typeof(ExternalToolCompletedData))] [JsonSerializable(typeof(ExternalToolCompletedEvent))] [JsonSerializable(typeof(ExternalToolRequestedData))] [JsonSerializable(typeof(ExternalToolRequestedEvent))] [JsonSerializable(typeof(HookEndData))] [JsonSerializable(typeof(HookEndDataError))] [JsonSerializable(typeof(HookEndEvent))] [JsonSerializable(typeof(HookStartData))] [JsonSerializable(typeof(HookStartEvent))] [JsonSerializable(typeof(PendingMessagesModifiedData))] [JsonSerializable(typeof(PendingMessagesModifiedEvent))] [JsonSerializable(typeof(PermissionCompletedData))] [JsonSerializable(typeof(PermissionCompletedDataResult))] [JsonSerializable(typeof(PermissionCompletedEvent))] [JsonSerializable(typeof(PermissionRequest))] [JsonSerializable(typeof(PermissionRequestCustomTool))] [JsonSerializable(typeof(PermissionRequestHook))] [JsonSerializable(typeof(PermissionRequestMcp))] [JsonSerializable(typeof(PermissionRequestMemory))] [JsonSerializable(typeof(PermissionRequestRead))] [JsonSerializable(typeof(PermissionRequestShell))] [JsonSerializable(typeof(PermissionRequestShellCommandsItem))] [JsonSerializable(typeof(PermissionRequestShellPossibleUrlsItem))] [JsonSerializable(typeof(PermissionRequestUrl))] [JsonSerializable(typeof(PermissionRequestWrite))] [JsonSerializable(typeof(PermissionRequestedData))] [JsonSerializable(typeof(PermissionRequestedEvent))] [JsonSerializable(typeof(SessionBackgroundTasksChangedData))] [JsonSerializable(typeof(SessionBackgroundTasksChangedEvent))] [JsonSerializable(typeof(SessionCompactionCompleteData))] [JsonSerializable(typeof(SessionCompactionCompleteDataCompactionTokensUsed))] [JsonSerializable(typeof(SessionCompactionCompleteEvent))] [JsonSerializable(typeof(SessionCompactionStartData))] [JsonSerializable(typeof(SessionCompactionStartEvent))] [JsonSerializable(typeof(SessionContextChangedData))] [JsonSerializable(typeof(SessionContextChangedEvent))] [JsonSerializable(typeof(SessionErrorData))] [JsonSerializable(typeof(SessionErrorEvent))] [JsonSerializable(typeof(SessionEvent))] [JsonSerializable(typeof(SessionHandoffData))] [JsonSerializable(typeof(SessionHandoffDataRepository))] [JsonSerializable(typeof(SessionHandoffEvent))] [JsonSerializable(typeof(SessionIdleData))] [JsonSerializable(typeof(SessionIdleDataBackgroundTasks))] [JsonSerializable(typeof(SessionIdleDataBackgroundTasksAgentsItem))] [JsonSerializable(typeof(SessionIdleDataBackgroundTasksShellsItem))] [JsonSerializable(typeof(SessionIdleEvent))] [JsonSerializable(typeof(SessionInfoData))] [JsonSerializable(typeof(SessionInfoEvent))] [JsonSerializable(typeof(SessionModeChangedData))] [JsonSerializable(typeof(SessionModeChangedEvent))] [JsonSerializable(typeof(SessionModelChangeData))] [JsonSerializable(typeof(SessionModelChangeEvent))] [JsonSerializable(typeof(SessionPlanChangedData))] [JsonSerializable(typeof(SessionPlanChangedEvent))] [JsonSerializable(typeof(SessionResumeData))] [JsonSerializable(typeof(SessionResumeDataContext))] [JsonSerializable(typeof(SessionResumeEvent))] [JsonSerializable(typeof(SessionShutdownData))] [JsonSerializable(typeof(SessionShutdownDataCodeChanges))] [JsonSerializable(typeof(SessionShutdownEvent))] [JsonSerializable(typeof(SessionSnapshotRewindData))] [JsonSerializable(typeof(SessionSnapshotRewindEvent))] [JsonSerializable(typeof(SessionStartData))] [JsonSerializable(typeof(SessionStartDataContext))] [JsonSerializable(typeof(SessionStartEvent))] [JsonSerializable(typeof(SessionTaskCompleteData))] [JsonSerializable(typeof(SessionTaskCompleteEvent))] [JsonSerializable(typeof(SessionTitleChangedData))] [JsonSerializable(typeof(SessionTitleChangedEvent))] [JsonSerializable(typeof(SessionToolsUpdatedData))] [JsonSerializable(typeof(SessionToolsUpdatedEvent))] [JsonSerializable(typeof(SessionTruncationData))] [JsonSerializable(typeof(SessionTruncationEvent))] [JsonSerializable(typeof(SessionUsageInfoData))] [JsonSerializable(typeof(SessionUsageInfoEvent))] [JsonSerializable(typeof(SessionWarningData))] [JsonSerializable(typeof(SessionWarningEvent))] [JsonSerializable(typeof(SessionWorkspaceFileChangedData))] [JsonSerializable(typeof(SessionWorkspaceFileChangedEvent))] [JsonSerializable(typeof(SkillInvokedData))] [JsonSerializable(typeof(SkillInvokedEvent))] [JsonSerializable(typeof(SubagentCompletedData))] [JsonSerializable(typeof(SubagentCompletedEvent))] [JsonSerializable(typeof(SubagentDeselectedData))] [JsonSerializable(typeof(SubagentDeselectedEvent))] [JsonSerializable(typeof(SubagentFailedData))] [JsonSerializable(typeof(SubagentFailedEvent))] [JsonSerializable(typeof(SubagentSelectedData))] [JsonSerializable(typeof(SubagentSelectedEvent))] [JsonSerializable(typeof(SubagentStartedData))] [JsonSerializable(typeof(SubagentStartedEvent))] [JsonSerializable(typeof(SystemMessageData))] [JsonSerializable(typeof(SystemMessageDataMetadata))] [JsonSerializable(typeof(SystemMessageEvent))] [JsonSerializable(typeof(SystemNotificationData))] [JsonSerializable(typeof(SystemNotificationDataKind))] [JsonSerializable(typeof(SystemNotificationDataKindAgentCompleted))] [JsonSerializable(typeof(SystemNotificationDataKindShellCompleted))] [JsonSerializable(typeof(SystemNotificationDataKindShellDetachedCompleted))] [JsonSerializable(typeof(SystemNotificationEvent))] [JsonSerializable(typeof(ToolExecutionCompleteData))] [JsonSerializable(typeof(ToolExecutionCompleteDataError))] [JsonSerializable(typeof(ToolExecutionCompleteDataResult))] [JsonSerializable(typeof(ToolExecutionCompleteDataResultContentsItem))] [JsonSerializable(typeof(ToolExecutionCompleteDataResultContentsItemAudio))] [JsonSerializable(typeof(ToolExecutionCompleteDataResultContentsItemImage))] [JsonSerializable(typeof(ToolExecutionCompleteDataResultContentsItemResource))] [JsonSerializable(typeof(ToolExecutionCompleteDataResultContentsItemResourceLink))] [JsonSerializable(typeof(ToolExecutionCompleteDataResultContentsItemResourceLinkIconsItem))] [JsonSerializable(typeof(ToolExecutionCompleteDataResultContentsItemTerminal))] [JsonSerializable(typeof(ToolExecutionCompleteDataResultContentsItemText))] [JsonSerializable(typeof(ToolExecutionCompleteEvent))] [JsonSerializable(typeof(ToolExecutionPartialResultData))] [JsonSerializable(typeof(ToolExecutionPartialResultEvent))] [JsonSerializable(typeof(ToolExecutionProgressData))] [JsonSerializable(typeof(ToolExecutionProgressEvent))] [JsonSerializable(typeof(ToolExecutionStartData))] [JsonSerializable(typeof(ToolExecutionStartEvent))] [JsonSerializable(typeof(ToolUserRequestedData))] [JsonSerializable(typeof(ToolUserRequestedEvent))] [JsonSerializable(typeof(UserInputCompletedData))] [JsonSerializable(typeof(UserInputCompletedEvent))] [JsonSerializable(typeof(UserInputRequestedData))] [JsonSerializable(typeof(UserInputRequestedEvent))] [JsonSerializable(typeof(UserMessageData))] [JsonSerializable(typeof(UserMessageDataAttachmentsItem))] [JsonSerializable(typeof(UserMessageDataAttachmentsItemBlob))] [JsonSerializable(typeof(UserMessageDataAttachmentsItemDirectory))] [JsonSerializable(typeof(UserMessageDataAttachmentsItemFile))] [JsonSerializable(typeof(UserMessageDataAttachmentsItemFileLineRange))] [JsonSerializable(typeof(UserMessageDataAttachmentsItemGithubReference))] [JsonSerializable(typeof(UserMessageDataAttachmentsItemSelection))] [JsonSerializable(typeof(UserMessageDataAttachmentsItemSelectionSelection))] [JsonSerializable(typeof(UserMessageDataAttachmentsItemSelectionSelectionEnd))] [JsonSerializable(typeof(UserMessageDataAttachmentsItemSelectionSelectionStart))] [JsonSerializable(typeof(UserMessageEvent))] internal partial class SessionEventsJsonContext : JsonSerializerContext;