/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. *--------------------------------------------------------------------------------------------*/ // AUTO-GENERATED FILE - DO NOT EDIT // Generated from: api.schema.json #pragma warning disable CS0612 // Type or member is obsolete #pragma warning disable CS0618 // Type or member is obsolete (with message) using System.ComponentModel; using System.ComponentModel.DataAnnotations; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Text.Json; using System.Text.Json.Serialization; using System.Threading; namespace GitHub.Copilot.Rpc; /// Server liveness response, including the echoed message, current server timestamp, and protocol version. public sealed class PingResult { /// Echoed message (or default greeting). [JsonPropertyName("message")] public string Message { get; set; } = string.Empty; /// Server protocol version number. [JsonPropertyName("protocolVersion")] public long ProtocolVersion { get; set; } /// ISO 8601 timestamp when the server handled the ping. [JsonPropertyName("timestamp")] public DateTimeOffset Timestamp { get; set; } } /// Optional message to echo back to the caller. internal sealed class PingRequest { /// Optional message to echo back. [JsonPropertyName("message")] public string? Message { get; set; } } /// Handshake result reporting the server's protocol version and package version on success. internal sealed class ConnectResult { /// Always true on success. [JsonPropertyName("ok")] public bool Ok { get; set; } /// Server protocol version number. [JsonPropertyName("protocolVersion")] public long ProtocolVersion { get; set; } /// Server package version. [JsonPropertyName("version")] public string Version { get; set; } = string.Empty; } /// Optional connection token presented by the SDK client during the handshake. internal sealed class ConnectRequest { /// Connection token; required when the server was started with COPILOT_CONNECTION_TOKEN. [JsonPropertyName("token")] public string? Token { get; set; } } /// Token-level pricing information for this model. public sealed class ModelBillingTokenPrices { /// Number of tokens per standard billing batch. [JsonPropertyName("batchSize")] public long? BatchSize { get; set; } /// Price per billing batch of cached tokens in nano-AIUs (1 nano-AIU = 0.000000001 AIU, 1 AIU = $0.01 USD). [JsonPropertyName("cachePrice")] public long? CachePrice { get; set; } /// Price per billing batch of input tokens in nano-AIUs (1 nano-AIU = 0.000000001 AIU, 1 AIU = $0.01 USD). [JsonPropertyName("inputPrice")] public long? InputPrice { get; set; } /// Price per billing batch of output tokens in nano-AIUs (1 nano-AIU = 0.000000001 AIU, 1 AIU = $0.01 USD). [JsonPropertyName("outputPrice")] public long? OutputPrice { get; set; } } /// Billing information. public sealed class ModelBilling { /// Billing cost multiplier relative to the base rate. [JsonPropertyName("multiplier")] public double? Multiplier { get; set; } /// Token-level pricing information for this model. [JsonPropertyName("tokenPrices")] public ModelBillingTokenPrices? TokenPrices { get; set; } } /// Vision-specific limits. public sealed class ModelCapabilitiesLimitsVision { /// Maximum image size in bytes. [JsonPropertyName("max_prompt_image_size")] public long MaxPromptImageSize { get; set; } /// Maximum number of images per prompt. [JsonPropertyName("max_prompt_images")] public long MaxPromptImages { get; set; } /// MIME types the model accepts. [JsonPropertyName("supported_media_types")] public IList SupportedMediaTypes { get => field ??= []; set; } } /// Token limits for prompts, outputs, and context window. public sealed class ModelCapabilitiesLimits { /// Maximum total context window size in tokens. [JsonPropertyName("max_context_window_tokens")] public long? MaxContextWindowTokens { get; set; } /// Maximum number of output/completion tokens. [JsonPropertyName("max_output_tokens")] public long? MaxOutputTokens { get; set; } /// Maximum number of prompt/input tokens. [JsonPropertyName("max_prompt_tokens")] public long? MaxPromptTokens { get; set; } /// Vision-specific limits. [JsonPropertyName("vision")] public ModelCapabilitiesLimitsVision? Vision { get; set; } } /// Feature flags indicating what the model supports. public sealed class ModelCapabilitiesSupports { /// Whether this model supports reasoning effort configuration. [JsonPropertyName("reasoningEffort")] public bool? ReasoningEffort { get; set; } /// Whether this model supports vision/image input. [JsonPropertyName("vision")] public bool? Vision { get; set; } } /// Model capabilities and limits. public sealed class ModelCapabilities { /// Token limits for prompts, outputs, and context window. [JsonPropertyName("limits")] public ModelCapabilitiesLimits? Limits { get; set; } /// Feature flags indicating what the model supports. [JsonPropertyName("supports")] public ModelCapabilitiesSupports? Supports { get; set; } } /// Policy state (if applicable). public sealed class ModelPolicy { /// Current policy state for this model. [JsonPropertyName("state")] public ModelPolicyState State { get; set; } /// Usage terms or conditions for this model. [JsonPropertyName("terms")] public string? Terms { get; set; } } /// Schema for the `Model` type. public sealed class Model { /// Billing information. [JsonPropertyName("billing")] public ModelBilling? Billing { get; set; } /// Model capabilities and limits. [JsonPropertyName("capabilities")] public ModelCapabilities Capabilities { get => field ??= new(); set; } /// Default reasoning effort level (only present if model supports reasoning effort). [JsonPropertyName("defaultReasoningEffort")] public string? DefaultReasoningEffort { get; set; } /// Model identifier (e.g., "claude-sonnet-4.5"). [JsonPropertyName("id")] public string Id { get; set; } = string.Empty; /// Model capability category for grouping in the model picker. [JsonPropertyName("modelPickerCategory")] public ModelPickerCategory? ModelPickerCategory { get; set; } /// Relative cost tier for token-based billing users. [JsonPropertyName("modelPickerPriceCategory")] public ModelPickerPriceCategory? ModelPickerPriceCategory { get; set; } /// Display name. [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; /// Policy state (if applicable). [JsonPropertyName("policy")] public ModelPolicy? Policy { get; set; } /// Supported reasoning effort levels (only present if model supports reasoning effort). [JsonPropertyName("supportedReasoningEfforts")] public IList? SupportedReasoningEfforts { get; set; } } /// List of Copilot models available to the resolved user, including capabilities and billing metadata. public sealed class ModelList { /// List of available models with full metadata. [JsonPropertyName("models")] public IList Models { get => field ??= []; set; } } /// RPC data type for ModelsList operations. internal sealed class ModelsListRequest { /// GitHub token for per-user model listing. When provided, resolves this token to determine the user's Copilot plan and available models instead of using the global auth. [JsonPropertyName("gitHubToken")] public string? GitHubToken { get; set; } } /// Schema for the `Tool` type. public sealed class Tool { /// Description of what the tool does. [JsonPropertyName("description")] public string Description { get; set; } = string.Empty; /// Optional instructions for how to use this tool effectively. [JsonPropertyName("instructions")] public string? Instructions { get; set; } /// Tool identifier (e.g., "bash", "grep", "str_replace_editor"). [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; /// Optional namespaced name for declarative filtering (e.g., "playwright/navigate" for MCP tools). [JsonPropertyName("namespacedName")] public string? NamespacedName { get; set; } /// JSON Schema for the tool's input parameters. [JsonPropertyName("parameters")] public IDictionary? Parameters { get; set; } } /// Built-in tools available for the requested model, with their parameters and instructions. public sealed class ToolList { /// List of available built-in tools with metadata. [JsonPropertyName("tools")] public IList Tools { get => field ??= []; set; } } /// Optional model identifier whose tool overrides should be applied to the listing. internal sealed class ToolsListRequest { /// Optional model ID — when provided, the returned tool list reflects model-specific overrides. [JsonPropertyName("model")] public string? Model { get; set; } } /// Schema for the `AccountQuotaSnapshot` type. public sealed class AccountQuotaSnapshot { /// Number of requests included in the entitlement, or -1 for unlimited entitlements. [JsonPropertyName("entitlementRequests")] public long EntitlementRequests { get; set; } /// Whether the user has an unlimited usage entitlement. [JsonPropertyName("isUnlimitedEntitlement")] public bool IsUnlimitedEntitlement { get; set; } /// Number of additional usage requests made this period. [JsonPropertyName("overage")] public double Overage { get; set; } /// Whether additional usage is allowed when quota is exhausted. [JsonPropertyName("overageAllowedWithExhaustedQuota")] public bool OverageAllowedWithExhaustedQuota { get; set; } /// Percentage of entitlement remaining. [JsonPropertyName("remainingPercentage")] public double RemainingPercentage { get; set; } /// Date when the quota resets (ISO 8601 string). [JsonPropertyName("resetDate")] public DateTimeOffset? ResetDate { get; set; } /// Whether usage is still permitted after quota exhaustion. [JsonPropertyName("usageAllowedWithExhaustedQuota")] public bool UsageAllowedWithExhaustedQuota { get; set; } /// Number of requests used so far this period. [JsonPropertyName("usedRequests")] public long UsedRequests { get; set; } } /// Quota usage snapshots for the resolved user, keyed by quota type. public sealed class AccountGetQuotaResult { /// Quota snapshots keyed by type (e.g., chat, completions, premium_interactions). [JsonPropertyName("quotaSnapshots")] public IDictionary QuotaSnapshots { get => field ??= new Dictionary(); set; } } /// RPC data type for AccountGetQuota operations. internal sealed class AccountGetQuotaRequest { /// GitHub token for per-user quota lookup. When provided, resolves this token to determine the user's quota instead of using the global auth. [JsonPropertyName("gitHubToken")] public string? GitHubToken { get; set; } } /// Confirmation that the secret values were registered. public sealed class SecretsAddFilterValuesResult { /// Whether the values were successfully registered. [JsonPropertyName("ok")] public bool Ok { get; set; } } /// Secret values to add to the redaction filter. internal sealed class SecretsAddFilterValuesRequest { /// Raw secret values to register for redaction. [JsonPropertyName("values")] public IList Values { get => field ??= []; set; } } /// Schema for the `DiscoveredMcpServer` type. public sealed class DiscoveredMcpServer { /// Whether the server is enabled (not in the disabled list). [JsonPropertyName("enabled")] public bool Enabled { get; set; } /// Server name (config key). [RegularExpression("^[^\\x00-\\x1f/\\x7f-\\x9f}]+(?:\\/[^\\x00-\\x1f/\\x7f-\\x9f}]+)*$")] [UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "Safe for generated string properties: JSON Schema minLength/maxLength map to string length validation, not reflection over trimmed Count members")] [MinLength(1)] [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; /// Configuration source: user, workspace, plugin, or builtin. [JsonPropertyName("source")] public McpServerSource Source { get; set; } /// Server transport type: stdio, http, sse, or memory. [JsonPropertyName("type")] public DiscoveredMcpServerType? Type { get; set; } } /// MCP servers discovered from user, workspace, plugin, and built-in sources. public sealed class McpDiscoverResult { /// MCP servers discovered from all sources. [JsonPropertyName("servers")] public IList Servers { get => field ??= []; set; } } /// Optional working directory used as context for MCP server discovery. internal sealed class McpDiscoverRequest { /// Working directory used as context for discovery (e.g., plugin resolution). [JsonPropertyName("workingDirectory")] public string? WorkingDirectory { get; set; } } /// User-configured MCP servers, keyed by server name. public sealed class McpConfigList { /// All MCP servers from user config, keyed by name. [JsonPropertyName("servers")] public IDictionary Servers { get => field ??= new Dictionary(); set; } } /// MCP server name and configuration to add to user configuration. internal sealed class McpConfigAddRequest { /// MCP server configuration (stdio process or remote HTTP/SSE). [JsonPropertyName("config")] public JsonElement Config { get; set; } /// Unique name for the MCP server. [RegularExpression("^[^\\x00-\\x1f/\\x7f-\\x9f}]+(?:\\/[^\\x00-\\x1f/\\x7f-\\x9f}]+)*$")] [UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "Safe for generated string properties: JSON Schema minLength/maxLength map to string length validation, not reflection over trimmed Count members")] [MinLength(1)] [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; } /// MCP server name and replacement configuration to write to user configuration. internal sealed class McpConfigUpdateRequest { /// MCP server configuration (stdio process or remote HTTP/SSE). [JsonPropertyName("config")] public JsonElement Config { get; set; } /// Name of the MCP server to update. [RegularExpression("^[^\\x00-\\x1f/\\x7f-\\x9f}]+(?:\\/[^\\x00-\\x1f/\\x7f-\\x9f}]+)*$")] [UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "Safe for generated string properties: JSON Schema minLength/maxLength map to string length validation, not reflection over trimmed Count members")] [MinLength(1)] [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; } /// MCP server name to remove from user configuration. internal sealed class McpConfigRemoveRequest { /// Name of the MCP server to remove. [RegularExpression("^[^\\x00-\\x1f/\\x7f-\\x9f}]+(?:\\/[^\\x00-\\x1f/\\x7f-\\x9f}]+)*$")] [UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "Safe for generated string properties: JSON Schema minLength/maxLength map to string length validation, not reflection over trimmed Count members")] [MinLength(1)] [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; } /// MCP server names to enable for new sessions. internal sealed class McpConfigEnableRequest { /// Names of MCP servers to enable. Each server is removed from the persisted disabled list so new sessions spawn it. Unknown or already-enabled names are ignored. [JsonPropertyName("names")] public IList Names { get => field ??= []; set; } } /// MCP server names to disable for new sessions. internal sealed class McpConfigDisableRequest { /// Names of MCP servers to disable. Each server is added to the persisted disabled list so new sessions skip it. Already-disabled names are ignored. Active sessions keep their current connections until they end. [JsonPropertyName("names")] public IList Names { get => field ??= []; set; } } /// Schema for the `ServerSkill` type. public sealed class ServerSkill { /// Description of what the skill does. [JsonPropertyName("description")] public string Description { get; set; } = string.Empty; /// Whether the skill is currently enabled (based on global config). [JsonPropertyName("enabled")] public bool Enabled { get; set; } /// Unique identifier for the skill. [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; /// Absolute path to the skill file. [JsonPropertyName("path")] public string? Path { get; set; } /// The project path this skill belongs to (only for project/inherited skills). [JsonPropertyName("projectPath")] public string? ProjectPath { get; set; } /// Source location type (e.g., project, personal-copilot, plugin, builtin). [JsonPropertyName("source")] public SkillSource Source { get; set; } /// Whether the skill can be invoked by the user as a slash command. [JsonPropertyName("userInvocable")] public bool UserInvocable { get; set; } } /// Skills discovered across global and project sources. public sealed class ServerSkillList { /// All discovered skills across all sources. [JsonPropertyName("skills")] public IList Skills { get => field ??= []; set; } } /// Optional project paths and additional skill directories to include in discovery. internal sealed class SkillsDiscoverRequest { /// Optional list of project directory paths to scan for project-scoped skills. [JsonPropertyName("projectPaths")] public IList? ProjectPaths { get; set; } /// Optional list of additional skill directory paths to include. [JsonPropertyName("skillDirectories")] public IList? SkillDirectories { get; set; } } /// Skill names to mark as disabled in global configuration, replacing any previous list. internal sealed class SkillsConfigSetDisabledSkillsRequest { /// List of skill names to disable. [JsonPropertyName("disabledSkills")] public IList DisabledSkills { get => field ??= []; set; } } /// Indicates whether the calling client was registered as the session filesystem provider. public sealed class SessionFsSetProviderResult { /// Whether the provider was set successfully. [JsonPropertyName("success")] public bool Success { get; set; } } /// Optional capabilities declared by the provider. public sealed class SessionFsSetProviderCapabilities { /// Whether the provider supports SQLite query/exists operations. [JsonPropertyName("sqlite")] public bool? Sqlite { get; set; } } /// Initial working directory, session-state path layout, and path conventions used to register the calling SDK client as the session filesystem provider. internal sealed class SessionFsSetProviderRequest { /// Optional capabilities declared by the provider. [JsonPropertyName("capabilities")] public SessionFsSetProviderCapabilities? Capabilities { get; set; } /// Path conventions used by this filesystem. [JsonPropertyName("conventions")] public SessionFsSetProviderConventions Conventions { get; set; } /// Initial working directory for sessions. [JsonPropertyName("initialCwd")] public string InitialCwd { get; set; } = string.Empty; /// Path within each session's SessionFs where the runtime stores files for that session. [JsonPropertyName("sessionStatePath")] public string SessionStatePath { get; set; } = string.Empty; } /// Identifier and optional friendly name assigned to the newly forked session. [Experimental(Diagnostics.Experimental)] public sealed class SessionsForkResult { /// Friendly name assigned to the forked session, if any. [JsonPropertyName("name")] public string? Name { get; set; } /// The new forked session's ID. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Source session identifier to fork from, optional event-ID boundary, and optional friendly name for the new session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionsForkRequest { /// Optional friendly name to assign to the forked session. [JsonPropertyName("name")] public string? Name { get; set; } /// Source session ID to fork from. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; /// Optional event ID boundary. When provided, the fork includes only events before this ID (exclusive). When omitted, all events are included. [JsonPropertyName("toEventId")] public string? ToEventId { get; set; } } /// Repository associated with the connected remote session. [Experimental(Diagnostics.Experimental)] public sealed class ConnectedRemoteSessionMetadataRepository { /// Branch associated with the remote session. [JsonPropertyName("branch")] public string Branch { get; set; } = string.Empty; /// Repository name. [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; /// Repository owner or organization login. [JsonPropertyName("owner")] public string Owner { get; set; } = string.Empty; } /// Metadata for a connected remote session. [Experimental(Diagnostics.Experimental)] public sealed class ConnectedRemoteSessionMetadata { /// Neutral SDK discriminator for the connected remote session kind. [JsonPropertyName("kind")] public ConnectedRemoteSessionMetadataKind Kind { get; set; } /// Last session update time as an ISO 8601 string. [JsonPropertyName("modifiedTime")] public DateTimeOffset ModifiedTime { get; set; } /// Optional friendly session name. [JsonPropertyName("name")] public string? Name { get; set; } /// Pull request number associated with the session. [JsonPropertyName("pullRequestNumber")] public long? PullRequestNumber { get; set; } /// Repository associated with the connected remote session. [JsonPropertyName("repository")] public ConnectedRemoteSessionMetadataRepository Repository { get => field ??= new(); set; } /// Original remote resource identifier. [JsonPropertyName("resourceId")] public string? ResourceId { get; set; } /// SDK session ID for the connected remote session. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; /// Remote session staleness deadline as an ISO 8601 string. [JsonPropertyName("staleAt")] public DateTimeOffset? StaleAt { get; set; } /// Session start time as an ISO 8601 string. [JsonPropertyName("startTime")] public DateTimeOffset StartTime { get; set; } /// Remote session state returned by the backing service. [JsonPropertyName("state")] public string? State { get; set; } /// Optional session summary. [JsonPropertyName("summary")] public string? Summary { get; set; } } /// Remote session connection result. [Experimental(Diagnostics.Experimental)] public sealed class RemoteSessionConnectionResult { /// Metadata for a connected remote session. [JsonPropertyName("metadata")] public ConnectedRemoteSessionMetadata Metadata { get => field ??= new(); set; } /// SDK session ID for the connected remote session. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Remote session connection parameters. [Experimental(Diagnostics.Experimental)] internal sealed class ConnectRemoteSessionParams { /// Session ID to connect to. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Schema for the `SessionContext` type. [Experimental(Diagnostics.Experimental)] public sealed class SessionContext { /// Active git branch. [JsonPropertyName("branch")] public string? Branch { get; set; } /// Most recent working directory for this session. [JsonPropertyName("cwd")] public string Cwd { get; set; } = string.Empty; /// Git repository root, if the cwd was inside a git repo. [JsonPropertyName("gitRoot")] public string? GitRoot { get; set; } /// Repository host type. [JsonPropertyName("hostType")] public SessionContextHostType? HostType { get; set; } /// Repository slug in `owner/name` form, when known. [JsonPropertyName("repository")] public string? Repository { get; set; } } /// Schema for the `SessionMetadata` type. [Experimental(Diagnostics.Experimental)] public sealed class SessionMetadata { /// Schema for the `SessionContext` type. [JsonPropertyName("context")] public SessionContext? Context { get; set; } /// True for remote (GitHub) sessions; false for local. [JsonPropertyName("isRemote")] public bool IsRemote { get; set; } /// GitHub task ID, when this local session is bound to one. Only present for local sessions exported to remote control. [JsonPropertyName("mcTaskId")] public string? McTaskId { get; set; } /// Last-modified time of the session's persisted state, as ISO 8601. [JsonPropertyName("modifiedTime")] public string ModifiedTime { get; set; } = string.Empty; /// Optional human-friendly name set via /rename. [JsonPropertyName("name")] public string? Name { get; set; } /// Stable session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; /// Session creation time as an ISO 8601 timestamp. [JsonPropertyName("startTime")] public string StartTime { get; set; } = string.Empty; /// Short summary of the session, when one has been derived. [JsonPropertyName("summary")] public string? Summary { get; set; } } /// Persisted sessions matching the filter, ordered most-recently-modified first. [Experimental(Diagnostics.Experimental)] public sealed class SessionList { /// Sessions ordered most-recently-modified first. [JsonPropertyName("sessions")] public IList Sessions { get => field ??= []; set; } } /// Optional filter applied to the returned sessions. [Experimental(Diagnostics.Experimental)] public sealed class SessionListFilter { /// Match sessions whose context.branch equals this value. [JsonPropertyName("branch")] public string? Branch { get; set; } /// Match sessions whose context.cwd equals this value. [JsonPropertyName("cwd")] public string? Cwd { get; set; } /// Match sessions whose context.gitRoot equals this value. [JsonPropertyName("gitRoot")] public string? GitRoot { get; set; } /// Match sessions whose context.repository equals this value. [JsonPropertyName("repository")] public string? Repository { get; set; } } /// Optional metadata-load limit and context filter applied to the returned sessions. [Experimental(Diagnostics.Experimental)] internal sealed class SessionsListRequest { /// Optional filter applied to the returned sessions. [JsonPropertyName("filter")] public SessionListFilter? Filter { get; set; } /// When provided, only the first N sessions (sorted by modification time, newest first) load full metadata; remaining sessions return basic info only. Use 0 to return only basic info for every session. [JsonPropertyName("metadataLimit")] public long? MetadataLimit { get; set; } } /// ID of the local session bound to the given GitHub task, or omitted when none. [Experimental(Diagnostics.Experimental)] public sealed class SessionsFindByTaskIDResult { /// Omitted when no local session is bound to that GitHub task. [JsonPropertyName("sessionId")] public string? SessionId { get; set; } } /// GitHub task ID to look up. [Experimental(Diagnostics.Experimental)] internal sealed class SessionsFindByTaskIDRequest { /// GitHub task ID to look up. [JsonPropertyName("taskId")] public string TaskId { get; set; } = string.Empty; } /// Session ID matching the prefix, omitted when no unique match exists. [Experimental(Diagnostics.Experimental)] public sealed class SessionsFindByPrefixResult { /// Omitted when no unique session matches the prefix (no match or ambiguous). [JsonPropertyName("sessionId")] public string? SessionId { get; set; } } /// UUID prefix to resolve to a unique session ID. [Experimental(Diagnostics.Experimental)] internal sealed class SessionsFindByPrefixRequest { /// UUID prefix (>=7 hex chars, <36 chars). Returns the unique session ID, or undefined when there is no match or the prefix matches multiple sessions. [JsonPropertyName("prefix")] public string Prefix { get; set; } = string.Empty; } /// Most-relevant session ID for the supplied context, or omitted when no sessions exist. [Experimental(Diagnostics.Experimental)] public sealed class SessionsGetLastForContextResult { /// Most-relevant session ID for the supplied context, or omitted when no sessions exist. [JsonPropertyName("sessionId")] public string? SessionId { get; set; } } /// Optional working-directory context used to score session relevance. [Experimental(Diagnostics.Experimental)] internal sealed class SessionsGetLastForContextRequest { /// Optional working-directory context used to score session relevance. When omitted the most-recently-modified session wins. [JsonPropertyName("context")] public SessionContext? Context { get; set; } } /// Absolute path to the session's events.jsonl file on disk. [Experimental(Diagnostics.Experimental)] public sealed class SessionsGetEventFilePathResult { /// Absolute path to the session's events.jsonl file. [JsonPropertyName("filePath")] public string FilePath { get; set; } = string.Empty; } /// Session ID whose event-log file path to compute. [Experimental(Diagnostics.Experimental)] internal sealed class SessionsGetEventFilePathRequest { /// Session ID whose event-log file path to compute. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Map of sessionId -> on-disk size in bytes for each session's workspace directory. [Experimental(Diagnostics.Experimental)] public sealed class SessionSizes { /// Map of sessionId -> on-disk size in bytes for the session's workspace directory. [JsonPropertyName("sizes")] public IDictionary Sizes { get => field ??= new Dictionary(); set; } } /// Session IDs from the input set that are currently in use by another process. [Experimental(Diagnostics.Experimental)] public sealed class SessionsCheckInUseResult { /// Session IDs from the input set that are currently held by another running process via an alive lock file. [JsonPropertyName("inUse")] public IList InUse { get => field ??= []; set; } } /// Session IDs to test for live in-use locks. [Experimental(Diagnostics.Experimental)] internal sealed class SessionsCheckInUseRequest { /// Session IDs to test for live in-use locks. [JsonPropertyName("sessionIds")] public IList SessionIds { get => field ??= []; set; } } /// The session's persisted remote-steerable flag, or omitted when no value has been persisted. [Experimental(Diagnostics.Experimental)] public sealed class SessionsGetPersistedRemoteSteerableResult { /// The session's persisted remote-steerable flag if recorded; omitted when no value has been persisted. [JsonPropertyName("remoteSteerable")] public bool? RemoteSteerable { get; set; } } /// Session ID to look up the persisted remote-steerable flag for. [Experimental(Diagnostics.Experimental)] internal sealed class SessionsGetPersistedRemoteSteerableRequest { /// Session ID to look up the persisted remote-steerable flag for. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Closes a session: emits shutdown, flushes pending events to disk, releases the in-use lock, disposes the active session. Idempotent: succeeds even if the session is not currently active. [Experimental(Diagnostics.Experimental)] public sealed class SessionsCloseResult { } /// Session ID to close. [Experimental(Diagnostics.Experimental)] internal sealed class SessionsCloseRequest { /// Session ID to close. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Map of sessionId -> bytes freed by removing the session's workspace directory. [Experimental(Diagnostics.Experimental)] public sealed class SessionBulkDeleteResult { /// Map of sessionId -> bytes freed by removing the session's workspace directory. Sessions whose deletion failed are omitted from this map (failures are logged on the server but not surfaced per-id; check the map for absent IDs to detect them). [JsonPropertyName("freedBytes")] public IDictionary FreedBytes { get => field ??= new Dictionary(); set; } } /// Session IDs to close, deactivate, and delete from disk. [Experimental(Diagnostics.Experimental)] internal sealed class SessionsBulkDeleteRequest { /// Session IDs to close, deactivate, and delete from disk. [JsonPropertyName("sessionIds")] public IList SessionIds { get => field ??= []; set; } } /// Outcome of the prune operation: deleted IDs, dry-run candidates, skipped IDs, total bytes freed, and the dry-run flag. [Experimental(Diagnostics.Experimental)] public sealed class SessionPruneResult { /// Session IDs that would be deleted in dry-run mode (always empty otherwise). [JsonPropertyName("candidates")] public IList Candidates { get => field ??= []; set; } /// Session IDs that were deleted (always empty in dry-run mode). [JsonPropertyName("deleted")] public IList Deleted { get => field ??= []; set; } /// True when no deletions were actually performed. [JsonPropertyName("dryRun")] public bool DryRun { get; set; } /// Total bytes freed (actual when not dry-run, projected when dry-run). [JsonPropertyName("freedBytes")] public long FreedBytes { get; set; } /// Session IDs that were skipped (e.g., named sessions). [JsonPropertyName("skipped")] public IList Skipped { get => field ??= []; set; } } /// Age threshold and optional flags controlling which old sessions are pruned (or simulated when dryRun is true). [Experimental(Diagnostics.Experimental)] internal sealed class SessionsPruneOldRequest { /// When true, only report what would be deleted without performing any deletion. [JsonPropertyName("dryRun")] public bool? DryRun { get; set; } /// Session IDs that should never be considered for pruning. [JsonPropertyName("excludeSessionIds")] public IList? ExcludeSessionIds { get; set; } /// When true, named sessions (set via /rename) are also eligible for pruning. [JsonPropertyName("includeNamed")] public bool? IncludeNamed { get; set; } /// Delete sessions whose modifiedTime is at least this many days old. [JsonPropertyName("olderThanDays")] public long OlderThanDays { get; set; } } /// Flush a session's pending events to disk. No-op when no writer exists for the session (e.g., already closed). [Experimental(Diagnostics.Experimental)] public sealed class SessionsSaveResult { } /// Session ID whose pending events should be flushed to disk. [Experimental(Diagnostics.Experimental)] internal sealed class SessionsSaveRequest { /// Session ID whose pending events should be flushed to disk. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Release the in-use lock held by this process for the given session. No-op when this process does not currently hold a lock for the session. [Experimental(Diagnostics.Experimental)] public sealed class SessionsReleaseLockResult { } /// Session ID whose in-use lock should be released. [Experimental(Diagnostics.Experimental)] internal sealed class SessionsReleaseLockRequest { /// Session ID whose in-use lock should be released. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// The same metadata records, with summary and context fields backfilled where available. [Experimental(Diagnostics.Experimental)] public sealed class SessionEnrichMetadataResult { /// Same records, with summary and context backfilled. [JsonPropertyName("sessions")] public IList Sessions { get => field ??= []; set; } } /// Session metadata records to enrich with summary and context information. [Experimental(Diagnostics.Experimental)] internal sealed class SessionsEnrichMetadataRequest { /// Session metadata records to enrich. Records that already have summary and context are returned unchanged. [JsonPropertyName("sessions")] public IList Sessions { get => field ??= []; set; } } /// Reload all hooks (user, plugin, optionally repo) and apply them to the active session. Call after installing or removing plugins so their hooks take effect immediately. No-op when no active session matches the given sessionId. [Experimental(Diagnostics.Experimental)] public sealed class SessionsReloadPluginHooksResult { } /// Active session ID and an optional flag for deferring repo-level hooks until folder trust. [Experimental(Diagnostics.Experimental)] internal sealed class SessionsReloadPluginHooksRequest { /// When true, skip repo-level hooks. Use before folder trust is confirmed; loadDeferredRepoHooks loads them post-trust. [JsonPropertyName("deferRepoHooks")] public bool? DeferRepoHooks { get; set; } /// Active session ID to reload hooks for. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Queued repo-level startup prompts and the total hook command count after loading. [Experimental(Diagnostics.Experimental)] public sealed class SessionLoadDeferredRepoHooksResult { /// Total hook command count (user + plugin + repo) loaded for the session by this call. Captured atomically with startupPrompts so callers don't need to read a separate counter. [JsonPropertyName("hookCount")] public long HookCount { get; set; } /// Repo-level startup prompts queued from repo hook configs. Empty on resume, when no repo configs were pending, or when disableAllHooks is set. [JsonPropertyName("startupPrompts")] public IList StartupPrompts { get => field ??= []; set; } } /// Active session ID whose deferred repo-level hooks should be loaded. [Experimental(Diagnostics.Experimental)] internal sealed class SessionsLoadDeferredRepoHooksRequest { /// Active session ID whose deferred repo-level hooks should be loaded. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Replace the manager-wide additional plugins. New session creations and subsequent hook reloads see the new set; already-running sessions keep their existing hook installation until the next reload. [Experimental(Diagnostics.Experimental)] public sealed class SessionsSetAdditionalPluginsResult { } /// Schema for the `InstalledPlugin` type. [Experimental(Diagnostics.Experimental)] public sealed class InstalledPlugin { /// Path where the plugin is cached locally. [JsonPropertyName("cache_path")] public string? CachePath { get; set; } /// Whether the plugin is currently enabled. [JsonPropertyName("enabled")] public bool Enabled { get; set; } /// Installation timestamp. [JsonPropertyName("installed_at")] public string InstalledAt { get; set; } = string.Empty; /// Marketplace the plugin came from (empty string for direct repo installs). [JsonPropertyName("marketplace")] public string Marketplace { get; set; } = string.Empty; /// Plugin name. [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; /// Source for direct repo installs (when marketplace is empty). [JsonPropertyName("source")] public JsonElement? Source { get; set; } /// Version installed (if available). [JsonPropertyName("version")] public string? Version { get; set; } } /// Manager-wide additional plugins to register; replaces any previously-configured set. [Experimental(Diagnostics.Experimental)] internal sealed class SessionsSetAdditionalPluginsRequest { /// Manager-wide additional plugins to register. Replaces any previously-configured set. Pass an empty array to clear. [JsonPropertyName("plugins")] public IList Plugins { get => field ??= []; set; } } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionSuspendRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Result of sending a user message. [Experimental(Diagnostics.Experimental)] public sealed class SendResult { /// Unique identifier assigned to the message. [JsonPropertyName("messageId")] public string MessageId { get; set; } = string.Empty; } /// A user message attachment — a file, directory, code selection, blob, or GitHub reference. /// Polymorphic base type discriminated by type. [Experimental(Diagnostics.Experimental)] [JsonPolymorphic( TypeDiscriminatorPropertyName = "type", UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToBaseType)] [JsonDerivedType(typeof(SendAttachmentFile), "file")] [JsonDerivedType(typeof(SendAttachmentDirectory), "directory")] [JsonDerivedType(typeof(SendAttachmentSelection), "selection")] [JsonDerivedType(typeof(SendAttachmentGithubReference), "github_reference")] [JsonDerivedType(typeof(SendAttachmentBlob), "blob")] public partial class SendAttachment { /// The type discriminator. [JsonPropertyName("type")] public virtual string Type { get; set; } = string.Empty; } /// Optional line range to scope the attachment to a specific section of the file. [Experimental(Diagnostics.Experimental)] public sealed class SendAttachmentFileLineRange { /// End line number (1-based, inclusive). [JsonPropertyName("end")] public long End { get; set; } /// Start line number (1-based). [JsonPropertyName("start")] public long Start { get; set; } } /// File attachment. /// The file variant of . [Experimental(Diagnostics.Experimental)] public partial class SendAttachmentFile : SendAttachment { /// [JsonIgnore] public override string Type => "file"; /// 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 SendAttachmentFileLineRange? LineRange { get; set; } /// Absolute file path. [JsonPropertyName("path")] public required string Path { get; set; } } /// Directory attachment. /// The directory variant of . [Experimental(Diagnostics.Experimental)] public partial class SendAttachmentDirectory : SendAttachment { /// [JsonIgnore] public override string Type => "directory"; /// User-facing display name for the attachment. [JsonPropertyName("displayName")] public required string DisplayName { get; set; } /// Absolute directory path. [JsonPropertyName("path")] public required string Path { get; set; } } /// End position of the selection. [Experimental(Diagnostics.Experimental)] public sealed class SendAttachmentSelectionDetailsEnd { /// End character offset within the line (0-based). [JsonPropertyName("character")] public long Character { get; set; } /// End line number (0-based). [JsonPropertyName("line")] public long Line { get; set; } } /// Start position of the selection. [Experimental(Diagnostics.Experimental)] public sealed class SendAttachmentSelectionDetailsStart { /// Start character offset within the line (0-based). [JsonPropertyName("character")] public long Character { get; set; } /// Start line number (0-based). [JsonPropertyName("line")] public long Line { get; set; } } /// Position range of the selection within the file. [Experimental(Diagnostics.Experimental)] public sealed class SendAttachmentSelectionDetails { /// End position of the selection. [JsonPropertyName("end")] public SendAttachmentSelectionDetailsEnd End { get => field ??= new(); set; } /// Start position of the selection. [JsonPropertyName("start")] public SendAttachmentSelectionDetailsStart Start { get => field ??= new(); set; } } /// Code selection attachment from an editor. /// The selection variant of . [Experimental(Diagnostics.Experimental)] public partial class SendAttachmentSelection : SendAttachment { /// [JsonIgnore] public override string Type => "selection"; /// User-facing display name for the selection. [JsonPropertyName("displayName")] public required string DisplayName { get; set; } /// Absolute path to the file containing the selection. [JsonPropertyName("filePath")] public required string FilePath { get; set; } /// Position range of the selection within the file. [JsonPropertyName("selection")] public required SendAttachmentSelectionDetails Selection { get; set; } /// The selected text content. [JsonPropertyName("text")] public required string Text { get; set; } } /// GitHub issue, pull request, or discussion reference. /// The github_reference variant of . [Experimental(Diagnostics.Experimental)] public partial class SendAttachmentGithubReference : SendAttachment { /// [JsonIgnore] public override string Type => "github_reference"; /// Issue, pull request, or discussion number. [JsonPropertyName("number")] public required long Number { get; set; } /// Type of GitHub reference. [JsonPropertyName("referenceType")] public required SendAttachmentGithubReferenceType ReferenceType { get; set; } /// Current state of the referenced item (e.g., open, closed, merged). [JsonPropertyName("state")] public required string State { get; set; } /// Title of the referenced item. [JsonPropertyName("title")] public required string Title { 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 . [Experimental(Diagnostics.Experimental)] public partial class SendAttachmentBlob : SendAttachment { /// [JsonIgnore] public override string Type => "blob"; /// Base64-encoded content. [Base64String] [JsonPropertyName("data")] public required string Data { get; set; } /// User-facing display name for the attachment. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("displayName")] public string? DisplayName { get; set; } /// MIME type of the inline data. [JsonPropertyName("mimeType")] public required string MimeType { get; set; } } /// Parameters for sending a user message to the session. [Experimental(Diagnostics.Experimental)] internal sealed class SendRequest { /// The UI mode the agent was in when this message was sent. Defaults to the session's current mode. [JsonPropertyName("agentMode")] public SendAgentMode? AgentMode { get; set; } /// Optional attachments (files, directories, selections, blobs, GitHub references) to include with the message. [JsonPropertyName("attachments")] public IList? Attachments { get; set; } /// If false, this message will not trigger a Premium Request Unit charge. User messages default to billable. [JsonPropertyName("billable")] public bool? Billable { get; set; } /// If provided, this is shown in the timeline instead of `prompt`. [JsonPropertyName("displayPrompt")] public string? DisplayPrompt { get; set; } /// How to deliver the message. `enqueue` (default) appends to the message queue. `immediate` interjects during an in-progress turn. [JsonPropertyName("mode")] public SendMode? Mode { get; set; } /// If true, adds the message to the front of the queue instead of the end. [JsonPropertyName("prepend")] public bool? Prepend { get; set; } /// The user message text. [JsonPropertyName("prompt")] public string Prompt { get; set; } = string.Empty; /// Custom HTTP headers to include in outbound model requests for this turn. Merged with session-level provider headers; per-turn headers augment and overwrite session-level headers with the same key. [JsonPropertyName("requestHeaders")] public IDictionary? RequestHeaders { get; set; } /// If set, the request will fail if the named tool is not available when this message is among the user messages at the start of the current exchange. [JsonPropertyName("requiredTool")] public string? RequiredTool { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; /// Optional provenance tag copied to the resulting user.message event. Supported values are `system`, `command-*`, and `schedule-*`. [JsonInclude] [JsonPropertyName("source")] internal JsonElement? Source { get; set; } /// W3C Trace Context traceparent header for distributed tracing of this agent turn. [JsonPropertyName("traceparent")] public string? Traceparent { get; set; } /// W3C Trace Context tracestate header for distributed tracing. [JsonPropertyName("tracestate")] public string? Tracestate { get; set; } /// If true, await completion of the agentic loop for this message before returning. Defaults to false (fire-and-forget). When true, the result still contains the same `messageId`; the caller can rely on the agent having processed the message before the call resolves. [JsonPropertyName("wait")] public bool? Wait { get; set; } } /// Result of aborting the current turn. [Experimental(Diagnostics.Experimental)] public sealed class AbortResult { /// Error message if the abort failed. [JsonPropertyName("error")] public string? Error { get; set; } /// Whether the abort completed successfully. [JsonPropertyName("success")] public bool Success { get; set; } } /// Parameters for aborting the current turn. [Experimental(Diagnostics.Experimental)] internal sealed class AbortRequest { /// Finite reason code describing why the current turn was aborted. [JsonPropertyName("reason")] public AbortReason? Reason { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Parameters for shutting down the session. [Experimental(Diagnostics.Experimental)] internal sealed class ShutdownRequest { /// Optional human-readable reason. Typically the message of the error that triggered shutdown when type is 'error'. [JsonPropertyName("reason")] public string? Reason { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; /// Why the session is being shut down. Defaults to "routine" when omitted. [JsonPropertyName("type")] public ShutdownType? Type { get; set; } } /// Identifier of the session event that was emitted for the log message. [Experimental(Diagnostics.Experimental)] public sealed class LogResult { /// The unique identifier of the emitted session event. [JsonPropertyName("eventId")] public Guid EventId { get; set; } } /// Message text, optional severity level, persistence flag, optional follow-up URL, and optional tip. [Experimental(Diagnostics.Experimental)] internal sealed class LogRequest { /// When true, the message is transient and not persisted to the session event log on disk. [JsonPropertyName("ephemeral")] public bool? Ephemeral { get; set; } /// Log severity level. Determines how the message is displayed in the timeline. Defaults to "info". [JsonPropertyName("level")] public SessionLogLevel? Level { get; set; } /// Human-readable message. [JsonPropertyName("message")] public string Message { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; /// Optional actionable tip displayed alongside the message. Only honored on `level: "info"`. [JsonPropertyName("tip")] public string? Tip { get; set; } /// Domain category for this log entry (e.g., "mcp", "subscription", "policy", "model"). Maps to `infoType`/`warningType`/`errorType` on the emitted event. Defaults to "notification". [JsonPropertyName("type")] public string? Type { get; set; } /// Optional URL the user can open in their browser for more details. [Url] [StringSyntax(StringSyntaxAttribute.Uri)] [JsonPropertyName("url")] public string? Url { get; set; } } /// Authentication status and account metadata for the session. [Experimental(Diagnostics.Experimental)] public sealed class SessionAuthStatus { /// Authentication type. [JsonPropertyName("authType")] public AuthInfoType? AuthType { get; set; } /// Copilot plan tier (e.g., individual_pro, business). [JsonPropertyName("copilotPlan")] public string? CopilotPlan { get; set; } /// Authentication host URL. [Url] [StringSyntax(StringSyntaxAttribute.Uri)] [JsonPropertyName("host")] public string? Host { get; set; } /// Whether the session has resolved authentication. [JsonPropertyName("isAuthenticated")] public bool IsAuthenticated { get; set; } /// Authenticated login/username, if available. [JsonPropertyName("login")] public string? Login { get; set; } /// Human-readable authentication status description. [JsonPropertyName("statusMessage")] public string? StatusMessage { get; set; } } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionAuthGetStatusRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Indicates whether the credential update succeeded. [Experimental(Diagnostics.Experimental)] public sealed class SessionSetCredentialsResult { /// Whether the operation succeeded. [JsonPropertyName("success")] public bool Success { get; set; } } /// The new auth credentials to install on the session. When omitted or `undefined`, the call is a no-op and the session's existing credentials are preserved. The runtime stores the value verbatim and uses it for outbound model/API requests; it does NOT re-validate or re-fetch the associated Copilot user response. Several variants carry secret material; treat this method's params as containing secrets at rest and in transit. /// Polymorphic base type discriminated by type. [Experimental(Diagnostics.Experimental)] [JsonPolymorphic( TypeDiscriminatorPropertyName = "type", UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToBaseType)] [JsonDerivedType(typeof(AuthInfoHmac), "hmac")] [JsonDerivedType(typeof(AuthInfoEnv), "env")] [JsonDerivedType(typeof(AuthInfoToken), "token")] [JsonDerivedType(typeof(AuthInfoCopilotApiToken), "copilot-api-token")] [JsonDerivedType(typeof(AuthInfoUser), "user")] [JsonDerivedType(typeof(AuthInfoGhCli), "gh-cli")] [JsonDerivedType(typeof(AuthInfoApiKey), "api-key")] public partial class AuthInfo { /// The type discriminator. [JsonPropertyName("type")] public virtual string Type { get; set; } = string.Empty; } /// Schema for the `CopilotUserResponseEndpoints` type. [Experimental(Diagnostics.Experimental)] public sealed class CopilotUserResponseEndpoints { /// Gets or sets the api value. [JsonPropertyName("api")] public string? Api { get; set; } /// Gets or sets the origin-tracker value. [JsonPropertyName("origin-tracker")] public string? OriginTracker { get; set; } /// Gets or sets the proxy value. [JsonPropertyName("proxy")] public string? Proxy { get; set; } /// Gets or sets the telemetry value. [JsonPropertyName("telemetry")] public string? Telemetry { get; set; } } /// RPC data type for CopilotUserResponseOrganizationListItem operations. public sealed class CopilotUserResponseOrganizationListItem { /// Gets or sets the login value. [JsonPropertyName("login")] public string? Login { get; set; } /// Gets or sets the name value. [JsonPropertyName("name")] public string? Name { get; set; } } /// Schema for the `CopilotUserResponseQuotaSnapshotsChat` type. [Experimental(Diagnostics.Experimental)] public sealed class CopilotUserResponseQuotaSnapshotsChat { /// Gets or sets the entitlement value. [JsonPropertyName("entitlement")] public double? Entitlement { get; set; } /// Gets or sets the has_quota value. [JsonPropertyName("has_quota")] public bool? HasQuota { get; set; } /// Gets or sets the overage_count value. [JsonPropertyName("overage_count")] public double? OverageCount { get; set; } /// Gets or sets the overage_permitted value. [JsonPropertyName("overage_permitted")] public bool? OveragePermitted { get; set; } /// Gets or sets the percent_remaining value. [JsonPropertyName("percent_remaining")] public double? PercentRemaining { get; set; } /// Gets or sets the quota_id value. [JsonPropertyName("quota_id")] public string? QuotaId { get; set; } /// Gets or sets the quota_remaining value. [JsonPropertyName("quota_remaining")] public double? QuotaRemaining { get; set; } /// Gets or sets the quota_reset_at value. [JsonPropertyName("quota_reset_at")] public double? QuotaResetAt { get; set; } /// Gets or sets the remaining value. [JsonPropertyName("remaining")] public double? Remaining { get; set; } /// Gets or sets the timestamp_utc value. [JsonPropertyName("timestamp_utc")] public string? TimestampUtc { get; set; } /// Gets or sets the token_based_billing value. [JsonPropertyName("token_based_billing")] public bool? TokenBasedBilling { get; set; } /// Gets or sets the unlimited value. [JsonPropertyName("unlimited")] public bool? Unlimited { get; set; } } /// Schema for the `CopilotUserResponseQuotaSnapshotsCompletions` type. [Experimental(Diagnostics.Experimental)] public sealed class CopilotUserResponseQuotaSnapshotsCompletions { /// Gets or sets the entitlement value. [JsonPropertyName("entitlement")] public double? Entitlement { get; set; } /// Gets or sets the has_quota value. [JsonPropertyName("has_quota")] public bool? HasQuota { get; set; } /// Gets or sets the overage_count value. [JsonPropertyName("overage_count")] public double? OverageCount { get; set; } /// Gets or sets the overage_permitted value. [JsonPropertyName("overage_permitted")] public bool? OveragePermitted { get; set; } /// Gets or sets the percent_remaining value. [JsonPropertyName("percent_remaining")] public double? PercentRemaining { get; set; } /// Gets or sets the quota_id value. [JsonPropertyName("quota_id")] public string? QuotaId { get; set; } /// Gets or sets the quota_remaining value. [JsonPropertyName("quota_remaining")] public double? QuotaRemaining { get; set; } /// Gets or sets the quota_reset_at value. [JsonPropertyName("quota_reset_at")] public double? QuotaResetAt { get; set; } /// Gets or sets the remaining value. [JsonPropertyName("remaining")] public double? Remaining { get; set; } /// Gets or sets the timestamp_utc value. [JsonPropertyName("timestamp_utc")] public string? TimestampUtc { get; set; } /// Gets or sets the token_based_billing value. [JsonPropertyName("token_based_billing")] public bool? TokenBasedBilling { get; set; } /// Gets or sets the unlimited value. [JsonPropertyName("unlimited")] public bool? Unlimited { get; set; } } /// Schema for the `CopilotUserResponseQuotaSnapshotsPremiumInteractions` type. [Experimental(Diagnostics.Experimental)] public sealed class CopilotUserResponseQuotaSnapshotsPremiumInteractions { /// Gets or sets the entitlement value. [JsonPropertyName("entitlement")] public double? Entitlement { get; set; } /// Gets or sets the has_quota value. [JsonPropertyName("has_quota")] public bool? HasQuota { get; set; } /// Gets or sets the overage_count value. [JsonPropertyName("overage_count")] public double? OverageCount { get; set; } /// Gets or sets the overage_permitted value. [JsonPropertyName("overage_permitted")] public bool? OveragePermitted { get; set; } /// Gets or sets the percent_remaining value. [JsonPropertyName("percent_remaining")] public double? PercentRemaining { get; set; } /// Gets or sets the quota_id value. [JsonPropertyName("quota_id")] public string? QuotaId { get; set; } /// Gets or sets the quota_remaining value. [JsonPropertyName("quota_remaining")] public double? QuotaRemaining { get; set; } /// Gets or sets the quota_reset_at value. [JsonPropertyName("quota_reset_at")] public double? QuotaResetAt { get; set; } /// Gets or sets the remaining value. [JsonPropertyName("remaining")] public double? Remaining { get; set; } /// Gets or sets the timestamp_utc value. [JsonPropertyName("timestamp_utc")] public string? TimestampUtc { get; set; } /// Gets or sets the token_based_billing value. [JsonPropertyName("token_based_billing")] public bool? TokenBasedBilling { get; set; } /// Gets or sets the unlimited value. [JsonPropertyName("unlimited")] public bool? Unlimited { get; set; } } /// Schema for the `CopilotUserResponseQuotaSnapshots` type. [Experimental(Diagnostics.Experimental)] public sealed class CopilotUserResponseQuotaSnapshots { /// Schema for the `CopilotUserResponseQuotaSnapshotsChat` type. [JsonPropertyName("chat")] public CopilotUserResponseQuotaSnapshotsChat? Chat { get; set; } /// Schema for the `CopilotUserResponseQuotaSnapshotsCompletions` type. [JsonPropertyName("completions")] public CopilotUserResponseQuotaSnapshotsCompletions? Completions { get; set; } /// Schema for the `CopilotUserResponseQuotaSnapshotsPremiumInteractions` type. [JsonPropertyName("premium_interactions")] public CopilotUserResponseQuotaSnapshotsPremiumInteractions? PremiumInteractions { get; set; } } /// Snapshot of the authenticated user's Copilot subscription info, if known. Mirrors the GitHub API `/copilot_internal/v2/token` user response shape — the runtime trusts this verbatim and does not re-fetch when set. [Experimental(Diagnostics.Experimental)] public sealed class CopilotUserResponse { /// Gets or sets the access_type_sku value. [JsonPropertyName("access_type_sku")] public string? AccessTypeSku { get; set; } /// Gets or sets the analytics_tracking_id value. [JsonPropertyName("analytics_tracking_id")] public string? AnalyticsTrackingId { get; set; } /// Gets or sets the assigned_date value. [JsonPropertyName("assigned_date")] public string? AssignedDate { get; set; } /// Gets or sets the can_signup_for_limited value. [JsonPropertyName("can_signup_for_limited")] public bool? CanSignupForLimited { get; set; } /// Gets or sets the chat_enabled value. [JsonPropertyName("chat_enabled")] public bool? ChatEnabled { get; set; } /// Gets or sets the cli_remote_control_enabled value. [JsonPropertyName("cli_remote_control_enabled")] public bool? CliRemoteControlEnabled { get; set; } /// Gets or sets the cloud_session_storage_enabled value. [JsonPropertyName("cloud_session_storage_enabled")] public bool? CloudSessionStorageEnabled { get; set; } /// Gets or sets the codex_agent_enabled value. [JsonPropertyName("codex_agent_enabled")] public bool? CodexAgentEnabled { get; set; } /// Gets or sets the copilot_plan value. [JsonPropertyName("copilot_plan")] public string? CopilotPlan { get; set; } /// Gets or sets the copilotignore_enabled value. [JsonPropertyName("copilotignore_enabled")] public bool? CopilotignoreEnabled { get; set; } /// Schema for the `CopilotUserResponseEndpoints` type. [JsonPropertyName("endpoints")] public CopilotUserResponseEndpoints? Endpoints { get; set; } /// Gets or sets the is_mcp_enabled value. [JsonPropertyName("is_mcp_enabled")] public bool? IsMcpEnabled { get; set; } /// Gets or sets the limited_user_quotas value. [JsonPropertyName("limited_user_quotas")] public IDictionary? LimitedUserQuotas { get; set; } /// Gets or sets the limited_user_reset_date value. [JsonPropertyName("limited_user_reset_date")] public string? LimitedUserResetDate { get; set; } /// Gets or sets the login value. [JsonPropertyName("login")] public string? Login { get; set; } /// Gets or sets the monthly_quotas value. [JsonPropertyName("monthly_quotas")] public IDictionary? MonthlyQuotas { get; set; } /// Gets or sets the organization_list value. [JsonPropertyName("organization_list")] public IList? OrganizationList { get; set; } /// Gets or sets the organization_login_list value. [JsonPropertyName("organization_login_list")] public IList? OrganizationLoginList { get; set; } /// Gets or sets the quota_reset_date value. [JsonPropertyName("quota_reset_date")] public string? QuotaResetDate { get; set; } /// Gets or sets the quota_reset_date_utc value. [JsonPropertyName("quota_reset_date_utc")] public string? QuotaResetDateUtc { get; set; } /// Schema for the `CopilotUserResponseQuotaSnapshots` type. [JsonPropertyName("quota_snapshots")] public CopilotUserResponseQuotaSnapshots? QuotaSnapshots { get; set; } /// Gets or sets the restricted_telemetry value. [JsonPropertyName("restricted_telemetry")] public bool? RestrictedTelemetry { get; set; } /// Gets or sets the token_based_billing value. [JsonPropertyName("token_based_billing")] public bool? TokenBasedBilling { get; set; } } /// Schema for the `HMACAuthInfo` type. /// The hmac variant of . [Experimental(Diagnostics.Experimental)] public partial class AuthInfoHmac : AuthInfo { /// [JsonIgnore] public override string Type => "hmac"; /// Snapshot of the authenticated user's Copilot subscription info, if known. Mirrors the GitHub API `/copilot_internal/v2/token` user response shape — the runtime trusts this verbatim and does not re-fetch when set. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("copilotUser")] public CopilotUserResponse? CopilotUser { get; set; } /// HMAC secret used to sign requests. [JsonPropertyName("hmac")] public required string Hmac { get; set; } /// Authentication host. HMAC auth always targets the public GitHub host. [JsonPropertyName("host")] public required string Host { get; set; } } /// Schema for the `EnvAuthInfo` type. /// The env variant of . [Experimental(Diagnostics.Experimental)] public partial class AuthInfoEnv : AuthInfo { /// [JsonIgnore] public override string Type => "env"; /// Snapshot of the authenticated user's Copilot subscription info, if known. Mirrors the GitHub API `/copilot_internal/v2/token` user response shape — the runtime trusts this verbatim and does not re-fetch when set. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("copilotUser")] public CopilotUserResponse? CopilotUser { get; set; } /// Name of the environment variable the token was sourced from. [JsonPropertyName("envVar")] public required string EnvVar { get; set; } /// Authentication host (e.g. https://github.com or a GHES host). [JsonPropertyName("host")] public required string Host { get; set; } /// User login associated with the token. Undefined for server-to-server tokens (those starting with `ghs_`). [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("login")] public string? Login { get; set; } /// The token value itself. Treat as a secret. [JsonPropertyName("token")] public required string Token { get; set; } } /// Schema for the `TokenAuthInfo` type. /// The token variant of . [Experimental(Diagnostics.Experimental)] public partial class AuthInfoToken : AuthInfo { /// [JsonIgnore] public override string Type => "token"; /// Snapshot of the authenticated user's Copilot subscription info, if known. Mirrors the GitHub API `/copilot_internal/v2/token` user response shape — the runtime trusts this verbatim and does not re-fetch when set. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("copilotUser")] public CopilotUserResponse? CopilotUser { get; set; } /// Authentication host. [JsonPropertyName("host")] public required string Host { get; set; } /// The token value itself. Treat as a secret. [JsonPropertyName("token")] public required string Token { get; set; } } /// Schema for the `CopilotApiTokenAuthInfo` type. /// The copilot-api-token variant of . [Experimental(Diagnostics.Experimental)] public partial class AuthInfoCopilotApiToken : AuthInfo { /// [JsonIgnore] public override string Type => "copilot-api-token"; /// Snapshot of the authenticated user's Copilot subscription info, if known. Mirrors the GitHub API `/copilot_internal/v2/token` user response shape — the runtime trusts this verbatim and does not re-fetch when set. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("copilotUser")] public CopilotUserResponse? CopilotUser { get; set; } /// Authentication host (always the public GitHub host). [JsonPropertyName("host")] public required string Host { get; set; } } /// Schema for the `UserAuthInfo` type. /// The user variant of . [Experimental(Diagnostics.Experimental)] public partial class AuthInfoUser : AuthInfo { /// [JsonIgnore] public override string Type => "user"; /// Snapshot of the authenticated user's Copilot subscription info, if known. Mirrors the GitHub API `/copilot_internal/v2/token` user response shape — the runtime trusts this verbatim and does not re-fetch when set. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("copilotUser")] public CopilotUserResponse? CopilotUser { get; set; } /// Authentication host. [JsonPropertyName("host")] public required string Host { get; set; } /// OAuth user login. [JsonPropertyName("login")] public required string Login { get; set; } } /// Schema for the `GhCliAuthInfo` type. /// The gh-cli variant of . [Experimental(Diagnostics.Experimental)] public partial class AuthInfoGhCli : AuthInfo { /// [JsonIgnore] public override string Type => "gh-cli"; /// Snapshot of the authenticated user's Copilot subscription info, if known. Mirrors the GitHub API `/copilot_internal/v2/token` user response shape — the runtime trusts this verbatim and does not re-fetch when set. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("copilotUser")] public CopilotUserResponse? CopilotUser { get; set; } /// Authentication host. [JsonPropertyName("host")] public required string Host { get; set; } /// User login as reported by `gh auth status`. [JsonPropertyName("login")] public required string Login { get; set; } /// The token returned by `gh auth token`. Treat as a secret. [JsonPropertyName("token")] public required string Token { get; set; } } /// Schema for the `ApiKeyAuthInfo` type. /// The api-key variant of . [Experimental(Diagnostics.Experimental)] public partial class AuthInfoApiKey : AuthInfo { /// [JsonIgnore] public override string Type => "api-key"; /// The API key. Treat as a secret. [JsonPropertyName("apiKey")] public required string ApiKey { get; set; } /// Snapshot of the authenticated user's Copilot subscription info, if known. Mirrors the GitHub API `/copilot_internal/v2/token` user response shape — the runtime trusts this verbatim and does not re-fetch when set. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("copilotUser")] public CopilotUserResponse? CopilotUser { get; set; } /// Authentication host. [JsonPropertyName("host")] public required string Host { get; set; } } /// New auth credentials to install on the session. Omit to leave credentials unchanged. [Experimental(Diagnostics.Experimental)] internal sealed class SessionSetCredentialsParams { /// The new auth credentials to install on the session. When omitted or `undefined`, the call is a no-op and the session's existing credentials are preserved. The runtime stores the value verbatim and uses it for outbound model/API requests; it does NOT re-validate or re-fetch the associated Copilot user response. Several variants carry secret material; treat this method's params as containing secrets at rest and in transit. [JsonPropertyName("credentials")] public AuthInfo? Credentials { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// The currently selected model and reasoning effort for the session. [Experimental(Diagnostics.Experimental)] public sealed class CurrentModel { /// Currently active model identifier. [JsonPropertyName("modelId")] public string? ModelId { get; set; } /// Reasoning effort level currently applied to the active model, when one is set. Reads `Session.getReasoningEffort()` synchronously after `getSelectedModel()` resolves so the two values are reported as a snapshot. [JsonPropertyName("reasoningEffort")] public string? ReasoningEffort { get; set; } } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionModelGetCurrentRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// The model identifier active on the session after the switch. [Experimental(Diagnostics.Experimental)] public sealed class ModelSwitchToResult { /// Currently active model identifier after the switch. [JsonPropertyName("modelId")] public string? ModelId { get; set; } } /// Vision-specific limits. [Experimental(Diagnostics.Experimental)] public sealed class ModelCapabilitiesOverrideLimitsVision { /// Maximum image size in bytes. [JsonPropertyName("max_prompt_image_size")] public long? MaxPromptImageSize { get; set; } /// Maximum number of images per prompt. [JsonPropertyName("max_prompt_images")] public long? MaxPromptImages { get; set; } /// MIME types the model accepts. [JsonPropertyName("supported_media_types")] public IList? SupportedMediaTypes { get; set; } } /// Token limits for prompts, outputs, and context window. [Experimental(Diagnostics.Experimental)] public sealed class ModelCapabilitiesOverrideLimits { /// Maximum total context window size in tokens. [JsonPropertyName("max_context_window_tokens")] public long? MaxContextWindowTokens { get; set; } /// Maximum number of output/completion tokens. [JsonPropertyName("max_output_tokens")] public long? MaxOutputTokens { get; set; } /// Maximum number of prompt/input tokens. [JsonPropertyName("max_prompt_tokens")] public long? MaxPromptTokens { get; set; } /// Vision-specific limits. [JsonPropertyName("vision")] public ModelCapabilitiesOverrideLimitsVision? Vision { get; set; } } /// Feature flags indicating what the model supports. [Experimental(Diagnostics.Experimental)] public sealed class ModelCapabilitiesOverrideSupports { /// Whether this model supports reasoning effort configuration. [JsonPropertyName("reasoningEffort")] public bool? ReasoningEffort { get; set; } /// Whether this model supports vision/image input. [JsonPropertyName("vision")] public bool? Vision { get; set; } } /// Override individual model capabilities resolved by the runtime. [Experimental(Diagnostics.Experimental)] public sealed class ModelCapabilitiesOverride { /// Token limits for prompts, outputs, and context window. [JsonPropertyName("limits")] public ModelCapabilitiesOverrideLimits? Limits { get; set; } /// Feature flags indicating what the model supports. [JsonPropertyName("supports")] public ModelCapabilitiesOverrideSupports? Supports { get; set; } } /// Target model identifier and optional reasoning effort, summary, and capability overrides. [Experimental(Diagnostics.Experimental)] internal sealed class ModelSwitchToRequest { /// Override individual model capabilities resolved by the runtime. [JsonPropertyName("modelCapabilities")] public ModelCapabilitiesOverride? ModelCapabilities { get; set; } /// Model identifier to switch to. [JsonPropertyName("modelId")] public string ModelId { get; set; } = string.Empty; /// Reasoning effort level to use for the model. "none" disables reasoning. [JsonPropertyName("reasoningEffort")] public string? ReasoningEffort { get; set; } /// Reasoning summary mode to request for supported model clients. [JsonPropertyName("reasoningSummary")] public ReasoningSummary? ReasoningSummary { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Update the session's reasoning effort without changing the selected model. Use `switchTo` instead when you also need to change the model. The runtime stores the effort on the session and applies it to subsequent turns. [Experimental(Diagnostics.Experimental)] public sealed class ModelSetReasoningEffortResult { /// Reasoning effort level recorded on the session after the update. [JsonPropertyName("reasoningEffort")] public string ReasoningEffort { get; set; } = string.Empty; } /// Reasoning effort level to apply to the currently selected model. [Experimental(Diagnostics.Experimental)] internal sealed class ModelSetReasoningEffortRequest { /// Reasoning effort level to apply to the currently selected model. The host is responsible for validating the value against the model's supported levels before calling. [JsonPropertyName("reasoningEffort")] public string ReasoningEffort { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionModeGetRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Agent interaction mode to apply to the session. [Experimental(Diagnostics.Experimental)] internal sealed class ModeSetRequest { /// The session mode the agent is operating in. [JsonPropertyName("mode")] public SessionMode Mode { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// The session's friendly name, or null when not yet set. [Experimental(Diagnostics.Experimental)] public sealed class NameGetResult { /// The session name (user-set or auto-generated), or null if not yet set. [JsonPropertyName("name")] public string? Name { get; set; } } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionNameGetRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// New friendly name to apply to the session. [Experimental(Diagnostics.Experimental)] internal sealed class NameSetRequest { /// New session name (1–100 characters, trimmed of leading/trailing whitespace). [UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "Safe for generated string properties: JSON Schema minLength/maxLength map to string length validation, not reflection over trimmed Count members")] [MinLength(1)] [MaxLength(100)] [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Indicates whether the auto-generated summary was applied as the session's name. [Experimental(Diagnostics.Experimental)] public sealed class NameSetAutoResult { /// Whether the auto-generated summary was persisted. False if the session already has a user-set name, the summary normalized to empty, or the session does not have a workspace. [JsonPropertyName("applied")] public bool Applied { get; set; } } /// Auto-generated session summary to apply as the session's name when no user-set name exists. [Experimental(Diagnostics.Experimental)] internal sealed class NameSetAutoRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; /// Auto-generated session summary. Empty/whitespace-only values are ignored; values are trimmed before persisting. [JsonPropertyName("summary")] public string Summary { get; set; } = string.Empty; } /// Existence, contents, and resolved path of the session plan file. [Experimental(Diagnostics.Experimental)] public sealed class PlanReadResult { /// The content of the plan file, or null if it does not exist. [JsonPropertyName("content")] public string? Content { get; set; } /// Whether the plan file exists in the workspace. [JsonPropertyName("exists")] public bool Exists { get; set; } /// Absolute file path of the plan file, or null if workspace is not enabled. [JsonPropertyName("path")] public string? Path { get; set; } } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionPlanReadRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Replacement contents to write to the session plan file. [Experimental(Diagnostics.Experimental)] internal sealed class PlanUpdateRequest { /// The new content for the plan file. [JsonPropertyName("content")] public string Content { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionPlanDeleteRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// RPC data type for WorkspacesGetWorkspaceResultWorkspace operations. public sealed class WorkspacesGetWorkspaceResultWorkspace { /// Gets or sets the branch value. [JsonPropertyName("branch")] public string? Branch { get; set; } /// Gets or sets the chronicle_sync_dismissed value. [JsonPropertyName("chronicle_sync_dismissed")] public bool? ChronicleSyncDismissed { get; set; } /// Gets or sets the created_at value. [JsonPropertyName("created_at")] public DateTimeOffset? CreatedAt { get; set; } /// Gets or sets the cwd value. [JsonPropertyName("cwd")] public string? Cwd { get; set; } /// Gets or sets the git_root value. [JsonPropertyName("git_root")] public string? GitRoot { get; set; } /// Allowed values for the `WorkspacesWorkspaceDetailsHostType` enumeration. [JsonPropertyName("host_type")] public WorkspacesWorkspaceDetailsHostType? HostType { get; set; } /// Gets or sets the id value. [UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "Safe for generated string properties: JSON Schema minLength/maxLength map to string length validation, not reflection over trimmed Count members")] [MinLength(1)] [JsonPropertyName("id")] public string Id { get; set; } = string.Empty; /// Gets or sets the mc_last_event_id value. [JsonPropertyName("mc_last_event_id")] public string? McLastEventId { get; set; } /// Gets or sets the mc_session_id value. [JsonPropertyName("mc_session_id")] public string? McSessionId { get; set; } /// Gets or sets the mc_task_id value. [JsonPropertyName("mc_task_id")] public string? McTaskId { get; set; } /// Gets or sets the name value. [JsonPropertyName("name")] public string? Name { get; set; } /// Gets or sets the remote_steerable value. [JsonPropertyName("remote_steerable")] public bool? RemoteSteerable { get; set; } /// Gets or sets the repository value. [JsonPropertyName("repository")] public string? Repository { get; set; } /// Gets or sets the summary_count value. [JsonPropertyName("summary_count")] public long? SummaryCount { get; set; } /// Gets or sets the updated_at value. [JsonPropertyName("updated_at")] public DateTimeOffset? UpdatedAt { get; set; } /// Gets or sets the user_named value. [JsonPropertyName("user_named")] public bool? UserNamed { get; set; } } /// Current workspace metadata for the session, including its absolute filesystem path when available. [Experimental(Diagnostics.Experimental)] public sealed class WorkspacesGetWorkspaceResult { /// Absolute filesystem path to the workspace directory. Omitted when the session has no workspace (e.g. remote sessions). [JsonPropertyName("path")] public string? Path { get; set; } /// Current workspace metadata, or null if not available. [JsonPropertyName("workspace")] public WorkspacesGetWorkspaceResultWorkspace? Workspace { get; set; } } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionWorkspacesGetWorkspaceRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Relative paths of files stored in the session workspace files directory. [Experimental(Diagnostics.Experimental)] public sealed class WorkspacesListFilesResult { /// Relative file paths in the workspace files directory. [JsonPropertyName("files")] public IList Files { get => field ??= []; set; } } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionWorkspacesListFilesRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Contents of the requested workspace file as a UTF-8 string. [Experimental(Diagnostics.Experimental)] public sealed class WorkspacesReadFileResult { /// File content as a UTF-8 string. [JsonPropertyName("content")] public string Content { get; set; } = string.Empty; } /// Relative path of the workspace file to read. [Experimental(Diagnostics.Experimental)] internal sealed class WorkspacesReadFileRequest { /// Relative path within the workspace files directory. [JsonPropertyName("path")] public string Path { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Relative path and UTF-8 content for the workspace file to create or overwrite. [Experimental(Diagnostics.Experimental)] internal sealed class WorkspacesCreateFileRequest { /// File content to write as a UTF-8 string. [JsonPropertyName("content")] public string Content { get; set; } = string.Empty; /// Relative path within the workspace files directory. [JsonPropertyName("path")] public string Path { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Schema for the `WorkspacesCheckpoints` type. [Experimental(Diagnostics.Experimental)] public sealed class WorkspacesCheckpoints { /// Filename of the checkpoint within the workspace checkpoints directory. [JsonPropertyName("filename")] public string Filename { get; set; } = string.Empty; /// Checkpoint number assigned by the workspace manager. [JsonPropertyName("number")] public long Number { get; set; } /// Human-readable checkpoint title. [JsonPropertyName("title")] public string Title { get; set; } = string.Empty; } /// Workspace checkpoints in chronological order; empty when the workspace is not enabled. [Experimental(Diagnostics.Experimental)] public sealed class WorkspacesListCheckpointsResult { /// Workspace checkpoints in chronological order. Empty when workspace is not enabled. [JsonPropertyName("checkpoints")] public IList Checkpoints { get => field ??= []; set; } } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionWorkspacesListCheckpointsRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Checkpoint content as a UTF-8 string, or null when the checkpoint or workspace is missing. [Experimental(Diagnostics.Experimental)] public sealed class WorkspacesReadCheckpointResult { /// Checkpoint content as a UTF-8 string, or null when the checkpoint or workspace is missing. [JsonPropertyName("content")] public string? Content { get; set; } } /// Checkpoint number to read. [Experimental(Diagnostics.Experimental)] internal sealed class WorkspacesReadCheckpointRequest { /// Checkpoint number to read. [JsonPropertyName("number")] public long Number { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// RPC data type for WorkspacesSaveLargePasteResultSaved operations. public sealed class WorkspacesSaveLargePasteResultSaved { /// Filename within the workspace files directory. [JsonPropertyName("filename")] public string Filename { get; set; } = string.Empty; /// Absolute filesystem path to the saved paste file. [JsonPropertyName("filePath")] public string FilePath { get; set; } = string.Empty; /// Size of the saved file in bytes. [JsonPropertyName("sizeBytes")] public long SizeBytes { get; set; } } /// Descriptor for the saved paste file, or null when the workspace is unavailable. [Experimental(Diagnostics.Experimental)] public sealed class WorkspacesSaveLargePasteResult { /// Saved-paste descriptor, or null when the workspace is unavailable (e.g. CCA runtime, non-infinite sessions, remote sessions). [JsonPropertyName("saved")] public WorkspacesSaveLargePasteResultSaved? Saved { get; set; } } /// Pasted content to save as a UTF-8 file in the session workspace. [Experimental(Diagnostics.Experimental)] internal sealed class WorkspacesSaveLargePasteRequest { /// Pasted content to save as a UTF-8 file. [JsonPropertyName("content")] public string Content { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Schema for the `InstructionsSources` type. [Experimental(Diagnostics.Experimental)] public sealed class InstructionsSources { /// Glob pattern(s) from frontmatter — when set, this instruction applies only to matching files. [JsonPropertyName("applyTo")] public IList? ApplyTo { get; set; } /// Raw content of the instruction file. [JsonPropertyName("content")] public string Content { get; set; } = string.Empty; /// When true, this source starts disabled and must be toggled on by the user. [JsonPropertyName("defaultDisabled")] public bool? DefaultDisabled { get; set; } /// Short description (body after frontmatter) for use in instruction tables. [JsonPropertyName("description")] public string? Description { get; set; } /// Unique identifier for this source (used for toggling). [JsonPropertyName("id")] public string Id { get; set; } = string.Empty; /// Human-readable label. [JsonPropertyName("label")] public string Label { get; set; } = string.Empty; /// Where this source lives — used for UI grouping. [JsonPropertyName("location")] public InstructionsSourcesLocation Location { get; set; } /// File path relative to repo or absolute for home. [JsonPropertyName("sourcePath")] public string SourcePath { get; set; } = string.Empty; /// Category of instruction source — used for merge logic. [JsonPropertyName("type")] public InstructionsSourcesType Type { get; set; } } /// Instruction sources loaded for the session, in merge order. [Experimental(Diagnostics.Experimental)] public sealed class InstructionsGetSourcesResult { /// Instruction sources for the session. [JsonPropertyName("sources")] public IList Sources { get => field ??= []; set; } } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionInstructionsGetSourcesRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Indicates whether fleet mode was successfully activated. [Experimental(Diagnostics.Experimental)] public sealed class FleetStartResult { /// Whether fleet mode was successfully activated. [JsonPropertyName("started")] public bool Started { get; set; } } /// Optional user prompt to combine with the fleet orchestration instructions. [Experimental(Diagnostics.Experimental)] internal sealed class FleetStartRequest { /// Optional user prompt to combine with fleet instructions. [JsonPropertyName("prompt")] public string? Prompt { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Schema for the `AgentInfo` type. [Experimental(Diagnostics.Experimental)] public sealed class AgentInfo { /// Description of the agent's purpose. [JsonPropertyName("description")] public string Description { get; set; } = string.Empty; /// Human-readable display name. [JsonPropertyName("displayName")] public string DisplayName { get; set; } = string.Empty; /// Stable identifier for selection. For most agents this is the same as `name`; for plugin/builtin agents it may differ. Always populated; defaults to `name` when no distinct id was assigned. [JsonPropertyName("id")] public string Id { get; set; } = string.Empty; /// MCP server configurations attached to this agent, keyed by server name. Server config shape mirrors the MCP `mcpServers` schema. [Experimental(Diagnostics.Experimental)] [JsonPropertyName("mcpServers")] public IDictionary? McpServers { get; set; } /// Preferred model id for this agent. When omitted, inherits the outer agent's model. [JsonPropertyName("model")] public string? Model { get; set; } /// Unique identifier of the custom agent. [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; /// Absolute local file path of the agent definition. Only set for file-based agents loaded from disk; remote agents do not have a path. [JsonPropertyName("path")] public string? Path { get; set; } /// Skill names preloaded into this agent's context. Omitted means none. [JsonPropertyName("skills")] public IList? Skills { get; set; } /// Where the agent definition was loaded from. [JsonPropertyName("source")] public AgentInfoSource? Source { get; set; } /// Allowed tool names for this agent. Empty array means none; omitted means inherit defaults. [JsonPropertyName("tools")] public IList? Tools { get; set; } /// Whether the agent can be selected directly by the user. Agents marked `false` are subagent-only. [JsonPropertyName("userInvocable")] public bool? UserInvocable { get; set; } } /// Custom agents available to the session. [Experimental(Diagnostics.Experimental)] public sealed class AgentList { /// Available custom agents. [JsonPropertyName("agents")] public IList Agents { get => field ??= []; set; } } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionAgentListRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// The currently selected custom agent, or null when using the default agent. [Experimental(Diagnostics.Experimental)] public sealed class AgentGetCurrentResult { /// Currently selected custom agent, or null if using the default agent. [JsonPropertyName("agent")] public AgentInfo? Agent { get; set; } } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionAgentGetCurrentRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// The newly selected custom agent. [Experimental(Diagnostics.Experimental)] public sealed class AgentSelectResult { /// The newly selected custom agent. [JsonPropertyName("agent")] public AgentInfo Agent { get => field ??= new(); set; } } /// Name of the custom agent to select for subsequent turns. [Experimental(Diagnostics.Experimental)] internal sealed class AgentSelectRequest { /// Name of the custom agent to select. [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionAgentDeselectRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Custom agents available to the session after reloading definitions from disk. [Experimental(Diagnostics.Experimental)] public sealed class AgentReloadResult { /// Reloaded custom agents. [JsonPropertyName("agents")] public IList Agents { get => field ??= []; set; } } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionAgentReloadRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Identifier assigned to the newly started background agent task. [Experimental(Diagnostics.Experimental)] public sealed class TasksStartAgentResult { /// Generated agent ID for the background task. [JsonPropertyName("agentId")] public string AgentId { get; set; } = string.Empty; } /// Agent type, prompt, name, and optional description and model override for the new task. [Experimental(Diagnostics.Experimental)] internal sealed class TasksStartAgentRequest { /// Type of agent to start (e.g., 'explore', 'task', 'general-purpose'). [JsonPropertyName("agentType")] public string AgentType { get; set; } = string.Empty; /// Short description of the task. [JsonPropertyName("description")] public string? Description { get; set; } /// Optional model override. [JsonPropertyName("model")] public string? Model { get; set; } /// Short name for the agent, used to generate a human-readable ID. [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; /// Task prompt for the agent. [JsonPropertyName("prompt")] public string Prompt { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Schema for the `TaskInfo` type. /// Polymorphic base type discriminated by type. [Experimental(Diagnostics.Experimental)] [JsonPolymorphic( TypeDiscriminatorPropertyName = "type", UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToBaseType)] [JsonDerivedType(typeof(TaskInfoAgent), "agent")] [JsonDerivedType(typeof(TaskInfoShell), "shell")] public partial class TaskInfo { /// The type discriminator. [JsonPropertyName("type")] public virtual string Type { get; set; } = string.Empty; } /// Schema for the `TaskAgentInfo` type. /// The agent variant of . [Experimental(Diagnostics.Experimental)] public partial class TaskInfoAgent : TaskInfo { /// [JsonIgnore] public override string Type => "agent"; /// ISO 8601 timestamp when the current active period began. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("activeStartedAt")] public DateTimeOffset? ActiveStartedAt { get; set; } /// Accumulated active execution time in milliseconds. [JsonConverter(typeof(MillisecondsTimeSpanConverter))] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("activeTimeMs")] public TimeSpan? ActiveTime { get; set; } /// Type of agent running this task. [JsonPropertyName("agentType")] public required string AgentType { get; set; } /// Whether the task is currently in the original sync wait and can be moved to background mode. False once it is already backgrounded, idle, finished, or no longer has a promotable sync waiter. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("canPromoteToBackground")] public bool? CanPromoteToBackground { get; set; } /// ISO 8601 timestamp when the task finished. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("completedAt")] public DateTimeOffset? CompletedAt { get; set; } /// Short description of the task. [JsonPropertyName("description")] public required string Description { get; set; } /// Error message when the task failed. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("error")] public string? Error { get; set; } /// Whether task execution is synchronously awaited or managed in the background. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("executionMode")] public TaskExecutionMode? ExecutionMode { get; set; } /// Unique task identifier. [JsonPropertyName("id")] public required string Id { get; set; } /// ISO 8601 timestamp when the agent entered idle state. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("idleSince")] public DateTimeOffset? IdleSince { get; set; } /// Most recent response text from the agent. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("latestResponse")] public string? LatestResponse { get; set; } /// Model used for the task when specified. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("model")] public string? Model { get; set; } /// Prompt passed to the agent. [JsonPropertyName("prompt")] public required string Prompt { get; set; } /// Result text from the task when available. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("result")] public string? Result { get; set; } /// ISO 8601 timestamp when the task was started. [JsonPropertyName("startedAt")] public required DateTimeOffset StartedAt { get; set; } /// Current lifecycle status of the task. [JsonPropertyName("status")] public required TaskStatus Status { get; set; } /// Tool call ID associated with this agent task. [JsonPropertyName("toolCallId")] public required string ToolCallId { get; set; } } /// Schema for the `TaskShellInfo` type. /// The shell variant of . [Experimental(Diagnostics.Experimental)] public partial class TaskInfoShell : TaskInfo { /// [JsonIgnore] public override string Type => "shell"; /// Whether the shell runs inside a managed PTY session or as an independent background process. [JsonPropertyName("attachmentMode")] public required TaskShellInfoAttachmentMode AttachmentMode { get; set; } /// Whether this shell task can be promoted to background mode. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("canPromoteToBackground")] public bool? CanPromoteToBackground { get; set; } /// Command being executed. [JsonPropertyName("command")] public required string Command { get; set; } /// ISO 8601 timestamp when the task finished. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("completedAt")] public DateTimeOffset? CompletedAt { get; set; } /// Short description of the task. [JsonPropertyName("description")] public required string Description { get; set; } /// Whether task execution is synchronously awaited or managed in the background. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("executionMode")] public TaskExecutionMode? ExecutionMode { get; set; } /// Unique task identifier. [JsonPropertyName("id")] public required string Id { get; set; } /// Path to the detached shell log, when available. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("logPath")] public string? LogPath { get; set; } /// Process ID when available. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("pid")] public long? Pid { get; set; } /// ISO 8601 timestamp when the task was started. [JsonPropertyName("startedAt")] public required DateTimeOffset StartedAt { get; set; } /// Current lifecycle status of the task. [JsonPropertyName("status")] public required TaskStatus Status { get; set; } } /// Background tasks currently tracked by the session. [Experimental(Diagnostics.Experimental)] public sealed class TaskList { /// Currently tracked tasks. [JsonPropertyName("tasks")] public IList Tasks { get => field ??= []; set; } } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionTasksListRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Refresh metadata for any detached background shells the runtime knows about. Use after a long pause to pick up exit/output state for shells running outside the agent loop. [Experimental(Diagnostics.Experimental)] public sealed class TasksRefreshResult { } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionTasksRefreshRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Wait until all in-flight background tasks (agents + shells) and any follow-up turns scheduled by their completions have settled. Returns when the runtime is fully drained or after an internal timeout (default 10 minutes; configurable via COPILOT_TASK_WAIT_TIMEOUT_SECONDS). [Experimental(Diagnostics.Experimental)] public sealed class TasksWaitForPendingResult { } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionTasksWaitForPendingRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Polymorphic base type discriminated by type. [JsonPolymorphic( TypeDiscriminatorPropertyName = "type", UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToBaseType)] [JsonDerivedType(typeof(TasksGetProgressResultProgressAgent), "agent")] [JsonDerivedType(typeof(TasksGetProgressResultProgressShell), "shell")] public partial class TasksGetProgressResultProgress { /// The type discriminator. [JsonPropertyName("type")] public virtual string Type { get; set; } = string.Empty; } /// Schema for the `TaskProgressLine` type. [Experimental(Diagnostics.Experimental)] public sealed class TaskProgressLine { /// Display message, e.g., "▸ bash", "✓ edit src/foo.ts". [JsonPropertyName("message")] public string Message { get; set; } = string.Empty; /// ISO 8601 timestamp when this event occurred. [JsonPropertyName("timestamp")] public DateTimeOffset Timestamp { get; set; } } /// Schema for the `TaskAgentProgress` type. /// The agent variant of . public partial class TasksGetProgressResultProgressAgent : TasksGetProgressResultProgress { /// [JsonIgnore] public override string Type => "agent"; /// The most recent intent reported by the agent. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("latestIntent")] public string? LatestIntent { get; set; } /// Recent tool execution events converted to display lines. [JsonPropertyName("recentActivity")] public required IList RecentActivity { get; set; } } /// Schema for the `TaskShellProgress` type. /// The shell variant of . public partial class TasksGetProgressResultProgressShell : TasksGetProgressResultProgress { /// [JsonIgnore] public override string Type => "shell"; /// Process ID when available. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("pid")] public long? Pid { get; set; } /// Recent stdout/stderr lines from the running shell command. [JsonPropertyName("recentOutput")] public required string RecentOutput { get; set; } } /// Progress information for the task, or null when no task with that ID is tracked. [Experimental(Diagnostics.Experimental)] public sealed class TasksGetProgressResult { /// Progress information for the task, discriminated by type. Returns null when no task with this ID is currently tracked. [JsonPropertyName("progress")] public TasksGetProgressResultProgress? Progress { get; set; } } /// Identifier of the background task to fetch progress for. [Experimental(Diagnostics.Experimental)] internal sealed class TasksGetProgressRequest { /// Task identifier (agent ID or shell ID). [JsonPropertyName("id")] public string Id { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// The first sync-waiting task that can currently be promoted to background mode. [Experimental(Diagnostics.Experimental)] public sealed class TasksGetCurrentPromotableResult { /// The first sync-waiting task (agent first, then shell) that can currently be promoted to background mode. Omitted if no such task exists. The returned task is guaranteed to have executionMode='sync' and canPromoteToBackground=true at the time of the call. [JsonPropertyName("task")] public TaskInfo? Task { get; set; } } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionTasksGetCurrentPromotableRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Indicates whether the task was successfully promoted to background mode. [Experimental(Diagnostics.Experimental)] public sealed class TasksPromoteToBackgroundResult { /// Whether the task was successfully promoted to background mode. [JsonPropertyName("promoted")] public bool Promoted { get; set; } } /// Identifier of the task to promote to background mode. [Experimental(Diagnostics.Experimental)] internal sealed class TasksPromoteToBackgroundRequest { /// Task identifier. [JsonPropertyName("id")] public string Id { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// The promoted task as it now exists in background mode, omitted if no promotable task was waiting. [Experimental(Diagnostics.Experimental)] public sealed class TasksPromoteCurrentToBackgroundResult { /// The promoted task as it now exists in background mode, omitted if no promotable task was waiting. Atomic operation: avoids the race window of getCurrentPromotable + promoteToBackground. [JsonPropertyName("task")] public TaskInfo? Task { get; set; } } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionTasksPromoteCurrentToBackgroundRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Indicates whether the background task was successfully cancelled. [Experimental(Diagnostics.Experimental)] public sealed class TasksCancelResult { /// Whether the task was successfully cancelled. [JsonPropertyName("cancelled")] public bool Cancelled { get; set; } } /// Identifier of the background task to cancel. [Experimental(Diagnostics.Experimental)] internal sealed class TasksCancelRequest { /// Task identifier. [JsonPropertyName("id")] public string Id { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Indicates whether the task was removed. False when the task does not exist or is still running/idle. [Experimental(Diagnostics.Experimental)] public sealed class TasksRemoveResult { /// Whether the task was removed. Returns false if the task does not exist or is still running/idle (cancel it first). [JsonPropertyName("removed")] public bool Removed { get; set; } } /// Identifier of the completed or cancelled task to remove from tracking. [Experimental(Diagnostics.Experimental)] internal sealed class TasksRemoveRequest { /// Task identifier. [JsonPropertyName("id")] public string Id { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Indicates whether the message was delivered, with an error message when delivery failed. [Experimental(Diagnostics.Experimental)] public sealed class TasksSendMessageResult { /// Error message if delivery failed. [JsonPropertyName("error")] public string? Error { get; set; } /// Whether the message was successfully delivered or steered. [JsonPropertyName("sent")] public bool Sent { get; set; } } /// Identifier of the target agent task, message content, and optional sender agent ID. [Experimental(Diagnostics.Experimental)] internal sealed class TasksSendMessageRequest { /// Agent ID of the sender, if sent on behalf of another agent. [JsonPropertyName("fromAgentId")] public string? FromAgentId { get; set; } /// Agent task identifier. [JsonPropertyName("id")] public string Id { get; set; } = string.Empty; /// Message content to send to the agent. [JsonPropertyName("message")] public string Message { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Schema for the `Skill` type. [Experimental(Diagnostics.Experimental)] public sealed class Skill { /// Description of what the skill does. [JsonPropertyName("description")] public string Description { get; set; } = string.Empty; /// Whether the skill is currently enabled. [JsonPropertyName("enabled")] public bool Enabled { get; set; } /// Unique identifier for the skill. [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; /// Absolute path to the skill file. [JsonPropertyName("path")] public string? Path { get; set; } /// Name of the plugin that provides the skill, when source is 'plugin'. [JsonPropertyName("pluginName")] public string? PluginName { get; set; } /// Source location type (e.g., project, personal-copilot, plugin, builtin). [JsonPropertyName("source")] public SkillSource Source { get; set; } /// Whether the skill can be invoked by the user as a slash command. [JsonPropertyName("userInvocable")] public bool UserInvocable { get; set; } } /// Skills available to the session, with their enabled state. [Experimental(Diagnostics.Experimental)] public sealed class SkillList { /// Available skills. [JsonPropertyName("skills")] public IList Skills { get => field ??= []; set; } } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionSkillsListRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Schema for the `SkillsInvokedSkill` type. [Experimental(Diagnostics.Experimental)] public sealed class SkillsInvokedSkill { /// Tools that should be auto-approved when this skill is active, captured at invocation time. [JsonPropertyName("allowedTools")] public IList? AllowedTools { get; set; } /// Full content of the skill file. [JsonPropertyName("content")] public string Content { get; set; } = string.Empty; /// Turn number when the skill was invoked. [JsonPropertyName("invokedAtTurn")] public long InvokedAtTurn { get; set; } /// Unique identifier for the skill. [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; /// Path to the SKILL.md file. [JsonPropertyName("path")] public string Path { get; set; } = string.Empty; } /// Skills invoked during this session, ordered by invocation time (most recent last). [Experimental(Diagnostics.Experimental)] public sealed class SkillsGetInvokedResult { /// Skills invoked during this session, ordered by invocation time (most recent last). [JsonPropertyName("skills")] public IList Skills { get => field ??= []; set; } } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionSkillsGetInvokedRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Name of the skill to enable for the session. [Experimental(Diagnostics.Experimental)] internal sealed class SkillsEnableRequest { /// Name of the skill to enable. [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Name of the skill to disable for the session. [Experimental(Diagnostics.Experimental)] internal sealed class SkillsDisableRequest { /// Name of the skill to disable. [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Diagnostics from reloading skill definitions, with warnings and errors as separate lists. [Experimental(Diagnostics.Experimental)] public sealed class SkillsLoadDiagnostics { /// Errors emitted while loading skills (e.g. skills that failed to load entirely). [JsonPropertyName("errors")] public IList Errors { get => field ??= []; set; } /// Warnings emitted while loading skills (e.g. skills that loaded but had issues). [JsonPropertyName("warnings")] public IList Warnings { get => field ??= []; set; } } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionSkillsReloadRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionSkillsEnsureLoadedRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Schema for the `McpServer` type. [Experimental(Diagnostics.Experimental)] public sealed class McpServer { /// Error message if the server failed to connect. [JsonPropertyName("error")] public string? Error { get; set; } /// Server name (config key). [RegularExpression("^[^\\x00-\\x1f/\\x7f-\\x9f}]+(?:\\/[^\\x00-\\x1f/\\x7f-\\x9f}]+)*$")] [UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "Safe for generated string properties: JSON Schema minLength/maxLength map to string length validation, not reflection over trimmed Count members")] [MinLength(1)] [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; /// Configuration source: user, workspace, plugin, or builtin. [JsonPropertyName("source")] public McpServerSource? Source { get; set; } /// Connection status: connected, failed, needs-auth, pending, disabled, or not_configured. [JsonPropertyName("status")] public McpServerStatus Status { get; set; } } /// MCP servers configured for the session, with their connection status. [Experimental(Diagnostics.Experimental)] public sealed class McpServerList { /// Configured MCP servers. [JsonPropertyName("servers")] public IList Servers { get => field ??= []; set; } } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionMcpListRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Name of the MCP server to enable for the session. [Experimental(Diagnostics.Experimental)] internal sealed class McpEnableRequest { /// Name of the MCP server to enable. [RegularExpression("^[^\\x00-\\x1f/\\x7f-\\x9f}]+(?:\\/[^\\x00-\\x1f/\\x7f-\\x9f}]+)*$")] [UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "Safe for generated string properties: JSON Schema minLength/maxLength map to string length validation, not reflection over trimmed Count members")] [MinLength(1)] [JsonPropertyName("serverName")] public string ServerName { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Name of the MCP server to disable for the session. [Experimental(Diagnostics.Experimental)] internal sealed class McpDisableRequest { /// Name of the MCP server to disable. [RegularExpression("^[^\\x00-\\x1f/\\x7f-\\x9f}]+(?:\\/[^\\x00-\\x1f/\\x7f-\\x9f}]+)*$")] [UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "Safe for generated string properties: JSON Schema minLength/maxLength map to string length validation, not reflection over trimmed Count members")] [MinLength(1)] [JsonPropertyName("serverName")] public string ServerName { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionMcpReloadRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// MCP CreateMessageResult payload (with optional 'tools' extension), present when action='success'. Treated as opaque at the schema layer; consumers should construct/consume it per the MCP CreateMessageResult shape. [Experimental(Diagnostics.Experimental)] public sealed class McpExecuteSamplingResult { } /// Outcome of an MCP sampling execution: success result, failure error, or cancellation. [Experimental(Diagnostics.Experimental)] public sealed class McpSamplingExecutionResult { /// Outcome of the sampling inference. 'success' produced a response; 'failure' encountered an error (including agent-side rejection by content filter or criteria); 'cancelled' the caller cancelled this execution via cancelSamplingExecution. [JsonPropertyName("action")] public McpSamplingExecutionAction Action { get; set; } /// Error description, present when action='failure'. [JsonPropertyName("error")] public string? Error { get; set; } /// MCP CreateMessageResult payload (with optional 'tools' extension), present when action='success'. Treated as opaque at the schema layer; consumers should construct/consume it per the MCP CreateMessageResult shape. [JsonPropertyName("result")] public McpExecuteSamplingResult? Result { get; set; } } /// Raw MCP CreateMessageRequest params, as received in the `sampling.requested` event. Treated as opaque at the schema layer; the runtime converts the embedded MCP messages into the OpenAI chat-completion shape internally. [Experimental(Diagnostics.Experimental)] public sealed class McpExecuteSamplingRequest { } /// Identifiers and raw MCP CreateMessageRequest params used to run a sampling inference. [Experimental(Diagnostics.Experimental)] internal sealed class McpExecuteSamplingParams { /// The original MCP JSON-RPC request ID (string or number). Used by the runtime to correlate the inference with the originating MCP request for telemetry; this is distinct from `requestId` (which is the schema-level cancellation handle). [JsonPropertyName("mcpRequestId")] public JsonElement McpRequestId { get; set; } /// Raw MCP CreateMessageRequest params, as received in the `sampling.requested` event. Treated as opaque at the schema layer; the runtime converts the embedded MCP messages into the OpenAI chat-completion shape internally. [JsonPropertyName("request")] public McpExecuteSamplingRequest Request { get => field ??= new(); set; } /// Caller-provided unique identifier for this sampling execution. Use this same ID with cancelSamplingExecution to cancel the in-flight call. Must be unique within the session for the lifetime of the call. [JsonPropertyName("requestId")] public string RequestId { get; set; } = string.Empty; /// Name of the MCP server that initiated the sampling request. [JsonPropertyName("serverName")] public string ServerName { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Indicates whether an in-flight sampling execution with the given requestId was found and cancelled. [Experimental(Diagnostics.Experimental)] public sealed class McpCancelSamplingExecutionResult { /// True if an in-flight execution with the given requestId was found and signalled to cancel. False when no such execution is in flight (already completed, never started, or cancelled by another caller). [JsonPropertyName("cancelled")] public bool Cancelled { get; set; } } /// The requestId previously passed to executeSampling that should be cancelled. [Experimental(Diagnostics.Experimental)] internal sealed class McpCancelSamplingExecutionParams { /// The requestId previously passed to executeSampling that should be cancelled. [JsonPropertyName("requestId")] public string RequestId { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Env-value mode recorded on the session after the update. [Experimental(Diagnostics.Experimental)] public sealed class McpSetEnvValueModeResult { /// Mode recorded on the session after the update. [JsonPropertyName("mode")] public McpSetEnvValueModeDetails Mode { get; set; } } /// Mode controlling how MCP server env values are resolved (`direct` or `indirect`). [Experimental(Diagnostics.Experimental)] internal sealed class McpSetEnvValueModeParams { /// How environment-variable values supplied to MCP servers are resolved. "direct" passes literal string values; "indirect" treats values as references (e.g. names of environment variables on the host) that the runtime resolves before launch. Defaults to the runtime's startup mode; clients that intentionally launch MCP servers with literal values (e.g. CLI prompt mode and ACP) set this to "direct". [JsonPropertyName("mode")] public McpSetEnvValueModeDetails Mode { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Indicates whether the auto-managed `github` MCP server was removed (false when nothing to remove). [Experimental(Diagnostics.Experimental)] public sealed class McpRemoveGitHubResult { /// True when the auto-managed `github` MCP server was removed; false when no removal happened (e.g. user has explicitly configured a `github` server, or the server was not registered). [JsonPropertyName("removed")] public bool Removed { get; set; } } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionMcpRemoveGitHubRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// OAuth authorization URL the caller should open, or empty when cached tokens already authenticated the server. [Experimental(Diagnostics.Experimental)] public sealed class McpOauthLoginResult { /// URL the caller should open in a browser to complete OAuth. Omitted when cached tokens were still valid and no browser interaction was needed — the server is already reconnected in that case. When present, the runtime starts the callback listener before returning and continues the flow in the background; completion is signaled via session.mcp_server_status_changed. [Url] [StringSyntax(StringSyntaxAttribute.Uri)] [JsonPropertyName("authorizationUrl")] public string? AuthorizationUrl { get; set; } } /// Remote MCP server name and optional overrides controlling reauthentication, OAuth client display name, and the callback success-page copy. [Experimental(Diagnostics.Experimental)] internal sealed class McpOauthLoginRequest { /// Optional override for the body text shown on the OAuth loopback callback success page. When omitted, the runtime applies a neutral fallback; callers driving interactive auth should pass surface-specific copy telling the user where to return. [JsonPropertyName("callbackSuccessMessage")] public string? CallbackSuccessMessage { get; set; } /// Optional override for the OAuth client display name shown on the consent screen. Applies to newly registered dynamic clients only — existing registrations keep the name they were created with. When omitted, the runtime applies a neutral fallback; callers driving interactive auth should pass their own surface-specific label so the consent screen matches the product the user sees. [JsonPropertyName("clientName")] public string? ClientName { get; set; } /// When true, clears any cached OAuth token for the server and runs a full new authorization. Use when the user explicitly wants to switch accounts or believes their session is stuck. [JsonPropertyName("forceReauth")] public bool? ForceReauth { get; set; } /// Name of the remote MCP server to authenticate. [RegularExpression("^[^\\x00-\\x1f/\\x7f-\\x9f}]+(?:\\/[^\\x00-\\x1f/\\x7f-\\x9f}]+)*$")] [UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "Safe for generated string properties: JSON Schema minLength/maxLength map to string length validation, not reflection over trimmed Count members")] [MinLength(1)] [JsonPropertyName("serverName")] public string ServerName { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Schema for the `Plugin` type. [Experimental(Diagnostics.Experimental)] public sealed class Plugin { /// Whether the plugin is currently enabled. [JsonPropertyName("enabled")] public bool Enabled { get; set; } /// Marketplace the plugin came from. [JsonPropertyName("marketplace")] public string Marketplace { get; set; } = string.Empty; /// Plugin name. [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; /// Installed version. [JsonPropertyName("version")] public string? Version { get; set; } } /// Plugins installed for the session, with their enabled state and version metadata. [Experimental(Diagnostics.Experimental)] public sealed class PluginList { /// Installed plugins. [JsonPropertyName("plugins")] public IList Plugins { get => field ??= []; set; } } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionPluginsListRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Indicates whether the session options patch was applied successfully. [Experimental(Diagnostics.Experimental)] public sealed class SessionUpdateOptionsResult { /// Whether the operation succeeded. [JsonPropertyName("success")] public bool Success { get; set; } } /// Schema for the `SessionInstalledPlugin` type. [Experimental(Diagnostics.Experimental)] public sealed class SessionInstalledPlugin { /// Path where the plugin is cached locally. [JsonPropertyName("cache_path")] public string? CachePath { get; set; } /// Whether the plugin is currently enabled. [JsonPropertyName("enabled")] public bool Enabled { get; set; } /// Installation timestamp (ISO-8601). [JsonPropertyName("installed_at")] public string InstalledAt { get; set; } = string.Empty; /// Marketplace the plugin came from (empty string for direct repo installs). [JsonPropertyName("marketplace")] public string Marketplace { get; set; } = string.Empty; /// Plugin name. [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; /// Source descriptor for direct repo installs (when marketplace is empty). [JsonPropertyName("source")] public JsonElement? Source { get; set; } /// Installed version, if known. [JsonPropertyName("version")] public string? Version { get; set; } } /// Patch of mutable session options to apply to the running session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionUpdateOptionsParams { /// Additional content-exclusion policies to merge into the session's policy set. Opaque shape; see `ContentExclusionApiResponse` in the runtime. [Experimental(Diagnostics.Experimental)] [JsonPropertyName("additionalContentExclusionPolicies")] public IList? AdditionalContentExclusionPolicies { get; set; } /// Runtime context discriminator (e.g., `cli`, `actions`). [JsonPropertyName("agentContext")] public string? AgentContext { get; set; } /// Whether to disable the `ask_user` tool (encourages autonomous behavior). [JsonPropertyName("askUserDisabled")] public bool? AskUserDisabled { get; set; } /// Allowlist of tool names available to this session. [JsonPropertyName("availableTools")] public IList? AvailableTools { get; set; } /// Identifier of the client driving the session. [JsonPropertyName("clientName")] public string? ClientName { get; set; } /// Whether to include the `Co-authored-by` trailer in commit messages. [JsonPropertyName("coauthorEnabled")] public bool? CoauthorEnabled { get; set; } /// Whether to allow auto-mode continuation across turns. [JsonPropertyName("continueOnAutoMode")] public bool? ContinueOnAutoMode { get; set; } /// Override URL for the Copilot API endpoint. [JsonPropertyName("copilotUrl")] public string? CopilotUrl { get; set; } /// Whether to default custom agents to local-only execution. [JsonPropertyName("customAgentsLocalOnly")] public bool? CustomAgentsLocalOnly { get; set; } /// Instruction source IDs to exclude from the system prompt. [JsonPropertyName("disabledInstructionSources")] public IList? DisabledInstructionSources { get; set; } /// Skill IDs that should be excluded from this session. [JsonPropertyName("disabledSkills")] public IList? DisabledSkills { get; set; } /// Whether to discover custom instructions on demand after successful file views (AGENTS.md / CLAUDE.md / .github/copilot-instructions.md surfacing). Combined with `skipCustomInstructions` and the runtime-side `ON_DEMAND_INSTRUCTIONS` feature flag. [JsonPropertyName("enableOnDemandInstructionDiscovery")] public bool? EnableOnDemandInstructionDiscovery { get; set; } /// Whether to surface reasoning-summary events from the model. [JsonPropertyName("enableReasoningSummaries")] public bool? EnableReasoningSummaries { get; set; } /// Whether shell-script safety heuristics are enabled. [JsonPropertyName("enableScriptSafety")] public bool? EnableScriptSafety { get; set; } /// Whether to stream model responses. [JsonPropertyName("enableStreaming")] public bool? EnableStreaming { get; set; } /// How env values are passed to MCP servers (`direct` inlines literal values; `indirect` resolves at launch). [JsonPropertyName("envValueMode")] public OptionsUpdateEnvValueMode? EnvValueMode { get; set; } /// Override directory for the session-events log. When unset, the runtime's default events log directory is used. [JsonPropertyName("eventsLogDirectory")] public string? EventsLogDirectory { get; set; } /// Denylist of tool names for this session. [JsonPropertyName("excludedTools")] public IList? ExcludedTools { get; set; } /// Map of feature-flag IDs to their boolean enabled state. [JsonPropertyName("featureFlags")] public IDictionary? FeatureFlags { get; set; } /// Full set of installed plugins for the session. Replaces the existing list; the runtime invalidates the skills cache only when the list materially changes. [JsonPropertyName("installedPlugins")] public IList? InstalledPlugins { get; set; } /// Stable integration identifier used for analytics and rate-limit attribution. [JsonPropertyName("integrationId")] public string? IntegrationId { get; set; } /// Whether experimental capabilities are enabled. [JsonPropertyName("isExperimentalMode")] public bool? IsExperimentalMode { get; set; } /// Whether interactive shell sessions are logged. [JsonPropertyName("logInteractiveShells")] public bool? LogInteractiveShells { get; set; } /// Identifier sent to LSP-style integrations. [JsonPropertyName("lspClientName")] public string? LspClientName { get; set; } /// Whether to expose the `manage_schedule` tool to the agent. The runtime always owns the per-session schedule registry; this flag only controls tool exposure (typically gated to staff users). [JsonPropertyName("manageScheduleEnabled")] public bool? ManageScheduleEnabled { get; set; } /// The model ID to use for assistant turns. [JsonPropertyName("model")] public string? Model { get; set; } /// Custom model-provider configuration (BYOK). Opaque shape; see `ProviderConfig` in the runtime. [Experimental(Diagnostics.Experimental)] [JsonPropertyName("provider")] public JsonElement? Provider { get; set; } /// Reasoning effort for the selected model (model-defined enum). [JsonPropertyName("reasoningEffort")] public string? ReasoningEffort { get; set; } /// Whether the session is running in an interactive UI. [JsonPropertyName("runningInInteractiveMode")] public bool? RunningInInteractiveMode { get; set; } /// Sandbox configuration shape; opaque to SDK consumers. See `SandboxConfig` in the runtime. [Experimental(Diagnostics.Experimental)] [JsonPropertyName("sandboxConfig")] public JsonElement? SandboxConfig { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; /// Shell init profile (`None` or `NonInteractive`). [JsonPropertyName("shellInitProfile")] public string? ShellInitProfile { get; set; } /// Per-shell process flags (e.g., `pwsh` arguments). [JsonPropertyName("shellProcessFlags")] public IList? ShellProcessFlags { get; set; } /// Additional directories to search for skills. [JsonPropertyName("skillDirectories")] public IList? SkillDirectories { get; set; } /// Whether to skip loading custom instruction sources. [JsonPropertyName("skipCustomInstructions")] public bool? SkipCustomInstructions { get; set; } /// Optional path for trajectory output. [JsonPropertyName("trajectoryFile")] public string? TrajectoryFile { get; set; } /// Absolute working-directory path for shell tools. [JsonPropertyName("workingDirectory")] public string? WorkingDirectory { get; set; } } /// Parameters for (re)loading the merged LSP configuration set. [Experimental(Diagnostics.Experimental)] internal sealed class LspInitializeRequest { /// Force re-initialization even when LSP configs were already loaded for the working directory. [JsonPropertyName("force")] public bool? Force { get; set; } /// Git root used as the boundary when traversing for project-level LSP configs (supports monorepos). [JsonPropertyName("gitRoot")] public string? GitRoot { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; /// Working directory used to load project-level LSP configs. Defaults to the session working directory when omitted. [JsonPropertyName("workingDirectory")] public string? WorkingDirectory { get; set; } } /// Schema for the `Extension` type. [Experimental(Diagnostics.Experimental)] public sealed class Extension { /// Source-qualified ID (e.g., 'project:my-ext', 'user:auth-helper'). [JsonPropertyName("id")] public string Id { get; set; } = string.Empty; /// Extension name (directory name). [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; /// Process ID if the extension is running. [JsonPropertyName("pid")] public long? Pid { get; set; } /// Discovery source: project (.github/extensions/) or user (~/.copilot/extensions/). [JsonPropertyName("source")] public ExtensionSource Source { get; set; } /// Current status: running, disabled, failed, or starting. [JsonPropertyName("status")] public ExtensionStatus Status { get; set; } } /// Extensions discovered for the session, with their current status. [Experimental(Diagnostics.Experimental)] public sealed class ExtensionList { /// Discovered extensions and their current status. [JsonPropertyName("extensions")] public IList Extensions { get => field ??= []; set; } } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionExtensionsListRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Source-qualified extension identifier to enable for the session. [Experimental(Diagnostics.Experimental)] internal sealed class ExtensionsEnableRequest { /// Source-qualified extension ID to enable. [JsonPropertyName("id")] public string Id { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Source-qualified extension identifier to disable for the session. [Experimental(Diagnostics.Experimental)] internal sealed class ExtensionsDisableRequest { /// Source-qualified extension ID to disable. [JsonPropertyName("id")] public string Id { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionExtensionsReloadRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Indicates whether the external tool call result was handled successfully. [Experimental(Diagnostics.Experimental)] public sealed class HandlePendingToolCallResult { /// Whether the tool call result was handled successfully. [JsonPropertyName("success")] public bool Success { get; set; } } /// Pending external tool call request ID, with the tool result or an error describing why it failed. [Experimental(Diagnostics.Experimental)] internal sealed class HandlePendingToolCallRequest { /// Error message if the tool call failed. [JsonPropertyName("error")] public string? Error { get; set; } /// Request ID of the pending tool call. [JsonPropertyName("requestId")] public string RequestId { get; set; } = string.Empty; /// Tool call result (string or expanded result object). [JsonPropertyName("result")] public JsonElement? Result { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Resolve, build, and validate the runtime tool list for this session. Subagent sessions and consumer flows that need an initialized tool set before `send` invoke this. Default base-class implementation is a no-op for sessions that don't support tool validation. [Experimental(Diagnostics.Experimental)] public sealed class ToolsInitializeAndValidateResult { } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionToolsInitializeAndValidateRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Optional unstructured input hint. [Experimental(Diagnostics.Experimental)] public sealed class SlashCommandInput { /// Optional completion hint for the input (e.g. 'directory' for filesystem path completion). [JsonPropertyName("completion")] public SlashCommandInputCompletion? Completion { get; set; } /// Hint to display when command input has not been provided. [JsonPropertyName("hint")] public string Hint { get; set; } = string.Empty; /// When true, clients should pass the full text after the command name as a single argument rather than splitting on whitespace. [JsonPropertyName("preserveMultilineInput")] public bool? PreserveMultilineInput { get; set; } /// When true, the command requires non-empty input; clients should render the input hint as required. [JsonPropertyName("required")] public bool? Required { get; set; } } /// Schema for the `SlashCommandInfo` type. [Experimental(Diagnostics.Experimental)] public sealed class SlashCommandInfo { /// Canonical aliases without leading slashes. [JsonPropertyName("aliases")] public IList? Aliases { get; set; } /// Whether the command may run while an agent turn is active. [JsonPropertyName("allowDuringAgentExecution")] public bool AllowDuringAgentExecution { get; set; } /// Human-readable command description. [JsonPropertyName("description")] public string Description { get; set; } = string.Empty; /// Whether the command is experimental. [JsonPropertyName("experimental")] public bool? Experimental { get; set; } /// Optional unstructured input hint. [JsonPropertyName("input")] public SlashCommandInput? Input { get; set; } /// Coarse command category for grouping and behavior: runtime built-in, skill-backed command, or SDK/client-owned command. [JsonPropertyName("kind")] public SlashCommandKind Kind { get; set; } /// Canonical command name without a leading slash. [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; } /// Slash commands available in the session, after applying any include/exclude filters. [Experimental(Diagnostics.Experimental)] public sealed class CommandList { /// Commands available in this session. [JsonPropertyName("commands")] public IList Commands { get => field ??= []; set; } } /// Optional filters controlling which command sources to include in the listing. [Experimental(Diagnostics.Experimental)] public sealed class CommandsListRequest { /// Include runtime built-in commands. [JsonPropertyName("includeBuiltins")] public bool? IncludeBuiltins { get; set; } /// Include commands registered by protocol clients, including SDK clients and extensions. [JsonPropertyName("includeClientCommands")] public bool? IncludeClientCommands { get; set; } /// Include enabled user-invocable skills and commands. [JsonPropertyName("includeSkills")] public bool? IncludeSkills { get; set; } } /// Optional filters controlling which command sources to include in the listing. [Experimental(Diagnostics.Experimental)] internal sealed class CommandsListRequestWithSession { /// Include runtime built-in commands. [JsonPropertyName("includeBuiltins")] public bool? IncludeBuiltins { get; set; } /// Include commands registered by protocol clients, including SDK clients and extensions. [JsonPropertyName("includeClientCommands")] public bool? IncludeClientCommands { get; set; } /// Include enabled user-invocable skills and commands. [JsonPropertyName("includeSkills")] public bool? IncludeSkills { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Result of invoking the slash command (text output, prompt to send to the agent, or completion). /// Polymorphic base type discriminated by kind. [Experimental(Diagnostics.Experimental)] [JsonPolymorphic( TypeDiscriminatorPropertyName = "kind", UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToBaseType)] [JsonDerivedType(typeof(SlashCommandInvocationResultText), "text")] [JsonDerivedType(typeof(SlashCommandInvocationResultAgentPrompt), "agent-prompt")] [JsonDerivedType(typeof(SlashCommandInvocationResultCompleted), "completed")] [JsonDerivedType(typeof(SlashCommandInvocationResultSelectSubcommand), "select-subcommand")] public partial class SlashCommandInvocationResult { /// The type discriminator. [JsonPropertyName("kind")] public virtual string Kind { get; set; } = string.Empty; } /// Schema for the `SlashCommandTextResult` type. /// The text variant of . [Experimental(Diagnostics.Experimental)] public partial class SlashCommandInvocationResultText : SlashCommandInvocationResult { /// [JsonIgnore] public override string Kind => "text"; /// Whether text contains Markdown. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("markdown")] public bool? Markdown { get; set; } /// Whether ANSI sequences should be preserved. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("preserveAnsi")] public bool? PreserveAnsi { get; set; } /// True when the invocation mutated user runtime settings; consumers caching settings should refresh. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("runtimeSettingsChanged")] public bool? RuntimeSettingsChanged { get; set; } /// Text output for the client to render. [JsonPropertyName("text")] public required string Text { get; set; } } /// Schema for the `SlashCommandAgentPromptResult` type. /// The agent-prompt variant of . [Experimental(Diagnostics.Experimental)] public partial class SlashCommandInvocationResultAgentPrompt : SlashCommandInvocationResult { /// [JsonIgnore] public override string Kind => "agent-prompt"; /// Prompt text to display to the user. [JsonPropertyName("displayPrompt")] public required string DisplayPrompt { get; set; } /// Optional target session mode for the agent prompt. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("mode")] public SessionMode? Mode { get; set; } /// Prompt to submit to the agent. [JsonPropertyName("prompt")] public required string Prompt { get; set; } /// True when the invocation mutated user runtime settings; consumers caching settings should refresh. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("runtimeSettingsChanged")] public bool? RuntimeSettingsChanged { get; set; } } /// Schema for the `SlashCommandCompletedResult` type. /// The completed variant of . [Experimental(Diagnostics.Experimental)] public partial class SlashCommandInvocationResultCompleted : SlashCommandInvocationResult { /// [JsonIgnore] public override string Kind => "completed"; /// Optional user-facing message describing the completed command. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("message")] public string? Message { get; set; } /// True when the invocation mutated user runtime settings; consumers caching settings should refresh. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("runtimeSettingsChanged")] public bool? RuntimeSettingsChanged { get; set; } } /// Schema for the `SlashCommandSelectSubcommandOption` type. [Experimental(Diagnostics.Experimental)] public sealed class SlashCommandSelectSubcommandOption { /// Human-readable description of the subcommand. [JsonPropertyName("description")] public string Description { get; set; } = string.Empty; /// Optional group label for organizing options. [JsonPropertyName("group")] public string? Group { get; set; } /// Subcommand name to invoke. [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; } /// Schema for the `SlashCommandSelectSubcommandResult` type. /// The select-subcommand variant of . [Experimental(Diagnostics.Experimental)] public partial class SlashCommandInvocationResultSelectSubcommand : SlashCommandInvocationResult { /// [JsonIgnore] public override string Kind => "select-subcommand"; /// Parent command name that requires subcommand selection. [JsonPropertyName("command")] public required string Command { get; set; } /// Available subcommand options for the client to present. [JsonPropertyName("options")] public required IList Options { get; set; } /// True when the invocation mutated user runtime settings; consumers caching settings should refresh. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("runtimeSettingsChanged")] public bool? RuntimeSettingsChanged { get; set; } /// Human-readable title for the selection UI. [JsonPropertyName("title")] public required string Title { get; set; } } /// Slash command name and optional raw input string to invoke. [Experimental(Diagnostics.Experimental)] internal sealed class CommandsInvokeRequest { /// Raw input after the command name. [JsonPropertyName("input")] public string? Input { get; set; } /// Command name. Leading slashes are stripped and the name is matched case-insensitively. [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Indicates whether the pending client-handled command was completed successfully. [Experimental(Diagnostics.Experimental)] public sealed class CommandsHandlePendingCommandResult { /// Whether the command was handled successfully. [JsonPropertyName("success")] public bool Success { get; set; } } /// Pending command request ID and an optional error if the client handler failed. [Experimental(Diagnostics.Experimental)] internal sealed class CommandsHandlePendingCommandRequest { /// Error message if the command handler failed. [JsonPropertyName("error")] public string? Error { get; set; } /// Request ID from the command invocation event. [JsonPropertyName("requestId")] public string RequestId { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Error message produced while executing the command, if any. [Experimental(Diagnostics.Experimental)] public sealed class ExecuteCommandResult { /// Error message produced while executing the command, if any. Omitted when the handler succeeded. [JsonPropertyName("error")] public string? Error { get; set; } } /// Slash command name and argument string to execute synchronously. [Experimental(Diagnostics.Experimental)] internal sealed class ExecuteCommandParams { /// Argument string to pass to the command (empty string if none). [JsonPropertyName("args")] public string Args { get; set; } = string.Empty; /// Name of the slash command to invoke (without the leading '/'). [JsonPropertyName("commandName")] public string CommandName { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Indicates whether the command was accepted into the local execution queue. [Experimental(Diagnostics.Experimental)] public sealed class EnqueueCommandResult { /// True when the command was accepted into the local execution queue. False when the call targets a session that does not support local command queueing (e.g. remote sessions). [JsonPropertyName("queued")] public bool Queued { get; set; } } /// Slash-prefixed command string to enqueue for FIFO processing. [Experimental(Diagnostics.Experimental)] internal sealed class EnqueueCommandParams { /// Slash-prefixed command string to enqueue, e.g. '/compact' or '/model gpt-4'. Queued FIFO with any in-flight items; if the session is idle, processing kicks off immediately. [JsonPropertyName("command")] public string Command { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Indicates whether the queued-command response was matched to a pending request. [Experimental(Diagnostics.Experimental)] public sealed class CommandsRespondToQueuedCommandResult { /// Whether a pending queued command with the given request ID was found and resolved. False when the request was already resolved, cancelled, or unknown. [JsonPropertyName("success")] public bool Success { get; set; } } /// Result of the queued command execution. /// Data type discriminated by handled. [Experimental(Diagnostics.Experimental)] public partial class QueuedCommandResult { /// The boolean discriminator. [JsonPropertyName("handled")] public bool Handled { get; set; } /// When true, the runtime will not process subsequent queued commands until a new request comes in. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("stopProcessingQueue")] public bool? StopProcessingQueue { get; set; } } /// Queued-command request ID and the result indicating whether the host executed it (and whether to stop processing further queued commands). [Experimental(Diagnostics.Experimental)] internal sealed class CommandsRespondToQueuedCommandRequest { /// Request ID from the `command.queued` event the host is responding to. [JsonPropertyName("requestId")] public string RequestId { get; set; } = string.Empty; /// Result of the queued command execution. [JsonPropertyName("result")] public QueuedCommandResult Result { get => field ??= new(); set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Feature override key/value pairs to attach to subsequent telemetry events from this session. [Experimental(Diagnostics.Experimental)] internal sealed class TelemetrySetFeatureOverridesRequest { /// Override key/value pairs to attach to subsequent telemetry events from this session. Replaces any previously-set overrides. [JsonPropertyName("features")] public IDictionary Features { get => field ??= new Dictionary(); set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// The elicitation response (accept with form values, decline, or cancel). [Experimental(Diagnostics.Experimental)] public sealed class UIElicitationResponse { /// The user's response: accept (submitted), decline (rejected), or cancel (dismissed). [JsonPropertyName("action")] public UIElicitationResponseAction Action { get; set; } /// The form values submitted by the user (present when action is 'accept'). [JsonPropertyName("content")] public IDictionary? Content { get; set; } } /// JSON Schema describing the form fields to present to the user. [Experimental(Diagnostics.Experimental)] public sealed class UIElicitationSchema { /// Form field definitions, keyed by field name. [JsonPropertyName("properties")] public IDictionary Properties { get => field ??= new Dictionary(); set; } /// List of required field names. [JsonPropertyName("required")] public IList? Required { get; set; } /// Schema type indicator (always 'object'). [JsonPropertyName("type")] public string Type { get; set; } = string.Empty; } /// Prompt message and JSON schema describing the form fields to elicit from the user. [Experimental(Diagnostics.Experimental)] internal sealed class UIElicitationRequest { /// Message describing what information is needed from the user. [JsonPropertyName("message")] public string Message { get; set; } = string.Empty; /// JSON Schema describing the form fields to present to the user. [JsonPropertyName("requestedSchema")] public UIElicitationSchema RequestedSchema { get => field ??= new(); set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Indicates whether the elicitation response was accepted; false if it was already resolved by another client. [Experimental(Diagnostics.Experimental)] public sealed class UIElicitationResult { /// Whether the response was accepted. False if the request was already resolved by another client. [JsonPropertyName("success")] public bool Success { get; set; } } /// Pending elicitation request ID and the user's response (accept/decline/cancel + form values). [Experimental(Diagnostics.Experimental)] internal sealed class UIHandlePendingElicitationRequest { /// The unique request ID from the elicitation.requested event. [JsonPropertyName("requestId")] public string RequestId { get; set; } = string.Empty; /// The elicitation response (accept with form values, decline, or cancel). [JsonPropertyName("result")] public UIElicitationResponse Result { get => field ??= new(); set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Indicates whether the pending UI request was resolved by this call. [Experimental(Diagnostics.Experimental)] public sealed class UIHandlePendingResult { /// True if the request was still pending and was resolved by this call. False if the request ID was unknown, already resolved by another client (e.g. GitHub), expired, or otherwise no longer pending. [JsonPropertyName("success")] public bool Success { get; set; } } /// Schema for the `UIUserInputResponse` type. [Experimental(Diagnostics.Experimental)] public sealed class UIUserInputResponse { /// The user's answer text. [JsonPropertyName("answer")] public string Answer { get; set; } = string.Empty; /// True if the user typed a freeform response, false if they selected a presented choice. Used by telemetry to differentiate between free text input and choice selection. [JsonPropertyName("wasFreeform")] public bool WasFreeform { get; set; } } /// Request ID of a pending `user_input.requested` event and the user's response. [Experimental(Diagnostics.Experimental)] internal sealed class UIHandlePendingUserInputRequest { /// The unique request ID from the user_input.requested event. [JsonPropertyName("requestId")] public string RequestId { get; set; } = string.Empty; /// Schema for the `UIUserInputResponse` type. [JsonPropertyName("response")] public UIUserInputResponse Response { get => field ??= new(); set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Optional sampling result payload. Omit to reject/cancel the sampling request without providing a result. [Experimental(Diagnostics.Experimental)] public sealed class UIHandlePendingSamplingResponse { } /// Request ID of a pending `sampling.requested` event and an optional sampling result payload (omit to reject). [Experimental(Diagnostics.Experimental)] internal sealed class UIHandlePendingSamplingRequest { /// The unique request ID from the sampling.requested event. [JsonPropertyName("requestId")] public string RequestId { get; set; } = string.Empty; /// Optional sampling result payload. Omit to reject/cancel the sampling request without providing a result. [JsonPropertyName("response")] public UIHandlePendingSamplingResponse? Response { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Request ID of a pending `auto_mode_switch.requested` event and the user's response. [Experimental(Diagnostics.Experimental)] internal sealed class UIHandlePendingAutoModeSwitchRequest { /// The unique request ID from the auto_mode_switch.requested event. [JsonPropertyName("requestId")] public string RequestId { get; set; } = string.Empty; /// User's choice for auto-mode switching: yes (allow this turn), yes_always (allow + persist as setting), or no (decline). [JsonPropertyName("response")] public UIAutoModeSwitchResponse Response { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Schema for the `UIExitPlanModeResponse` type. [Experimental(Diagnostics.Experimental)] public sealed class UIExitPlanModeResponse { /// Whether the plan was approved. [JsonPropertyName("approved")] public bool Approved { get; set; } /// Whether subsequent edits should be auto-approved without confirmation. [JsonPropertyName("autoApproveEdits")] public bool? AutoApproveEdits { get; set; } /// Feedback from the user when they declined the plan or requested changes. [JsonPropertyName("feedback")] public string? Feedback { get; set; } /// The action the user selected. Defaults to 'autopilot' when autoApproveEdits is true, otherwise 'interactive'. [JsonPropertyName("selectedAction")] public UIExitPlanModeAction? SelectedAction { get; set; } } /// Request ID of a pending `exit_plan_mode.requested` event and the user's response. [Experimental(Diagnostics.Experimental)] internal sealed class UIHandlePendingExitPlanModeRequest { /// The unique request ID from the exit_plan_mode.requested event. [JsonPropertyName("requestId")] public string RequestId { get; set; } = string.Empty; /// Schema for the `UIExitPlanModeResponse` type. [JsonPropertyName("response")] public UIExitPlanModeResponse Response { get => field ??= new(); set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Register an in-process handler for `auto_mode_switch.requested` events. The caller still attaches the actual listener via the standard event-subscription mechanism; this registration solely tells the server bridge to skip its own dispatch (so a remote client doesn't race the in-process handler for the same requestId). [Experimental(Diagnostics.Experimental)] public sealed class UIRegisterDirectAutoModeSwitchHandlerResult { /// Opaque handle representing the registration. Pass this same handle to `unregisterDirectAutoModeSwitchHandler` when the in-process handler is no longer active. Multiple registrations are reference-counted; the server bridge will only dispatch auto-mode-switch requests when no handles are active. [JsonPropertyName("handle")] public string Handle { get; set; } = string.Empty; } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionUiRegisterDirectAutoModeSwitchHandlerRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Indicates whether the handle was active and the registration count was decremented. [Experimental(Diagnostics.Experimental)] public sealed class UIUnregisterDirectAutoModeSwitchHandlerResult { /// True if the handle was active and decremented the counter; false if the handle was unknown. [JsonPropertyName("unregistered")] public bool Unregistered { get; set; } } /// Opaque handle previously returned by `registerDirectAutoModeSwitchHandler` to release. [Experimental(Diagnostics.Experimental)] internal sealed class UIUnregisterDirectAutoModeSwitchHandlerRequest { /// Handle previously returned by `registerDirectAutoModeSwitchHandler`. [JsonPropertyName("handle")] public string Handle { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Indicates whether the operation succeeded. [Experimental(Diagnostics.Experimental)] public sealed class PermissionsConfigureResult { /// Whether the operation succeeded. [JsonPropertyName("success")] public bool Success { get; set; } } /// Schema for the `PermissionsConfigureAdditionalContentExclusionPolicyRuleSource` type. [Experimental(Diagnostics.Experimental)] public sealed class PermissionsConfigureAdditionalContentExclusionPolicyRuleSource { /// Gets or sets the name value. [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; /// Gets or sets the type value. [JsonPropertyName("type")] public string Type { get; set; } = string.Empty; } /// Schema for the `PermissionsConfigureAdditionalContentExclusionPolicyRule` type. [Experimental(Diagnostics.Experimental)] public sealed class PermissionsConfigureAdditionalContentExclusionPolicyRule { /// Gets or sets the ifAnyMatch value. [JsonPropertyName("ifAnyMatch")] public IList? IfAnyMatch { get; set; } /// Gets or sets the ifNoneMatch value. [JsonPropertyName("ifNoneMatch")] public IList? IfNoneMatch { get; set; } /// Gets or sets the paths value. [JsonPropertyName("paths")] public IList Paths { get => field ??= []; set; } /// Schema for the `PermissionsConfigureAdditionalContentExclusionPolicyRuleSource` type. [JsonPropertyName("source")] public PermissionsConfigureAdditionalContentExclusionPolicyRuleSource Source { get => field ??= new(); set; } } /// Schema for the `PermissionsConfigureAdditionalContentExclusionPolicy` type. [Experimental(Diagnostics.Experimental)] public sealed class PermissionsConfigureAdditionalContentExclusionPolicy { /// Gets or sets the last_updated_at value. [JsonPropertyName("last_updated_at")] public JsonElement LastUpdatedAt { get; set; } /// Gets or sets the rules value. [JsonPropertyName("rules")] public IList Rules { get => field ??= []; set; } /// Allowed values for the `PermissionsConfigureAdditionalContentExclusionPolicyScope` enumeration. [JsonPropertyName("scope")] public PermissionsConfigureAdditionalContentExclusionPolicyScope Scope { get; set; } } /// If specified, replaces the session's path-permission policy. The runtime constructs the appropriate PathManager based on these inputs (rooted at the session's working directory). Omit to leave the current path policy unchanged. [Experimental(Diagnostics.Experimental)] public sealed class PermissionPathsConfig { /// Additional directories to allow tool access to (in addition to the session's working directory). When `unrestricted` is true, these are still pre-populated on the UnrestrictedPathManager so they remain visible via getDirectories() (e.g. for @-mention completion). [JsonPropertyName("additionalDirectories")] public IList? AdditionalDirectories { get; set; } /// Whether to include the system temp directory in the allowed list (defaults to true). Ignored when `unrestricted` is true. [JsonPropertyName("includeTempDirectory")] public bool? IncludeTempDirectory { get; set; } /// If true, the runtime allows access to all paths without prompting. Equivalent to constructing an UnrestrictedPathManager. [JsonPropertyName("unrestricted")] public bool? Unrestricted { get; set; } /// Workspace root path (special-cased to be allowed even before the directory exists). Ignored when `unrestricted` is true. [JsonPropertyName("workspacePath")] public string? WorkspacePath { get; set; } } /// If specified, replaces the session's approved/denied permission rules. Omit to leave the current rules unchanged. [Experimental(Diagnostics.Experimental)] public sealed class PermissionRulesSet { /// Rules that auto-approve matching requests. [JsonPropertyName("approved")] public IList Approved { get => field ??= []; set; } /// Rules that auto-deny matching requests. [JsonPropertyName("denied")] public IList Denied { get => field ??= []; set; } } /// If specified, replaces the session's URL-permission policy. The runtime constructs a fresh DefaultUrlManager based on these inputs. Omit to leave the current URL policy unchanged. [Experimental(Diagnostics.Experimental)] public sealed class PermissionUrlsConfig { /// Initial list of allowed URL/domain patterns. Patterns may include path components. Ignored when `unrestricted` is true. [JsonPropertyName("initialAllowed")] public IList? InitialAllowed { get; set; } /// If true, the runtime allows access to all URLs without prompting. Initial allow-list is ignored when this is true. [JsonPropertyName("unrestricted")] public bool? Unrestricted { get; set; } } /// Patch of permission policy fields to apply (omit a field to leave it unchanged). [Experimental(Diagnostics.Experimental)] internal sealed class PermissionsConfigureParams { /// If specified, replaces the host-supplied GitHub Content Exclusion policies on the session (combined with natively-discovered policies when evaluating tool/file access). Omit to leave the current policies unchanged. [JsonPropertyName("additionalContentExclusionPolicies")] public IList? AdditionalContentExclusionPolicies { get; set; } /// If specified, sets whether path/URL read permission requests are auto-approved. Omit to leave the current value unchanged. [JsonPropertyName("approveAllReadPermissionRequests")] public bool? ApproveAllReadPermissionRequests { get; set; } /// If specified, sets whether tool permission requests are auto-approved without prompting. Omit to leave the current value unchanged. [JsonPropertyName("approveAllToolPermissionRequests")] public bool? ApproveAllToolPermissionRequests { get; set; } /// If specified, replaces the session's path-permission policy. The runtime constructs the appropriate PathManager based on these inputs (rooted at the session's working directory). Omit to leave the current path policy unchanged. [JsonPropertyName("paths")] public PermissionPathsConfig? Paths { get; set; } /// If specified, replaces the session's approved/denied permission rules. Omit to leave the current rules unchanged. [JsonPropertyName("rules")] public PermissionRulesSet? Rules { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; /// If specified, replaces the session's URL-permission policy. The runtime constructs a fresh DefaultUrlManager based on these inputs. Omit to leave the current URL policy unchanged. [JsonPropertyName("urls")] public PermissionUrlsConfig? Urls { get; set; } } /// Indicates whether the permission decision was applied; false when the request was already resolved. [Experimental(Diagnostics.Experimental)] public sealed class PermissionRequestResult { /// Whether the permission request was handled successfully. [JsonPropertyName("success")] public bool Success { get; set; } } /// The client's response to the pending permission prompt. /// Polymorphic base type discriminated by kind. [Experimental(Diagnostics.Experimental)] [JsonPolymorphic( TypeDiscriminatorPropertyName = "kind", UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToBaseType)] [JsonDerivedType(typeof(PermissionDecisionApproveOnce), "approve-once")] [JsonDerivedType(typeof(PermissionDecisionApproveForSession), "approve-for-session")] [JsonDerivedType(typeof(PermissionDecisionApproveForLocation), "approve-for-location")] [JsonDerivedType(typeof(PermissionDecisionApprovePermanently), "approve-permanently")] [JsonDerivedType(typeof(PermissionDecisionReject), "reject")] [JsonDerivedType(typeof(PermissionDecisionUserNotAvailable), "user-not-available")] [JsonDerivedType(typeof(PermissionDecisionApproved), "approved")] [JsonDerivedType(typeof(PermissionDecisionApprovedForSession), "approved-for-session")] [JsonDerivedType(typeof(PermissionDecisionApprovedForLocation), "approved-for-location")] [JsonDerivedType(typeof(PermissionDecisionCancelled), "cancelled")] [JsonDerivedType(typeof(PermissionDecisionDeniedByRules), "denied-by-rules")] [JsonDerivedType(typeof(PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUser), "denied-no-approval-rule-and-could-not-request-from-user")] [JsonDerivedType(typeof(PermissionDecisionDeniedInteractivelyByUser), "denied-interactively-by-user")] [JsonDerivedType(typeof(PermissionDecisionDeniedByContentExclusionPolicy), "denied-by-content-exclusion-policy")] [JsonDerivedType(typeof(PermissionDecisionDeniedByPermissionRequestHook), "denied-by-permission-request-hook")] public partial class PermissionDecision { /// The type discriminator. [JsonPropertyName("kind")] public virtual string Kind { get; set; } = string.Empty; } /// Schema for the `PermissionDecisionApproveOnce` type. /// The approve-once variant of . [Experimental(Diagnostics.Experimental)] public partial class PermissionDecisionApproveOnce : PermissionDecision { /// [JsonIgnore] public override string Kind => "approve-once"; } /// Session-scoped approval to remember (tool prompts only; omitted for path/url prompts). /// Polymorphic base type discriminated by kind. [Experimental(Diagnostics.Experimental)] [JsonPolymorphic( TypeDiscriminatorPropertyName = "kind", UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToBaseType)] [JsonDerivedType(typeof(PermissionDecisionApproveForSessionApprovalCommands), "commands")] [JsonDerivedType(typeof(PermissionDecisionApproveForSessionApprovalRead), "read")] [JsonDerivedType(typeof(PermissionDecisionApproveForSessionApprovalWrite), "write")] [JsonDerivedType(typeof(PermissionDecisionApproveForSessionApprovalMcp), "mcp")] [JsonDerivedType(typeof(PermissionDecisionApproveForSessionApprovalMcpSampling), "mcp-sampling")] [JsonDerivedType(typeof(PermissionDecisionApproveForSessionApprovalMemory), "memory")] [JsonDerivedType(typeof(PermissionDecisionApproveForSessionApprovalCustomTool), "custom-tool")] [JsonDerivedType(typeof(PermissionDecisionApproveForSessionApprovalExtensionManagement), "extension-management")] [JsonDerivedType(typeof(PermissionDecisionApproveForSessionApprovalExtensionPermissionAccess), "extension-permission-access")] public partial class PermissionDecisionApproveForSessionApproval { /// The type discriminator. [JsonPropertyName("kind")] public virtual string Kind { get; set; } = string.Empty; } /// Schema for the `PermissionDecisionApproveForSessionApprovalCommands` type. /// The commands variant of . [Experimental(Diagnostics.Experimental)] public partial class PermissionDecisionApproveForSessionApprovalCommands : PermissionDecisionApproveForSessionApproval { /// [JsonIgnore] public override string Kind => "commands"; /// Command identifiers covered by this approval. [JsonPropertyName("commandIdentifiers")] public required IList CommandIdentifiers { get; set; } } /// Schema for the `PermissionDecisionApproveForSessionApprovalRead` type. /// The read variant of . [Experimental(Diagnostics.Experimental)] public partial class PermissionDecisionApproveForSessionApprovalRead : PermissionDecisionApproveForSessionApproval { /// [JsonIgnore] public override string Kind => "read"; } /// Schema for the `PermissionDecisionApproveForSessionApprovalWrite` type. /// The write variant of . [Experimental(Diagnostics.Experimental)] public partial class PermissionDecisionApproveForSessionApprovalWrite : PermissionDecisionApproveForSessionApproval { /// [JsonIgnore] public override string Kind => "write"; } /// Schema for the `PermissionDecisionApproveForSessionApprovalMcp` type. /// The mcp variant of . [Experimental(Diagnostics.Experimental)] public partial class PermissionDecisionApproveForSessionApprovalMcp : PermissionDecisionApproveForSessionApproval { /// [JsonIgnore] public override string Kind => "mcp"; /// MCP server name. [JsonPropertyName("serverName")] public required string ServerName { get; set; } /// MCP tool name, or null to cover every tool on the server. [JsonPropertyName("toolName")] public string? ToolName { get; set; } } /// Schema for the `PermissionDecisionApproveForSessionApprovalMcpSampling` type. /// The mcp-sampling variant of . [Experimental(Diagnostics.Experimental)] public partial class PermissionDecisionApproveForSessionApprovalMcpSampling : PermissionDecisionApproveForSessionApproval { /// [JsonIgnore] public override string Kind => "mcp-sampling"; /// MCP server name. [JsonPropertyName("serverName")] public required string ServerName { get; set; } } /// Schema for the `PermissionDecisionApproveForSessionApprovalMemory` type. /// The memory variant of . [Experimental(Diagnostics.Experimental)] public partial class PermissionDecisionApproveForSessionApprovalMemory : PermissionDecisionApproveForSessionApproval { /// [JsonIgnore] public override string Kind => "memory"; } /// Schema for the `PermissionDecisionApproveForSessionApprovalCustomTool` type. /// The custom-tool variant of . [Experimental(Diagnostics.Experimental)] public partial class PermissionDecisionApproveForSessionApprovalCustomTool : PermissionDecisionApproveForSessionApproval { /// [JsonIgnore] public override string Kind => "custom-tool"; /// Custom tool name. [JsonPropertyName("toolName")] public required string ToolName { get; set; } } /// Schema for the `PermissionDecisionApproveForSessionApprovalExtensionManagement` type. /// The extension-management variant of . [Experimental(Diagnostics.Experimental)] public partial class PermissionDecisionApproveForSessionApprovalExtensionManagement : PermissionDecisionApproveForSessionApproval { /// [JsonIgnore] public override string Kind => "extension-management"; /// Optional operation identifier; when omitted, the approval covers all extension management operations. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("operation")] public string? Operation { get; set; } } /// Schema for the `PermissionDecisionApproveForSessionApprovalExtensionPermissionAccess` type. /// The extension-permission-access variant of . [Experimental(Diagnostics.Experimental)] public partial class PermissionDecisionApproveForSessionApprovalExtensionPermissionAccess : PermissionDecisionApproveForSessionApproval { /// [JsonIgnore] public override string Kind => "extension-permission-access"; /// Extension name. [JsonPropertyName("extensionName")] public required string ExtensionName { get; set; } } /// Schema for the `PermissionDecisionApproveForSession` type. /// The approve-for-session variant of . [Experimental(Diagnostics.Experimental)] public partial class PermissionDecisionApproveForSession : PermissionDecision { /// [JsonIgnore] public override string Kind => "approve-for-session"; /// Session-scoped approval to remember (tool prompts only; omitted for path/url prompts). [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("approval")] public PermissionDecisionApproveForSessionApproval? Approval { get; set; } /// URL domain to approve for the rest of the session (URL prompts only). [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("domain")] public string? Domain { get; set; } } /// Approval to persist for this location. /// Polymorphic base type discriminated by kind. [Experimental(Diagnostics.Experimental)] [JsonPolymorphic( TypeDiscriminatorPropertyName = "kind", UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToBaseType)] [JsonDerivedType(typeof(PermissionDecisionApproveForLocationApprovalCommands), "commands")] [JsonDerivedType(typeof(PermissionDecisionApproveForLocationApprovalRead), "read")] [JsonDerivedType(typeof(PermissionDecisionApproveForLocationApprovalWrite), "write")] [JsonDerivedType(typeof(PermissionDecisionApproveForLocationApprovalMcp), "mcp")] [JsonDerivedType(typeof(PermissionDecisionApproveForLocationApprovalMcpSampling), "mcp-sampling")] [JsonDerivedType(typeof(PermissionDecisionApproveForLocationApprovalMemory), "memory")] [JsonDerivedType(typeof(PermissionDecisionApproveForLocationApprovalCustomTool), "custom-tool")] [JsonDerivedType(typeof(PermissionDecisionApproveForLocationApprovalExtensionManagement), "extension-management")] [JsonDerivedType(typeof(PermissionDecisionApproveForLocationApprovalExtensionPermissionAccess), "extension-permission-access")] public partial class PermissionDecisionApproveForLocationApproval { /// The type discriminator. [JsonPropertyName("kind")] public virtual string Kind { get; set; } = string.Empty; } /// Schema for the `PermissionDecisionApproveForLocationApprovalCommands` type. /// The commands variant of . [Experimental(Diagnostics.Experimental)] public partial class PermissionDecisionApproveForLocationApprovalCommands : PermissionDecisionApproveForLocationApproval { /// [JsonIgnore] public override string Kind => "commands"; /// Command identifiers covered by this approval. [JsonPropertyName("commandIdentifiers")] public required IList CommandIdentifiers { get; set; } } /// Schema for the `PermissionDecisionApproveForLocationApprovalRead` type. /// The read variant of . [Experimental(Diagnostics.Experimental)] public partial class PermissionDecisionApproveForLocationApprovalRead : PermissionDecisionApproveForLocationApproval { /// [JsonIgnore] public override string Kind => "read"; } /// Schema for the `PermissionDecisionApproveForLocationApprovalWrite` type. /// The write variant of . [Experimental(Diagnostics.Experimental)] public partial class PermissionDecisionApproveForLocationApprovalWrite : PermissionDecisionApproveForLocationApproval { /// [JsonIgnore] public override string Kind => "write"; } /// Schema for the `PermissionDecisionApproveForLocationApprovalMcp` type. /// The mcp variant of . [Experimental(Diagnostics.Experimental)] public partial class PermissionDecisionApproveForLocationApprovalMcp : PermissionDecisionApproveForLocationApproval { /// [JsonIgnore] public override string Kind => "mcp"; /// MCP server name. [JsonPropertyName("serverName")] public required string ServerName { get; set; } /// MCP tool name, or null to cover every tool on the server. [JsonPropertyName("toolName")] public string? ToolName { get; set; } } /// Schema for the `PermissionDecisionApproveForLocationApprovalMcpSampling` type. /// The mcp-sampling variant of . [Experimental(Diagnostics.Experimental)] public partial class PermissionDecisionApproveForLocationApprovalMcpSampling : PermissionDecisionApproveForLocationApproval { /// [JsonIgnore] public override string Kind => "mcp-sampling"; /// MCP server name. [JsonPropertyName("serverName")] public required string ServerName { get; set; } } /// Schema for the `PermissionDecisionApproveForLocationApprovalMemory` type. /// The memory variant of . [Experimental(Diagnostics.Experimental)] public partial class PermissionDecisionApproveForLocationApprovalMemory : PermissionDecisionApproveForLocationApproval { /// [JsonIgnore] public override string Kind => "memory"; } /// Schema for the `PermissionDecisionApproveForLocationApprovalCustomTool` type. /// The custom-tool variant of . [Experimental(Diagnostics.Experimental)] public partial class PermissionDecisionApproveForLocationApprovalCustomTool : PermissionDecisionApproveForLocationApproval { /// [JsonIgnore] public override string Kind => "custom-tool"; /// Custom tool name. [JsonPropertyName("toolName")] public required string ToolName { get; set; } } /// Schema for the `PermissionDecisionApproveForLocationApprovalExtensionManagement` type. /// The extension-management variant of . [Experimental(Diagnostics.Experimental)] public partial class PermissionDecisionApproveForLocationApprovalExtensionManagement : PermissionDecisionApproveForLocationApproval { /// [JsonIgnore] public override string Kind => "extension-management"; /// Optional operation identifier; when omitted, the approval covers all extension management operations. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("operation")] public string? Operation { get; set; } } /// Schema for the `PermissionDecisionApproveForLocationApprovalExtensionPermissionAccess` type. /// The extension-permission-access variant of . [Experimental(Diagnostics.Experimental)] public partial class PermissionDecisionApproveForLocationApprovalExtensionPermissionAccess : PermissionDecisionApproveForLocationApproval { /// [JsonIgnore] public override string Kind => "extension-permission-access"; /// Extension name. [JsonPropertyName("extensionName")] public required string ExtensionName { get; set; } } /// Schema for the `PermissionDecisionApproveForLocation` type. /// The approve-for-location variant of . [Experimental(Diagnostics.Experimental)] public partial class PermissionDecisionApproveForLocation : PermissionDecision { /// [JsonIgnore] public override string Kind => "approve-for-location"; /// Approval to persist for this location. [JsonPropertyName("approval")] public required PermissionDecisionApproveForLocationApproval Approval { get; set; } /// Location key (git root or cwd) to persist the approval to. [JsonPropertyName("locationKey")] public required string LocationKey { get; set; } } /// Schema for the `PermissionDecisionApprovePermanently` type. /// The approve-permanently variant of . [Experimental(Diagnostics.Experimental)] public partial class PermissionDecisionApprovePermanently : PermissionDecision { /// [JsonIgnore] public override string Kind => "approve-permanently"; /// URL domain to approve permanently. [JsonPropertyName("domain")] public required string Domain { get; set; } } /// Schema for the `PermissionDecisionReject` type. /// The reject variant of . [Experimental(Diagnostics.Experimental)] public partial class PermissionDecisionReject : PermissionDecision { /// [JsonIgnore] public override string Kind => "reject"; /// Optional feedback explaining the rejection. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("feedback")] public string? Feedback { get; set; } } /// Schema for the `PermissionDecisionUserNotAvailable` type. /// The user-not-available variant of . [Experimental(Diagnostics.Experimental)] public partial class PermissionDecisionUserNotAvailable : PermissionDecision { /// [JsonIgnore] public override string Kind => "user-not-available"; } /// Schema for the `PermissionDecisionApproved` type. /// The approved variant of . [Experimental(Diagnostics.Experimental)] public partial class PermissionDecisionApproved : PermissionDecision { /// [JsonIgnore] public override string Kind => "approved"; } /// Schema for the `PermissionDecisionApprovedForSession` type. /// The approved-for-session variant of . [Experimental(Diagnostics.Experimental)] public partial class PermissionDecisionApprovedForSession : PermissionDecision { /// [JsonIgnore] public override string Kind => "approved-for-session"; /// The approval to add as a session-scoped rule. [JsonPropertyName("approval")] public required UserToolSessionApproval Approval { get; set; } } /// Schema for the `PermissionDecisionApprovedForLocation` type. /// The approved-for-location variant of . [Experimental(Diagnostics.Experimental)] public partial class PermissionDecisionApprovedForLocation : PermissionDecision { /// [JsonIgnore] public override string Kind => "approved-for-location"; /// The approval to persist for this location. [JsonPropertyName("approval")] public required UserToolSessionApproval Approval { get; set; } /// The location key (git root or cwd) to persist the approval to. [JsonPropertyName("locationKey")] public required string LocationKey { get; set; } } /// Schema for the `PermissionDecisionCancelled` type. /// The cancelled variant of . [Experimental(Diagnostics.Experimental)] public partial class PermissionDecisionCancelled : PermissionDecision { /// [JsonIgnore] public override string Kind => "cancelled"; /// Optional explanation of why the request was cancelled. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("reason")] public string? Reason { get; set; } } /// Schema for the `PermissionDecisionDeniedByRules` type. /// The denied-by-rules variant of . [Experimental(Diagnostics.Experimental)] public partial class PermissionDecisionDeniedByRules : PermissionDecision { /// [JsonIgnore] public override string Kind => "denied-by-rules"; /// Rules that denied the request. [JsonPropertyName("rules")] public required IList Rules { get; set; } } /// Schema for the `PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUser` type. /// The denied-no-approval-rule-and-could-not-request-from-user variant of . [Experimental(Diagnostics.Experimental)] public partial class PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUser : PermissionDecision { /// [JsonIgnore] public override string Kind => "denied-no-approval-rule-and-could-not-request-from-user"; } /// Schema for the `PermissionDecisionDeniedInteractivelyByUser` type. /// The denied-interactively-by-user variant of . [Experimental(Diagnostics.Experimental)] public partial class PermissionDecisionDeniedInteractivelyByUser : PermissionDecision { /// [JsonIgnore] public override string Kind => "denied-interactively-by-user"; /// Optional feedback from the user explaining the denial. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("feedback")] public string? Feedback { get; set; } /// Whether to force-reject the current agent turn. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("forceReject")] public bool? ForceReject { get; set; } } /// Schema for the `PermissionDecisionDeniedByContentExclusionPolicy` type. /// The denied-by-content-exclusion-policy variant of . [Experimental(Diagnostics.Experimental)] public partial class PermissionDecisionDeniedByContentExclusionPolicy : PermissionDecision { /// [JsonIgnore] public override string Kind => "denied-by-content-exclusion-policy"; /// Human-readable explanation of why the path was excluded. [JsonPropertyName("message")] public required string Message { get; set; } /// File path that triggered the exclusion. [JsonPropertyName("path")] public required string Path { get; set; } } /// Schema for the `PermissionDecisionDeniedByPermissionRequestHook` type. /// The denied-by-permission-request-hook variant of . [Experimental(Diagnostics.Experimental)] public partial class PermissionDecisionDeniedByPermissionRequestHook : PermissionDecision { /// [JsonIgnore] public override string Kind => "denied-by-permission-request-hook"; /// Whether to interrupt the current agent turn. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("interrupt")] public bool? Interrupt { get; set; } /// Optional message from the hook explaining the denial. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("message")] public string? Message { get; set; } } /// Pending permission request ID and the decision to apply (approve/reject and scope). [Experimental(Diagnostics.Experimental)] internal sealed class PermissionDecisionRequest { /// Request ID of the pending permission request. [JsonPropertyName("requestId")] public string RequestId { get; set; } = string.Empty; /// The client's response to the pending permission prompt. [JsonPropertyName("result")] public PermissionDecision Result { get => field ??= new(); set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Schema for the `PendingPermissionRequest` type. [Experimental(Diagnostics.Experimental)] public sealed class PendingPermissionRequest { /// The user-facing permission prompt details (commands, write, read, mcp, url, memory, custom-tool, path, hook). [JsonPropertyName("request")] public PermissionPromptRequest Request { get; set; } = null!; /// Unique identifier for the pending permission request. [JsonPropertyName("requestId")] public string RequestId { get; set; } = string.Empty; } /// List of pending permission requests reconstructed from event history. [Experimental(Diagnostics.Experimental)] public sealed class PendingPermissionRequestList { /// Pending permission prompts reconstructed from the session's event history. Equivalent to the set of `permission.requested` events that have not yet been followed by a matching `permission.completed` event. Used by clients (e.g. the CLI) to hydrate UI for prompts that were emitted before the client attached to the session. [JsonPropertyName("items")] public IList Items { get => field ??= []; set; } } /// No parameters; returns currently-pending permission requests for the session. [Experimental(Diagnostics.Experimental)] internal sealed class PermissionsPendingRequestsRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Indicates whether the operation succeeded. [Experimental(Diagnostics.Experimental)] public sealed class PermissionsSetApproveAllResult { /// Whether the operation succeeded. [JsonPropertyName("success")] public bool Success { get; set; } } /// Allow-all toggle for tool permission requests, with an optional telemetry source. [Experimental(Diagnostics.Experimental)] internal sealed class PermissionsSetApproveAllRequest { /// Whether to auto-approve all tool permission requests. [JsonPropertyName("enabled")] public bool Enabled { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; /// Optional source for allow-all telemetry. Defaults to `rpc` when omitted for SDK callers. [JsonPropertyName("source")] public PermissionsSetApproveAllSource? Source { get; set; } } /// Indicates whether the operation succeeded. [Experimental(Diagnostics.Experimental)] public sealed class PermissionsModifyRulesResult { /// Whether the operation succeeded. [JsonPropertyName("success")] public bool Success { get; set; } } /// Scope and add/remove instructions for modifying session- or location-scoped permission rules. [Experimental(Diagnostics.Experimental)] internal sealed class PermissionsModifyRulesParams { /// Rules to add to the scope. Applied before `remove`/`removeAll`. [JsonPropertyName("add")] public IList? Add { get; set; } /// Specific rules to remove from the scope. Ignored when `removeAll` is true. [JsonPropertyName("remove")] public IList? Remove { get; set; } /// When true, removes every rule currently in the scope (after any `add` is applied). Useful for clearing the location scope wholesale. [JsonPropertyName("removeAll")] public bool? RemoveAll { get; set; } /// Whether the change applies to ephemeral session-scoped rules (cleared at session end) or to location-scoped rules persisted via the location-permissions config file. [JsonPropertyName("scope")] public PermissionsModifyRulesScope Scope { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Indicates whether the operation succeeded. [Experimental(Diagnostics.Experimental)] public sealed class PermissionsSetRequiredResult { /// Whether the operation succeeded. [JsonPropertyName("success")] public bool Success { get; set; } } /// Toggles whether permission prompts should be bridged into session events for this client. [Experimental(Diagnostics.Experimental)] internal sealed class PermissionsSetRequiredRequest { /// Whether the client wants `permission.requested` events bridged from the session-owned permission service. CLI clients that render prompt UI set this to `true` for as long as their listener is mounted; headless callers leave it unset (the default is `false`). [JsonPropertyName("required")] public bool Required { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Indicates whether the operation succeeded. [Experimental(Diagnostics.Experimental)] public sealed class PermissionsResetSessionApprovalsResult { /// Whether the operation succeeded. [JsonPropertyName("success")] public bool Success { get; set; } } /// No parameters; clears all session-scoped tool permission approvals. [Experimental(Diagnostics.Experimental)] internal sealed class PermissionsResetSessionApprovalsRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Indicates whether the operation succeeded. [Experimental(Diagnostics.Experimental)] public sealed class PermissionsNotifyPromptShownResult { /// Whether the operation succeeded. [JsonPropertyName("success")] public bool Success { get; set; } } /// Notification payload describing the permission prompt that the client just rendered. [Experimental(Diagnostics.Experimental)] internal sealed class PermissionPromptShownNotification { /// Human-readable description of the prompt the user is being asked to approve. Used by the runtime to fire the registered `permission_prompt` notification hook (e.g. terminal bell, desktop notification). [JsonPropertyName("message")] public string Message { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Snapshot of the session's allow-listed directories and primary working directory. [Experimental(Diagnostics.Experimental)] public sealed class PermissionPathsList { /// All directories currently allowed for tool access on this session. [JsonPropertyName("directories")] public IList Directories { get => field ??= []; set; } /// The primary working directory for this session. [JsonPropertyName("primary")] public string Primary { get; set; } = string.Empty; } /// No parameters; returns the session's allow-listed directories. [Experimental(Diagnostics.Experimental)] internal sealed class PermissionsPathsListRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Indicates whether the operation succeeded. [Experimental(Diagnostics.Experimental)] public sealed class PermissionsPathsAddResult { /// Whether the operation succeeded. [JsonPropertyName("success")] public bool Success { get; set; } } /// Directory path to add to the session's allowed directories. [Experimental(Diagnostics.Experimental)] internal sealed class PermissionPathsAddParams { /// Directory to add to the allow-list. The runtime resolves and validates the path before adding. [JsonPropertyName("path")] public string Path { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Indicates whether the operation succeeded. [Experimental(Diagnostics.Experimental)] public sealed class PermissionsPathsUpdatePrimaryResult { /// Whether the operation succeeded. [JsonPropertyName("success")] public bool Success { get; set; } } /// Directory path to set as the session's new primary working directory. [Experimental(Diagnostics.Experimental)] internal sealed class PermissionPathsUpdatePrimaryParams { /// Directory to set as the new primary working directory for the session's permission policy. [JsonPropertyName("path")] public string Path { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Indicates whether the supplied path is within the session's allowed directories. [Experimental(Diagnostics.Experimental)] public sealed class PermissionPathsAllowedCheckResult { /// Whether the path is within the session's allowed directories. [JsonPropertyName("allowed")] public bool Allowed { get; set; } } /// Path to evaluate against the session's allowed directories. [Experimental(Diagnostics.Experimental)] internal sealed class PermissionPathsAllowedCheckParams { /// Path to check against the session's allowed directories. [JsonPropertyName("path")] public string Path { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Indicates whether the supplied path is within the session's workspace directory. [Experimental(Diagnostics.Experimental)] public sealed class PermissionPathsWorkspaceCheckResult { /// Whether the path is within the session workspace directory. [JsonPropertyName("allowed")] public bool Allowed { get; set; } } /// Path to evaluate against the session's workspace (primary) directory. [Experimental(Diagnostics.Experimental)] internal sealed class PermissionPathsWorkspaceCheckParams { /// Path to check against the session workspace directory. [JsonPropertyName("path")] public string Path { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Resolved location-permissions key and type. [Experimental(Diagnostics.Experimental)] public sealed class PermissionLocationResolveResult { /// Location key used in the location-permissions store. [JsonPropertyName("locationKey")] public string LocationKey { get; set; } = string.Empty; /// Whether the location is a git repo or directory. [JsonPropertyName("locationType")] public PermissionLocationType LocationType { get; set; } } /// Working directory to resolve into a location-permissions key. [Experimental(Diagnostics.Experimental)] internal sealed class PermissionLocationResolveParams { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; /// Working directory whose permission location should be resolved. [JsonPropertyName("workingDirectory")] public string WorkingDirectory { get; set; } = string.Empty; } /// Summary of persisted location permissions applied to the session. [Experimental(Diagnostics.Experimental)] public sealed class PermissionLocationApplyResult { /// Number of persisted allowed directories added to the live path manager. [JsonPropertyName("appliedDirectoryCount")] public long AppliedDirectoryCount { get; set; } /// Number of location-scoped rules added to the live permission service. [JsonPropertyName("appliedRuleCount")] public long AppliedRuleCount { get; set; } /// Location-scoped rules applied to the live permission service. [JsonPropertyName("appliedRules")] public IList AppliedRules { get => field ??= []; set; } /// Whether a different location was applied since the previous apply call. [JsonPropertyName("changed")] public bool Changed { get; set; } /// Location key used in the location-permissions store. [JsonPropertyName("locationKey")] public string LocationKey { get; set; } = string.Empty; /// Whether the location is a git repo or directory. [JsonPropertyName("locationType")] public PermissionLocationType LocationType { get; set; } } /// Working directory to load persisted location permissions for. [Experimental(Diagnostics.Experimental)] internal sealed class PermissionLocationApplyParams { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; /// Working directory whose persisted location permissions should be applied. [JsonPropertyName("workingDirectory")] public string WorkingDirectory { get; set; } = string.Empty; } /// Indicates whether the operation succeeded. [Experimental(Diagnostics.Experimental)] public sealed class PermissionsLocationsAddToolApprovalResult { /// Whether the operation succeeded. [JsonPropertyName("success")] public bool Success { get; set; } } /// Tool approval to persist and apply. /// Polymorphic base type discriminated by kind. [Experimental(Diagnostics.Experimental)] [JsonPolymorphic( TypeDiscriminatorPropertyName = "kind", UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToBaseType)] [JsonDerivedType(typeof(PermissionsLocationsAddToolApprovalDetailsCommands), "commands")] [JsonDerivedType(typeof(PermissionsLocationsAddToolApprovalDetailsRead), "read")] [JsonDerivedType(typeof(PermissionsLocationsAddToolApprovalDetailsWrite), "write")] [JsonDerivedType(typeof(PermissionsLocationsAddToolApprovalDetailsMcp), "mcp")] [JsonDerivedType(typeof(PermissionsLocationsAddToolApprovalDetailsMcpSampling), "mcp-sampling")] [JsonDerivedType(typeof(PermissionsLocationsAddToolApprovalDetailsMemory), "memory")] [JsonDerivedType(typeof(PermissionsLocationsAddToolApprovalDetailsCustomTool), "custom-tool")] [JsonDerivedType(typeof(PermissionsLocationsAddToolApprovalDetailsExtensionManagement), "extension-management")] [JsonDerivedType(typeof(PermissionsLocationsAddToolApprovalDetailsExtensionPermissionAccess), "extension-permission-access")] public partial class PermissionsLocationsAddToolApprovalDetails { /// The type discriminator. [JsonPropertyName("kind")] public virtual string Kind { get; set; } = string.Empty; } /// Schema for the `PermissionsLocationsAddToolApprovalDetailsCommands` type. /// The commands variant of . [Experimental(Diagnostics.Experimental)] public partial class PermissionsLocationsAddToolApprovalDetailsCommands : PermissionsLocationsAddToolApprovalDetails { /// [JsonIgnore] public override string Kind => "commands"; /// Command identifiers covered by this approval. [JsonPropertyName("commandIdentifiers")] public required IList CommandIdentifiers { get; set; } } /// Schema for the `PermissionsLocationsAddToolApprovalDetailsRead` type. /// The read variant of . [Experimental(Diagnostics.Experimental)] public partial class PermissionsLocationsAddToolApprovalDetailsRead : PermissionsLocationsAddToolApprovalDetails { /// [JsonIgnore] public override string Kind => "read"; } /// Schema for the `PermissionsLocationsAddToolApprovalDetailsWrite` type. /// The write variant of . [Experimental(Diagnostics.Experimental)] public partial class PermissionsLocationsAddToolApprovalDetailsWrite : PermissionsLocationsAddToolApprovalDetails { /// [JsonIgnore] public override string Kind => "write"; } /// Schema for the `PermissionsLocationsAddToolApprovalDetailsMcp` type. /// The mcp variant of . [Experimental(Diagnostics.Experimental)] public partial class PermissionsLocationsAddToolApprovalDetailsMcp : PermissionsLocationsAddToolApprovalDetails { /// [JsonIgnore] public override string Kind => "mcp"; /// MCP server name. [JsonPropertyName("serverName")] public required string ServerName { get; set; } /// MCP tool name, or null to cover every tool on the server. [JsonPropertyName("toolName")] public string? ToolName { get; set; } } /// Schema for the `PermissionsLocationsAddToolApprovalDetailsMcpSampling` type. /// The mcp-sampling variant of . [Experimental(Diagnostics.Experimental)] public partial class PermissionsLocationsAddToolApprovalDetailsMcpSampling : PermissionsLocationsAddToolApprovalDetails { /// [JsonIgnore] public override string Kind => "mcp-sampling"; /// MCP server name. [JsonPropertyName("serverName")] public required string ServerName { get; set; } } /// Schema for the `PermissionsLocationsAddToolApprovalDetailsMemory` type. /// The memory variant of . [Experimental(Diagnostics.Experimental)] public partial class PermissionsLocationsAddToolApprovalDetailsMemory : PermissionsLocationsAddToolApprovalDetails { /// [JsonIgnore] public override string Kind => "memory"; } /// Schema for the `PermissionsLocationsAddToolApprovalDetailsCustomTool` type. /// The custom-tool variant of . [Experimental(Diagnostics.Experimental)] public partial class PermissionsLocationsAddToolApprovalDetailsCustomTool : PermissionsLocationsAddToolApprovalDetails { /// [JsonIgnore] public override string Kind => "custom-tool"; /// Custom tool name. [JsonPropertyName("toolName")] public required string ToolName { get; set; } } /// Schema for the `PermissionsLocationsAddToolApprovalDetailsExtensionManagement` type. /// The extension-management variant of . [Experimental(Diagnostics.Experimental)] public partial class PermissionsLocationsAddToolApprovalDetailsExtensionManagement : PermissionsLocationsAddToolApprovalDetails { /// [JsonIgnore] public override string Kind => "extension-management"; /// Optional operation identifier; when omitted, the approval covers all extension management operations. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("operation")] public string? Operation { get; set; } } /// Schema for the `PermissionsLocationsAddToolApprovalDetailsExtensionPermissionAccess` type. /// The extension-permission-access variant of . [Experimental(Diagnostics.Experimental)] public partial class PermissionsLocationsAddToolApprovalDetailsExtensionPermissionAccess : PermissionsLocationsAddToolApprovalDetails { /// [JsonIgnore] public override string Kind => "extension-permission-access"; /// Extension name. [JsonPropertyName("extensionName")] public required string ExtensionName { get; set; } } /// Location-scoped tool approval to persist. [Experimental(Diagnostics.Experimental)] internal sealed class PermissionLocationAddToolApprovalParams { /// Tool approval to persist and apply. [JsonPropertyName("approval")] public PermissionsLocationsAddToolApprovalDetails Approval { get => field ??= new(); set; } /// Location key (git root or cwd) to persist the approval to. [JsonPropertyName("locationKey")] public string LocationKey { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Folder trust check result. [Experimental(Diagnostics.Experimental)] public sealed class FolderTrustCheckResult { /// Whether the folder is trusted. [JsonPropertyName("trusted")] public bool Trusted { get; set; } } /// Folder path to check for trust. [Experimental(Diagnostics.Experimental)] internal sealed class FolderTrustCheckParams { /// Folder path to check. [JsonPropertyName("path")] public string Path { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Indicates whether the operation succeeded. [Experimental(Diagnostics.Experimental)] public sealed class PermissionsFolderTrustAddTrustedResult { /// Whether the operation succeeded. [JsonPropertyName("success")] public bool Success { get; set; } } /// Folder path to add to trusted folders. [Experimental(Diagnostics.Experimental)] internal sealed class FolderTrustAddParams { /// Folder path to mark as trusted. [JsonPropertyName("path")] public string Path { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Indicates whether the operation succeeded. [Experimental(Diagnostics.Experimental)] public sealed class PermissionsUrlsSetUnrestrictedModeResult { /// Whether the operation succeeded. [JsonPropertyName("success")] public bool Success { get; set; } } /// Whether the URL-permission policy should run in unrestricted mode. [Experimental(Diagnostics.Experimental)] internal sealed class PermissionUrlsSetUnrestrictedModeParams { /// Whether to allow access to all URLs without prompting. Toggles the runtime's URL-permission policy in place. [JsonPropertyName("enabled")] public bool Enabled { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// The repository the remote session targets. [Experimental(Diagnostics.Experimental)] public sealed class MetadataSnapshotRemoteMetadataRepository { /// The branch the remote session is operating on. [JsonPropertyName("branch")] public string Branch { get; set; } = string.Empty; /// The GitHub repository name (without owner). [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; /// The GitHub owner (user or organization) of the target repository. [JsonPropertyName("owner")] public string Owner { get; set; } = string.Empty; } /// Remote-session-specific metadata. Populated only when `isRemote` is true. Fields are immutable for the lifetime of the session. [Experimental(Diagnostics.Experimental)] public sealed class MetadataSnapshotRemoteMetadata { /// The pull request number the remote session is associated with, if any. [JsonPropertyName("pullRequestNumber")] public long? PullRequestNumber { get; set; } /// The repository the remote session targets. [JsonPropertyName("repository")] public MetadataSnapshotRemoteMetadataRepository Repository { get => field ??= new(); set; } /// The original resource identifier (task ID or PR node ID), preserved across event-replay reconstructions. Falls back to `sessionId` when absent. [JsonPropertyName("resourceId")] public string? ResourceId { get; set; } /// Whether the remote task originated from Copilot Coding Agent (cca) or a CLI `--remote` invocation. [JsonPropertyName("taskType")] public MetadataSnapshotRemoteMetadataTaskType? TaskType { get; set; } } /// Public-facing projection of workspace metadata for SDK / TUI consumers. public sealed class SessionMetadataSnapshotWorkspace { /// Branch checked out at session start, if any. [JsonPropertyName("branch")] public string? Branch { get; set; } /// ISO 8601 timestamp when the workspace was created. [JsonPropertyName("created_at")] public DateTimeOffset? CreatedAt { get; set; } /// Current working directory at session start. [JsonPropertyName("cwd")] public string? Cwd { get; set; } /// Resolved git root for cwd, if any. [JsonPropertyName("git_root")] public string? GitRoot { get; set; } /// Repository host type, if known. [JsonPropertyName("host_type")] public WorkspaceSummaryHostType? HostType { get; set; } /// Workspace identifier (1:1 with sessionId). [UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "Safe for generated string properties: JSON Schema minLength/maxLength map to string length validation, not reflection over trimmed Count members")] [MinLength(1)] [JsonPropertyName("id")] public string Id { get; set; } = string.Empty; /// Display name for the session, if set. [JsonPropertyName("name")] public string? Name { get; set; } /// Repository identifier in 'owner/repo' or 'org/project/repo' format, if any. [JsonPropertyName("repository")] public string? Repository { get; set; } /// ISO 8601 timestamp when the workspace was last updated. [JsonPropertyName("updated_at")] public DateTimeOffset? UpdatedAt { get; set; } } /// Point-in-time snapshot of slow-changing session identifier and state fields. [Experimental(Diagnostics.Experimental)] public sealed class SessionMetadataSnapshot { /// True when the session was detected to be in use by another process at construction time. Local consumers may surface a confirmation prompt before fully attaching. Always false for new sessions. [JsonPropertyName("alreadyInUse")] public bool AlreadyInUse { get; set; } /// The current agent mode for this session (e.g., 'interactive', 'plan', 'autopilot'). [JsonPropertyName("currentMode")] public MetadataSnapshotCurrentMode CurrentMode { get; set; } /// User-provided name supplied at session construction (via `--name`), if any. Immutable after construction. [JsonPropertyName("initialName")] public string? InitialName { get; set; } /// Whether this is a remote session (i.e., one whose runtime executes elsewhere and is steered through this process). [JsonPropertyName("isRemote")] public bool IsRemote { get; set; } /// ISO 8601 timestamp of when the session's persisted state was last modified on disk. For new sessions, equals startTime. For resumed sessions, reflects the previous modification time at construction. [JsonPropertyName("modifiedTime")] public DateTimeOffset ModifiedTime { get; set; } /// Remote-session-specific metadata. Populated only when `isRemote` is true. Fields are immutable for the lifetime of the session. [JsonPropertyName("remoteMetadata")] public MetadataSnapshotRemoteMetadata? RemoteMetadata { get; set; } /// Currently selected model identifier, if any. [JsonPropertyName("selectedModel")] public string? SelectedModel { get; set; } /// The unique identifier of the session. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; /// ISO 8601 timestamp of when the session started. [JsonPropertyName("startTime")] public DateTimeOffset StartTime { get; set; } /// Short human-readable summary of the session, if known. Omitted when no summary has been generated. [JsonPropertyName("summary")] public string? Summary { get; set; } /// Absolute path to the session's current working directory. [JsonPropertyName("workingDirectory")] public string WorkingDirectory { get; set; } = string.Empty; /// Public-facing workspace metadata for this session, or null if the session has no associated workspace. Excludes runtime-internal fields (GitHub IDs, summary count, internal flags). [JsonPropertyName("workspace")] public SessionMetadataSnapshotWorkspace? Workspace { get; set; } /// Absolute path to the session's workspace directory on disk, or null if the session has no associated workspace. [JsonPropertyName("workspacePath")] public string? WorkspacePath { get; set; } } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionMetadataSnapshotRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Indicates whether the local session is currently processing a turn or background continuation. [Experimental(Diagnostics.Experimental)] public sealed class MetadataIsProcessingResult { /// Whether the session is currently processing user/agent messages. False for non-local sessions (which don't run a local agentic loop). Reflects an in-flight turn or background continuation. [JsonPropertyName("processing")] public bool Processing { get; set; } } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionMetadataIsProcessingRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Token-usage breakdown for the session's current context window. public sealed class MetadataContextInfoResultContextInfo { /// Output reserve plus tokens after the buffer-exhaustion blocking threshold (default 95%). [JsonPropertyName("bufferTokens")] public long BufferTokens { get; set; } /// Token count at which background compaction starts (configurable percentage of promptTokenLimit). [JsonPropertyName("compactionThreshold")] public long CompactionThreshold { get; set; } /// Tokens consumed by user/assistant/tool messages. [JsonPropertyName("conversationTokens")] public long ConversationTokens { get; set; } /// Total context limit for /context display. promptTokenLimit + min(32k or 64k, outputTokenLimit) depending on model. [JsonPropertyName("limit")] public long Limit { get; set; } /// The model used for token counting. [JsonPropertyName("modelName")] public string ModelName { get; set; } = string.Empty; /// Maximum prompt tokens allowed by the model (or DEFAULT_TOKEN_LIMIT if unspecified). [JsonPropertyName("promptTokenLimit")] public long PromptTokenLimit { get; set; } /// Tokens consumed by the system prompt. [JsonPropertyName("systemTokens")] public long SystemTokens { get; set; } /// Tokens consumed by tool definitions sent to the model (excludes deferred tools). [JsonPropertyName("toolDefinitionsTokens")] public long ToolDefinitionsTokens { get; set; } /// Sum of system, conversation and tool-definition tokens. [JsonPropertyName("totalTokens")] public long TotalTokens { get; set; } } /// Token breakdown for the session's current context window, or null if uninitialized. [Experimental(Diagnostics.Experimental)] public sealed class MetadataContextInfoResult { /// Token breakdown for the current context window, or null if the session has not yet been initialized (no system prompt or tool metadata cached). [JsonPropertyName("contextInfo")] public MetadataContextInfoResultContextInfo? ContextInfo { get; set; } } /// Model identifier and token limits used to compute the context-info breakdown. [Experimental(Diagnostics.Experimental)] internal sealed class MetadataContextInfoRequest { /// Maximum output tokens allowed by the target model. Pass 0 if unknown. [JsonPropertyName("outputTokenLimit")] public long OutputTokenLimit { get; set; } /// Maximum prompt tokens allowed by the target model. Pass 0 to use the runtime default. [JsonPropertyName("promptTokenLimit")] public long PromptTokenLimit { get; set; } /// Model identifier used for tokenization. Omit to use the session default. Used both for token counting and to compute display values. [JsonPropertyName("selectedModel")] public string? SelectedModel { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Notify the session that its working directory context has changed. Emits a `session.context_changed` event so consumers (telemetry, OTel tracker, ACP, the timeline UI) can react. Use this when the host has detected a cwd/branch/repo change outside the session's normal lifecycle (e.g., after a shell command in interactive mode). [Experimental(Diagnostics.Experimental)] public sealed class MetadataRecordContextChangeResult { } /// Updated working directory and git context. Emitted as the new payload of `session.context_changed`. [Experimental(Diagnostics.Experimental)] public sealed class SessionWorkingDirectoryContext { /// Merge-base commit SHA (fork point from the remote default branch). [JsonPropertyName("baseCommit")] public string? BaseCommit { get; set; } /// Current git branch name. [JsonPropertyName("branch")] public string? Branch { get; set; } /// Current working directory path. [JsonPropertyName("cwd")] public string Cwd { get; set; } = string.Empty; /// Root directory of the git repository, resolved via git rev-parse. [JsonPropertyName("gitRoot")] public string? GitRoot { get; set; } /// Head commit of the current git branch. [JsonPropertyName("headCommit")] public string? HeadCommit { get; set; } /// Hosting platform type of the repository. [JsonPropertyName("hostType")] public SessionWorkingDirectoryContextHostType? HostType { get; set; } /// Repository identifier derived from the git remote URL ("owner/name" for GitHub, "org/project/repo" for Azure DevOps). [JsonPropertyName("repository")] public string? Repository { get; set; } /// Raw host string from the git remote URL (e.g. "github.com", "dev.azure.com"). [JsonPropertyName("repositoryHost")] public string? RepositoryHost { get; set; } } /// Updated working-directory/git context to record on the session. [Experimental(Diagnostics.Experimental)] internal sealed class MetadataRecordContextChangeRequest { /// Updated working directory and git context. Emitted as the new payload of `session.context_changed`. [JsonPropertyName("context")] public SessionWorkingDirectoryContext Context { get => field ??= new(); set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Update the session's working directory. Used by the host when the user explicitly changes cwd (e.g., the `/cd` slash command). The host is responsible for `process.chdir` and any related side-effects (file index, etc.); this method only updates the session's own recorded path. [Experimental(Diagnostics.Experimental)] public sealed class MetadataSetWorkingDirectoryResult { /// Working directory after the update. [JsonPropertyName("workingDirectory")] public string WorkingDirectory { get; set; } = string.Empty; } /// Absolute path to set as the session's new working directory. [Experimental(Diagnostics.Experimental)] internal sealed class MetadataSetWorkingDirectoryRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; /// Absolute path to set as the session's working directory. The runtime updates the session's recorded cwd so subsequent operations (shell tools, file lookups, telemetry) anchor to it. [JsonPropertyName("workingDirectory")] public string WorkingDirectory { get; set; } = string.Empty; } /// Re-tokenize the session's existing messages against `modelId` and return the token totals. Useful for hosts that want an initial estimate of context usage on session resume, before the next agent turn fires `session.context_info_changed` events. Returns zeros for an empty session. [Experimental(Diagnostics.Experimental)] public sealed class MetadataRecomputeContextTokensResult { /// Tokens contributed by user/assistant/tool messages (excludes system/developer prompts). [JsonPropertyName("messagesTokenCount")] public long MessagesTokenCount { get; set; } /// Tokens contributed by system/developer prompt snapshots. [JsonPropertyName("systemTokenCount")] public long SystemTokenCount { get; set; } /// Sum of tokens across chat-context and system-context messages currently held by the session. [JsonPropertyName("totalTokens")] public long TotalTokens { get; set; } } /// Model identifier to use when re-tokenizing the session's existing messages. [Experimental(Diagnostics.Experimental)] internal sealed class MetadataRecomputeContextTokensRequest { /// Model identifier used for tokenization. The runtime token-counts both chat-context and system-context messages against this model. [JsonPropertyName("modelId")] public string ModelId { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Identifier of the spawned process, used to correlate streamed output and exit notifications. [Experimental(Diagnostics.Experimental)] public sealed class ShellExecResult { /// Unique identifier for tracking streamed output. [JsonPropertyName("processId")] public string ProcessId { get; set; } = string.Empty; } /// Shell command to run, with optional working directory and timeout in milliseconds. [Experimental(Diagnostics.Experimental)] internal sealed class ShellExecRequest { /// Shell command to execute. [JsonPropertyName("command")] public string Command { get; set; } = string.Empty; /// Working directory (defaults to session working directory). [JsonPropertyName("cwd")] public string? Cwd { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; /// Timeout in milliseconds (default: 30000). [JsonConverter(typeof(MillisecondsTimeSpanConverter))] [JsonPropertyName("timeout")] public TimeSpan? Timeout { get; set; } } /// Indicates whether the signal was delivered; false if the process was unknown or already exited. [Experimental(Diagnostics.Experimental)] public sealed class ShellKillResult { /// Whether the signal was sent successfully. [JsonPropertyName("killed")] public bool Killed { get; set; } } /// Identifier of a process previously returned by "shell.exec" and the signal to send. [Experimental(Diagnostics.Experimental)] internal sealed class ShellKillRequest { /// Process identifier returned by shell.exec. [JsonPropertyName("processId")] public string ProcessId { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; /// Signal to send (default: SIGTERM). [JsonPropertyName("signal")] public ShellKillSignal? Signal { get; set; } } /// Post-compaction context window usage breakdown. [Experimental(Diagnostics.Experimental)] public sealed class HistoryCompactContextWindow { /// Token count from non-system messages (user, assistant, tool). [JsonPropertyName("conversationTokens")] public long? ConversationTokens { get; set; } /// Current total tokens in the context window (system + conversation + tool definitions). [JsonPropertyName("currentTokens")] public long CurrentTokens { get; set; } /// Current number of messages in the conversation. [JsonPropertyName("messagesLength")] public long MessagesLength { get; set; } /// Token count from system message(s). [JsonPropertyName("systemTokens")] public long? SystemTokens { get; set; } /// Maximum token count for the model's context window. [JsonPropertyName("tokenLimit")] public long TokenLimit { get; set; } /// Token count from tool definitions. [JsonPropertyName("toolDefinitionsTokens")] public long? ToolDefinitionsTokens { get; set; } } /// Compaction outcome with the number of tokens and messages removed, summary text, and the resulting context window breakdown. [Experimental(Diagnostics.Experimental)] public sealed class HistoryCompactResult { /// Post-compaction context window usage breakdown. [JsonPropertyName("contextWindow")] public HistoryCompactContextWindow? ContextWindow { get; set; } /// Number of messages removed during compaction. [JsonPropertyName("messagesRemoved")] public long MessagesRemoved { get; set; } /// Whether compaction completed successfully. [JsonPropertyName("success")] public bool Success { get; set; } /// Summary text produced by compaction. Omitted when compaction did not produce a summary (e.g. failure path). [JsonPropertyName("summaryContent")] public string? SummaryContent { get; set; } /// Number of tokens freed by compaction. [JsonPropertyName("tokensRemoved")] public long TokensRemoved { get; set; } } /// Optional compaction parameters. [Experimental(Diagnostics.Experimental)] public sealed class HistoryCompactRequest { /// Optional user-provided instructions to focus the compaction summary. [UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "Safe for generated string properties: JSON Schema minLength/maxLength map to string length validation, not reflection over trimmed Count members")] [MaxLength(4000)] [JsonPropertyName("customInstructions")] public string? CustomInstructions { get; set; } } /// Optional compaction parameters. [Experimental(Diagnostics.Experimental)] internal sealed class HistoryCompactRequestWithSession { /// Optional user-provided instructions to focus the compaction summary. [UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "Safe for generated string properties: JSON Schema minLength/maxLength map to string length validation, not reflection over trimmed Count members")] [MaxLength(4000)] [JsonPropertyName("customInstructions")] public string? CustomInstructions { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Number of events that were removed by the truncation. [Experimental(Diagnostics.Experimental)] public sealed class HistoryTruncateResult { /// Number of events that were removed. [JsonPropertyName("eventsRemoved")] public long EventsRemoved { get; set; } } /// Identifier of the event to truncate to; this event and all later events are removed. [Experimental(Diagnostics.Experimental)] internal sealed class HistoryTruncateRequest { /// Event ID to truncate to. This event and all events after it are removed from the session. [JsonPropertyName("eventId")] public string EventId { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Indicates whether an in-progress background compaction was cancelled. [Experimental(Diagnostics.Experimental)] public sealed class HistoryCancelBackgroundCompactionResult { /// Whether an in-progress background compaction was cancelled. False when no compaction was running, when the session is remote, or when the underlying processor was unavailable. [JsonPropertyName("cancelled")] public bool Cancelled { get; set; } } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionHistoryCancelBackgroundCompactionRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Indicates whether an in-progress manual compaction was aborted. [Experimental(Diagnostics.Experimental)] public sealed class HistoryAbortManualCompactionResult { /// Whether an in-progress manual compaction was aborted. False when no manual compaction was running, when its abort controller was already aborted, or when the session is remote. [JsonPropertyName("aborted")] public bool Aborted { get; set; } } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionHistoryAbortManualCompactionRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Markdown summary of the conversation context (empty when not available). [Experimental(Diagnostics.Experimental)] public sealed class HistorySummarizeForHandoffResult { /// Markdown summary of the conversation context produced by an LLM. Empty string when there are no messages or when the session does not support local summarization. [JsonPropertyName("summary")] public string Summary { get; set; } = string.Empty; } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionHistorySummarizeForHandoffRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Schema for the `QueuePendingItems` type. [Experimental(Diagnostics.Experimental)] public sealed class QueuePendingItems { /// Human-readable text to display for this queue entry in the UI. [JsonPropertyName("displayText")] public string DisplayText { get; set; } = string.Empty; /// Whether this item is a queued user message or a queued slash command / model change. [JsonPropertyName("kind")] public QueuePendingItemsKind Kind { get; set; } } /// Snapshot of the session's pending queued items and immediate-steering messages. [Experimental(Diagnostics.Experimental)] public sealed class QueuePendingItemsResult { /// Pending queued items in submission order. Includes user messages, queued slash commands, and queued model changes; omits internal system items. [JsonPropertyName("items")] public IList Items { get => field ??= []; set; } /// Display text for messages currently in the immediate steering queue (interjections sent during a running turn). [JsonPropertyName("steeringMessages")] public IList SteeringMessages { get => field ??= []; set; } } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionQueuePendingItemsRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Indicates whether a user-facing pending item was removed. [Experimental(Diagnostics.Experimental)] public sealed class QueueRemoveMostRecentResult { /// True if a user-facing pending item was removed (LIFO across both queues); false when no removable items remained. [JsonPropertyName("removed")] public bool Removed { get; set; } } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionQueueRemoveMostRecentRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionQueueClearRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Batch of session events returned by a read, with cursor and continuation metadata. [Experimental(Diagnostics.Experimental)] public sealed class EventsReadResult { /// Opaque cursor for the next read. Pass back unchanged in the next read.cursor to continue from where this read left off. Always present, even when no events were returned. [JsonPropertyName("cursor")] public string Cursor { get; set; } = string.Empty; /// Cursor status: 'ok' means the cursor was applied successfully; 'expired' means the cursor referred to an event that no longer exists in history (e.g. truncated or compacted away) and the read started from the beginning of the remaining history. [JsonPropertyName("cursorStatus")] public EventsCursorStatus CursorStatus { get; set; } /// Events are delivered in two batches per read: persisted events first (in append order), then ephemeral events (in seq order). When `waitMs > 0` and the catch-up batches were empty, post-wait events follow the same two-batch ordering. Persisted and ephemeral events do not interleave within a single read. [JsonPropertyName("events")] public IList Events { get => field ??= []; set; } /// True when the read returned `max` events and more events are available immediately. When false, the next read with a non-zero `waitMs` will block until a new event arrives or the wait expires. [JsonPropertyName("hasMore")] public bool HasMore { get; set; } } /// Cursor, batch size, and optional long-poll/filter parameters for reading session events. [Experimental(Diagnostics.Experimental)] internal sealed class EventLogReadRequest { /// Agent-scope filter: 'primary' returns only main-agent events plus events whose type starts with 'subagent.' (matching the typed-subscription default behavior); 'all' returns events from all agents (matching wildcard-subscription behavior). Default is 'all' to preserve wildcard semantics for catch-up callers. [JsonPropertyName("agentScope")] public EventsAgentScope? AgentScope { get; set; } /// Opaque cursor returned by a previous read. Omit on the first call to start from the beginning of the session's persisted history. [JsonPropertyName("cursor")] public string? Cursor { get; set; } /// Maximum number of events to return in this batch (1–1000, default 200). [JsonPropertyName("max")] public int? Max { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; /// Either '*' to receive all event types, or a non-empty list of event types to receive. [JsonPropertyName("types")] public JsonElement? Types { get; set; } /// Milliseconds to wait for new events when the cursor is at the tail of history. 0 (default) returns immediately even if no events are available. Capped at 30000ms. Ephemeral events that arrive during the wait are delivered in this batch but are NOT replayable on a subsequent read (use a non-zero waitMs in your next call to capture future ephemerals as they happen). [JsonConverter(typeof(MillisecondsTimeSpanConverter))] [JsonPropertyName("waitMs")] public TimeSpan? Wait { get; set; } } /// Snapshot of the current tail cursor without returning any events. Use this when a consumer wants to subscribe to live events going forward without first paginating through the entire persisted history (which would happen if `read` were called without a cursor on a long-lived session). [Experimental(Diagnostics.Experimental)] public sealed class EventLogTailResult { /// Opaque cursor pointing at the current tail of the session's persisted-events history. Pass back to `read` to receive only events that arrive AFTER this snapshot. When the session has no events, this returns the same sentinel as an unset cursor (i.e. equivalent to omitting the cursor on a first read). [JsonPropertyName("cursor")] public string Cursor { get; set; } = string.Empty; } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionEventLogTailRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Opaque handle representing an event-type interest registration. [Experimental(Diagnostics.Experimental)] public sealed class RegisterEventInterestResult { /// Opaque handle for this registration. Pass to releaseInterest to release. Each call to registerInterest produces a fresh handle, even when the same eventType is registered multiple times. [JsonPropertyName("handle")] public string Handle { get; set; } = string.Empty; } /// Event type to register consumer interest for, used by runtime gating logic. [Experimental(Diagnostics.Experimental)] internal sealed class RegisterEventInterestParams { /// The event type the consumer wants the runtime to treat as 'observed' for behavior-switching gating. Some runtime code paths inspect whether any consumer is interested in a specific event type and choose a different implementation accordingly (e.g. `mcp.oauth_required`: when interest is registered the runtime delegates the full interactive OAuth flow to the consumer; when no interest is registered the runtime installs a browserless fallback that silently reuses cached tokens). SDK clients that long-poll events do NOT automatically appear as listeners to these gating checks — they must explicitly call `registerInterest` for each event type they want the runtime to count as having a consumer. Multiple registrations for the same event type from the same or different consumers are tracked independently and must each be released. See: `mcp.oauth_required`, `sampling.requested`, `auto_mode_switch.requested`, `user_input.requested`, `elicitation.requested`, `command.queued`, `exit_plan_mode.requested`. [JsonPropertyName("eventType")] public string EventType { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Indicates whether the operation succeeded. [Experimental(Diagnostics.Experimental)] public sealed class EventLogReleaseInterestResult { /// Whether the operation succeeded. [JsonPropertyName("success")] public bool Success { get; set; } } /// Opaque handle previously returned by `registerInterest` to release. [Experimental(Diagnostics.Experimental)] internal sealed class ReleaseEventInterestParams { /// Handle returned by a previous `registerInterest` call. Idempotent: releasing an unknown or already-released handle is a no-op (returns success). When the last outstanding handle for an event type is released, the runtime reverts to its 'no consumer' code path for that event type. [JsonPropertyName("handle")] public string Handle { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Aggregated code change metrics. [Experimental(Diagnostics.Experimental)] public sealed class UsageMetricsCodeChanges { /// Distinct file paths modified during the session. [JsonPropertyName("filesModified")] public IList FilesModified { get => field ??= []; set; } /// Number of distinct files modified. [JsonPropertyName("filesModifiedCount")] public long FilesModifiedCount { get; set; } /// Total lines of code added. [JsonPropertyName("linesAdded")] public long LinesAdded { get; set; } /// Total lines of code removed. [JsonPropertyName("linesRemoved")] public long LinesRemoved { get; set; } } /// Request count and cost metrics for this model. [Experimental(Diagnostics.Experimental)] public sealed class UsageMetricsModelMetricRequests { /// User-initiated premium request cost (with multiplier applied). [JsonPropertyName("cost")] public double Cost { get; set; } /// Number of API requests made with this model. [JsonPropertyName("count")] public long Count { get; set; } } /// Schema for the `UsageMetricsModelMetricTokenDetail` type. [Experimental(Diagnostics.Experimental)] public sealed class UsageMetricsModelMetricTokenDetail { /// Accumulated token count for this token type. [JsonPropertyName("tokenCount")] public long TokenCount { get; set; } } /// Token usage metrics for this model. [Experimental(Diagnostics.Experimental)] public sealed class UsageMetricsModelMetricUsage { /// Total tokens read from prompt cache. [JsonPropertyName("cacheReadTokens")] public long CacheReadTokens { get; set; } /// Total tokens written to prompt cache. [JsonPropertyName("cacheWriteTokens")] public long CacheWriteTokens { get; set; } /// Total input tokens consumed. [JsonPropertyName("inputTokens")] public long InputTokens { get; set; } /// Total output tokens produced. [JsonPropertyName("outputTokens")] public long OutputTokens { get; set; } /// Total output tokens used for reasoning. [JsonPropertyName("reasoningTokens")] public long? ReasoningTokens { get; set; } } /// Schema for the `UsageMetricsModelMetric` type. [Experimental(Diagnostics.Experimental)] public sealed class UsageMetricsModelMetric { /// Request count and cost metrics for this model. [JsonPropertyName("requests")] public UsageMetricsModelMetricRequests Requests { get => field ??= new(); set; } /// Token count details per type. [JsonPropertyName("tokenDetails")] public IDictionary? TokenDetails { get; set; } /// Accumulated nano-AI units cost for this model. [JsonPropertyName("totalNanoAiu")] public double? TotalNanoAiu { get; set; } /// Token usage metrics for this model. [JsonPropertyName("usage")] public UsageMetricsModelMetricUsage Usage { get => field ??= new(); set; } } /// Schema for the `UsageMetricsTokenDetail` type. [Experimental(Diagnostics.Experimental)] public sealed class UsageMetricsTokenDetail { /// Accumulated token count for this token type. [JsonPropertyName("tokenCount")] public long TokenCount { get; set; } } /// Accumulated session usage metrics, including premium request cost, token counts, model breakdown, and code-change totals. [Experimental(Diagnostics.Experimental)] public sealed class UsageGetMetricsResult { /// Aggregated code change metrics. [JsonPropertyName("codeChanges")] public UsageMetricsCodeChanges CodeChanges { get => field ??= new(); set; } /// Currently active model identifier. [JsonPropertyName("currentModel")] public string? CurrentModel { get; set; } /// Input tokens from the most recent main-agent API call. [JsonPropertyName("lastCallInputTokens")] public long LastCallInputTokens { get; set; } /// Output tokens from the most recent main-agent API call. [JsonPropertyName("lastCallOutputTokens")] public long LastCallOutputTokens { get; set; } /// Per-model token and request metrics, keyed by model identifier. [JsonPropertyName("modelMetrics")] public IDictionary ModelMetrics { get => field ??= new Dictionary(); set; } /// ISO 8601 timestamp when the session started. [JsonPropertyName("sessionStartTime")] public DateTimeOffset SessionStartTime { get; set; } /// Session-wide per-token-type accumulated token counts. [JsonPropertyName("tokenDetails")] public IDictionary? TokenDetails { get; set; } /// Total time spent in model API calls (milliseconds). [JsonConverter(typeof(MillisecondsTimeSpanConverter))] [JsonPropertyName("totalApiDurationMs")] public TimeSpan TotalApiDuration { get; set; } /// Session-wide accumulated nano-AI units cost. [JsonPropertyName("totalNanoAiu")] public double? TotalNanoAiu { get; set; } /// Total user-initiated premium request cost across all models (may be fractional due to multipliers). [JsonPropertyName("totalPremiumRequestCost")] public double TotalPremiumRequestCost { get; set; } /// Raw count of user-initiated API requests. [JsonPropertyName("totalUserRequests")] public long TotalUserRequests { get; set; } } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionUsageGetMetricsRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// GitHub URL for the session and a flag indicating whether remote steering is enabled. [Experimental(Diagnostics.Experimental)] public sealed class RemoteEnableResult { /// Whether remote steering is enabled. [JsonPropertyName("remoteSteerable")] public bool RemoteSteerable { get; set; } /// GitHub frontend URL for this session. [Url] [StringSyntax(StringSyntaxAttribute.Uri)] [JsonPropertyName("url")] public string? Url { get; set; } } /// Optional remote session mode ("off", "export", or "on"); defaults to enabling both export and remote steering. [Experimental(Diagnostics.Experimental)] internal sealed class RemoteEnableRequest { /// Per-session remote mode. "off" disables remote, "export" exports session events to GitHub without enabling remote steering, "on" enables both export and remote steering. [JsonPropertyName("mode")] public RemoteSessionMode? Mode { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionRemoteDisableRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Persist a steerability change as a `session.remote_steerable_changed` event. Used by the host (CLI / SDK consumer) when it has just finished enabling or disabling steering on a remote exporter that the runtime does not directly own. [Experimental(Diagnostics.Experimental)] public sealed class RemoteNotifySteerableChangedResult { } /// New remote-steerability state to persist as a `session.remote_steerable_changed` event. [Experimental(Diagnostics.Experimental)] internal sealed class RemoteNotifySteerableChangedRequest { /// Whether the session now supports remote steering via GitHub. The runtime persists this as a `session.remote_steerable_changed` event so resume/replay sees the up-to-date capability. [JsonPropertyName("remoteSteerable")] public bool RemoteSteerable { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Schema for the `ScheduleEntry` type. [Experimental(Diagnostics.Experimental)] public sealed class ScheduleEntry { /// Display-only label for the prompt as shown in the UI (e.g. `/skill-name` for a skill-invocation schedule). The actual enqueued prompt is `prompt`. [JsonPropertyName("displayPrompt")] public string? DisplayPrompt { get; set; } /// Sequential id assigned by the runtime within the session. Stable across resumes (rebuilt from the event log). [JsonPropertyName("id")] public long Id { get; set; } /// Interval between scheduled ticks, in milliseconds. [JsonConverter(typeof(MillisecondsTimeSpanConverter))] [JsonPropertyName("intervalMs")] public TimeSpan Interval { get; set; } /// ISO 8601 timestamp when the next tick is scheduled to fire. [JsonPropertyName("nextRunAt")] public DateTimeOffset NextRunAt { get; set; } /// Prompt text that gets enqueued on every tick. [JsonPropertyName("prompt")] public string Prompt { get; set; } = string.Empty; /// Whether the schedule re-arms after each tick (`/every`) or fires once (`/after`). [JsonPropertyName("recurring")] public bool Recurring { get; set; } } /// Snapshot of the currently active recurring prompts for this session. [Experimental(Diagnostics.Experimental)] public sealed class ScheduleList { /// Active scheduled prompts, ordered by id. [JsonPropertyName("entries")] public IList Entries { get => field ??= []; set; } } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionScheduleListRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Remove a scheduled prompt by id. The result entry is omitted if the id was unknown. [Experimental(Diagnostics.Experimental)] public sealed class ScheduleStopResult { /// The removed entry, or omitted if no entry matched. [JsonPropertyName("entry")] public ScheduleEntry? Entry { get; set; } } /// Identifier of the scheduled prompt to remove. [Experimental(Diagnostics.Experimental)] internal sealed class ScheduleStopRequest { /// Id of the scheduled prompt to remove. [JsonPropertyName("id")] public long Id { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Describes a filesystem error. public sealed class SessionFsError { /// Error classification. [JsonPropertyName("code")] public SessionFsErrorCode Code { get; set; } /// Free-form detail about the error, for logging/diagnostics. [JsonPropertyName("message")] public string? Message { get; set; } } /// File content as a UTF-8 string, or a filesystem error if the read failed. public sealed class SessionFsReadFileResult { /// File content as UTF-8 string. [JsonPropertyName("content")] public string Content { get; set; } = string.Empty; /// Describes a filesystem error. [JsonPropertyName("error")] public SessionFsError? Error { get; set; } } /// Path of the file to read from the client-provided session filesystem. public sealed class SessionFsReadFileRequest { /// Path using SessionFs conventions. [JsonPropertyName("path")] public string Path { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// File path, content to write, and optional mode for the client-provided session filesystem. public sealed class SessionFsWriteFileRequest { /// Content to write. [JsonPropertyName("content")] public string Content { get; set; } = string.Empty; /// Optional POSIX-style mode for newly created files. [JsonPropertyName("mode")] public long? Mode { get; set; } /// Path using SessionFs conventions. [JsonPropertyName("path")] public string Path { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// File path, content to append, and optional mode for the client-provided session filesystem. public sealed class SessionFsAppendFileRequest { /// Content to append. [JsonPropertyName("content")] public string Content { get; set; } = string.Empty; /// Optional POSIX-style mode for newly created files. [JsonPropertyName("mode")] public long? Mode { get; set; } /// Path using SessionFs conventions. [JsonPropertyName("path")] public string Path { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Indicates whether the requested path exists in the client-provided session filesystem. public sealed class SessionFsExistsResult { /// Whether the path exists. [JsonPropertyName("exists")] public bool Exists { get; set; } } /// Path to test for existence in the client-provided session filesystem. public sealed class SessionFsExistsRequest { /// Path using SessionFs conventions. [JsonPropertyName("path")] public string Path { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Filesystem metadata for the requested path, or a filesystem error if the stat failed. public sealed class SessionFsStatResult { /// ISO 8601 timestamp of creation. [JsonPropertyName("birthtime")] public DateTimeOffset Birthtime { get; set; } /// Describes a filesystem error. [JsonPropertyName("error")] public SessionFsError? Error { get; set; } /// Whether the path is a directory. [JsonPropertyName("isDirectory")] public bool IsDirectory { get; set; } /// Whether the path is a file. [JsonPropertyName("isFile")] public bool IsFile { get; set; } /// ISO 8601 timestamp of last modification. [JsonPropertyName("mtime")] public DateTimeOffset Mtime { get; set; } /// File size in bytes. [JsonPropertyName("size")] public long Size { get; set; } } /// Path whose metadata should be returned from the client-provided session filesystem. public sealed class SessionFsStatRequest { /// Path using SessionFs conventions. [JsonPropertyName("path")] public string Path { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Directory path to create in the client-provided session filesystem, with options for recursive creation and POSIX mode. public sealed class SessionFsMkdirRequest { /// Optional POSIX-style mode for newly created directories. [JsonPropertyName("mode")] public long? Mode { get; set; } /// Path using SessionFs conventions. [JsonPropertyName("path")] public string Path { get; set; } = string.Empty; /// Create parent directories as needed. [JsonPropertyName("recursive")] public bool? Recursive { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Names of entries in the requested directory, or a filesystem error if the read failed. public sealed class SessionFsReaddirResult { /// Entry names in the directory. [JsonPropertyName("entries")] public IList Entries { get => field ??= []; set; } /// Describes a filesystem error. [JsonPropertyName("error")] public SessionFsError? Error { get; set; } } /// Directory path whose entries should be listed from the client-provided session filesystem. public sealed class SessionFsReaddirRequest { /// Path using SessionFs conventions. [JsonPropertyName("path")] public string Path { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Schema for the `SessionFsReaddirWithTypesEntry` type. public sealed class SessionFsReaddirWithTypesEntry { /// Entry name. [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; /// Entry type. [JsonPropertyName("type")] public SessionFsReaddirWithTypesEntryType Type { get; set; } } /// Entries in the requested directory paired with file/directory type information, or a filesystem error if the read failed. public sealed class SessionFsReaddirWithTypesResult { /// Directory entries with type information. [JsonPropertyName("entries")] public IList Entries { get => field ??= []; set; } /// Describes a filesystem error. [JsonPropertyName("error")] public SessionFsError? Error { get; set; } } /// Directory path whose entries (with type information) should be listed from the client-provided session filesystem. public sealed class SessionFsReaddirWithTypesRequest { /// Path using SessionFs conventions. [JsonPropertyName("path")] public string Path { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Path to remove from the client-provided session filesystem, with options for recursive removal and force. public sealed class SessionFsRmRequest { /// Ignore errors if the path does not exist. [JsonPropertyName("force")] public bool? Force { get; set; } /// Path using SessionFs conventions. [JsonPropertyName("path")] public string Path { get; set; } = string.Empty; /// Remove directories and their contents recursively. [JsonPropertyName("recursive")] public bool? Recursive { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Source and destination paths for renaming or moving an entry in the client-provided session filesystem. public sealed class SessionFsRenameRequest { /// Destination path using SessionFs conventions. [JsonPropertyName("dest")] public string Dest { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; /// Source path using SessionFs conventions. [JsonPropertyName("src")] public string Src { get; set; } = string.Empty; } /// Query results including rows, columns, and rows affected, or a filesystem error if execution failed. public sealed class SessionFsSqliteQueryResult { /// Column names from the result set. [JsonPropertyName("columns")] public IList Columns { get => field ??= []; set; } /// Describes a filesystem error. [JsonPropertyName("error")] public SessionFsError? Error { get; set; } /// SQLite last_insert_rowid() value for INSERT. [JsonPropertyName("lastInsertRowid")] public long? LastInsertRowid { get; set; } /// For SELECT: array of row objects. For others: empty array. [JsonPropertyName("rows")] public IList> Rows { get => field ??= []; set; } /// Number of rows affected (for INSERT/UPDATE/DELETE). [JsonPropertyName("rowsAffected")] public long RowsAffected { get; set; } } /// SQL query, query type, and optional bind parameters for executing a SQLite query against the per-session database. public sealed class SessionFsSqliteQueryRequest { /// Optional named bind parameters. [JsonPropertyName("params")] public IDictionary? Params { get; set; } /// SQL query to execute. [JsonPropertyName("query")] public string Query { get; set; } = string.Empty; /// How to execute the query: 'exec' for DDL/multi-statement (no results), 'query' for SELECT (returns rows), 'run' for INSERT/UPDATE/DELETE (returns rowsAffected). [JsonPropertyName("queryType")] public SessionFsSqliteQueryType QueryType { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Indicates whether the per-session SQLite database already exists. public sealed class SessionFsSqliteExistsResult { /// Whether the session database already exists. [JsonPropertyName("exists")] public bool Exists { get; set; } } /// Identifies the target session. public sealed class SessionFsSqliteExistsRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Model capability category for grouping in the model picker. [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct ModelPickerCategory : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public ModelPickerCategory(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Lightweight model category optimized for faster, lower-cost interactions. public static ModelPickerCategory Lightweight { get; } = new("lightweight"); /// Versatile model category suitable for a broad range of tasks. public static ModelPickerCategory Versatile { get; } = new("versatile"); /// Powerful model category optimized for complex tasks. public static ModelPickerCategory Powerful { get; } = new("powerful"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(ModelPickerCategory left, ModelPickerCategory right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(ModelPickerCategory left, ModelPickerCategory right) => !(left == right); /// public override bool Equals(object? obj) => obj is ModelPickerCategory other && Equals(other); /// public bool Equals(ModelPickerCategory other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); /// public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); /// public override string ToString() => Value; /// Provides a for serializing instances. [EditorBrowsable(EditorBrowsableState.Never)] public sealed class Converter : JsonConverter { /// public override ModelPickerCategory Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, ModelPickerCategory value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(ModelPickerCategory)); } } } /// Relative cost tier for token-based billing users. [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct ModelPickerPriceCategory : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public ModelPickerPriceCategory(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Lowest relative token cost tier. public static ModelPickerPriceCategory Low { get; } = new("low"); /// Medium relative token cost tier. public static ModelPickerPriceCategory Medium { get; } = new("medium"); /// High relative token cost tier. public static ModelPickerPriceCategory High { get; } = new("high"); /// Highest relative token cost tier. public static ModelPickerPriceCategory VeryHigh { get; } = new("very_high"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(ModelPickerPriceCategory left, ModelPickerPriceCategory right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(ModelPickerPriceCategory left, ModelPickerPriceCategory right) => !(left == right); /// public override bool Equals(object? obj) => obj is ModelPickerPriceCategory other && Equals(other); /// public bool Equals(ModelPickerPriceCategory other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); /// public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); /// public override string ToString() => Value; /// Provides a for serializing instances. [EditorBrowsable(EditorBrowsableState.Never)] public sealed class Converter : JsonConverter { /// public override ModelPickerPriceCategory Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, ModelPickerPriceCategory value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(ModelPickerPriceCategory)); } } } /// Current policy state for this model. [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct ModelPolicyState : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public ModelPolicyState(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// The model is enabled by policy. public static ModelPolicyState Enabled { get; } = new("enabled"); /// The model is disabled by policy. public static ModelPolicyState Disabled { get; } = new("disabled"); /// No explicit policy is configured for the model. public static ModelPolicyState Unconfigured { get; } = new("unconfigured"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(ModelPolicyState left, ModelPolicyState right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(ModelPolicyState left, ModelPolicyState right) => !(left == right); /// public override bool Equals(object? obj) => obj is ModelPolicyState other && Equals(other); /// public bool Equals(ModelPolicyState other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); /// public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); /// public override string ToString() => Value; /// Provides a for serializing instances. [EditorBrowsable(EditorBrowsableState.Never)] public sealed class Converter : JsonConverter { /// public override ModelPolicyState Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, ModelPolicyState value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(ModelPolicyState)); } } } /// Server transport type: stdio, http, sse, or memory. [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct DiscoveredMcpServerType : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public DiscoveredMcpServerType(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Server communicates over stdio with a local child process. public static DiscoveredMcpServerType Stdio { get; } = new("stdio"); /// Server communicates over streamable HTTP. public static DiscoveredMcpServerType Http { get; } = new("http"); /// Server communicates over Server-Sent Events. public static DiscoveredMcpServerType Sse { get; } = new("sse"); /// Server is backed by an in-memory runtime implementation. public static DiscoveredMcpServerType Memory { get; } = new("memory"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(DiscoveredMcpServerType left, DiscoveredMcpServerType right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(DiscoveredMcpServerType left, DiscoveredMcpServerType right) => !(left == right); /// public override bool Equals(object? obj) => obj is DiscoveredMcpServerType other && Equals(other); /// public bool Equals(DiscoveredMcpServerType other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); /// public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); /// public override string ToString() => Value; /// Provides a for serializing instances. [EditorBrowsable(EditorBrowsableState.Never)] public sealed class Converter : JsonConverter { /// public override DiscoveredMcpServerType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, DiscoveredMcpServerType value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(DiscoveredMcpServerType)); } } } /// Path conventions used by this filesystem. [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct SessionFsSetProviderConventions : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public SessionFsSetProviderConventions(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Paths use Windows path conventions. public static SessionFsSetProviderConventions Windows { get; } = new("windows"); /// Paths use POSIX path conventions. public static SessionFsSetProviderConventions Posix { get; } = new("posix"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(SessionFsSetProviderConventions left, SessionFsSetProviderConventions right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(SessionFsSetProviderConventions left, SessionFsSetProviderConventions right) => !(left == right); /// public override bool Equals(object? obj) => obj is SessionFsSetProviderConventions other && Equals(other); /// public bool Equals(SessionFsSetProviderConventions other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); /// public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); /// public override string ToString() => Value; /// Provides a for serializing instances. [EditorBrowsable(EditorBrowsableState.Never)] public sealed class Converter : JsonConverter { /// public override SessionFsSetProviderConventions Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, SessionFsSetProviderConventions value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(SessionFsSetProviderConventions)); } } } /// Neutral SDK discriminator for the connected remote session kind. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct ConnectedRemoteSessionMetadataKind : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public ConnectedRemoteSessionMetadataKind(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Remote CLI session. public static ConnectedRemoteSessionMetadataKind RemoteSession { get; } = new("remote-session"); /// GitHub Copilot coding agent session. public static ConnectedRemoteSessionMetadataKind CodingAgent { get; } = new("coding-agent"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(ConnectedRemoteSessionMetadataKind left, ConnectedRemoteSessionMetadataKind right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(ConnectedRemoteSessionMetadataKind left, ConnectedRemoteSessionMetadataKind right) => !(left == right); /// public override bool Equals(object? obj) => obj is ConnectedRemoteSessionMetadataKind other && Equals(other); /// public bool Equals(ConnectedRemoteSessionMetadataKind other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); /// public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); /// public override string ToString() => Value; /// Provides a for serializing instances. [EditorBrowsable(EditorBrowsableState.Never)] public sealed class Converter : JsonConverter { /// public override ConnectedRemoteSessionMetadataKind Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, ConnectedRemoteSessionMetadataKind value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(ConnectedRemoteSessionMetadataKind)); } } } /// Repository host type. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct SessionContextHostType : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public SessionContextHostType(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Session repository is hosted on GitHub. public static SessionContextHostType Github { get; } = new("github"); /// Session repository is hosted on Azure DevOps. public static SessionContextHostType Ado { get; } = new("ado"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(SessionContextHostType left, SessionContextHostType right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(SessionContextHostType left, SessionContextHostType right) => !(left == right); /// public override bool Equals(object? obj) => obj is SessionContextHostType other && Equals(other); /// public bool Equals(SessionContextHostType other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); /// public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); /// public override string ToString() => Value; /// Provides a for serializing instances. [EditorBrowsable(EditorBrowsableState.Never)] public sealed class Converter : JsonConverter { /// public override SessionContextHostType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, SessionContextHostType value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(SessionContextHostType)); } } } /// The UI mode the agent was in when this message was sent. Defaults to the session's current mode. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct SendAgentMode : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public SendAgentMode(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// The agent is responding interactively to the user. public static SendAgentMode Interactive { get; } = new("interactive"); /// The agent is preparing a plan before making changes. public static SendAgentMode Plan { get; } = new("plan"); /// The agent is working autonomously toward task completion. public static SendAgentMode Autopilot { get; } = new("autopilot"); /// The agent is in shell-focused UI mode. public static SendAgentMode Shell { get; } = new("shell"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(SendAgentMode left, SendAgentMode right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(SendAgentMode left, SendAgentMode right) => !(left == right); /// public override bool Equals(object? obj) => obj is SendAgentMode other && Equals(other); /// public bool Equals(SendAgentMode other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); /// public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); /// public override string ToString() => Value; /// Provides a for serializing instances. [EditorBrowsable(EditorBrowsableState.Never)] public sealed class Converter : JsonConverter { /// public override SendAgentMode Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, SendAgentMode value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(SendAgentMode)); } } } /// Type of GitHub reference. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct SendAttachmentGithubReferenceType : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public SendAttachmentGithubReferenceType(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// GitHub issue reference. public static SendAttachmentGithubReferenceType Issue { get; } = new("issue"); /// GitHub pull request reference. public static SendAttachmentGithubReferenceType Pr { get; } = new("pr"); /// GitHub discussion reference. public static SendAttachmentGithubReferenceType Discussion { get; } = new("discussion"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(SendAttachmentGithubReferenceType left, SendAttachmentGithubReferenceType right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(SendAttachmentGithubReferenceType left, SendAttachmentGithubReferenceType right) => !(left == right); /// public override bool Equals(object? obj) => obj is SendAttachmentGithubReferenceType other && Equals(other); /// public bool Equals(SendAttachmentGithubReferenceType other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); /// public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); /// public override string ToString() => Value; /// Provides a for serializing instances. [EditorBrowsable(EditorBrowsableState.Never)] public sealed class Converter : JsonConverter { /// public override SendAttachmentGithubReferenceType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, SendAttachmentGithubReferenceType value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(SendAttachmentGithubReferenceType)); } } } /// How to deliver the message. `enqueue` (default) appends to the message queue. `immediate` interjects during an in-progress turn. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct SendMode : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public SendMode(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Append the message to the normal session queue. public static SendMode Enqueue { get; } = new("enqueue"); /// Interject the message during the in-progress turn. public static SendMode Immediate { get; } = new("immediate"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(SendMode left, SendMode right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(SendMode left, SendMode right) => !(left == right); /// public override bool Equals(object? obj) => obj is SendMode other && Equals(other); /// public bool Equals(SendMode other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); /// public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); /// public override string ToString() => Value; /// Provides a for serializing instances. [EditorBrowsable(EditorBrowsableState.Never)] public sealed class Converter : JsonConverter { /// public override SendMode Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, SendMode value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(SendMode)); } } } /// Log severity level. Determines how the message is displayed in the timeline. Defaults to "info". [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct SessionLogLevel : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public SessionLogLevel(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Informational message. public static SessionLogLevel Info { get; } = new("info"); /// Warning message that may require attention. public static SessionLogLevel Warning { get; } = new("warning"); /// Error message describing a failure. public static SessionLogLevel Error { get; } = new("error"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(SessionLogLevel left, SessionLogLevel right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(SessionLogLevel left, SessionLogLevel right) => !(left == right); /// public override bool Equals(object? obj) => obj is SessionLogLevel other && Equals(other); /// public bool Equals(SessionLogLevel other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); /// public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); /// public override string ToString() => Value; /// Provides a for serializing instances. [EditorBrowsable(EditorBrowsableState.Never)] public sealed class Converter : JsonConverter { /// public override SessionLogLevel Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, SessionLogLevel value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(SessionLogLevel)); } } } /// Authentication type. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct AuthInfoType : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public AuthInfoType(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Authentication provided by a GitHub App HMAC credential. public static AuthInfoType Hmac { get; } = new("hmac"); /// Authentication resolved from environment-provided credentials. public static AuthInfoType Env { get; } = new("env"); /// Authentication from an interactive user sign-in. public static AuthInfoType User { get; } = new("user"); /// Authentication delegated to the GitHub CLI. public static AuthInfoType GhCli { get; } = new("gh-cli"); /// Authentication from an API key credential. public static AuthInfoType ApiKey { get; } = new("api-key"); /// Authentication from a GitHub token. public static AuthInfoType Token { get; } = new("token"); /// Authentication from a Copilot API token. public static AuthInfoType CopilotApiToken { get; } = new("copilot-api-token"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(AuthInfoType left, AuthInfoType right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(AuthInfoType left, AuthInfoType right) => !(left == right); /// public override bool Equals(object? obj) => obj is AuthInfoType other && Equals(other); /// public bool Equals(AuthInfoType other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); /// public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); /// public override string ToString() => Value; /// Provides a for serializing instances. [EditorBrowsable(EditorBrowsableState.Never)] public sealed class Converter : JsonConverter { /// public override AuthInfoType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, AuthInfoType value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(AuthInfoType)); } } } /// Allowed values for the `WorkspacesWorkspaceDetailsHostType` enumeration. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct WorkspacesWorkspaceDetailsHostType : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public WorkspacesWorkspaceDetailsHostType(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Workspace repository is hosted on GitHub. public static WorkspacesWorkspaceDetailsHostType Github { get; } = new("github"); /// Workspace repository is hosted on Azure DevOps. public static WorkspacesWorkspaceDetailsHostType Ado { get; } = new("ado"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(WorkspacesWorkspaceDetailsHostType left, WorkspacesWorkspaceDetailsHostType right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(WorkspacesWorkspaceDetailsHostType left, WorkspacesWorkspaceDetailsHostType right) => !(left == right); /// public override bool Equals(object? obj) => obj is WorkspacesWorkspaceDetailsHostType other && Equals(other); /// public bool Equals(WorkspacesWorkspaceDetailsHostType other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); /// public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); /// public override string ToString() => Value; /// Provides a for serializing instances. [EditorBrowsable(EditorBrowsableState.Never)] public sealed class Converter : JsonConverter { /// public override WorkspacesWorkspaceDetailsHostType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, WorkspacesWorkspaceDetailsHostType value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(WorkspacesWorkspaceDetailsHostType)); } } } /// Where this source lives — used for UI grouping. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct InstructionsSourcesLocation : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public InstructionsSourcesLocation(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Instructions live in user-level configuration. public static InstructionsSourcesLocation User { get; } = new("user"); /// Instructions live in repository-level configuration. public static InstructionsSourcesLocation Repository { get; } = new("repository"); /// Instructions live under the current working directory. public static InstructionsSourcesLocation WorkingDirectory { get; } = new("working-directory"); /// Instructions live in plugin-provided configuration. public static InstructionsSourcesLocation Plugin { get; } = new("plugin"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(InstructionsSourcesLocation left, InstructionsSourcesLocation right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(InstructionsSourcesLocation left, InstructionsSourcesLocation right) => !(left == right); /// public override bool Equals(object? obj) => obj is InstructionsSourcesLocation other && Equals(other); /// public bool Equals(InstructionsSourcesLocation other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); /// public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); /// public override string ToString() => Value; /// Provides a for serializing instances. [EditorBrowsable(EditorBrowsableState.Never)] public sealed class Converter : JsonConverter { /// public override InstructionsSourcesLocation Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, InstructionsSourcesLocation value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(InstructionsSourcesLocation)); } } } /// Category of instruction source — used for merge logic. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct InstructionsSourcesType : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public InstructionsSourcesType(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Instructions loaded from the user's home configuration. public static InstructionsSourcesType Home { get; } = new("home"); /// Instructions loaded from repository-scoped files. public static InstructionsSourcesType Repo { get; } = new("repo"); /// Instructions loaded from model-specific files. public static InstructionsSourcesType Model { get; } = new("model"); /// Instructions loaded from VS Code instruction files. public static InstructionsSourcesType Vscode { get; } = new("vscode"); /// Instructions discovered from nested agent files. public static InstructionsSourcesType NestedAgents { get; } = new("nested-agents"); /// Instructions inherited from child instruction files. public static InstructionsSourcesType ChildInstructions { get; } = new("child-instructions"); /// Instructions supplied by an installed plugin. public static InstructionsSourcesType Plugin { get; } = new("plugin"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(InstructionsSourcesType left, InstructionsSourcesType right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(InstructionsSourcesType left, InstructionsSourcesType right) => !(left == right); /// public override bool Equals(object? obj) => obj is InstructionsSourcesType other && Equals(other); /// public bool Equals(InstructionsSourcesType other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); /// public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); /// public override string ToString() => Value; /// Provides a for serializing instances. [EditorBrowsable(EditorBrowsableState.Never)] public sealed class Converter : JsonConverter { /// public override InstructionsSourcesType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, InstructionsSourcesType value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(InstructionsSourcesType)); } } } /// Where the agent definition was loaded from. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct AgentInfoSource : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public AgentInfoSource(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Agent loaded from the user's personal agent configuration. public static AgentInfoSource User { get; } = new("user"); /// Agent loaded from the current project's repository configuration. public static AgentInfoSource Project { get; } = new("project"); /// Agent inherited from a parent project or workspace. public static AgentInfoSource Inherited { get; } = new("inherited"); /// Agent provided by a remote runtime or service. public static AgentInfoSource Remote { get; } = new("remote"); /// Agent contributed by an installed plugin. public static AgentInfoSource Plugin { get; } = new("plugin"); /// Agent built into the Copilot runtime. public static AgentInfoSource Builtin { get; } = new("builtin"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(AgentInfoSource left, AgentInfoSource right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(AgentInfoSource left, AgentInfoSource right) => !(left == right); /// public override bool Equals(object? obj) => obj is AgentInfoSource other && Equals(other); /// public bool Equals(AgentInfoSource other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); /// public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); /// public override string ToString() => Value; /// Provides a for serializing instances. [EditorBrowsable(EditorBrowsableState.Never)] public sealed class Converter : JsonConverter { /// public override AgentInfoSource Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, AgentInfoSource value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(AgentInfoSource)); } } } /// Whether task execution is synchronously awaited or managed in the background. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct TaskExecutionMode : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public TaskExecutionMode(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// The task was started with synchronous waiting. public static TaskExecutionMode Sync { get; } = new("sync"); /// The task is managed in the background. public static TaskExecutionMode Background { get; } = new("background"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(TaskExecutionMode left, TaskExecutionMode right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(TaskExecutionMode left, TaskExecutionMode right) => !(left == right); /// public override bool Equals(object? obj) => obj is TaskExecutionMode other && Equals(other); /// public bool Equals(TaskExecutionMode other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); /// public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); /// public override string ToString() => Value; /// Provides a for serializing instances. [EditorBrowsable(EditorBrowsableState.Never)] public sealed class Converter : JsonConverter { /// public override TaskExecutionMode Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, TaskExecutionMode value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(TaskExecutionMode)); } } } /// Current lifecycle status of the task. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct TaskStatus : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public TaskStatus(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// The task is actively executing. public static TaskStatus Running { get; } = new("running"); /// The task is waiting for additional input. public static TaskStatus Idle { get; } = new("idle"); /// The task finished successfully. public static TaskStatus Completed { get; } = new("completed"); /// The task finished with an error. public static TaskStatus Failed { get; } = new("failed"); /// The task was cancelled before completion. public static TaskStatus Cancelled { get; } = new("cancelled"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(TaskStatus left, TaskStatus right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(TaskStatus left, TaskStatus right) => !(left == right); /// public override bool Equals(object? obj) => obj is TaskStatus other && Equals(other); /// public bool Equals(TaskStatus other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); /// public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); /// public override string ToString() => Value; /// Provides a for serializing instances. [EditorBrowsable(EditorBrowsableState.Never)] public sealed class Converter : JsonConverter { /// public override TaskStatus Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, TaskStatus value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(TaskStatus)); } } } /// Whether the shell runs inside a managed PTY session or as an independent background process. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct TaskShellInfoAttachmentMode : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public TaskShellInfoAttachmentMode(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// The shell runs in a managed PTY session. public static TaskShellInfoAttachmentMode Attached { get; } = new("attached"); /// The shell runs as an independent background process. public static TaskShellInfoAttachmentMode Detached { get; } = new("detached"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(TaskShellInfoAttachmentMode left, TaskShellInfoAttachmentMode right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(TaskShellInfoAttachmentMode left, TaskShellInfoAttachmentMode right) => !(left == right); /// public override bool Equals(object? obj) => obj is TaskShellInfoAttachmentMode other && Equals(other); /// public bool Equals(TaskShellInfoAttachmentMode other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); /// public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); /// public override string ToString() => Value; /// Provides a for serializing instances. [EditorBrowsable(EditorBrowsableState.Never)] public sealed class Converter : JsonConverter { /// public override TaskShellInfoAttachmentMode Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, TaskShellInfoAttachmentMode value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(TaskShellInfoAttachmentMode)); } } } /// Outcome of the sampling inference. 'success' produced a response; 'failure' encountered an error (including agent-side rejection by content filter or criteria); 'cancelled' the caller cancelled this execution via cancelSamplingExecution. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct McpSamplingExecutionAction : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public McpSamplingExecutionAction(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// The sampling inference completed and produced a result. public static McpSamplingExecutionAction Success { get; } = new("success"); /// The sampling inference failed or was rejected. public static McpSamplingExecutionAction Failure { get; } = new("failure"); /// The sampling inference was cancelled before completion. public static McpSamplingExecutionAction Cancelled { get; } = new("cancelled"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(McpSamplingExecutionAction left, McpSamplingExecutionAction right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(McpSamplingExecutionAction left, McpSamplingExecutionAction right) => !(left == right); /// public override bool Equals(object? obj) => obj is McpSamplingExecutionAction other && Equals(other); /// public bool Equals(McpSamplingExecutionAction other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); /// public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); /// public override string ToString() => Value; /// Provides a for serializing instances. [EditorBrowsable(EditorBrowsableState.Never)] public sealed class Converter : JsonConverter { /// public override McpSamplingExecutionAction Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, McpSamplingExecutionAction value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(McpSamplingExecutionAction)); } } } /// How environment-variable values supplied to MCP servers are resolved. "direct" passes literal string values; "indirect" treats values as references (e.g. names of environment variables on the host) that the runtime resolves before launch. Defaults to the runtime's startup mode; clients that intentionally launch MCP servers with literal values (e.g. CLI prompt mode and ACP) set this to "direct". [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct McpSetEnvValueModeDetails : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public McpSetEnvValueModeDetails(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Treat MCP server environment values as literal strings. public static McpSetEnvValueModeDetails Direct { get; } = new("direct"); /// Treat MCP server environment values as host-side references to resolve before launch. public static McpSetEnvValueModeDetails Indirect { get; } = new("indirect"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(McpSetEnvValueModeDetails left, McpSetEnvValueModeDetails right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(McpSetEnvValueModeDetails left, McpSetEnvValueModeDetails right) => !(left == right); /// public override bool Equals(object? obj) => obj is McpSetEnvValueModeDetails other && Equals(other); /// public bool Equals(McpSetEnvValueModeDetails other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); /// public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); /// public override string ToString() => Value; /// Provides a for serializing instances. [EditorBrowsable(EditorBrowsableState.Never)] public sealed class Converter : JsonConverter { /// public override McpSetEnvValueModeDetails Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, McpSetEnvValueModeDetails value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(McpSetEnvValueModeDetails)); } } } /// How env values are passed to MCP servers (`direct` inlines literal values; `indirect` resolves at launch). [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct OptionsUpdateEnvValueMode : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public OptionsUpdateEnvValueMode(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Pass MCP server environment values as literal strings. public static OptionsUpdateEnvValueMode Direct { get; } = new("direct"); /// Resolve MCP server environment values from host-side references. public static OptionsUpdateEnvValueMode Indirect { get; } = new("indirect"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(OptionsUpdateEnvValueMode left, OptionsUpdateEnvValueMode right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(OptionsUpdateEnvValueMode left, OptionsUpdateEnvValueMode right) => !(left == right); /// public override bool Equals(object? obj) => obj is OptionsUpdateEnvValueMode other && Equals(other); /// public bool Equals(OptionsUpdateEnvValueMode other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); /// public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); /// public override string ToString() => Value; /// Provides a for serializing instances. [EditorBrowsable(EditorBrowsableState.Never)] public sealed class Converter : JsonConverter { /// public override OptionsUpdateEnvValueMode Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, OptionsUpdateEnvValueMode value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(OptionsUpdateEnvValueMode)); } } } /// Discovery source: project (.github/extensions/) or user (~/.copilot/extensions/). [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct ExtensionSource : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public ExtensionSource(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Extension discovered from the current project's .github/extensions directory. public static ExtensionSource Project { get; } = new("project"); /// Extension discovered from the user's ~/.copilot/extensions directory. public static ExtensionSource User { get; } = new("user"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(ExtensionSource left, ExtensionSource right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(ExtensionSource left, ExtensionSource right) => !(left == right); /// public override bool Equals(object? obj) => obj is ExtensionSource other && Equals(other); /// public bool Equals(ExtensionSource other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); /// public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); /// public override string ToString() => Value; /// Provides a for serializing instances. [EditorBrowsable(EditorBrowsableState.Never)] public sealed class Converter : JsonConverter { /// public override ExtensionSource Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, ExtensionSource value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(ExtensionSource)); } } } /// Current status: running, disabled, failed, or starting. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct ExtensionStatus : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public ExtensionStatus(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// The extension process is running. public static ExtensionStatus Running { get; } = new("running"); /// The extension is installed but disabled. public static ExtensionStatus Disabled { get; } = new("disabled"); /// The extension failed to start or crashed. public static ExtensionStatus Failed { get; } = new("failed"); /// The extension process is starting. public static ExtensionStatus Starting { get; } = new("starting"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(ExtensionStatus left, ExtensionStatus right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(ExtensionStatus left, ExtensionStatus right) => !(left == right); /// public override bool Equals(object? obj) => obj is ExtensionStatus other && Equals(other); /// public bool Equals(ExtensionStatus other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); /// public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); /// public override string ToString() => Value; /// Provides a for serializing instances. [EditorBrowsable(EditorBrowsableState.Never)] public sealed class Converter : JsonConverter { /// public override ExtensionStatus Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, ExtensionStatus value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(ExtensionStatus)); } } } /// Optional completion hint for the input (e.g. 'directory' for filesystem path completion). [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct SlashCommandInputCompletion : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public SlashCommandInputCompletion(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Input should complete filesystem directories. public static SlashCommandInputCompletion Directory { get; } = new("directory"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(SlashCommandInputCompletion left, SlashCommandInputCompletion right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(SlashCommandInputCompletion left, SlashCommandInputCompletion right) => !(left == right); /// public override bool Equals(object? obj) => obj is SlashCommandInputCompletion other && Equals(other); /// public bool Equals(SlashCommandInputCompletion other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); /// public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); /// public override string ToString() => Value; /// Provides a for serializing instances. [EditorBrowsable(EditorBrowsableState.Never)] public sealed class Converter : JsonConverter { /// public override SlashCommandInputCompletion Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, SlashCommandInputCompletion value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(SlashCommandInputCompletion)); } } } /// Coarse command category for grouping and behavior: runtime built-in, skill-backed command, or SDK/client-owned command. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct SlashCommandKind : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public SlashCommandKind(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Command implemented by the runtime. public static SlashCommandKind Builtin { get; } = new("builtin"); /// Command backed by a skill. public static SlashCommandKind Skill { get; } = new("skill"); /// Command registered by an SDK client or extension. public static SlashCommandKind Client { get; } = new("client"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(SlashCommandKind left, SlashCommandKind right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(SlashCommandKind left, SlashCommandKind right) => !(left == right); /// public override bool Equals(object? obj) => obj is SlashCommandKind other && Equals(other); /// public bool Equals(SlashCommandKind other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); /// public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); /// public override string ToString() => Value; /// Provides a for serializing instances. [EditorBrowsable(EditorBrowsableState.Never)] public sealed class Converter : JsonConverter { /// public override SlashCommandKind Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, SlashCommandKind value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(SlashCommandKind)); } } } /// The user's response: accept (submitted), decline (rejected), or cancel (dismissed). [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct UIElicitationResponseAction : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public UIElicitationResponseAction(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// The user submitted the requested form values. public static UIElicitationResponseAction Accept { get; } = new("accept"); /// The user explicitly declined to provide the requested input. public static UIElicitationResponseAction Decline { get; } = new("decline"); /// The user dismissed the elicitation request. public static UIElicitationResponseAction Cancel { get; } = new("cancel"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(UIElicitationResponseAction left, UIElicitationResponseAction right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(UIElicitationResponseAction left, UIElicitationResponseAction right) => !(left == right); /// public override bool Equals(object? obj) => obj is UIElicitationResponseAction other && Equals(other); /// public bool Equals(UIElicitationResponseAction other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); /// public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); /// public override string ToString() => Value; /// Provides a for serializing instances. [EditorBrowsable(EditorBrowsableState.Never)] public sealed class Converter : JsonConverter { /// public override UIElicitationResponseAction Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, UIElicitationResponseAction value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(UIElicitationResponseAction)); } } } /// User's choice for auto-mode switching: yes (allow this turn), yes_always (allow + persist as setting), or no (decline). [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct UIAutoModeSwitchResponse : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public UIAutoModeSwitchResponse(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Allow the automatic mode switch for this turn. public static UIAutoModeSwitchResponse Yes { get; } = new("yes"); /// Allow this mode switch and persist the preference. public static UIAutoModeSwitchResponse YesAlways { get; } = new("yes_always"); /// Decline the automatic mode switch. public static UIAutoModeSwitchResponse No { get; } = new("no"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(UIAutoModeSwitchResponse left, UIAutoModeSwitchResponse right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(UIAutoModeSwitchResponse left, UIAutoModeSwitchResponse right) => !(left == right); /// public override bool Equals(object? obj) => obj is UIAutoModeSwitchResponse other && Equals(other); /// public bool Equals(UIAutoModeSwitchResponse other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); /// public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); /// public override string ToString() => Value; /// Provides a for serializing instances. [EditorBrowsable(EditorBrowsableState.Never)] public sealed class Converter : JsonConverter { /// public override UIAutoModeSwitchResponse Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, UIAutoModeSwitchResponse value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(UIAutoModeSwitchResponse)); } } } /// The action the user selected. Defaults to 'autopilot' when autoApproveEdits is true, otherwise 'interactive'. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct UIExitPlanModeAction : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public UIExitPlanModeAction(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Exit plan mode without starting implementation. public static UIExitPlanModeAction ExitOnly { get; } = new("exit_only"); /// Exit plan mode and continue interactively. public static UIExitPlanModeAction Interactive { get; } = new("interactive"); /// Exit plan mode and continue in autopilot mode. public static UIExitPlanModeAction Autopilot { get; } = new("autopilot"); /// Exit plan mode and continue in autopilot mode with parallel subagent execution. public static UIExitPlanModeAction AutopilotFleet { get; } = new("autopilot_fleet"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(UIExitPlanModeAction left, UIExitPlanModeAction right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(UIExitPlanModeAction left, UIExitPlanModeAction right) => !(left == right); /// public override bool Equals(object? obj) => obj is UIExitPlanModeAction other && Equals(other); /// public bool Equals(UIExitPlanModeAction other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); /// public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); /// public override string ToString() => Value; /// Provides a for serializing instances. [EditorBrowsable(EditorBrowsableState.Never)] public sealed class Converter : JsonConverter { /// public override UIExitPlanModeAction Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, UIExitPlanModeAction value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(UIExitPlanModeAction)); } } } /// Allowed values for the `PermissionsConfigureAdditionalContentExclusionPolicyScope` enumeration. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct PermissionsConfigureAdditionalContentExclusionPolicyScope : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public PermissionsConfigureAdditionalContentExclusionPolicyScope(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// The content exclusion policy applies to the current repository. public static PermissionsConfigureAdditionalContentExclusionPolicyScope Repo { get; } = new("repo"); /// The content exclusion policy applies across all repositories. public static PermissionsConfigureAdditionalContentExclusionPolicyScope All { get; } = new("all"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(PermissionsConfigureAdditionalContentExclusionPolicyScope left, PermissionsConfigureAdditionalContentExclusionPolicyScope right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(PermissionsConfigureAdditionalContentExclusionPolicyScope left, PermissionsConfigureAdditionalContentExclusionPolicyScope right) => !(left == right); /// public override bool Equals(object? obj) => obj is PermissionsConfigureAdditionalContentExclusionPolicyScope other && Equals(other); /// public bool Equals(PermissionsConfigureAdditionalContentExclusionPolicyScope other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); /// public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); /// public override string ToString() => Value; /// Provides a for serializing instances. [EditorBrowsable(EditorBrowsableState.Never)] public sealed class Converter : JsonConverter { /// public override PermissionsConfigureAdditionalContentExclusionPolicyScope Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, PermissionsConfigureAdditionalContentExclusionPolicyScope value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(PermissionsConfigureAdditionalContentExclusionPolicyScope)); } } } /// Optional source for allow-all telemetry. Defaults to `rpc` when omitted for SDK callers. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct PermissionsSetApproveAllSource : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public PermissionsSetApproveAllSource(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Allow-all was enabled from a CLI command-line flag. public static PermissionsSetApproveAllSource CliFlag { get; } = new("cli_flag"); /// Allow-all was enabled by a slash command. public static PermissionsSetApproveAllSource SlashCommand { get; } = new("slash_command"); /// Allow-all was enabled by confirming autopilot behavior. public static PermissionsSetApproveAllSource AutopilotConfirmation { get; } = new("autopilot_confirmation"); /// Allow-all was enabled through an RPC caller. public static PermissionsSetApproveAllSource Rpc { get; } = new("rpc"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(PermissionsSetApproveAllSource left, PermissionsSetApproveAllSource right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(PermissionsSetApproveAllSource left, PermissionsSetApproveAllSource right) => !(left == right); /// public override bool Equals(object? obj) => obj is PermissionsSetApproveAllSource other && Equals(other); /// public bool Equals(PermissionsSetApproveAllSource other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); /// public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); /// public override string ToString() => Value; /// Provides a for serializing instances. [EditorBrowsable(EditorBrowsableState.Never)] public sealed class Converter : JsonConverter { /// public override PermissionsSetApproveAllSource Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, PermissionsSetApproveAllSource value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(PermissionsSetApproveAllSource)); } } } /// Whether the change applies to ephemeral session-scoped rules (cleared at session end) or to location-scoped rules persisted via the location-permissions config file. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct PermissionsModifyRulesScope : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public PermissionsModifyRulesScope(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Apply the rule change only to this session. public static PermissionsModifyRulesScope Session { get; } = new("session"); /// Persist the rule change for this project location. public static PermissionsModifyRulesScope Location { get; } = new("location"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(PermissionsModifyRulesScope left, PermissionsModifyRulesScope right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(PermissionsModifyRulesScope left, PermissionsModifyRulesScope right) => !(left == right); /// public override bool Equals(object? obj) => obj is PermissionsModifyRulesScope other && Equals(other); /// public bool Equals(PermissionsModifyRulesScope other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); /// public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); /// public override string ToString() => Value; /// Provides a for serializing instances. [EditorBrowsable(EditorBrowsableState.Never)] public sealed class Converter : JsonConverter { /// public override PermissionsModifyRulesScope Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, PermissionsModifyRulesScope value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(PermissionsModifyRulesScope)); } } } /// Whether the location is a git repo or directory. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct PermissionLocationType : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public PermissionLocationType(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// The permission location is persisted at the git repository root. public static PermissionLocationType Repo { get; } = new("repo"); /// The permission location is persisted at the working directory. public static PermissionLocationType Dir { get; } = new("dir"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(PermissionLocationType left, PermissionLocationType right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(PermissionLocationType left, PermissionLocationType right) => !(left == right); /// public override bool Equals(object? obj) => obj is PermissionLocationType other && Equals(other); /// public bool Equals(PermissionLocationType other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); /// public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); /// public override string ToString() => Value; /// Provides a for serializing instances. [EditorBrowsable(EditorBrowsableState.Never)] public sealed class Converter : JsonConverter { /// public override PermissionLocationType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, PermissionLocationType value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(PermissionLocationType)); } } } /// The current agent mode for this session (e.g., 'interactive', 'plan', 'autopilot'). [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct MetadataSnapshotCurrentMode : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public MetadataSnapshotCurrentMode(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// The agent is responding interactively to the user. public static MetadataSnapshotCurrentMode Interactive { get; } = new("interactive"); /// The agent is preparing a plan before making changes. public static MetadataSnapshotCurrentMode Plan { get; } = new("plan"); /// The agent is working autonomously toward task completion. public static MetadataSnapshotCurrentMode Autopilot { get; } = new("autopilot"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(MetadataSnapshotCurrentMode left, MetadataSnapshotCurrentMode right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(MetadataSnapshotCurrentMode left, MetadataSnapshotCurrentMode right) => !(left == right); /// public override bool Equals(object? obj) => obj is MetadataSnapshotCurrentMode other && Equals(other); /// public bool Equals(MetadataSnapshotCurrentMode other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); /// public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); /// public override string ToString() => Value; /// Provides a for serializing instances. [EditorBrowsable(EditorBrowsableState.Never)] public sealed class Converter : JsonConverter { /// public override MetadataSnapshotCurrentMode Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, MetadataSnapshotCurrentMode value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(MetadataSnapshotCurrentMode)); } } } /// Whether the remote task originated from Copilot Coding Agent (cca) or a CLI `--remote` invocation. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct MetadataSnapshotRemoteMetadataTaskType : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public MetadataSnapshotRemoteMetadataTaskType(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Remote task originated from Copilot Coding Agent. public static MetadataSnapshotRemoteMetadataTaskType Cca { get; } = new("cca"); /// Remote task originated from a CLI remote-session invocation. public static MetadataSnapshotRemoteMetadataTaskType Cli { get; } = new("cli"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(MetadataSnapshotRemoteMetadataTaskType left, MetadataSnapshotRemoteMetadataTaskType right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(MetadataSnapshotRemoteMetadataTaskType left, MetadataSnapshotRemoteMetadataTaskType right) => !(left == right); /// public override bool Equals(object? obj) => obj is MetadataSnapshotRemoteMetadataTaskType other && Equals(other); /// public bool Equals(MetadataSnapshotRemoteMetadataTaskType other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); /// public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); /// public override string ToString() => Value; /// Provides a for serializing instances. [EditorBrowsable(EditorBrowsableState.Never)] public sealed class Converter : JsonConverter { /// public override MetadataSnapshotRemoteMetadataTaskType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, MetadataSnapshotRemoteMetadataTaskType value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(MetadataSnapshotRemoteMetadataTaskType)); } } } /// Repository host type, if known. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct WorkspaceSummaryHostType : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public WorkspaceSummaryHostType(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Workspace summary repository is hosted on GitHub. public static WorkspaceSummaryHostType Github { get; } = new("github"); /// Workspace summary repository is hosted on Azure DevOps. public static WorkspaceSummaryHostType Ado { get; } = new("ado"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(WorkspaceSummaryHostType left, WorkspaceSummaryHostType right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(WorkspaceSummaryHostType left, WorkspaceSummaryHostType right) => !(left == right); /// public override bool Equals(object? obj) => obj is WorkspaceSummaryHostType other && Equals(other); /// public bool Equals(WorkspaceSummaryHostType other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); /// public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); /// public override string ToString() => Value; /// Provides a for serializing instances. [EditorBrowsable(EditorBrowsableState.Never)] public sealed class Converter : JsonConverter { /// public override WorkspaceSummaryHostType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, WorkspaceSummaryHostType value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(WorkspaceSummaryHostType)); } } } /// Hosting platform type of the repository. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct SessionWorkingDirectoryContextHostType : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public SessionWorkingDirectoryContextHostType(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// The working directory repository is hosted on GitHub. public static SessionWorkingDirectoryContextHostType Github { get; } = new("github"); /// The working directory repository is hosted on Azure DevOps. public static SessionWorkingDirectoryContextHostType Ado { get; } = new("ado"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(SessionWorkingDirectoryContextHostType left, SessionWorkingDirectoryContextHostType right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(SessionWorkingDirectoryContextHostType left, SessionWorkingDirectoryContextHostType right) => !(left == right); /// public override bool Equals(object? obj) => obj is SessionWorkingDirectoryContextHostType other && Equals(other); /// public bool Equals(SessionWorkingDirectoryContextHostType other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); /// public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); /// public override string ToString() => Value; /// Provides a for serializing instances. [EditorBrowsable(EditorBrowsableState.Never)] public sealed class Converter : JsonConverter { /// public override SessionWorkingDirectoryContextHostType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, SessionWorkingDirectoryContextHostType value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(SessionWorkingDirectoryContextHostType)); } } } /// Signal to send (default: SIGTERM). [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct ShellKillSignal : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public ShellKillSignal(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Request graceful process termination. public static ShellKillSignal SIGTERM { get; } = new("SIGTERM"); /// Forcefully terminate the process. public static ShellKillSignal SIGKILL { get; } = new("SIGKILL"); /// Send an interrupt signal to the process. public static ShellKillSignal SIGINT { get; } = new("SIGINT"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(ShellKillSignal left, ShellKillSignal right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(ShellKillSignal left, ShellKillSignal right) => !(left == right); /// public override bool Equals(object? obj) => obj is ShellKillSignal other && Equals(other); /// public bool Equals(ShellKillSignal other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); /// public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); /// public override string ToString() => Value; /// Provides a for serializing instances. [EditorBrowsable(EditorBrowsableState.Never)] public sealed class Converter : JsonConverter { /// public override ShellKillSignal Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, ShellKillSignal value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(ShellKillSignal)); } } } /// Whether this item is a queued user message or a queued slash command / model change. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct QueuePendingItemsKind : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public QueuePendingItemsKind(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// A queued user message. public static QueuePendingItemsKind Message { get; } = new("message"); /// A queued slash command or model-change command. public static QueuePendingItemsKind Command { get; } = new("command"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(QueuePendingItemsKind left, QueuePendingItemsKind right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(QueuePendingItemsKind left, QueuePendingItemsKind right) => !(left == right); /// public override bool Equals(object? obj) => obj is QueuePendingItemsKind other && Equals(other); /// public bool Equals(QueuePendingItemsKind other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); /// public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); /// public override string ToString() => Value; /// Provides a for serializing instances. [EditorBrowsable(EditorBrowsableState.Never)] public sealed class Converter : JsonConverter { /// public override QueuePendingItemsKind Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, QueuePendingItemsKind value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(QueuePendingItemsKind)); } } } /// Cursor status: 'ok' means the cursor was applied successfully; 'expired' means the cursor referred to an event that no longer exists in history (e.g. truncated or compacted away) and the read started from the beginning of the remaining history. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct EventsCursorStatus : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public EventsCursorStatus(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// The cursor was applied successfully. public static EventsCursorStatus Ok { get; } = new("ok"); /// The cursor referred to history that is no longer available. public static EventsCursorStatus Expired { get; } = new("expired"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(EventsCursorStatus left, EventsCursorStatus right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(EventsCursorStatus left, EventsCursorStatus right) => !(left == right); /// public override bool Equals(object? obj) => obj is EventsCursorStatus other && Equals(other); /// public bool Equals(EventsCursorStatus other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); /// public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); /// public override string ToString() => Value; /// Provides a for serializing instances. [EditorBrowsable(EditorBrowsableState.Never)] public sealed class Converter : JsonConverter { /// public override EventsCursorStatus Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, EventsCursorStatus value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(EventsCursorStatus)); } } } /// Agent-scope filter: 'primary' returns only main-agent events plus events whose type starts with 'subagent.' (matching the typed-subscription default behavior); 'all' returns events from all agents (matching wildcard-subscription behavior). Default is 'all' to preserve wildcard semantics for catch-up callers. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct EventsAgentScope : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public EventsAgentScope(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Return main-agent events and typed subagent lifecycle events. public static EventsAgentScope Primary { get; } = new("primary"); /// Return events from all agents. public static EventsAgentScope All { get; } = new("all"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(EventsAgentScope left, EventsAgentScope right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(EventsAgentScope left, EventsAgentScope right) => !(left == right); /// public override bool Equals(object? obj) => obj is EventsAgentScope other && Equals(other); /// public bool Equals(EventsAgentScope other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); /// public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); /// public override string ToString() => Value; /// Provides a for serializing instances. [EditorBrowsable(EditorBrowsableState.Never)] public sealed class Converter : JsonConverter { /// public override EventsAgentScope Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, EventsAgentScope value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(EventsAgentScope)); } } } /// Per-session remote mode. "off" disables remote, "export" exports session events to GitHub without enabling remote steering, "on" enables both export and remote steering. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct RemoteSessionMode : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public RemoteSessionMode(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Disable remote session export and steering. public static RemoteSessionMode Off { get; } = new("off"); /// Export session events to GitHub without enabling remote steering. public static RemoteSessionMode Export { get; } = new("export"); /// Enable both remote session export and remote steering. public static RemoteSessionMode On { get; } = new("on"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(RemoteSessionMode left, RemoteSessionMode right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(RemoteSessionMode left, RemoteSessionMode right) => !(left == right); /// public override bool Equals(object? obj) => obj is RemoteSessionMode other && Equals(other); /// public bool Equals(RemoteSessionMode other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); /// public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); /// public override string ToString() => Value; /// Provides a for serializing instances. [EditorBrowsable(EditorBrowsableState.Never)] public sealed class Converter : JsonConverter { /// public override RemoteSessionMode Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, RemoteSessionMode value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(RemoteSessionMode)); } } } /// Error classification. [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct SessionFsErrorCode : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public SessionFsErrorCode(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// The requested path does not exist. public static SessionFsErrorCode ENOENT { get; } = new("ENOENT"); /// The filesystem operation failed for an unspecified reason. public static SessionFsErrorCode UNKNOWN { get; } = new("UNKNOWN"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(SessionFsErrorCode left, SessionFsErrorCode right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(SessionFsErrorCode left, SessionFsErrorCode right) => !(left == right); /// public override bool Equals(object? obj) => obj is SessionFsErrorCode other && Equals(other); /// public bool Equals(SessionFsErrorCode other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); /// public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); /// public override string ToString() => Value; /// Provides a for serializing instances. [EditorBrowsable(EditorBrowsableState.Never)] public sealed class Converter : JsonConverter { /// public override SessionFsErrorCode Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, SessionFsErrorCode value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(SessionFsErrorCode)); } } } /// Entry type. [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct SessionFsReaddirWithTypesEntryType : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public SessionFsReaddirWithTypesEntryType(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// The entry is a file. public static SessionFsReaddirWithTypesEntryType File { get; } = new("file"); /// The entry is a directory. public static SessionFsReaddirWithTypesEntryType Directory { get; } = new("directory"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(SessionFsReaddirWithTypesEntryType left, SessionFsReaddirWithTypesEntryType right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(SessionFsReaddirWithTypesEntryType left, SessionFsReaddirWithTypesEntryType right) => !(left == right); /// public override bool Equals(object? obj) => obj is SessionFsReaddirWithTypesEntryType other && Equals(other); /// public bool Equals(SessionFsReaddirWithTypesEntryType other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); /// public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); /// public override string ToString() => Value; /// Provides a for serializing instances. [EditorBrowsable(EditorBrowsableState.Never)] public sealed class Converter : JsonConverter { /// public override SessionFsReaddirWithTypesEntryType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, SessionFsReaddirWithTypesEntryType value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(SessionFsReaddirWithTypesEntryType)); } } } /// How to execute the query: 'exec' for DDL/multi-statement (no results), 'query' for SELECT (returns rows), 'run' for INSERT/UPDATE/DELETE (returns rowsAffected). [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct SessionFsSqliteQueryType : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public SessionFsSqliteQueryType(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Execute DDL or multi-statement SQL without returning rows. public static SessionFsSqliteQueryType Exec { get; } = new("exec"); /// Execute a SELECT-style query and return rows. public static SessionFsSqliteQueryType Query { get; } = new("query"); /// Execute INSERT, UPDATE, or DELETE SQL and return affected-row metadata. public static SessionFsSqliteQueryType Run { get; } = new("run"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(SessionFsSqliteQueryType left, SessionFsSqliteQueryType right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(SessionFsSqliteQueryType left, SessionFsSqliteQueryType right) => !(left == right); /// public override bool Equals(object? obj) => obj is SessionFsSqliteQueryType other && Equals(other); /// public bool Equals(SessionFsSqliteQueryType other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); /// public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); /// public override string ToString() => Value; /// Provides a for serializing instances. [EditorBrowsable(EditorBrowsableState.Never)] public sealed class Converter : JsonConverter { /// public override SessionFsSqliteQueryType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, SessionFsSqliteQueryType value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(SessionFsSqliteQueryType)); } } } /// Provides server-scoped RPC methods (no session required). public sealed class ServerRpc { private readonly JsonRpc _rpc; internal ServerRpc(JsonRpc rpc) { _rpc = rpc; } /// Checks server responsiveness and returns protocol information. /// Optional message to echo back. /// The to monitor for cancellation requests. The default is . /// Server liveness response, including the echoed message, current server timestamp, and protocol version. public async Task PingAsync(string? message = null, CancellationToken cancellationToken = default) { var request = new PingRequest { Message = message }; return await CopilotClient.InvokeRpcAsync(_rpc, "ping", [request], cancellationToken); } /// Performs the SDK server connection handshake and validates the optional connection token. /// Connection token; required when the server was started with COPILOT_CONNECTION_TOKEN. /// The to monitor for cancellation requests. The default is . /// Handshake result reporting the server's protocol version and package version on success. internal async Task ConnectAsync(string? token = null, CancellationToken cancellationToken = default) { var request = new ConnectRequest { Token = token }; return await CopilotClient.InvokeRpcAsync(_rpc, "connect", [request], cancellationToken); } /// Models APIs. public ServerModelsApi Models => field ?? Interlocked.CompareExchange(ref field, new(_rpc), null) ?? field; /// Tools APIs. public ServerToolsApi Tools => field ?? Interlocked.CompareExchange(ref field, new(_rpc), null) ?? field; /// Account APIs. public ServerAccountApi Account => field ?? Interlocked.CompareExchange(ref field, new(_rpc), null) ?? field; /// Secrets APIs. public ServerSecretsApi Secrets => field ?? Interlocked.CompareExchange(ref field, new(_rpc), null) ?? field; /// Mcp APIs. public ServerMcpApi Mcp => field ?? Interlocked.CompareExchange(ref field, new(_rpc), null) ?? field; /// Skills APIs. public ServerSkillsApi Skills => field ?? Interlocked.CompareExchange(ref field, new(_rpc), null) ?? field; /// SessionFs APIs. public ServerSessionFsApi SessionFs => field ?? Interlocked.CompareExchange(ref field, new(_rpc), null) ?? field; /// Sessions APIs. public ServerSessionsApi Sessions => field ?? Interlocked.CompareExchange(ref field, new(_rpc), null) ?? field; } /// Provides server-scoped Models APIs. public sealed class ServerModelsApi { private readonly JsonRpc _rpc; internal ServerModelsApi(JsonRpc rpc) { _rpc = rpc; } /// Lists Copilot models available to the authenticated user. /// GitHub token for per-user model listing. When provided, resolves this token to determine the user's Copilot plan and available models instead of using the global auth. /// The to monitor for cancellation requests. The default is . /// List of Copilot models available to the resolved user, including capabilities and billing metadata. public async Task ListAsync(string? gitHubToken = null, CancellationToken cancellationToken = default) { var request = new ModelsListRequest { GitHubToken = gitHubToken }; return await CopilotClient.InvokeRpcAsync(_rpc, "models.list", [request], cancellationToken); } } /// Provides server-scoped Tools APIs. public sealed class ServerToolsApi { private readonly JsonRpc _rpc; internal ServerToolsApi(JsonRpc rpc) { _rpc = rpc; } /// Lists built-in tools available for a model. /// Optional model ID — when provided, the returned tool list reflects model-specific overrides. /// The to monitor for cancellation requests. The default is . /// Built-in tools available for the requested model, with their parameters and instructions. public async Task ListAsync(string? model = null, CancellationToken cancellationToken = default) { var request = new ToolsListRequest { Model = model }; return await CopilotClient.InvokeRpcAsync(_rpc, "tools.list", [request], cancellationToken); } } /// Provides server-scoped Account APIs. public sealed class ServerAccountApi { private readonly JsonRpc _rpc; internal ServerAccountApi(JsonRpc rpc) { _rpc = rpc; } /// Gets Copilot quota usage for the authenticated user or supplied GitHub token. /// GitHub token for per-user quota lookup. When provided, resolves this token to determine the user's quota instead of using the global auth. /// The to monitor for cancellation requests. The default is . /// Quota usage snapshots for the resolved user, keyed by quota type. public async Task GetQuotaAsync(string? gitHubToken = null, CancellationToken cancellationToken = default) { var request = new AccountGetQuotaRequest { GitHubToken = gitHubToken }; return await CopilotClient.InvokeRpcAsync(_rpc, "account.getQuota", [request], cancellationToken); } } /// Provides server-scoped Secrets APIs. public sealed class ServerSecretsApi { private readonly JsonRpc _rpc; internal ServerSecretsApi(JsonRpc rpc) { _rpc = rpc; } /// Registers secret values for redaction in session logs and exports. The SDK calls this to inject dynamically generated secret values (e.g., OIDC tokens). /// Raw secret values to register for redaction. /// The to monitor for cancellation requests. The default is . /// Confirmation that the secret values were registered. public async Task AddFilterValuesAsync(IList values, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(values); var request = new SecretsAddFilterValuesRequest { Values = values }; return await CopilotClient.InvokeRpcAsync(_rpc, "secrets.addFilterValues", [request], cancellationToken); } } /// Provides server-scoped Mcp APIs. public sealed class ServerMcpApi { private readonly JsonRpc _rpc; internal ServerMcpApi(JsonRpc rpc) { _rpc = rpc; } /// Discovers MCP servers from user, workspace, plugin, and builtin sources. /// Working directory used as context for discovery (e.g., plugin resolution). /// The to monitor for cancellation requests. The default is . /// MCP servers discovered from user, workspace, plugin, and built-in sources. public async Task DiscoverAsync(string? workingDirectory = null, CancellationToken cancellationToken = default) { var request = new McpDiscoverRequest { WorkingDirectory = workingDirectory }; return await CopilotClient.InvokeRpcAsync(_rpc, "mcp.discover", [request], cancellationToken); } /// Config APIs. public ServerMcpConfigApi Config => field ?? Interlocked.CompareExchange(ref field, new(_rpc), null) ?? field; } /// Provides server-scoped McpConfig APIs. public sealed class ServerMcpConfigApi { private readonly JsonRpc _rpc; internal ServerMcpConfigApi(JsonRpc rpc) { _rpc = rpc; } /// Lists MCP servers from user configuration. /// The to monitor for cancellation requests. The default is . /// User-configured MCP servers, keyed by server name. public async Task ListAsync(CancellationToken cancellationToken = default) { return await CopilotClient.InvokeRpcAsync(_rpc, "mcp.config.list", [], cancellationToken); } /// Adds an MCP server to user configuration. /// Unique name for the MCP server. /// MCP server configuration (stdio process or remote HTTP/SSE). /// The to monitor for cancellation requests. The default is . public async Task AddAsync(string name, object config, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(name); ArgumentNullException.ThrowIfNull(config); var request = new McpConfigAddRequest { Name = name, Config = CopilotClient.ToJsonElementForWire(config)!.Value }; await CopilotClient.InvokeRpcAsync(_rpc, "mcp.config.add", [request], cancellationToken); } /// Updates an MCP server in user configuration. /// Name of the MCP server to update. /// MCP server configuration (stdio process or remote HTTP/SSE). /// The to monitor for cancellation requests. The default is . public async Task UpdateAsync(string name, object config, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(name); ArgumentNullException.ThrowIfNull(config); var request = new McpConfigUpdateRequest { Name = name, Config = CopilotClient.ToJsonElementForWire(config)!.Value }; await CopilotClient.InvokeRpcAsync(_rpc, "mcp.config.update", [request], cancellationToken); } /// Removes an MCP server from user configuration. /// Name of the MCP server to remove. /// The to monitor for cancellation requests. The default is . public async Task RemoveAsync(string name, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(name); var request = new McpConfigRemoveRequest { Name = name }; await CopilotClient.InvokeRpcAsync(_rpc, "mcp.config.remove", [request], cancellationToken); } /// Enables MCP servers in user configuration for new sessions. /// Names of MCP servers to enable. Each server is removed from the persisted disabled list so new sessions spawn it. Unknown or already-enabled names are ignored. /// The to monitor for cancellation requests. The default is . public async Task EnableAsync(IList names, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(names); var request = new McpConfigEnableRequest { Names = names }; await CopilotClient.InvokeRpcAsync(_rpc, "mcp.config.enable", [request], cancellationToken); } /// Disables MCP servers in user configuration for new sessions. /// Names of MCP servers to disable. Each server is added to the persisted disabled list so new sessions skip it. Already-disabled names are ignored. Active sessions keep their current connections until they end. /// The to monitor for cancellation requests. The default is . public async Task DisableAsync(IList names, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(names); var request = new McpConfigDisableRequest { Names = names }; await CopilotClient.InvokeRpcAsync(_rpc, "mcp.config.disable", [request], cancellationToken); } } /// Provides server-scoped Skills APIs. public sealed class ServerSkillsApi { private readonly JsonRpc _rpc; internal ServerSkillsApi(JsonRpc rpc) { _rpc = rpc; } /// Discovers skills across global and project sources. /// Optional list of project directory paths to scan for project-scoped skills. /// Optional list of additional skill directory paths to include. /// The to monitor for cancellation requests. The default is . /// Skills discovered across global and project sources. public async Task DiscoverAsync(IList? projectPaths = null, IList? skillDirectories = null, CancellationToken cancellationToken = default) { var request = new SkillsDiscoverRequest { ProjectPaths = projectPaths, SkillDirectories = skillDirectories }; return await CopilotClient.InvokeRpcAsync(_rpc, "skills.discover", [request], cancellationToken); } /// Config APIs. public ServerSkillsConfigApi Config => field ?? Interlocked.CompareExchange(ref field, new(_rpc), null) ?? field; } /// Provides server-scoped SkillsConfig APIs. public sealed class ServerSkillsConfigApi { private readonly JsonRpc _rpc; internal ServerSkillsConfigApi(JsonRpc rpc) { _rpc = rpc; } /// Replaces the global list of disabled skills. /// List of skill names to disable. /// The to monitor for cancellation requests. The default is . public async Task SetDisabledSkillsAsync(IList disabledSkills, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(disabledSkills); var request = new SkillsConfigSetDisabledSkillsRequest { DisabledSkills = disabledSkills }; await CopilotClient.InvokeRpcAsync(_rpc, "skills.config.setDisabledSkills", [request], cancellationToken); } } /// Provides server-scoped SessionFs APIs. public sealed class ServerSessionFsApi { private readonly JsonRpc _rpc; internal ServerSessionFsApi(JsonRpc rpc) { _rpc = rpc; } /// Registers an SDK client as the session filesystem provider. /// Initial working directory for sessions. /// Path within each session's SessionFs where the runtime stores files for that session. /// Path conventions used by this filesystem. /// Optional capabilities declared by the provider. /// The to monitor for cancellation requests. The default is . /// Indicates whether the calling client was registered as the session filesystem provider. public async Task SetProviderAsync(string initialCwd, string sessionStatePath, SessionFsSetProviderConventions conventions, SessionFsSetProviderCapabilities? capabilities = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(initialCwd); ArgumentNullException.ThrowIfNull(sessionStatePath); var request = new SessionFsSetProviderRequest { InitialCwd = initialCwd, SessionStatePath = sessionStatePath, Conventions = conventions, Capabilities = capabilities }; return await CopilotClient.InvokeRpcAsync(_rpc, "sessionFs.setProvider", [request], cancellationToken); } } /// Provides server-scoped Sessions APIs. [Experimental(Diagnostics.Experimental)] public sealed class ServerSessionsApi { private readonly JsonRpc _rpc; internal ServerSessionsApi(JsonRpc rpc) { _rpc = rpc; } /// Creates a new session by forking persisted history from an existing session. /// Source session ID to fork from. /// Optional event ID boundary. When provided, the fork includes only events before this ID (exclusive). When omitted, all events are included. /// Optional friendly name to assign to the forked session. /// The to monitor for cancellation requests. The default is . /// Identifier and optional friendly name assigned to the newly forked session. public async Task ForkAsync(string sessionId, string? toEventId = null, string? name = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(sessionId); var request = new SessionsForkRequest { SessionId = sessionId, ToEventId = toEventId, Name = name }; return await CopilotClient.InvokeRpcAsync(_rpc, "sessions.fork", [request], cancellationToken); } /// Connects to an existing remote session and exposes it as an SDK session. /// Session ID to connect to. /// The to monitor for cancellation requests. The default is . /// Remote session connection result. public async Task ConnectAsync(string sessionId, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(sessionId); var request = new ConnectRemoteSessionParams { SessionId = sessionId }; return await CopilotClient.InvokeRpcAsync(_rpc, "sessions.connect", [request], cancellationToken); } /// Lists persisted sessions, optionally filtered by working-directory context. /// When provided, only the first N sessions (sorted by modification time, newest first) load full metadata; remaining sessions return basic info only. Use 0 to return only basic info for every session. /// Optional filter applied to the returned sessions. /// The to monitor for cancellation requests. The default is . /// Persisted sessions matching the filter, ordered most-recently-modified first. public async Task ListAsync(long? metadataLimit = null, SessionListFilter? filter = null, CancellationToken cancellationToken = default) { var request = new SessionsListRequest { MetadataLimit = metadataLimit, Filter = filter }; return await CopilotClient.InvokeRpcAsync(_rpc, "sessions.list", [request], cancellationToken); } /// Finds the local session bound to a GitHub task ID, if any. /// GitHub task ID to look up. /// The to monitor for cancellation requests. The default is . /// ID of the local session bound to the given GitHub task, or omitted when none. public async Task FindByTaskIdAsync(string taskId, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(taskId); var request = new SessionsFindByTaskIDRequest { TaskId = taskId }; return await CopilotClient.InvokeRpcAsync(_rpc, "sessions.findByTaskId", [request], cancellationToken); } /// Resolves a UUID prefix to a unique session ID, if exactly one session matches. /// UUID prefix (>=7 hex chars, <36 chars). Returns the unique session ID, or undefined when there is no match or the prefix matches multiple sessions. /// The to monitor for cancellation requests. The default is . /// Session ID matching the prefix, omitted when no unique match exists. public async Task FindByPrefixAsync(string prefix, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(prefix); var request = new SessionsFindByPrefixRequest { Prefix = prefix }; return await CopilotClient.InvokeRpcAsync(_rpc, "sessions.findByPrefix", [request], cancellationToken); } /// Returns the most-relevant prior session for a given working-directory context. /// Optional working-directory context used to score session relevance. When omitted the most-recently-modified session wins. /// The to monitor for cancellation requests. The default is . /// Most-relevant session ID for the supplied context, or omitted when no sessions exist. public async Task GetLastForContextAsync(SessionContext? context = null, CancellationToken cancellationToken = default) { var request = new SessionsGetLastForContextRequest { Context = context }; return await CopilotClient.InvokeRpcAsync(_rpc, "sessions.getLastForContext", [request], cancellationToken); } /// Computes the absolute path to a session's persisted events.jsonl file. /// Session ID whose event-log file path to compute. /// The to monitor for cancellation requests. The default is . /// Absolute path to the session's events.jsonl file on disk. public async Task GetEventFilePathAsync(string sessionId, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(sessionId); var request = new SessionsGetEventFilePathRequest { SessionId = sessionId }; return await CopilotClient.InvokeRpcAsync(_rpc, "sessions.getEventFilePath", [request], cancellationToken); } /// Returns the on-disk byte size of each session's workspace directory. /// The to monitor for cancellation requests. The default is . /// Map of sessionId -> on-disk size in bytes for each session's workspace directory. public async Task GetSizesAsync(CancellationToken cancellationToken = default) { return await CopilotClient.InvokeRpcAsync(_rpc, "sessions.getSizes", [], cancellationToken); } /// Returns the subset of the supplied session IDs that are currently held by another running process. /// Session IDs to test for live in-use locks. /// The to monitor for cancellation requests. The default is . /// Session IDs from the input set that are currently in use by another process. public async Task CheckInUseAsync(IList sessionIds, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(sessionIds); var request = new SessionsCheckInUseRequest { SessionIds = sessionIds }; return await CopilotClient.InvokeRpcAsync(_rpc, "sessions.checkInUse", [request], cancellationToken); } /// Returns a session's persisted remote-steerable flag, if any has been recorded. /// Session ID to look up the persisted remote-steerable flag for. /// The to monitor for cancellation requests. The default is . /// The session's persisted remote-steerable flag, or omitted when no value has been persisted. public async Task GetPersistedRemoteSteerableAsync(string sessionId, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(sessionId); var request = new SessionsGetPersistedRemoteSteerableRequest { SessionId = sessionId }; return await CopilotClient.InvokeRpcAsync(_rpc, "sessions.getPersistedRemoteSteerable", [request], cancellationToken); } /// Closes a session: emits shutdown, flushes pending events, releases the in-use lock, and disposes the active session. /// Session ID to close. /// The to monitor for cancellation requests. The default is . /// Closes a session: emits shutdown, flushes pending events to disk, releases the in-use lock, disposes the active session. Idempotent: succeeds even if the session is not currently active. public async Task CloseAsync(string sessionId, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(sessionId); var request = new SessionsCloseRequest { SessionId = sessionId }; return await CopilotClient.InvokeRpcAsync(_rpc, "sessions.close", [request], cancellationToken); } /// Closes, deactivates, and deletes a set of sessions, returning the bytes freed per session. /// Session IDs to close, deactivate, and delete from disk. /// The to monitor for cancellation requests. The default is . /// Map of sessionId -> bytes freed by removing the session's workspace directory. public async Task BulkDeleteAsync(IList sessionIds, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(sessionIds); var request = new SessionsBulkDeleteRequest { SessionIds = sessionIds }; return await CopilotClient.InvokeRpcAsync(_rpc, "sessions.bulkDelete", [request], cancellationToken); } /// Deletes sessions older than the given threshold, with optional dry-run and exclusion list. /// Delete sessions whose modifiedTime is at least this many days old. /// When true, only report what would be deleted without performing any deletion. /// When true, named sessions (set via /rename) are also eligible for pruning. /// Session IDs that should never be considered for pruning. /// The to monitor for cancellation requests. The default is . /// Outcome of the prune operation: deleted IDs, dry-run candidates, skipped IDs, total bytes freed, and the dry-run flag. public async Task PruneOldAsync(long olderThanDays, bool? dryRun = null, bool? includeNamed = null, IList? excludeSessionIds = null, CancellationToken cancellationToken = default) { var request = new SessionsPruneOldRequest { OlderThanDays = olderThanDays, DryRun = dryRun, IncludeNamed = includeNamed, ExcludeSessionIds = excludeSessionIds }; return await CopilotClient.InvokeRpcAsync(_rpc, "sessions.pruneOld", [request], cancellationToken); } /// Flushes a session's pending events to disk. /// Session ID whose pending events should be flushed to disk. /// The to monitor for cancellation requests. The default is . /// Flush a session's pending events to disk. No-op when no writer exists for the session (e.g., already closed). public async Task SaveAsync(string sessionId, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(sessionId); var request = new SessionsSaveRequest { SessionId = sessionId }; return await CopilotClient.InvokeRpcAsync(_rpc, "sessions.save", [request], cancellationToken); } /// Releases the in-use lock held by this process for a session. /// Session ID whose in-use lock should be released. /// The to monitor for cancellation requests. The default is . /// Release the in-use lock held by this process for the given session. No-op when this process does not currently hold a lock for the session. public async Task ReleaseLockAsync(string sessionId, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(sessionId); var request = new SessionsReleaseLockRequest { SessionId = sessionId }; return await CopilotClient.InvokeRpcAsync(_rpc, "sessions.releaseLock", [request], cancellationToken); } /// Backfills missing summary and context fields on the supplied session metadata records. /// Session metadata records to enrich. Records that already have summary and context are returned unchanged. /// The to monitor for cancellation requests. The default is . /// The same metadata records, with summary and context fields backfilled where available. public async Task EnrichMetadataAsync(IList sessions, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(sessions); var request = new SessionsEnrichMetadataRequest { Sessions = sessions }; return await CopilotClient.InvokeRpcAsync(_rpc, "sessions.enrichMetadata", [request], cancellationToken); } /// Reloads user, plugin, and (optionally) repo hooks on the active session. /// Active session ID to reload hooks for. /// When true, skip repo-level hooks. Use before folder trust is confirmed; loadDeferredRepoHooks loads them post-trust. /// The to monitor for cancellation requests. The default is . /// Reload all hooks (user, plugin, optionally repo) and apply them to the active session. Call after installing or removing plugins so their hooks take effect immediately. No-op when no active session matches the given sessionId. public async Task ReloadPluginHooksAsync(string sessionId, bool? deferRepoHooks = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(sessionId); var request = new SessionsReloadPluginHooksRequest { SessionId = sessionId, DeferRepoHooks = deferRepoHooks }; return await CopilotClient.InvokeRpcAsync(_rpc, "sessions.reloadPluginHooks", [request], cancellationToken); } /// Loads previously-deferred repo-level hooks on the active session, returning queued startup prompts. /// Active session ID whose deferred repo-level hooks should be loaded. /// The to monitor for cancellation requests. The default is . /// Queued repo-level startup prompts and the total hook command count after loading. public async Task LoadDeferredRepoHooksAsync(string sessionId, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(sessionId); var request = new SessionsLoadDeferredRepoHooksRequest { SessionId = sessionId }; return await CopilotClient.InvokeRpcAsync(_rpc, "sessions.loadDeferredRepoHooks", [request], cancellationToken); } /// Replaces the manager-wide additional plugins registered with the session manager. /// Manager-wide additional plugins to register. Replaces any previously-configured set. Pass an empty array to clear. /// The to monitor for cancellation requests. The default is . /// Replace the manager-wide additional plugins. New session creations and subsequent hook reloads see the new set; already-running sessions keep their existing hook installation until the next reload. public async Task SetAdditionalPluginsAsync(IList plugins, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(plugins); var request = new SessionsSetAdditionalPluginsRequest { Plugins = plugins }; return await CopilotClient.InvokeRpcAsync(_rpc, "sessions.setAdditionalPlugins", [request], cancellationToken); } } /// Provides typed session-scoped RPC methods. public sealed class SessionRpc { private readonly CopilotSession _session; internal SessionRpc(CopilotSession session) { _session = session; } internal CopilotSession Session => _session; /// Auth APIs. public AuthApi Auth => field ?? Interlocked.CompareExchange(ref field, new(_session), null) ?? field; /// Model APIs. public ModelApi Model => field ?? Interlocked.CompareExchange(ref field, new(_session), null) ?? field; /// Mode APIs. public ModeApi Mode => field ?? Interlocked.CompareExchange(ref field, new(_session), null) ?? field; /// Name APIs. public NameApi Name => field ?? Interlocked.CompareExchange(ref field, new(_session), null) ?? field; /// Plan APIs. public PlanApi Plan => field ?? Interlocked.CompareExchange(ref field, new(_session), null) ?? field; /// Workspaces APIs. public WorkspacesApi Workspaces => field ?? Interlocked.CompareExchange(ref field, new(_session), null) ?? field; /// Instructions APIs. public InstructionsApi Instructions => field ?? Interlocked.CompareExchange(ref field, new(_session), null) ?? field; /// Fleet APIs. public FleetApi Fleet => field ?? Interlocked.CompareExchange(ref field, new(_session), null) ?? field; /// Agent APIs. public AgentApi Agent => field ?? Interlocked.CompareExchange(ref field, new(_session), null) ?? field; /// Tasks APIs. public TasksApi Tasks => field ?? Interlocked.CompareExchange(ref field, new(_session), null) ?? field; /// Skills APIs. public SkillsApi Skills => field ?? Interlocked.CompareExchange(ref field, new(_session), null) ?? field; /// Mcp APIs. public McpApi Mcp => field ?? Interlocked.CompareExchange(ref field, new(_session), null) ?? field; /// Plugins APIs. public PluginsApi Plugins => field ?? Interlocked.CompareExchange(ref field, new(_session), null) ?? field; /// Options APIs. public OptionsApi Options => field ?? Interlocked.CompareExchange(ref field, new(_session), null) ?? field; /// Lsp APIs. public LspApi Lsp => field ?? Interlocked.CompareExchange(ref field, new(_session), null) ?? field; /// Extensions APIs. public ExtensionsApi Extensions => field ?? Interlocked.CompareExchange(ref field, new(_session), null) ?? field; /// Tools APIs. public ToolsApi Tools => field ?? Interlocked.CompareExchange(ref field, new(_session), null) ?? field; /// Commands APIs. public CommandsApi Commands => field ?? Interlocked.CompareExchange(ref field, new(_session), null) ?? field; /// Telemetry APIs. public TelemetryApi Telemetry => field ?? Interlocked.CompareExchange(ref field, new(_session), null) ?? field; /// Ui APIs. public UiApi Ui => field ?? Interlocked.CompareExchange(ref field, new(_session), null) ?? field; /// Permissions APIs. public PermissionsApi Permissions => field ?? Interlocked.CompareExchange(ref field, new(_session), null) ?? field; /// Metadata APIs. public MetadataApi Metadata => field ?? Interlocked.CompareExchange(ref field, new(_session), null) ?? field; /// Shell APIs. public ShellApi Shell => field ?? Interlocked.CompareExchange(ref field, new(_session), null) ?? field; /// History APIs. public HistoryApi History => field ?? Interlocked.CompareExchange(ref field, new(_session), null) ?? field; /// Queue APIs. public QueueApi Queue => field ?? Interlocked.CompareExchange(ref field, new(_session), null) ?? field; /// EventLog APIs. public EventLogApi EventLog => field ?? Interlocked.CompareExchange(ref field, new(_session), null) ?? field; /// Usage APIs. public UsageApi Usage => field ?? Interlocked.CompareExchange(ref field, new(_session), null) ?? field; /// Remote APIs. public RemoteApi Remote => field ?? Interlocked.CompareExchange(ref field, new(_session), null) ?? field; /// Schedule APIs. public ScheduleApi Schedule => field ?? Interlocked.CompareExchange(ref field, new(_session), null) ?? field; /// Suspends the session while preserving persisted state for later resume. /// The to monitor for cancellation requests. The default is . [Experimental(Diagnostics.Experimental)] public async Task SuspendAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionSuspendRequest { SessionId = _session.SessionId }; await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.suspend", [request], cancellationToken); } /// Sends a user message to the session and returns its message ID. /// The user message text. /// If provided, this is shown in the timeline instead of `prompt`. /// Optional attachments (files, directories, selections, blobs, GitHub references) to include with the message. /// How to deliver the message. `enqueue` (default) appends to the message queue. `immediate` interjects during an in-progress turn. /// If true, adds the message to the front of the queue instead of the end. /// If false, this message will not trigger a Premium Request Unit charge. User messages default to billable. /// If set, the request will fail if the named tool is not available when this message is among the user messages at the start of the current exchange. /// Optional provenance tag copied to the resulting user.message event. Supported values are `system`, `command-*`, and `schedule-*`. /// The UI mode the agent was in when this message was sent. Defaults to the session's current mode. /// Custom HTTP headers to include in outbound model requests for this turn. Merged with session-level provider headers; per-turn headers augment and overwrite session-level headers with the same key. /// W3C Trace Context traceparent header for distributed tracing of this agent turn. /// W3C Trace Context tracestate header for distributed tracing. /// If true, await completion of the agentic loop for this message before returning. Defaults to false (fire-and-forget). When true, the result still contains the same `messageId`; the caller can rely on the agent having processed the message before the call resolves. /// The to monitor for cancellation requests. The default is . /// Result of sending a user message. [Experimental(Diagnostics.Experimental)] public async Task SendAsync(string prompt, string? displayPrompt = null, IList? attachments = null, SendMode? mode = null, bool? prepend = null, bool? billable = null, string? requiredTool = null, object? source = null, SendAgentMode? agentMode = null, IDictionary? requestHeaders = null, string? traceparent = null, string? tracestate = null, bool? wait = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(prompt); _session.ThrowIfDisposed(); var request = new SendRequest { SessionId = _session.SessionId, Prompt = prompt, DisplayPrompt = displayPrompt, Attachments = attachments, Mode = mode, Prepend = prepend, Billable = billable, RequiredTool = requiredTool, Source = CopilotClient.ToJsonElementForWire(source), AgentMode = agentMode, RequestHeaders = requestHeaders, Traceparent = traceparent, Tracestate = tracestate, Wait = wait }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.send", [request], cancellationToken); } /// Aborts the current agent turn. /// Finite reason code describing why the current turn was aborted. /// The to monitor for cancellation requests. The default is . /// Result of aborting the current turn. [Experimental(Diagnostics.Experimental)] public async Task AbortAsync(AbortReason? reason = null, CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new AbortRequest { SessionId = _session.SessionId, Reason = reason }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.abort", [request], cancellationToken); } /// Shuts down the session and persists its final state. Awaits any deferred sessionEnd hooks before resolving so user-supplied hook scripts complete before the runtime tears down. /// Why the session is being shut down. Defaults to "routine" when omitted. /// Optional human-readable reason. Typically the message of the error that triggered shutdown when type is 'error'. /// The to monitor for cancellation requests. The default is . [Experimental(Diagnostics.Experimental)] public async Task ShutdownAsync(ShutdownType? type = null, string? reason = null, CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new ShutdownRequest { SessionId = _session.SessionId, Type = type, Reason = reason }; await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.shutdown", [request], cancellationToken); } /// Emits a user-visible session log event. /// Human-readable message. /// Log severity level. Determines how the message is displayed in the timeline. Defaults to "info". /// Domain category for this log entry (e.g., "mcp", "subscription", "policy", "model"). Maps to `infoType`/`warningType`/`errorType` on the emitted event. Defaults to "notification". /// When true, the message is transient and not persisted to the session event log on disk. /// Optional URL the user can open in their browser for more details. /// Optional actionable tip displayed alongside the message. Only honored on `level: "info"`. /// The to monitor for cancellation requests. The default is . /// Identifier of the session event that was emitted for the log message. [Experimental(Diagnostics.Experimental)] public async Task LogAsync(string message, SessionLogLevel? level = null, string? type = null, bool? ephemeral = null, string? url = null, string? tip = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(message); _session.ThrowIfDisposed(); var request = new LogRequest { SessionId = _session.SessionId, Message = message, Level = level, Type = type, Ephemeral = ephemeral, Url = url, Tip = tip }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.log", [request], cancellationToken); } } /// Provides session-scoped Auth APIs. [Experimental(Diagnostics.Experimental)] public sealed class AuthApi { private readonly CopilotSession _session; internal AuthApi(CopilotSession session) { _session = session; } /// Gets authentication status and account metadata for the session. /// The to monitor for cancellation requests. The default is . /// Authentication status and account metadata for the session. public async Task GetStatusAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionAuthGetStatusRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.auth.getStatus", [request], cancellationToken); } /// Updates the session's auth credentials used for outbound model and API requests. /// The new auth credentials to install on the session. When omitted or `undefined`, the call is a no-op and the session's existing credentials are preserved. The runtime stores the value verbatim and uses it for outbound model/API requests; it does NOT re-validate or re-fetch the associated Copilot user response. Several variants carry secret material; treat this method's params as containing secrets at rest and in transit. /// The to monitor for cancellation requests. The default is . /// Indicates whether the credential update succeeded. public async Task SetCredentialsAsync(AuthInfo? credentials = null, CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionSetCredentialsParams { SessionId = _session.SessionId, Credentials = credentials }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.auth.setCredentials", [request], cancellationToken); } } /// Provides session-scoped Model APIs. [Experimental(Diagnostics.Experimental)] public sealed class ModelApi { private readonly CopilotSession _session; internal ModelApi(CopilotSession session) { _session = session; } /// Gets the currently selected model for the session. /// The to monitor for cancellation requests. The default is . /// The currently selected model and reasoning effort for the session. public async Task GetCurrentAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionModelGetCurrentRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.model.getCurrent", [request], cancellationToken); } /// Switches the session to a model and optional reasoning configuration. /// Model identifier to switch to. /// Reasoning effort level to use for the model. "none" disables reasoning. /// Reasoning summary mode to request for supported model clients. /// Override individual model capabilities resolved by the runtime. /// The to monitor for cancellation requests. The default is . /// The model identifier active on the session after the switch. public async Task SwitchToAsync(string modelId, string? reasoningEffort = null, ReasoningSummary? reasoningSummary = null, ModelCapabilitiesOverride? modelCapabilities = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(modelId); _session.ThrowIfDisposed(); var request = new ModelSwitchToRequest { SessionId = _session.SessionId, ModelId = modelId, ReasoningEffort = reasoningEffort, ReasoningSummary = reasoningSummary, ModelCapabilities = modelCapabilities }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.model.switchTo", [request], cancellationToken); } /// Updates the session's reasoning effort without changing the selected model. /// Reasoning effort level to apply to the currently selected model. The host is responsible for validating the value against the model's supported levels before calling. /// The to monitor for cancellation requests. The default is . /// Update the session's reasoning effort without changing the selected model. Use `switchTo` instead when you also need to change the model. The runtime stores the effort on the session and applies it to subsequent turns. public async Task SetReasoningEffortAsync(string reasoningEffort, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(reasoningEffort); _session.ThrowIfDisposed(); var request = new ModelSetReasoningEffortRequest { SessionId = _session.SessionId, ReasoningEffort = reasoningEffort }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.model.setReasoningEffort", [request], cancellationToken); } } /// Provides session-scoped Mode APIs. [Experimental(Diagnostics.Experimental)] public sealed class ModeApi { private readonly CopilotSession _session; internal ModeApi(CopilotSession session) { _session = session; } /// Gets the current agent interaction mode. /// The to monitor for cancellation requests. The default is . /// The session mode the agent is operating in. public async Task GetAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionModeGetRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.mode.get", [request], cancellationToken); } /// Sets the current agent interaction mode. /// The session mode the agent is operating in. /// The to monitor for cancellation requests. The default is . public async Task SetAsync(SessionMode mode, CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new ModeSetRequest { SessionId = _session.SessionId, Mode = mode }; await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.mode.set", [request], cancellationToken); } } /// Provides session-scoped Name APIs. [Experimental(Diagnostics.Experimental)] public sealed class NameApi { private readonly CopilotSession _session; internal NameApi(CopilotSession session) { _session = session; } /// Gets the session's friendly name. /// The to monitor for cancellation requests. The default is . /// The session's friendly name, or null when not yet set. public async Task GetAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionNameGetRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.name.get", [request], cancellationToken); } /// Sets the session's friendly name. /// New session name (1–100 characters, trimmed of leading/trailing whitespace). /// The to monitor for cancellation requests. The default is . public async Task SetAsync(string name, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(name); _session.ThrowIfDisposed(); var request = new NameSetRequest { SessionId = _session.SessionId, Name = name }; await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.name.set", [request], cancellationToken); } /// Persists an auto-generated session summary as the session's name when no user-set name exists. /// Auto-generated session summary. Empty/whitespace-only values are ignored; values are trimmed before persisting. /// The to monitor for cancellation requests. The default is . /// Indicates whether the auto-generated summary was applied as the session's name. public async Task SetAutoAsync(string summary, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(summary); _session.ThrowIfDisposed(); var request = new NameSetAutoRequest { SessionId = _session.SessionId, Summary = summary }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.name.setAuto", [request], cancellationToken); } } /// Provides session-scoped Plan APIs. [Experimental(Diagnostics.Experimental)] public sealed class PlanApi { private readonly CopilotSession _session; internal PlanApi(CopilotSession session) { _session = session; } /// Reads the session plan file from the workspace. /// The to monitor for cancellation requests. The default is . /// Existence, contents, and resolved path of the session plan file. public async Task ReadAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionPlanReadRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.plan.read", [request], cancellationToken); } /// Writes new content to the session plan file. /// The new content for the plan file. /// The to monitor for cancellation requests. The default is . public async Task UpdateAsync(string content, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(content); _session.ThrowIfDisposed(); var request = new PlanUpdateRequest { SessionId = _session.SessionId, Content = content }; await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.plan.update", [request], cancellationToken); } /// Deletes the session plan file from the workspace. /// The to monitor for cancellation requests. The default is . public async Task DeleteAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionPlanDeleteRequest { SessionId = _session.SessionId }; await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.plan.delete", [request], cancellationToken); } } /// Provides session-scoped Workspaces APIs. [Experimental(Diagnostics.Experimental)] public sealed class WorkspacesApi { private readonly CopilotSession _session; internal WorkspacesApi(CopilotSession session) { _session = session; } /// Gets current workspace metadata for the session. /// The to monitor for cancellation requests. The default is . /// Current workspace metadata for the session, including its absolute filesystem path when available. public async Task GetWorkspaceAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionWorkspacesGetWorkspaceRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.workspaces.getWorkspace", [request], cancellationToken); } /// Lists files stored in the session workspace files directory. /// The to monitor for cancellation requests. The default is . /// Relative paths of files stored in the session workspace files directory. public async Task ListFilesAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionWorkspacesListFilesRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.workspaces.listFiles", [request], cancellationToken); } /// Reads a file from the session workspace files directory. /// Relative path within the workspace files directory. /// The to monitor for cancellation requests. The default is . /// Contents of the requested workspace file as a UTF-8 string. public async Task ReadFileAsync(string path, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(path); _session.ThrowIfDisposed(); var request = new WorkspacesReadFileRequest { SessionId = _session.SessionId, Path = path }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.workspaces.readFile", [request], cancellationToken); } /// Creates or overwrites a file in the session workspace files directory. /// Relative path within the workspace files directory. /// File content to write as a UTF-8 string. /// The to monitor for cancellation requests. The default is . public async Task CreateFileAsync(string path, string content, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(path); ArgumentNullException.ThrowIfNull(content); _session.ThrowIfDisposed(); var request = new WorkspacesCreateFileRequest { SessionId = _session.SessionId, Path = path, Content = content }; await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.workspaces.createFile", [request], cancellationToken); } /// Lists workspace checkpoints in chronological order. /// The to monitor for cancellation requests. The default is . /// Workspace checkpoints in chronological order; empty when the workspace is not enabled. public async Task ListCheckpointsAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionWorkspacesListCheckpointsRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.workspaces.listCheckpoints", [request], cancellationToken); } /// Reads the content of a workspace checkpoint by number. /// Checkpoint number to read. /// The to monitor for cancellation requests. The default is . /// Checkpoint content as a UTF-8 string, or null when the checkpoint or workspace is missing. public async Task ReadCheckpointAsync(long number, CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new WorkspacesReadCheckpointRequest { SessionId = _session.SessionId, Number = number }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.workspaces.readCheckpoint", [request], cancellationToken); } /// Saves pasted content as a UTF-8 file in the session workspace. /// Pasted content to save as a UTF-8 file. /// The to monitor for cancellation requests. The default is . /// Descriptor for the saved paste file, or null when the workspace is unavailable. public async Task SaveLargePasteAsync(string content, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(content); _session.ThrowIfDisposed(); var request = new WorkspacesSaveLargePasteRequest { SessionId = _session.SessionId, Content = content }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.workspaces.saveLargePaste", [request], cancellationToken); } } /// Provides session-scoped Instructions APIs. [Experimental(Diagnostics.Experimental)] public sealed class InstructionsApi { private readonly CopilotSession _session; internal InstructionsApi(CopilotSession session) { _session = session; } /// Gets instruction sources loaded for the session. /// The to monitor for cancellation requests. The default is . /// Instruction sources loaded for the session, in merge order. public async Task GetSourcesAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionInstructionsGetSourcesRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.instructions.getSources", [request], cancellationToken); } } /// Provides session-scoped Fleet APIs. [Experimental(Diagnostics.Experimental)] public sealed class FleetApi { private readonly CopilotSession _session; internal FleetApi(CopilotSession session) { _session = session; } /// Starts fleet mode by submitting the fleet orchestration prompt to the session. /// Optional user prompt to combine with fleet instructions. /// The to monitor for cancellation requests. The default is . /// Indicates whether fleet mode was successfully activated. public async Task StartAsync(string? prompt = null, CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new FleetStartRequest { SessionId = _session.SessionId, Prompt = prompt }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.fleet.start", [request], cancellationToken); } } /// Provides session-scoped Agent APIs. [Experimental(Diagnostics.Experimental)] public sealed class AgentApi { private readonly CopilotSession _session; internal AgentApi(CopilotSession session) { _session = session; } /// Lists custom agents available to the session. /// The to monitor for cancellation requests. The default is . /// Custom agents available to the session. public async Task ListAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionAgentListRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.agent.list", [request], cancellationToken); } /// Gets the currently selected custom agent for the session. /// The to monitor for cancellation requests. The default is . /// The currently selected custom agent, or null when using the default agent. public async Task GetCurrentAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionAgentGetCurrentRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.agent.getCurrent", [request], cancellationToken); } /// Selects a custom agent for subsequent turns in the session. /// Name of the custom agent to select. /// The to monitor for cancellation requests. The default is . /// The newly selected custom agent. public async Task SelectAsync(string name, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(name); _session.ThrowIfDisposed(); var request = new AgentSelectRequest { SessionId = _session.SessionId, Name = name }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.agent.select", [request], cancellationToken); } /// Clears the selected custom agent and returns the session to the default agent. /// The to monitor for cancellation requests. The default is . public async Task DeselectAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionAgentDeselectRequest { SessionId = _session.SessionId }; await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.agent.deselect", [request], cancellationToken); } /// Reloads custom agent definitions and returns the refreshed list. /// The to monitor for cancellation requests. The default is . /// Custom agents available to the session after reloading definitions from disk. public async Task ReloadAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionAgentReloadRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.agent.reload", [request], cancellationToken); } } /// Provides session-scoped Tasks APIs. [Experimental(Diagnostics.Experimental)] public sealed class TasksApi { private readonly CopilotSession _session; internal TasksApi(CopilotSession session) { _session = session; } /// Starts a background agent task in the session. /// Type of agent to start (e.g., 'explore', 'task', 'general-purpose'). /// Task prompt for the agent. /// Short name for the agent, used to generate a human-readable ID. /// Short description of the task. /// Optional model override. /// The to monitor for cancellation requests. The default is . /// Identifier assigned to the newly started background agent task. public async Task StartAgentAsync(string agentType, string prompt, string name, string? description = null, string? model = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(agentType); ArgumentNullException.ThrowIfNull(prompt); ArgumentNullException.ThrowIfNull(name); _session.ThrowIfDisposed(); var request = new TasksStartAgentRequest { SessionId = _session.SessionId, AgentType = agentType, Prompt = prompt, Name = name, Description = description, Model = model }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.tasks.startAgent", [request], cancellationToken); } /// Lists background tasks tracked by the session. /// The to monitor for cancellation requests. The default is . /// Background tasks currently tracked by the session. public async Task ListAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionTasksListRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.tasks.list", [request], cancellationToken); } /// Refreshes metadata for any detached background shells the runtime knows about. /// The to monitor for cancellation requests. The default is . /// Refresh metadata for any detached background shells the runtime knows about. Use after a long pause to pick up exit/output state for shells running outside the agent loop. public async Task RefreshAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionTasksRefreshRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.tasks.refresh", [request], cancellationToken); } /// Waits for all in-flight background tasks and any follow-up turns to settle. /// The to monitor for cancellation requests. The default is . /// Wait until all in-flight background tasks (agents + shells) and any follow-up turns scheduled by their completions have settled. Returns when the runtime is fully drained or after an internal timeout (default 10 minutes; configurable via COPILOT_TASK_WAIT_TIMEOUT_SECONDS). public async Task WaitForPendingAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionTasksWaitForPendingRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.tasks.waitForPending", [request], cancellationToken); } /// Returns progress information for a background task by ID. /// Task identifier (agent ID or shell ID). /// The to monitor for cancellation requests. The default is . /// Progress information for the task, or null when no task with that ID is tracked. public async Task GetProgressAsync(string id, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(id); _session.ThrowIfDisposed(); var request = new TasksGetProgressRequest { SessionId = _session.SessionId, Id = id }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.tasks.getProgress", [request], cancellationToken); } /// Returns the first sync-waiting task that can currently be promoted to background mode. /// The to monitor for cancellation requests. The default is . /// The first sync-waiting task that can currently be promoted to background mode. public async Task GetCurrentPromotableAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionTasksGetCurrentPromotableRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.tasks.getCurrentPromotable", [request], cancellationToken); } /// Promotes an eligible synchronously-waited task so it continues running in the background. /// Task identifier. /// The to monitor for cancellation requests. The default is . /// Indicates whether the task was successfully promoted to background mode. public async Task PromoteToBackgroundAsync(string id, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(id); _session.ThrowIfDisposed(); var request = new TasksPromoteToBackgroundRequest { SessionId = _session.SessionId, Id = id }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.tasks.promoteToBackground", [request], cancellationToken); } /// Atomically promotes the first promotable sync-waiting task to background mode and returns it. /// The to monitor for cancellation requests. The default is . /// The promoted task as it now exists in background mode, omitted if no promotable task was waiting. public async Task PromoteCurrentToBackgroundAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionTasksPromoteCurrentToBackgroundRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.tasks.promoteCurrentToBackground", [request], cancellationToken); } /// Cancels a background task. /// Task identifier. /// The to monitor for cancellation requests. The default is . /// Indicates whether the background task was successfully cancelled. public async Task CancelAsync(string id, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(id); _session.ThrowIfDisposed(); var request = new TasksCancelRequest { SessionId = _session.SessionId, Id = id }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.tasks.cancel", [request], cancellationToken); } /// Removes a completed or cancelled background task from tracking. /// Task identifier. /// The to monitor for cancellation requests. The default is . /// Indicates whether the task was removed. False when the task does not exist or is still running/idle. public async Task RemoveAsync(string id, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(id); _session.ThrowIfDisposed(); var request = new TasksRemoveRequest { SessionId = _session.SessionId, Id = id }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.tasks.remove", [request], cancellationToken); } /// Sends a message to a background agent task. /// Agent task identifier. /// Message content to send to the agent. /// Agent ID of the sender, if sent on behalf of another agent. /// The to monitor for cancellation requests. The default is . /// Indicates whether the message was delivered, with an error message when delivery failed. public async Task SendMessageAsync(string id, string message, string? fromAgentId = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(id); ArgumentNullException.ThrowIfNull(message); _session.ThrowIfDisposed(); var request = new TasksSendMessageRequest { SessionId = _session.SessionId, Id = id, Message = message, FromAgentId = fromAgentId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.tasks.sendMessage", [request], cancellationToken); } } /// Provides session-scoped Skills APIs. [Experimental(Diagnostics.Experimental)] public sealed class SkillsApi { private readonly CopilotSession _session; internal SkillsApi(CopilotSession session) { _session = session; } /// Lists skills available to the session. /// The to monitor for cancellation requests. The default is . /// Skills available to the session, with their enabled state. public async Task ListAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionSkillsListRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.skills.list", [request], cancellationToken); } /// Returns the skills that have been invoked during this session. /// The to monitor for cancellation requests. The default is . /// Skills invoked during this session, ordered by invocation time (most recent last). public async Task GetInvokedAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionSkillsGetInvokedRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.skills.getInvoked", [request], cancellationToken); } /// Enables a skill for the session. /// Name of the skill to enable. /// The to monitor for cancellation requests. The default is . public async Task EnableAsync(string name, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(name); _session.ThrowIfDisposed(); var request = new SkillsEnableRequest { SessionId = _session.SessionId, Name = name }; await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.skills.enable", [request], cancellationToken); } /// Disables a skill for the session. /// Name of the skill to disable. /// The to monitor for cancellation requests. The default is . public async Task DisableAsync(string name, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(name); _session.ThrowIfDisposed(); var request = new SkillsDisableRequest { SessionId = _session.SessionId, Name = name }; await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.skills.disable", [request], cancellationToken); } /// Reloads skill definitions for the session. /// The to monitor for cancellation requests. The default is . /// Diagnostics from reloading skill definitions, with warnings and errors as separate lists. public async Task ReloadAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionSkillsReloadRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.skills.reload", [request], cancellationToken); } /// Ensures the session's skill definitions have been loaded from disk. /// The to monitor for cancellation requests. The default is . public async Task EnsureLoadedAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionSkillsEnsureLoadedRequest { SessionId = _session.SessionId }; await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.skills.ensureLoaded", [request], cancellationToken); } } /// Provides session-scoped Mcp APIs. [Experimental(Diagnostics.Experimental)] public sealed class McpApi { private readonly CopilotSession _session; internal McpApi(CopilotSession session) { _session = session; } /// Lists MCP servers configured for the session and their connection status. /// The to monitor for cancellation requests. The default is . /// MCP servers configured for the session, with their connection status. public async Task ListAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionMcpListRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.mcp.list", [request], cancellationToken); } /// Enables an MCP server for the session. /// Name of the MCP server to enable. /// The to monitor for cancellation requests. The default is . public async Task EnableAsync(string serverName, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(serverName); _session.ThrowIfDisposed(); var request = new McpEnableRequest { SessionId = _session.SessionId, ServerName = serverName }; await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.mcp.enable", [request], cancellationToken); } /// Disables an MCP server for the session. /// Name of the MCP server to disable. /// The to monitor for cancellation requests. The default is . public async Task DisableAsync(string serverName, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(serverName); _session.ThrowIfDisposed(); var request = new McpDisableRequest { SessionId = _session.SessionId, ServerName = serverName }; await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.mcp.disable", [request], cancellationToken); } /// Reloads MCP server connections for the session. /// The to monitor for cancellation requests. The default is . public async Task ReloadAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionMcpReloadRequest { SessionId = _session.SessionId }; await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.mcp.reload", [request], cancellationToken); } /// Runs an MCP sampling inference on behalf of an MCP server. /// Caller-provided unique identifier for this sampling execution. Use this same ID with cancelSamplingExecution to cancel the in-flight call. Must be unique within the session for the lifetime of the call. /// Name of the MCP server that initiated the sampling request. /// The original MCP JSON-RPC request ID (string or number). Used by the runtime to correlate the inference with the originating MCP request for telemetry; this is distinct from `requestId` (which is the schema-level cancellation handle). /// Raw MCP CreateMessageRequest params, as received in the `sampling.requested` event. Treated as opaque at the schema layer; the runtime converts the embedded MCP messages into the OpenAI chat-completion shape internally. /// The to monitor for cancellation requests. The default is . /// Outcome of an MCP sampling execution: success result, failure error, or cancellation. public async Task ExecuteSamplingAsync(string requestId, string serverName, object mcpRequestId, McpExecuteSamplingRequest request, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(requestId); ArgumentNullException.ThrowIfNull(serverName); ArgumentNullException.ThrowIfNull(mcpRequestId); ArgumentNullException.ThrowIfNull(request); _session.ThrowIfDisposed(); var rpcRequest = new McpExecuteSamplingParams { SessionId = _session.SessionId, RequestId = requestId, ServerName = serverName, McpRequestId = CopilotClient.ToJsonElementForWire(mcpRequestId)!.Value, Request = request }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.mcp.executeSampling", [rpcRequest], cancellationToken); } /// Cancels an in-flight MCP sampling execution by request ID. /// The requestId previously passed to executeSampling that should be cancelled. /// The to monitor for cancellation requests. The default is . /// Indicates whether an in-flight sampling execution with the given requestId was found and cancelled. public async Task CancelSamplingExecutionAsync(string requestId, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(requestId); _session.ThrowIfDisposed(); var request = new McpCancelSamplingExecutionParams { SessionId = _session.SessionId, RequestId = requestId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.mcp.cancelSamplingExecution", [request], cancellationToken); } /// Sets how environment-variable values supplied to MCP servers are resolved (direct or indirect). /// How environment-variable values supplied to MCP servers are resolved. "direct" passes literal string values; "indirect" treats values as references (e.g. names of environment variables on the host) that the runtime resolves before launch. Defaults to the runtime's startup mode; clients that intentionally launch MCP servers with literal values (e.g. CLI prompt mode and ACP) set this to "direct". /// The to monitor for cancellation requests. The default is . /// Env-value mode recorded on the session after the update. public async Task SetEnvValueModeAsync(McpSetEnvValueModeDetails mode, CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new McpSetEnvValueModeParams { SessionId = _session.SessionId, Mode = mode }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.mcp.setEnvValueMode", [request], cancellationToken); } /// Removes the auto-managed `github` MCP server when present. /// The to monitor for cancellation requests. The default is . /// Indicates whether the auto-managed `github` MCP server was removed (false when nothing to remove). public async Task RemoveGitHubAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionMcpRemoveGitHubRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.mcp.removeGitHub", [request], cancellationToken); } /// Oauth APIs. public McpOauthApi Oauth => field ?? Interlocked.CompareExchange(ref field, new(_session), null) ?? field; } /// Provides session-scoped McpOauth APIs. [Experimental(Diagnostics.Experimental)] public sealed class McpOauthApi { private readonly CopilotSession _session; internal McpOauthApi(CopilotSession session) { _session = session; } /// Starts OAuth authentication for a remote MCP server. /// Name of the remote MCP server to authenticate. /// When true, clears any cached OAuth token for the server and runs a full new authorization. Use when the user explicitly wants to switch accounts or believes their session is stuck. /// Optional override for the OAuth client display name shown on the consent screen. Applies to newly registered dynamic clients only — existing registrations keep the name they were created with. When omitted, the runtime applies a neutral fallback; callers driving interactive auth should pass their own surface-specific label so the consent screen matches the product the user sees. /// Optional override for the body text shown on the OAuth loopback callback success page. When omitted, the runtime applies a neutral fallback; callers driving interactive auth should pass surface-specific copy telling the user where to return. /// The to monitor for cancellation requests. The default is . /// OAuth authorization URL the caller should open, or empty when cached tokens already authenticated the server. public async Task LoginAsync(string serverName, bool? forceReauth = null, string? clientName = null, string? callbackSuccessMessage = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(serverName); _session.ThrowIfDisposed(); var request = new McpOauthLoginRequest { SessionId = _session.SessionId, ServerName = serverName, ForceReauth = forceReauth, ClientName = clientName, CallbackSuccessMessage = callbackSuccessMessage }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.mcp.oauth.login", [request], cancellationToken); } } /// Provides session-scoped Plugins APIs. [Experimental(Diagnostics.Experimental)] public sealed class PluginsApi { private readonly CopilotSession _session; internal PluginsApi(CopilotSession session) { _session = session; } /// Lists plugins installed for the session. /// The to monitor for cancellation requests. The default is . /// Plugins installed for the session, with their enabled state and version metadata. public async Task ListAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionPluginsListRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.plugins.list", [request], cancellationToken); } } /// Provides session-scoped Options APIs. [Experimental(Diagnostics.Experimental)] public sealed class OptionsApi { private readonly CopilotSession _session; internal OptionsApi(CopilotSession session) { _session = session; } /// Patches the genuinely-mutable subset of session options. /// The model ID to use for assistant turns. /// Reasoning effort for the selected model (model-defined enum). /// Identifier of the client driving the session. /// Identifier sent to LSP-style integrations. /// Stable integration identifier used for analytics and rate-limit attribution. /// Map of feature-flag IDs to their boolean enabled state. /// Whether experimental capabilities are enabled. /// Custom model-provider configuration (BYOK). Opaque shape; see `ProviderConfig` in the runtime. /// Absolute working-directory path for shell tools. /// Allowlist of tool names available to this session. /// Denylist of tool names for this session. /// Whether shell-script safety heuristics are enabled. /// Shell init profile (`None` or `NonInteractive`). /// Per-shell process flags (e.g., `pwsh` arguments). /// Sandbox configuration shape; opaque to SDK consumers. See `SandboxConfig` in the runtime. /// Whether interactive shell sessions are logged. /// How env values are passed to MCP servers (`direct` inlines literal values; `indirect` resolves at launch). /// Additional directories to search for skills. /// Skill IDs that should be excluded from this session. /// Whether to discover custom instructions on demand after successful file views (AGENTS.md / CLAUDE.md / .github/copilot-instructions.md surfacing). Combined with `skipCustomInstructions` and the runtime-side `ON_DEMAND_INSTRUCTIONS` feature flag. /// Full set of installed plugins for the session. Replaces the existing list; the runtime invalidates the skills cache only when the list materially changes. /// Whether to default custom agents to local-only execution. /// Whether to skip loading custom instruction sources. /// Instruction source IDs to exclude from the system prompt. /// Whether to include the `Co-authored-by` trailer in commit messages. /// Optional path for trajectory output. /// Whether to stream model responses. /// Override URL for the Copilot API endpoint. /// Whether to disable the `ask_user` tool (encourages autonomous behavior). /// Whether to allow auto-mode continuation across turns. /// Whether the session is running in an interactive UI. /// Whether to surface reasoning-summary events from the model. /// Runtime context discriminator (e.g., `cli`, `actions`). /// Override directory for the session-events log. When unset, the runtime's default events log directory is used. /// Additional content-exclusion policies to merge into the session's policy set. Opaque shape; see `ContentExclusionApiResponse` in the runtime. /// Whether to expose the `manage_schedule` tool to the agent. The runtime always owns the per-session schedule registry; this flag only controls tool exposure (typically gated to staff users). /// The to monitor for cancellation requests. The default is . /// Indicates whether the session options patch was applied successfully. public async Task UpdateAsync(string? model = null, string? reasoningEffort = null, string? clientName = null, string? lspClientName = null, string? integrationId = null, IDictionary? featureFlags = null, bool? isExperimentalMode = null, object? provider = null, string? workingDirectory = null, IList? availableTools = null, IList? excludedTools = null, bool? enableScriptSafety = null, string? shellInitProfile = null, IList? shellProcessFlags = null, object? sandboxConfig = null, bool? logInteractiveShells = null, OptionsUpdateEnvValueMode? envValueMode = null, IList? skillDirectories = null, IList? disabledSkills = null, bool? enableOnDemandInstructionDiscovery = null, IList? installedPlugins = null, bool? customAgentsLocalOnly = null, bool? skipCustomInstructions = null, IList? disabledInstructionSources = null, bool? coauthorEnabled = null, string? trajectoryFile = null, bool? enableStreaming = null, string? copilotUrl = null, bool? askUserDisabled = null, bool? continueOnAutoMode = null, bool? runningInInteractiveMode = null, bool? enableReasoningSummaries = null, string? agentContext = null, string? eventsLogDirectory = null, IList? additionalContentExclusionPolicies = null, bool? manageScheduleEnabled = null, CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionUpdateOptionsParams { SessionId = _session.SessionId, Model = model, ReasoningEffort = reasoningEffort, ClientName = clientName, LspClientName = lspClientName, IntegrationId = integrationId, FeatureFlags = featureFlags, IsExperimentalMode = isExperimentalMode, Provider = CopilotClient.ToJsonElementForWire(provider), WorkingDirectory = workingDirectory, AvailableTools = availableTools, ExcludedTools = excludedTools, EnableScriptSafety = enableScriptSafety, ShellInitProfile = shellInitProfile, ShellProcessFlags = shellProcessFlags, SandboxConfig = CopilotClient.ToJsonElementForWire(sandboxConfig), LogInteractiveShells = logInteractiveShells, EnvValueMode = envValueMode, SkillDirectories = skillDirectories, DisabledSkills = disabledSkills, EnableOnDemandInstructionDiscovery = enableOnDemandInstructionDiscovery, InstalledPlugins = installedPlugins, CustomAgentsLocalOnly = customAgentsLocalOnly, SkipCustomInstructions = skipCustomInstructions, DisabledInstructionSources = disabledInstructionSources, CoauthorEnabled = coauthorEnabled, TrajectoryFile = trajectoryFile, EnableStreaming = enableStreaming, CopilotUrl = copilotUrl, AskUserDisabled = askUserDisabled, ContinueOnAutoMode = continueOnAutoMode, RunningInInteractiveMode = runningInInteractiveMode, EnableReasoningSummaries = enableReasoningSummaries, AgentContext = agentContext, EventsLogDirectory = eventsLogDirectory, AdditionalContentExclusionPolicies = additionalContentExclusionPolicies?.Select(static v => CopilotClient.ToJsonElementForWire(v)!.Value).ToList(), ManageScheduleEnabled = manageScheduleEnabled }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.options.update", [request], cancellationToken); } } /// Provides session-scoped Lsp APIs. [Experimental(Diagnostics.Experimental)] public sealed class LspApi { private readonly CopilotSession _session; internal LspApi(CopilotSession session) { _session = session; } /// Loads the merged LSP configuration set for the session's working directory. /// Working directory used to load project-level LSP configs. Defaults to the session working directory when omitted. /// Git root used as the boundary when traversing for project-level LSP configs (supports monorepos). /// Force re-initialization even when LSP configs were already loaded for the working directory. /// The to monitor for cancellation requests. The default is . public async Task InitializeAsync(string? workingDirectory = null, string? gitRoot = null, bool? force = null, CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new LspInitializeRequest { SessionId = _session.SessionId, WorkingDirectory = workingDirectory, GitRoot = gitRoot, Force = force }; await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.lsp.initialize", [request], cancellationToken); } } /// Provides session-scoped Extensions APIs. [Experimental(Diagnostics.Experimental)] public sealed class ExtensionsApi { private readonly CopilotSession _session; internal ExtensionsApi(CopilotSession session) { _session = session; } /// Lists extensions discovered for the session and their current status. /// The to monitor for cancellation requests. The default is . /// Extensions discovered for the session, with their current status. public async Task ListAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionExtensionsListRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.extensions.list", [request], cancellationToken); } /// Enables an extension for the session. /// Source-qualified extension ID to enable. /// The to monitor for cancellation requests. The default is . public async Task EnableAsync(string id, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(id); _session.ThrowIfDisposed(); var request = new ExtensionsEnableRequest { SessionId = _session.SessionId, Id = id }; await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.extensions.enable", [request], cancellationToken); } /// Disables an extension for the session. /// Source-qualified extension ID to disable. /// The to monitor for cancellation requests. The default is . public async Task DisableAsync(string id, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(id); _session.ThrowIfDisposed(); var request = new ExtensionsDisableRequest { SessionId = _session.SessionId, Id = id }; await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.extensions.disable", [request], cancellationToken); } /// Reloads extension definitions and processes for the session. /// The to monitor for cancellation requests. The default is . public async Task ReloadAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionExtensionsReloadRequest { SessionId = _session.SessionId }; await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.extensions.reload", [request], cancellationToken); } } /// Provides session-scoped Tools APIs. [Experimental(Diagnostics.Experimental)] public sealed class ToolsApi { private readonly CopilotSession _session; internal ToolsApi(CopilotSession session) { _session = session; } /// Provides the result for a pending external tool call. /// Request ID of the pending tool call. /// Tool call result (string or expanded result object). /// Error message if the tool call failed. /// The to monitor for cancellation requests. The default is . /// Indicates whether the external tool call result was handled successfully. public async Task HandlePendingToolCallAsync(string requestId, object? result = null, string? error = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(requestId); _session.ThrowIfDisposed(); var request = new HandlePendingToolCallRequest { SessionId = _session.SessionId, RequestId = requestId, Result = CopilotClient.ToJsonElementForWire(result), Error = error }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.tools.handlePendingToolCall", [request], cancellationToken); } /// Resolves, builds, and validates the runtime tool list for the session. /// The to monitor for cancellation requests. The default is . /// Resolve, build, and validate the runtime tool list for this session. Subagent sessions and consumer flows that need an initialized tool set before `send` invoke this. Default base-class implementation is a no-op for sessions that don't support tool validation. public async Task InitializeAndValidateAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionToolsInitializeAndValidateRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.tools.initializeAndValidate", [request], cancellationToken); } } /// Provides session-scoped Commands APIs. [Experimental(Diagnostics.Experimental)] public sealed class CommandsApi { private readonly CopilotSession _session; internal CommandsApi(CopilotSession session) { _session = session; } /// Lists slash commands available in the session. /// Optional filters controlling which command sources to include in the listing. /// The to monitor for cancellation requests. The default is . /// Slash commands available in the session, after applying any include/exclude filters. public async Task ListAsync(CommandsListRequest? request = null, CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var rpcRequest = new CommandsListRequestWithSession { SessionId = _session.SessionId, IncludeBuiltins = request?.IncludeBuiltins, IncludeSkills = request?.IncludeSkills, IncludeClientCommands = request?.IncludeClientCommands }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.commands.list", [rpcRequest], cancellationToken); } /// Invokes a slash command in the session. /// Command name. Leading slashes are stripped and the name is matched case-insensitively. /// Raw input after the command name. /// The to monitor for cancellation requests. The default is . /// Result of invoking the slash command (text output, prompt to send to the agent, or completion). public async Task InvokeAsync(string name, string? input = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(name); _session.ThrowIfDisposed(); var request = new CommandsInvokeRequest { SessionId = _session.SessionId, Name = name, Input = input }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.commands.invoke", [request], cancellationToken); } /// Reports completion of a pending client-handled slash command. /// Request ID from the command invocation event. /// Error message if the command handler failed. /// The to monitor for cancellation requests. The default is . /// Indicates whether the pending client-handled command was completed successfully. public async Task HandlePendingCommandAsync(string requestId, string? error = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(requestId); _session.ThrowIfDisposed(); var request = new CommandsHandlePendingCommandRequest { SessionId = _session.SessionId, RequestId = requestId, Error = error }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.commands.handlePendingCommand", [request], cancellationToken); } /// Executes a slash command synchronously and returns any error. /// Name of the slash command to invoke (without the leading '/'). /// Argument string to pass to the command (empty string if none). /// The to monitor for cancellation requests. The default is . /// Error message produced while executing the command, if any. public async Task ExecuteAsync(string commandName, string args, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(commandName); ArgumentNullException.ThrowIfNull(args); _session.ThrowIfDisposed(); var request = new ExecuteCommandParams { SessionId = _session.SessionId, CommandName = commandName, Args = args }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.commands.execute", [request], cancellationToken); } /// Enqueues a slash command for FIFO processing on the local session. /// Slash-prefixed command string to enqueue, e.g. '/compact' or '/model gpt-4'. Queued FIFO with any in-flight items; if the session is idle, processing kicks off immediately. /// The to monitor for cancellation requests. The default is . /// Indicates whether the command was accepted into the local execution queue. public async Task EnqueueAsync(string command, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(command); _session.ThrowIfDisposed(); var request = new EnqueueCommandParams { SessionId = _session.SessionId, Command = command }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.commands.enqueue", [request], cancellationToken); } /// Reports whether the host actually executed a queued command and whether to continue processing. /// Request ID from the `command.queued` event the host is responding to. /// Result of the queued command execution. /// The to monitor for cancellation requests. The default is . /// Indicates whether the queued-command response was matched to a pending request. public async Task RespondToQueuedCommandAsync(string requestId, QueuedCommandResult result, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(requestId); ArgumentNullException.ThrowIfNull(result); _session.ThrowIfDisposed(); var request = new CommandsRespondToQueuedCommandRequest { SessionId = _session.SessionId, RequestId = requestId, Result = result }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.commands.respondToQueuedCommand", [request], cancellationToken); } } /// Provides session-scoped Telemetry APIs. [Experimental(Diagnostics.Experimental)] public sealed class TelemetryApi { private readonly CopilotSession _session; internal TelemetryApi(CopilotSession session) { _session = session; } /// Sets feature override key/value pairs to attach to subsequent telemetry events for the session. /// Override key/value pairs to attach to subsequent telemetry events from this session. Replaces any previously-set overrides. /// The to monitor for cancellation requests. The default is . public async Task SetFeatureOverridesAsync(IDictionary features, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(features); _session.ThrowIfDisposed(); var request = new TelemetrySetFeatureOverridesRequest { SessionId = _session.SessionId, Features = features }; await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.telemetry.setFeatureOverrides", [request], cancellationToken); } } /// Provides session-scoped Ui APIs. [Experimental(Diagnostics.Experimental)] public sealed class UiApi { private readonly CopilotSession _session; internal UiApi(CopilotSession session) { _session = session; } /// Requests structured input from a UI-capable client. /// Message describing what information is needed from the user. /// JSON Schema describing the form fields to present to the user. /// The to monitor for cancellation requests. The default is . /// The elicitation response (accept with form values, decline, or cancel). public async Task ElicitationAsync(string message, UIElicitationSchema requestedSchema, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(message); ArgumentNullException.ThrowIfNull(requestedSchema); _session.ThrowIfDisposed(); var request = new UIElicitationRequest { SessionId = _session.SessionId, Message = message, RequestedSchema = requestedSchema }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.ui.elicitation", [request], cancellationToken); } /// Provides the user response for a pending elicitation request. /// The unique request ID from the elicitation.requested event. /// The elicitation response (accept with form values, decline, or cancel). /// The to monitor for cancellation requests. The default is . /// Indicates whether the elicitation response was accepted; false if it was already resolved by another client. public async Task HandlePendingElicitationAsync(string requestId, UIElicitationResponse result, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(requestId); ArgumentNullException.ThrowIfNull(result); _session.ThrowIfDisposed(); var request = new UIHandlePendingElicitationRequest { SessionId = _session.SessionId, RequestId = requestId, Result = result }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.ui.handlePendingElicitation", [request], cancellationToken); } /// Resolves a pending `user_input.requested` event with the user's response. /// The unique request ID from the user_input.requested event. /// Schema for the `UIUserInputResponse` type. /// The to monitor for cancellation requests. The default is . /// Indicates whether the pending UI request was resolved by this call. public async Task HandlePendingUserInputAsync(string requestId, UIUserInputResponse response, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(requestId); ArgumentNullException.ThrowIfNull(response); _session.ThrowIfDisposed(); var request = new UIHandlePendingUserInputRequest { SessionId = _session.SessionId, RequestId = requestId, Response = response }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.ui.handlePendingUserInput", [request], cancellationToken); } /// Resolves a pending `sampling.requested` event with a sampling result, or rejects it. /// The unique request ID from the sampling.requested event. /// Optional sampling result payload. Omit to reject/cancel the sampling request without providing a result. /// The to monitor for cancellation requests. The default is . /// Indicates whether the pending UI request was resolved by this call. public async Task HandlePendingSamplingAsync(string requestId, UIHandlePendingSamplingResponse? response = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(requestId); _session.ThrowIfDisposed(); var request = new UIHandlePendingSamplingRequest { SessionId = _session.SessionId, RequestId = requestId, Response = response }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.ui.handlePendingSampling", [request], cancellationToken); } /// Resolves a pending `auto_mode_switch.requested` event with the user's accept/decline decision. /// The unique request ID from the auto_mode_switch.requested event. /// User's choice for auto-mode switching: yes (allow this turn), yes_always (allow + persist as setting), or no (decline). /// The to monitor for cancellation requests. The default is . /// Indicates whether the pending UI request was resolved by this call. public async Task HandlePendingAutoModeSwitchAsync(string requestId, UIAutoModeSwitchResponse response, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(requestId); _session.ThrowIfDisposed(); var request = new UIHandlePendingAutoModeSwitchRequest { SessionId = _session.SessionId, RequestId = requestId, Response = response }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.ui.handlePendingAutoModeSwitch", [request], cancellationToken); } /// Resolves a pending `exit_plan_mode.requested` event with the user's response. /// The unique request ID from the exit_plan_mode.requested event. /// Schema for the `UIExitPlanModeResponse` type. /// The to monitor for cancellation requests. The default is . /// Indicates whether the pending UI request was resolved by this call. public async Task HandlePendingExitPlanModeAsync(string requestId, UIExitPlanModeResponse response, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(requestId); ArgumentNullException.ThrowIfNull(response); _session.ThrowIfDisposed(); var request = new UIHandlePendingExitPlanModeRequest { SessionId = _session.SessionId, RequestId = requestId, Response = response }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.ui.handlePendingExitPlanMode", [request], cancellationToken); } /// Registers an in-process handler for auto-mode-switch requests so the server bridge skips dispatch. /// The to monitor for cancellation requests. The default is . /// Register an in-process handler for `auto_mode_switch.requested` events. The caller still attaches the actual listener via the standard event-subscription mechanism; this registration solely tells the server bridge to skip its own dispatch (so a remote client doesn't race the in-process handler for the same requestId). public async Task RegisterDirectAutoModeSwitchHandlerAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionUiRegisterDirectAutoModeSwitchHandlerRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.ui.registerDirectAutoModeSwitchHandler", [request], cancellationToken); } /// Unregisters a previously-registered in-process auto-mode-switch handler by its opaque handle. /// Handle previously returned by `registerDirectAutoModeSwitchHandler`. /// The to monitor for cancellation requests. The default is . /// Indicates whether the handle was active and the registration count was decremented. public async Task UnregisterDirectAutoModeSwitchHandlerAsync(string handle, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(handle); _session.ThrowIfDisposed(); var request = new UIUnregisterDirectAutoModeSwitchHandlerRequest { SessionId = _session.SessionId, Handle = handle }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.ui.unregisterDirectAutoModeSwitchHandler", [request], cancellationToken); } } /// Provides session-scoped Permissions APIs. [Experimental(Diagnostics.Experimental)] public sealed class PermissionsApi { private readonly CopilotSession _session; internal PermissionsApi(CopilotSession session) { _session = session; } /// Replaces selected permission policy fields (rules, paths, URLs, exclusions, allow-all flags) on the session. /// If specified, sets whether tool permission requests are auto-approved without prompting. Omit to leave the current value unchanged. /// If specified, sets whether path/URL read permission requests are auto-approved. Omit to leave the current value unchanged. /// If specified, replaces the session's approved/denied permission rules. Omit to leave the current rules unchanged. /// If specified, replaces the session's path-permission policy. The runtime constructs the appropriate PathManager based on these inputs (rooted at the session's working directory). Omit to leave the current path policy unchanged. /// If specified, replaces the session's URL-permission policy. The runtime constructs a fresh DefaultUrlManager based on these inputs. Omit to leave the current URL policy unchanged. /// If specified, replaces the host-supplied GitHub Content Exclusion policies on the session (combined with natively-discovered policies when evaluating tool/file access). Omit to leave the current policies unchanged. /// The to monitor for cancellation requests. The default is . /// Indicates whether the operation succeeded. public async Task ConfigureAsync(bool? approveAllToolPermissionRequests = null, bool? approveAllReadPermissionRequests = null, PermissionRulesSet? rules = null, PermissionPathsConfig? paths = null, PermissionUrlsConfig? urls = null, IList? additionalContentExclusionPolicies = null, CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new PermissionsConfigureParams { SessionId = _session.SessionId, ApproveAllToolPermissionRequests = approveAllToolPermissionRequests, ApproveAllReadPermissionRequests = approveAllReadPermissionRequests, Rules = rules, Paths = paths, Urls = urls, AdditionalContentExclusionPolicies = additionalContentExclusionPolicies }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.permissions.configure", [request], cancellationToken); } /// Provides a decision for a pending tool permission request. /// Request ID of the pending permission request. /// The client's response to the pending permission prompt. /// The to monitor for cancellation requests. The default is . /// Indicates whether the permission decision was applied; false when the request was already resolved. public async Task HandlePendingPermissionRequestAsync(string requestId, PermissionDecision result, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(requestId); ArgumentNullException.ThrowIfNull(result); _session.ThrowIfDisposed(); var request = new PermissionDecisionRequest { SessionId = _session.SessionId, RequestId = requestId, Result = result }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.permissions.handlePendingPermissionRequest", [request], cancellationToken); } /// Reconstructs the set of pending tool permission requests from the session's event history. /// The to monitor for cancellation requests. The default is . /// List of pending permission requests reconstructed from event history. public async Task PendingRequestsAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new PermissionsPendingRequestsRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.permissions.pendingRequests", [request], cancellationToken); } /// Enables or disables automatic approval of tool permission requests for the session. /// Whether to auto-approve all tool permission requests. /// Optional source for allow-all telemetry. Defaults to `rpc` when omitted for SDK callers. /// The to monitor for cancellation requests. The default is . /// Indicates whether the operation succeeded. public async Task SetApproveAllAsync(bool enabled, PermissionsSetApproveAllSource? source = null, CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new PermissionsSetApproveAllRequest { SessionId = _session.SessionId, Enabled = enabled, Source = source }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.permissions.setApproveAll", [request], cancellationToken); } /// Adds or removes session-scoped or location-scoped permission rules. /// Whether the change applies to ephemeral session-scoped rules (cleared at session end) or to location-scoped rules persisted via the location-permissions config file. /// Rules to add to the scope. Applied before `remove`/`removeAll`. /// Specific rules to remove from the scope. Ignored when `removeAll` is true. /// When true, removes every rule currently in the scope (after any `add` is applied). Useful for clearing the location scope wholesale. /// The to monitor for cancellation requests. The default is . /// Indicates whether the operation succeeded. public async Task ModifyRulesAsync(PermissionsModifyRulesScope scope, IList? add = null, IList? remove = null, bool? removeAll = null, CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new PermissionsModifyRulesParams { SessionId = _session.SessionId, Scope = scope, Add = add, Remove = remove, RemoveAll = removeAll }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.permissions.modifyRules", [request], cancellationToken); } /// Sets whether the client wants permission prompts bridged into session events. /// Whether the client wants `permission.requested` events bridged from the session-owned permission service. CLI clients that render prompt UI set this to `true` for as long as their listener is mounted; headless callers leave it unset (the default is `false`). /// The to monitor for cancellation requests. The default is . /// Indicates whether the operation succeeded. public async Task SetRequiredAsync(bool required, CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new PermissionsSetRequiredRequest { SessionId = _session.SessionId, Required = required }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.permissions.setRequired", [request], cancellationToken); } /// Clears session-scoped tool permission approvals. /// The to monitor for cancellation requests. The default is . /// Indicates whether the operation succeeded. public async Task ResetSessionApprovalsAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new PermissionsResetSessionApprovalsRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.permissions.resetSessionApprovals", [request], cancellationToken); } /// Notifies the runtime that a permission prompt UI has been shown to the user. /// Human-readable description of the prompt the user is being asked to approve. Used by the runtime to fire the registered `permission_prompt` notification hook (e.g. terminal bell, desktop notification). /// The to monitor for cancellation requests. The default is . /// Indicates whether the operation succeeded. public async Task NotifyPromptShownAsync(string message, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(message); _session.ThrowIfDisposed(); var request = new PermissionPromptShownNotification { SessionId = _session.SessionId, Message = message }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.permissions.notifyPromptShown", [request], cancellationToken); } /// Paths APIs. public PermissionsPathsApi Paths => field ?? Interlocked.CompareExchange(ref field, new(_session), null) ?? field; /// Locations APIs. public PermissionsLocationsApi Locations => field ?? Interlocked.CompareExchange(ref field, new(_session), null) ?? field; /// FolderTrust APIs. public PermissionsFolderTrustApi FolderTrust => field ?? Interlocked.CompareExchange(ref field, new(_session), null) ?? field; /// Urls APIs. public PermissionsUrlsApi Urls => field ?? Interlocked.CompareExchange(ref field, new(_session), null) ?? field; } /// Provides session-scoped PermissionsPaths APIs. [Experimental(Diagnostics.Experimental)] public sealed class PermissionsPathsApi { private readonly CopilotSession _session; internal PermissionsPathsApi(CopilotSession session) { _session = session; } /// Returns the session's allowed directories and primary working directory. /// The to monitor for cancellation requests. The default is . /// Snapshot of the session's allow-listed directories and primary working directory. public async Task ListAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new PermissionsPathsListRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.permissions.paths.list", [request], cancellationToken); } /// Adds a directory to the session's allow-list. /// Directory to add to the allow-list. The runtime resolves and validates the path before adding. /// The to monitor for cancellation requests. The default is . /// Indicates whether the operation succeeded. public async Task AddAsync(string path, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(path); _session.ThrowIfDisposed(); var request = new PermissionPathsAddParams { SessionId = _session.SessionId, Path = path }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.permissions.paths.add", [request], cancellationToken); } /// Updates the session's primary working directory used by the permission policy. /// Directory to set as the new primary working directory for the session's permission policy. /// The to monitor for cancellation requests. The default is . /// Indicates whether the operation succeeded. public async Task UpdatePrimaryAsync(string path, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(path); _session.ThrowIfDisposed(); var request = new PermissionPathsUpdatePrimaryParams { SessionId = _session.SessionId, Path = path }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.permissions.paths.updatePrimary", [request], cancellationToken); } /// Reports whether a path falls within any of the session's allowed directories. /// Path to check against the session's allowed directories. /// The to monitor for cancellation requests. The default is . /// Indicates whether the supplied path is within the session's allowed directories. public async Task IsPathWithinAllowedDirectoriesAsync(string path, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(path); _session.ThrowIfDisposed(); var request = new PermissionPathsAllowedCheckParams { SessionId = _session.SessionId, Path = path }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.permissions.paths.isPathWithinAllowedDirectories", [request], cancellationToken); } /// Reports whether a path falls within the session's workspace (primary) directory. /// Path to check against the session workspace directory. /// The to monitor for cancellation requests. The default is . /// Indicates whether the supplied path is within the session's workspace directory. public async Task IsPathWithinWorkspaceAsync(string path, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(path); _session.ThrowIfDisposed(); var request = new PermissionPathsWorkspaceCheckParams { SessionId = _session.SessionId, Path = path }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.permissions.paths.isPathWithinWorkspace", [request], cancellationToken); } } /// Provides session-scoped PermissionsLocations APIs. [Experimental(Diagnostics.Experimental)] public sealed class PermissionsLocationsApi { private readonly CopilotSession _session; internal PermissionsLocationsApi(CopilotSession session) { _session = session; } /// Resolves the permission location key and type for a working directory. /// Working directory whose permission location should be resolved. /// The to monitor for cancellation requests. The default is . /// Resolved location-permissions key and type. public async Task ResolveAsync(string workingDirectory, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(workingDirectory); _session.ThrowIfDisposed(); var request = new PermissionLocationResolveParams { SessionId = _session.SessionId, WorkingDirectory = workingDirectory }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.permissions.locations.resolve", [request], cancellationToken); } /// Applies persisted location-scoped tool approvals and allowed directories for a working directory to this session's permission service. /// Working directory whose persisted location permissions should be applied. /// The to monitor for cancellation requests. The default is . /// Summary of persisted location permissions applied to the session. public async Task ApplyAsync(string workingDirectory, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(workingDirectory); _session.ThrowIfDisposed(); var request = new PermissionLocationApplyParams { SessionId = _session.SessionId, WorkingDirectory = workingDirectory }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.permissions.locations.apply", [request], cancellationToken); } /// Persists a tool approval for a permission location and applies its rules to this session's live permission service. /// Location key (git root or cwd) to persist the approval to. /// Tool approval to persist and apply. /// The to monitor for cancellation requests. The default is . /// Indicates whether the operation succeeded. public async Task AddToolApprovalAsync(string locationKey, PermissionsLocationsAddToolApprovalDetails approval, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(locationKey); ArgumentNullException.ThrowIfNull(approval); _session.ThrowIfDisposed(); var request = new PermissionLocationAddToolApprovalParams { SessionId = _session.SessionId, LocationKey = locationKey, Approval = approval }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.permissions.locations.addToolApproval", [request], cancellationToken); } } /// Provides session-scoped PermissionsFolderTrust APIs. [Experimental(Diagnostics.Experimental)] public sealed class PermissionsFolderTrustApi { private readonly CopilotSession _session; internal PermissionsFolderTrustApi(CopilotSession session) { _session = session; } /// Reports whether a folder is trusted according to the user's folder trust state. /// Folder path to check. /// The to monitor for cancellation requests. The default is . /// Folder trust check result. public async Task IsTrustedAsync(string path, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(path); _session.ThrowIfDisposed(); var request = new FolderTrustCheckParams { SessionId = _session.SessionId, Path = path }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.permissions.folderTrust.isTrusted", [request], cancellationToken); } /// Adds a folder to the user's trusted folders list. /// Folder path to mark as trusted. /// The to monitor for cancellation requests. The default is . /// Indicates whether the operation succeeded. public async Task AddTrustedAsync(string path, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(path); _session.ThrowIfDisposed(); var request = new FolderTrustAddParams { SessionId = _session.SessionId, Path = path }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.permissions.folderTrust.addTrusted", [request], cancellationToken); } } /// Provides session-scoped PermissionsUrls APIs. [Experimental(Diagnostics.Experimental)] public sealed class PermissionsUrlsApi { private readonly CopilotSession _session; internal PermissionsUrlsApi(CopilotSession session) { _session = session; } /// Toggles the runtime's URL-permission policy between unrestricted and restricted modes. /// Whether to allow access to all URLs without prompting. Toggles the runtime's URL-permission policy in place. /// The to monitor for cancellation requests. The default is . /// Indicates whether the operation succeeded. public async Task SetUnrestrictedModeAsync(bool enabled, CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new PermissionUrlsSetUnrestrictedModeParams { SessionId = _session.SessionId, Enabled = enabled }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.permissions.urls.setUnrestrictedMode", [request], cancellationToken); } } /// Provides session-scoped Metadata APIs. [Experimental(Diagnostics.Experimental)] public sealed class MetadataApi { private readonly CopilotSession _session; internal MetadataApi(CopilotSession session) { _session = session; } /// Returns a snapshot of the session's identifying metadata, mode, agent, and remote info. /// The to monitor for cancellation requests. The default is . /// Point-in-time snapshot of slow-changing session identifier and state fields. public async Task SnapshotAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionMetadataSnapshotRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.metadata.snapshot", [request], cancellationToken); } /// Reports whether the local session is currently processing user/agent messages. /// The to monitor for cancellation requests. The default is . /// Indicates whether the local session is currently processing a turn or background continuation. public async Task IsProcessingAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionMetadataIsProcessingRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.metadata.isProcessing", [request], cancellationToken); } /// Returns the token breakdown for the session's current context window for a given model. /// Maximum prompt tokens allowed by the target model. Pass 0 to use the runtime default. /// Maximum output tokens allowed by the target model. Pass 0 if unknown. /// Model identifier used for tokenization. Omit to use the session default. Used both for token counting and to compute display values. /// The to monitor for cancellation requests. The default is . /// Token breakdown for the session's current context window, or null if uninitialized. public async Task ContextInfoAsync(long promptTokenLimit, long outputTokenLimit, string? selectedModel = null, CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new MetadataContextInfoRequest { SessionId = _session.SessionId, PromptTokenLimit = promptTokenLimit, OutputTokenLimit = outputTokenLimit, SelectedModel = selectedModel }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.metadata.contextInfo", [request], cancellationToken); } /// Records a working-directory/git context change and emits a `session.context_changed` event. /// Updated working directory and git context. Emitted as the new payload of `session.context_changed`. /// The to monitor for cancellation requests. The default is . /// Notify the session that its working directory context has changed. Emits a `session.context_changed` event so consumers (telemetry, OTel tracker, ACP, the timeline UI) can react. Use this when the host has detected a cwd/branch/repo change outside the session's normal lifecycle (e.g., after a shell command in interactive mode). public async Task RecordContextChangeAsync(SessionWorkingDirectoryContext context, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(context); _session.ThrowIfDisposed(); var request = new MetadataRecordContextChangeRequest { SessionId = _session.SessionId, Context = context }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.metadata.recordContextChange", [request], cancellationToken); } /// Updates the session's recorded working directory. /// Absolute path to set as the session's working directory. The runtime updates the session's recorded cwd so subsequent operations (shell tools, file lookups, telemetry) anchor to it. /// The to monitor for cancellation requests. The default is . /// Update the session's working directory. Used by the host when the user explicitly changes cwd (e.g., the `/cd` slash command). The host is responsible for `process.chdir` and any related side-effects (file index, etc.); this method only updates the session's own recorded path. public async Task SetWorkingDirectoryAsync(string workingDirectory, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(workingDirectory); _session.ThrowIfDisposed(); var request = new MetadataSetWorkingDirectoryRequest { SessionId = _session.SessionId, WorkingDirectory = workingDirectory }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.metadata.setWorkingDirectory", [request], cancellationToken); } /// Re-tokenizes the session's existing messages against a model and returns aggregate token totals. /// Model identifier used for tokenization. The runtime token-counts both chat-context and system-context messages against this model. /// The to monitor for cancellation requests. The default is . /// Re-tokenize the session's existing messages against `modelId` and return the token totals. Useful for hosts that want an initial estimate of context usage on session resume, before the next agent turn fires `session.context_info_changed` events. Returns zeros for an empty session. public async Task RecomputeContextTokensAsync(string modelId, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(modelId); _session.ThrowIfDisposed(); var request = new MetadataRecomputeContextTokensRequest { SessionId = _session.SessionId, ModelId = modelId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.metadata.recomputeContextTokens", [request], cancellationToken); } } /// Provides session-scoped Shell APIs. [Experimental(Diagnostics.Experimental)] public sealed class ShellApi { private readonly CopilotSession _session; internal ShellApi(CopilotSession session) { _session = session; } /// Starts a shell command and streams output through session notifications. /// Shell command to execute. /// Working directory (defaults to session working directory). /// Timeout in milliseconds (default: 30000). /// The to monitor for cancellation requests. The default is . /// Identifier of the spawned process, used to correlate streamed output and exit notifications. public async Task ExecAsync(string command, string? cwd = null, TimeSpan? timeout = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(command); _session.ThrowIfDisposed(); var request = new ShellExecRequest { SessionId = _session.SessionId, Command = command, Cwd = cwd, Timeout = timeout }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.shell.exec", [request], cancellationToken); } /// Sends a signal to a shell process previously started via "shell.exec". /// Process identifier returned by shell.exec. /// Signal to send (default: SIGTERM). /// The to monitor for cancellation requests. The default is . /// Indicates whether the signal was delivered; false if the process was unknown or already exited. public async Task KillAsync(string processId, ShellKillSignal? signal = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(processId); _session.ThrowIfDisposed(); var request = new ShellKillRequest { SessionId = _session.SessionId, ProcessId = processId, Signal = signal }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.shell.kill", [request], cancellationToken); } } /// Provides session-scoped History APIs. [Experimental(Diagnostics.Experimental)] public sealed class HistoryApi { private readonly CopilotSession _session; internal HistoryApi(CopilotSession session) { _session = session; } /// Compacts the session history to reduce context usage. /// Optional compaction parameters. /// The to monitor for cancellation requests. The default is . /// Compaction outcome with the number of tokens and messages removed, summary text, and the resulting context window breakdown. public async Task CompactAsync(HistoryCompactRequest? request = null, CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var rpcRequest = new HistoryCompactRequestWithSession { SessionId = _session.SessionId, CustomInstructions = request?.CustomInstructions }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.history.compact", [rpcRequest], cancellationToken); } /// Truncates persisted session history to a specific event. /// Event ID to truncate to. This event and all events after it are removed from the session. /// The to monitor for cancellation requests. The default is . /// Number of events that were removed by the truncation. public async Task TruncateAsync(string eventId, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(eventId); _session.ThrowIfDisposed(); var request = new HistoryTruncateRequest { SessionId = _session.SessionId, EventId = eventId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.history.truncate", [request], cancellationToken); } /// Cancels any in-progress background compaction on a local session. /// The to monitor for cancellation requests. The default is . /// Indicates whether an in-progress background compaction was cancelled. public async Task CancelBackgroundCompactionAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionHistoryCancelBackgroundCompactionRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.history.cancelBackgroundCompaction", [request], cancellationToken); } /// Aborts any in-progress manual compaction on a local session. /// The to monitor for cancellation requests. The default is . /// Indicates whether an in-progress manual compaction was aborted. public async Task AbortManualCompactionAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionHistoryAbortManualCompactionRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.history.abortManualCompaction", [request], cancellationToken); } /// Produces a markdown summary of the session's conversation context for hand-off scenarios. /// The to monitor for cancellation requests. The default is . /// Markdown summary of the conversation context (empty when not available). public async Task SummarizeForHandoffAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionHistorySummarizeForHandoffRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.history.summarizeForHandoff", [request], cancellationToken); } } /// Provides session-scoped Queue APIs. [Experimental(Diagnostics.Experimental)] public sealed class QueueApi { private readonly CopilotSession _session; internal QueueApi(CopilotSession session) { _session = session; } /// Returns the local session's pending user-facing queued items and steering messages. /// The to monitor for cancellation requests. The default is . /// Snapshot of the session's pending queued items and immediate-steering messages. public async Task PendingItemsAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionQueuePendingItemsRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.queue.pendingItems", [request], cancellationToken); } /// Removes the most recently queued user-facing item (LIFO). /// The to monitor for cancellation requests. The default is . /// Indicates whether a user-facing pending item was removed. public async Task RemoveMostRecentAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionQueueRemoveMostRecentRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.queue.removeMostRecent", [request], cancellationToken); } /// Clears all pending queued items on the local session. /// The to monitor for cancellation requests. The default is . public async Task ClearAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionQueueClearRequest { SessionId = _session.SessionId }; await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.queue.clear", [request], cancellationToken); } } /// Provides session-scoped EventLog APIs. [Experimental(Diagnostics.Experimental)] public sealed class EventLogApi { private readonly CopilotSession _session; internal EventLogApi(CopilotSession session) { _session = session; } /// Reads a batch of session events from a cursor, optionally waiting for new events. /// Opaque cursor returned by a previous read. Omit on the first call to start from the beginning of the session's persisted history. /// Maximum number of events to return in this batch (1–1000, default 200). /// Milliseconds to wait for new events when the cursor is at the tail of history. 0 (default) returns immediately even if no events are available. Capped at 30000ms. Ephemeral events that arrive during the wait are delivered in this batch but are NOT replayable on a subsequent read (use a non-zero waitMs in your next call to capture future ephemerals as they happen). /// Either '*' to receive all event types, or a non-empty list of event types to receive. /// Agent-scope filter: 'primary' returns only main-agent events plus events whose type starts with 'subagent.' (matching the typed-subscription default behavior); 'all' returns events from all agents (matching wildcard-subscription behavior). Default is 'all' to preserve wildcard semantics for catch-up callers. /// The to monitor for cancellation requests. The default is . /// Batch of session events returned by a read, with cursor and continuation metadata. public async Task ReadAsync(string? cursor = null, int? max = null, TimeSpan? waitMs = null, object? types = null, EventsAgentScope? agentScope = null, CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new EventLogReadRequest { SessionId = _session.SessionId, Cursor = cursor, Max = max, Wait = waitMs, Types = CopilotClient.ToJsonElementForWire(types), AgentScope = agentScope }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.eventLog.read", [request], cancellationToken); } /// Returns a snapshot of the current tail cursor without consuming events. /// The to monitor for cancellation requests. The default is . /// Snapshot of the current tail cursor without returning any events. Use this when a consumer wants to subscribe to live events going forward without first paginating through the entire persisted history (which would happen if `read` were called without a cursor on a long-lived session). public async Task TailAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionEventLogTailRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.eventLog.tail", [request], cancellationToken); } /// Registers consumer interest in an event type for runtime gating purposes. /// The event type the consumer wants the runtime to treat as 'observed' for behavior-switching gating. Some runtime code paths inspect whether any consumer is interested in a specific event type and choose a different implementation accordingly (e.g. `mcp.oauth_required`: when interest is registered the runtime delegates the full interactive OAuth flow to the consumer; when no interest is registered the runtime installs a browserless fallback that silently reuses cached tokens). SDK clients that long-poll events do NOT automatically appear as listeners to these gating checks — they must explicitly call `registerInterest` for each event type they want the runtime to count as having a consumer. Multiple registrations for the same event type from the same or different consumers are tracked independently and must each be released. See: `mcp.oauth_required`, `sampling.requested`, `auto_mode_switch.requested`, `user_input.requested`, `elicitation.requested`, `command.queued`, `exit_plan_mode.requested`. /// The to monitor for cancellation requests. The default is . /// Opaque handle representing an event-type interest registration. public async Task RegisterInterestAsync(string eventType, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(eventType); _session.ThrowIfDisposed(); var request = new RegisterEventInterestParams { SessionId = _session.SessionId, EventType = eventType }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.eventLog.registerInterest", [request], cancellationToken); } /// Releases a consumer's previously-registered interest in an event type. /// Handle returned by a previous `registerInterest` call. Idempotent: releasing an unknown or already-released handle is a no-op (returns success). When the last outstanding handle for an event type is released, the runtime reverts to its 'no consumer' code path for that event type. /// The to monitor for cancellation requests. The default is . /// Indicates whether the operation succeeded. public async Task ReleaseInterestAsync(string handle, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(handle); _session.ThrowIfDisposed(); var request = new ReleaseEventInterestParams { SessionId = _session.SessionId, Handle = handle }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.eventLog.releaseInterest", [request], cancellationToken); } } /// Provides session-scoped Usage APIs. [Experimental(Diagnostics.Experimental)] public sealed class UsageApi { private readonly CopilotSession _session; internal UsageApi(CopilotSession session) { _session = session; } /// Gets accumulated usage metrics for the session. /// The to monitor for cancellation requests. The default is . /// Accumulated session usage metrics, including premium request cost, token counts, model breakdown, and code-change totals. public async Task GetMetricsAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionUsageGetMetricsRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.usage.getMetrics", [request], cancellationToken); } } /// Provides session-scoped Remote APIs. [Experimental(Diagnostics.Experimental)] public sealed class RemoteApi { private readonly CopilotSession _session; internal RemoteApi(CopilotSession session) { _session = session; } /// Enables remote session export or steering. /// Per-session remote mode. "off" disables remote, "export" exports session events to GitHub without enabling remote steering, "on" enables both export and remote steering. /// The to monitor for cancellation requests. The default is . /// GitHub URL for the session and a flag indicating whether remote steering is enabled. public async Task EnableAsync(RemoteSessionMode? mode = null, CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new RemoteEnableRequest { SessionId = _session.SessionId, Mode = mode }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.remote.enable", [request], cancellationToken); } /// Disables remote session export and steering. /// The to monitor for cancellation requests. The default is . public async Task DisableAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionRemoteDisableRequest { SessionId = _session.SessionId }; await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.remote.disable", [request], cancellationToken); } /// Persists a remote-steerability change emitted by the host as a session event. /// Whether the session now supports remote steering via GitHub. The runtime persists this as a `session.remote_steerable_changed` event so resume/replay sees the up-to-date capability. /// The to monitor for cancellation requests. The default is . /// Persist a steerability change as a `session.remote_steerable_changed` event. Used by the host (CLI / SDK consumer) when it has just finished enabling or disabling steering on a remote exporter that the runtime does not directly own. public async Task NotifySteerableChangedAsync(bool remoteSteerable, CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new RemoteNotifySteerableChangedRequest { SessionId = _session.SessionId, RemoteSteerable = remoteSteerable }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.remote.notifySteerableChanged", [request], cancellationToken); } } /// Provides session-scoped Schedule APIs. [Experimental(Diagnostics.Experimental)] public sealed class ScheduleApi { private readonly CopilotSession _session; internal ScheduleApi(CopilotSession session) { _session = session; } /// Lists the session's currently active scheduled prompts. /// The to monitor for cancellation requests. The default is . /// Snapshot of the currently active recurring prompts for this session. public async Task ListAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionScheduleListRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.schedule.list", [request], cancellationToken); } /// Removes a scheduled prompt by id. /// Id of the scheduled prompt to remove. /// The to monitor for cancellation requests. The default is . /// Remove a scheduled prompt by id. The result entry is omitted if the id was unknown. public async Task StopAsync(long id, CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new ScheduleStopRequest { SessionId = _session.SessionId, Id = id }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.schedule.stop", [request], cancellationToken); } } /// Handles `sessionFs` client session API methods. public interface ISessionFsHandler { /// Reads a file from the client-provided session filesystem. /// Path of the file to read from the client-provided session filesystem. /// The to monitor for cancellation requests. The default is . /// File content as a UTF-8 string, or a filesystem error if the read failed. Task ReadFileAsync(SessionFsReadFileRequest request, CancellationToken cancellationToken = default); /// Writes a file in the client-provided session filesystem. /// File path, content to write, and optional mode for the client-provided session filesystem. /// The to monitor for cancellation requests. The default is . /// Describes a filesystem error. Task WriteFileAsync(SessionFsWriteFileRequest request, CancellationToken cancellationToken = default); /// Appends content to a file in the client-provided session filesystem. /// File path, content to append, and optional mode for the client-provided session filesystem. /// The to monitor for cancellation requests. The default is . /// Describes a filesystem error. Task AppendFileAsync(SessionFsAppendFileRequest request, CancellationToken cancellationToken = default); /// Checks whether a path exists in the client-provided session filesystem. /// Path to test for existence in the client-provided session filesystem. /// The to monitor for cancellation requests. The default is . /// Indicates whether the requested path exists in the client-provided session filesystem. Task ExistsAsync(SessionFsExistsRequest request, CancellationToken cancellationToken = default); /// Gets metadata for a path in the client-provided session filesystem. /// Path whose metadata should be returned from the client-provided session filesystem. /// The to monitor for cancellation requests. The default is . /// Filesystem metadata for the requested path, or a filesystem error if the stat failed. Task StatAsync(SessionFsStatRequest request, CancellationToken cancellationToken = default); /// Creates a directory in the client-provided session filesystem. /// Directory path to create in the client-provided session filesystem, with options for recursive creation and POSIX mode. /// The to monitor for cancellation requests. The default is . /// Describes a filesystem error. Task MkdirAsync(SessionFsMkdirRequest request, CancellationToken cancellationToken = default); /// Lists entry names in a directory from the client-provided session filesystem. /// Directory path whose entries should be listed from the client-provided session filesystem. /// The to monitor for cancellation requests. The default is . /// Names of entries in the requested directory, or a filesystem error if the read failed. Task ReaddirAsync(SessionFsReaddirRequest request, CancellationToken cancellationToken = default); /// Lists directory entries with type information from the client-provided session filesystem. /// Directory path whose entries (with type information) should be listed from the client-provided session filesystem. /// The to monitor for cancellation requests. The default is . /// Entries in the requested directory paired with file/directory type information, or a filesystem error if the read failed. Task ReaddirWithTypesAsync(SessionFsReaddirWithTypesRequest request, CancellationToken cancellationToken = default); /// Removes a file or directory from the client-provided session filesystem. /// Path to remove from the client-provided session filesystem, with options for recursive removal and force. /// The to monitor for cancellation requests. The default is . /// Describes a filesystem error. Task RmAsync(SessionFsRmRequest request, CancellationToken cancellationToken = default); /// Renames or moves a path in the client-provided session filesystem. /// Source and destination paths for renaming or moving an entry in the client-provided session filesystem. /// The to monitor for cancellation requests. The default is . /// Describes a filesystem error. Task RenameAsync(SessionFsRenameRequest request, CancellationToken cancellationToken = default); /// Executes a SQLite query against the per-session database. /// SQL query, query type, and optional bind parameters for executing a SQLite query against the per-session database. /// The to monitor for cancellation requests. The default is . /// Query results including rows, columns, and rows affected, or a filesystem error if execution failed. Task SqliteQueryAsync(SessionFsSqliteQueryRequest request, CancellationToken cancellationToken = default); /// Checks whether the per-session SQLite database already exists, without creating it. /// Identifies the target session. /// The to monitor for cancellation requests. The default is . /// Indicates whether the per-session SQLite database already exists. Task SqliteExistsAsync(SessionFsSqliteExistsRequest request, CancellationToken cancellationToken = default); } /// Provides all client session API handler groups for a session. public sealed class ClientSessionApiHandlers { /// Optional handler for SessionFs client session API methods. public ISessionFsHandler? SessionFs { get; set; } } /// Registers client session API handlers on a JSON-RPC connection. internal static class ClientSessionApiRegistration { /// /// Registers handlers for server-to-client session API calls. /// Each incoming call includes a sessionId in its params object, /// which is used to resolve the session's handler group. /// public static void RegisterClientSessionApiHandlers(JsonRpc rpc, Func getHandlers) { rpc.SetLocalRpcMethod("sessionFs.readFile", (Func>)(async (request, cancellationToken) => { var handler = getHandlers(request.SessionId).SessionFs; if (handler is null) throw new InvalidOperationException($"No sessionFs handler registered for session: {request.SessionId}"); return await handler.ReadFileAsync(request, cancellationToken); }), singleObjectParam: true); rpc.SetLocalRpcMethod("sessionFs.writeFile", (Func>)(async (request, cancellationToken) => { var handler = getHandlers(request.SessionId).SessionFs; if (handler is null) throw new InvalidOperationException($"No sessionFs handler registered for session: {request.SessionId}"); return await handler.WriteFileAsync(request, cancellationToken); }), singleObjectParam: true); rpc.SetLocalRpcMethod("sessionFs.appendFile", (Func>)(async (request, cancellationToken) => { var handler = getHandlers(request.SessionId).SessionFs; if (handler is null) throw new InvalidOperationException($"No sessionFs handler registered for session: {request.SessionId}"); return await handler.AppendFileAsync(request, cancellationToken); }), singleObjectParam: true); rpc.SetLocalRpcMethod("sessionFs.exists", (Func>)(async (request, cancellationToken) => { var handler = getHandlers(request.SessionId).SessionFs; if (handler is null) throw new InvalidOperationException($"No sessionFs handler registered for session: {request.SessionId}"); return await handler.ExistsAsync(request, cancellationToken); }), singleObjectParam: true); rpc.SetLocalRpcMethod("sessionFs.stat", (Func>)(async (request, cancellationToken) => { var handler = getHandlers(request.SessionId).SessionFs; if (handler is null) throw new InvalidOperationException($"No sessionFs handler registered for session: {request.SessionId}"); return await handler.StatAsync(request, cancellationToken); }), singleObjectParam: true); rpc.SetLocalRpcMethod("sessionFs.mkdir", (Func>)(async (request, cancellationToken) => { var handler = getHandlers(request.SessionId).SessionFs; if (handler is null) throw new InvalidOperationException($"No sessionFs handler registered for session: {request.SessionId}"); return await handler.MkdirAsync(request, cancellationToken); }), singleObjectParam: true); rpc.SetLocalRpcMethod("sessionFs.readdir", (Func>)(async (request, cancellationToken) => { var handler = getHandlers(request.SessionId).SessionFs; if (handler is null) throw new InvalidOperationException($"No sessionFs handler registered for session: {request.SessionId}"); return await handler.ReaddirAsync(request, cancellationToken); }), singleObjectParam: true); rpc.SetLocalRpcMethod("sessionFs.readdirWithTypes", (Func>)(async (request, cancellationToken) => { var handler = getHandlers(request.SessionId).SessionFs; if (handler is null) throw new InvalidOperationException($"No sessionFs handler registered for session: {request.SessionId}"); return await handler.ReaddirWithTypesAsync(request, cancellationToken); }), singleObjectParam: true); rpc.SetLocalRpcMethod("sessionFs.rm", (Func>)(async (request, cancellationToken) => { var handler = getHandlers(request.SessionId).SessionFs; if (handler is null) throw new InvalidOperationException($"No sessionFs handler registered for session: {request.SessionId}"); return await handler.RmAsync(request, cancellationToken); }), singleObjectParam: true); rpc.SetLocalRpcMethod("sessionFs.rename", (Func>)(async (request, cancellationToken) => { var handler = getHandlers(request.SessionId).SessionFs; if (handler is null) throw new InvalidOperationException($"No sessionFs handler registered for session: {request.SessionId}"); return await handler.RenameAsync(request, cancellationToken); }), singleObjectParam: true); rpc.SetLocalRpcMethod("sessionFs.sqliteQuery", (Func>)(async (request, cancellationToken) => { var handler = getHandlers(request.SessionId).SessionFs; if (handler is null) throw new InvalidOperationException($"No sessionFs handler registered for session: {request.SessionId}"); return await handler.SqliteQueryAsync(request, cancellationToken); }), singleObjectParam: true); rpc.SetLocalRpcMethod("sessionFs.sqliteExists", (Func>)(async (request, cancellationToken) => { var handler = getHandlers(request.SessionId).SessionFs; if (handler is null) throw new InvalidOperationException($"No sessionFs handler registered for session: {request.SessionId}"); return await handler.SqliteExistsAsync(request, cancellationToken); }), singleObjectParam: true); } } [JsonSourceGenerationOptions( JsonSerializerDefaults.Web, AllowOutOfOrderMetadataProperties = true, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)] [JsonSerializable(typeof(bool))] [JsonSerializable(typeof(double))] [JsonSerializable(typeof(int))] [JsonSerializable(typeof(long))] [JsonSerializable(typeof(string))] [JsonSerializable(typeof(GitHub.Copilot.AbortData), TypeInfoPropertyName = "SessionEventsAbortData")] [JsonSerializable(typeof(GitHub.Copilot.AbortEvent), TypeInfoPropertyName = "SessionEventsAbortEvent")] [JsonSerializable(typeof(GitHub.Copilot.AbortReason), TypeInfoPropertyName = "SessionEventsAbortReason")] [JsonSerializable(typeof(GitHub.Copilot.AssistantIntentData), TypeInfoPropertyName = "SessionEventsAssistantIntentData")] [JsonSerializable(typeof(GitHub.Copilot.AssistantIntentEvent), TypeInfoPropertyName = "SessionEventsAssistantIntentEvent")] [JsonSerializable(typeof(GitHub.Copilot.AssistantMessageData), TypeInfoPropertyName = "SessionEventsAssistantMessageData")] [JsonSerializable(typeof(GitHub.Copilot.AssistantMessageDeltaData), TypeInfoPropertyName = "SessionEventsAssistantMessageDeltaData")] [JsonSerializable(typeof(GitHub.Copilot.AssistantMessageDeltaEvent), TypeInfoPropertyName = "SessionEventsAssistantMessageDeltaEvent")] [JsonSerializable(typeof(GitHub.Copilot.AssistantMessageEvent), TypeInfoPropertyName = "SessionEventsAssistantMessageEvent")] [JsonSerializable(typeof(GitHub.Copilot.AssistantMessageStartData), TypeInfoPropertyName = "SessionEventsAssistantMessageStartData")] [JsonSerializable(typeof(GitHub.Copilot.AssistantMessageStartEvent), TypeInfoPropertyName = "SessionEventsAssistantMessageStartEvent")] [JsonSerializable(typeof(GitHub.Copilot.AssistantMessageToolRequest), TypeInfoPropertyName = "SessionEventsAssistantMessageToolRequest")] [JsonSerializable(typeof(GitHub.Copilot.AssistantMessageToolRequestType), TypeInfoPropertyName = "SessionEventsAssistantMessageToolRequestType")] [JsonSerializable(typeof(GitHub.Copilot.AssistantReasoningData), TypeInfoPropertyName = "SessionEventsAssistantReasoningData")] [JsonSerializable(typeof(GitHub.Copilot.AssistantReasoningDeltaData), TypeInfoPropertyName = "SessionEventsAssistantReasoningDeltaData")] [JsonSerializable(typeof(GitHub.Copilot.AssistantReasoningDeltaEvent), TypeInfoPropertyName = "SessionEventsAssistantReasoningDeltaEvent")] [JsonSerializable(typeof(GitHub.Copilot.AssistantReasoningEvent), TypeInfoPropertyName = "SessionEventsAssistantReasoningEvent")] [JsonSerializable(typeof(GitHub.Copilot.AssistantStreamingDeltaData), TypeInfoPropertyName = "SessionEventsAssistantStreamingDeltaData")] [JsonSerializable(typeof(GitHub.Copilot.AssistantStreamingDeltaEvent), TypeInfoPropertyName = "SessionEventsAssistantStreamingDeltaEvent")] [JsonSerializable(typeof(GitHub.Copilot.AssistantTurnEndData), TypeInfoPropertyName = "SessionEventsAssistantTurnEndData")] [JsonSerializable(typeof(GitHub.Copilot.AssistantTurnEndEvent), TypeInfoPropertyName = "SessionEventsAssistantTurnEndEvent")] [JsonSerializable(typeof(GitHub.Copilot.AssistantTurnStartData), TypeInfoPropertyName = "SessionEventsAssistantTurnStartData")] [JsonSerializable(typeof(GitHub.Copilot.AssistantTurnStartEvent), TypeInfoPropertyName = "SessionEventsAssistantTurnStartEvent")] [JsonSerializable(typeof(GitHub.Copilot.AssistantUsageApiEndpoint), TypeInfoPropertyName = "SessionEventsAssistantUsageApiEndpoint")] [JsonSerializable(typeof(GitHub.Copilot.AssistantUsageCopilotUsageTokenDetail), TypeInfoPropertyName = "SessionEventsAssistantUsageCopilotUsageTokenDetail")] [JsonSerializable(typeof(GitHub.Copilot.AssistantUsageData), TypeInfoPropertyName = "SessionEventsAssistantUsageData")] [JsonSerializable(typeof(GitHub.Copilot.AssistantUsageEvent), TypeInfoPropertyName = "SessionEventsAssistantUsageEvent")] [JsonSerializable(typeof(GitHub.Copilot.AutoModeSwitchCompletedData), TypeInfoPropertyName = "SessionEventsAutoModeSwitchCompletedData")] [JsonSerializable(typeof(GitHub.Copilot.AutoModeSwitchCompletedEvent), TypeInfoPropertyName = "SessionEventsAutoModeSwitchCompletedEvent")] [JsonSerializable(typeof(GitHub.Copilot.AutoModeSwitchRequestedData), TypeInfoPropertyName = "SessionEventsAutoModeSwitchRequestedData")] [JsonSerializable(typeof(GitHub.Copilot.AutoModeSwitchRequestedEvent), TypeInfoPropertyName = "SessionEventsAutoModeSwitchRequestedEvent")] [JsonSerializable(typeof(GitHub.Copilot.AutoModeSwitchResponse), TypeInfoPropertyName = "SessionEventsAutoModeSwitchResponse")] [JsonSerializable(typeof(GitHub.Copilot.CapabilitiesChangedData), TypeInfoPropertyName = "SessionEventsCapabilitiesChangedData")] [JsonSerializable(typeof(GitHub.Copilot.CapabilitiesChangedEvent), TypeInfoPropertyName = "SessionEventsCapabilitiesChangedEvent")] [JsonSerializable(typeof(GitHub.Copilot.CapabilitiesChangedUI), TypeInfoPropertyName = "SessionEventsCapabilitiesChangedUI")] [JsonSerializable(typeof(GitHub.Copilot.CommandCompletedData), TypeInfoPropertyName = "SessionEventsCommandCompletedData")] [JsonSerializable(typeof(GitHub.Copilot.CommandCompletedEvent), TypeInfoPropertyName = "SessionEventsCommandCompletedEvent")] [JsonSerializable(typeof(GitHub.Copilot.CommandExecuteData), TypeInfoPropertyName = "SessionEventsCommandExecuteData")] [JsonSerializable(typeof(GitHub.Copilot.CommandExecuteEvent), TypeInfoPropertyName = "SessionEventsCommandExecuteEvent")] [JsonSerializable(typeof(GitHub.Copilot.CommandQueuedData), TypeInfoPropertyName = "SessionEventsCommandQueuedData")] [JsonSerializable(typeof(GitHub.Copilot.CommandQueuedEvent), TypeInfoPropertyName = "SessionEventsCommandQueuedEvent")] [JsonSerializable(typeof(GitHub.Copilot.CommandsChangedCommand), TypeInfoPropertyName = "SessionEventsCommandsChangedCommand")] [JsonSerializable(typeof(GitHub.Copilot.CommandsChangedData), TypeInfoPropertyName = "SessionEventsCommandsChangedData")] [JsonSerializable(typeof(GitHub.Copilot.CommandsChangedEvent), TypeInfoPropertyName = "SessionEventsCommandsChangedEvent")] [JsonSerializable(typeof(GitHub.Copilot.CompactionCompleteCompactionTokensUsed), TypeInfoPropertyName = "SessionEventsCompactionCompleteCompactionTokensUsed")] [JsonSerializable(typeof(GitHub.Copilot.CompactionCompleteCompactionTokensUsedCopilotUsageTokenDetail), TypeInfoPropertyName = "SessionEventsCompactionCompleteCompactionTokensUsedCopilotUsageTokenDetail")] [JsonSerializable(typeof(GitHub.Copilot.CustomAgentsUpdatedAgent), TypeInfoPropertyName = "SessionEventsCustomAgentsUpdatedAgent")] [JsonSerializable(typeof(GitHub.Copilot.ElicitationCompletedAction), TypeInfoPropertyName = "SessionEventsElicitationCompletedAction")] [JsonSerializable(typeof(GitHub.Copilot.ElicitationCompletedData), TypeInfoPropertyName = "SessionEventsElicitationCompletedData")] [JsonSerializable(typeof(GitHub.Copilot.ElicitationCompletedEvent), TypeInfoPropertyName = "SessionEventsElicitationCompletedEvent")] [JsonSerializable(typeof(GitHub.Copilot.ElicitationRequestedData), TypeInfoPropertyName = "SessionEventsElicitationRequestedData")] [JsonSerializable(typeof(GitHub.Copilot.ElicitationRequestedEvent), TypeInfoPropertyName = "SessionEventsElicitationRequestedEvent")] [JsonSerializable(typeof(GitHub.Copilot.ElicitationRequestedMode), TypeInfoPropertyName = "SessionEventsElicitationRequestedMode")] [JsonSerializable(typeof(GitHub.Copilot.ElicitationRequestedSchema), TypeInfoPropertyName = "SessionEventsElicitationRequestedSchema")] [JsonSerializable(typeof(GitHub.Copilot.EmbeddedBlobResourceContents), TypeInfoPropertyName = "SessionEventsEmbeddedBlobResourceContents")] [JsonSerializable(typeof(GitHub.Copilot.EmbeddedTextResourceContents), TypeInfoPropertyName = "SessionEventsEmbeddedTextResourceContents")] [JsonSerializable(typeof(GitHub.Copilot.ExitPlanModeAction), TypeInfoPropertyName = "SessionEventsExitPlanModeAction")] [JsonSerializable(typeof(GitHub.Copilot.ExitPlanModeCompletedData), TypeInfoPropertyName = "SessionEventsExitPlanModeCompletedData")] [JsonSerializable(typeof(GitHub.Copilot.ExitPlanModeCompletedEvent), TypeInfoPropertyName = "SessionEventsExitPlanModeCompletedEvent")] [JsonSerializable(typeof(GitHub.Copilot.ExitPlanModeRequestedData), TypeInfoPropertyName = "SessionEventsExitPlanModeRequestedData")] [JsonSerializable(typeof(GitHub.Copilot.ExitPlanModeRequestedEvent), TypeInfoPropertyName = "SessionEventsExitPlanModeRequestedEvent")] [JsonSerializable(typeof(GitHub.Copilot.ExtensionsLoadedExtension), TypeInfoPropertyName = "SessionEventsExtensionsLoadedExtension")] [JsonSerializable(typeof(GitHub.Copilot.ExtensionsLoadedExtensionSource), TypeInfoPropertyName = "SessionEventsExtensionsLoadedExtensionSource")] [JsonSerializable(typeof(GitHub.Copilot.ExtensionsLoadedExtensionStatus), TypeInfoPropertyName = "SessionEventsExtensionsLoadedExtensionStatus")] [JsonSerializable(typeof(GitHub.Copilot.ExternalToolCompletedData), TypeInfoPropertyName = "SessionEventsExternalToolCompletedData")] [JsonSerializable(typeof(GitHub.Copilot.ExternalToolCompletedEvent), TypeInfoPropertyName = "SessionEventsExternalToolCompletedEvent")] [JsonSerializable(typeof(GitHub.Copilot.ExternalToolRequestedData), TypeInfoPropertyName = "SessionEventsExternalToolRequestedData")] [JsonSerializable(typeof(GitHub.Copilot.ExternalToolRequestedEvent), TypeInfoPropertyName = "SessionEventsExternalToolRequestedEvent")] [JsonSerializable(typeof(GitHub.Copilot.HandoffRepository), TypeInfoPropertyName = "SessionEventsHandoffRepository")] [JsonSerializable(typeof(GitHub.Copilot.HandoffSourceType), TypeInfoPropertyName = "SessionEventsHandoffSourceType")] [JsonSerializable(typeof(GitHub.Copilot.HookEndData), TypeInfoPropertyName = "SessionEventsHookEndData")] [JsonSerializable(typeof(GitHub.Copilot.HookEndError), TypeInfoPropertyName = "SessionEventsHookEndError")] [JsonSerializable(typeof(GitHub.Copilot.HookEndEvent), TypeInfoPropertyName = "SessionEventsHookEndEvent")] [JsonSerializable(typeof(GitHub.Copilot.HookStartData), TypeInfoPropertyName = "SessionEventsHookStartData")] [JsonSerializable(typeof(GitHub.Copilot.HookStartEvent), TypeInfoPropertyName = "SessionEventsHookStartEvent")] [JsonSerializable(typeof(GitHub.Copilot.McpOauthCompletedData), TypeInfoPropertyName = "SessionEventsMcpOauthCompletedData")] [JsonSerializable(typeof(GitHub.Copilot.McpOauthCompletedEvent), TypeInfoPropertyName = "SessionEventsMcpOauthCompletedEvent")] [JsonSerializable(typeof(GitHub.Copilot.McpOauthRequiredData), TypeInfoPropertyName = "SessionEventsMcpOauthRequiredData")] [JsonSerializable(typeof(GitHub.Copilot.McpOauthRequiredEvent), TypeInfoPropertyName = "SessionEventsMcpOauthRequiredEvent")] [JsonSerializable(typeof(GitHub.Copilot.McpOauthRequiredStaticClientConfig), TypeInfoPropertyName = "SessionEventsMcpOauthRequiredStaticClientConfig")] [JsonSerializable(typeof(GitHub.Copilot.McpServerSource), TypeInfoPropertyName = "SessionEventsMcpServerSource")] [JsonSerializable(typeof(GitHub.Copilot.McpServerStatus), TypeInfoPropertyName = "SessionEventsMcpServerStatus")] [JsonSerializable(typeof(GitHub.Copilot.McpServersLoadedServer), TypeInfoPropertyName = "SessionEventsMcpServersLoadedServer")] [JsonSerializable(typeof(GitHub.Copilot.ModelCallFailureData), TypeInfoPropertyName = "SessionEventsModelCallFailureData")] [JsonSerializable(typeof(GitHub.Copilot.ModelCallFailureEvent), TypeInfoPropertyName = "SessionEventsModelCallFailureEvent")] [JsonSerializable(typeof(GitHub.Copilot.ModelCallFailureSource), TypeInfoPropertyName = "SessionEventsModelCallFailureSource")] [JsonSerializable(typeof(GitHub.Copilot.PendingMessagesModifiedData), TypeInfoPropertyName = "SessionEventsPendingMessagesModifiedData")] [JsonSerializable(typeof(GitHub.Copilot.PendingMessagesModifiedEvent), TypeInfoPropertyName = "SessionEventsPendingMessagesModifiedEvent")] [JsonSerializable(typeof(GitHub.Copilot.PermissionCompletedData), TypeInfoPropertyName = "SessionEventsPermissionCompletedData")] [JsonSerializable(typeof(GitHub.Copilot.PermissionCompletedEvent), TypeInfoPropertyName = "SessionEventsPermissionCompletedEvent")] [JsonSerializable(typeof(GitHub.Copilot.PermissionPromptRequest), TypeInfoPropertyName = "SessionEventsPermissionPromptRequest")] [JsonSerializable(typeof(GitHub.Copilot.PermissionPromptRequestCommands), TypeInfoPropertyName = "SessionEventsPermissionPromptRequestCommands")] [JsonSerializable(typeof(GitHub.Copilot.PermissionPromptRequestCustomTool), TypeInfoPropertyName = "SessionEventsPermissionPromptRequestCustomTool")] [JsonSerializable(typeof(GitHub.Copilot.PermissionPromptRequestExtensionManagement), TypeInfoPropertyName = "SessionEventsPermissionPromptRequestExtensionManagement")] [JsonSerializable(typeof(GitHub.Copilot.PermissionPromptRequestExtensionPermissionAccess), TypeInfoPropertyName = "SessionEventsPermissionPromptRequestExtensionPermissionAccess")] [JsonSerializable(typeof(GitHub.Copilot.PermissionPromptRequestHook), TypeInfoPropertyName = "SessionEventsPermissionPromptRequestHook")] [JsonSerializable(typeof(GitHub.Copilot.PermissionPromptRequestMcp), TypeInfoPropertyName = "SessionEventsPermissionPromptRequestMcp")] [JsonSerializable(typeof(GitHub.Copilot.PermissionPromptRequestMemory), TypeInfoPropertyName = "SessionEventsPermissionPromptRequestMemory")] [JsonSerializable(typeof(GitHub.Copilot.PermissionPromptRequestPath), TypeInfoPropertyName = "SessionEventsPermissionPromptRequestPath")] [JsonSerializable(typeof(GitHub.Copilot.PermissionPromptRequestPathAccessKind), TypeInfoPropertyName = "SessionEventsPermissionPromptRequestPathAccessKind")] [JsonSerializable(typeof(GitHub.Copilot.PermissionPromptRequestRead), TypeInfoPropertyName = "SessionEventsPermissionPromptRequestRead")] [JsonSerializable(typeof(GitHub.Copilot.PermissionPromptRequestUrl), TypeInfoPropertyName = "SessionEventsPermissionPromptRequestUrl")] [JsonSerializable(typeof(GitHub.Copilot.PermissionPromptRequestWrite), TypeInfoPropertyName = "SessionEventsPermissionPromptRequestWrite")] [JsonSerializable(typeof(GitHub.Copilot.PermissionRequest), TypeInfoPropertyName = "SessionEventsPermissionRequest")] [JsonSerializable(typeof(GitHub.Copilot.PermissionRequestCustomTool), TypeInfoPropertyName = "SessionEventsPermissionRequestCustomTool")] [JsonSerializable(typeof(GitHub.Copilot.PermissionRequestExtensionManagement), TypeInfoPropertyName = "SessionEventsPermissionRequestExtensionManagement")] [JsonSerializable(typeof(GitHub.Copilot.PermissionRequestExtensionPermissionAccess), TypeInfoPropertyName = "SessionEventsPermissionRequestExtensionPermissionAccess")] [JsonSerializable(typeof(GitHub.Copilot.PermissionRequestHook), TypeInfoPropertyName = "SessionEventsPermissionRequestHook")] [JsonSerializable(typeof(GitHub.Copilot.PermissionRequestMcp), TypeInfoPropertyName = "SessionEventsPermissionRequestMcp")] [JsonSerializable(typeof(GitHub.Copilot.PermissionRequestMemory), TypeInfoPropertyName = "SessionEventsPermissionRequestMemory")] [JsonSerializable(typeof(GitHub.Copilot.PermissionRequestMemoryAction), TypeInfoPropertyName = "SessionEventsPermissionRequestMemoryAction")] [JsonSerializable(typeof(GitHub.Copilot.PermissionRequestMemoryDirection), TypeInfoPropertyName = "SessionEventsPermissionRequestMemoryDirection")] [JsonSerializable(typeof(GitHub.Copilot.PermissionRequestRead), TypeInfoPropertyName = "SessionEventsPermissionRequestRead")] [JsonSerializable(typeof(GitHub.Copilot.PermissionRequestShell), TypeInfoPropertyName = "SessionEventsPermissionRequestShell")] [JsonSerializable(typeof(GitHub.Copilot.PermissionRequestShellCommand), TypeInfoPropertyName = "SessionEventsPermissionRequestShellCommand")] [JsonSerializable(typeof(GitHub.Copilot.PermissionRequestShellPossibleUrl), TypeInfoPropertyName = "SessionEventsPermissionRequestShellPossibleUrl")] [JsonSerializable(typeof(GitHub.Copilot.PermissionRequestUrl), TypeInfoPropertyName = "SessionEventsPermissionRequestUrl")] [JsonSerializable(typeof(GitHub.Copilot.PermissionRequestWrite), TypeInfoPropertyName = "SessionEventsPermissionRequestWrite")] [JsonSerializable(typeof(GitHub.Copilot.PermissionRequestedData), TypeInfoPropertyName = "SessionEventsPermissionRequestedData")] [JsonSerializable(typeof(GitHub.Copilot.PermissionRequestedEvent), TypeInfoPropertyName = "SessionEventsPermissionRequestedEvent")] [JsonSerializable(typeof(GitHub.Copilot.PermissionResult), TypeInfoPropertyName = "SessionEventsPermissionResult")] [JsonSerializable(typeof(GitHub.Copilot.PermissionRule), TypeInfoPropertyName = "SessionEventsPermissionRule")] [JsonSerializable(typeof(GitHub.Copilot.PlanChangedOperation), TypeInfoPropertyName = "SessionEventsPlanChangedOperation")] [JsonSerializable(typeof(GitHub.Copilot.ReasoningSummary), TypeInfoPropertyName = "SessionEventsReasoningSummary")] [JsonSerializable(typeof(GitHub.Copilot.SamplingCompletedData), TypeInfoPropertyName = "SessionEventsSamplingCompletedData")] [JsonSerializable(typeof(GitHub.Copilot.SamplingCompletedEvent), TypeInfoPropertyName = "SessionEventsSamplingCompletedEvent")] [JsonSerializable(typeof(GitHub.Copilot.SamplingRequestedData), TypeInfoPropertyName = "SessionEventsSamplingRequestedData")] [JsonSerializable(typeof(GitHub.Copilot.SamplingRequestedEvent), TypeInfoPropertyName = "SessionEventsSamplingRequestedEvent")] [JsonSerializable(typeof(GitHub.Copilot.SessionEvent), TypeInfoPropertyName = "SessionEventsSessionEvent")] [JsonSerializable(typeof(GitHub.Copilot.SessionMode), TypeInfoPropertyName = "SessionEventsSessionMode")] [JsonSerializable(typeof(GitHub.Copilot.ShutdownCodeChanges), TypeInfoPropertyName = "SessionEventsShutdownCodeChanges")] [JsonSerializable(typeof(GitHub.Copilot.ShutdownModelMetric), TypeInfoPropertyName = "SessionEventsShutdownModelMetric")] [JsonSerializable(typeof(GitHub.Copilot.ShutdownModelMetricRequests), TypeInfoPropertyName = "SessionEventsShutdownModelMetricRequests")] [JsonSerializable(typeof(GitHub.Copilot.ShutdownModelMetricTokenDetail), TypeInfoPropertyName = "SessionEventsShutdownModelMetricTokenDetail")] [JsonSerializable(typeof(GitHub.Copilot.ShutdownModelMetricUsage), TypeInfoPropertyName = "SessionEventsShutdownModelMetricUsage")] [JsonSerializable(typeof(GitHub.Copilot.ShutdownTokenDetail), TypeInfoPropertyName = "SessionEventsShutdownTokenDetail")] [JsonSerializable(typeof(GitHub.Copilot.ShutdownType), TypeInfoPropertyName = "SessionEventsShutdownType")] [JsonSerializable(typeof(GitHub.Copilot.SkillInvokedData), TypeInfoPropertyName = "SessionEventsSkillInvokedData")] [JsonSerializable(typeof(GitHub.Copilot.SkillInvokedEvent), TypeInfoPropertyName = "SessionEventsSkillInvokedEvent")] [JsonSerializable(typeof(GitHub.Copilot.SkillSource), TypeInfoPropertyName = "SessionEventsSkillSource")] [JsonSerializable(typeof(GitHub.Copilot.SkillsLoadedSkill), TypeInfoPropertyName = "SessionEventsSkillsLoadedSkill")] [JsonSerializable(typeof(GitHub.Copilot.SubagentCompletedData), TypeInfoPropertyName = "SessionEventsSubagentCompletedData")] [JsonSerializable(typeof(GitHub.Copilot.SubagentCompletedEvent), TypeInfoPropertyName = "SessionEventsSubagentCompletedEvent")] [JsonSerializable(typeof(GitHub.Copilot.SubagentDeselectedData), TypeInfoPropertyName = "SessionEventsSubagentDeselectedData")] [JsonSerializable(typeof(GitHub.Copilot.SubagentDeselectedEvent), TypeInfoPropertyName = "SessionEventsSubagentDeselectedEvent")] [JsonSerializable(typeof(GitHub.Copilot.SubagentFailedData), TypeInfoPropertyName = "SessionEventsSubagentFailedData")] [JsonSerializable(typeof(GitHub.Copilot.SubagentFailedEvent), TypeInfoPropertyName = "SessionEventsSubagentFailedEvent")] [JsonSerializable(typeof(GitHub.Copilot.SubagentSelectedData), TypeInfoPropertyName = "SessionEventsSubagentSelectedData")] [JsonSerializable(typeof(GitHub.Copilot.SubagentSelectedEvent), TypeInfoPropertyName = "SessionEventsSubagentSelectedEvent")] [JsonSerializable(typeof(GitHub.Copilot.SubagentStartedData), TypeInfoPropertyName = "SessionEventsSubagentStartedData")] [JsonSerializable(typeof(GitHub.Copilot.SubagentStartedEvent), TypeInfoPropertyName = "SessionEventsSubagentStartedEvent")] [JsonSerializable(typeof(GitHub.Copilot.SystemMessageData), TypeInfoPropertyName = "SessionEventsSystemMessageData")] [JsonSerializable(typeof(GitHub.Copilot.SystemMessageEvent), TypeInfoPropertyName = "SessionEventsSystemMessageEvent")] [JsonSerializable(typeof(GitHub.Copilot.SystemMessageMetadata), TypeInfoPropertyName = "SessionEventsSystemMessageMetadata")] [JsonSerializable(typeof(GitHub.Copilot.SystemMessageRole), TypeInfoPropertyName = "SessionEventsSystemMessageRole")] [JsonSerializable(typeof(GitHub.Copilot.SystemNotification), TypeInfoPropertyName = "SessionEventsSystemNotification")] [JsonSerializable(typeof(GitHub.Copilot.SystemNotificationAgentCompleted), TypeInfoPropertyName = "SessionEventsSystemNotificationAgentCompleted")] [JsonSerializable(typeof(GitHub.Copilot.SystemNotificationAgentCompletedStatus), TypeInfoPropertyName = "SessionEventsSystemNotificationAgentCompletedStatus")] [JsonSerializable(typeof(GitHub.Copilot.SystemNotificationAgentIdle), TypeInfoPropertyName = "SessionEventsSystemNotificationAgentIdle")] [JsonSerializable(typeof(GitHub.Copilot.SystemNotificationData), TypeInfoPropertyName = "SessionEventsSystemNotificationData")] [JsonSerializable(typeof(GitHub.Copilot.SystemNotificationEvent), TypeInfoPropertyName = "SessionEventsSystemNotificationEvent")] [JsonSerializable(typeof(GitHub.Copilot.SystemNotificationInstructionDiscovered), TypeInfoPropertyName = "SessionEventsSystemNotificationInstructionDiscovered")] [JsonSerializable(typeof(GitHub.Copilot.SystemNotificationNewInboxMessage), TypeInfoPropertyName = "SessionEventsSystemNotificationNewInboxMessage")] [JsonSerializable(typeof(GitHub.Copilot.SystemNotificationShellCompleted), TypeInfoPropertyName = "SessionEventsSystemNotificationShellCompleted")] [JsonSerializable(typeof(GitHub.Copilot.SystemNotificationShellDetachedCompleted), TypeInfoPropertyName = "SessionEventsSystemNotificationShellDetachedCompleted")] [JsonSerializable(typeof(GitHub.Copilot.ToolExecutionCompleteContent), TypeInfoPropertyName = "SessionEventsToolExecutionCompleteContent")] [JsonSerializable(typeof(GitHub.Copilot.ToolExecutionCompleteContentAudio), TypeInfoPropertyName = "SessionEventsToolExecutionCompleteContentAudio")] [JsonSerializable(typeof(GitHub.Copilot.ToolExecutionCompleteContentImage), TypeInfoPropertyName = "SessionEventsToolExecutionCompleteContentImage")] [JsonSerializable(typeof(GitHub.Copilot.ToolExecutionCompleteContentResource), TypeInfoPropertyName = "SessionEventsToolExecutionCompleteContentResource")] [JsonSerializable(typeof(GitHub.Copilot.ToolExecutionCompleteContentResourceDetails), TypeInfoPropertyName = "SessionEventsToolExecutionCompleteContentResourceDetails")] [JsonSerializable(typeof(GitHub.Copilot.ToolExecutionCompleteContentResourceLink), TypeInfoPropertyName = "SessionEventsToolExecutionCompleteContentResourceLink")] [JsonSerializable(typeof(GitHub.Copilot.ToolExecutionCompleteContentResourceLinkIcon), TypeInfoPropertyName = "SessionEventsToolExecutionCompleteContentResourceLinkIcon")] [JsonSerializable(typeof(GitHub.Copilot.ToolExecutionCompleteContentResourceLinkIconTheme), TypeInfoPropertyName = "SessionEventsToolExecutionCompleteContentResourceLinkIconTheme")] [JsonSerializable(typeof(GitHub.Copilot.ToolExecutionCompleteContentTerminal), TypeInfoPropertyName = "SessionEventsToolExecutionCompleteContentTerminal")] [JsonSerializable(typeof(GitHub.Copilot.ToolExecutionCompleteContentText), TypeInfoPropertyName = "SessionEventsToolExecutionCompleteContentText")] [JsonSerializable(typeof(GitHub.Copilot.ToolExecutionCompleteData), TypeInfoPropertyName = "SessionEventsToolExecutionCompleteData")] [JsonSerializable(typeof(GitHub.Copilot.ToolExecutionCompleteError), TypeInfoPropertyName = "SessionEventsToolExecutionCompleteError")] [JsonSerializable(typeof(GitHub.Copilot.ToolExecutionCompleteEvent), TypeInfoPropertyName = "SessionEventsToolExecutionCompleteEvent")] [JsonSerializable(typeof(GitHub.Copilot.ToolExecutionCompleteResult), TypeInfoPropertyName = "SessionEventsToolExecutionCompleteResult")] [JsonSerializable(typeof(GitHub.Copilot.ToolExecutionPartialResultEvent), TypeInfoPropertyName = "SessionEventsToolExecutionPartialResultEvent")] [JsonSerializable(typeof(GitHub.Copilot.ToolExecutionProgressData), TypeInfoPropertyName = "SessionEventsToolExecutionProgressData")] [JsonSerializable(typeof(GitHub.Copilot.ToolExecutionProgressEvent), TypeInfoPropertyName = "SessionEventsToolExecutionProgressEvent")] [JsonSerializable(typeof(GitHub.Copilot.ToolExecutionStartData), TypeInfoPropertyName = "SessionEventsToolExecutionStartData")] [JsonSerializable(typeof(GitHub.Copilot.ToolExecutionStartEvent), TypeInfoPropertyName = "SessionEventsToolExecutionStartEvent")] [JsonSerializable(typeof(GitHub.Copilot.ToolUserRequestedData), TypeInfoPropertyName = "SessionEventsToolUserRequestedData")] [JsonSerializable(typeof(GitHub.Copilot.ToolUserRequestedEvent), TypeInfoPropertyName = "SessionEventsToolUserRequestedEvent")] [JsonSerializable(typeof(GitHub.Copilot.UserInputCompletedData), TypeInfoPropertyName = "SessionEventsUserInputCompletedData")] [JsonSerializable(typeof(GitHub.Copilot.UserInputCompletedEvent), TypeInfoPropertyName = "SessionEventsUserInputCompletedEvent")] [JsonSerializable(typeof(GitHub.Copilot.UserInputRequestedData), TypeInfoPropertyName = "SessionEventsUserInputRequestedData")] [JsonSerializable(typeof(GitHub.Copilot.UserInputRequestedEvent), TypeInfoPropertyName = "SessionEventsUserInputRequestedEvent")] [JsonSerializable(typeof(GitHub.Copilot.UserMessageAgentMode), TypeInfoPropertyName = "SessionEventsUserMessageAgentMode")] [JsonSerializable(typeof(GitHub.Copilot.UserMessageAttachment), TypeInfoPropertyName = "SessionEventsUserMessageAttachment")] [JsonSerializable(typeof(GitHub.Copilot.UserMessageAttachmentBlob), TypeInfoPropertyName = "SessionEventsUserMessageAttachmentBlob")] [JsonSerializable(typeof(GitHub.Copilot.UserMessageAttachmentDirectory), TypeInfoPropertyName = "SessionEventsUserMessageAttachmentDirectory")] [JsonSerializable(typeof(GitHub.Copilot.UserMessageAttachmentFile), TypeInfoPropertyName = "SessionEventsUserMessageAttachmentFile")] [JsonSerializable(typeof(GitHub.Copilot.UserMessageAttachmentFileLineRange), TypeInfoPropertyName = "SessionEventsUserMessageAttachmentFileLineRange")] [JsonSerializable(typeof(GitHub.Copilot.UserMessageAttachmentGithubReference), TypeInfoPropertyName = "SessionEventsUserMessageAttachmentGithubReference")] [JsonSerializable(typeof(GitHub.Copilot.UserMessageAttachmentGithubReferenceType), TypeInfoPropertyName = "SessionEventsUserMessageAttachmentGithubReferenceType")] [JsonSerializable(typeof(GitHub.Copilot.UserMessageAttachmentSelection), TypeInfoPropertyName = "SessionEventsUserMessageAttachmentSelection")] [JsonSerializable(typeof(GitHub.Copilot.UserMessageAttachmentSelectionDetails), TypeInfoPropertyName = "SessionEventsUserMessageAttachmentSelectionDetails")] [JsonSerializable(typeof(GitHub.Copilot.UserMessageAttachmentSelectionDetailsEnd), TypeInfoPropertyName = "SessionEventsUserMessageAttachmentSelectionDetailsEnd")] [JsonSerializable(typeof(GitHub.Copilot.UserMessageAttachmentSelectionDetailsStart), TypeInfoPropertyName = "SessionEventsUserMessageAttachmentSelectionDetailsStart")] [JsonSerializable(typeof(GitHub.Copilot.UserMessageData), TypeInfoPropertyName = "SessionEventsUserMessageData")] [JsonSerializable(typeof(GitHub.Copilot.UserMessageEvent), TypeInfoPropertyName = "SessionEventsUserMessageEvent")] [JsonSerializable(typeof(GitHub.Copilot.UserToolSessionApproval), TypeInfoPropertyName = "SessionEventsUserToolSessionApproval")] [JsonSerializable(typeof(GitHub.Copilot.UserToolSessionApprovalCommands), TypeInfoPropertyName = "SessionEventsUserToolSessionApprovalCommands")] [JsonSerializable(typeof(GitHub.Copilot.UserToolSessionApprovalCustomTool), TypeInfoPropertyName = "SessionEventsUserToolSessionApprovalCustomTool")] [JsonSerializable(typeof(GitHub.Copilot.UserToolSessionApprovalExtensionManagement), TypeInfoPropertyName = "SessionEventsUserToolSessionApprovalExtensionManagement")] [JsonSerializable(typeof(GitHub.Copilot.UserToolSessionApprovalExtensionPermissionAccess), TypeInfoPropertyName = "SessionEventsUserToolSessionApprovalExtensionPermissionAccess")] [JsonSerializable(typeof(GitHub.Copilot.UserToolSessionApprovalMcp), TypeInfoPropertyName = "SessionEventsUserToolSessionApprovalMcp")] [JsonSerializable(typeof(GitHub.Copilot.UserToolSessionApprovalMemory), TypeInfoPropertyName = "SessionEventsUserToolSessionApprovalMemory")] [JsonSerializable(typeof(GitHub.Copilot.UserToolSessionApprovalRead), TypeInfoPropertyName = "SessionEventsUserToolSessionApprovalRead")] [JsonSerializable(typeof(GitHub.Copilot.UserToolSessionApprovalWrite), TypeInfoPropertyName = "SessionEventsUserToolSessionApprovalWrite")] [JsonSerializable(typeof(GitHub.Copilot.WorkingDirectoryContext), TypeInfoPropertyName = "SessionEventsWorkingDirectoryContext")] [JsonSerializable(typeof(GitHub.Copilot.WorkingDirectoryContextHostType), TypeInfoPropertyName = "SessionEventsWorkingDirectoryContextHostType")] [JsonSerializable(typeof(GitHub.Copilot.WorkspaceFileChangedOperation), TypeInfoPropertyName = "SessionEventsWorkspaceFileChangedOperation")] [JsonSerializable(typeof(AbortRequest))] [JsonSerializable(typeof(AbortResult))] [JsonSerializable(typeof(AccountGetQuotaRequest))] [JsonSerializable(typeof(AccountGetQuotaResult))] [JsonSerializable(typeof(AccountQuotaSnapshot))] [JsonSerializable(typeof(AgentGetCurrentResult))] [JsonSerializable(typeof(AgentInfo))] [JsonSerializable(typeof(AgentList))] [JsonSerializable(typeof(AgentReloadResult))] [JsonSerializable(typeof(AgentSelectRequest))] [JsonSerializable(typeof(AgentSelectResult))] [JsonSerializable(typeof(AuthInfo))] [JsonSerializable(typeof(CommandList))] [JsonSerializable(typeof(CommandsHandlePendingCommandRequest))] [JsonSerializable(typeof(CommandsHandlePendingCommandResult))] [JsonSerializable(typeof(CommandsInvokeRequest))] [JsonSerializable(typeof(CommandsListRequest))] [JsonSerializable(typeof(CommandsListRequestWithSession))] [JsonSerializable(typeof(CommandsRespondToQueuedCommandRequest))] [JsonSerializable(typeof(CommandsRespondToQueuedCommandResult))] [JsonSerializable(typeof(ConnectRemoteSessionParams))] [JsonSerializable(typeof(ConnectRequest))] [JsonSerializable(typeof(ConnectResult))] [JsonSerializable(typeof(ConnectedRemoteSessionMetadata))] [JsonSerializable(typeof(ConnectedRemoteSessionMetadataRepository))] [JsonSerializable(typeof(CopilotUserResponse))] [JsonSerializable(typeof(CopilotUserResponseEndpoints))] [JsonSerializable(typeof(CopilotUserResponseOrganizationListItem))] [JsonSerializable(typeof(CopilotUserResponseQuotaSnapshots))] [JsonSerializable(typeof(CopilotUserResponseQuotaSnapshotsChat))] [JsonSerializable(typeof(CopilotUserResponseQuotaSnapshotsCompletions))] [JsonSerializable(typeof(CopilotUserResponseQuotaSnapshotsPremiumInteractions))] [JsonSerializable(typeof(CurrentModel))] [JsonSerializable(typeof(DiscoveredMcpServer))] [JsonSerializable(typeof(EnqueueCommandParams))] [JsonSerializable(typeof(EnqueueCommandResult))] [JsonSerializable(typeof(EventLogReadRequest))] [JsonSerializable(typeof(EventLogReleaseInterestResult))] [JsonSerializable(typeof(EventLogTailResult))] [JsonSerializable(typeof(EventsReadResult))] [JsonSerializable(typeof(ExecuteCommandParams))] [JsonSerializable(typeof(ExecuteCommandResult))] [JsonSerializable(typeof(Extension))] [JsonSerializable(typeof(ExtensionList))] [JsonSerializable(typeof(ExtensionsDisableRequest))] [JsonSerializable(typeof(ExtensionsEnableRequest))] [JsonSerializable(typeof(FleetStartRequest))] [JsonSerializable(typeof(FleetStartResult))] [JsonSerializable(typeof(FolderTrustAddParams))] [JsonSerializable(typeof(FolderTrustCheckParams))] [JsonSerializable(typeof(FolderTrustCheckResult))] [JsonSerializable(typeof(HandlePendingToolCallRequest))] [JsonSerializable(typeof(HandlePendingToolCallResult))] [JsonSerializable(typeof(HistoryAbortManualCompactionResult))] [JsonSerializable(typeof(HistoryCancelBackgroundCompactionResult))] [JsonSerializable(typeof(HistoryCompactContextWindow))] [JsonSerializable(typeof(HistoryCompactRequest))] [JsonSerializable(typeof(HistoryCompactRequestWithSession))] [JsonSerializable(typeof(HistoryCompactResult))] [JsonSerializable(typeof(HistorySummarizeForHandoffResult))] [JsonSerializable(typeof(HistoryTruncateRequest))] [JsonSerializable(typeof(HistoryTruncateResult))] [JsonSerializable(typeof(InstalledPlugin))] [JsonSerializable(typeof(InstructionsGetSourcesResult))] [JsonSerializable(typeof(InstructionsSources))] [JsonSerializable(typeof(LogRequest))] [JsonSerializable(typeof(LogResult))] [JsonSerializable(typeof(LspInitializeRequest))] [JsonSerializable(typeof(McpCancelSamplingExecutionParams))] [JsonSerializable(typeof(McpCancelSamplingExecutionResult))] [JsonSerializable(typeof(McpConfigAddRequest))] [JsonSerializable(typeof(McpConfigDisableRequest))] [JsonSerializable(typeof(McpConfigEnableRequest))] [JsonSerializable(typeof(McpConfigList))] [JsonSerializable(typeof(McpConfigRemoveRequest))] [JsonSerializable(typeof(McpConfigUpdateRequest))] [JsonSerializable(typeof(McpDisableRequest))] [JsonSerializable(typeof(McpDiscoverRequest))] [JsonSerializable(typeof(McpDiscoverResult))] [JsonSerializable(typeof(McpEnableRequest))] [JsonSerializable(typeof(McpExecuteSamplingParams))] [JsonSerializable(typeof(McpExecuteSamplingRequest))] [JsonSerializable(typeof(McpExecuteSamplingResult))] [JsonSerializable(typeof(McpOauthLoginRequest))] [JsonSerializable(typeof(McpOauthLoginResult))] [JsonSerializable(typeof(McpRemoveGitHubResult))] [JsonSerializable(typeof(McpSamplingExecutionResult))] [JsonSerializable(typeof(McpServer))] [JsonSerializable(typeof(McpServerList))] [JsonSerializable(typeof(McpSetEnvValueModeParams))] [JsonSerializable(typeof(McpSetEnvValueModeResult))] [JsonSerializable(typeof(MetadataContextInfoRequest))] [JsonSerializable(typeof(MetadataContextInfoResult))] [JsonSerializable(typeof(MetadataContextInfoResultContextInfo))] [JsonSerializable(typeof(MetadataIsProcessingResult))] [JsonSerializable(typeof(MetadataRecomputeContextTokensRequest))] [JsonSerializable(typeof(MetadataRecomputeContextTokensResult))] [JsonSerializable(typeof(MetadataRecordContextChangeRequest))] [JsonSerializable(typeof(MetadataRecordContextChangeResult))] [JsonSerializable(typeof(MetadataSetWorkingDirectoryRequest))] [JsonSerializable(typeof(MetadataSetWorkingDirectoryResult))] [JsonSerializable(typeof(MetadataSnapshotRemoteMetadata))] [JsonSerializable(typeof(MetadataSnapshotRemoteMetadataRepository))] [JsonSerializable(typeof(ModeSetRequest))] [JsonSerializable(typeof(Model))] [JsonSerializable(typeof(ModelBilling))] [JsonSerializable(typeof(ModelBillingTokenPrices))] [JsonSerializable(typeof(ModelCapabilities))] [JsonSerializable(typeof(ModelCapabilitiesLimits))] [JsonSerializable(typeof(ModelCapabilitiesLimitsVision))] [JsonSerializable(typeof(ModelCapabilitiesOverride))] [JsonSerializable(typeof(ModelCapabilitiesOverrideLimits))] [JsonSerializable(typeof(ModelCapabilitiesOverrideLimitsVision))] [JsonSerializable(typeof(ModelCapabilitiesOverrideSupports))] [JsonSerializable(typeof(ModelCapabilitiesSupports))] [JsonSerializable(typeof(ModelList))] [JsonSerializable(typeof(ModelPolicy))] [JsonSerializable(typeof(ModelSetReasoningEffortRequest))] [JsonSerializable(typeof(ModelSetReasoningEffortResult))] [JsonSerializable(typeof(ModelSwitchToRequest))] [JsonSerializable(typeof(ModelSwitchToResult))] [JsonSerializable(typeof(ModelsListRequest))] [JsonSerializable(typeof(NameGetResult))] [JsonSerializable(typeof(NameSetAutoRequest))] [JsonSerializable(typeof(NameSetAutoResult))] [JsonSerializable(typeof(NameSetRequest))] [JsonSerializable(typeof(PendingPermissionRequest))] [JsonSerializable(typeof(PendingPermissionRequestList))] [JsonSerializable(typeof(PermissionDecision))] [JsonSerializable(typeof(PermissionDecisionApproveForLocationApproval))] [JsonSerializable(typeof(PermissionDecisionApproveForSessionApproval))] [JsonSerializable(typeof(PermissionDecisionRequest))] [JsonSerializable(typeof(PermissionLocationAddToolApprovalParams))] [JsonSerializable(typeof(PermissionLocationApplyParams))] [JsonSerializable(typeof(PermissionLocationApplyResult))] [JsonSerializable(typeof(PermissionLocationResolveParams))] [JsonSerializable(typeof(PermissionLocationResolveResult))] [JsonSerializable(typeof(PermissionPathsAddParams))] [JsonSerializable(typeof(PermissionPathsAllowedCheckParams))] [JsonSerializable(typeof(PermissionPathsAllowedCheckResult))] [JsonSerializable(typeof(PermissionPathsConfig))] [JsonSerializable(typeof(PermissionPathsList))] [JsonSerializable(typeof(PermissionPathsUpdatePrimaryParams))] [JsonSerializable(typeof(PermissionPathsWorkspaceCheckParams))] [JsonSerializable(typeof(PermissionPathsWorkspaceCheckResult))] [JsonSerializable(typeof(PermissionPromptShownNotification))] [JsonSerializable(typeof(PermissionRequestResult))] [JsonSerializable(typeof(PermissionRulesSet))] [JsonSerializable(typeof(PermissionUrlsConfig))] [JsonSerializable(typeof(PermissionUrlsSetUnrestrictedModeParams))] [JsonSerializable(typeof(PermissionsConfigureAdditionalContentExclusionPolicy))] [JsonSerializable(typeof(PermissionsConfigureAdditionalContentExclusionPolicyRule))] [JsonSerializable(typeof(PermissionsConfigureAdditionalContentExclusionPolicyRuleSource))] [JsonSerializable(typeof(PermissionsConfigureParams))] [JsonSerializable(typeof(PermissionsConfigureResult))] [JsonSerializable(typeof(PermissionsFolderTrustAddTrustedResult))] [JsonSerializable(typeof(PermissionsLocationsAddToolApprovalDetails))] [JsonSerializable(typeof(PermissionsLocationsAddToolApprovalResult))] [JsonSerializable(typeof(PermissionsModifyRulesParams))] [JsonSerializable(typeof(PermissionsModifyRulesResult))] [JsonSerializable(typeof(PermissionsNotifyPromptShownResult))] [JsonSerializable(typeof(PermissionsPathsAddResult))] [JsonSerializable(typeof(PermissionsPathsListRequest))] [JsonSerializable(typeof(PermissionsPathsUpdatePrimaryResult))] [JsonSerializable(typeof(PermissionsPendingRequestsRequest))] [JsonSerializable(typeof(PermissionsResetSessionApprovalsRequest))] [JsonSerializable(typeof(PermissionsResetSessionApprovalsResult))] [JsonSerializable(typeof(PermissionsSetApproveAllRequest))] [JsonSerializable(typeof(PermissionsSetApproveAllResult))] [JsonSerializable(typeof(PermissionsSetRequiredRequest))] [JsonSerializable(typeof(PermissionsSetRequiredResult))] [JsonSerializable(typeof(PermissionsUrlsSetUnrestrictedModeResult))] [JsonSerializable(typeof(PingRequest))] [JsonSerializable(typeof(PingResult))] [JsonSerializable(typeof(PlanReadResult))] [JsonSerializable(typeof(PlanUpdateRequest))] [JsonSerializable(typeof(Plugin))] [JsonSerializable(typeof(PluginList))] [JsonSerializable(typeof(QueuePendingItems))] [JsonSerializable(typeof(QueuePendingItemsResult))] [JsonSerializable(typeof(QueueRemoveMostRecentResult))] [JsonSerializable(typeof(QueuedCommandResult))] [JsonSerializable(typeof(RegisterEventInterestParams))] [JsonSerializable(typeof(RegisterEventInterestResult))] [JsonSerializable(typeof(ReleaseEventInterestParams))] [JsonSerializable(typeof(RemoteEnableRequest))] [JsonSerializable(typeof(RemoteEnableResult))] [JsonSerializable(typeof(RemoteNotifySteerableChangedRequest))] [JsonSerializable(typeof(RemoteNotifySteerableChangedResult))] [JsonSerializable(typeof(RemoteSessionConnectionResult))] [JsonSerializable(typeof(ScheduleEntry))] [JsonSerializable(typeof(ScheduleList))] [JsonSerializable(typeof(ScheduleStopRequest))] [JsonSerializable(typeof(ScheduleStopResult))] [JsonSerializable(typeof(SecretsAddFilterValuesRequest))] [JsonSerializable(typeof(SecretsAddFilterValuesResult))] [JsonSerializable(typeof(SendAttachment))] [JsonSerializable(typeof(SendAttachmentFileLineRange))] [JsonSerializable(typeof(SendAttachmentSelectionDetails))] [JsonSerializable(typeof(SendAttachmentSelectionDetailsEnd))] [JsonSerializable(typeof(SendAttachmentSelectionDetailsStart))] [JsonSerializable(typeof(SendRequest))] [JsonSerializable(typeof(SendResult))] [JsonSerializable(typeof(ServerSkill))] [JsonSerializable(typeof(ServerSkillList))] [JsonSerializable(typeof(SessionAgentDeselectRequest))] [JsonSerializable(typeof(SessionAgentGetCurrentRequest))] [JsonSerializable(typeof(SessionAgentListRequest))] [JsonSerializable(typeof(SessionAgentReloadRequest))] [JsonSerializable(typeof(SessionAuthGetStatusRequest))] [JsonSerializable(typeof(SessionAuthStatus))] [JsonSerializable(typeof(SessionBulkDeleteResult))] [JsonSerializable(typeof(SessionContext))] [JsonSerializable(typeof(SessionEnrichMetadataResult))] [JsonSerializable(typeof(SessionEventLogTailRequest))] [JsonSerializable(typeof(SessionExtensionsListRequest))] [JsonSerializable(typeof(SessionExtensionsReloadRequest))] [JsonSerializable(typeof(SessionFsAppendFileRequest))] [JsonSerializable(typeof(SessionFsError))] [JsonSerializable(typeof(SessionFsExistsRequest))] [JsonSerializable(typeof(SessionFsExistsResult))] [JsonSerializable(typeof(SessionFsMkdirRequest))] [JsonSerializable(typeof(SessionFsReadFileRequest))] [JsonSerializable(typeof(SessionFsReadFileResult))] [JsonSerializable(typeof(SessionFsReaddirRequest))] [JsonSerializable(typeof(SessionFsReaddirResult))] [JsonSerializable(typeof(SessionFsReaddirWithTypesEntry))] [JsonSerializable(typeof(SessionFsReaddirWithTypesRequest))] [JsonSerializable(typeof(SessionFsReaddirWithTypesResult))] [JsonSerializable(typeof(SessionFsRenameRequest))] [JsonSerializable(typeof(SessionFsRmRequest))] [JsonSerializable(typeof(SessionFsSetProviderCapabilities))] [JsonSerializable(typeof(SessionFsSetProviderRequest))] [JsonSerializable(typeof(SessionFsSetProviderResult))] [JsonSerializable(typeof(SessionFsSqliteExistsRequest))] [JsonSerializable(typeof(SessionFsSqliteExistsResult))] [JsonSerializable(typeof(SessionFsSqliteQueryRequest))] [JsonSerializable(typeof(SessionFsSqliteQueryResult))] [JsonSerializable(typeof(SessionFsStatRequest))] [JsonSerializable(typeof(SessionFsStatResult))] [JsonSerializable(typeof(SessionFsWriteFileRequest))] [JsonSerializable(typeof(SessionHistoryAbortManualCompactionRequest))] [JsonSerializable(typeof(SessionHistoryCancelBackgroundCompactionRequest))] [JsonSerializable(typeof(SessionHistorySummarizeForHandoffRequest))] [JsonSerializable(typeof(SessionInstalledPlugin))] [JsonSerializable(typeof(SessionInstructionsGetSourcesRequest))] [JsonSerializable(typeof(SessionList))] [JsonSerializable(typeof(SessionListFilter))] [JsonSerializable(typeof(SessionLoadDeferredRepoHooksResult))] [JsonSerializable(typeof(SessionMcpListRequest))] [JsonSerializable(typeof(SessionMcpReloadRequest))] [JsonSerializable(typeof(SessionMcpRemoveGitHubRequest))] [JsonSerializable(typeof(SessionMetadata))] [JsonSerializable(typeof(SessionMetadataIsProcessingRequest))] [JsonSerializable(typeof(SessionMetadataSnapshot))] [JsonSerializable(typeof(SessionMetadataSnapshotRequest))] [JsonSerializable(typeof(SessionMetadataSnapshotWorkspace))] [JsonSerializable(typeof(SessionModeGetRequest))] [JsonSerializable(typeof(SessionModelGetCurrentRequest))] [JsonSerializable(typeof(SessionNameGetRequest))] [JsonSerializable(typeof(SessionPlanDeleteRequest))] [JsonSerializable(typeof(SessionPlanReadRequest))] [JsonSerializable(typeof(SessionPluginsListRequest))] [JsonSerializable(typeof(SessionPruneResult))] [JsonSerializable(typeof(SessionQueueClearRequest))] [JsonSerializable(typeof(SessionQueuePendingItemsRequest))] [JsonSerializable(typeof(SessionQueueRemoveMostRecentRequest))] [JsonSerializable(typeof(SessionRemoteDisableRequest))] [JsonSerializable(typeof(SessionScheduleListRequest))] [JsonSerializable(typeof(SessionSetCredentialsParams))] [JsonSerializable(typeof(SessionSetCredentialsResult))] [JsonSerializable(typeof(SessionSizes))] [JsonSerializable(typeof(SessionSkillsEnsureLoadedRequest))] [JsonSerializable(typeof(SessionSkillsGetInvokedRequest))] [JsonSerializable(typeof(SessionSkillsListRequest))] [JsonSerializable(typeof(SessionSkillsReloadRequest))] [JsonSerializable(typeof(SessionSuspendRequest))] [JsonSerializable(typeof(SessionTasksGetCurrentPromotableRequest))] [JsonSerializable(typeof(SessionTasksListRequest))] [JsonSerializable(typeof(SessionTasksPromoteCurrentToBackgroundRequest))] [JsonSerializable(typeof(SessionTasksRefreshRequest))] [JsonSerializable(typeof(SessionTasksWaitForPendingRequest))] [JsonSerializable(typeof(SessionToolsInitializeAndValidateRequest))] [JsonSerializable(typeof(SessionUiRegisterDirectAutoModeSwitchHandlerRequest))] [JsonSerializable(typeof(SessionUpdateOptionsParams))] [JsonSerializable(typeof(SessionUpdateOptionsResult))] [JsonSerializable(typeof(SessionUsageGetMetricsRequest))] [JsonSerializable(typeof(SessionWorkingDirectoryContext))] [JsonSerializable(typeof(SessionWorkspacesGetWorkspaceRequest))] [JsonSerializable(typeof(SessionWorkspacesListCheckpointsRequest))] [JsonSerializable(typeof(SessionWorkspacesListFilesRequest))] [JsonSerializable(typeof(SessionsBulkDeleteRequest))] [JsonSerializable(typeof(SessionsCheckInUseRequest))] [JsonSerializable(typeof(SessionsCheckInUseResult))] [JsonSerializable(typeof(SessionsCloseRequest))] [JsonSerializable(typeof(SessionsCloseResult))] [JsonSerializable(typeof(SessionsEnrichMetadataRequest))] [JsonSerializable(typeof(SessionsFindByPrefixRequest))] [JsonSerializable(typeof(SessionsFindByPrefixResult))] [JsonSerializable(typeof(SessionsFindByTaskIDRequest))] [JsonSerializable(typeof(SessionsFindByTaskIDResult))] [JsonSerializable(typeof(SessionsForkRequest))] [JsonSerializable(typeof(SessionsForkResult))] [JsonSerializable(typeof(SessionsGetEventFilePathRequest))] [JsonSerializable(typeof(SessionsGetEventFilePathResult))] [JsonSerializable(typeof(SessionsGetLastForContextRequest))] [JsonSerializable(typeof(SessionsGetLastForContextResult))] [JsonSerializable(typeof(SessionsGetPersistedRemoteSteerableRequest))] [JsonSerializable(typeof(SessionsGetPersistedRemoteSteerableResult))] [JsonSerializable(typeof(SessionsListRequest))] [JsonSerializable(typeof(SessionsLoadDeferredRepoHooksRequest))] [JsonSerializable(typeof(SessionsPruneOldRequest))] [JsonSerializable(typeof(SessionsReleaseLockRequest))] [JsonSerializable(typeof(SessionsReleaseLockResult))] [JsonSerializable(typeof(SessionsReloadPluginHooksRequest))] [JsonSerializable(typeof(SessionsReloadPluginHooksResult))] [JsonSerializable(typeof(SessionsSaveRequest))] [JsonSerializable(typeof(SessionsSaveResult))] [JsonSerializable(typeof(SessionsSetAdditionalPluginsRequest))] [JsonSerializable(typeof(SessionsSetAdditionalPluginsResult))] [JsonSerializable(typeof(ShellExecRequest))] [JsonSerializable(typeof(ShellExecResult))] [JsonSerializable(typeof(ShellKillRequest))] [JsonSerializable(typeof(ShellKillResult))] [JsonSerializable(typeof(ShutdownRequest))] [JsonSerializable(typeof(Skill))] [JsonSerializable(typeof(SkillList))] [JsonSerializable(typeof(SkillsConfigSetDisabledSkillsRequest))] [JsonSerializable(typeof(SkillsDisableRequest))] [JsonSerializable(typeof(SkillsDiscoverRequest))] [JsonSerializable(typeof(SkillsEnableRequest))] [JsonSerializable(typeof(SkillsGetInvokedResult))] [JsonSerializable(typeof(SkillsInvokedSkill))] [JsonSerializable(typeof(SkillsLoadDiagnostics))] [JsonSerializable(typeof(SlashCommandInfo))] [JsonSerializable(typeof(SlashCommandInput))] [JsonSerializable(typeof(SlashCommandInvocationResult))] [JsonSerializable(typeof(SlashCommandSelectSubcommandOption))] [JsonSerializable(typeof(TaskInfo))] [JsonSerializable(typeof(TaskList))] [JsonSerializable(typeof(TaskProgressLine))] [JsonSerializable(typeof(TasksCancelRequest))] [JsonSerializable(typeof(TasksCancelResult))] [JsonSerializable(typeof(TasksGetCurrentPromotableResult))] [JsonSerializable(typeof(TasksGetProgressRequest))] [JsonSerializable(typeof(TasksGetProgressResult))] [JsonSerializable(typeof(TasksGetProgressResultProgress))] [JsonSerializable(typeof(TasksPromoteCurrentToBackgroundResult))] [JsonSerializable(typeof(TasksPromoteToBackgroundRequest))] [JsonSerializable(typeof(TasksPromoteToBackgroundResult))] [JsonSerializable(typeof(TasksRefreshResult))] [JsonSerializable(typeof(TasksRemoveRequest))] [JsonSerializable(typeof(TasksRemoveResult))] [JsonSerializable(typeof(TasksSendMessageRequest))] [JsonSerializable(typeof(TasksSendMessageResult))] [JsonSerializable(typeof(TasksStartAgentRequest))] [JsonSerializable(typeof(TasksStartAgentResult))] [JsonSerializable(typeof(TasksWaitForPendingResult))] [JsonSerializable(typeof(TelemetrySetFeatureOverridesRequest))] [JsonSerializable(typeof(Tool))] [JsonSerializable(typeof(ToolList))] [JsonSerializable(typeof(ToolsInitializeAndValidateResult))] [JsonSerializable(typeof(ToolsListRequest))] [JsonSerializable(typeof(UIElicitationRequest))] [JsonSerializable(typeof(UIElicitationResponse))] [JsonSerializable(typeof(UIElicitationResult))] [JsonSerializable(typeof(UIElicitationSchema))] [JsonSerializable(typeof(UIExitPlanModeResponse))] [JsonSerializable(typeof(UIHandlePendingAutoModeSwitchRequest))] [JsonSerializable(typeof(UIHandlePendingElicitationRequest))] [JsonSerializable(typeof(UIHandlePendingExitPlanModeRequest))] [JsonSerializable(typeof(UIHandlePendingResult))] [JsonSerializable(typeof(UIHandlePendingSamplingRequest))] [JsonSerializable(typeof(UIHandlePendingSamplingResponse))] [JsonSerializable(typeof(UIHandlePendingUserInputRequest))] [JsonSerializable(typeof(UIRegisterDirectAutoModeSwitchHandlerResult))] [JsonSerializable(typeof(UIUnregisterDirectAutoModeSwitchHandlerRequest))] [JsonSerializable(typeof(UIUnregisterDirectAutoModeSwitchHandlerResult))] [JsonSerializable(typeof(UIUserInputResponse))] [JsonSerializable(typeof(UsageGetMetricsResult))] [JsonSerializable(typeof(UsageMetricsCodeChanges))] [JsonSerializable(typeof(UsageMetricsModelMetric))] [JsonSerializable(typeof(UsageMetricsModelMetricRequests))] [JsonSerializable(typeof(UsageMetricsModelMetricTokenDetail))] [JsonSerializable(typeof(UsageMetricsModelMetricUsage))] [JsonSerializable(typeof(UsageMetricsTokenDetail))] [JsonSerializable(typeof(WorkspacesCheckpoints))] [JsonSerializable(typeof(WorkspacesCreateFileRequest))] [JsonSerializable(typeof(WorkspacesGetWorkspaceResult))] [JsonSerializable(typeof(WorkspacesGetWorkspaceResultWorkspace))] [JsonSerializable(typeof(WorkspacesListCheckpointsResult))] [JsonSerializable(typeof(WorkspacesListFilesResult))] [JsonSerializable(typeof(WorkspacesReadCheckpointRequest))] [JsonSerializable(typeof(WorkspacesReadCheckpointResult))] [JsonSerializable(typeof(WorkspacesReadFileRequest))] [JsonSerializable(typeof(WorkspacesReadFileResult))] [JsonSerializable(typeof(WorkspacesSaveLargePasteRequest))] [JsonSerializable(typeof(WorkspacesSaveLargePasteResult))] [JsonSerializable(typeof(WorkspacesSaveLargePasteResultSaved))] internal partial class RpcJsonContext : JsonSerializerContext;