/*--------------------------------------------------------------------------------------------- * 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. [Experimental(Diagnostics.Experimental)] 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. [Experimental(Diagnostics.Experimental)] 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. [Experimental(Diagnostics.Experimental)] 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; } /// Task kinds the server may return to this connection. [JsonPropertyName("taskKinds")] public IList? TaskKinds { get; set; } /// Server package version. [JsonPropertyName("version")] public string Version { get; set; } = string.Empty; } /// Identity of the integrating host, declared once on the `server.connect` handshake so telemetry from this connection is attributed to a single, consistent surface. All fields are optional; omit them to keep the default attribution. [Experimental(Diagnostics.Experimental)] internal sealed class ConnectClientInfo { /// Name of the host editor, e.g. `"vscode"`. [JsonPropertyName("editorName")] public string? EditorName { get; set; } /// Version of the host editor, e.g. `"1.124.2"`. Ignored unless it looks like a version string. [JsonPropertyName("editorVersion")] public string? EditorVersion { get; set; } /// Name of the Copilot extension within the host, e.g. `"copilot-chat"`. [JsonPropertyName("extensionName")] public string? ExtensionName { get; set; } /// Version of the Copilot extension within the host, e.g. `"0.54.0"`. Ignored unless it looks like a version string. [JsonPropertyName("extensionVersion")] public string? ExtensionVersion { get; set; } } /// Connection-level opt-ins for the `server.connect` handshake. Transport authentication is consumed by the native protocol boundary before dispatch. [Experimental(Diagnostics.Experimental)] internal sealed class ConnectRequest { /// Identity of the integrating host. Optional; omit it to keep the default attribution. [JsonPropertyName("clientInfo")] public ConnectClientInfo? ClientInfo { get; set; } /// Opt this connection in to GitHub telemetry forwarding for its lifetime. When set, the runtime forwards every internal telemetry event it emits — across all sessions, plus sessionless events — to this connection over the `gitHubTelemetry.event` notification. Regular events are also written to the runtime's normal GitHub/CTS path (dual-write); host-only compatibility events are forward-only and intentionally skip that path. Intended for first-party hosts that re-emit the events into their own telemetry stores. Both unrestricted and restricted events are forwarded, each tagged with a `restricted` discriminator; a backstop drops restricted events when restricted telemetry is disabled — using the process-global gate for ordinary events and an explicit session-scoped decision for host-only events. [JsonPropertyName("enableGitHubTelemetryForwarding")] public bool? EnableGitHubTelemetryForwarding { get; set; } /// Task kinds this connection can decode when observing session tasks. Omit to retain agent and shell compatibility. [JsonPropertyName("supportedTaskKinds")] public IList? SupportedTaskKinds { get; set; } /// Connection token; required when the server was started with COPILOT_CONNECTION_TOKEN. [JsonPropertyName("token")] public string? Token { get; set; } } /// One server-discovered hook action from user, repository, plugin, or managed-policy configuration. [Experimental(Diagnostics.Experimental)] public sealed class DiscoveredHook { /// Durable content hash used by hook enablement. Identical actions may intentionally share this key. Omitted when changing the user's disabled-hooks setting cannot change the action's current server-discovered state, including managed-policy hooks, session-start prompt actions, actions suppressed by disable-all settings, and projectless plugin actions that require project-directory expansion. [JsonPropertyName("disableKey")] public string? DisableKey { get; set; } /// Whether this action is enabled under the server-side discovery settings. Concrete sessions may differ because they can add session-specific directories, plugins, or trust. False when its disable key is present in the user's disabled-hooks setting or disable-all settings suppress the action. [JsonPropertyName("enabled")] public bool Enabled { get; set; } /// Hook event that invokes this action. [JsonPropertyName("hookType")] public HookType HookType { get; set; } /// Deterministic identifier for this server-discovered action row. It remains stable while the project, origin, source, event, action content, and duplicate ordinal are unchanged. This is row identity, not the key persisted in disabledHooks. [JsonPropertyName("id")] public string Id { get; set; } = string.Empty; /// Configuration tier that contributed this hook action. [JsonPropertyName("origin")] public HookOrigin Origin { get; set; } /// Input project path for which this server-side action was resolved. Set on every row returned for project-scoped discovery, including repeated user and policy actions. [JsonPropertyName("projectPath")] public string? ProjectPath { get; set; } /// Human-readable source label, such as a hook file path, settings source, or plugin name. [JsonPropertyName("source")] public string? Source { get; set; } } /// Server-discovered hook actions and partial-load diagnostics from user, repository, plugin, and managed-policy sources. Concrete sessions may include additional session-specific hook sources. [Experimental(Diagnostics.Experimental)] public sealed class HooksDiscoverResult { /// Errors for hook sources or actions that could not be loaded, making the result partially incomplete. Other valid actions are still returned. Project-resolution and repository-settings errors are prefixed with their project path. [JsonPropertyName("errors")] public IList Errors { get => field ??= []; set; } /// All discovered hook actions. Byte-identical actions remain separate rows even when they share a disable key. [JsonPropertyName("hooks")] public IList Hooks { get => field ??= []; set; } /// Non-fatal source-loading warnings. Discovery remains complete for the affected source, although the source had a recoverable issue. Repository-settings warnings are prefixed with their project path when attribution is available. [JsonPropertyName("warnings")] public IList Warnings { get => field ??= []; set; } } /// Optional project paths and host-exclusion behavior for server-scoped hook discovery. [Experimental(Diagnostics.Experimental)] internal sealed class HooksDiscoverRequest { /// When true, omit host-owned user and plugin hook rows and their diagnostics. Managed-policy hooks and trusted repository hooks remain visible, and host disabledHooks still contribute to each remaining row's effective enabled state. This filters sources rather than simulating a host with no settings. [JsonPropertyName("excludeHostHooks")] public bool? ExcludeHostHooks { get; set; } /// Optional project directory paths whose trusted repository and project-expanded plugin hooks should be discovered. When omitted or empty, user, managed-policy, and globally enabled installed or explicit plugin hooks are returned without project expansion. [JsonPropertyName("projectPaths")] public IList? ProjectPaths { get; set; } } /// Active server-driven promotion for a model, including its discount and optional expiry. [Experimental(Diagnostics.Experimental)] public sealed class ModelBillingPromo { /// Percentage discount (0-100) applied while the promotion is active. May be fractional. [JsonPropertyName("discountPercent")] public double? DiscountPercent { get; set; } /// UTC ISO 8601 timestamp marking when the promotion ends. Optional: an open-ended promotion omits this field. When present, the API only surfaces a promo whose expiry parses and is in the future, so consumers should treat a past value as expired. [JsonPropertyName("endsAt")] public string? EndsAt { get; set; } /// Stable identifier for the promotion campaign. [JsonPropertyName("id")] public string? Id { get; set; } /// Human-readable promotion message. Does not include the expiry timestamp; consumers may format endsAt and append it when present. [JsonPropertyName("message")] public string? Message { get; set; } /// Whether the service asked hosts to give this promotion a prominent surface, such as a dedicated banner, in addition to listing it with the model. `true` requests that surface and `false` asks for the model list only. Absent means the service expressed no preference — for example a response that predates the field — so hosts should apply their own default rather than read it as `false`. [JsonPropertyName("showBanner")] public bool? ShowBanner { get; set; } } /// Long context tier pricing (available for models with extended context windows). [Experimental(Diagnostics.Experimental)] public sealed class ModelBillingTokenPricesLongContext { /// Use cacheReadPrice instead. AI Credits cost per billing batch of cached tokens. [EditorBrowsable(EditorBrowsableState.Never)] #if NET5_0_OR_GREATER [Obsolete("This member is deprecated and will be removed in a future version.", DiagnosticId = "GHCP001")] #endif [JsonPropertyName("cachePrice")] public double? CachePrice { get; set; } /// AI Credits cost per billing batch of cached (read) tokens. [JsonPropertyName("cacheReadPrice")] public double? CacheReadPrice { get; set; } /// AI Credits cost per billing batch of 1-hour cache-write (cache creation) tokens. [JsonPropertyName("cacheWrite1hPrice")] public double? CacheWrite1hPrice { get; set; } /// AI Credits cost per billing batch of cache-write (cache creation) tokens. [JsonPropertyName("cacheWritePrice")] public double? CacheWritePrice { get; set; } /// Use maxPromptTokens instead. Prompt token budget for the long context tier. The total context window is this value plus the model's max_output_tokens. [EditorBrowsable(EditorBrowsableState.Never)] #if NET5_0_OR_GREATER [Obsolete("This member is deprecated and will be removed in a future version.", DiagnosticId = "GHCP001")] #endif [JsonPropertyName("contextMax")] public long? ContextMax { get; set; } /// AI Credits cost per billing batch of input tokens. [JsonPropertyName("inputPrice")] public double? InputPrice { get; set; } /// Prompt token budget for the long context tier. The total context window is this value plus the model's max_output_tokens. [JsonPropertyName("maxPromptTokens")] public long? MaxPromptTokens { get; set; } /// AI Credits cost per billing batch of output tokens. [JsonPropertyName("outputPrice")] public double? OutputPrice { get; set; } } /// Token-level pricing information for this model. [Experimental(Diagnostics.Experimental)] public sealed class ModelBillingTokenPrices { /// Number of tokens per standard billing batch. [JsonPropertyName("batchSize")] public long? BatchSize { get; set; } /// Use cacheReadPrice instead. AI Credits cost per billing batch of cached tokens. [EditorBrowsable(EditorBrowsableState.Never)] #if NET5_0_OR_GREATER [Obsolete("This member is deprecated and will be removed in a future version.", DiagnosticId = "GHCP001")] #endif [JsonPropertyName("cachePrice")] public double? CachePrice { get; set; } /// AI Credits cost per billing batch of cached (read) tokens. [JsonPropertyName("cacheReadPrice")] public double? CacheReadPrice { get; set; } /// AI Credits cost per billing batch of 1-hour cache-write (cache creation) tokens. [JsonPropertyName("cacheWrite1hPrice")] public double? CacheWrite1hPrice { get; set; } /// AI Credits cost per billing batch of cache-write (cache creation) tokens. [JsonPropertyName("cacheWritePrice")] public double? CacheWritePrice { get; set; } /// Use maxPromptTokens instead. Prompt token budget for the default tier. The total context window is this value plus the model's max_output_tokens. [EditorBrowsable(EditorBrowsableState.Never)] #if NET5_0_OR_GREATER [Obsolete("This member is deprecated and will be removed in a future version.", DiagnosticId = "GHCP001")] #endif [JsonPropertyName("contextMax")] public long? ContextMax { get; set; } /// AI Credits cost per billing batch of input tokens. [JsonPropertyName("inputPrice")] public double? InputPrice { get; set; } /// Long context tier pricing (available for models with extended context windows). [JsonPropertyName("longContext")] public ModelBillingTokenPricesLongContext? LongContext { get; set; } /// Prompt token budget for the default tier. The total context window is this value plus the model's max_output_tokens. [JsonPropertyName("maxPromptTokens")] public long? MaxPromptTokens { get; set; } /// AI Credits cost per billing batch of output tokens. [JsonPropertyName("outputPrice")] public double? OutputPrice { get; set; } } /// Billing information. [Experimental(Diagnostics.Experimental)] public sealed class ModelBilling { /// Whole-number percentage discount (0-100) applied to usage billed through this model. Populated for the synthetic `auto` model, where requests routed by auto-mode are billed at a reduced rate; absent for concrete models. [JsonPropertyName("discountPercent")] public int? DiscountPercent { get; set; } /// Billing cost multiplier relative to the base rate. [JsonPropertyName("multiplier")] public double? Multiplier { get; set; } /// Active server-driven promotion for this model, if any. Present when the model is being promoted with a discount, which may be time-boxed or open-ended. [JsonPropertyName("promo")] public ModelBillingPromo? Promo { get; set; } /// Token-level pricing information for this model. [JsonPropertyName("tokenPrices")] public ModelBillingTokenPrices? TokenPrices { get; set; } } /// Vision-specific limits. [Experimental(Diagnostics.Experimental)] 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. [Experimental(Diagnostics.Experimental)] 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. [Experimental(Diagnostics.Experimental)] public sealed class ModelCapabilitiesSupports { /// Resolved Anthropic adaptive-thinking capability — unsupported / optional / required. 'required' models reject thinking.type='enabled' with HTTP 400 (e.g. opus-4.7/4.8). [JsonPropertyName("adaptive_thinking")] public AdaptiveThinkingSupport? AdaptiveThinking { get; set; } /// 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. [Experimental(Diagnostics.Experimental)] 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; } } /// A service-published message about a model, carrying a stable machine-readable code alongside human-readable text. [Experimental(Diagnostics.Experimental)] public sealed class ModelMessage { /// Stable machine-readable identifier for the message, such as `client_version_deprecated`. Hosts can key custom presentation off this; unrecognized codes should fall back to displaying `message`. [JsonPropertyName("code")] public string Code { get; set; } = string.Empty; /// Human-readable message text intended for display to the user. [JsonPropertyName("message")] public string Message { get; set; } = string.Empty; } /// Policy state (if applicable). [Experimental(Diagnostics.Experimental)] 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; } } /// Service-published warning text that hosts should display when presenting a model. [Experimental(Diagnostics.Experimental)] public sealed class ModelWarningText { /// Data-retention warning for the model. The text may contain Markdown links and should be rendered as Markdown when supported. [JsonPropertyName("dataRetention")] public string? DataRetention { get; set; } } /// Copilot model metadata, including identifier, display name, capabilities, policy, billing, reasoning efforts, and picker categories. [Experimental(Diagnostics.Experimental)] 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; /// Informational notices the service published for this model, such as an upcoming change or a recommended alternative. Present only when the service published at least one notice. Hosts should surface these without implying anything is wrong with the model. [JsonPropertyName("infoMessages")] public IList? InfoMessages { get; set; } /// Provider-supplied model metadata. Keys and JSON-compatible values are preserved unchanged. This is factual metadata published by the model provider; it carries no picker or UX semantics. [JsonPropertyName("metadata")] public IDictionary? Metadata { get; set; } /// 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; } /// Context-window tiers this model offers, when the provider advertises them independently of tiered token pricing. Copilot models carry their tiers in `billing.tokenPrices`; a provider that has no pricing to publish (an agent host reached over AHP, for example) declares them here instead, so the model picker can still offer the tier toggle. [JsonPropertyName("supportedContextTiers")] public IList? SupportedContextTiers { get; set; } /// Supported reasoning effort levels (only present if model supports reasoning effort). [JsonPropertyName("supportedReasoningEfforts")] public IList? SupportedReasoningEfforts { get; set; } /// Warnings the service published for this model, such as a deprecated client version. Present only when the service published at least one warning. The model remains usable; hosts should surface these as advisory rather than blocking. [JsonPropertyName("warningMessages")] public IList? WarningMessages { get; set; } /// Warning text the service requires hosts to surface for this model. Present only when the service published at least one warning. [JsonPropertyName("warningText")] public ModelWarningText? WarningText { get; set; } } /// List of Copilot models available to the resolved user, including capabilities and billing metadata. [Experimental(Diagnostics.Experimental)] 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. [Experimental(Diagnostics.Experimental)] internal sealed class ModelsListRequest { /// GitHub token accepted for compatibility with existing SDK clients. When provided, resolves this token instead of using the current account. [JsonPropertyName("gitHubToken")] public string? GitHubToken { get; set; } /// Opaque account identifier returned by `account.getAllUsers`. When omitted, the current account is used. [JsonPropertyName("selectionId")] public string? SelectionId { get; set; } } /// A well-known model in the runtime's built-in catalog. [Experimental(Diagnostics.Experimental)] public sealed class BuiltInModelCatalogEntry { /// Well-known runtime model ID suitable for provider or provider-model metadata. This is not necessarily the provider-facing deployment or model name and does not indicate CAPI entitlement or provider availability. [JsonPropertyName("id")] public string Id { get; set; } = string.Empty; } /// The running runtime's complete catalog of well-known built-in model IDs, including supported models and additional IDs with built-in metadata. [Experimental(Diagnostics.Experimental)] public sealed class BuiltInModelCatalog { /// Built-in model entries. [JsonPropertyName("models")] public IList Models { get => field ??= []; set; } } /// Built-in tool metadata with identifier, optional namespaced name, description, input-parameter schema, and usage instructions. [Experimental(Diagnostics.Experimental)] 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. [Experimental(Diagnostics.Experimental)] 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. [Experimental(Diagnostics.Experimental)] internal sealed class ToolsListRequest { /// Optional model ID — when provided, the returned tool list reflects model-specific overrides. [JsonPropertyName("model")] public string? Model { get; set; } } /// Quota usage snapshot for a Copilot quota type, including entitlement, used requests, overage, reset date, and remaining percentage. [Experimental(Diagnostics.Experimental)] 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. [Experimental(Diagnostics.Experimental)] 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. [Experimental(Diagnostics.Experimental)] internal sealed class AccountGetQuotaRequest { /// GitHub token accepted for compatibility with existing SDK clients. When provided, resolves this token instead of using the current account. [JsonPropertyName("gitHubToken")] public string? GitHubToken { get; set; } /// Opaque account identifier returned by `account.getAllUsers`. When omitted, the current account is used. [JsonPropertyName("selectionId")] public string? SelectionId { get; set; } } /// Authentication credentials accepted only at native protocol ingress. Runtime outputs use credential-free `AuthIdentity` metadata. /// 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(AuthInfoTokenProvider), "token-provider")] [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; } /// Endpoint URLs from the raw Copilot `/copilot_internal/v2/token` user-response passthrough. [Experimental(Diagnostics.Experimental)] public sealed class CopilotUserResponseEndpoints { /// Copilot API endpoint URL. [JsonPropertyName("api")] public string? Api { get; set; } /// Experimental-service endpoint URL. [JsonPropertyName("exp")] public string? Exp { get; set; } /// Origin-tracker endpoint URL. [JsonPropertyName("origin-tracker")] public string? OriginTracker { get; set; } /// Copilot proxy endpoint URL. [JsonPropertyName("proxy")] public string? Proxy { get; set; } /// Copilot telemetry endpoint URL. [JsonPropertyName("telemetry")] public string? Telemetry { get; set; } } /// RPC data type for CopilotUserResponseOrganizationListItem operations. public sealed class CopilotUserResponseOrganizationListItem { /// GitHub login of the organization. [JsonPropertyName("login")] public string? Login { get; set; } /// Display name of the organization. [JsonPropertyName("name")] public string? Name { get; set; } } /// Chat quota snapshot from the raw Copilot user-response passthrough, with entitlement, overage, remaining quota, reset, and billing fields. [Experimental(Diagnostics.Experimental)] public sealed class CopilotUserResponseQuotaSnapshotsChat { /// Number of requests/units included in the entitlement for this period; `-1` denotes an unlimited entitlement. [JsonPropertyName("entitlement")] public double? Entitlement { get; set; } /// Whether the user currently has quota available; when `false` and not unlimited, further requests are blocked until the quota resets. [JsonPropertyName("has_quota")] public bool? HasQuota { get; set; } /// Count of additional pay-per-request usage consumed this period beyond the entitlement. [JsonPropertyName("overage_count")] public double? OverageCount { get; set; } /// Whether usage may continue at pay-per-request rates once the entitlement is exhausted. [JsonPropertyName("overage_permitted")] public bool? OveragePermitted { get; set; } /// Percentage of the entitlement remaining at the snapshot timestamp. [JsonPropertyName("percent_remaining")] public double? PercentRemaining { get; set; } /// Identifier of the quota bucket this snapshot describes. [JsonPropertyName("quota_id")] public string? QuotaId { get; set; } /// Amount of quota remaining at the snapshot timestamp. [JsonPropertyName("quota_remaining")] public double? QuotaRemaining { get; set; } /// Unix epoch time, in seconds, when this quota next resets. [JsonPropertyName("quota_reset_at")] public double? QuotaResetAt { get; set; } /// Remaining entitlement/quota amount at the snapshot timestamp. [JsonPropertyName("remaining")] public double? Remaining { get; set; } /// UTC timestamp when this snapshot was captured. [JsonPropertyName("timestamp_utc")] public string? TimestampUtc { get; set; } /// Whether this category uses usage-based (token/AI-credit) billing rather than a fixed premium-request count. [JsonPropertyName("token_based_billing")] public bool? TokenBasedBilling { get; set; } /// Whether the entitlement for this category is unlimited. [JsonPropertyName("unlimited")] public bool? Unlimited { get; set; } } /// Completions quota snapshot from the raw Copilot user-response passthrough, with entitlement, overage, remaining quota, reset, and billing fields. [Experimental(Diagnostics.Experimental)] public sealed class CopilotUserResponseQuotaSnapshotsCompletions { /// Number of requests/units included in the entitlement for this period; `-1` denotes an unlimited entitlement. [JsonPropertyName("entitlement")] public double? Entitlement { get; set; } /// Whether the user currently has quota available; when `false` and not unlimited, further requests are blocked until the quota resets. [JsonPropertyName("has_quota")] public bool? HasQuota { get; set; } /// Count of additional pay-per-request usage consumed this period beyond the entitlement. [JsonPropertyName("overage_count")] public double? OverageCount { get; set; } /// Whether usage may continue at pay-per-request rates once the entitlement is exhausted. [JsonPropertyName("overage_permitted")] public bool? OveragePermitted { get; set; } /// Percentage of the entitlement remaining at the snapshot timestamp. [JsonPropertyName("percent_remaining")] public double? PercentRemaining { get; set; } /// Identifier of the quota bucket this snapshot describes. [JsonPropertyName("quota_id")] public string? QuotaId { get; set; } /// Amount of quota remaining at the snapshot timestamp. [JsonPropertyName("quota_remaining")] public double? QuotaRemaining { get; set; } /// Unix epoch time, in seconds, when this quota next resets. [JsonPropertyName("quota_reset_at")] public double? QuotaResetAt { get; set; } /// Remaining entitlement/quota amount at the snapshot timestamp. [JsonPropertyName("remaining")] public double? Remaining { get; set; } /// UTC timestamp when this snapshot was captured. [JsonPropertyName("timestamp_utc")] public string? TimestampUtc { get; set; } /// Whether this category uses usage-based (token/AI-credit) billing rather than a fixed premium-request count. [JsonPropertyName("token_based_billing")] public bool? TokenBasedBilling { get; set; } /// Whether the entitlement for this category is unlimited. [JsonPropertyName("unlimited")] public bool? Unlimited { get; set; } } /// Premium-interactions quota snapshot from the raw Copilot user-response passthrough, with entitlement, overage, remaining quota, reset, and billing fields. [Experimental(Diagnostics.Experimental)] public sealed class CopilotUserResponseQuotaSnapshotsPremiumInteractions { /// Number of requests/units included in the entitlement for this period; `-1` denotes an unlimited entitlement. [JsonPropertyName("entitlement")] public double? Entitlement { get; set; } /// Whether the user currently has quota available; when `false` and not unlimited, further requests are blocked until the quota resets. [JsonPropertyName("has_quota")] public bool? HasQuota { get; set; } /// Count of additional pay-per-request usage consumed this period beyond the entitlement. [JsonPropertyName("overage_count")] public double? OverageCount { get; set; } /// Whether usage may continue at pay-per-request rates once the entitlement is exhausted. [JsonPropertyName("overage_permitted")] public bool? OveragePermitted { get; set; } /// Percentage of the entitlement remaining at the snapshot timestamp. [JsonPropertyName("percent_remaining")] public double? PercentRemaining { get; set; } /// Identifier of the quota bucket this snapshot describes. [JsonPropertyName("quota_id")] public string? QuotaId { get; set; } /// Amount of quota remaining at the snapshot timestamp. [JsonPropertyName("quota_remaining")] public double? QuotaRemaining { get; set; } /// Unix epoch time, in seconds, when this quota next resets. [JsonPropertyName("quota_reset_at")] public double? QuotaResetAt { get; set; } /// Remaining entitlement/quota amount at the snapshot timestamp. [JsonPropertyName("remaining")] public double? Remaining { get; set; } /// UTC timestamp when this snapshot was captured. [JsonPropertyName("timestamp_utc")] public string? TimestampUtc { get; set; } /// Whether this category uses usage-based (token/AI-credit) billing rather than a fixed premium-request count. [JsonPropertyName("token_based_billing")] public bool? TokenBasedBilling { get; set; } /// Whether the entitlement for this category is unlimited. [JsonPropertyName("unlimited")] public bool? Unlimited { get; set; } } /// Quota snapshot map from the raw Copilot user-response passthrough, with chat, completions, premium-interactions, and other entries. [Experimental(Diagnostics.Experimental)] public sealed class CopilotUserResponseQuotaSnapshots { /// Chat quota snapshot from the raw Copilot user-response passthrough, with entitlement, overage, remaining quota, reset, and billing fields. [JsonPropertyName("chat")] public CopilotUserResponseQuotaSnapshotsChat? Chat { get; set; } /// Completions quota snapshot from the raw Copilot user-response passthrough, with entitlement, overage, remaining quota, reset, and billing fields. [JsonPropertyName("completions")] public CopilotUserResponseQuotaSnapshotsCompletions? Completions { get; set; } /// Premium-interactions quota snapshot from the raw Copilot user-response passthrough, with entitlement, overage, remaining quota, reset, and billing fields. [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 { /// Copilot access SKU identifier (e.g. `free_limited_copilot`, `copilot_for_business_seat_quota`) used to gate model and feature access. [JsonPropertyName("access_type_sku")] public string? AccessTypeSku { get; set; } /// Opaque analytics tracking identifier for the user, forwarded from the Copilot API. [JsonPropertyName("analytics_tracking_id")] public string? AnalyticsTrackingId { get; set; } /// Date the Copilot seat was assigned to the user, if applicable. [JsonPropertyName("assigned_date")] public string? AssignedDate { get; set; } /// Whether the user is eligible to sign up for the free/limited Copilot tier. [JsonPropertyName("can_signup_for_limited")] public bool? CanSignupForLimited { get; set; } /// Whether the user is able to upgrade their Copilot plan. [JsonPropertyName("can_upgrade_plan")] public bool? CanUpgradePlan { get; set; } /// Whether Copilot chat is enabled for the user. [JsonPropertyName("chat_enabled")] public bool? ChatEnabled { get; set; } /// Whether CLI remote control is enabled for the user. [JsonPropertyName("cli_remote_control_enabled")] public bool? CliRemoteControlEnabled { get; set; } /// Whether cloud session storage is enabled for the user. [JsonPropertyName("cloud_session_storage_enabled")] public bool? CloudSessionStorageEnabled { get; set; } /// Whether the Codex agent is enabled for the user. [JsonPropertyName("codex_agent_enabled")] public bool? CodexAgentEnabled { get; set; } /// Copilot plan name for the user (e.g. `individual`, `business`, `enterprise`). [JsonPropertyName("copilot_plan")] public string? CopilotPlan { get; set; } /// Whether `.copilotignore` content-exclusion support is enabled for the user. [JsonPropertyName("copilotignore_enabled")] public bool? CopilotignoreEnabled { get; set; } /// Endpoint URLs from the raw Copilot `/copilot_internal/v2/token` user-response passthrough. [JsonPropertyName("endpoints")] public CopilotUserResponseEndpoints? Endpoints { get; set; } /// Whether MCP (Model Context Protocol) support is enabled for the user. [JsonPropertyName("is_mcp_enabled")] public bool? IsMcpEnabled { get; set; } /// Whether the user is a GitHub/Microsoft staff member. [JsonPropertyName("is_staff")] public bool? IsStaff { get; set; } /// Per-category quota allotments for free/limited-tier users, keyed by quota category. [JsonPropertyName("limited_user_quotas")] public IDictionary? LimitedUserQuotas { get; set; } /// Date the free/limited-tier user's quotas next reset, as a raw string from the Copilot API. [JsonPropertyName("limited_user_reset_date")] public string? LimitedUserResetDate { get; set; } /// GitHub login of the authenticated user. [JsonPropertyName("login")] public string? Login { get; set; } /// Per-category monthly quota allotments, keyed by quota category. [JsonPropertyName("monthly_quotas")] public IDictionary? MonthlyQuotas { get; set; } /// Organizations the user belongs to, each with an optional login and display name. [JsonPropertyName("organization_list")] public IList? OrganizationList { get; set; } /// Logins of the organizations the user belongs to. [JsonPropertyName("organization_login_list")] public IList? OrganizationLoginList { get; set; } /// Date the user's usage quota next resets, as a raw string from the Copilot API; see `quota_reset_date_utc` for the UTC-normalized value. [JsonPropertyName("quota_reset_date")] public string? QuotaResetDate { get; set; } /// UTC-normalized form of `quota_reset_date` (the date the user's usage quota next resets). [JsonPropertyName("quota_reset_date_utc")] public string? QuotaResetDateUtc { get; set; } /// Quota snapshot map from the raw Copilot user-response passthrough, with chat, completions, premium-interactions, and other entries. [JsonPropertyName("quota_snapshots")] public CopilotUserResponseQuotaSnapshots? QuotaSnapshots { get; set; } /// Whether the user's telemetry is subject to restricted-data handling. [JsonPropertyName("restricted_telemetry")] public bool? RestrictedTelemetry { get; set; } /// Raw passthrough of the Copilot API `te` flag for the user (an opaque server-side eligibility signal surfaced in telemetry); not otherwise interpreted by the runtime. [JsonPropertyName("te")] public bool? Te { get; set; } /// Whether the account is on usage-based (token/AI-credit) billing rather than a fixed premium-request quota. [JsonPropertyName("token_based_billing")] public bool? TokenBasedBilling { get; set; } } /// Authentication-info input variant for GitHub-internal HMAC auth, carrying the public GitHub host and HMAC secret. /// 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; } } /// Authentication-info input variant for a token sourced from an environment variable, with host, optional login, token, and env var name. /// 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; } } /// Authentication-info input variant for SDK-configured token authentication, carrying host and the secret token value. /// 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; } /// Opaque native GitHub credential registration backing this token identity, when applicable. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("registrationId")] public string? RegistrationId { get; set; } /// The token value itself. Treat as a secret. [JsonPropertyName("token")] public required string Token { get; set; } } /// Authentication-info variant backed by an SDK GitHub token callback. It carries routing metadata but never a plaintext token. /// The token-provider variant of . [Experimental(Diagnostics.Experimental)] public partial class AuthInfoTokenProvider : AuthInfo { /// [JsonIgnore] public override string Type => "token-provider"; /// Snapshot of the authenticated user's Copilot subscription info, if known. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("copilotUser")] public CopilotUserResponse? CopilotUser { get; set; } /// Authentication host. [JsonPropertyName("host")] public required string Host { get; set; } /// Opaque SDK callback registration identifier. [JsonPropertyName("registrationId")] public required string RegistrationId { get; set; } } /// Authentication-info variant for direct Copilot API token auth sourced from environment variables, with public GitHub host. /// 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; } } /// Authentication-info variant for OAuth user auth, with host and login; the token remains in the runtime secret store. /// 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; } } /// Authentication-info input variant for GitHub CLI credentials, carrying host, login, and the `gh auth token` value. /// 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; } } /// Authentication-info input variant for API-key authentication to a non-GitHub LLM provider, carrying the secret `apiKey` and host. /// 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; } } /// Current authentication state. [Experimental(Diagnostics.Experimental)] public sealed class AccountGetCurrentAuthResult { /// Authentication errors from the last auth attempt, if any. [JsonPropertyName("authErrors")] public IList? AuthErrors { get; set; } /// Current authentication information, if authenticated. [JsonPropertyName("authInfo")] public AuthInfo? AuthInfo { get; set; } } /// Authenticated account entry returned by `account.getAllUsers`. [Experimental(Diagnostics.Experimental)] public sealed class AccountAllUsers { /// Authentication information for this user. [JsonPropertyName("authInfo")] public AuthInfo AuthInfo { get => field ??= new(); set; } /// Opaque identifier accepted by account and model selection APIs. [JsonPropertyName("selectionId")] public string? SelectionId { get; set; } /// Associated token, if available. [JsonPropertyName("token")] public string? Token { get; set; } } /// Result of a successful login; throws on failure. [Experimental(Diagnostics.Experimental)] public sealed class AccountLoginResult { /// Whether the credential was persisted to a secure store (system keychain, or the config file when plaintext storage is enabled). False when no secure store was available and the token was not saved, so the consumer can decide how to proceed. [JsonPropertyName("storedInVault")] public bool StoredInVault { get; set; } } /// Credentials to validate and store. Omit login to resolve the authenticated user from the token. [Experimental(Diagnostics.Experimental)] internal sealed class AccountLoginRequest { /// GitHub host URL. [JsonPropertyName("host")] public string Host { get; set; } = string.Empty; /// User login/username. When omitted, the runtime validates the token and resolves the login from GitHub. [JsonPropertyName("login")] public string? Login { get; set; } /// GitHub authentication token. [JsonPropertyName("token")] public string Token { get; set; } = string.Empty; } /// Logout result indicating if more users remain. [Experimental(Diagnostics.Experimental)] public sealed class AccountLogoutResult { /// Whether other authenticated users remain after logout. [JsonPropertyName("hasMoreUsers")] public bool HasMoreUsers { get; set; } } /// User to log out. [Experimental(Diagnostics.Experimental)] internal sealed class AccountLogoutRequest { /// Authentication information for the user to log out. [JsonPropertyName("authInfo")] public AuthInfo? AuthInfo { get; set; } /// Opaque account identifier returned by `account.getAllUsers`. [JsonPropertyName("selectionId")] public string? SelectionId { get; set; } } /// Confirmation that the secret values were registered. [Experimental(Diagnostics.Experimental)] 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. [Experimental(Diagnostics.Experimental)] internal sealed class SecretsAddFilterValuesRequest { /// Raw secret values to register for redaction. [JsonPropertyName("values")] public IList Values { get => field ??= []; set; } } /// Concrete configuration file containing an MCP server declaration. [Experimental(Diagnostics.Experimental)] public sealed class McpSourceFile { /// RFC 6901 JSON Pointer to the server declaration, when known. [JsonPropertyName("jsonPointer")] public string? JsonPointer { get; set; } /// Canonical file URI for the configuration document. [Url] [StringSyntax(StringSyntaxAttribute.Uri)] [JsonPropertyName("uri")] public string Uri { get; set; } = string.Empty; } /// Plugin identity associated with an MCP server declaration. [Experimental(Diagnostics.Experimental)] public sealed class McpSourcePlugin { /// Canonical plugin identity. [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; /// Human-readable plugin name, when available. [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; } /// Plugin version, when available. [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("version")] public string? Version { get; set; } } /// Canonical identity and location of the effective MCP server declaration. The declaration is uniquely addressed by this source id together with the discovered server name. [Experimental(Diagnostics.Experimental)] public sealed class McpSourceRef { /// Open semantic editability identifier. Known values are editable and read-only. [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("editability")] public string Editability { get; set; } = string.Empty; /// Configuration file location, when the declaration is file-backed. [JsonPropertyName("file")] public McpSourceFile? File { get; set; } /// Opaque stable identity for the configuration source. Clients must not parse this 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; /// Open source-kind identifier. Known values include user, workspace, invocation, plugin, builtin, and device-registry. [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("kind")] public string Kind { get; set; } = string.Empty; /// Plugin identity, when the declaration is plugin-provided. [JsonPropertyName("plugin")] public McpSourcePlugin? Plugin { get; set; } } /// MCP server discovered by `mcp.discover`, with config source, optional plugin source, transport type, and enabled state. [Experimental(Diagnostics.Experimental)] public sealed class DiscoveredMcpServer { /// Canonical identity and location of the effective server declaration. [JsonPropertyName("effectiveSource")] public McpSourceRef? EffectiveSource { get; set; } /// 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; } /// Plugin name that provided this server, when source is plugin. [JsonPropertyName("sourcePlugin")] public string? SourcePlugin { get; set; } /// Plugin version that provided this server, when source is plugin. [JsonPropertyName("sourcePluginVersion")] public string? SourcePluginVersion { get; set; } /// Server transport type: stdio, http, sse (deprecated), or memory. [JsonPropertyName("type")] public DiscoveredMcpServerType? Type { get; set; } } /// MCP servers discovered from user, workspace, plugin, and built-in sources. [Experimental(Diagnostics.Experimental)] 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. [Experimental(Diagnostics.Experimental)] internal sealed class McpDiscoverRequest { /// Whether to include canonical effectiveSource metadata for each discovered server. Callers must opt in so protocol-3 clients retain the legacy closed response shape. [JsonPropertyName("includeEffectiveSource")] public bool? IncludeEffectiveSource { get; set; } /// Working directory used as context for discovery (e.g., plugin resolution). [JsonPropertyName("workingDirectory")] public string? WorkingDirectory { get; set; } } /// Outcome of an mcp.planInstall call: either a normalised plan, or one typed refusal. Nothing is written in either case. /// Polymorphic base type discriminated by kind. [Experimental(Diagnostics.Experimental)] [JsonPolymorphic( TypeDiscriminatorPropertyName = "kind", UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToBaseType)] [JsonDerivedType(typeof(McpPlanInstallResultPlanned), "planned")] [JsonDerivedType(typeof(McpPlanInstallResultNegotiationRefused), "negotiation-refused")] [JsonDerivedType(typeof(McpPlanInstallResultHandleRejected), "handle-rejected")] [JsonDerivedType(typeof(McpPlanInstallResultInvalidRequest), "invalid-request")] [JsonDerivedType(typeof(McpPlanInstallResultAuthenticationRequired), "authentication-required")] [JsonDerivedType(typeof(McpPlanInstallResultPolicyRejected), "policy-rejected")] [JsonDerivedType(typeof(McpPlanInstallResultNetworkFailure), "network-failure")] [JsonDerivedType(typeof(McpPlanInstallResultUnsafeRetrieval), "unsafe-retrieval")] [JsonDerivedType(typeof(McpPlanInstallResultMalformedCard), "malformed-card")] [JsonDerivedType(typeof(McpPlanInstallResultContractViolation), "contract-violation")] [JsonDerivedType(typeof(McpPlanInstallResultUnavailableTransport), "unavailable-transport")] [JsonDerivedType(typeof(McpPlanInstallResultNotInstallable), "not-installable")] [JsonDerivedType(typeof(McpPlanInstallResultUnavailable), "unavailable")] public partial class McpPlanInstallResult { /// The type discriminator. [JsonPropertyName("kind")] public virtual string Kind { get; set; } = string.Empty; } /// The protocol version and capability set the runtime actually honoured for a successful catalog operation. [Experimental(Diagnostics.Experimental)] public sealed class CatalogNegotiatedContract { /// Wire features the runtime understood for this operation. Always a superset of the caller's required features, because any shortfall is a refusal instead. Operation availability remains a separate typed result. [JsonPropertyName("grantedCapabilities")] public IList GrantedCapabilities { get => field ??= []; set; } /// Protocol version of the runtime that served the request. [JsonPropertyName("runtimeProtocolVersion")] public long RuntimeProtocolVersion { get; set; } } /// One change applying the plan would make, described rather than serialised so the configuration payload stays behind the runtime boundary. [Experimental(Diagnostics.Experimental)] public sealed class McpPlanConfigurationChange { /// Names of the configuration fields the change would set, without their values. [JsonPropertyName("changedFields")] public IList ChangedFields { get => field ??= []; set; } /// Configuration key the change applies to. [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("configKey")] public string ConfigKey { get; set; } = string.Empty; /// Whether the change would create a new entry or modify an existing one. [JsonPropertyName("operation")] public McpPlanConfigurationOperation Operation { get; set; } /// Scope the change would be written to. [JsonPropertyName("scope")] public McpPlanScope Scope { get; set; } /// Secret placeholders the written configuration would reference. The constrained placeholder type cannot carry a literal secret value. [JsonPropertyName("secretReferences")] public IList SecretReferences { get => field ??= []; set; } } /// Normalised identity of the MCP server a plan targets, independent of how the card spelled it. [Experimental(Diagnostics.Experimental)] public sealed class McpPlanResourceIdentity { /// Canonical, normalised name of the server, for example `io.github.owner/server`. [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("canonicalName")] public string CanonicalName { get; set; } = string.Empty; /// Registry identifier of the server, when it came from a registry. [JsonPropertyName("registryId")] public string? RegistryId { get; set; } /// Local configuration key the server would be recorded under. [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; /// Version advertised by the card, when it declares one. [JsonPropertyName("version")] public string? Version { get; set; } } /// Outcome of evaluating the planned server against registry and enterprise policy. Evaluation is read-only. [Experimental(Diagnostics.Experimental)] public sealed class McpPlanPolicyResult { /// What policy decided for this server. [JsonPropertyName("decision")] public McpPlanPolicyDecision Decision { get; set; } /// Human-readable explanation, safe to surface. Never contains a query, URL, handle, or secret. [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(1000)] [JsonPropertyName("reason")] public string? Reason { get; set; } /// Which authority produced the decision. [JsonPropertyName("source")] public McpPlanPolicySource Source { get; set; } } /// Semantic digest of a strictly parsed and schema-validated JSON MCP card. Both URL-backed and embedded cards are canonicalised with RFC 8785 JSON Canonicalization Scheme, encoded as UTF-8, and hashed with SHA-256. [Experimental(Diagnostics.Experimental)] public sealed class CardDigest { /// Digest algorithm and canonical representation. [JsonPropertyName("algorithm")] public CardDigestAlgorithm Algorithm { get; set; } /// SHA-256 digest of the RFC 8785 canonical UTF-8 bytes, encoded as exactly 64 lowercase hexadecimal characters. [RegularExpression("^[0-9a-f]{64}$")] [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(64)] [MaxLength(64)] [JsonPropertyName("value")] public string Value { get; set; } = string.Empty; } /// Provenance of the exact validated JSON MCP card content bound privately to a completed plan and its opaque handle. [Experimental(Diagnostics.Experimental)] public sealed class McpPlanProvenance { /// Authority associated with the validated card, without path, query, or credentials. Inert untrusted data. [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("authority")] public string Authority { get; set; } = string.Empty; /// Semantic digest of the exact validated JSON content bound to the plan handle. [JsonPropertyName("cardDigest")] public CardDigest CardDigest { get => field ??= new(); set; } /// JSON MCP media type the validated card was interpreted as. [JsonPropertyName("mediaType")] public McpServerCardMediaType MediaType { get; set; } /// ISO 8601 timestamp at which the runtime completed strict parsing and schema validation of the card content. [JsonPropertyName("validatedAt")] public string ValidatedAt { get; set; } = string.Empty; } /// Where a plan would be written. [Experimental(Diagnostics.Experimental)] public sealed class McpPlanTarget { /// Configuration key the server would be recorded under within that scope. [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("configKey")] public string ConfigKey { get; set; } = string.Empty; /// Configuration scope the plan targets. [JsonPropertyName("scope")] public McpPlanScope Scope { get; set; } } /// One eligible way to run the server, represented as a tagged package or remote variant so package identity and endpoint states cannot contradict the install method. /// Polymorphic base type discriminated by installMethod. [Experimental(Diagnostics.Experimental)] [JsonPolymorphic( TypeDiscriminatorPropertyName = "installMethod", UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToBaseType)] [JsonDerivedType(typeof(McpPlanTransportChoicePackage), "package")] [JsonDerivedType(typeof(McpPlanTransportChoiceRemote), "remote")] public partial class McpPlanTransportChoice { /// The type discriminator. [JsonPropertyName("installMethod")] public virtual string InstallMethod { get; set; } = string.Empty; } /// One non-secret value a transport choice needs, represented as a scalar or enumerated variant so enum values cannot be missing or attached to another type. /// Polymorphic base type discriminated by kind. [Experimental(Diagnostics.Experimental)] [JsonPolymorphic( TypeDiscriminatorPropertyName = "kind", UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToBaseType)] [JsonDerivedType(typeof(McpPlanRequiredValueScalar), "scalar")] [JsonDerivedType(typeof(McpPlanRequiredValueEnum), "enum")] public partial class McpPlanRequiredValue { /// The type discriminator. [JsonPropertyName("kind")] public virtual string Kind { get; set; } = string.Empty; } /// One non-secret scalar value a transport choice needs before it can be applied. /// The scalar variant of . [Experimental(Diagnostics.Experimental)] public partial class McpPlanRequiredValueScalar : McpPlanRequiredValue { /// [JsonIgnore] public override string Kind => "scalar"; /// Where the value is applied when the server is launched. [JsonPropertyName("category")] public required McpPlanValueCategory Category { get; set; } /// Default supplied by the card, when the value can be resolved without input. Presence is the authoritative indication that a default exists. Inert untrusted data. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("defaultValue")] public string? DefaultValue { get; set; } /// Human-readable explanation from the card. Inert untrusted text. [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(1000)] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("description")] public string? Description { get; set; } /// Whether the value may be supplied more than once. [JsonPropertyName("isRepeated")] public required bool IsRepeated { get; set; } /// Key the value is supplied under. Inert untrusted data. [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("key")] public required string Key { get; set; } /// Whether the value must be present for the plan to be applicable. [JsonPropertyName("required")] public required bool Required { get; set; } /// Human-readable label from the card. Inert untrusted text. [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(200)] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("title")] public string? Title { get; set; } /// Scalar type the value must conform to. [JsonPropertyName("valueType")] public required McpPlanScalarValueType ValueType { get; set; } } /// One enumerated non-secret value a transport choice needs before it can be applied. The permitted values are structurally required. /// The enum variant of . [Experimental(Diagnostics.Experimental)] public partial class McpPlanRequiredValueEnum : McpPlanRequiredValue { /// [JsonIgnore] public override string Kind => "enum"; /// Where the value is applied when the server is launched. [JsonPropertyName("category")] public required McpPlanValueCategory Category { get; set; } /// Default supplied by the card, when the value can be resolved without input. Presence is the authoritative indication that a default exists. Inert untrusted data. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("defaultValue")] public string? DefaultValue { get; set; } /// Human-readable explanation from the card. Inert untrusted text. [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(1000)] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("description")] public string? Description { get; set; } /// Non-empty permitted value set. Inert untrusted data. [JsonPropertyName("enumValues")] public required IList EnumValues { get; set; } /// Whether the value may be supplied more than once. [JsonPropertyName("isRepeated")] public required bool IsRepeated { get; set; } /// Key the value is supplied under. Inert untrusted data. [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("key")] public required string Key { get; set; } /// Whether the value must be present for the plan to be applicable. [JsonPropertyName("required")] public required bool Required { get; set; } /// Human-readable label from the card. Inert untrusted text. [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(200)] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("title")] public string? Title { get; set; } /// Discriminator: the value must be one of `enumValues`. [JsonPropertyName("valueType")] public required McpPlanEnumValueType ValueType { get; set; } } /// A secret a transport choice needs, referenced by placeholder. No secret value ever appears in a plan, and the placeholder resolves against the keychain only when a plan is applied. [Experimental(Diagnostics.Experimental)] public sealed class McpPlanSecretPlaceholder { /// Key the secret is supplied under. Inert untrusted data. [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("key")] public string Key { get; set; } = string.Empty; /// The runtime-assigned `${secret:<id>}` placeholder written into configuration in place of the value. [JsonPropertyName("placeholder")] public string Placeholder { get; set; } = string.Empty; /// Human-readable label from the card. Inert untrusted text. [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(200)] [JsonPropertyName("title")] public string? Title { get; set; } } /// An eligible local-package transport choice. Package identity is required and a remote endpoint cannot be represented. /// The package variant of . [Experimental(Diagnostics.Experimental)] public partial class McpPlanTransportChoicePackage : McpPlanTransportChoice { /// [JsonIgnore] public override string InstallMethod => "package"; /// Stable identifier for this choice within the plan, used to select it when the plan is applied. [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(128)] [JsonPropertyName("choiceId")] public required string ChoiceId { get; set; } /// Package identifier. Inert untrusted data. [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(512)] [JsonPropertyName("packageIdentifier")] public required string PackageIdentifier { get; set; } /// Packaging ecosystem, for example `oci` or `npm`. [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(64)] [JsonPropertyName("packageType")] public required string PackageType { get; set; } /// Typed values this choice requires, excluding secrets. [JsonPropertyName("requiredValues")] public required IList RequiredValues { get; set; } /// Secrets this choice requires, referenced by placeholder only. [JsonPropertyName("secretPlaceholders")] public required IList SecretPlaceholders { get; set; } /// Local process transport this package choice would use. [JsonPropertyName("transport")] public required McpPlanPackageTransport Transport { get; set; } } /// An eligible remote-endpoint transport choice. The endpoint is required and package identity cannot be represented. /// The remote variant of . [Experimental(Diagnostics.Experimental)] public partial class McpPlanTransportChoiceRemote : McpPlanTransportChoice { /// [JsonIgnore] public override string InstallMethod => "remote"; /// Stable identifier for this choice within the plan, used to select it when the plan is applied. [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(128)] [JsonPropertyName("choiceId")] public required string ChoiceId { get; set; } /// Endpoint URL. Inert untrusted data. [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(2048)] [JsonPropertyName("endpoint")] public required string Endpoint { get; set; } /// Typed values this choice requires, excluding secrets. [JsonPropertyName("requiredValues")] public required IList RequiredValues { get; set; } /// Secrets this choice requires, referenced by placeholder only. [JsonPropertyName("secretPlaceholders")] public required IList SecretPlaceholders { get; set; } /// Endpoint transport this remote choice would use. [JsonPropertyName("transport")] public required McpPlanRemoteTransport Transport { get; set; } } /// A normalised, inert description of what installing an MCP server would involve. Carries no raw card, no install specification, and no secret value. [Experimental(Diagnostics.Experimental)] public sealed class McpInstallPlan { /// The configuration changes installing would make, described rather than serialised, so the mutable configuration payload stays behind the runtime boundary. [JsonPropertyName("configurationChanges")] public IList ConfigurationChanges { get => field ??= []; set; } /// Normalised identity of the server the plan would install. [JsonPropertyName("identity")] public McpPlanResourceIdentity Identity { get => field ??= new(); set; } /// Opaque, runtime-instance scoped, TTL-bound, single-use handle for this plan. Rejected when stale, replayed, or presented to a different runtime instance. Never logged. [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("planHandle")] public string PlanHandle { get; set; } = string.Empty; /// ISO 8601 timestamp after which the plan handle is stale and will be rejected. Abandoning a plan needs no call: an unused handle simply expires, so cancellation before commit is side-effect free. [JsonPropertyName("planHandleExpiresAt")] public string PlanHandleExpiresAt { get; set; } = string.Empty; /// Outcome of evaluating the server against registry and enterprise policy. [JsonPropertyName("policy")] public McpPlanPolicyResult Policy { get => field ??= new(); set; } /// Origin and semantic digest of the exact validated JSON MCP card content bound to this plan. [JsonPropertyName("provenance")] public McpPlanProvenance Provenance { get => field ??= new(); set; } /// Identifier of the choice the runtime would pick by default. Omitted when there is no eligible transport, or when the runtime expresses no preference. [JsonPropertyName("recommendedTransportChoiceId")] public string? RecommendedTransportChoiceId { get; set; } /// Whether applying this plan would require an MCP reload to take effect. Planning itself never reloads. [JsonPropertyName("reloadRequired")] public bool ReloadRequired { get; set; } /// Whether the plan cannot be applied without further input, because a required value has no default or a secret must be supplied. [JsonPropertyName("requiresInteractiveConfiguration")] public bool RequiresInteractiveConfiguration { get; set; } /// Configuration scope and key the plan would write to. [JsonPropertyName("target")] public McpPlanTarget Target { get => field ??= new(); set; } /// Every eligible transport, so a host can present an explicit choice. A completed plan always has at least one; when none is eligible, planning returns `CatalogUnavailableTransportError` instead. [JsonPropertyName("transportChoices")] public IList TransportChoices { get => field ??= []; set; } } /// A computed MCP install plan. Nothing has been applied: the plan describes what installing would change, and the plan handle is what a later apply operation would consume. /// The planned variant of . [Experimental(Diagnostics.Experimental)] public partial class McpPlanInstallResultPlanned : McpPlanInstallResult { /// [JsonIgnore] public override string Kind => "planned"; /// Protocol version and capabilities the runtime honoured. [JsonPropertyName("negotiated")] public required CatalogNegotiatedContract Negotiated { get; set; } /// The normalised plan. [JsonPropertyName("plan")] public required McpInstallPlan Plan { get; set; } } /// The caller's protocol version or required capabilities cannot be honoured. Returned instead of a partial or ambiguous success. /// The negotiation-refused variant of . [Experimental(Diagnostics.Experimental)] public partial class McpPlanInstallResultNegotiationRefused : McpPlanInstallResult { /// [JsonIgnore] public override string Kind => "negotiation-refused"; /// Human-readable explanation, safe to surface. Never contains a query, URL, handle, or secret. [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(1000)] [JsonPropertyName("message")] public required string Message { get; set; } /// Lowest caller protocol version this runtime will serve. [JsonPropertyName("minimumSupportedProtocolVersion")] public required long MinimumSupportedProtocolVersion { get; set; } /// Whether the version or the capability set was the problem. [JsonPropertyName("reason")] public required CatalogNegotiationRefusedReason Reason { get; set; } /// Protocol version of the runtime that refused the request. [JsonPropertyName("runtimeProtocolVersion")] public required long RuntimeProtocolVersion { get; set; } /// Every wire feature this runtime understands, so the caller can retry within that contract. This list does not imply that every deployment has enabled every operation. [JsonPropertyName("supportedCapabilities")] public required IList SupportedCapabilities { get; set; } /// The subset of the caller's bounded extensible capability identifiers this runtime cannot honour. [JsonPropertyName("unsupportedCapabilities")] public required IList UnsupportedCapabilities { get; set; } } /// A presented handle was not accepted. Handles are runtime-instance scoped, TTL-bound, and single-use, so each way of failing is reported distinctly. /// The handle-rejected variant of . [Experimental(Diagnostics.Experimental)] public partial class McpPlanInstallResultHandleRejected : McpPlanInstallResult { /// [JsonIgnore] public override string Kind => "handle-rejected"; /// Which kind of handle was presented. [JsonPropertyName("handleType")] public required CatalogHandleType HandleType { get; set; } /// Human-readable explanation, safe to surface. Never contains the handle itself, nor a query, URL, or secret. [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(1000)] [JsonPropertyName("message")] public required string Message { get; set; } /// Why the handle was rejected. [JsonPropertyName("reason")] public required CatalogHandleRejectionReason Reason { get; set; } } /// The request was rejected before any work was done, because a bounded field fell outside its permitted range or a required field was unusable. /// The invalid-request variant of . [Experimental(Diagnostics.Experimental)] public partial class McpPlanInstallResultInvalidRequest : McpPlanInstallResult { /// [JsonIgnore] public override string Kind => "invalid-request"; /// Which request field was rejected. [JsonPropertyName("field")] public required CatalogInvalidRequestField Field { get; set; } /// Human-readable explanation, safe to surface. Never echoes the offending value, nor a query, URL, handle, or secret. [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(1000)] [JsonPropertyName("message")] public required string Message { get; set; } } /// An optional catalog authentication exchange did not establish the caller's identity. Anonymous search remains supported; this refusal is reserved for an operation that cannot continue after the attempted exchange. It is distinct from `policy-rejected` and from a network failure, and the reason identifies the recovery action. /// The authentication-required variant of . [Experimental(Diagnostics.Experimental)] public partial class McpPlanInstallResultAuthenticationRequired : McpPlanInstallResult { /// [JsonIgnore] public override string Kind => "authentication-required"; /// Human-readable explanation, safe to surface. Never contains a credential or token, nor a query, URL, handle, or secret. [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(1000)] [JsonPropertyName("message")] public required string Message { get; set; } /// Why authentication failed. Only an expired credential justifies attempting a silent refresh; an absent or rejected credential requires sign-in. [JsonPropertyName("reason")] public required CatalogAuthenticationRequiredReason Reason { get; set; } } /// Registry or enterprise policy refused the operation. /// The policy-rejected variant of . [Experimental(Diagnostics.Experimental)] public partial class McpPlanInstallResultPolicyRejected : McpPlanInstallResult { /// [JsonIgnore] public override string Kind => "policy-rejected"; /// Human-readable explanation, safe to surface. Never contains a query, URL, handle, or secret. [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(1000)] [JsonPropertyName("message")] public required string Message { get; set; } /// Which authority produced the decision. [JsonPropertyName("source")] public required McpPlanPolicySource Source { get; set; } } /// The runtime could not reach the catalog authority or retrieve a card. Covers being offline as well as transport-level failure. /// The network-failure variant of . [Experimental(Diagnostics.Experimental)] public partial class McpPlanInstallResultNetworkFailure : McpPlanInstallResult { /// [JsonIgnore] public override string Kind => "network-failure"; /// Human-readable explanation, safe to surface. Never contains a query, URL, handle, or secret. [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(1000)] [JsonPropertyName("message")] public required string Message { get; set; } /// Categorised failure, low cardinality so it can be aggregated without carrying a URL. [JsonPropertyName("reason")] public required CatalogNetworkFailureReason Reason { get; set; } /// Bounded cooldown in seconds before another catalog request should be attempted, when the authority supplied a numeric Retry-After value or the runtime applied its documented fallback. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("retryAfterSeconds")] public int? RetryAfterSeconds { get; set; } /// HTTP status code, when the failure was a rejected response. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("statusCode")] public int? StatusCode { get; set; } } /// Retrieval was refused by the runtime's hardened fetch boundary before any request left the process, or before a redirect was followed. /// The unsafe-retrieval variant of . [Experimental(Diagnostics.Experimental)] public partial class McpPlanInstallResultUnsafeRetrieval : McpPlanInstallResult { /// [JsonIgnore] public override string Kind => "unsafe-retrieval"; /// Human-readable explanation, safe to surface. Never contains the refused URL, nor a query, handle, or secret. [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(1000)] [JsonPropertyName("message")] public required string Message { get; set; } /// Which control refused the retrieval, low cardinality so it can be aggregated without carrying a URL. [JsonPropertyName("reason")] public required CatalogUnsafeRetrievalReason Reason { get; set; } } /// A card could not be parsed or did not satisfy its declared media type's schema. /// The malformed-card variant of . [Experimental(Diagnostics.Experimental)] public partial class McpPlanInstallResultMalformedCard : McpPlanInstallResult { /// [JsonIgnore] public override string Kind => "malformed-card"; /// Media type the card was interpreted as, when it declared one this runtime recognises. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("mediaType")] public CatalogMediaType? MediaType { get; set; } /// Human-readable explanation, safe to surface. Never echoes card content, nor a query, URL, handle, or secret. [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(1000)] [JsonPropertyName("message")] public required string Message { get; set; } /// How the card failed validation. [JsonPropertyName("reason")] public required CatalogMalformedCardReason Reason { get; set; } } /// An upstream catalog response broke the wire contract. Most importantly, every result must carry exactly one of a URL or embedded data: a result carrying both, or neither, is refused here rather than being guessed at. /// The contract-violation variant of . [Experimental(Diagnostics.Experimental)] public partial class McpPlanInstallResultContractViolation : McpPlanInstallResult { /// [JsonIgnore] public override string Kind => "contract-violation"; /// Human-readable explanation, safe to surface. Never echoes response content, nor a query, URL, handle, or secret. [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(1000)] [JsonPropertyName("message")] public required string Message { get; set; } /// Which rule the response broke. [JsonPropertyName("reason")] public required CatalogContractViolationReason Reason { get; set; } } /// No transport this runtime can use is available for the requested server. /// The unavailable-transport variant of . [Experimental(Diagnostics.Experimental)] public partial class McpPlanInstallResultUnavailableTransport : McpPlanInstallResult { /// [JsonIgnore] public override string Kind => "unavailable-transport"; /// Human-readable explanation, safe to surface. Never contains a query, URL, handle, or secret. [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(1000)] [JsonPropertyName("message")] public required string Message { get; set; } /// Why no transport could be offered. [JsonPropertyName("reason")] public required CatalogUnavailableTransportReason Reason { get; set; } } /// The candidate is discoverable but cannot be installed. `application/ai-skill` resolves here, because it stays searchable while remaining typed non-installable. /// The not-installable variant of . [Experimental(Diagnostics.Experimental)] public partial class McpPlanInstallResultNotInstallable : McpPlanInstallResult { /// [JsonIgnore] public override string Kind => "not-installable"; /// Human-readable explanation, safe to surface. Never contains a query, URL, handle, or secret. [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(1000)] [JsonPropertyName("message")] public required string Message { get; set; } /// Why the candidate cannot be installed. [JsonPropertyName("reason")] public required CatalogNotInstallableReason Reason { get; set; } } /// The operation is not available on this runtime. Distinct from a network failure: nothing was attempted. /// The unavailable variant of . [Experimental(Diagnostics.Experimental)] public partial class McpPlanInstallResultUnavailable : McpPlanInstallResult { /// [JsonIgnore] public override string Kind => "unavailable"; /// Human-readable explanation, safe to surface. Never contains a query, URL, handle, or secret. [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(1000)] [JsonPropertyName("message")] public required string Message { get; set; } /// Why the operation is unavailable. [JsonPropertyName("reason")] public required CatalogUnavailableReason Reason { get; set; } } /// The protocol version and capability set a caller requires, supplied on every catalog request so negotiation cannot be skipped by omission. [Experimental(Diagnostics.Experimental)] public sealed class CatalogClientContract { /// SDK protocol version the caller was generated against. A caller below the runtime's minimum supported version is refused rather than served a partial result. [JsonPropertyName("protocolVersion")] public long ProtocolVersion { get; set; } /// Wire features the caller requires the runtime to understand. Identifiers are bounded but extensible so a newer caller can negotiate with an older runtime. Requiring an unknown feature yields a typed refusal listing what is understood, never a partial grant. A grant does not promise that a deployment has enabled the operation; typed unavailable results report that separately. [JsonPropertyName("requiredCapabilities")] public IList RequiredCapabilities { get => field ??= []; set; } } /// What an install plan is computed from: a candidate handle from a previous search, or a card supplied directly. /// Polymorphic base type discriminated by kind. [Experimental(Diagnostics.Experimental)] [JsonPolymorphic( TypeDiscriminatorPropertyName = "kind", UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToBaseType)] [JsonDerivedType(typeof(McpPlanInstallSourceCandidate), "candidate")] [JsonDerivedType(typeof(McpPlanInstallSourceCard), "card")] public partial class McpPlanInstallSource { /// The type discriminator. [JsonPropertyName("kind")] public virtual string Kind { get; set; } = string.Empty; } /// Plan from a candidate returned by a previous catalog search. /// The candidate variant of . [Experimental(Diagnostics.Experimental)] public partial class McpPlanInstallSourceCandidate : McpPlanInstallSource { /// [JsonIgnore] public override string Kind => "candidate"; /// Single-use candidate handle. Consumed by this call, so a replay of the same handle is rejected. [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(256)] [JsonPropertyName("candidateHandle")] public required string CandidateHandle { get; set; } /// The runtime- or authority-minted `searchId` returned with the search that produced this candidate. A search implementation binds it to private candidate-handle context; a planning implementation must verify that context before returning a plan. The unavailable planning implementation in this contract layer validates presence but does not claim the verification has occurred. It identifies a search rather than a person and must never be joined with user identity to re-identify anyone. [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(64)] [JsonPropertyName("searchId")] public required string SearchId { get; set; } } /// A card supplied directly by the caller. Exactly one of a URL or embedded data, encoded structurally so neither both nor neither can be expressed. /// Polymorphic base type discriminated by kind. [Experimental(Diagnostics.Experimental)] [JsonPolymorphic( TypeDiscriminatorPropertyName = "kind", UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToBaseType)] [JsonDerivedType(typeof(McpServerCardReferenceUrl), "url")] [JsonDerivedType(typeof(McpServerCardReferenceEmbedded), "embedded")] public partial class McpServerCardReference { /// The type discriminator. [JsonPropertyName("kind")] public virtual string Kind { get; set; } = string.Empty; } /// An MCP server card to be retrieved from a URL through the runtime's hardened fetch boundary. /// The url variant of . [Experimental(Diagnostics.Experimental)] public partial class McpServerCardReferenceUrl : McpServerCardReference { /// [JsonIgnore] public override string Kind => "url"; /// Media type the card is expected to conform to. [JsonPropertyName("mediaType")] public required McpServerCardMediaType MediaType { get; set; } /// Card URL. Retrieved only through the runtime's hardened boundary, with scheme, credential, address-range, redirect, timeout, and response-size controls applied. Never logged. [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(2048)] [JsonPropertyName("url")] public required string Url { get; set; } } /// An MCP server card supplied inline as an inert document. /// The embedded variant of . [Experimental(Diagnostics.Experimental)] public partial class McpServerCardReferenceEmbedded : McpServerCardReference { /// [JsonIgnore] public override string Kind => "embedded"; /// The card document verbatim, treated as inert untrusted bytes. The runtime parses and validates it; the host is not expected to interpret it. Never logged. [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(1048576)] [JsonPropertyName("data")] public required string Data { get; set; } /// Media type the card is expected to conform to. [JsonPropertyName("mediaType")] public required McpServerCardMediaType MediaType { get; set; } } /// Plan from a card supplied directly by the caller, without a preceding search. /// The card variant of . [Experimental(Diagnostics.Experimental)] public partial class McpPlanInstallSourceCard : McpPlanInstallSource { /// [JsonIgnore] public override string Kind => "card"; /// The card to plan from: exactly one of a URL or embedded data. [JsonPropertyName("card")] public required McpServerCardReference Card { get; set; } } /// A side-effect-free request for an MCP install plan. Computing a plan never writes configuration, stores a secret, or reloads MCP servers. [Experimental(Diagnostics.Experimental)] internal sealed class McpPlanInstallRequest { /// Protocol version and capabilities the caller requires. [JsonPropertyName("contract")] public CatalogClientContract Contract { get => field ??= new(); set; } /// Configuration scope the plan targets. Defaults to user scope when omitted. [JsonPropertyName("scope")] public McpPlanScope? Scope { get; set; } /// What to plan: either a candidate handle from a previous search, or a card supplied directly. [JsonPropertyName("source")] public McpPlanInstallSource Source { get => field ??= new(); set; } } /// User-configured MCP servers, keyed by server name. [Experimental(Diagnostics.Experimental)] 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. [Experimental(Diagnostics.Experimental)] 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. [Experimental(Diagnostics.Experimental)] 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. [Experimental(Diagnostics.Experimental)] internal sealed class McpConfigRemoveRequest { /// OAuth Client ID Metadata Document URL whose persisted credentials should also be removed. [JsonPropertyName("authClientIdMetadataUrl")] public string? AuthClientIdMetadataUrl { get; set; } /// 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. [Experimental(Diagnostics.Experimental)] 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. [Experimental(Diagnostics.Experimental)] 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; } } /// Installed plugin that contributes a discovered extension. [Experimental(Diagnostics.Experimental)] public sealed class DiscoveredExtensionPlugin { /// Installed plugin name. [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; } /// Discovered extension metadata and persistent enablement state. [Experimental(Diagnostics.Experimental)] public sealed class DiscoveredExtension { /// Whether this extension's persistent per-ID preference is enabled. [JsonPropertyName("enabled")] public bool Enabled { get; set; } /// Source-qualified ID accepted by both server and session extension enablement methods. [JsonPropertyName("id")] public string Id { get; set; } = string.Empty; /// Human-readable extension name. [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; /// Absolute path to the extension entry module, suitable for revealing it in a file manager. [JsonPropertyName("path")] public string Path { get; set; } = string.Empty; /// Containing plugin metadata for plugin-contributed extensions. [JsonPropertyName("plugin")] public DiscoveredExtensionPlugin? Plugin { get; set; } /// Discovery source. [JsonPropertyName("source")] public DiscoveredExtensionSource Source { get; set; } } /// Extensions discovered from persisted Copilot home state and their effective loading mode. Launch-scoped additional plugins are not included. [Experimental(Diagnostics.Experimental)] public sealed class DiscoveredExtensions { /// Discovered user and enabled installed-plugin extensions from persisted Copilot home state. [JsonPropertyName("extensions")] public IList Extensions { get => field ??= []; set; } /// Effective extension loading mode. Defaults to load_and_augment when unset. [JsonPropertyName("mode")] public DiscoveredExtensionMode Mode { get; set; } } /// Source-qualified extension identifiers to persistently enable for future sessions. [Experimental(Diagnostics.Experimental)] internal sealed class DiscoveredExtensionsEnableRequest { /// Source-qualified user or plugin extension IDs to enable. [JsonPropertyName("ids")] public IList Ids { get => field ??= []; set; } } /// Source-qualified extension identifiers to persistently disable for future sessions. [Experimental(Diagnostics.Experimental)] internal sealed class DiscoveredExtensionsDisableRequest { /// Source-qualified user or plugin extension IDs to disable. [JsonPropertyName("ids")] public IList Ids { get => field ??= []; set; } } /// Outcome of a catalog.search call: either bounded inert candidates, or one typed refusal. Never a partial success. /// Polymorphic base type discriminated by kind. [Experimental(Diagnostics.Experimental)] [JsonPolymorphic( TypeDiscriminatorPropertyName = "kind", UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToBaseType)] [JsonDerivedType(typeof(CatalogSearchResultSucceeded), "succeeded")] [JsonDerivedType(typeof(CatalogSearchResultNegotiationRefused), "negotiation-refused")] [JsonDerivedType(typeof(CatalogSearchResultUnsupportedKind), "unsupported-kind")] [JsonDerivedType(typeof(CatalogSearchResultInvalidRequest), "invalid-request")] [JsonDerivedType(typeof(CatalogSearchResultAuthenticationRequired), "authentication-required")] [JsonDerivedType(typeof(CatalogSearchResultPolicyRejected), "policy-rejected")] [JsonDerivedType(typeof(CatalogSearchResultNetworkFailure), "network-failure")] [JsonDerivedType(typeof(CatalogSearchResultUnsafeRetrieval), "unsafe-retrieval")] [JsonDerivedType(typeof(CatalogSearchResultMalformedCard), "malformed-card")] [JsonDerivedType(typeof(CatalogSearchResultContractViolation), "contract-violation")] [JsonDerivedType(typeof(CatalogSearchResultUnavailable), "unavailable")] public partial class CatalogSearchResult { /// The type discriminator. [JsonPropertyName("kind")] public virtual string Kind { get; set; } = string.Empty; } /// One inert catalog result, represented as an MCP server or discovery-only AI skill variant so kind, media type, provenance, and installability cannot contradict each other. /// Polymorphic base type discriminated by kind. [Experimental(Diagnostics.Experimental)] [JsonPolymorphic( TypeDiscriminatorPropertyName = "kind", UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToBaseType)] [JsonDerivedType(typeof(CatalogCandidateMcpServer), "mcp-server")] [JsonDerivedType(typeof(CatalogCandidateAiSkill), "ai-skill")] public partial class CatalogCandidate { /// The type discriminator. [JsonPropertyName("kind")] public virtual string Kind { get; set; } = string.Empty; } /// Where and when an MCP server catalog reference was observed. Discovery provenance deliberately carries no content digest because search does not establish the exact validated content a later plan will bind. [Experimental(Diagnostics.Experimental)] public sealed class CatalogMcpServerCandidateProvenance { /// Host of the catalog authority that advertised the reference, without path, query, or credentials. Inert untrusted data. [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("authority")] public string Authority { get; set; } = string.Empty; /// JSON MCP media type advertised for the referenced card. [JsonPropertyName("mediaType")] public McpServerCardMediaType MediaType { get; set; } /// ISO 8601 timestamp at which the runtime observed the catalog reference. This is not a retrieval or validation timestamp. [JsonPropertyName("observedAt")] public string ObservedAt { get; set; } = string.Empty; } /// Where a candidate's card came from. Exactly one of a URL or embedded data: the union has no variant carrying both, and no variant carrying neither, so the rule holds structurally rather than by validation. /// Polymorphic base type discriminated by kind. [Experimental(Diagnostics.Experimental)] [JsonPolymorphic( TypeDiscriminatorPropertyName = "kind", UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToBaseType)] [JsonDerivedType(typeof(CatalogCandidateSourceUrl), "url")] [JsonDerivedType(typeof(CatalogCandidateSourceEmbedded), "embedded")] public partial class CatalogCandidateSource { /// The type discriminator. [JsonPropertyName("kind")] public virtual string Kind { get; set; } = string.Empty; } /// Candidate whose card is retrieved from a URL through the runtime's hardened fetch boundary. /// The url variant of . [Experimental(Diagnostics.Experimental)] public partial class CatalogCandidateSourceUrl : CatalogCandidateSource { /// [JsonIgnore] public override string Kind => "url"; /// Card URL as advertised. Inert untrusted data: the runtime retrieves it only through its own hardened boundary, and it is never logged. [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("url")] public required string Url { get; set; } } /// Candidate whose card reference arrived inline. The document and its content-derived properties stay behind the runtime boundary. /// The embedded variant of . [Experimental(Diagnostics.Experimental)] public partial class CatalogCandidateSourceEmbedded : CatalogCandidateSource { /// [JsonIgnore] public override string Kind => "embedded"; } /// An inert MCP server catalog result. Every free-text field is untrusted external data and must never be treated as an instruction, and the handle is the only way to refer to the candidate in a later operation. /// The mcp-server variant of . [Experimental(Diagnostics.Experimental)] public partial class CatalogCandidateMcpServer : CatalogCandidate { /// [JsonIgnore] public override string Kind => "mcp-server"; /// Description taken verbatim from the card. Inert untrusted text. [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(1000)] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("description")] public string? Description { get; set; } /// Display name taken verbatim from the card. Inert untrusted text. [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(200)] [JsonPropertyName("displayName")] public required string DisplayName { get; set; } /// Opaque, runtime-instance scoped, TTL-bound, single-use handle for this candidate. Carries no readable information and is rejected when stale, replayed, or presented to a different runtime instance. Never logged. [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("handle")] public required string Handle { get; set; } /// ISO 8601 timestamp after which the handle is stale and will be rejected. [JsonPropertyName("handleExpiresAt")] public required string HandleExpiresAt { get; set; } /// Whether this MCP server can be planned for installation, and if policy prevents it. [JsonPropertyName("installability")] public required CatalogMcpServerInstallability Installability { get; set; } /// JSON MCP media type of the underlying card. [JsonPropertyName("mediaType")] public required McpServerCardMediaType MediaType { get; set; } /// Where the catalog reference was observed, without the card itself or any content digest. [JsonPropertyName("provenance")] public required CatalogMcpServerCandidateProvenance Provenance { get; set; } /// Publisher taken verbatim from the card. Inert untrusted text. [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(200)] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("publisher")] public string? Publisher { get; set; } /// Where the card came from: exactly one of a URL or embedded data, encoded as a tagged union so neither both nor neither can be represented. [JsonPropertyName("source")] public required CatalogCandidateSource Source { get; set; } } /// Where and when an AI skill catalog reference was observed. Discovery provenance deliberately carries no content digest because search does not establish the exact validated content a later plan will bind. [Experimental(Diagnostics.Experimental)] public sealed class CatalogAiSkillCandidateProvenance { /// Host of the catalog authority that advertised the reference, without path, query, or credentials. Inert untrusted data. [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("authority")] public string Authority { get; set; } = string.Empty; /// Media type advertised for the referenced AI skill card. [JsonPropertyName("mediaType")] public string MediaType { get; set; } = string.Empty; /// ISO 8601 timestamp at which the runtime observed the catalog reference. This is not a retrieval or validation timestamp. [JsonPropertyName("observedAt")] public string ObservedAt { get; set; } = string.Empty; } /// An inert AI skill catalog result. AI skills are discovery-only and cannot be represented as installable through this surface. /// The ai-skill variant of . [Experimental(Diagnostics.Experimental)] public partial class CatalogCandidateAiSkill : CatalogCandidate { /// [JsonIgnore] public override string Kind => "ai-skill"; /// Description taken verbatim from the card. Inert untrusted text. [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(1000)] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("description")] public string? Description { get; set; } /// Display name taken verbatim from the card. Inert untrusted text. [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(200)] [JsonPropertyName("displayName")] public required string DisplayName { get; set; } /// Opaque, runtime-instance scoped, TTL-bound, single-use handle for this candidate. Carries no readable information and is rejected when stale, replayed, or presented to a different runtime instance. Never logged. [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("handle")] public required string Handle { get; set; } /// ISO 8601 timestamp after which the handle is stale and will be rejected. [JsonPropertyName("handleExpiresAt")] public required string HandleExpiresAt { get; set; } /// AI skills are discovery-only and cannot be installed through this surface. [JsonPropertyName("installability")] public required string Installability { get; set; } /// Media type of the underlying AI skill card. [JsonPropertyName("mediaType")] public required string MediaType { get; set; } /// Where the catalog reference was observed, without the card itself or any content digest. [JsonPropertyName("provenance")] public required CatalogAiSkillCandidateProvenance Provenance { get; set; } /// Publisher taken verbatim from the card. Inert untrusted text. [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(200)] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("publisher")] public string? Publisher { get; set; } /// Where the card came from: exactly one of a URL or embedded data, encoded as a tagged union so neither both nor neither can be represented. [JsonPropertyName("source")] public required CatalogCandidateSource Source { get; set; } } /// A completed catalog search: inert candidate summaries, each carrying a single-use handle. /// The succeeded variant of . [Experimental(Diagnostics.Experimental)] public partial class CatalogSearchResultSucceeded : CatalogSearchResult { /// [JsonIgnore] public override string Kind => "succeeded"; /// Matching candidates, never more than the requested limit. All text is inert untrusted data. [JsonPropertyName("candidates")] public required IList Candidates { get; set; } /// Protocol version and capabilities the runtime honoured. [JsonPropertyName("negotiated")] public required CatalogNegotiatedContract Negotiated { get; set; } /// Pseudonymous identifier for this search, issued by the runtime or by the catalog authority it queried and never by the caller, so it cannot be forged or replayed to attribute an install to a search that never happened. Always present on a success, so a result set can be tied to the installs it leads to. It identifies a search rather than a person: it is derived from no user, account, device, or query data, and must never be joined with user identity to re-identify anyone. [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(64)] [JsonPropertyName("searchId")] public required string SearchId { get; set; } /// Whether further matches existed beyond the requested limit. [JsonPropertyName("truncated")] public required bool Truncated { get; set; } } /// The caller's protocol version or required capabilities cannot be honoured. Returned instead of a partial or ambiguous success. /// The negotiation-refused variant of . [Experimental(Diagnostics.Experimental)] public partial class CatalogSearchResultNegotiationRefused : CatalogSearchResult { /// [JsonIgnore] public override string Kind => "negotiation-refused"; /// Human-readable explanation, safe to surface. Never contains a query, URL, handle, or secret. [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(1000)] [JsonPropertyName("message")] public required string Message { get; set; } /// Lowest caller protocol version this runtime will serve. [JsonPropertyName("minimumSupportedProtocolVersion")] public required long MinimumSupportedProtocolVersion { get; set; } /// Whether the version or the capability set was the problem. [JsonPropertyName("reason")] public required CatalogNegotiationRefusedReason Reason { get; set; } /// Protocol version of the runtime that refused the request. [JsonPropertyName("runtimeProtocolVersion")] public required long RuntimeProtocolVersion { get; set; } /// Every wire feature this runtime understands, so the caller can retry within that contract. This list does not imply that every deployment has enabled every operation. [JsonPropertyName("supportedCapabilities")] public required IList SupportedCapabilities { get; set; } /// The subset of the caller's bounded extensible capability identifiers this runtime cannot honour. [JsonPropertyName("unsupportedCapabilities")] public required IList UnsupportedCapabilities { get; set; } } /// The request asked for a candidate kind this runtime does not serve. /// The unsupported-kind variant of . [Experimental(Diagnostics.Experimental)] public partial class CatalogSearchResultUnsupportedKind : CatalogSearchResult { /// [JsonIgnore] public override string Kind => "unsupported-kind"; /// Human-readable explanation, safe to surface. Never contains a query, URL, handle, or secret. [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(1000)] [JsonPropertyName("message")] public required string Message { get; set; } /// The kinds from the request that are not supported. [JsonPropertyName("requestedKinds")] public required IList RequestedKinds { get; set; } /// Every candidate kind this runtime can serve. [JsonPropertyName("supportedKinds")] public required IList SupportedKinds { get; set; } } /// The request was rejected before any work was done, because a bounded field fell outside its permitted range or a required field was unusable. /// The invalid-request variant of . [Experimental(Diagnostics.Experimental)] public partial class CatalogSearchResultInvalidRequest : CatalogSearchResult { /// [JsonIgnore] public override string Kind => "invalid-request"; /// Which request field was rejected. [JsonPropertyName("field")] public required CatalogInvalidRequestField Field { get; set; } /// Human-readable explanation, safe to surface. Never echoes the offending value, nor a query, URL, handle, or secret. [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(1000)] [JsonPropertyName("message")] public required string Message { get; set; } } /// An optional catalog authentication exchange did not establish the caller's identity. Anonymous search remains supported; this refusal is reserved for an operation that cannot continue after the attempted exchange. It is distinct from `policy-rejected` and from a network failure, and the reason identifies the recovery action. /// The authentication-required variant of . [Experimental(Diagnostics.Experimental)] public partial class CatalogSearchResultAuthenticationRequired : CatalogSearchResult { /// [JsonIgnore] public override string Kind => "authentication-required"; /// Human-readable explanation, safe to surface. Never contains a credential or token, nor a query, URL, handle, or secret. [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(1000)] [JsonPropertyName("message")] public required string Message { get; set; } /// Why authentication failed. Only an expired credential justifies attempting a silent refresh; an absent or rejected credential requires sign-in. [JsonPropertyName("reason")] public required CatalogAuthenticationRequiredReason Reason { get; set; } } /// Registry or enterprise policy refused the operation. /// The policy-rejected variant of . [Experimental(Diagnostics.Experimental)] public partial class CatalogSearchResultPolicyRejected : CatalogSearchResult { /// [JsonIgnore] public override string Kind => "policy-rejected"; /// Human-readable explanation, safe to surface. Never contains a query, URL, handle, or secret. [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(1000)] [JsonPropertyName("message")] public required string Message { get; set; } /// Which authority produced the decision. [JsonPropertyName("source")] public required McpPlanPolicySource Source { get; set; } } /// The runtime could not reach the catalog authority or retrieve a card. Covers being offline as well as transport-level failure. /// The network-failure variant of . [Experimental(Diagnostics.Experimental)] public partial class CatalogSearchResultNetworkFailure : CatalogSearchResult { /// [JsonIgnore] public override string Kind => "network-failure"; /// Human-readable explanation, safe to surface. Never contains a query, URL, handle, or secret. [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(1000)] [JsonPropertyName("message")] public required string Message { get; set; } /// Categorised failure, low cardinality so it can be aggregated without carrying a URL. [JsonPropertyName("reason")] public required CatalogNetworkFailureReason Reason { get; set; } /// Bounded cooldown in seconds before another catalog request should be attempted, when the authority supplied a numeric Retry-After value or the runtime applied its documented fallback. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("retryAfterSeconds")] public int? RetryAfterSeconds { get; set; } /// HTTP status code, when the failure was a rejected response. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("statusCode")] public int? StatusCode { get; set; } } /// Retrieval was refused by the runtime's hardened fetch boundary before any request left the process, or before a redirect was followed. /// The unsafe-retrieval variant of . [Experimental(Diagnostics.Experimental)] public partial class CatalogSearchResultUnsafeRetrieval : CatalogSearchResult { /// [JsonIgnore] public override string Kind => "unsafe-retrieval"; /// Human-readable explanation, safe to surface. Never contains the refused URL, nor a query, handle, or secret. [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(1000)] [JsonPropertyName("message")] public required string Message { get; set; } /// Which control refused the retrieval, low cardinality so it can be aggregated without carrying a URL. [JsonPropertyName("reason")] public required CatalogUnsafeRetrievalReason Reason { get; set; } } /// A card could not be parsed or did not satisfy its declared media type's schema. /// The malformed-card variant of . [Experimental(Diagnostics.Experimental)] public partial class CatalogSearchResultMalformedCard : CatalogSearchResult { /// [JsonIgnore] public override string Kind => "malformed-card"; /// Media type the card was interpreted as, when it declared one this runtime recognises. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("mediaType")] public CatalogMediaType? MediaType { get; set; } /// Human-readable explanation, safe to surface. Never echoes card content, nor a query, URL, handle, or secret. [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(1000)] [JsonPropertyName("message")] public required string Message { get; set; } /// How the card failed validation. [JsonPropertyName("reason")] public required CatalogMalformedCardReason Reason { get; set; } } /// An upstream catalog response broke the wire contract. Most importantly, every result must carry exactly one of a URL or embedded data: a result carrying both, or neither, is refused here rather than being guessed at. /// The contract-violation variant of . [Experimental(Diagnostics.Experimental)] public partial class CatalogSearchResultContractViolation : CatalogSearchResult { /// [JsonIgnore] public override string Kind => "contract-violation"; /// Human-readable explanation, safe to surface. Never echoes response content, nor a query, URL, handle, or secret. [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(1000)] [JsonPropertyName("message")] public required string Message { get; set; } /// Which rule the response broke. [JsonPropertyName("reason")] public required CatalogContractViolationReason Reason { get; set; } } /// The operation is not available on this runtime. Distinct from a network failure: nothing was attempted. /// The unavailable variant of . [Experimental(Diagnostics.Experimental)] public partial class CatalogSearchResultUnavailable : CatalogSearchResult { /// [JsonIgnore] public override string Kind => "unavailable"; /// Human-readable explanation, safe to surface. Never contains a query, URL, handle, or secret. [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(1000)] [JsonPropertyName("message")] public required string Message { get; set; } /// Why the operation is unavailable. [JsonPropertyName("reason")] public required CatalogUnavailableReason Reason { get; set; } } /// A bounded catalog search. Both the query length and the result count are capped by the schema so a caller cannot request an unbounded scan. [Experimental(Diagnostics.Experimental)] internal sealed class CatalogSearchRequest { /// Protocol version and capabilities the caller requires. [JsonPropertyName("contract")] public CatalogClientContract Contract { get => field ??= new(); set; } /// Restrict results to these candidate kinds. When omitted, every kind the runtime supports is searched. [JsonPropertyName("kinds")] public IList? Kinds { get; set; } /// Maximum number of candidates to return. Defaults to 10 when omitted. [JsonPropertyName("limit")] public int? Limit { get; set; } /// Free-text search query. Persisted as tool input for session continuity, but omitted from telemetry. [RegularExpression("\\S")] [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(256)] [JsonPropertyName("query")] public string Query { get; set; } = string.Empty; } /// Information about an installed plugin tracked in global state. [Experimental(Diagnostics.Experimental)] public sealed class InstalledPluginInfo { /// Opaque, stable hash identifying a direct (non-marketplace) install source. Present only for direct repo / URL / local installs; absent for marketplace plugins. Same source yields the same id; distinct sources never collide. [JsonPropertyName("directSourceId")] public string? DirectSourceId { get; set; } /// Whether the plugin is currently enabled for new sessions. [JsonPropertyName("enabled")] public bool Enabled { get; set; } /// Absolute path of the marketplace directory a live plugin was resolved from. Present only on live, never-persisted records — a plugin belonging to a directory/local marketplace, which is loaded from its real directory on every pass instead of a copy under the installed-plugins cache. Its presence is what marks a listed plugin as live: such a plugin is always present on disk, so `enabled` is its only meaningful state and it is never "not installed". [JsonPropertyName("installedFrom")] public string? InstalledFrom { get; set; } /// Marketplace the plugin came from. Empty string ("") for direct repo / URL / local installs. [JsonPropertyName("marketplace")] public string Marketplace { get; set; } = string.Empty; /// Plugin name. [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; /// Installed version (when reported by the plugin manifest). [JsonPropertyName("version")] public string? Version { get; set; } } /// Plugins installed in user/global state. [Experimental(Diagnostics.Experimental)] public sealed class PluginListResult { /// Installed plugins. [JsonPropertyName("plugins")] public IList Plugins { get => field ??= []; set; } } /// Result of installing a plugin. [Experimental(Diagnostics.Experimental)] public sealed class PluginInstallResult { /// Set when the install path is deprecated (e.g. direct repo / URL / local installs). Callers should surface this to end users. [JsonPropertyName("deprecationWarning")] public string? DeprecationWarning { get; set; } /// The newly installed plugin's metadata. [JsonPropertyName("plugin")] public InstalledPluginInfo Plugin { get => field ??= new(); set; } /// Optional post-install message provided by the plugin (e.g. setup instructions). [JsonPropertyName("postInstallMessage")] public string? PostInstallMessage { get; set; } /// Number of skills discovered and installed from the plugin. [JsonPropertyName("skillsInstalled")] public long SkillsInstalled { get; set; } /// Where the completed plugin tree was staged before atomic promotion. [JsonPropertyName("stagingMode")] public PluginInstallStagingMode? StagingMode { get; set; } } /// Plugin source and optional working directory for relative-path resolution. [Experimental(Diagnostics.Experimental)] internal sealed class PluginsInstallRequest { /// Plugin install spec. Accepts the same forms as the CLI: "plugin@marketplace" (marketplace install), "owner/repo" or "owner/repo:subpath" (GitHub direct), an http/https/ssh URL, or a local path. Direct (non-marketplace) installs are deprecated and will produce a deprecationWarning in the result. [JsonPropertyName("source")] public string Source { get; set; } = string.Empty; /// Working directory used to resolve relative local paths in `source`. Defaults to the server's current working directory. [JsonPropertyName("workingDirectory")] public string? WorkingDirectory { get; set; } } /// Name (or spec) of the plugin to uninstall. [Experimental(Diagnostics.Experimental)] internal sealed class PluginsUninstallRequest { /// Stable source identity for a direct (non-marketplace) install. Disambiguates uninstall when multiple installed plugins share the same name. [JsonPropertyName("directSourceId")] public string? DirectSourceId { get; set; } /// Plugin name or "plugin@marketplace" spec to uninstall. When ambiguous, prefer the fully-qualified spec. [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; } /// Result of updating a single plugin. [Experimental(Diagnostics.Experimental)] public sealed class PluginUpdateResult { /// Version after the update, when reported by the plugin manifest. [JsonPropertyName("newVersion")] public string? NewVersion { get; set; } /// Version that was previously installed, when available. [JsonPropertyName("previousVersion")] public string? PreviousVersion { get; set; } /// Number of skills discovered and installed after the update. [JsonPropertyName("skillsInstalled")] public long SkillsInstalled { get; set; } } /// Name (or spec) of the plugin to update. [Experimental(Diagnostics.Experimental)] internal sealed class PluginsUpdateRequest { /// Plugin name or "plugin@marketplace" spec to update. [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; } /// Per-plugin result from updating all plugins, with versions, skills installed, success flag, and optional error. [Experimental(Diagnostics.Experimental)] public sealed class PluginUpdateAllEntry { /// Error message (failure only). [JsonPropertyName("error")] public string? Error { get; set; } /// Marketplace the plugin came from. Empty string ("") for direct installs. [JsonPropertyName("marketplace")] public string Marketplace { get; set; } = string.Empty; /// Plugin name that was updated. [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; /// Version after the update, when available. [JsonPropertyName("newVersion")] public string? NewVersion { get; set; } /// Previously installed version, when available. [JsonPropertyName("previousVersion")] public string? PreviousVersion { get; set; } /// Number of skills installed after the update (success only). [JsonPropertyName("skillsInstalled")] public long? SkillsInstalled { get; set; } /// Whether the update succeeded for this plugin. [JsonPropertyName("success")] public bool Success { get; set; } } /// Result of updating all installed plugins. [Experimental(Diagnostics.Experimental)] public sealed class PluginUpdateAllResult { /// Per-plugin update results in deterministic order. [JsonPropertyName("results")] public IList Results { get => field ??= []; set; } } /// Plugin names (or specs) to enable, plus the optional working directory the repository-controlled guard is evaluated against. [Experimental(Diagnostics.Experimental)] internal sealed class PluginsEnableRequest { /// Plugin names or "plugin@marketplace" specs to enable. Unknown names are ignored. Non-marketplace direct installs are always enabled and cannot be toggled via this API. [JsonPropertyName("names")] public IList Names { get => field ??= []; set; } /// Working directory whose repository `enabledPlugins` overlay decides whether this mutation is repository-controlled. Hosts that serve sessions across several repositories (the SDK server) should pass the session's directory; otherwise the guard is evaluated against the server process's own working directory, which may belong to a different repository. Defaults to the server's current working directory. [JsonPropertyName("workingDirectory")] public string? WorkingDirectory { get; set; } } /// Plugin names (or specs) to disable, plus the optional working directory the repository-controlled guard is evaluated against. [Experimental(Diagnostics.Experimental)] internal sealed class PluginsDisableRequest { /// Plugin names or "plugin@marketplace" specs to disable. Unknown names are ignored. Non-marketplace direct installs cannot be disabled via this API; uninstall them instead. Plugin-owned MCP servers are stopped in active sessions immediately; other plugin contributions remain available until each session reloads plugins. [JsonPropertyName("names")] public IList Names { get => field ??= []; set; } /// Working directory whose repository `enabledPlugins` overlay decides whether this mutation is repository-controlled. Hosts that serve sessions across several repositories (the SDK server) should pass the session's directory; otherwise the guard is evaluated against the server process's own working directory, which may belong to a different repository. Defaults to the server's current working directory. [JsonPropertyName("workingDirectory")] public string? WorkingDirectory { get; set; } } /// Trusted built-in plugin directories to use for this runtime process. [Experimental(Diagnostics.Experimental)] internal sealed class PluginsBuiltinSetRequest { /// Complete replacement set of trusted built-in plugin directories. Every entry must be an absolute local filesystem path no longer than 4096 characters. [JsonPropertyName("paths")] public IList Paths { get => field ??= []; set; } } /// Registered marketplace summary. [Experimental(Diagnostics.Experimental)] public sealed class MarketplaceInfo { /// True when this is a default marketplace shipped with the runtime. Defaults are not removable. [JsonPropertyName("isDefault")] public bool? IsDefault { get; set; } /// Marketplace name (matches the @marketplace suffix in plugin specs). [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; /// Human-readable description of where the marketplace data is fetched from (e.g. "GitHub: owner/repo"). [JsonPropertyName("source")] public string Source { get; set; } = string.Empty; } /// All registered marketplaces, including built-in defaults. [Experimental(Diagnostics.Experimental)] public sealed class MarketplaceListResult { /// Registered marketplaces. [JsonPropertyName("marketplaces")] public IList Marketplaces { get => field ??= []; set; } } /// Result of registering a new marketplace. [Experimental(Diagnostics.Experimental)] public sealed class MarketplaceAddResult { /// Final name of the marketplace as resolved from its manifest. [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; } /// Marketplace source and optional working directory for relative-path resolution. [Experimental(Diagnostics.Experimental)] internal sealed class PluginsMarketplacesAddRequest { /// Marketplace source. Accepts the same forms as the CLI: "owner/repo" or "owner/repo#ref" (GitHub), an http/https/ssh URL (optionally with #ref), a git scp-style URL (user@host:path), or a local path. The marketplace's own name (from its manifest) is used as the registration key. [JsonPropertyName("source")] public string Source { get; set; } = string.Empty; /// Working directory used to resolve relative local paths in `source`. Defaults to the server's current working directory. [JsonPropertyName("workingDirectory")] public string? WorkingDirectory { get; set; } } /// Outcome of the remove attempt, including dependent-plugin info when applicable. [Experimental(Diagnostics.Experimental)] public sealed class MarketplaceRemoveResult { /// Names of installed plugins that prevented removal. Populated only when `removed=false`. [JsonPropertyName("dependentPlugins")] public IList? DependentPlugins { get; set; } /// True when the marketplace was actually removed. False when removal was skipped because the marketplace has dependent plugins and `force` was not set. [JsonPropertyName("removed")] public bool Removed { get; set; } } /// Name of the marketplace to remove and an optional force flag. [Experimental(Diagnostics.Experimental)] internal sealed class PluginsMarketplacesRemoveRequest { /// When true, also uninstall every plugin sourced from this marketplace. When false (default), removal is a no-op if any plugin from this marketplace is installed and the dependent plugin names are returned in the result. [JsonPropertyName("force")] public bool? Force { get; set; } /// Marketplace name to remove. [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; } /// Plugin entry advertised by a marketplace. [Experimental(Diagnostics.Experimental)] public sealed class MarketplacePluginInfo { /// Short description from the marketplace catalog, when present. [JsonPropertyName("description")] public string? Description { get; set; } /// Plugin name as listed in the marketplace catalog. [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; } /// Plugins advertised by the marketplace. [Experimental(Diagnostics.Experimental)] public sealed class MarketplaceBrowseResult { /// Plugins advertised by the marketplace. [JsonPropertyName("plugins")] public IList Plugins { get => field ??= []; set; } } /// Name of the marketplace whose plugin catalog to fetch. [Experimental(Diagnostics.Experimental)] internal sealed class PluginsMarketplacesBrowseRequest { /// Marketplace name to browse. [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; } /// Per-marketplace refresh result, including marketplace name, success flag, and optional failure error. [Experimental(Diagnostics.Experimental)] public sealed class MarketplaceRefreshEntry { /// Error message (failure only). [JsonPropertyName("error")] public string? Error { get; set; } /// Marketplace name that was refreshed. [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; /// Whether the refresh succeeded. [JsonPropertyName("success")] public bool Success { get; set; } } /// Result of refreshing one or more marketplace catalogs. [Experimental(Diagnostics.Experimental)] public sealed class MarketplaceRefreshResult { /// Per-marketplace refresh results in deterministic order. [JsonPropertyName("results")] public IList Results { get => field ??= []; set; } } /// RPC data type for PluginsMarketplacesRefresh operations. [Experimental(Diagnostics.Experimental)] internal sealed class PluginsMarketplacesRefreshRequest { /// Marketplace name to refresh. When omitted, every registered marketplace is refreshed. [JsonPropertyName("name")] public string? Name { get; set; } } /// Server-side skill metadata, including name, description, source, enabled/invocable state, path, project path, and argument hint. [Experimental(Diagnostics.Experimental)] public sealed class ServerSkill { /// Optional freeform hint describing the skill's expected arguments, from the `argument-hint` frontmatter field. [JsonPropertyName("argumentHint")] public string? ArgumentHint { get; set; } /// Canonical slash command name used to invoke the skill, without the leading '/'. [JsonPropertyName("commandName")] public string? CommandName { get; set; } /// 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. [Experimental(Diagnostics.Experimental)] public sealed class ServerSkillList { /// Messages for skills that failed to load (e.g. malformed SKILL.md). Empty when host skills are excluded so host-local paths are not disclosed to multitenant callers. [JsonPropertyName("errors")] public IList? Errors { get; set; } /// 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. [Experimental(Diagnostics.Experimental)] internal sealed class SkillsDiscoverRequest { /// When true, omit skills from the host's global sources (personal, custom, plugin, and built-in), returning only project-scoped skills. For multitenant deployments. [JsonPropertyName("excludeHostSkills")] public bool? ExcludeHostSkills { get; set; } /// 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; } } /// Canonical directory where skills can be discovered or created, with scope, preference, and optional project path. [Experimental(Diagnostics.Experimental)] public sealed class SkillDiscoveryPath { /// Absolute path of the create/discovery target (may not exist on disk yet). [JsonPropertyName("path")] public string Path { get; set; } = string.Empty; /// Whether this is the canonical directory to create a new skill in its tier. At most one entry per tier is preferred; the `personal-agents` and `custom` scopes are never preferred. [JsonPropertyName("preferredForCreation")] public bool PreferredForCreation { get; set; } /// The input project path this directory was derived from (only for project scope). [JsonPropertyName("projectPath")] public string? ProjectPath { get; set; } /// Which tier this directory belongs to. [JsonPropertyName("scope")] public SkillDiscoveryScope Scope { get; set; } } /// Canonical locations where skills can be created so the runtime will recognize them. [Experimental(Diagnostics.Experimental)] public sealed class SkillDiscoveryPathList { /// Canonical skill create/discovery directories, in priority order. [JsonPropertyName("paths")] public IList Paths { get => field ??= []; set; } } /// Optional project paths to enumerate. [Experimental(Diagnostics.Experimental)] internal sealed class SkillsGetDiscoveryPathsRequest { /// When true, omit the host's personal and custom skill directories, leaving only project directories. For multitenant deployments. [JsonPropertyName("excludeHostSkills")] public bool? ExcludeHostSkills { get; set; } /// Optional list of project directory paths. When omitted or empty, only personal and custom directories are returned. [JsonPropertyName("projectPaths")] public IList? ProjectPaths { get; set; } } /// Skill names to mark as disabled in global configuration, replacing any previous list. [Experimental(Diagnostics.Experimental)] internal sealed class SkillsConfigSetDisabledSkillsRequest { /// List of skill names to disable. [JsonPropertyName("disabledSkills")] public IList DisabledSkills { get => field ??= []; set; } } /// Adds or removes a single skill from the global disabled list, leaving every other entry untouched. [Experimental(Diagnostics.Experimental)] internal sealed class SkillsConfigSetSkillDisabledRequest { /// True to disable the skill, false to enable it. [JsonPropertyName("disabled")] public bool Disabled { get; set; } /// Name of the skill to add to or remove from the disabled list. [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; } /// Agent metadata, including identifiers, display details, source, tools, model, models, MCP servers, skills, and file path. [Experimental(Diagnostics.Experimental)] public sealed class AgentInfo { /// Description of the agent's purpose. [JsonPropertyName("description")] public string Description { get; set; } = string.Empty; /// Whether model-driven invocation is disabled for this agent. [JsonPropertyName("disableModelInvocation")] public bool? DisableModelInvocation { get; set; } /// 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; } /// Authored preferred model id for this agent. Runtime model selection may choose a different model; omitted means no authored preference. [JsonPropertyName("model")] public string? Model { get; set; } /// Whether authored models are preferences or required constraints. [JsonPropertyName("modelPolicy")] public AgentModelPolicy? ModelPolicy { get; set; } /// Authored preferred model ids for this agent, in priority order. Runtime model selection chooses the first available model; omitted means no authored preference. [JsonPropertyName("models")] public IList? Models { get; set; } /// Name of the agent. Use `id` as the stable selection identifier. [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; } /// Authored base prompt for the agent. Runtime prompt assembly may add dynamic context at invocation time. Omitted from `session.agent.list` unless `includePrompt` is true. [JsonPropertyName("prompt")] public string? Prompt { 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; } } /// Agents discovered across user, project, plugin, and remote sources. [Experimental(Diagnostics.Experimental)] public sealed class ServerAgentList { /// All discovered agents across all sources. [JsonPropertyName("agents")] public IList Agents { get => field ??= []; set; } } /// Optional project paths to include in agent discovery. [Experimental(Diagnostics.Experimental)] internal sealed class AgentsDiscoverRequest { /// When true, omit the host's agents (the user-level agent directory and all plugin agents), leaving only project and remote agents. For multitenant deployments. [JsonPropertyName("excludeHostAgents")] public bool? ExcludeHostAgents { get; set; } /// Optional list of project directory paths to scan for project-scoped agents. When omitted or empty, only user/plugin/remote-independent agents are returned (no project scan). [JsonPropertyName("projectPaths")] public IList? ProjectPaths { get; set; } } /// Canonical directory where custom agents can be discovered or created, with scope, preference, and optional project path. [Experimental(Diagnostics.Experimental)] public sealed class AgentDiscoveryPath { /// Absolute path of the search/create directory (may not exist on disk yet). [JsonPropertyName("path")] public string Path { get; set; } = string.Empty; /// Whether this is the canonical directory to create a new agent in its tier. At most one entry per tier is preferred. [JsonPropertyName("preferredForCreation")] public bool PreferredForCreation { get; set; } /// The input project path this directory was derived from (only for project scope). [JsonPropertyName("projectPath")] public string? ProjectPath { get; set; } /// Which tier this directory belongs to. [JsonPropertyName("scope")] public AgentDiscoveryPathScope Scope { get; set; } } /// Canonical locations where custom agents can be created so the runtime will recognize them. [Experimental(Diagnostics.Experimental)] public sealed class AgentDiscoveryPathList { /// Canonical agent create/discovery directories, in priority order. [JsonPropertyName("paths")] public IList Paths { get => field ??= []; set; } } /// Optional project paths to include when enumerating agent discovery directories. [Experimental(Diagnostics.Experimental)] internal sealed class AgentsGetDiscoveryPathsRequest { /// When true, omit the host's user-level agent directory, leaving only project directories. For multitenant deployments (mirrors `discover`'s `excludeHostAgents`). [JsonPropertyName("excludeHostAgents")] public bool? ExcludeHostAgents { get; set; } /// Optional list of project directory paths. When omitted or empty, only the user-level directory is returned. [JsonPropertyName("projectPaths")] public IList? ProjectPaths { get; set; } } /// Loaded instruction source for a session, including path, content, category, location, applicability, and optional description. [Experimental(Diagnostics.Experimental)] public sealed class InstructionSource { /// 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 InstructionSourceLocation Location { get; set; } /// The project path this source was discovered from. Only set by sessionless discovery for repository, working-directory, and project-scoped plugin sources, where it disambiguates sources across multiple workspace roots. The session-scoped getSources leaves it unset. [JsonPropertyName("projectPath")] public string? ProjectPath { 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 InstructionSourceType Type { get; set; } } /// Instruction sources discovered across user, repository, and plugin sources. [Experimental(Diagnostics.Experimental)] public sealed class ServerInstructionSourceList { /// All discovered instruction sources. [JsonPropertyName("sources")] public IList Sources { get => field ??= []; set; } } /// Optional project paths to include in instruction discovery. [Experimental(Diagnostics.Experimental)] internal sealed class InstructionsDiscoverRequest { /// When true, omit the host's instruction sources (user/home-level files and plugin rules), leaving only repository and working-directory sources. For multitenant deployments. [JsonPropertyName("excludeHostInstructions")] public bool? ExcludeHostInstructions { get; set; } /// Optional list of project directory paths to scan for repository/working-directory instruction sources. When omitted or empty, only user-level and plugin instruction sources are returned (no project scan). [JsonPropertyName("projectPaths")] public IList? ProjectPaths { get; set; } } /// Canonical file or directory where custom instructions can be discovered or created, with location, kind, preference, and project path. [Experimental(Diagnostics.Experimental)] public sealed class InstructionDiscoveryPath { /// Whether the target is a single file or a directory of instruction files. [JsonPropertyName("kind")] public InstructionDiscoveryPathKind Kind { get; set; } /// Which tier this target belongs to. [JsonPropertyName("location")] public InstructionDiscoveryPathLocation Location { get; set; } /// Absolute path of the file or directory (may not exist on disk yet). [JsonPropertyName("path")] public string Path { get; set; } = string.Empty; /// Whether this is the canonical target to create new instructions in its tier. At most one entry per tier is preferred. [JsonPropertyName("preferredForCreation")] public bool PreferredForCreation { get; set; } /// The input project path this target was derived from (only for repository targets). [JsonPropertyName("projectPath")] public string? ProjectPath { get; set; } } /// Canonical files and directories where custom instructions can be created so the runtime will recognize them. [Experimental(Diagnostics.Experimental)] public sealed class InstructionDiscoveryPathList { /// Canonical instruction create/discovery files and directories, in priority order. [JsonPropertyName("paths")] public IList Paths { get => field ??= []; set; } } /// Optional project paths to include when enumerating instruction discovery targets. [Experimental(Diagnostics.Experimental)] internal sealed class InstructionsGetDiscoveryPathsRequest { /// When true, omit the host's user-level instruction targets, leaving only repository targets. For multitenant deployments (mirrors `discover`'s `excludeHostInstructions`). [JsonPropertyName("excludeHostInstructions")] public bool? ExcludeHostInstructions { get; set; } /// Optional list of project directory paths. When omitted or empty, only the user-level targets are returned. [JsonPropertyName("projectPaths")] public IList? ProjectPaths { get; set; } } /// A literal choice the command input accepts, with a human-facing description. [Experimental(Diagnostics.Experimental)] public sealed class SlashCommandInputChoice { /// Human-readable description shown alongside the choice. [JsonPropertyName("description")] public string Description { get; set; } = string.Empty; /// The literal choice value (e.g. 'on', 'off', 'show'). [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; } /// Optional unstructured input hint. [Experimental(Diagnostics.Experimental)] public sealed class SlashCommandInput { /// Optional literal choices the input accepts, each with a human-facing description; clients may render these as selectable options. [JsonPropertyName("choices")] public IList? Choices { get; set; } /// 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; } } /// Slash-command metadata with name, aliases, description, kind, input hint, execution allowance, and schedulability. [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; /// Whether the command may be the target of `/every` / `/after` schedules. Resolution happens at every tick, so only set this when the command is safe to re-invoke and produces an agent prompt. [JsonPropertyName("schedulable")] public bool? Schedulable { get; set; } } /// 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; } } /// A single user setting's effective value alongside its default, so consumers can render settings left at their default. [Experimental(Diagnostics.Experimental)] public sealed class UserSettingMetadata { /// The centrally-known default for this setting (null when no default is registered). [JsonPropertyName("default")] public JsonElement Default { get; set; } /// True when the user has not set an explicit value for this setting (i.e. it is left at its default). Reflects whether the user has overridden the key, not whether the effective value happens to equal the default — a key explicitly set to a value identical to the default still reports false. [JsonPropertyName("isDefault")] public bool IsDefault { get; set; } /// The effective value: the user's value if set, otherwise the default. [JsonPropertyName("value")] public JsonElement Value { get; set; } } /// Per-key metadata for every known user setting (settings.json overlaid with the legacy config.json, config.json wins), including settings left at their default. Excludes repository- and enterprise-managed overrides. [Experimental(Diagnostics.Experimental)] public sealed class UserSettingsGetResult { /// Every known user setting keyed by setting name, each with its effective value, default, and whether it is at the default. [JsonPropertyName("settings")] public IDictionary Settings { get => field ??= new Dictionary(); set; } } /// Outcome of writing user settings. [Experimental(Diagnostics.Experimental)] public sealed class UserSettingsSetResult { /// Top-level keys whose write landed in settings.json but is shadowed by a value still present in the legacy config.json (config.json wins on read). The write does not take effect until the legacy value is removed. [JsonPropertyName("shadowedKeys")] public IList ShadowedKeys { get => field ??= []; set; } } /// Partial user settings to write to settings.json. Each top-level key is written individually, replacing the existing value; a key whose value is null is removed. [Experimental(Diagnostics.Experimental)] internal sealed class UserSettingsSetRequest { /// Partial user settings to write, as a free-form object keyed by setting name. [JsonPropertyName("settings")] public JsonElement Settings { get; set; } } /// Validated device-managed settings discovered before a session exists. [Experimental(Diagnostics.Experimental)] public sealed class ManagedSettingsReadResult { /// Discovery or validation error text when managed settings could not be read safely. [JsonPropertyName("errorMessage")] public string? ErrorMessage { get; set; } /// Validated, canonical managed-settings JSON. Omitted when no managed settings were discovered or when discovered settings failed validation. [JsonPropertyName("settingsJson")] public JsonElement? SettingsJson { get; set; } } /// Indicates whether the calling client was registered as the session filesystem provider. [Experimental(Diagnostics.Experimental)] public sealed class SessionFsSetProviderResult { /// Whether the provider was set successfully. [JsonPropertyName("success")] public bool Success { get; set; } } /// Optional capabilities declared by the provider. [Experimental(Diagnostics.Experimental)] 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. [Experimental(Diagnostics.Experimental)] 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; } /// Indicates whether the calling client was registered as the LLM inference provider. [Experimental(Diagnostics.Experimental)] public sealed class LlmInferenceSetProviderResult { /// Whether the provider was set successfully. [JsonPropertyName("success")] public bool Success { get; set; } } /// Whether the start frame was accepted. [Experimental(Diagnostics.Experimental)] public sealed class LlmInferenceHttpResponseStartResult { /// True when the response start was matched to a pending request; false when unknown. [JsonPropertyName("accepted")] public bool Accepted { get; set; } } /// Response head. [Experimental(Diagnostics.Experimental)] internal sealed class LlmInferenceHttpResponseStartRequest { /// HTTP response headers, preserving multiple values per name. [JsonPropertyName("headers")] public IDictionary> Headers { get => field ??= new Dictionary>(); set; } /// Matches the requestId from the originating httpRequestStart frame. [JsonPropertyName("requestId")] public string RequestId { get; set; } = string.Empty; /// HTTP status code. [JsonPropertyName("status")] public long Status { get; set; } /// Optional HTTP status reason phrase. [JsonPropertyName("statusText")] public string? StatusText { get; set; } } /// Whether the chunk was accepted. [Experimental(Diagnostics.Experimental)] public sealed class LlmInferenceHttpResponseChunkResult { /// True when the chunk was matched to a pending request; false when unknown. [JsonPropertyName("accepted")] public bool Accepted { get; set; } } /// Set to terminate the response with a transport-level failure. Implies end-of-stream; any further chunks for this requestId are ignored. [Experimental(Diagnostics.Experimental)] public sealed class LlmInferenceHttpResponseChunkError { /// Optional machine-readable error code. [JsonPropertyName("code")] public string? Code { get; set; } /// Human-readable failure description. [JsonPropertyName("message")] public string Message { get; set; } = string.Empty; } /// A response body chunk or terminal error. [Experimental(Diagnostics.Experimental)] internal sealed class LlmInferenceHttpResponseChunkRequest { /// When true, `data` is base64-encoded bytes. When absent or false, `data` is UTF-8 text. [JsonPropertyName("binary")] public bool? Binary { get; set; } /// Body byte range. UTF-8 text when `binary` is absent or false; base64-encoded bytes when `binary` is true. May be empty (e.g. when the response body is empty: send a single chunk with empty data and end=true). [JsonPropertyName("data")] public string Data { get; set; } = string.Empty; /// When true, this is the final body chunk for the response. The runtime treats the response body as complete after receiving an end-marked chunk. [JsonPropertyName("end")] public bool? End { get; set; } /// Set to terminate the response with a transport-level failure. Implies end-of-stream; any further chunks for this requestId are ignored. [JsonPropertyName("error")] public LlmInferenceHttpResponseChunkError? Error { get; set; } /// Matches the requestId from the originating httpRequestStart frame. [JsonPropertyName("requestId")] public string RequestId { get; set; } = string.Empty; } /// Pre-resolved working-directory context for session startup. [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; } } /// GitHub repository the remote session belongs to. [Experimental(Diagnostics.Experimental)] public sealed class RemoteSessionMetadataRepository { /// 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. [JsonPropertyName("owner")] public string Owner { get; set; } = string.Empty; } /// Remote session metadata for the session to hand off (typically obtained from `sessions.list` with `source: "remote"`). [Experimental(Diagnostics.Experimental)] public sealed class RemoteSessionMetadataValue { /// Most recent working directory context. [JsonPropertyName("context")] public SessionContext? Context { get; set; } /// Host-supplied human description of what the session is doing right now ("running tests", "waiting for approval"). Optional in the protocol and absent on hosts that do not publish it, so never rely on it -- it enriches `hostStatus`, it does not replace it. [JsonPropertyName("hostActivity")] public string? HostActivity { get; set; } /// Live status as the owning host reports it in its session listing, so a row for a session running elsewhere can show that it is running. Absent for hosts that publish no such status (the cloud task managers), which read as idle. [JsonPropertyName("hostStatus")] public RemoteSessionHostStatus? HostStatus { get; set; } /// Always true for remote sessions. [JsonPropertyName("isRemote")] public bool IsRemote { get; set; } /// Last-modified time as an ISO 8601 timestamp. [JsonPropertyName("modifiedTime")] public string ModifiedTime { get; set; } = string.Empty; /// Optional human-friendly name set via /rename. [JsonPropertyName("name")] public string? Name { get; set; } /// Pull request number associated with the session. [JsonPropertyName("pullRequestNumber")] public long? PullRequestNumber { get; set; } /// Backing remote session IDs (most recent first). [JsonPropertyName("remoteSessionIds")] public IList RemoteSessionIds { get => field ??= []; set; } /// GitHub repository the remote session belongs to. [JsonPropertyName("repository")] public RemoteSessionMetadataRepository Repository { get => field ??= new(); set; } /// Original remote resource identifier (task ID or PR node ID). [JsonPropertyName("resourceId")] public string? ResourceId { get; set; } /// Stable session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; /// Deadline (ISO 8601) at which a CLI remote session becomes stale without further heartbeats. [JsonPropertyName("staleAt")] public string? StaleAt { get; set; } /// Session creation time as an ISO 8601 timestamp. [JsonPropertyName("startTime")] public string StartTime { get; set; } = string.Empty; /// Server-side task state returned by GitHub. [JsonPropertyName("state")] public string? State { get; set; } /// Short summary of the session, when one has been derived. [JsonPropertyName("summary")] public string? Summary { get; set; } /// Whether the remote task originated from CCA or CLI `--remote`. [JsonPropertyName("taskType")] public RemoteSessionMetadataTaskType? TaskType { get; set; } } /// `sessions.open` handoff progress update with step, status, and optional message. [Experimental(Diagnostics.Experimental)] public sealed class SessionsOpenProgress { /// Optional step message. [JsonPropertyName("message")] public string? Message { get; set; } /// Step status. [JsonPropertyName("status")] public SessionsOpenProgressStatus Status { get; set; } /// Handoff step. [JsonPropertyName("step")] public SessionsOpenProgressStep Step { get; set; } } /// Result of opening a session. [Experimental(Diagnostics.Experimental)] public sealed class SessionOpenResult { /// Remote session metadata, present when status is `connected`. [JsonPropertyName("metadata")] public RemoteSessionMetadataValue? Metadata { get; set; } /// Handoff progress steps, present when status is `handed_off`. [JsonPropertyName("progress")] public IList? Progress { get; set; } /// Remote session ID, present when status is `connected`. [JsonPropertyName("remoteSessionId")] public string? RemoteSessionId { get; set; } /// Opened session ID. Omitted when status is `not_found`. [JsonPropertyName("sessionId")] public string? SessionId { get; set; } /// Startup prompts queued by user-level hook configs at session creation. Only populated when status is `created`; resumed sessions return an empty array. [JsonPropertyName("startupPrompts")] public IList? StartupPrompts { get; set; } /// Outcome of the open request. [JsonPropertyName("status")] public SessionsOpenStatus Status { get; set; } } /// 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; } /// Local or remote session metadata entry. Narrow on `isRemote` to access source-specific fields. /// Data type discriminated by isRemote. [Experimental(Diagnostics.Experimental)] public partial class SessionListEntry { /// The boolean discriminator. [JsonPropertyName("isRemote")] public bool IsRemote { get; set; } /// Runtime client name that created/last resumed this session. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("clientName")] public string? ClientName { get; set; } /// Pre-resolved working-directory context for session startup. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("context")] public SessionContext? Context { get; set; } /// Host-supplied human description of what the session is doing right now ("running tests", "waiting for approval"). Optional in the protocol and absent on hosts that do not publish it, so never rely on it -- it enriches `hostStatus`, it does not replace it. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("hostActivity")] public string? HostActivity { get; set; } /// Live status as the owning host reports it in its session listing, so a row for a session running elsewhere can show that it is running. Absent for hosts that publish no such status (the cloud task managers), which read as idle. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("hostStatus")] public RemoteSessionHostStatus? HostStatus { get; set; } /// True for detached maintenance sessions that should be hidden from normal resume lists. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("isDetached")] public bool? IsDetached { get; set; } /// GitHub task ID, when this local session is bound to one. Only present for local sessions exported to remote control. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("mcTaskId")] public string? McTaskId { get; set; } /// Last-modified time of the session's persisted state, as ISO 8601. [JsonPropertyName("modifiedTime")] public required string ModifiedTime { get; set; } /// Optional human-friendly name set via /rename. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("name")] public string? Name { get; set; } /// Pull request number associated with the session. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("pullRequestNumber")] public long? PullRequestNumber { get; set; } /// Backing remote session IDs (most recent first). [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("remoteSessionIds")] public IList? RemoteSessionIds { get; set; } /// GitHub repository the remote session belongs to. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("repository")] public RemoteSessionMetadataRepository? Repository { get; set; } /// Original remote resource identifier (task ID or PR node ID). [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("resourceId")] public string? ResourceId { get; set; } /// Stable session identifier. [JsonPropertyName("sessionId")] public required string SessionId { get; set; } /// Deadline (ISO 8601) at which a CLI remote session becomes stale without further heartbeats. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("staleAt")] public string? StaleAt { get; set; } /// Session creation time as an ISO 8601 timestamp. [JsonPropertyName("startTime")] public required string StartTime { get; set; } /// Server-side task state returned by GitHub. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("state")] public string? State { get; set; } /// Short summary of the session, when one has been derived. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("summary")] public string? Summary { get; set; } /// Whether the remote task originated from CCA or CLI `--remote`. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("taskType")] public RemoteSessionMetadataTaskType? TaskType { get; set; } } /// Sessions matching the filter, ordered most-recently-modified first. [Experimental(Diagnostics.Experimental)] public sealed class SessionList { /// Sessions ordered most-recently-modified first. Discriminated by `isRemote`. [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 source filter, 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 true, include detached maintenance sessions. Defaults to false for user-facing session lists. [JsonPropertyName("includeDetached")] public bool? IncludeDetached { get; set; } /// When provided, only the first N local 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 local session. Has no effect on remote entries (which always carry their full shape). [JsonPropertyName("metadataLimit")] public long? MetadataLimit { get; set; } /// Which session sources to include. Defaults to `local` for backward compatibility. [JsonPropertyName("source")] public SessionSource? Source { get; set; } /// Only meaningful when `source` includes remote. When true, propagates errors from the remote service instead of silently returning an empty remote list. Defaults to false. [JsonPropertyName("throwOnError")] public bool? ThrowOnError { get; set; } } /// Persisted local session metadata, including identifiers, timestamps, summary/name, client, context, detached state, and task ID. [Experimental(Diagnostics.Experimental)] public sealed class LocalSessionMetadataValue { /// Runtime client name that created/last resumed this session. [JsonPropertyName("clientName")] public string? ClientName { get; set; } /// Pre-resolved working-directory context for session startup. [JsonPropertyName("context")] public SessionContext? Context { get; set; } /// True for detached maintenance sessions that should be hidden from normal resume lists. [JsonPropertyName("isDetached")] public bool? IsDetached { get; set; } /// Always false for local sessions. [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 local session metadata when the session exists. [Experimental(Diagnostics.Experimental)] internal sealed class SessionsGetMetadataResult { /// Local session metadata, omitted when the session does not exist. [JsonPropertyName("session")] public LocalSessionMetadataValue? Session { get; set; } } /// Session ID whose persisted metadata should be read. [Experimental(Diagnostics.Experimental)] internal sealed class SessionsGetMetadataRequest { /// Session ID to inspect. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Client metadata outcome for one requested local session. /// Polymorphic base type discriminated by status. [Experimental(Diagnostics.Experimental)] [JsonPolymorphic( TypeDiscriminatorPropertyName = "status", UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToBaseType)] [JsonDerivedType(typeof(SessionsClientMetadataEntryOk), "ok")] [JsonDerivedType(typeof(SessionsClientMetadataEntryNotFound), "notFound")] [JsonDerivedType(typeof(SessionsClientMetadataEntryCorrupt), "corrupt")] [JsonDerivedType(typeof(SessionsClientMetadataEntryUnsupportedVersion), "unsupportedVersion")] [JsonDerivedType(typeof(SessionsClientMetadataEntryUnavailable), "unavailable")] public partial class SessionsClientMetadataEntry { /// The type discriminator. [JsonPropertyName("status")] public virtual string Status { get; set; } = string.Empty; } /// The ok variant of . [Experimental(Diagnostics.Experimental)] public partial class SessionsClientMetadataEntryOk : SessionsClientMetadataEntry { /// [JsonIgnore] public override string Status => "ok"; /// Validated client metadata, possibly empty or projected to requested keys. [JsonPropertyName("metadata")] public required IDictionary Metadata { get; set; } /// Requested session ID. [JsonPropertyName("sessionId")] public required string SessionId { get; set; } } /// The notFound variant of . [Experimental(Diagnostics.Experimental)] public partial class SessionsClientMetadataEntryNotFound : SessionsClientMetadataEntry { /// [JsonIgnore] public override string Status => "notFound"; /// Requested session ID. [JsonPropertyName("sessionId")] public required string SessionId { get; set; } } /// The corrupt variant of . [Experimental(Diagnostics.Experimental)] public partial class SessionsClientMetadataEntryCorrupt : SessionsClientMetadataEntry { /// [JsonIgnore] public override string Status => "corrupt"; /// Requested session ID. [JsonPropertyName("sessionId")] public required string SessionId { get; set; } } /// The unsupportedVersion variant of . [Experimental(Diagnostics.Experimental)] public partial class SessionsClientMetadataEntryUnsupportedVersion : SessionsClientMetadataEntry { /// [JsonIgnore] public override string Status => "unsupportedVersion"; /// Requested session ID. [JsonPropertyName("sessionId")] public required string SessionId { get; set; } } /// The unavailable variant of . [Experimental(Diagnostics.Experimental)] public partial class SessionsClientMetadataEntryUnavailable : SessionsClientMetadataEntry { /// [JsonIgnore] public override string Status => "unavailable"; /// Filesystem or provider error code. Clients should not assume every provider uses operating-system error codes. [JsonPropertyName("code")] public required string Code { get; set; } /// Human-readable diagnostic message. Not stable for programmatic matching. [JsonPropertyName("message")] public required string Message { get; set; } /// Requested session ID. [JsonPropertyName("sessionId")] public required string SessionId { get; set; } } /// Bounded batch request for client-owned metadata from persisted local sessions. [Experimental(Diagnostics.Experimental)] internal sealed class SessionsGetClientMetadataRequest { /// Case-sensitive keys to project from each valid bag. Each key must be non-empty, at most 256 UTF-8 bytes, and outside the reserved `copilot/` and `github/` namespaces. Omit to return every entry. [JsonPropertyName("keys")] public IList? Keys { get; set; } /// Session IDs to inspect. Results preserve this order. [JsonPropertyName("sessionIds")] public IList SessionIds { get => field ??= []; set; } } /// 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. For a backward read this cursor pages toward OLDER events; keep passing `direction: backward` with it (the cursor is also self-describing, so backward paging continues correctly). [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 fell back to a boundary of the remaining history. For a forward read the fallback starts from the beginning of the remaining history; for a backward read it falls back to the tail (the newest window). Because the fallback page is a fresh boundary snapshot rather than a continuation of the requested cursor, it may overlap events the consumer has already rendered — a backward fallback to the tail in particular can repeat the newest window. On 'expired', consumers should reset or rebase their local pagination state (or deduplicate by event id) before continuing from the returned cursor rather than blindly appending/prepending the fallback page. [JsonPropertyName("cursorStatus")] public EventsCursorStatus CursorStatus { get; set; } /// Session events for this batch, merged into a single stream in creation order: durable (persisted) events and ephemeral events interleave exactly as they were emitted. Set `includeEphemeral: false` to receive only durable events. Ephemeral events are never replayable once pruned from the in-memory ring, so a consumer that needs them should keep reading with a non-zero `waitMs`. For a backward (tail-first) read, the returned window contains persisted events only, still in chronological (oldest-to-newest) append order. [JsonPropertyName("events")] public IList Events { get => field ??= []; set; } /// True when more events are available in the read's direction. For a forward read, true means the batch returned `max` events and more are available immediately. For a backward read, true means older persisted events remain before the returned window. [JsonPropertyName("hasMore")] public bool HasMore { get; set; } } /// Pagination options for reading an inactive or active local session's persisted event journal. [Experimental(Diagnostics.Experimental)] internal sealed class SessionsReadPersistedEventsRequest { /// Opaque cursor returned by a previous persisted-event read. Omit on the first call. [JsonPropertyName("cursor")] public string? Cursor { get; set; } /// Direction to page through persisted history. Forward starts at the beginning; backward starts with the newest events. Events in each page remain chronological. [JsonPropertyName("direction")] public EventsReadDirection? Direction { get; set; } /// Maximum number of events to return in this batch (1–1000, default 200). [JsonPropertyName("max")] public long? Max { get; set; } /// Session ID whose persisted event journal should be read. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Recent local session IDs that contain user-visible history. [Experimental(Diagnostics.Experimental)] internal sealed class SessionsListNonEmptySessionIdsResult { /// Session IDs ordered newest-first. [JsonPropertyName("sessionIds")] public IList SessionIds { get => field ??= []; set; } } /// Limit for non-empty local session IDs. [Experimental(Diagnostics.Experimental)] internal sealed class SessionsListNonEmptySessionIdsRequest { /// Maximum number of session IDs to return. [JsonPropertyName("limit")] public long? Limit { 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)] internal 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)] internal 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; } } /// Session ID to delete from disk. [Experimental(Diagnostics.Experimental)] internal sealed class SessionsDeleteRequest { /// Session ID to delete. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; /// Internal resolved session directory path to delete. [JsonPropertyName("sessionPath")] public string? SessionPath { get; 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 enriched metadata records, with summary and context fields backfilled where available. Sessions confirmed empty and unnamed are omitted. [Experimental(Diagnostics.Experimental)] public sealed class SessionEnrichMetadataResult { /// Enriched records, with summary and context backfilled. Sessions confirmed empty and unnamed may be omitted. [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 { } /// Installed plugin record from global state, with marketplace, version, install time, enabled state, cache path, and source. [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; /// Absolute path of the marketplace directory a live plugin was resolved from. Present only on live, never-persisted records — those synthesized at session start for a directory/local marketplace, whose cache_path points at the real plugin directory on disk rather than a copy under the installed-plugins cache. Its presence is what marks a record as live, and no record carrying it is ever written to the persisted installedPlugins key. [JsonPropertyName("installed_from")] public string? InstalledFrom { get; set; } /// 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; } /// Per-plugin source fingerprint (a SHA-256 hash of the plugin's catalog source spec plus its resolved source subtree — NOT a Git commit SHA) captured at marketplace install/update time. Auto-update compares it against the freshly recomputed fingerprint to detect a content change that does not bump the version. Absent for pre-existing installs and for direct (non-marketplace) installs. [JsonPropertyName("source_sha")] public string? SourceSha { 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; } } /// Dynamic-context board entry count, when available. [Experimental(Diagnostics.Experimental)] internal sealed class SessionsGetBoardEntryCountResult { /// Board entry count, when available. [JsonPropertyName("count")] public long? Count { get; set; } } /// Session ID whose board entry count should be returned. [Experimental(Diagnostics.Experimental)] internal sealed class SessionsGetBoardEntryCountRequest { /// Session ID whose board entry count should be returned. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// State of the runtime-managed remote-control singleton. /// Polymorphic base type discriminated by state. [Experimental(Diagnostics.Experimental)] [JsonPolymorphic( TypeDiscriminatorPropertyName = "state", UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToBaseType)] [JsonDerivedType(typeof(RemoteControlStatusOff), "off")] [JsonDerivedType(typeof(RemoteControlStatusConnecting), "connecting")] [JsonDerivedType(typeof(RemoteControlStatusActive), "active")] [JsonDerivedType(typeof(RemoteControlStatusError), "error")] public partial class RemoteControlStatus { /// The type discriminator. [JsonPropertyName("state")] public virtual string State { get; set; } = string.Empty; } /// Remote control is not connected. /// The off variant of . [Experimental(Diagnostics.Experimental)] public partial class RemoteControlStatusOff : RemoteControlStatus { /// [JsonIgnore] public override string State => "off"; } /// Remote control is in the middle of initial setup. /// The connecting variant of . [Experimental(Diagnostics.Experimental)] public partial class RemoteControlStatusConnecting : RemoteControlStatus { /// [JsonIgnore] public override string State => "connecting"; /// Session id the connection is attaching to. [JsonPropertyName("attachedSessionId")] public required string AttachedSessionId { get; set; } } /// Remote control is connected to a local session. /// The active variant of . [Experimental(Diagnostics.Experimental)] public partial class RemoteControlStatusActive : RemoteControlStatus { /// [JsonIgnore] public override string State => "active"; /// Session id remote control is pointed at. [JsonPropertyName("attachedSessionId")] public required string AttachedSessionId { get; set; } /// True while a read-only/session-sync export is deferred, awaiting the first `user.message` before its MC session exists. Marked internal: this field is excluded from the public SDK surface and is populated only on the CLI in-process path. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonInclude] [JsonPropertyName("awaitingFirstMessage")] internal bool? AwaitingFirstMessage { get; set; } /// MC frontend URL for this session, when known. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("frontendUrl")] public string? FrontendUrl { get; set; } /// Whether the MC session may steer this session. [JsonPropertyName("isSteerable")] public required bool IsSteerable { get; set; } } /// The last setup attempt failed. The singleton is otherwise off. /// The error variant of . [Experimental(Diagnostics.Experimental)] public partial class RemoteControlStatusError : RemoteControlStatus { /// [JsonIgnore] public override string State => "error"; /// Session id the failing setup attempt targeted, when known. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("attachedSessionId")] public string? AttachedSessionId { get; set; } /// Human-readable error message from the last setup attempt. [JsonPropertyName("error")] public required string Error { get; set; } } /// Wrapper for the singleton's current status. [Experimental(Diagnostics.Experimental)] public sealed class RemoteControlStatusResult { /// State of the runtime-managed remote-control singleton. [JsonPropertyName("status")] public RemoteControlStatus Status { get => field ??= new(); set; } } /// Reattach to an existing MC session without creating a new one. [Experimental(Diagnostics.Experimental)] public sealed class RemoteControlConfigExistingMcSession { /// Existing MC session ID to reattach to. [JsonPropertyName("mcSessionId")] public string McSessionId { get; set; } = string.Empty; /// Existing MC task ID for the reattached session. [JsonPropertyName("mcTaskId")] public string McTaskId { get; set; } = string.Empty; } /// Configuration for the runtime-managed remote-control singleton. [Experimental(Diagnostics.Experimental)] public sealed class RemoteControlConfig { /// Reattach to an existing MC session without creating a new one. [JsonPropertyName("existingMcSession")] public RemoteControlConfigExistingMcSession? ExistingMcSession { get; set; } /// Whether the user explicitly requested remote (vs. implicit session-sync). Controls warning surfacing for missing-repo cases. [JsonPropertyName("explicit")] public bool Explicit { get; set; } /// Whether remote export should be enabled. [JsonPropertyName("remote")] public bool Remote { get; set; } /// When true, suppresses timeline messages on successful setup. [JsonPropertyName("silent")] public bool Silent { get; set; } /// Whether the MC session may steer the local session (write mode). [JsonPropertyName("steerable")] public bool Steerable { get; set; } /// Existing Mission Control task ID to attach the exported session to. [JsonPropertyName("taskId")] public string? TaskId { get; set; } } /// Parameters for attaching the remote-control singleton to a session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionsStartRemoteControlRequest { /// Configuration for the runtime-managed remote-control singleton. [JsonPropertyName("config")] public RemoteControlConfig Config { get => field ??= new(); set; } /// Local session id to attach remote control to. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Outcome of a transferRemoteControl call. [Experimental(Diagnostics.Experimental)] public sealed class RemoteControlTransferResult { /// State of the runtime-managed remote-control singleton. [JsonPropertyName("status")] public RemoteControlStatus Status { get => field ??= new(); set; } /// Whether the rebinding actually happened. [JsonPropertyName("transferred")] public bool Transferred { get; set; } } /// Parameters for atomically rebinding the remote-control singleton. [Experimental(Diagnostics.Experimental)] internal sealed class SessionsTransferRemoteControlRequest { /// When provided, the transfer is rejected unless the singleton currently points at this session id (compare-and-swap semantics to avoid clobbering newer state). [JsonPropertyName("expectedFromSessionId")] public string? ExpectedFromSessionId { get; set; } /// Local session id to point remote control at. [JsonPropertyName("toSessionId")] public string ToSessionId { get; set; } = string.Empty; } /// Patch for the singleton's steering state. [Experimental(Diagnostics.Experimental)] internal sealed class SessionsSetRemoteControlSteeringRequest { /// Target steering state. Today only `true` is actionable on the underlying exporter; `false` is reserved for future use. [JsonPropertyName("enabled")] public bool Enabled { get; set; } } /// Outcome of a stopRemoteControl call. [Experimental(Diagnostics.Experimental)] public sealed class RemoteControlStopResult { /// State of the runtime-managed remote-control singleton. [JsonPropertyName("status")] public RemoteControlStatus Status { get => field ??= new(); set; } /// Whether the singleton was actually torn down by this call. [JsonPropertyName("stopped")] public bool Stopped { get; set; } } /// RPC data type for SessionsStopRemoteControl operations. [Experimental(Diagnostics.Experimental)] internal sealed class SessionsStopRemoteControlRequest { /// When provided, the stop is rejected unless the singleton currently points at this session id (compare-and-swap semantics). [JsonPropertyName("expectedSessionId")] public string? ExpectedSessionId { get; set; } /// When true, the singleton is unconditionally torn down regardless of `expectedSessionId`. Use during shutdown or explicit `/remote off`. [JsonPropertyName("force")] public bool? Force { get; set; } } /// Handle for releasing the extension tool registration. [Experimental(Diagnostics.Experimental)] internal sealed class RegisterExtensionToolsResult { } /// Optional registration options. [Experimental(Diagnostics.Experimental)] public sealed class SessionsRegisterExtensionToolsOnSessionOptions { } /// Params to attach an extension loader's tools to a session. [Experimental(Diagnostics.Experimental)] internal sealed class RegisterExtensionToolsParams { /// Optional registration options. [JsonPropertyName("options")] public SessionsRegisterExtensionToolsOnSessionOptions? Options { get; set; } /// Session to register extension tools on. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Params to attach or detach an in-process ExtensionController delegate. [Experimental(Diagnostics.Experimental)] internal sealed class ConfigureSessionExtensionsParams { /// Session to attach the extension controller delegate to. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Outcome of an agentRegistry.spawn call. /// Polymorphic base type discriminated by kind. [Experimental(Diagnostics.Experimental)] [JsonPolymorphic( TypeDiscriminatorPropertyName = "kind", UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToBaseType)] [JsonDerivedType(typeof(AgentRegistrySpawnResultSpawned), "spawned")] [JsonDerivedType(typeof(AgentRegistrySpawnResultSpawnError), "spawn-error")] [JsonDerivedType(typeof(AgentRegistrySpawnResultRegistryTimeout), "registry-timeout")] [JsonDerivedType(typeof(AgentRegistrySpawnResultValidationError), "validation-error")] public partial class AgentRegistrySpawnResult { /// The type discriminator. [JsonPropertyName("kind")] public virtual string Kind { get; set; } = string.Empty; } /// Full registry entry for the spawned child. Lets the controller call `handleLiveTargetSelected(entry)` directly without re-reading the registry (avoids a TOCTOU window). [Experimental(Diagnostics.Experimental)] public sealed class AgentRegistryLiveTargetEntry { /// Kind of attention required when status === "attention". Meaningful only when status === "attention". [JsonPropertyName("attentionKind")] public AgentRegistryLiveTargetEntryAttentionKind? AttentionKind { get; set; } /// Git branch of the session (when known). [JsonPropertyName("branch")] public string? Branch { get; set; } /// Copilot CLI version that wrote the entry. [JsonPropertyName("copilotVersion")] public string CopilotVersion { get; set; } = string.Empty; /// Working directory of the session (when known). [JsonPropertyName("cwd")] public string? Cwd { get; set; } /// Bind host for the entry's JSON-RPC server. [JsonPropertyName("host")] public string Host { get; set; } = string.Empty; /// Process kind tag for the registry entry. [JsonPropertyName("kind")] public AgentRegistryLiveTargetEntryKind Kind { get; set; } /// Wall-clock milliseconds since the watcher last observed this entry (heartbeat freshness). [JsonPropertyName("lastSeenMs")] public long LastSeenMs { get; set; } /// How the most recent turn ended (clean vs aborted). Lets the renderer distinguish done from done_cancelled. [JsonPropertyName("lastTerminalEvent")] public AgentRegistryLiveTargetEntryLastTerminalEvent? LastTerminalEvent { get; set; } /// Model identifier currently selected for the session. [JsonPropertyName("model")] public string? Model { get; set; } /// Operating-system pid of the process owning this entry. [JsonPropertyName("pid")] public long Pid { get; set; } /// TCP port the entry's JSON-RPC server is listening on. [JsonPropertyName("port")] public long Port { get; set; } /// Registry entry schema version (1 = ui-server, 2 = managed-server). [JsonPropertyName("schemaVersion")] public long SchemaVersion { get; set; } /// Session ID of the foreground session for this entry. [JsonPropertyName("sessionId")] public string? SessionId { get; set; } /// Friendly session name (when set). [JsonPropertyName("sessionName")] public string? SessionName { get; set; } /// ISO 8601 timestamp captured at registration. [JsonPropertyName("startedAt")] public string StartedAt { get; set; } = string.Empty; /// Coarse lifecycle status of the foreground session. [JsonPropertyName("status")] public AgentRegistryLiveTargetEntryStatus? Status { get; set; } /// Monotonic per-publisher revision counter incremented on every status update. Lets watchers detect transient flips. [JsonPropertyName("statusRevision")] public long? StatusRevision { get; set; } /// Connection token (null when the target is unauthenticated). [JsonInclude] [JsonPropertyName("token")] internal string? Token { get; set; } } /// Per-spawn log-capture outcome; populated from spawnLiveTarget. [Experimental(Diagnostics.Experimental)] public sealed class AgentRegistryLogCapture { /// Whether per-spawn log capture is on (false when env-disabled or open failed). [JsonPropertyName("enabled")] public bool Enabled { get; set; } /// Human-readable open failure message (only set when enabled === false AND the env-disable opt-out was NOT used). [JsonPropertyName("openError")] public string? OpenError { get; set; } /// Categorized reason for log-open failure. [JsonPropertyName("openErrorReason")] public AgentRegistryLogCaptureOpenErrorReason? OpenErrorReason { get; set; } /// Absolute path to the per-spawn log file (only set when enabled). [JsonPropertyName("path")] public string? Path { get; set; } } /// Managed-server child was spawned and registered successfully. /// The spawned variant of . [Experimental(Diagnostics.Experimental)] public partial class AgentRegistrySpawnResultSpawned : AgentRegistrySpawnResult { /// [JsonIgnore] public override string Kind => "spawned"; /// Full registry entry for the spawned child. Lets the controller call `handleLiveTargetSelected(entry)` directly without re-reading the registry (avoids a TOCTOU window). [JsonPropertyName("entry")] public required AgentRegistryLiveTargetEntry Entry { get; set; } /// If the delegate attempted to send the initial prompt and failed, the categorized error message. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("initialPromptError")] public string? InitialPromptError { get; set; } /// Whether the delegate already sent the initial prompt. Always omitted in the current wiring: the controller sends the prompt post-attach via the standard LocalRpcSession.send path. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("initialPromptSent")] public bool? InitialPromptSent { get; set; } /// Per-spawn log-capture outcome; populated from spawnLiveTarget. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("logCapture")] public AgentRegistryLogCapture? LogCapture { get; set; } } /// `child_process.spawn` itself failed before the child entered the registry. /// The spawn-error variant of . [Experimental(Diagnostics.Experimental)] public partial class AgentRegistrySpawnResultSpawnError : AgentRegistrySpawnResult { /// [JsonIgnore] public override string Kind => "spawn-error"; /// Underlying errno code (e.g. ENOENT, EACCES) when available. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("code")] public string? Code { get; set; } /// Human-readable error message. [JsonPropertyName("message")] public required string Message { get; set; } } /// Spawn succeeded but the child did not publish a matching managed-server entry within the timeout. /// The registry-timeout variant of . [Experimental(Diagnostics.Experimental)] public partial class AgentRegistrySpawnResultRegistryTimeout : AgentRegistrySpawnResult { /// [JsonIgnore] public override string Kind => "registry-timeout"; /// Process ID of the orphaned child (so the caller can offer 'kill the pid' guidance). [JsonPropertyName("childPid")] public required long ChildPid { get; set; } /// Per-spawn log-capture outcome; populated from spawnLiveTarget. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("logCapture")] public AgentRegistryLogCapture? LogCapture { get; set; } } /// Synchronous pre-validation rejected the spawn request. /// The validation-error variant of . [Experimental(Diagnostics.Experimental)] public partial class AgentRegistrySpawnResultValidationError : AgentRegistrySpawnResult { /// [JsonIgnore] public override string Kind => "validation-error"; /// Which parameter field was invalid. Omitted when the rejection is not field-specific. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("field")] public AgentRegistrySpawnValidationErrorField? Field { get; set; } /// Human-readable explanation; safe to surface in the UI banner. Never logged to unrestricted telemetry. [JsonPropertyName("message")] public required string Message { get; set; } /// Categorized reason for the rejection. Low-cardinality enum so telemetry can aggregate by reason without leaking raw paths or agent/model names. [JsonPropertyName("reason")] public required AgentRegistrySpawnValidationErrorReason Reason { get; set; } } /// Inputs to spawn a managed-server child via the controller's spawn delegate. [Experimental(Diagnostics.Experimental)] internal sealed class AgentRegistrySpawnRequest { /// Custom or built-in agent name (e.g. 'explore'). When omitted, the child uses its own default. [JsonPropertyName("agentName")] public string? AgentName { get; set; } /// Working directory for the spawned child (must be an existing directory). [JsonPropertyName("cwd")] public string Cwd { get; set; } = string.Empty; /// Optional first user message. Forwarded to the caller (the CLI's spawn wrapper sends it post-attach via the standard LocalRpcSession.send path). [JsonPropertyName("initialPrompt")] public string? InitialPrompt { get; set; } /// Model identifier to apply to the new session. [JsonPropertyName("model")] public string? Model { get; set; } /// Friendly session name. Must satisfy validateSessionName: non-empty, no leading/trailing whitespace, <=100 chars, no control chars, no double quotes. [JsonPropertyName("name")] public string? Name { get; set; } /// Permission posture for the new session. 'yolo' requires the controller-local session to currently be in allow-all mode. [JsonPropertyName("permissionMode")] public AgentRegistrySpawnPermissionMode? PermissionMode { get; 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; } /// 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. Must be `user`, `system`, `command-<command-id>` for command-originated messages, `schedule-<numeric-id>` for scheduled prompts, or `agent-<agent-id>` for prompts sent by another agent. [RegularExpression("^(user|system|command-.*|schedule-\\d+|agent-.+)$")] [JsonInclude] [JsonPropertyName("source")] internal string? 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. Transport-dependent tail semantics: on a LOCAL (in-process) session the wait additionally blocks until the completed turn's event tail has been dispatched to this session's in-process subscribers, so a subsequent read of subscriber state already reflects the turn; on a REMOTE session the wait resolves once the loop completes and mirrored delivery follows over the wire. Callers that need the stronger local guarantee on remote sessions should await the event stream explicitly. [JsonPropertyName("wait")] public bool? Wait { get; set; } } /// Result of sending zero or more user messages. [Experimental(Diagnostics.Experimental)] public sealed class SendMessagesResult { /// Unique identifiers assigned to the messages, one per provided message in order. Empty when no messages were provided. [JsonPropertyName("messageIds")] public IList MessageIds { get => field ??= []; set; } } /// A single user message to append to the session as part of a `session.sendMessages` turn. [Experimental(Diagnostics.Experimental)] public sealed class SendMessageItem { /// Optional attachments (files, directories, selections, blobs, GitHub references) to include with this 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. [JsonInclude] [JsonPropertyName("billable")] internal bool? Billable { get; set; } /// If provided, this is shown in the timeline instead of `prompt`. [JsonPropertyName("displayPrompt")] public string? DisplayPrompt { get; set; } /// The user message text. [JsonPropertyName("prompt")] public string Prompt { get; set; } = string.Empty; /// 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; } /// Optional provenance tag copied to the resulting user.message event. Must be `user`, `system`, `command-<command-id>` for command-originated messages, `schedule-<numeric-id>` for scheduled prompts, or `agent-<agent-id>` for prompts sent by another agent. [RegularExpression("^(user|system|command-.*|schedule-\\d+|agent-.+)$")] [JsonInclude] [JsonPropertyName("source")] internal string? Source { get; set; } } /// Parameters for sending zero or more user messages to the session in a single turn. Remote-backed (Mission Control) sessions do not support this method and will return an error. [Experimental(Diagnostics.Experimental)] internal sealed class SendMessagesRequest { /// The UI mode the agent was in when these messages were sent. Defaults to the session's current mode. [JsonPropertyName("agentMode")] public SendAgentMode? AgentMode { get; set; } /// The user messages to append to the conversation, in order. May be empty, in which case a single turn runs over the existing history with no new user message. [JsonPropertyName("messages")] public IList Messages { get => field ??= []; set; } /// How to deliver the messages. `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 messages to the front of the queue instead of the end. [JsonPropertyName("prepend")] public bool? Prepend { get; set; } /// 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; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; /// 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 turn before returning. Defaults to false (fire-and-forget). When true, the result still contains the same `messageIds`; the caller can rely on the agent having processed the messages before the call resolves. Transport-dependent tail semantics: on a LOCAL (in-process) session the wait additionally blocks until the completed turn's event tail has been dispatched to this session's in-process subscribers, so a subsequent read of subscriber state already reflects the turn; on a REMOTE session the wait resolves once the loop completes and mirrored delivery follows over the wire. Callers that need the stronger local guarantee on remote sessions should await the event stream explicitly. [JsonPropertyName("wait")] public bool? Wait { get; set; } } /// Internal request for sending a system notification. [Experimental(Diagnostics.Experimental)] internal sealed class SendSystemNotificationRequest { /// Optional structured notification kind. [JsonPropertyName("kind")] public JsonElement? Kind { get; set; } /// Notification text to deliver to the model. [JsonPropertyName("message")] public string Message { get; set; } = string.Empty; /// Internal delivery options, including passive policy. [JsonPropertyName("options")] public JsonElement? Options { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// 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; } /// Result of interrupting the main agent turn. [Experimental(Diagnostics.Experimental)] public sealed class InterruptMainTurnResult { /// Whether an in-flight main agent turn was interrupted. False when the main loop was not processing. [JsonPropertyName("interrupted")] public bool Interrupted { get; set; } } /// Parameters for interrupting the main agent turn. [Experimental(Diagnostics.Experimental)] internal sealed class InterruptMainTurnRequest { /// When true, the user's queued prompts are preserved and run as the next turn once the interrupted turn unwinds; when false (the default), the queue is cleared like a plain abort. [JsonPropertyName("flushQueued")] public bool? FlushQueued { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionCancelAllBackgroundAgentsRequest { /// 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; } } /// Managed sandbox enforcement state for a session. [Experimental(Diagnostics.Experimental)] public sealed class SandboxEnforcementStatus { /// Whether an enforcement failure has permanently blocked the session. [JsonPropertyName("blocked")] public bool Blocked { get; set; } /// The first sandbox enforcement failure that blocked the session. [JsonPropertyName("reason")] public string? Reason { get; set; } /// Whether the effective managed policy requires an available sandbox backend. [JsonPropertyName("required")] public bool Required { get; set; } } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionSandboxGetEnforcementStatusRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Result of attempting to disable sandboxing for the current session. [Experimental(Diagnostics.Experimental)] public sealed class SandboxDisableForSessionResult { /// The authoritative sandbox enabled state after the operation. [JsonPropertyName("enabled")] public bool Enabled { get; set; } /// Whether this call resolved the pending request and applied the session opt-out. [JsonPropertyName("success")] public bool Success { get; set; } } /// Optional informational context describing how and where the permission decision was made. This does not affect permission behavior. [Experimental(Diagnostics.Experimental)] public sealed class PermissionDecisionContext { /// Disposition of the permission request as observed by the responding client. [JsonPropertyName("outcome")] public PermissionDecisionOutcome Outcome { get; set; } /// Whether the responding client could ask a user interactively, was running headlessly, or had no response path. Omit when the client cannot determine this authoritatively. [JsonPropertyName("responseCapability")] public PermissionResponseCapability? ResponseCapability { get; set; } /// Controlled reason or actor responsible for the response. [JsonPropertyName("source")] public PermissionDecisionSource Source { get; set; } /// Client surface that submitted the response. [JsonPropertyName("surface")] public PermissionDecisionSurface Surface { get; set; } } /// Request to disable sandboxing for the current session while resolving an active sandbox-bypass permission prompt. [Experimental(Diagnostics.Experimental)] internal sealed class SandboxDisableForSessionRequest { /// Optional attribution for the permission decision. [JsonPropertyName("decisionContext")] public PermissionDecisionContext? DecisionContext { get; set; } /// Identifier of the exact pending sandbox-bypass permission request that authorized the session opt-out. [JsonPropertyName("requestId")] public string RequestId { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// 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 SessionGitHubAuthGetStatusRequest { /// 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 session ended up with a populated `copilotUser` for the installed credentials. `true` when the supplied credential already carried `copilotUser` or it was successfully re-resolved server-side. `false` when the credential is installed without `copilotUser` — either re-resolution failed, or the variant cannot be re-resolved from the credential alone (only the raw-token variants `token`, `env`, and `gh-cli` can). In both `false` cases the token swap still applied, but plan/quota/billing metadata is degraded. Present whenever a credential was supplied; omitted only when no credential was supplied (no-op call). [JsonPropertyName("copilotUserResolved")] public bool? CopilotUserResolved { get; set; } /// Whether the operation succeeded. [JsonPropertyName("success")] public bool Success { get; set; } } /// Authentication credentials accepted by session.gitHubAuth.setCredentials. Session-owned token-provider identities cannot be installed through this method. /// Polymorphic base type discriminated by type. [Experimental(Diagnostics.Experimental)] [JsonPolymorphic( TypeDiscriminatorPropertyName = "type", UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToBaseType)] [JsonDerivedType(typeof(SettableAuthInfoHmac), "hmac")] [JsonDerivedType(typeof(SettableAuthInfoEnv), "env")] [JsonDerivedType(typeof(SettableAuthInfoToken), "token")] [JsonDerivedType(typeof(SettableAuthInfoCopilotApiToken), "copilot-api-token")] [JsonDerivedType(typeof(SettableAuthInfoUser), "user")] [JsonDerivedType(typeof(SettableAuthInfoGhCli), "gh-cli")] [JsonDerivedType(typeof(SettableAuthInfoApiKey), "api-key")] public partial class SettableAuthInfo { /// The type discriminator. [JsonPropertyName("type")] public virtual string Type { get; set; } = string.Empty; } /// Authentication-info input variant for GitHub-internal HMAC auth, carrying the public GitHub host and HMAC secret. /// The hmac variant of . [Experimental(Diagnostics.Experimental)] public partial class SettableAuthInfoHmac : SettableAuthInfo { /// [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; } } /// Authentication-info input variant for a token sourced from an environment variable, with host, optional login, token, and env var name. /// The env variant of . [Experimental(Diagnostics.Experimental)] public partial class SettableAuthInfoEnv : SettableAuthInfo { /// [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; } } /// Token authentication accepted by session.gitHubAuth.setCredentials. /// The token variant of . [Experimental(Diagnostics.Experimental)] public partial class SettableAuthInfoToken : SettableAuthInfo { /// [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; } } /// Authentication-info variant for direct Copilot API token auth sourced from environment variables, with public GitHub host. /// The copilot-api-token variant of . [Experimental(Diagnostics.Experimental)] public partial class SettableAuthInfoCopilotApiToken : SettableAuthInfo { /// [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; } } /// Authentication-info variant for OAuth user auth, with host and login; the token remains in the runtime secret store. /// The user variant of . [Experimental(Diagnostics.Experimental)] public partial class SettableAuthInfoUser : SettableAuthInfo { /// [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; } } /// Authentication-info input variant for GitHub CLI credentials, carrying host, login, and the `gh auth token` value. /// The gh-cli variant of . [Experimental(Diagnostics.Experimental)] public partial class SettableAuthInfoGhCli : SettableAuthInfo { /// [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; } } /// Authentication-info input variant for API-key authentication to a non-GitHub LLM provider, carrying the secret `apiKey` and host. /// The api-key variant of . [Experimental(Diagnostics.Experimental)] public partial class SettableAuthInfoApiKey : SettableAuthInfo { /// [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 installs the supplied value immediately for outbound model/API requests. When the credential carries a raw token (`token`, `env`, or `gh-cli`) but no `copilotUser`, the runtime additionally re-resolves `copilotUser` server-side (best-effort, asynchronously, after the synchronous install) so plan/quota/billing metadata regains fidelity; on resolution failure the verbatim credential remains installed. It does NOT otherwise validate the credential. Several variants carry secret material; treat this method's params as containing secrets at rest and in transit. [JsonPropertyName("credentials")] public SettableAuthInfo? Credentials { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Credential-free authentication identity safe to expose to hosts and user interfaces. [Experimental(Diagnostics.Experimental)] public sealed class AuthIdentity { /// Snapshot of the authenticated user's Copilot subscription info, if known. [JsonPropertyName("copilotUser")] public CopilotUserResponse? CopilotUser { get; set; } /// Name of the environment variable that supplied the credential, when applicable. [JsonPropertyName("envVar")] public string? EnvVar { get; set; } /// Authentication host. [JsonPropertyName("host")] public string Host { get; set; } = string.Empty; /// Authenticated login, when available. [JsonPropertyName("login")] public string? Login { get; set; } /// Opaque SDK GitHub credential registration backing this identity. Routing metadata only; never a credential. [JsonPropertyName("registrationId")] public string? RegistrationId { get; set; } /// Authentication type. [JsonPropertyName("type")] public AuthInfoType Type { get; set; } } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionGitHubAuthGetCurrentAuthInfoRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionGitHubAuthGetAllAuthAvailableRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionGitHubAuthRefreshCopilotUserRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Internal GitHub login parameters. [Experimental(Diagnostics.Experimental)] internal sealed class SessionAuthLoginRequest { /// GitHub host URL. [JsonPropertyName("host")] public string Host { get; set; } = string.Empty; /// GitHub login. [JsonPropertyName("login")] public string Login { get; set; } = string.Empty; /// Whether to persist the token after login. [JsonPropertyName("persist")] public bool? Persist { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; /// GitHub authentication token. [JsonPropertyName("token")] public string Token { get; set; } = string.Empty; } /// Parameters for switching the session's active authentication. [Experimental(Diagnostics.Experimental)] internal sealed class SessionAuthSwitchRequest { /// Authentication information to activate. [JsonPropertyName("authInfo")] public AuthInfo AuthInfo { get => field ??= new(); set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; /// Optional token paired with the authentication information. [JsonPropertyName("token")] public string? Token { get; set; } } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionGitHubAuthLogoutRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Parameters identifying a GitHub authentication to log out. [Experimental(Diagnostics.Experimental)] internal sealed class SessionAuthLogoutUserRequest { /// Authentication information to log out. [JsonPropertyName("authInfo")] public AuthInfo AuthInfo { get => field ??= new(); set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Validation error from an authentication attempt. [Experimental(Diagnostics.Experimental)] public sealed class AuthValidationError { /// Optional message returned by GitHub. [JsonPropertyName("githubMessage")] public string? GitHubMessage { get; set; } /// Authentication validation error message. [JsonPropertyName("message")] public string Message { get; set; } = string.Empty; } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionGitHubAuthLastAuthErrorsRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// A file included in the redacted debug bundle. [Experimental(Diagnostics.Experimental)] public sealed class DebugCollectLogsCollectedEntry { /// Relative path of the file in the staged bundle/archive. [JsonPropertyName("bundlePath")] public string BundlePath { get; set; } = string.Empty; /// Redacted output size in bytes. [JsonPropertyName("sizeBytes")] public long SizeBytes { get; set; } /// Source category for this entry. [JsonPropertyName("source")] public DebugCollectLogsSource Source { get; set; } } /// An optional debug bundle entry that could not be included. [Experimental(Diagnostics.Experimental)] public sealed class DebugCollectLogsSkippedEntry { /// Relative path requested for this bundle entry. [JsonPropertyName("bundlePath")] public string BundlePath { get; set; } = string.Empty; /// Server-local source path that could not be read. [JsonPropertyName("path")] public string? Path { get; set; } /// Reason the entry was skipped. [JsonPropertyName("reason")] public string Reason { get; set; } = string.Empty; } /// Result of collecting a redacted debug bundle. [Experimental(Diagnostics.Experimental)] public sealed class DebugCollectLogsResult { /// Files included in the redacted bundle. [JsonPropertyName("entries")] public IList Entries { get => field ??= []; set; } /// Destination kind that was written. [JsonPropertyName("kind")] public DebugCollectLogsResultKind Kind { get; set; } /// Actual archive path or staging directory path written. This may differ from the requested path when no-overwrite suffixing or fallback-to-temp-directory was needed. [JsonPropertyName("path")] public string Path { get; set; } = string.Empty; /// Optional files or directories that could not be included. [JsonPropertyName("skippedEntries")] public IList? SkippedEntries { get; set; } } /// A caller-provided server-local file or directory to include in the debug bundle. [Experimental(Diagnostics.Experimental)] public sealed class DebugCollectLogsEntry { /// Relative path to use inside the staged bundle/archive. [JsonPropertyName("bundlePath")] public string BundlePath { get; set; } = string.Empty; /// Kind of source path to include. [JsonPropertyName("kind")] public DebugCollectLogsEntryKind Kind { get; set; } /// Server-local source path to read. [JsonPropertyName("path")] public string Path { get; set; } = string.Empty; /// How text content from this entry should be redacted. Defaults to plain-text. [JsonPropertyName("redaction")] public DebugCollectLogsRedaction? Redaction { get; set; } /// When true, collection fails if this entry cannot be read. Defaults to false, which records the entry in `skippedEntries`. [JsonPropertyName("required")] public bool? Required { get; set; } } /// Destination for the redacted debug bundle. /// Polymorphic base type discriminated by kind. [Experimental(Diagnostics.Experimental)] [JsonPolymorphic( TypeDiscriminatorPropertyName = "kind", UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToBaseType)] [JsonDerivedType(typeof(DebugCollectLogsDestinationArchive), "archive")] [JsonDerivedType(typeof(DebugCollectLogsDestinationDirectory), "directory")] public partial class DebugCollectLogsDestination { /// The type discriminator. [JsonPropertyName("kind")] public virtual string Kind { get; set; } = string.Empty; } /// The archive variant of . [Experimental(Diagnostics.Experimental)] public partial class DebugCollectLogsDestinationArchive : DebugCollectLogsDestination { /// [JsonIgnore] public override string Kind => "archive"; /// When true, create the archive atomically without overwriting an existing file by appending ` (N)` before the extension as needed. Defaults to false. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("noOverwrite")] public bool? NoOverwrite { get; set; } /// Absolute or server-relative path for the .tgz archive to create. [JsonPropertyName("outputPath")] public required string OutputPath { get; set; } } /// The directory variant of . [Experimental(Diagnostics.Experimental)] public partial class DebugCollectLogsDestinationDirectory : DebugCollectLogsDestination { /// [JsonIgnore] public override string Kind => "directory"; /// Directory where redacted files should be staged. The directory is created if needed. [JsonPropertyName("outputDirectory")] public required string OutputDirectory { get; set; } } /// Built-in session diagnostics to include in the bundle. Omitted fields default to true. [Experimental(Diagnostics.Experimental)] public sealed class DebugCollectLogsInclude { /// Server-local path to the current process log. When set, it is included as `process.log` and its directory is searched for prior logs from the same session. [JsonPropertyName("currentProcessLogPath")] public string? CurrentProcessLogPath { get; set; } /// Include the session event log (`events.jsonl`). Defaults to true. [JsonPropertyName("events")] public bool? Events { get; set; } /// Server-local path to the session's events.jsonl file. Internal callers normally omit this and let the runtime derive it from the session. [JsonPropertyName("eventsPath")] public string? EventsPath { get; set; } /// Maximum number of previous process logs to include. Defaults to 5. [JsonPropertyName("previousProcessLogLimit")] public long? PreviousProcessLogLimit { get; set; } /// Server-local process log directory to search when `currentProcessLogPath` is unavailable, useful for collecting logs for inactive sessions. [JsonPropertyName("processLogDirectory")] public string? ProcessLogDirectory { get; set; } /// Include process logs for the session. Defaults to true. [JsonPropertyName("processLogs")] public bool? ProcessLogs { get; set; } /// Include interactive shell logs written under the session's `shell-logs` directory. Defaults to true. [JsonPropertyName("shellLogs")] public bool? ShellLogs { get; set; } } /// Options for collecting a redacted session debug bundle. [Experimental(Diagnostics.Experimental)] internal sealed class DebugCollectLogsRequest { /// Caller-provided server-local files or directories to include in addition to the runtime's built-in session diagnostics. This lets host applications add their own diagnostics without changing the API shape. [JsonPropertyName("additionalEntries")] public IList? AdditionalEntries { get; set; } /// Where the redacted bundle should be written. Use `archive` to produce a .tgz, or `directory` to stage redacted files for caller-managed upload/post-processing. [JsonPropertyName("destination")] public DebugCollectLogsDestination Destination { get => field ??= new(); set; } /// Which built-in session diagnostics to include. Omitted fields default to true. [JsonPropertyName("include")] public DebugCollectLogsInclude? Include { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Canvas action that the agent or host can invoke. To discover the input schema for a particular action, call the list_canvas_capabilities tool. [Experimental(Diagnostics.Experimental)] public sealed class CanvasAction { /// Description of the action. [JsonPropertyName("description")] public string? Description { get; set; } /// JSON Schema for the action input. [JsonPropertyName("inputSchema")] public JsonElement? InputSchema { get; set; } /// Action name exposed by the canvas provider. [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; } /// Canvas available in the current session. [Experimental(Diagnostics.Experimental)] public sealed class DiscoveredCanvas { /// Actions the agent or host may invoke on an open instance. [JsonPropertyName("actions")] public IList? Actions { get; set; } /// Provider-local canvas identifier. [JsonPropertyName("canvasId")] public string CanvasId { get; set; } = string.Empty; /// Short, single-sentence description shown to the agent in canvas catalogs. [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("description")] public string Description { get; set; } = string.Empty; /// Human-readable canvas name. [JsonPropertyName("displayName")] public string DisplayName { get; set; } = string.Empty; /// Owning provider identifier. [JsonPropertyName("extensionId")] public string ExtensionId { get; set; } = string.Empty; /// Owning extension display name, when available. [JsonPropertyName("extensionName")] public string? ExtensionName { get; set; } /// Host-local PNG path for the canvas icon, when supplied. [JsonPropertyName("icon")] public string? Icon { get; set; } /// JSON Schema for canvas open input. [JsonPropertyName("inputSchema")] public JsonElement? InputSchema { get; set; } } /// Declared canvases available in this session. [Experimental(Diagnostics.Experimental)] public sealed class CanvasList { /// Declared canvases available in this session. [JsonPropertyName("canvases")] public IList Canvases { get => field ??= []; set; } } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionCanvasListRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Open canvas instance snapshot. [Experimental(Diagnostics.Experimental)] public sealed class OpenCanvasInstance { /// Provider-local canvas identifier. [JsonPropertyName("canvasId")] public string CanvasId { get; set; } = string.Empty; /// Owning provider identifier. [JsonPropertyName("extensionId")] public string ExtensionId { get; set; } = string.Empty; /// Owning extension display name, when available. [JsonPropertyName("extensionName")] public string? ExtensionName { get; set; } /// Host-local PNG path for the canvas icon, when supplied. [JsonPropertyName("icon")] public string? Icon { get; set; } /// Input supplied when the instance was opened. [JsonPropertyName("input")] public JsonElement? Input { get; set; } /// Stable caller-supplied canvas instance identifier. [JsonPropertyName("instanceId")] public string InstanceId { get; set; } = string.Empty; /// Provider-supplied status text. [JsonPropertyName("status")] public string? Status { get; set; } /// Rendered title. [JsonPropertyName("title")] public string? Title { get; set; } /// URL for web-rendered canvases. [JsonPropertyName("url")] public string? Url { get; set; } } /// Live open-canvas snapshot. [Experimental(Diagnostics.Experimental)] public sealed class CanvasListOpenResult { /// Currently open canvas instances. [JsonPropertyName("openCanvases")] public IList OpenCanvases { get => field ??= []; set; } } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionCanvasListOpenRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Canvas open parameters. [Experimental(Diagnostics.Experimental)] internal sealed class CanvasOpenRequest { /// Provider-local canvas identifier. [JsonPropertyName("canvasId")] public string CanvasId { get; set; } = string.Empty; /// Owning provider identifier. Optional when the canvasId is unique across providers; required to disambiguate when multiple providers register the same canvasId. [JsonPropertyName("extensionId")] public string? ExtensionId { get; set; } /// Canvas open input. [JsonPropertyName("input")] public JsonElement? Input { get; set; } /// Caller-supplied stable instance identifier. [JsonPropertyName("instanceId")] public string InstanceId { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Canvas close parameters. [Experimental(Diagnostics.Experimental)] internal sealed class CanvasCloseRequest { /// Open canvas instance identifier. [JsonPropertyName("instanceId")] public string InstanceId { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Canvas action invocation result. [Experimental(Diagnostics.Experimental)] public sealed class CanvasActionInvokeResult { /// Provider-supplied action result. [JsonPropertyName("result")] public JsonElement? Result { get; set; } } /// Canvas action invocation parameters. [Experimental(Diagnostics.Experimental)] internal sealed class CanvasActionInvokeRequest { /// Action name to invoke. [JsonPropertyName("actionName")] public string ActionName { get; set; } = string.Empty; /// Action input. [JsonPropertyName("input")] public JsonElement? Input { get; set; } /// Open canvas instance identifier. [JsonPropertyName("instanceId")] public string InstanceId { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Internal canvas provider registration parameters. [Experimental(Diagnostics.Experimental)] internal sealed class CanvasProviderRegisterRequest { /// Canvas contributions supplied by the provider. [JsonPropertyName("canvases")] public IList Canvases { get => field ??= []; set; } /// Connection identifier for callback routing. [JsonPropertyName("connectionId")] public string ConnectionId { get; set; } = string.Empty; /// Provider metadata supplied by the host. [JsonPropertyName("info")] public JsonElement Info { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Internal canvas provider unregistration parameters. [Experimental(Diagnostics.Experimental)] internal sealed class CanvasProviderUnregisterRequest { /// Connection identifier to unregister. [JsonPropertyName("connectionId")] public string ConnectionId { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Machine-readable factory run failure. /// Polymorphic base type discriminated by type. [Experimental(Diagnostics.Experimental)] [JsonPolymorphic( TypeDiscriminatorPropertyName = "type", UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToBaseType)] [JsonDerivedType(typeof(FactoryRunFailureFactoryLimitReached), "factory_limit_reached")] [JsonDerivedType(typeof(FactoryRunFailureFactoryResumeDeclined), "factory_resume_declined")] [JsonDerivedType(typeof(FactoryRunFailureFactoryDurableFailure), "factory_durable_failure")] [JsonDerivedType(typeof(FactoryRunFailureFactoryAccountingIncomplete), "factory_accounting_incomplete")] [JsonDerivedType(typeof(FactoryRunFailureFactoryProviderDisconnected), "factory_provider_disconnected")] public partial class FactoryRunFailure { /// The type discriminator. [JsonPropertyName("type")] public virtual string Type { get; set; } = string.Empty; } /// The factory_limit_reached variant of . [Experimental(Diagnostics.Experimental)] public partial class FactoryRunFailureFactoryLimitReached : FactoryRunFailure { /// [JsonIgnore] public override string Type => "factory_limit_reached"; /// Resource ceiling that stopped the run. [JsonPropertyName("kind")] public required FactoryRunFailureKind Kind { get; set; } /// Factory run identifier. [JsonPropertyName("runId")] public required string RunId { get; set; } /// Suggested larger ceiling when the runtime can derive one safely. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("suggestedValue")] public double? SuggestedValue { get; set; } /// Approved effective ceiling that was reached. [JsonPropertyName("value")] public required double Value { get; set; } } /// The factory_resume_declined variant of . [Experimental(Diagnostics.Experimental)] public partial class FactoryRunFailureFactoryResumeDeclined : FactoryRunFailure { /// [JsonIgnore] public override string Type => "factory_resume_declined"; /// Human-readable reason the resume did not proceed. [JsonPropertyName("reason")] public required string Reason { get; set; } /// Factory run identifier whose changed limits were declined. [JsonPropertyName("runId")] public required string RunId { get; set; } } /// The factory_durable_failure variant of . [Experimental(Diagnostics.Experimental)] public partial class FactoryRunFailureFactoryDurableFailure : FactoryRunFailure { /// [JsonIgnore] public override string Type => "factory_durable_failure"; /// Stable failure code. [JsonPropertyName("code")] public required string Code { get; set; } /// Execution-critical durable operation that failed. [JsonPropertyName("operation")] public required FactoryDurableOperation Operation { get; set; } /// Factory run identifier. [JsonPropertyName("runId")] public required string RunId { get; set; } } /// The run stopped because its usage accounting could not be completed. /// The factory_accounting_incomplete variant of . [Experimental(Diagnostics.Experimental)] public partial class FactoryRunFailureFactoryAccountingIncomplete : FactoryRunFailure { /// [JsonIgnore] public override string Type => "factory_accounting_incomplete"; /// Confirmed usage in nano-AIU, representing the floor of what the run spent. [JsonPropertyName("drainedNanoAiu")] public required long DrainedNanoAiu { get; set; } /// Factory run identifier. [JsonPropertyName("runId")] public required string RunId { get; set; } } /// The extension that owns the factory disconnected while the run was executing, so the host halted it. The run's journaled subagent results are preserved so a resume can reuse them. /// The factory_provider_disconnected variant of . [Experimental(Diagnostics.Experimental)] public partial class FactoryRunFailureFactoryProviderDisconnected : FactoryRunFailure { /// [JsonIgnore] public override string Type => "factory_provider_disconnected"; /// Factory run identifier. [JsonPropertyName("runId")] public required string RunId { get; set; } } /// Durable metadata describing who initiated a factory pause. /// Polymorphic base type discriminated by type. [Experimental(Diagnostics.Experimental)] [JsonPolymorphic( TypeDiscriminatorPropertyName = "type", UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToBaseType)] [JsonDerivedType(typeof(FactoryPauseInfoUser), "user")] [JsonDerivedType(typeof(FactoryPauseInfoCheckpoint), "checkpoint")] public partial class FactoryPauseInfo { /// The type discriminator. [JsonPropertyName("type")] public virtual string Type { get; set; } = string.Empty; } /// The user variant of . [Experimental(Diagnostics.Experimental)] public partial class FactoryPauseInfoUser : FactoryPauseInfo { /// [JsonIgnore] public override string Type => "user"; } /// The checkpoint variant of . [Experimental(Diagnostics.Experimental)] public partial class FactoryPauseInfoCheckpoint : FactoryPauseInfo { /// [JsonIgnore] public override string Type => "checkpoint"; /// Stable author-defined checkpoint key that initiated the pause. [JsonPropertyName("key")] public required string Key { get; set; } } /// Complete current or terminal factory run envelope. [Experimental(Diagnostics.Experimental)] public sealed class FactoryRunResult { /// One-based execution attempt represented by this envelope. Absent before the first attempt starts or when returned by an older runtime. [JsonPropertyName("attempt")] public long? Attempt { get; set; } /// Error message for an errored run. [JsonPropertyName("error")] public string? Error { get; set; } /// Machine-readable failure details for a halted or errored run. [JsonPropertyName("failure")] public FactoryRunFailure? Failure { get; set; } /// Structured pause initiator metadata for a paused attempt. [JsonPropertyName("pauseInfo")] public FactoryPauseInfo? PauseInfo { get; set; } /// Reason for a halted or cancelled run. [JsonPropertyName("reason")] public string? Reason { get; set; } /// Completed factory result. [JsonPropertyName("result")] public JsonElement? Result { get; set; } /// Factory run identifier. [JsonPropertyName("runId")] public string RunId { get; set; } = string.Empty; /// Partial journal and progress snapshot for a halted, cancelled, or errored run. [JsonPropertyName("snapshot")] public JsonElement? Snapshot { get; set; } /// Current or terminal factory run status. [JsonPropertyName("status")] public FactoryRunStatus Status { get; set; } } /// Wire-only per-invocation factory resource ceiling overrides. [Experimental(Diagnostics.Experimental)] public sealed class FactoryRunLimits { /// Maximum AI credits consumed by factory subagents and their descendants. The post-paid ceiling is soft: parallel turns can settle beyond it before the run stops. [JsonPropertyName("maxAiCredits")] public double? MaxAiCredits { get; set; } /// Maximum number of factory subagents that may run concurrently. [JsonPropertyName("maxConcurrentSubagents")] public long? MaxConcurrentSubagents { get; set; } /// Maximum total number of factory subagents that may be admitted. [JsonPropertyName("maxTotalSubagents")] public long? MaxTotalSubagents { get; set; } /// Maximum accumulated active-execution time in seconds. Active execution includes the entire extension body, subprocess waits, queued-agent waits, and sleeps; time between resumed attempts is not counted. [JsonPropertyName("timeoutSeconds")] public double? TimeoutSeconds { get; set; } } /// Options controlling factory invocation. [Experimental(Diagnostics.Experimental)] public sealed class RunOptions { /// Per-invocation resource ceiling overrides. [JsonPropertyName("limits")] public FactoryRunLimits? Limits { get; set; } /// Whether to emit factory phase names to the session transcript. [JsonPropertyName("logPhaseNames")] public bool? LogPhaseNames { get; set; } /// Whether to notify the originating session when the factory completes. [JsonPropertyName("notifyOnComplete")] public bool? NotifyOnComplete { get; set; } /// Run identifier whose journal and progress should seed this resumed run. [JsonPropertyName("resumeFromRunId")] public string? ResumeFromRunId { get; set; } } /// Parameters for invoking a registered factory. [Experimental(Diagnostics.Experimental)] internal sealed class FactoryRunRequest { /// Factory input value. [JsonPropertyName("args")] public JsonElement Args { get; set; } /// Registered factory name. [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; /// Factory invocation options. [JsonPropertyName("options")] public RunOptions? Options { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Resolved persisted factory identity and resumed run envelope. [Experimental(Diagnostics.Experimental)] public sealed class FactoryResumeResult { /// Persisted factory name resolved for the resumed run. [JsonPropertyName("factoryName")] public string FactoryName { get; set; } = string.Empty; /// Terminal resumed run envelope. [JsonPropertyName("run")] public FactoryRunResult Run { get => field ??= new(); set; } } /// Parameters for resuming a factory run from its persisted identity. [Experimental(Diagnostics.Experimental)] internal sealed class FactoryResumeRequest { /// Optional per-invocation resource ceiling overrides. [JsonPropertyName("limits")] public FactoryRunLimits? Limits { get; set; } /// Whether to emit factory phase names to the session transcript. [JsonPropertyName("logPhaseNames")] public bool? LogPhaseNames { get; set; } /// Whether to notify the originating session when the factory completes. [JsonPropertyName("notifyOnComplete")] public bool? NotifyOnComplete { get; set; } /// Factory run identifier. [JsonPropertyName("runId")] public string RunId { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Options for an internal tool-originated factory invocation. [Experimental(Diagnostics.Experimental)] internal sealed class FactoryToolRunOptions { /// Per-invocation resource ceiling overrides. [JsonPropertyName("limits")] public FactoryRunLimits? Limits { get; set; } /// Run identifier whose journal and progress should seed this resumed run. [JsonPropertyName("resumeFromRunId")] public string? ResumeFromRunId { get; set; } } /// Internal parameters for invoking a registered factory from a tool. [Experimental(Diagnostics.Experimental)] internal sealed class FactoryToolRunRequest { /// Factory input value. [JsonPropertyName("args")] public JsonElement Args { get; set; } /// Registered factory name. [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; /// Tool-originated factory invocation options. [JsonPropertyName("options")] public FactoryToolRunOptions? Options { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; /// Opaque identifier of the originating tool call. [JsonPropertyName("toolCallId")] public string? ToolCallId { get; set; } } /// Internal parameters for resuming a factory run from a tool. [Experimental(Diagnostics.Experimental)] internal sealed class FactoryToolResumeRequest { /// Optional per-invocation resource ceiling overrides. [JsonPropertyName("limits")] public FactoryRunLimits? Limits { get; set; } /// Factory run identifier. [JsonPropertyName("runId")] public string RunId { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; /// Opaque identifier of the originating tool call. [JsonPropertyName("toolCallId")] public string? ToolCallId { get; set; } } /// Parameters for retrieving a factory run. [Experimental(Diagnostics.Experimental)] internal sealed class FactoryGetRunRequest { /// Factory run identifier. [JsonPropertyName("runId")] public string RunId { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Declared or approved factory resource ceilings. [Experimental(Diagnostics.Experimental)] public sealed class FactoryDeclaredLimits { /// Maximum AI credits consumed by subagents and descendants. [JsonPropertyName("maxAiCredits")] public double? MaxAiCredits { get; set; } /// Maximum concurrently active subagents. [JsonPropertyName("maxConcurrentSubagents")] public long? MaxConcurrentSubagents { get; set; } /// Maximum total subagents spawned by the run. [JsonPropertyName("maxTotalSubagents")] public long? MaxTotalSubagents { get; set; } /// Maximum accumulated active execution time in seconds. [JsonPropertyName("timeoutSeconds")] public double? TimeoutSeconds { get; set; } } /// Durable factory resource consumption. [Experimental(Diagnostics.Experimental)] public sealed class FactoryRunConsumed { /// Accumulated active execution time in milliseconds. [JsonPropertyName("activeMs")] public long ActiveMs { get; set; } /// AI usage consumed by the run in nano-AIU. [JsonPropertyName("nanoAiu")] public long NanoAiu { get; set; } /// Total subagents spawned by the run. [JsonPropertyName("subagents")] public long Subagents { get; set; } } /// Current factory phase identity. [Experimental(Diagnostics.Experimental)] public sealed class FactoryCurrentPhase { /// Current phase identifier. [JsonPropertyName("id")] public string Id { get; set; } = string.Empty; /// Zero-based declared phase ordinal, or null for an undeclared phase. [JsonPropertyName("ordinal")] public long? Ordinal { get; set; } } /// Prompt-safe terminal factory outcome. [Experimental(Diagnostics.Experimental)] public sealed class FactoryRunTerminal { /// Human-readable terminal error. [JsonPropertyName("error")] public string? Error { get; set; } /// Machine-readable terminal failure. [JsonPropertyName("failure")] public FactoryRunFailure? Failure { get; set; } /// Pause initiator metadata, or null when the run did not pause. [JsonPropertyName("pauseInfo")] public FactoryPauseInfo? PauseInfo { get; set; } /// Human-readable terminal reason. [JsonPropertyName("reason")] public string? Reason { get; set; } /// Prompt-safe preview of the completed result. [JsonPropertyName("resultPreview")] public string? ResultPreview { get; set; } } /// Durable factory run summary with read-time live overlays. [Experimental(Diagnostics.Experimental)] public sealed class FactoryRunSummary { /// Epoch milliseconds when the current active segment started, or null while inactive. [JsonPropertyName("activeSegmentStartedAt")] public long? ActiveSegmentStartedAt { get; set; } /// Approved effective resource ceilings, or null until approved. [JsonPropertyName("approved")] public FactoryDeclaredLimits? Approved { get; set; } /// Whether the durable run state currently passes runtime resume eligibility checks. [JsonPropertyName("canResume")] public bool CanResume { get; set; } /// Epoch milliseconds when the run completed, or null while nonterminal. [JsonPropertyName("completedAt")] public long? CompletedAt { get; set; } /// Durable resource consumption. [JsonPropertyName("consumed")] public FactoryRunConsumed Consumed { get => field ??= new(); set; } /// Epoch milliseconds when the run was created. [JsonPropertyName("createdAt")] public long CreatedAt { get; set; } /// Current phase identity, or null before any phase is entered. [JsonPropertyName("currentPhase")] public FactoryCurrentPhase? CurrentPhase { get; set; } /// Resource ceilings declared by the factory. [JsonPropertyName("declaredLimits")] public FactoryDeclaredLimits DeclaredLimits { get => field ??= new(); set; } /// Number of phases declared by the factory. [JsonPropertyName("declaredPhaseCount")] public long DeclaredPhaseCount { get; set; } /// Human-readable factory description. [JsonPropertyName("description")] public string Description { get; set; } = string.Empty; /// Registered factory name. [JsonPropertyName("factoryName")] public string FactoryName { get; set; } = string.Empty; /// Number of direct factory agents currently live. [JsonPropertyName("liveAgentCount")] public long LiveAgentCount { get; set; } /// Epoch milliseconds when this live-overlay snapshot was observed. [JsonPropertyName("observedAt")] public long ObservedAt { get; set; } /// Monotonic durable run revision. [JsonPropertyName("revision")] public long Revision { get; set; } /// Factory run identifier. [JsonPropertyName("runId")] public string RunId { get; set; } = string.Empty; /// Epoch milliseconds when execution first started, or null before start. [JsonPropertyName("startedAt")] public long? StartedAt { get; set; } /// Current factory run status. [JsonPropertyName("status")] public FactoryRunStatus Status { get; set; } /// Terminal run outcome, or null while nonterminal. [JsonPropertyName("terminal")] public FactoryRunTerminal? Terminal { get; set; } /// Total direct factory agents spawned across all attempts. [JsonPropertyName("totalSpawnedAgentCount")] public long TotalSpawnedAgentCount { get; set; } /// Epoch milliseconds when the durable run was last updated. [JsonPropertyName("updatedAt")] public long UpdatedAt { get; set; } } /// A page of factory runs in durable creation order. [Experimental(Diagnostics.Experimental)] public sealed class FactoryListRunsResult { /// Whether terminal runs newer than this page exist. [JsonPropertyName("hasMoreNewer")] public bool? HasMoreNewer { get; set; } /// Newest terminal-run cursor in this page, or null when the terminal window is empty. [JsonPropertyName("newestSeq")] public long? NewestSeq { get; set; } /// Oldest terminal-run cursor in this page, or null when the terminal window is empty. [JsonPropertyName("oldestSeq")] public long? OldestSeq { get; set; } /// Number of terminal runs older than this page. [JsonPropertyName("omittedOlder")] public long? OmittedOlder { get; set; } /// Factory run summaries in durable creation order. [JsonPropertyName("runs")] public IList Runs { get => field ??= []; set; } } /// Parameters for paging factory runs. [Experimental(Diagnostics.Experimental)] internal sealed class FactoryListRunsRequest { /// Exclusive forward cursor. [JsonPropertyName("afterSeq")] public long? AfterSeq { get; set; } /// Exclusive backward cursor. [JsonPropertyName("beforeSeq")] public long? BeforeSeq { get; set; } /// Maximum terminal runs to return. Defaults to 200 and is capped at 500. [JsonPropertyName("limit")] public int? Limit { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Prompt-safe durable identity and live status for a direct factory agent. [Experimental(Diagnostics.Experimental)] public sealed class FactoryAgentSummary { /// Accumulated active agent time in milliseconds. [JsonPropertyName("activeMs")] public long ActiveMs { get; set; } /// Prompt-safe live activity text. [JsonPropertyName("activity")] public string? Activity { get; set; } /// Stable direct-agent identifier. [JsonPropertyName("agentId")] public string AgentId { get; set; } = string.Empty; /// Registered agent type. [JsonPropertyName("agentType")] public string AgentType { get; set; } = string.Empty; /// Epoch milliseconds when the agent completed. [JsonPropertyName("completedAt")] public long? CompletedAt { get; set; } /// Friendly, non-unique name intended for display. [JsonPropertyName("displayName")] public string? DisplayName { get; set; } /// Friendly, non-unique name intended for display. [JsonPropertyName("label")] public string Label { get; set; } = string.Empty; /// Phase identifier active when the agent was launched, or null. [JsonPropertyName("phaseId")] public string? PhaseId { get; set; } /// Model requested when the agent was launched. [JsonPropertyName("requestedModel")] public string? RequestedModel { get; set; } /// Concrete model resolved for the agent. [JsonPropertyName("resolvedModel")] public string? ResolvedModel { get; set; } /// Owning factory run identifier. [JsonPropertyName("runId")] public string RunId { get; set; } = string.Empty; /// Epoch milliseconds when the agent started. [JsonPropertyName("startedAt")] public long? StartedAt { get; set; } /// Current durable or live agent status. [JsonPropertyName("status")] public string Status { get; set; } = string.Empty; /// Tool-call identifier that launched the agent. [JsonPropertyName("toolCallId")] public string ToolCallId { get; set; } = string.Empty; } /// Durable lifecycle and timing for one factory phase. [Experimental(Diagnostics.Experimental)] public sealed class FactoryPhaseObservation { /// Completed active time accumulated by this phase in milliseconds. [JsonPropertyName("accumulatedActiveMs")] public long AccumulatedActiveMs { get; set; } /// Epoch milliseconds when this phase completed; for a skipped phase, the synthetic skip timestamp (equal to `startedAt`). [JsonPropertyName("completedAt")] public long? CompletedAt { get; set; } /// Current live active time for this phase in milliseconds. [JsonPropertyName("currentActiveMs")] public long CurrentActiveMs { get; set; } /// Optional human-readable phase detail. [JsonPropertyName("detail")] public string? Detail { get; set; } /// Number of times execution entered this phase. [JsonPropertyName("entryCount")] public long EntryCount { get; set; } /// Phase identifier. [JsonPropertyName("id")] public string Id { get; set; } = string.Empty; /// Most recent run attempt that entered this phase, or `0` if the phase has never been entered. [JsonPropertyName("lastEnteredRunAttempt")] public long LastEnteredRunAttempt { get; set; } /// Direct agents in this phase that are currently live. [JsonPropertyName("liveAgentCount")] public long LiveAgentCount { get; set; } /// Zero-based declared phase ordinal, or null for an undeclared phase. [JsonPropertyName("ordinal")] public long? Ordinal { get; set; } /// Epoch milliseconds when this phase first started; for a skipped phase, the synthetic skip timestamp (equal to `completedAt`). [JsonPropertyName("startedAt")] public long? StartedAt { get; set; } /// Derived lifecycle state of the phase. [JsonPropertyName("status")] public FactoryPhaseStatus Status { get; set; } /// Human-readable phase title. [JsonPropertyName("title")] public string Title { get; set; } = string.Empty; /// Total direct agents associated with this phase. [JsonPropertyName("totalAgentCount")] public long TotalAgentCount { get; set; } } /// One durable factory progress record. [Experimental(Diagnostics.Experimental)] public sealed class FactoryProgressLine { /// Resume attempt that emitted this record. [JsonPropertyName("attempt")] public long Attempt { get; set; } /// Progress record kind. [JsonPropertyName("kind")] public FactoryLogLineKind Kind { get; set; } /// Phase active when the record was emitted, or null before any phase. [JsonPropertyName("phaseId")] public string? PhaseId { get; set; } /// Epoch milliseconds when the record was persisted. [JsonPropertyName("recordedAt")] public long RecordedAt { get; set; } /// Global monotonic sequence number within the run. [JsonPropertyName("seq")] public long Seq { get; set; } /// Prompt-safe progress text. [JsonPropertyName("text")] public string Text { get; set; } = string.Empty; } /// A bidirectional page of factory progress. [Experimental(Diagnostics.Experimental)] public sealed class FactoryProgressPage { /// Whether progress records newer than this page exist. [JsonPropertyName("hasMoreNewer")] public bool HasMoreNewer { get; set; } /// Whether progress records older than this page exist. [JsonPropertyName("hasMoreOlder")] public bool HasMoreOlder { get; set; } /// Newest sequence number in this page, or null when empty. [JsonPropertyName("newestSeq")] public long? NewestSeq { get; set; } /// Oldest sequence number in this page, or null when empty. [JsonPropertyName("oldestSeq")] public long? OldestSeq { get; set; } /// Progress records in sequence order. [JsonPropertyName("records")] public IList Records { get => field ??= []; set; } /// Run revision reflected by this page. [JsonPropertyName("revision")] public long Revision { get; set; } } /// Full factory run observability detail. [Experimental(Diagnostics.Experimental)] public sealed class FactoryRunDetail { /// Epoch milliseconds when the current active segment started, or null while inactive. [JsonPropertyName("activeSegmentStartedAt")] public long? ActiveSegmentStartedAt { get; set; } /// Durable identities and live statuses for direct factory agents. [JsonPropertyName("agents")] public IList Agents { get => field ??= []; set; } /// Approved effective resource ceilings, or null until approved. [JsonPropertyName("approved")] public FactoryDeclaredLimits? Approved { get; set; } /// Whether the durable run state currently passes runtime resume eligibility checks. [JsonPropertyName("canResume")] public bool CanResume { get; set; } /// Epoch milliseconds when the run completed, or null while nonterminal. [JsonPropertyName("completedAt")] public long? CompletedAt { get; set; } /// Durable resource consumption. [JsonPropertyName("consumed")] public FactoryRunConsumed Consumed { get => field ??= new(); set; } /// Epoch milliseconds when the run was created. [JsonPropertyName("createdAt")] public long CreatedAt { get; set; } /// Current phase identity, or null before any phase is entered. [JsonPropertyName("currentPhase")] public FactoryCurrentPhase? CurrentPhase { get; set; } /// Resource ceilings declared by the factory. [JsonPropertyName("declaredLimits")] public FactoryDeclaredLimits DeclaredLimits { get => field ??= new(); set; } /// Number of phases declared by the factory. [JsonPropertyName("declaredPhaseCount")] public long DeclaredPhaseCount { get; set; } /// Human-readable factory description. [JsonPropertyName("description")] public string Description { get; set; } = string.Empty; /// Registered factory name. [JsonPropertyName("factoryName")] public string FactoryName { get; set; } = string.Empty; /// Number of direct factory agents currently live. [JsonPropertyName("liveAgentCount")] public long LiveAgentCount { get; set; } /// Epoch milliseconds when this live-overlay snapshot was observed. [JsonPropertyName("observedAt")] public long ObservedAt { get; set; } /// Lifecycle and timing observations for each factory phase. [JsonPropertyName("phases")] public IList Phases { get => field ??= []; set; } /// Bidirectional page of durable factory progress. [JsonPropertyName("progress")] public FactoryProgressPage Progress { get => field ??= new(); set; } /// Monotonic durable run revision. [JsonPropertyName("revision")] public long Revision { get; set; } /// Factory run identifier. [JsonPropertyName("runId")] public string RunId { get; set; } = string.Empty; /// Epoch milliseconds when execution first started, or null before start. [JsonPropertyName("startedAt")] public long? StartedAt { get; set; } /// Current factory run status. [JsonPropertyName("status")] public FactoryRunStatus Status { get; set; } /// Terminal run outcome, or null while nonterminal. [JsonPropertyName("terminal")] public FactoryRunTerminal? Terminal { get; set; } /// Total direct factory agents spawned across all attempts. [JsonPropertyName("totalSpawnedAgentCount")] public long TotalSpawnedAgentCount { get; set; } /// Epoch milliseconds when the durable run was last updated. [JsonPropertyName("updatedAt")] public long UpdatedAt { get; set; } } /// Parameters for paging factory progress. [Experimental(Diagnostics.Experimental)] internal sealed class FactoryGetRunProgressRequest { /// Exclusive forward cursor. [JsonPropertyName("afterSeq")] public long? AfterSeq { get; set; } /// Exclusive backward cursor. [JsonPropertyName("beforeSeq")] public long? BeforeSeq { get; set; } /// Maximum records to return. Defaults to 200 and is capped at 500. [JsonPropertyName("limit")] public int? Limit { get; set; } /// Optional phase identifier used to scope records and cursors. [JsonPropertyName("phaseId")] public string? PhaseId { get; set; } /// Factory run identifier. [JsonPropertyName("runId")] public string RunId { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Parameters for cancelling a factory run. [Experimental(Diagnostics.Experimental)] internal sealed class FactoryCancelRequest { /// Factory run identifier. [JsonPropertyName("runId")] public string RunId { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Parameters for pausing a running factory. [Experimental(Diagnostics.Experimental)] internal sealed class FactoryPauseRequest { /// Factory run identifier. [JsonPropertyName("runId")] public string RunId { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// RPC data type for SessionFactoryPauseAtCheckpoint operations. [Experimental(Diagnostics.Experimental)] internal sealed class SessionFactoryPauseAtCheckpointResult { /// Whether this execution attempt must pause or may continue. [JsonPropertyName("action")] public FactoryPauseCheckpointAction Action { get; set; } } /// Parameters for an owned durable pause checkpoint. [Experimental(Diagnostics.Experimental)] internal sealed class FactoryPauseCheckpointRequest { /// Opaque token identifying the execution attempt that reached the checkpoint. [JsonPropertyName("executionToken")] public string ExecutionToken { get; set; } = string.Empty; /// Stable author-defined checkpoint key. [JsonPropertyName("key")] public string Key { get; set; } = string.Empty; /// Factory run identifier. [JsonPropertyName("runId")] public string RunId { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Acknowledgement that a factory request was accepted. [Experimental(Diagnostics.Experimental)] public sealed class FactoryAckResult { } /// One ordered factory progress line. [Experimental(Diagnostics.Experimental)] public sealed class FactoryLogLine { /// Progress line kind. [JsonPropertyName("kind")] public FactoryLogLineKind Kind { get; set; } /// Monotonic sequence number within the factory run. [JsonPropertyName("seq")] public long Seq { get; set; } /// Progress text. [JsonPropertyName("text")] public string Text { get; set; } = string.Empty; } /// Parameters for recording factory progress. [Experimental(Diagnostics.Experimental)] internal sealed class FactoryLogRequest { /// Opaque token identifying the current factory execution attempt. [JsonPropertyName("executionToken")] public string ExecutionToken { get; set; } = string.Empty; /// Ordered progress lines to append. [JsonPropertyName("lines")] public IList Lines { get => field ??= []; set; } /// Factory run identifier. [JsonPropertyName("runId")] public string RunId { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Result of one factory-scoped subagent call. [Experimental(Diagnostics.Experimental)] public sealed class FactoryAgentResult { /// Agent result, omitted when the agent produced no result. [JsonPropertyName("result")] public JsonElement? Result { get; set; } } /// Options for one factory-scoped subagent call. [Experimental(Diagnostics.Experimental)] public sealed class FactoryAgentOptions { /// Optional built-in or custom agent name whose definition configures the subagent. [JsonPropertyName("agent")] public string? Agent { get; set; } /// Optional context tier override for the subagent. [JsonPropertyName("contextTier")] public ContextTier? ContextTier { get; set; } /// Optional label distinguishing otherwise identical memoized agent calls. [JsonPropertyName("label")] public string? Label { get; set; } /// Optional model identifier for the subagent. [JsonPropertyName("model")] public string? Model { get; set; } /// Optional reasoning effort override for the subagent. [JsonPropertyName("reasoningEffort")] public string? ReasoningEffort { get; set; } /// Optional JSON Schema for structured agent output. [JsonPropertyName("schema")] public JsonElement? Schema { get; set; } } /// Parameters for one factory-scoped subagent call. [Experimental(Diagnostics.Experimental)] internal sealed class FactoryAgentRequest { /// Opaque token identifying the current factory execution attempt. [JsonPropertyName("executionToken")] public string ExecutionToken { get; set; } = string.Empty; /// Factory run identifier that owns the subagent. [JsonPropertyName("factoryRunId")] public string FactoryRunId { get; set; } = string.Empty; /// Subagent execution options. [JsonPropertyName("opts")] public FactoryAgentOptions Opts { get => field ??= new(); set; } /// Prompt to send to the subagent. [JsonPropertyName("prompt")] public string Prompt { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Result of reading a factory journal entry. [Experimental(Diagnostics.Experimental)] public sealed class FactoryJournalGetResult { /// Whether the journal contained the requested key. [JsonPropertyName("hit")] public bool Hit { get; set; } /// Cached JSON result. The hit field distinguishes a cached JSON null from a miss. [JsonPropertyName("resultJson")] public JsonElement? ResultJson { get; set; } } /// Parameters for reading a factory journal entry. [Experimental(Diagnostics.Experimental)] internal sealed class FactoryJournalGetRequest { /// Opaque token identifying the current factory execution attempt. [JsonPropertyName("executionToken")] public string ExecutionToken { get; set; } = string.Empty; /// Namespaced journal key. [JsonPropertyName("key")] public string Key { get; set; } = string.Empty; /// Factory run identifier. [JsonPropertyName("runId")] public string RunId { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Parameters for storing a factory journal entry. [Experimental(Diagnostics.Experimental)] internal sealed class FactoryJournalPutRequest { /// Opaque token identifying the current factory execution attempt. [JsonPropertyName("executionToken")] public string ExecutionToken { get; set; } = string.Empty; /// Namespaced journal key. [JsonPropertyName("key")] public string Key { get; set; } = string.Empty; /// JSON result to memoize. [JsonPropertyName("resultJson")] public JsonElement ResultJson { get; set; } /// Factory run identifier. [JsonPropertyName("runId")] public string RunId { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// The session's authoritative model snapshot. Auto preference fields are configuration for the virtual `auto` model and do not change the selected model identifier. The context tier reflects `Session.getContextTier()`, restored from the session journal on resume. [Experimental(Diagnostics.Experimental)] public sealed class CurrentModel { /// Auto preference currently claimed by an in-progress activation. Null means the activation is returning to provider-default routing. [JsonPropertyName("activatingAutoTier")] public AutoTier? ActivatingAutoTier { get; set; } /// Auto preference currently committed for the session. This can remain available while another model is selected so a later switch to `auto` can reuse it. [JsonPropertyName("autoTier")] public AutoTier? AutoTier { get; set; } /// Context tier for models that support multiple context-window sizes. [JsonPropertyName("contextTier")] public ContextTier? ContextTier { get; set; } /// Currently active model identifier. [JsonPropertyName("modelId")] public string? ModelId { get; set; } /// Latest unclaimed Auto preference waiting for a future user turn. Null means the pending request is returning to provider-default routing. [JsonPropertyName("pendingAutoTier")] public AutoTier? PendingAutoTier { 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; } /// RPC data type for ModelSwitchConfirmation operations. [Experimental(Diagnostics.Experimental)] public sealed class ModelSwitchConfirmation { /// Current conversation token count before switching models. [JsonPropertyName("currentTokens")] public double CurrentTokens { get; set; } /// Target model token limit used by the compaction preflight. [JsonPropertyName("targetLimit")] public double TargetLimit { get; set; } /// Display name of the model that requires compaction confirmation. [JsonPropertyName("targetModelDisplayName")] public string TargetModelDisplayName { get; set; } = string.Empty; } /// The model identifier active on the session after the switch. [Experimental(Diagnostics.Experimental)] public sealed class ModelSwitchToResult { /// Compaction confirmation projection when status is confirmation_required. [JsonPropertyName("confirmation")] public ModelSwitchConfirmation? Confirmation { get; set; } /// True when the switch was deferred (enqueued as a cancellable `/model` command) because a turn was active or another model change was already queued, rather than applied immediately. When true, the session's live model is unchanged until the queued change drains. [JsonPropertyName("deferred")] public bool? Deferred { get; set; } /// Deprecation warnings associated with the selected model or options. [JsonPropertyName("deprecationWarnings")] public IList? DeprecationWarnings { get; set; } /// User-facing outcome message for the model switch. [JsonPropertyName("message")] public string? Message { get; set; } /// Currently active model identifier after the switch. [JsonPropertyName("modelId")] public string? ModelId { get; set; } /// Authoritative model and Auto preference state after an immediate switch. For deferred switches this remains the current state until the queued change drains. [JsonPropertyName("modelState")] public CurrentModel? ModelState { get; set; } /// Persistence failure encountered after applying the model switch. [JsonPropertyName("persistenceError")] public string? PersistenceError { get; set; } /// Lifecycle result for the requested switch. [JsonPropertyName("status")] public string? Status { get; set; } /// User-facing warning produced while applying the model switch. [JsonPropertyName("warning")] public string? Warning { 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 { /// Resolved Anthropic adaptive-thinking capability — unsupported / optional / required. 'required' models reject thinking.type='enabled' with HTTP 400 (e.g. opus-4.7/4.8). [JsonPropertyName("adaptive_thinking")] public AdaptiveThinkingSupport? AdaptiveThinking { get; set; } /// 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; } } /// Optional capability overrides (vision, tool_calls, reasoning, etc.). [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; } } /// Environment variables consulted while resolving model-picker settings. public sealed class ModelPickerSettingsContextEnvironment { } /// Filesystem and environment context used to resolve model-picker settings. [Experimental(Diagnostics.Experimental)] public sealed class ModelPickerSettingsContext { /// Optional Copilot configuration directory containing persisted settings. [JsonPropertyName("configDir")] public string? ConfigDir { get; set; } /// Environment variables consulted while resolving model-picker settings. [JsonPropertyName("environment")] public ModelPickerSettingsContextEnvironment Environment { get => field ??= new(); set; } /// User home directory used when resolving persisted settings. [JsonPropertyName("homeDirectory")] public string HomeDirectory { get; set; } = string.Empty; } /// RPC data type for ModelPickerPersistence operations. [Experimental(Diagnostics.Experimental)] public sealed class ModelPickerPersistenceRequest { /// Whether context tier was explicitly selected and should be persisted. [JsonPropertyName("contextTierExplicit")] public bool? ContextTierExplicit { get; set; } /// Whether reasoning effort was explicitly selected and should be persisted. [JsonPropertyName("reasoningEffortExplicit")] public bool? ReasoningEffortExplicit { get; set; } /// Filesystem and environment context used to resolve settings persistence. [JsonPropertyName("settingsContext")] public ModelPickerSettingsContext SettingsContext { get => field ??= new(); set; } } /// Target model identifier and optional reasoning effort, summary, capability overrides, and context tier. [Experimental(Diagnostics.Experimental)] internal sealed class ModelSwitchToRequest { /// Optional Auto routing preference to stage atomically with selecting `auto`. Pass null to return to provider-default Auto routing. This field is rejected when `modelId` is not `auto`. [JsonPropertyName("autoTier")] public AutoTier? AutoTier { get; set; } /// Explicit response to a model-switch compaction preflight. Omit to request a confirmation projection when compaction is necessary. [JsonPropertyName("compactionDecision")] public string? CompactionDecision { get; set; } /// Explicit context tier for the selected model. `"default"` / `"long_context"` apply the requested tier; omit this field to use normal model behavior with no explicit tier. [JsonPropertyName("contextTier")] public ContextTier? ContextTier { get; set; } /// When true, defer this switch (enqueue it) if another model change is already queued, even when no turn is active — so it drains last (FIFO) and wins over the already-queued change. Intended for genuine user-initiated model selections; internal restore/reapply switches omit it and apply immediately when no turn is active. When no other model change is queued this has no effect (a switch still applies immediately unless a turn is active). [JsonPropertyName("deferIfModelChangeQueued")] public bool? DeferIfModelChangeQueued { get; set; } /// Override individual model capabilities resolved by the runtime. [JsonPropertyName("modelCapabilities")] public ModelCapabilitiesOverride? ModelCapabilities { get; set; } /// Settings scope used when persisting the selected model. [JsonPropertyName("modelChangeScope")] public string? ModelChangeScope { get; set; } /// Model selection id to switch to, as returned by `list`. A bare id (e.g. `claude-sonnet-4.6`) names a Copilot (CAPI) model; a provider-qualified id (`provider/id`, e.g. `acme/claude-sonnet`) targets a registry BYOK model. [JsonPropertyName("modelId")] public string ModelId { get; set; } = string.Empty; /// Optional settings context and explicit-override flags used to persist a picker selection. [JsonPropertyName("pickerPersistence")] public ModelPickerPersistenceRequest? PickerPersistence { get; set; } /// Reasoning effort level to use for the model. CAPI values are model-defined and validated against the selected model; BYOK providers may define additional values. "none" disables reasoning. When omitted, no effort override is applied. [JsonPropertyName("reasoningEffort")] public string? ReasoningEffort { get; set; } /// Reasoning summary mode to request for supported model clients. [JsonPropertyName("reasoningSummary")] public ReasoningSummary? ReasoningSummary { get; set; } /// Optional repository settings scope to persist after the switch commits. [JsonPropertyName("repoScope")] public string? RepoScope { get; set; } /// Require the target to be currently available and enabled before applying the switch. [JsonPropertyName("requireAvailable")] public bool? RequireAvailable { get; set; } /// When true, evaluate context-window compaction policy before applying the switch. [JsonPropertyName("runCompactionPreflight")] public bool? RunCompactionPreflight { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; /// Origin to record on the effective `session.model_change` event for trusted in-process calls. Transport SDK calls are always recorded as `sdk`, regardless of this value. [JsonPropertyName("source")] public ModelChangeSource? Source { get; set; } /// Output verbosity level to request for supported models. [JsonPropertyName("verbosity")] public Verbosity? Verbosity { get; set; } } /// Immediate acknowledgement and Auto preference snapshot after a switch request. This result never implies that a pending preference committed. [Experimental(Diagnostics.Experimental)] public sealed class ModelSwitchAutoTierResult { /// Auto preference currently claimed by an in-progress activation. Null means the activation is returning to provider-default routing. [JsonPropertyName("activatingAutoTier")] public AutoTier? ActivatingAutoTier { get; set; } /// Auto preference currently committed for the session. [JsonPropertyName("effectiveAutoTier")] public AutoTier? EffectiveAutoTier { get; set; } /// Latest unclaimed Auto preference waiting for a future user turn. [JsonPropertyName("pendingAutoTier")] public AutoTier? PendingAutoTier { get; set; } /// Immediate request status. `pending` means accepted but not committed. [JsonPropertyName("status")] public ModelSwitchAutoTierStatus Status { get; set; } /// Earlier unclaimed preference replaced by this request. This can be present with either status, including when selecting the effective preference cancels pending work. [JsonPropertyName("supersededAutoTier")] public AutoTier? SupersededAutoTier { get; set; } } /// An Auto preference request for the session. This updates Auto configuration only; it does not change the selected model to `auto`. [Experimental(Diagnostics.Experimental)] internal sealed class ModelSwitchAutoTierRequest { /// Auto preference to activate when a future user turn using the `auto` model safely mints a replacement model and token pair. Pass null to return to provider-default Auto routing. [JsonPropertyName("autoTier")] [JsonIgnore(Condition = JsonIgnoreCondition.Never)] public AutoTier? AutoTier { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; /// Origin to record on the effective `session.model_change` event. Defaults to `sdk` when omitted. [JsonPropertyName("source")] public ModelChangeSource? Source { get; set; } } /// Managed, repository, and CLI model overrides to overlay onto the session at startup. [Experimental(Diagnostics.Experimental)] internal sealed class ModelApplyStartupOverlayRequest { /// Model explicitly selected by the CLI, when provided. [JsonPropertyName("cliModel")] public string? CliModel { get; set; } /// Whether the overlay is being applied while resuming a deferred session. [JsonPropertyName("deferredResume")] public bool? DeferredResume { get; set; } /// Model required by device-managed policy, when configured. [JsonPropertyName("deviceManagedModel")] public string? DeviceManagedModel { get; set; } /// Startup default model from the enterprise policy helper, when configured. Weakest of the managed sources: it applies only when neither device nor server policy names a model, and an explicit user selection still wins. [JsonPropertyName("policyHelperModel")] public string? PolicyHelperModel { get; set; } /// Context tier selected by repository settings, when configured. [JsonPropertyName("repoContextTier")] public string? RepoContextTier { get; set; } /// Model selected by repository settings, when configured. [JsonPropertyName("repoModel")] public string? RepoModel { get; set; } /// Reasoning effort selected by repository settings, when configured. [JsonPropertyName("repoReasoningEffort")] public string? RepoReasoningEffort { get; set; } /// Model required by server-managed policy, when configured. [JsonPropertyName("serverManagedModel")] public string? ServerManagedModel { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// The applied host allowlist and effective session model policy after intersection. [Experimental(Diagnostics.Experimental)] public sealed class ModelSetAllowedModelsResult { /// Normalized host allowlist. Omitted when the host restriction was cleared, or when a relay client does not return the host policy. [JsonPropertyName("allowedModels")] public IList? AllowedModels { get; set; } /// Effective exact IDs or repository policy patterns after applying the host restriction. Omitted by relay clients that do not return the host policy. [JsonPropertyName("effectiveAllowedModels")] public IList? EffectiveAllowedModels { get; set; } /// Effective deterministic fallback model, when the policy defines one. [JsonPropertyName("fallbackModel")] public string? FallbackModel { get; set; } /// Selected session model after reconciling a now-disallowed concrete selection. [JsonPropertyName("modelId")] public string? ModelId { get; set; } } /// Host-supplied exact model selection IDs to allow for this running session. CAPI IDs are intersected with repository `.github/allowed_models.txt` policy; provider-qualified IDs remain exempt from repository-only policy but are restricted by this host list. Omit or pass null to clear the host restriction; an explicit empty or disjoint list is rejected. Validation and pre-selection fallback failures preserve the previous restriction. Failures after a fallback selection commits retain the new restriction and selected model; callers should inspect current session state after such an error. [Experimental(Diagnostics.Experimental)] internal sealed class ModelSetAllowedModelsRequest { /// Exact model IDs to permit, or null to clear the host restriction. [JsonPropertyName("allowedModels")] public IList? AllowedModels { 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; } /// Cost-category metadata for a CAPI model. [Experimental(Diagnostics.Experimental)] public sealed class SessionModelPriceCategory { /// CAPI model identifier. [JsonPropertyName("id")] public string Id { get; set; } = string.Empty; /// Cost category assigned to the model. [JsonPropertyName("priceCategory")] public ModelPickerPriceCategory PriceCategory { get; set; } } /// The list of models available to this session. [Experimental(Diagnostics.Experimental)] public sealed class SessionModelList { /// Available models, ordered with the most preferred default first. Includes both Copilot (CAPI) models and any registry BYOK models; a BYOK model appears under its provider-qualified selection id (`provider/id`). [JsonPropertyName("list")] public IList List { get => field ??= []; set; } /// Cost categories for the full CAPI catalog, including picker-disabled models that Auto may select. Metadata only; entries absent from `list` are not manually selectable. [JsonPropertyName("modelPriceCategories")] public IList? ModelPriceCategories { get; set; } /// Per-quota snapshots returned alongside the model list, keyed by quota type. [JsonPropertyName("quotaSnapshots")] public IDictionary? QuotaSnapshots { get; set; } } /// RPC data type for SessionModelList operations. [Experimental(Diagnostics.Experimental)] public sealed class SessionModelListRequest { /// If true, bypasses the per-session model list cache and re-fetches from CAPI. [JsonPropertyName("skipCache")] public bool? SkipCache { get; set; } } /// RPC data type for SessionModelListRequestWithSession operations. [Experimental(Diagnostics.Experimental)] internal sealed class SessionModelListRequestWithSession { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; /// If true, bypasses the per-session model list cache and re-fetches from CAPI. [JsonPropertyName("skipCache")] public bool? SkipCache { get; set; } } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionModeGetRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Outcome of a session mode change, including any model switch it triggered and follow-up the host must perform. [Experimental(Diagnostics.Experimental)] public sealed class ModeSetResult { /// Whether the host should arm an interactive continuation after the mode change. [JsonPropertyName("armInteractiveContinuation")] public bool? ArmInteractiveContinuation { get; set; } /// Compaction confirmation required before the mode change can complete. [JsonPropertyName("confirmation")] public ModelSwitchConfirmation? Confirmation { get; set; } /// Whether the host must defer implementing the requested mode change. [JsonPropertyName("deferImplementation")] public bool? DeferImplementation { get; set; } /// Deprecation warnings associated with the model selected by the mode change. [JsonPropertyName("deprecationWarnings")] public IList? DeprecationWarnings { get; set; } /// User-facing outcome message for the model switch triggered by the mode change. [JsonPropertyName("message")] public string? Message { get; set; } /// Whether applying the mode changed the active model. [JsonPropertyName("modelChanged")] public bool ModelChanged { get; set; } /// Lifecycle status of the requested mode change. [JsonPropertyName("status")] public string Status { get; set; } = string.Empty; /// User-facing warning produced while applying the mode change. [JsonPropertyName("warning")] public string? Warning { get; set; } } /// Agent interaction mode to apply to the session. [Experimental(Diagnostics.Experimental)] internal sealed class ModeSetRequest { /// Explicit response to a model-switch compaction preflight. [JsonPropertyName("compactionDecision")] public string? CompactionDecision { get; set; } /// Session whose plan-mode base state should be inherited. [JsonPropertyName("inheritPlanBaseFromSessionId")] public string? InheritPlanBaseFromSessionId { get; set; } /// The session mode the agent is operating in. [JsonPropertyName("mode")] public SessionMode Mode { get; set; } /// Whether the selected plan model should be persisted. [JsonPropertyName("persistPlanSelection")] public bool? PersistPlanSelection { get; set; } /// Settings context used when persisting the selected plan model. [JsonPropertyName("pickerSettingsContext")] public ModelPickerSettingsContext? PickerSettingsContext { get; set; } /// Context tier to use with the dedicated plan model. [JsonPropertyName("planContextTier")] public string? PlanContextTier { get; set; } /// Action to perform when leaving plan mode. [JsonPropertyName("planExitAction")] public string? PlanExitAction { get; set; } /// Dedicated model to use in plan mode, when configured. [JsonPropertyName("planModel")] public string? PlanModel { get; set; } /// Whether a dedicated plan model is configured. [JsonPropertyName("planModelConfigured")] public bool? PlanModelConfigured { get; set; } /// Reasoning effort to use with the dedicated plan model. [JsonPropertyName("planReasoningEffort")] public string? PlanReasoningEffort { get; set; } /// Whether leaving plan mode should restore the session's previous model. [JsonPropertyName("restorePlanModel")] public bool? RestorePlanModel { 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; } /// A single todo row read from the session SQL `todos` table. All fields are optional because the SQL schema is best-effort and the agent may not have populated every column. [Experimental(Diagnostics.Experimental)] public sealed class PlanSqlTodosRow { /// Todo creation time, as stored by the session SQL schema's `datetime('now')` default: `YYYY-MM-DD HH:MM:SS` in UTC. Lets clients attribute todos to the work item that created them (e.g. scoping a goal's progress to the todos it produced) rather than to the whole session. [JsonPropertyName("createdAt")] public string? CreatedAt { get; set; } /// Todo description. [JsonPropertyName("description")] public string? Description { get; set; } /// Todo identifier. [JsonPropertyName("id")] public string? Id { get; set; } /// Todo status. [JsonPropertyName("status")] public string? Status { get; set; } /// Todo title. [JsonPropertyName("title")] public string? Title { get; set; } } /// Todo rows read from the session SQL database. Empty when no session database is available. [Experimental(Diagnostics.Experimental)] public sealed class PlanReadSqlTodosResult { /// Rows from the session SQL todos table, ordered by creation time with insertion order used to break ties when available and id used for WITHOUT ROWID tables. [JsonPropertyName("rows")] public IList Rows { get => field ??= []; set; } } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionPlanReadSqlTodosRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// A single dependency edge read from the session SQL `todo_deps` table, indicating that one todo must complete before another. [Experimental(Diagnostics.Experimental)] public sealed class PlanSqlTodoDependency { /// ID of the todo it depends on. [JsonPropertyName("dependsOn")] public string DependsOn { get; set; } = string.Empty; /// ID of the todo that has the dependency. [JsonPropertyName("todoId")] public string TodoId { get; set; } = string.Empty; } /// Todo rows + dependency edges read from the session SQL database. [Experimental(Diagnostics.Experimental)] public sealed class PlanReadSqlTodosWithDependenciesResult { /// Edges from the session SQL todo_deps table. Empty when no database, no todo_deps table, or the SELECT failed. Read independently from `rows`, so a broken todo_deps table does not affect the rows result and vice versa. [JsonPropertyName("dependencies")] public IList Dependencies { get => field ??= []; set; } /// Rows from the session SQL todos table, ordered by creation time with insertion order used to break ties when available and id used for WITHOUT ROWID tables. Empty when no database, no todos table, or the SELECT failed. [JsonPropertyName("rows")] public IList Rows { get => field ??= []; set; } } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionPlanReadSqlTodosWithDependenciesRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// RPC data type for WorkspacesGetWorkspaceResultWorkspace operations. public sealed class WorkspacesGetWorkspaceResultWorkspace { /// Current Git branch. [JsonPropertyName("branch")] public string? Branch { get; set; } /// Whether the per-session Chronicle upgrade prompt was dismissed for the workspace. [JsonPropertyName("chronicle_sync_dismissed")] public bool? ChronicleSyncDismissed { get; set; } /// Name of the client that created the workspace. [JsonPropertyName("client_name")] public string? ClientName { get; set; } /// Timestamp when the workspace was created. [JsonPropertyName("created_at")] public DateTimeOffset? CreatedAt { get; set; } /// Current working directory associated with the workspace. [JsonPropertyName("cwd")] public string? Cwd { get; set; } /// Git repository root associated with the workspace. [JsonPropertyName("git_root")] public string? GitRoot { get; set; } /// Allowed values for the `WorkspacesWorkspaceDetailsHostType` enumeration. [JsonPropertyName("host_type")] public WorkspacesWorkspaceDetailsHostType? HostType { get; set; } /// Stable workspace identifier. [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; /// Most recent Mission Control event identifier observed for the workspace. [JsonPropertyName("mc_last_event_id")] public string? McLastEventId { get; set; } /// Mission Control session identifier associated with the workspace. [JsonPropertyName("mc_session_id")] public string? McSessionId { get; set; } /// Mission Control task identifier associated with the workspace. [JsonPropertyName("mc_task_id")] public string? McTaskId { get; set; } /// Workspace display name. [JsonPropertyName("name")] public string? Name { get; set; } /// Whether the workspace session can be steered remotely. [JsonPropertyName("remote_steerable")] public bool? RemoteSteerable { get; set; } /// Repository identifier associated with the workspace. [JsonPropertyName("repository")] public string? Repository { get; set; } /// Number of persisted summaries in the workspace. [JsonPropertyName("summary_count")] public long? SummaryCount { get; set; } /// Timestamp when the workspace was last updated. [JsonPropertyName("updated_at")] public DateTimeOffset? UpdatedAt { get; set; } /// Whether the workspace name was explicitly chosen by the user. [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; } /// Workspace metadata fields to update. [Experimental(Diagnostics.Experimental)] internal sealed class WorkspacesUpdateMetadataRequest { /// Opaque workspace context supplied by the session host. [JsonPropertyName("context")] public JsonElement? Context { get; set; } /// Optional workspace display name override. [JsonPropertyName("name")] public string? Name { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Optional session context used when creating a local workspace. [Experimental(Diagnostics.Experimental)] internal sealed class WorkspacesEnsureRequest { /// Opaque workspace context supplied by the session host. [JsonPropertyName("context")] public JsonElement? Context { get; set; } /// 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; } /// Workspace checkpoint metadata with assigned number, human-readable title, and checkpoint filename. [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; } /// Metadata for the persisted summary. public sealed class WorkspacesAddSummaryResultSummary { } /// Refreshed metadata for the containing workspace. public sealed class WorkspacesAddSummaryResultWorkspace { } /// Persisted summary metadata and refreshed workspace metadata. [Experimental(Diagnostics.Experimental)] public sealed class WorkspacesAddSummaryResult { /// Metadata for the persisted summary. [JsonPropertyName("summary")] public WorkspacesAddSummaryResultSummary? Summary { get; set; } /// Refreshed metadata for the containing workspace. [JsonPropertyName("workspace")] public WorkspacesAddSummaryResultWorkspace? Workspace { get; set; } } /// Compaction summary checkpoint to persist. [Experimental(Diagnostics.Experimental)] internal sealed class WorkspacesAddSummaryRequest { /// Markdown summary content to persist. [JsonPropertyName("content")] public string Content { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; /// Summary title shown in checkpoint listings. [JsonPropertyName("title")] public string Title { get; set; } = string.Empty; } /// Rollback point for local workspace summaries. [Experimental(Diagnostics.Experimental)] internal sealed class WorkspacesTruncateSummariesRequest { /// Number of newest summaries to keep. [JsonPropertyName("keepCount")] public long KeepCount { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Autopilot objective file content, or null when missing. [Experimental(Diagnostics.Experimental)] public sealed class WorkspacesReadAutopilotObjectiveResult { /// Autopilot objective file content, or null when missing. [JsonPropertyName("content")] public string? Content { get; set; } } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionWorkspacesReadAutopilotObjectiveRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Result of writing the autopilot objective file. [Experimental(Diagnostics.Experimental)] public sealed class WorkspacesWriteAutopilotObjectiveResult { /// Filesystem operation performed. [JsonPropertyName("operation")] public string Operation { get; set; } = string.Empty; } /// Autopilot objective file content to persist. [Experimental(Diagnostics.Experimental)] internal sealed class WorkspacesWriteAutopilotObjectiveRequest { /// Autopilot objective file content. [JsonPropertyName("content")] public string Content { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Result of deleting the autopilot objective file. [Experimental(Diagnostics.Experimental)] public sealed class WorkspacesDeleteAutopilotObjectiveResult { /// True when a file was deleted. [JsonPropertyName("deleted")] public bool Deleted { get; set; } } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionWorkspacesDeleteAutopilotObjectiveRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Whether the autopilot objective file exists. [Experimental(Diagnostics.Experimental)] public sealed class WorkspacesAutopilotObjectiveExistsResult { /// True when the objective file exists. [JsonPropertyName("exists")] public bool Exists { get; set; } } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionWorkspacesAutopilotObjectiveExistsRequest { /// 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; } /// A single changed file and its unified diff. [Experimental(Diagnostics.Experimental)] public sealed class WorkspaceDiffFileChange { /// Type of change represented by this file diff. [JsonPropertyName("changeType")] public WorkspaceDiffFileChangeType ChangeType { get; set; } /// Unified diff content for the file. Empty when the diff was truncated. [JsonPropertyName("diff")] public string Diff { get; set; } = string.Empty; /// Whether the diff content was omitted because it exceeded the per-file size limit. [JsonPropertyName("isTruncated")] public bool? IsTruncated { get; set; } /// Original file path for renamed files. [JsonPropertyName("oldPath")] public string? OldPath { get; set; } /// Path to the changed file, relative to the workspace root when the file lives under it. A file changed outside the workspace root keeps a `../`-relative path, or an absolute path when no relative path exists (for example a different Windows drive). [JsonPropertyName("path")] public string Path { get; set; } = string.Empty; } /// Workspace diff result for the requested mode. [Experimental(Diagnostics.Experimental)] public sealed class WorkspaceDiffResult { /// Default branch used for a branch diff, when branch mode was requested. [JsonPropertyName("baseBranch")] public string? BaseBranch { get; set; } /// Changed files and their unified diffs. [JsonPropertyName("changes")] public IList Changes { get => field ??= []; set; } /// Whether the requested diff fell back to unstaged changes, either because branch diff failed or session diff was unavailable. [JsonPropertyName("isFallback")] public bool IsFallback { get; set; } /// Effective mode used for the returned changes. [JsonPropertyName("mode")] public WorkspaceDiffMode Mode { get; set; } /// Diff mode requested by the client. [JsonPropertyName("requestedMode")] public WorkspaceDiffMode RequestedMode { get; set; } /// Why the session diff could not be produced, when applicable. Set only when `session` mode was requested and `isFallback` is true, so a client can tell the permanent `file-change-tracking-disabled` apart from the transient `session-busy`, which the same request answers once the session settles. Never set for `unstaged` or `branch` mode, and never `unsupported-remote-session`: a remote session's captures live on its own host, so a `session`-mode diff is rejected for one rather than answered with a controller-side fallback. [JsonPropertyName("unavailableReason")] public HistoryRewindUnavailableReason? UnavailableReason { get; set; } } /// Parameters for computing a workspace diff. [Experimental(Diagnostics.Experimental)] internal sealed class WorkspacesDiffRequest { /// When true, ignore whitespace-only changes (git `--ignore-all-space`). Defaults to false. [JsonPropertyName("ignoreWhitespace")] public bool? IgnoreWhitespace { get; set; } /// Diff mode requested by the client. [JsonPropertyName("mode")] public WorkspaceDiffMode Mode { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Current per-window credit limit and consumption for an autopilot objective. [Experimental(Diagnostics.Experimental)] public sealed class AutopilotObjectiveCreditLimit { /// Configured AI-credit cap, when one is set. [JsonPropertyName("credits")] public double? Credits { get; set; } /// Window consumption in fractional AI credits, for display. [JsonPropertyName("creditsUsed")] public double CreditsUsed { get; set; } /// Exact window consumption in non-negative integer nano-AIU, encoded as a decimal string. [RegularExpression("^[0-9]+$")] [JsonPropertyName("creditsUsedNanoAiu")] public string CreditsUsedNanoAiu { get; set; } = string.Empty; } /// Public, persistence-independent projection of an autopilot objective. [Experimental(Diagnostics.Experimental)] public sealed class AutopilotObjectiveState { /// Optional summary recorded when the objective completed. [JsonPropertyName("completionSummary")] public string? CompletionSummary { get; set; } /// Exact lifetime AI-credit consumption in non-negative integer nano-AIU, encoded as a decimal string. [RegularExpression("^[0-9]+$")] [JsonPropertyName("creditCountNanoAiu")] public string CreditCountNanoAiu { get; set; } = string.Empty; /// Current per-window consumption and optional cap, when a credit-tracking window is present. [JsonPropertyName("creditLimit")] public AutopilotObjectiveCreditLimit? CreditLimit { get; set; } /// Session-local objective identifier. [JsonPropertyName("id")] public long Id { get; set; } /// User-provided objective text. [JsonPropertyName("objective")] public string Objective { get; set; } = string.Empty; /// Optional reason the objective is paused. [JsonPropertyName("pauseReason")] public string? PauseReason { get; set; } /// Current normalized lifecycle status. [JsonPropertyName("status")] public AutopilotObjectiveStatus Status { get; set; } /// Number of objective turns started. [JsonPropertyName("turnCount")] public long TurnCount { get; set; } } /// Canonical runtime state for the session's current autopilot objective. [Experimental(Diagnostics.Experimental)] public sealed class AutopilotObjectiveGetStateResult { /// Current objective state, or `null` when the session has no objective. [JsonPropertyName("state")] public AutopilotObjectiveState? State { get; set; } } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionAutopilotObjectiveGetStateRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Characters that, when typed in the composer, should trigger a `completions.request`. Empty when the session has no host-driven completions (e.g. local sessions, or a relay host that does not advertise `completionTriggerCharacters`). [Experimental(Diagnostics.Experimental)] public sealed class CompletionsGetTriggerCharactersResult { /// Trigger characters advertised by the host (e.g. `["@", "#"]`). Empty disables host-driven completions for the session. [JsonPropertyName("triggerCharacters")] public IList TriggerCharacters { get => field ??= []; set; } } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionCompletionsGetTriggerCharactersRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// A single host-driven completion. Accepting an item replaces `[rangeStart, rangeEnd)` (UTF-16 code units) in the composer with `insertText`; when the range is absent, the active token around the cursor is replaced. [Experimental(Diagnostics.Experimental)] public sealed class SessionCompletionItem { /// Text spliced into the composer when the item is accepted. [JsonPropertyName("insertText")] public string InsertText { get; set; } = string.Empty; /// Render-kind hint for the picker row (e.g. `"document"`, `"directory"`), derived from the host's display kind. [JsonPropertyName("kind")] public string? Kind { get; set; } /// Primary display label for the picker row. Falls back to `insertText` when absent. [JsonPropertyName("label")] public string? Label { get; set; } /// End (exclusive) of the replacement range in `text`, in UTF-16 code units. [JsonPropertyName("rangeEnd")] public long? RangeEnd { get; set; } /// Start of the replacement range in `text`, in UTF-16 code units. [JsonPropertyName("rangeStart")] public long? RangeStart { get; set; } } /// Host-driven completion items for the current composer input. Empty when the host returns no items or does not support completions. [Experimental(Diagnostics.Experimental)] public sealed class CompletionsRequestResult { /// Completion items in host-ranked order. [JsonPropertyName("items")] public IList Items { get => field ??= []; set; } } /// Request host-driven completions for the current composer input. [Experimental(Diagnostics.Experimental)] internal sealed class CompletionsRequestRequest { /// Cursor offset within `text`, in UTF-16 code units. [JsonPropertyName("offset")] public long Offset { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; /// The full composed composer input. [JsonPropertyName("text")] public string Text { get; set; } = string.Empty; } /// 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; } /// Agents available to the session. [Experimental(Diagnostics.Experimental)] public sealed class AgentList { /// Available agents. [JsonPropertyName("agents")] public IList Agents { get => field ??= []; set; } } /// RPC data type for SessionAgentList operations. [Experimental(Diagnostics.Experimental)] public sealed class SessionAgentListRequest { /// When true, request the session's configured built-in agents alongside custom agents. Listing applies feature, context, inclusion, exclusion, and user-disabled-agent policy, but does not evaluate transient invocation requirements such as model availability. Built-in metadata may be omitted when the session cannot project it, such as a relay session. [JsonPropertyName("includeBuiltInAgents")] public bool? IncludeBuiltInAgents { get; set; } /// When true, request authored base prompt text on each AgentInfo. Prompt text may be omitted when unavailable, such as for agents projected through a relay session. [JsonPropertyName("includePrompt")] public bool? IncludePrompt { get; set; } } /// RPC data type for SessionAgentListRequestWithSession operations. [Experimental(Diagnostics.Experimental)] internal sealed class SessionAgentListRequestWithSession { /// When true, request the session's configured built-in agents alongside custom agents. Listing applies feature, context, inclusion, exclusion, and user-disabled-agent policy, but does not evaluate transient invocation requirements such as model availability. Built-in metadata may be omitted when the session cannot project it, such as a relay session. [JsonPropertyName("includeBuiltInAgents")] public bool? IncludeBuiltInAgents { get; set; } /// When true, request authored base prompt text on each AgentInfo. Prompt text may be omitted when unavailable, such as for agents projected through a relay session. [JsonPropertyName("includePrompt")] public bool? IncludePrompt { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// An in-memory authored prompt override for an available agent. [Experimental(Diagnostics.Experimental)] internal sealed class AgentSetPromptRequest { /// Stable effective agent id. Plugin namespace separators are normalized. [JsonPropertyName("id")] public string Id { get; set; } = string.Empty; /// Replacement authored prompt. Empty text is valid. [JsonPropertyName("prompt")] public string Prompt { get; set; } = string.Empty; /// 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; } /// Friendly, non-unique name used when displaying the agent. [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; } /// Tracked task union returned by task APIs, containing an agent, client, or shell task. /// Polymorphic base type discriminated by type. [Experimental(Diagnostics.Experimental)] [JsonPolymorphic( TypeDiscriminatorPropertyName = "type", UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToBaseType)] [JsonDerivedType(typeof(TaskInfoAgent), "agent")] [JsonDerivedType(typeof(TaskInfoClient), "client")] [JsonDerivedType(typeof(TaskInfoShell), "shell")] public partial class TaskInfo { /// The type discriminator. [JsonPropertyName("type")] public virtual string Type { get; set; } = string.Empty; } /// Tracked background agent task metadata, including IDs, status, timing, agent type, prompt, model, result, and latest response. /// 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; } /// Friendly, non-unique name intended for display. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("displayName")] public string? DisplayName { 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; } /// Requested model override for the task when specified. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("model")] public string? Model { get; set; } /// Most recent prompt delivered to the agent. Updated whenever the agent receives a follow-up message. [JsonPropertyName("prompt")] public required string Prompt { get; set; } /// Runtime model resolved for the task when available. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("resolvedModel")] public string? ResolvedModel { 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; } } /// Public owner attribution for a client-owned task. Identifiers are opaque and never authorize requests. [Experimental(Diagnostics.Experimental)] public sealed class TaskClientOwner { /// ISO 8601 timestamp when the bound join disconnected. [JsonPropertyName("disconnectedAt")] public DateTimeOffset? DisconnectedAt { get; set; } /// Display-only owner name. [JsonPropertyName("displayName")] public string? DisplayName { get; set; } /// Opaque identity of the currently or most recently bound session join. [JsonPropertyName("joinId")] public string JoinId { get; set; } = string.Empty; /// Class of the task owner. [JsonPropertyName("kind")] public TaskClientOwnerKind Kind { get; set; } /// Opaque session-scoped participant identity. [JsonPropertyName("participantId")] public string ParticipantId { get; set; } = string.Empty; /// Whether this task's bound join is currently connected. [JsonPropertyName("presence")] public TaskClientOwnerPresence Presence { get; set; } /// Display-only owner source. [JsonPropertyName("source")] public string? Source { get; set; } } /// Tracked client-owned task metadata. /// The client variant of . [Experimental(Diagnostics.Experimental)] public partial class TaskInfoClient : TaskInfo { /// [JsonIgnore] public override string Type => "client"; /// ISO 8601 timestamp when the current active segment started. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("activeStartedAt")] public DateTimeOffset? ActiveStartedAt { get; set; } /// Accumulated active execution time in milliseconds. [JsonPropertyName("activeTimeMs")] public required long ActiveTimeMs { get; set; } /// Whether the currently bound owner can receive a cancellation request. [JsonPropertyName("canCancel")] public required bool CanCancel { get; set; } /// Human-readable reason for terminal cancellation. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("cancellationReason")] public string? CancellationReason { get; set; } /// Owner-scoped registration and reclaim key. [JsonPropertyName("clientTaskId")] public required string ClientTaskId { get; set; } /// ISO 8601 timestamp when the task reached a terminal status. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("completedAt")] public DateTimeOffset? CompletedAt { get; set; } /// Task description. [JsonPropertyName("description")] public required string Description { get; set; } /// Optional task display name. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("displayName")] public string? DisplayName { get; set; } /// Human-readable terminal failure message. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("error")] public string? Error { get; set; } /// Optional owner-supplied terminal failure code. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("errorCode")] public string? ErrorCode { get; set; } /// Execution mode, which is always background for client-owned tasks. [JsonPropertyName("executionMode")] public required TaskClientExecutionMode ExecutionMode { get; set; } /// Canonical runtime-generated task identifier. [JsonPropertyName("id")] public required string Id { get; set; } /// ISO 8601 timestamp when the connected owner entered idle status. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("idleSince")] public DateTimeOffset? IdleSince { get; set; } /// ISO 8601 timestamp of the most recent orphan transition. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("orphanedAt")] public DateTimeOffset? OrphanedAt { get; set; } /// Public attribution and presence for the task owner. [JsonPropertyName("owner")] public required TaskClientOwner Owner { get; set; } /// ISO 8601 timestamp of the most recent successful reclaim. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("reclaimedAt")] public DateTimeOffset? ReclaimedAt { get; set; } /// Opaque successful terminal result supplied by the task owner. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("result")] public JsonElement? Result { get; set; } /// Sequence number of the latest accepted owner update. [JsonPropertyName("sequence")] public required long Sequence { get; set; } /// ISO 8601 timestamp when the task started. [JsonPropertyName("startedAt")] public required DateTimeOffset StartedAt { get; set; } /// Client task lifecycle status. [JsonPropertyName("status")] public required TaskClientStatus Status { get; set; } /// ISO 8601 timestamp of the latest accepted lifecycle change. [JsonPropertyName("updatedAt")] public required DateTimeOffset UpdatedAt { get; set; } } /// Tracked shell task metadata, including ID, command, status, timing, attachment/execution mode, log path, and PID. /// 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; } /// Tracked client-owned task metadata. [Experimental(Diagnostics.Experimental)] public sealed class TaskClientInfo { /// ISO 8601 timestamp when the current active segment started. [JsonPropertyName("activeStartedAt")] public DateTimeOffset? ActiveStartedAt { get; set; } /// Accumulated active execution time in milliseconds. [JsonPropertyName("activeTimeMs")] public long ActiveTimeMs { get; set; } /// Whether the currently bound owner can receive a cancellation request. [JsonPropertyName("canCancel")] public bool CanCancel { get; set; } /// Human-readable reason for terminal cancellation. [JsonPropertyName("cancellationReason")] public string? CancellationReason { get; set; } /// Owner-scoped registration and reclaim key. [JsonPropertyName("clientTaskId")] public string ClientTaskId { get; set; } = string.Empty; /// ISO 8601 timestamp when the task reached a terminal status. [JsonPropertyName("completedAt")] public DateTimeOffset? CompletedAt { get; set; } /// Task description. [JsonPropertyName("description")] public string Description { get; set; } = string.Empty; /// Optional task display name. [JsonPropertyName("displayName")] public string? DisplayName { get; set; } /// Human-readable terminal failure message. [JsonPropertyName("error")] public string? Error { get; set; } /// Optional owner-supplied terminal failure code. [JsonPropertyName("errorCode")] public string? ErrorCode { get; set; } /// Execution mode, which is always background for client-owned tasks. [JsonPropertyName("executionMode")] public TaskClientExecutionMode ExecutionMode { get; set; } /// Canonical runtime-generated task identifier. [JsonPropertyName("id")] public string Id { get; set; } = string.Empty; /// ISO 8601 timestamp when the connected owner entered idle status. [JsonPropertyName("idleSince")] public DateTimeOffset? IdleSince { get; set; } /// ISO 8601 timestamp of the most recent orphan transition. [JsonPropertyName("orphanedAt")] public DateTimeOffset? OrphanedAt { get; set; } /// Public attribution and presence for the task owner. [JsonPropertyName("owner")] public TaskClientOwner Owner { get => field ??= new(); set; } /// ISO 8601 timestamp of the most recent successful reclaim. [JsonPropertyName("reclaimedAt")] public DateTimeOffset? ReclaimedAt { get; set; } /// Opaque successful terminal result supplied by the task owner. [JsonPropertyName("result")] public JsonElement? Result { get; set; } /// Sequence number of the latest accepted owner update. [JsonPropertyName("sequence")] public long Sequence { get; set; } /// ISO 8601 timestamp when the task started. [JsonPropertyName("startedAt")] public DateTimeOffset StartedAt { get; set; } /// Client task lifecycle status. [JsonPropertyName("status")] public TaskClientStatus Status { get; set; } /// Task kind. [JsonPropertyName("type")] public TaskClientType Type { get; set; } /// ISO 8601 timestamp of the latest accepted lifecycle change. [JsonPropertyName("updatedAt")] public DateTimeOffset UpdatedAt { get; set; } } /// Result of registering or reclaiming a client-owned task. [Experimental(Diagnostics.Experimental)] public sealed class TasksRegisterResult { /// True only when this invocation created a new task. [JsonPropertyName("created")] public bool Created { get; set; } /// True only when this invocation reclaimed an orphaned task. [JsonPropertyName("reclaimed")] public bool Reclaimed { get; set; } /// Authoritative registered or reclaimed task. [JsonPropertyName("task")] public TaskClientInfo Task { get => field ??= new(); set; } } /// Registers or reclaims a client-owned task. [Experimental(Diagnostics.Experimental)] internal sealed class TasksRegisterRequest { /// Whether the owner supports runtime cancellation requests. [JsonPropertyName("cancellable")] public bool Cancellable { get; set; } /// Owner-scoped idempotency key used for registration and reclaim. [JsonPropertyName("clientTaskId")] public string ClientTaskId { get; set; } = string.Empty; /// Human-readable description of the external work. [JsonPropertyName("description")] public string Description { get; set; } = string.Empty; /// Optional short display name for the external work. [JsonPropertyName("displayName")] public string? DisplayName { get; set; } /// Expected current sequence for idempotent registration or orphan reclaim. [JsonPropertyName("expectedSequence")] public long? ExpectedSequence { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; /// Task kind. [JsonPropertyName("type")] public TaskClientType Type { get; set; } } /// Result of publishing a client-owned task update. [Experimental(Diagnostics.Experimental)] public sealed class TasksUpdateResult { /// Whether this invocation changed task state. [JsonPropertyName("applied")] public bool Applied { get; set; } /// Whether this invocation repeated the latest accepted update. [JsonPropertyName("duplicate")] public bool Duplicate { get; set; } /// Authoritative task after processing the update. [JsonPropertyName("task")] public TaskClientInfo Task { get => field ??= new(); set; } } /// Progress or terminal update for a client-owned task. /// Polymorphic base type discriminated by kind. [Experimental(Diagnostics.Experimental)] [JsonPolymorphic( TypeDiscriminatorPropertyName = "kind", UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToBaseType)] [JsonDerivedType(typeof(TaskClientUpdateProgress), "progress")] [JsonDerivedType(typeof(TaskClientUpdateCompleted), "completed")] [JsonDerivedType(typeof(TaskClientUpdateFailed), "failed")] [JsonDerivedType(typeof(TaskClientUpdateCancelled), "cancelled")] public partial class TaskClientUpdate { /// The type discriminator. [JsonPropertyName("kind")] public virtual string Kind { get; set; } = string.Empty; } /// Publishes nonterminal progress for a running or idle client task. /// The progress variant of . [Experimental(Diagnostics.Experimental)] public partial class TaskClientUpdateProgress : TaskClientUpdate { /// [JsonIgnore] public override string Kind => "progress"; /// Optional progress message appended to recent activity when nonempty. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("message")] public string? Message { get; set; } /// Optional completion percentage; null clears the current percentage. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("percentage")] public double? Percentage { get; set; } /// Optional progress phase; null clears the current phase. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("phase")] public string? Phase { get; set; } /// Optional active status transition. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("status")] public TaskClientActiveStatus? Status { get; set; } } /// Reports successful terminal completion. /// The completed variant of . [Experimental(Diagnostics.Experimental)] public partial class TaskClientUpdateCompleted : TaskClientUpdate { /// [JsonIgnore] public override string Kind => "completed"; /// Optional final progress message. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("message")] public string? Message { get; set; } /// Optional opaque successful terminal result. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("result")] public JsonElement? Result { get; set; } } /// Reports terminal failure. /// The failed variant of . [Experimental(Diagnostics.Experimental)] public partial class TaskClientUpdateFailed : TaskClientUpdate { /// [JsonIgnore] public override string Kind => "failed"; /// Optional owner-supplied terminal failure code. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("code")] public string? Code { get; set; } /// Human-readable terminal failure message. [JsonPropertyName("error")] public required string Error { get; set; } /// Optional final progress message. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("message")] public string? Message { get; set; } } /// Reports terminal cancellation after external work stopped. /// The cancelled variant of . [Experimental(Diagnostics.Experimental)] public partial class TaskClientUpdateCancelled : TaskClientUpdate { /// [JsonIgnore] public override string Kind => "cancelled"; /// Optional final progress message. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("message")] public string? Message { get; set; } /// Optional human-readable cancellation reason. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("reason")] public string? Reason { get; set; } } /// Updates a client-owned task. [Experimental(Diagnostics.Experimental)] internal sealed class TasksUpdateRequest { /// Canonical runtime-generated task identifier. [JsonPropertyName("id")] public string Id { get; set; } = string.Empty; /// Owner update sequence to apply. [JsonPropertyName("sequence")] public long Sequence { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; /// Progress or terminal update payload. [JsonPropertyName("update")] public TaskClientUpdate Update { get => field ??= new(); set; } } /// 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; } /// Progress information for the task, discriminated by type. Returns null when no task with this ID is currently tracked. /// Polymorphic base type discriminated by type. [Experimental(Diagnostics.Experimental)] [JsonPolymorphic( TypeDiscriminatorPropertyName = "type", UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToBaseType)] [JsonDerivedType(typeof(TaskProgressAgent), "agent")] [JsonDerivedType(typeof(TaskProgressClient), "client")] [JsonDerivedType(typeof(TaskProgressShell), "shell")] public partial class TaskProgress { /// The type discriminator. [JsonPropertyName("type")] public virtual string Type { get; set; } = string.Empty; } /// Timestamped display line for task progress output or recent agent activity. [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; } } /// Progress snapshot for an agent task, with recent activity lines and optional latest intent. /// The agent variant of . [Experimental(Diagnostics.Experimental)] public partial class TaskProgressAgent : TaskProgress { /// [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; } } /// Generic progress for a client-owned task. /// The client variant of . [Experimental(Diagnostics.Experimental)] public partial class TaskProgressClient : TaskProgress { /// [JsonIgnore] public override string Type => "client"; /// Most recent nonempty progress message. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("lastMessage")] public string? LastMessage { get; set; } /// Current completion percentage from zero through one hundred. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("percentage")] public double? Percentage { get; set; } /// Current owner-defined progress phase. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("phase")] public string? Phase { get; set; } /// Recent server-timestamped progress messages. [JsonPropertyName("recentActivity")] public required IList RecentActivity { get; set; } /// Sequence number of the latest accepted owner update. [JsonPropertyName("sequence")] public required long Sequence { get; set; } /// Current client task lifecycle status. [JsonPropertyName("status")] public required TaskClientStatus Status { get; set; } /// ISO 8601 timestamp of the latest accepted lifecycle change. [JsonPropertyName("updatedAt")] public required DateTimeOffset UpdatedAt { get; set; } } /// Progress snapshot for a shell task, with recent stdout/stderr output and optional process ID. /// The shell variant of . [Experimental(Diagnostics.Experimental)] public partial class TaskProgressShell : TaskProgress { /// [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 TaskProgress? 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; } /// Skill metadata available to a session, with name, description, source, enabled/invocable state, path, plugin, and argument hint. [Experimental(Diagnostics.Experimental)] public sealed class Skill { /// Optional freeform hint describing the skill's expected arguments, from the `argument-hint` frontmatter field. [JsonPropertyName("argumentHint")] public string? ArgumentHint { get; set; } /// Canonical slash command name used to invoke the skill, without the leading '/'. [JsonPropertyName("commandName")] public string? CommandName { get; set; } /// 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; } /// Skill invocation record with name, path, content, allowed tools, and turn number. [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; /// Whether model invocation was disabled when this skill was invoked. [JsonPropertyName("disableModelInvocation")] public bool? DisableModelInvocation { get; set; } /// 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, or an empty string for an SDK-provided skill without a filesystem identity. [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; } /// Recorded MCP server connection failure. [Experimental(Diagnostics.Experimental)] public sealed class McpServerFailureInfo { /// Failure message produced when the MCP server connection failed. [JsonPropertyName("message")] public string Message { get; set; } = string.Empty; /// epoch-ms timestamp at which the failure was recorded. [JsonPropertyName("timestamp")] public long Timestamp { get; set; } } /// Recorded MCP server pending-auth state. [Experimental(Diagnostics.Experimental)] public sealed class McpServerNeedsAuthInfo { /// epoch-ms timestamp at which the server signalled it needs authentication. [JsonPropertyName("timestamp")] public long Timestamp { get; set; } } /// Host-level state, omitted when no MCP host is initialized. [Experimental(Diagnostics.Experimental)] public sealed class McpHostState { /// Names of currently-connected MCP clients. [JsonPropertyName("clients")] public IList Clients { get => field ??= []; set; } /// Configured servers that are explicitly disabled. [JsonPropertyName("disabledServers")] public IList DisabledServers { get => field ??= []; set; } /// Map of server name to recorded connection failure. [JsonPropertyName("failedServers")] public IDictionary FailedServers { get => field ??= new Dictionary(); set; } /// Configured servers filtered out by MCP server policy. [JsonPropertyName("filteredServers")] public IList FilteredServers { get => field ??= []; set; } /// Whether third-party MCP servers are policy-enabled for this session. [JsonPropertyName("mcp3pEnabled")] public bool Mcp3pEnabled { get; set; } /// Map of server name to recorded pending-auth state. [JsonPropertyName("needsAuthServers")] public IDictionary NeedsAuthServers { get => field ??= new Dictionary(); set; } /// Names of servers with in-flight connection attempts. [JsonPropertyName("pendingConnections")] public IList PendingConnections { get => field ??= []; set; } } /// MCP server status entry, including config source/plugin source and any connection error. [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; /// Server-advertised metadata for a connected server. Omitted when no live connection metadata is available, including while pending or when failed, disabled, stopped, or not configured. [JsonPropertyName("serverMetadata")] public McpServerMetadata? ServerMetadata { get; set; } /// Configuration source: user, workspace, plugin, or builtin. [JsonPropertyName("source")] public McpServerSource? Source { get; set; } /// Plugin name that provided this server, when source is plugin. [JsonPropertyName("sourcePlugin")] public string? SourcePlugin { get; set; } /// Plugin version that provided this server, when source is plugin. [JsonPropertyName("sourcePluginVersion")] public string? SourcePluginVersion { get; set; } /// Connection status: connected, failed, needs-auth, pending, disabled, stopped, or not_configured. [JsonPropertyName("status")] public McpServerStatus Status { get; set; } } /// MCP servers configured for the session, with their connection status and host-level state. [Experimental(Diagnostics.Experimental)] public sealed class McpServerList { /// Host-level state, omitted when no MCP host is initialized. [JsonPropertyName("host")] public McpHostState? Host { get; set; } /// 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; } /// Normalized MCP Apps discovery metadata from a tool's `_meta.ui` block. [Experimental(Diagnostics.Experimental)] public sealed class McpToolUi { /// URI of the tool's MCP App resource, typically a `ui://` resource identifier. Use `session.mcp.resources.read` to fetch its HTML and resource metadata. [JsonPropertyName("resourceUri")] public string? ResourceUri { get; set; } /// Tool visibility advertised by the server. When absent, MCP Apps defaults apply. [JsonPropertyName("visibility")] public IList? Visibility { get; set; } } /// MCP tool metadata with tool name, optional description, and normalized MCP Apps discovery metadata. [Experimental(Diagnostics.Experimental)] public sealed class McpTools { /// Tool description, when provided. [JsonPropertyName("description")] public string? Description { get; set; } /// Tool name. [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; /// Normalized MCP Apps discovery metadata. An empty object indicates that a valid `_meta.ui` block was present without recognized fields. [JsonPropertyName("ui")] public McpToolUi? Ui { get; set; } } /// Tools exposed by the connected MCP server. Throws when the server is not connected. [Experimental(Diagnostics.Experimental)] public sealed class McpListToolsResult { /// Tools exposed by the server. [JsonPropertyName("tools")] public IList Tools { get => field ??= []; set; } } /// Server name whose tool list should be returned. [Experimental(Diagnostics.Experimental)] internal sealed class McpListToolsRequest { /// Name of the connected MCP server whose tools to list. [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 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; } /// Result of moving in-flight MCP loading to the background. [Experimental(Diagnostics.Experimental)] public sealed class MoveMcpLoadingToBackgroundResult { /// Whether an in-flight MCP load was moved to the background, releasing turns that were waiting on it. False when no MCP load was in flight or the waiting turns had already been released. [JsonPropertyName("movedToBackground")] public bool MovedToBackground { get; set; } } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionMcpMoveLoadingToBackgroundRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// MCP server allowed by policy, with server name and optional PII-free explanatory note. [Experimental(Diagnostics.Experimental)] public sealed class McpAllowedServer { /// Allowed server name. [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; /// PII-free note explaining why the server was allowed. [JsonPropertyName("redactedNote")] public string? RedactedNote { get; set; } } /// MCP server whose connection attempt failed. [Experimental(Diagnostics.Experimental)] public sealed class McpFailedServer { /// The captured connection failure detail. [JsonPropertyName("error")] public string? Error { get; set; } /// The config key of the server that failed to connect. [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; } /// MCP server filtered by policy, with name, reason, and optional redacted reason. [Experimental(Diagnostics.Experimental)] public sealed class McpFilteredServer { /// Deprecated. This field is no longer populated. [EditorBrowsable(EditorBrowsableState.Never)] #if NET5_0_OR_GREATER [Obsolete("This member is deprecated and will be removed in a future version.", DiagnosticId = "GHCP001")] #endif [JsonPropertyName("enterpriseName")] public string? EnterpriseName { get; set; } /// Filtered server name. [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; /// Human-readable filter reason. [JsonPropertyName("reason")] public string Reason { get; set; } = string.Empty; /// PII-free filter reason. [JsonPropertyName("redactedReason")] public string? RedactedReason { get; set; } } /// MCP server startup filtering result. [Experimental(Diagnostics.Experimental)] internal sealed class McpStartServersResult { /// Non-default servers allowed by policy. [JsonPropertyName("allowedServers")] public IList? AllowedServers { get; set; } /// Servers whose connection attempt failed. [JsonPropertyName("failedServers")] public IList? FailedServers { get; set; } /// Servers filtered out before startup. [JsonPropertyName("filteredServers")] public IList FilteredServers { get => field ??= []; set; } } /// Opaque MCP reload configuration. [Experimental(Diagnostics.Experimental)] internal sealed class McpReloadWithConfigRequest { /// 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; } /// Result of configuring GitHub MCP. [Experimental(Diagnostics.Experimental)] internal sealed class McpConfigureGitHubResult { /// Whether GitHub MCP configuration changed. [JsonPropertyName("changed")] public bool Changed { get; set; } } /// Credential-free authentication identity used to configure GitHub MCP. [Experimental(Diagnostics.Experimental)] internal sealed class McpConfigureGitHubRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Server name and optional configuration for an individual MCP server start. Omit `config` for a config-free start-by-name of an already-configured server. [Experimental(Diagnostics.Experimental)] internal sealed class McpStartServerRequest { /// MCP server configuration (stdio process or remote HTTP/SSE). Omit to start the server with its already-registered configuration (config-free start-by-name). [JsonPropertyName("config")] public JsonElement? Config { get; set; } /// Name of the MCP server to start. [JsonPropertyName("serverName")] public string ServerName { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Server name and optional replacement configuration for an individual MCP server restart. Omit `config` for a config-free restart-by-name of an already-configured server. [Experimental(Diagnostics.Experimental)] internal sealed class McpRestartServerRequest { /// Replacement MCP server configuration (stdio process or remote HTTP/SSE). Omit to restart the server with its already-registered configuration (config-free restart-by-name). [JsonPropertyName("config")] public JsonElement? Config { get; set; } /// Name of the MCP server to restart. [JsonPropertyName("serverName")] public string ServerName { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Server name for an individual MCP server stop. [Experimental(Diagnostics.Experimental)] internal sealed class McpStopServerRequest { /// Name of the MCP server to stop. [JsonPropertyName("serverName")] public string ServerName { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Registration parameters for an external MCP client. [Experimental(Diagnostics.Experimental)] internal sealed class McpRegisterExternalClientRequest { /// Logical server name for the external client. [JsonPropertyName("serverName")] public string ServerName { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Server name identifying the external client to remove. [Experimental(Diagnostics.Experimental)] internal sealed class McpUnregisterExternalClientRequest { /// Server name of the external client to unregister. [JsonPropertyName("serverName")] public string ServerName { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Whether the named MCP server is running. [Experimental(Diagnostics.Experimental)] public sealed class McpIsServerRunningResult { /// True if the server has an active client and transport. [JsonPropertyName("running")] public bool Running { get; set; } } /// Server name to check running status for. [Experimental(Diagnostics.Experimental)] internal sealed class McpIsServerRunningRequest { /// Name of the MCP server to check. [JsonPropertyName("serverName")] public string ServerName { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Indicates whether the pending MCP OAuth response was accepted. [Experimental(Diagnostics.Experimental)] public sealed class McpOauthHandlePendingResult { /// Whether the response was accepted. False if the request was unknown, timed out, or already resolved. [JsonPropertyName("success")] public bool Success { get; set; } } /// Host response to the pending OAuth request. /// Polymorphic base type discriminated by kind. [Experimental(Diagnostics.Experimental)] [JsonPolymorphic( TypeDiscriminatorPropertyName = "kind", UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToBaseType)] [JsonDerivedType(typeof(McpOauthPendingRequestResponseToken), "token")] [JsonDerivedType(typeof(McpOauthPendingRequestResponseCancelled), "cancelled")] public partial class McpOauthPendingRequestResponse { /// The type discriminator. [JsonPropertyName("kind")] public virtual string Kind { get; set; } = string.Empty; } /// The token variant of . [Experimental(Diagnostics.Experimental)] public partial class McpOauthPendingRequestResponseToken : McpOauthPendingRequestResponse { /// [JsonIgnore] public override string Kind => "token"; /// Access token acquired by the SDK host. [JsonPropertyName("accessToken")] public required string AccessToken { get; set; } /// Token lifetime in seconds, if known. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("expiresIn")] public long? ExpiresIn { get; set; } /// OAuth token type. Defaults to bearer when omitted. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("tokenType")] public string? TokenType { get; set; } } /// The cancelled variant of . [Experimental(Diagnostics.Experimental)] public partial class McpOauthPendingRequestResponseCancelled : McpOauthPendingRequestResponse { /// [JsonIgnore] public override string Kind => "cancelled"; } /// Pending MCP OAuth request ID and host-provided token or cancellation response. [Experimental(Diagnostics.Experimental)] internal sealed class McpOauthHandlePendingRequest { /// OAuth request identifier from the mcp.oauth_required event. [JsonPropertyName("requestId")] public string RequestId { get; set; } = string.Empty; /// Host response to the pending OAuth request. [JsonPropertyName("result")] public McpOauthPendingRequestResponse Result { get => field ??= new(); set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Identifies the MCP server whose persisted OAuth credentials were updated. [Experimental(Diagnostics.Experimental)] internal sealed class McpOauthAuthenticationStateChangedRequest { /// Whether the target session must mint a session-scoped access token instead of reusing a shared access token persisted by another session. [JsonPropertyName("refreshSessionToken")] public bool? RefreshSessionToken { get; set; } /// Name of the MCP server whose OAuth credentials were updated. Omit only when the host cannot identify the server. [JsonPropertyName("serverName")] public string? ServerName { get; set; } /// 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, callback success-page copy, and static OAuth client selection. [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 OAuth client ID override for this login. When set, the runtime uses this pre-registered static client instead of dynamic client registration. [JsonPropertyName("clientId")] public string? ClientId { 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; } /// Optional OAuth client secret override for this login. The runtime treats this as an ephemeral host-owned secret, uses it for this authentication attempt and does not persist it. [JsonPropertyName("clientSecret")] public string? ClientSecret { 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; } /// Optional OAuth grant type override for this login. Defaults to the server configuration, or authorization_code when no grant type is specified. [JsonPropertyName("grantType")] public McpOauthLoginGrantType? GrantType { get; set; } /// Optional override indicating whether the static OAuth client is public. When false, the runtime treats it as confidential and uses the per-login clientSecret if provided, otherwise retrieving the client secret from the MCP OAuth secret store. [JsonPropertyName("publicClient")] public bool? PublicClient { 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; } /// Passive MCP OAuth probe result. `authenticated` means the server accepted the probe request while an OAuth-origin access token was attached; it does not prove the server required or independently validated that token. The probe does not make a second unauthenticated request. Failed is an expected probe-domain outcome; JSON-RPC errors are reserved for API-call failures. /// Polymorphic base type discriminated by status. [Experimental(Diagnostics.Experimental)] [JsonPolymorphic( TypeDiscriminatorPropertyName = "status", UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToBaseType)] [JsonDerivedType(typeof(McpOauthProbeResultNoAuthRequired), "no-auth-required")] [JsonDerivedType(typeof(McpOauthProbeResultAuthenticated), "authenticated")] [JsonDerivedType(typeof(McpOauthProbeResultNeedsAuth), "needs-auth")] [JsonDerivedType(typeof(McpOauthProbeResultFailed), "failed")] public partial class McpOauthProbeResult { /// The type discriminator. [JsonPropertyName("status")] public virtual string Status { get; set; } = string.Empty; } /// The no-auth-required variant of . [Experimental(Diagnostics.Experimental)] public partial class McpOauthProbeResultNoAuthRequired : McpOauthProbeResult { /// [JsonIgnore] public override string Status => "no-auth-required"; /// HTTP response returned by the server. [JsonPropertyName("httpResponse")] public required McpOauthHttpResponse HttpResponse { get; set; } } /// The authenticated variant of . [Experimental(Diagnostics.Experimental)] public partial class McpOauthProbeResultAuthenticated : McpOauthProbeResult { /// [JsonIgnore] public override string Status => "authenticated"; /// HTTP response returned by the server. [JsonPropertyName("httpResponse")] public required McpOauthHttpResponse HttpResponse { get; set; } } /// The needs-auth variant of . [Experimental(Diagnostics.Experimental)] public partial class McpOauthProbeResultNeedsAuth : McpOauthProbeResult { /// [JsonIgnore] public override string Status => "needs-auth"; /// HTTP 401 or 403 response returned by the server. [JsonPropertyName("httpResponse")] public required McpOauthHttpResponse HttpResponse { get; set; } /// Why authentication is needed. [JsonPropertyName("reason")] public required McpOauthProbeNeedsAuthReason Reason { get; set; } /// Parsed WWW-Authenticate challenge parameters, when present and parseable. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("wwwAuthenticateParams")] public McpOauthWWWAuthenticateParams? WwwAuthenticateParams { get; set; } } /// The failed variant of . [Experimental(Diagnostics.Experimental)] public partial class McpOauthProbeResultFailed : McpOauthProbeResult { /// [JsonIgnore] public override string Status => "failed"; /// Human-readable probe failure detail. [JsonPropertyName("error")] public required string Error { get; set; } /// HTTP response returned by the server, when the probe reached the server and captured the complete response. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("httpResponse")] public McpOauthHttpResponse? HttpResponse { get; set; } } /// Remote MCP server name for a passive OAuth status probe. [Experimental(Diagnostics.Experimental)] internal sealed class McpOauthProbeRequest { /// Name of the configured remote MCP server to probe. [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; } /// Indicates whether the pending MCP OAuth response was accepted. [Experimental(Diagnostics.Experimental)] public sealed class McpOauthRespondResult { /// Whether the response was accepted. False if the request was unknown, timed out, or already resolved. [JsonPropertyName("success")] public bool Success { get; set; } } /// Pending MCP OAuth request id to respond to. [Experimental(Diagnostics.Experimental)] internal sealed class McpOauthRespondRequest { /// OAuth request identifier from the mcp.oauth_required event. [JsonPropertyName("requestId")] public string RequestId { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Indicates whether the pending MCP headers refresh response was accepted. [Experimental(Diagnostics.Experimental)] public sealed class McpHeadersHandlePendingHeadersRefreshRequestResult { /// Whether the response was accepted. False if the request was unknown, timed out, or already resolved. [JsonPropertyName("success")] public bool Success { get; set; } } /// Host response: supply dynamic headers or decline this refresh. /// Polymorphic base type discriminated by kind. [Experimental(Diagnostics.Experimental)] [JsonPolymorphic( TypeDiscriminatorPropertyName = "kind", UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToBaseType)] [JsonDerivedType(typeof(McpHeadersHandlePendingHeadersRefreshRequestHeaders), "headers")] [JsonDerivedType(typeof(McpHeadersHandlePendingHeadersRefreshRequestNone), "none")] public partial class McpHeadersHandlePendingHeadersRefreshRequest { /// The type discriminator. [JsonPropertyName("kind")] public virtual string Kind { get; set; } = string.Empty; } /// The headers variant of . [Experimental(Diagnostics.Experimental)] public partial class McpHeadersHandlePendingHeadersRefreshRequestHeaders : McpHeadersHandlePendingHeadersRefreshRequest { /// [JsonIgnore] public override string Kind => "headers"; /// Headers to overlay onto the MCP request. Dynamic headers override static config headers but do not replace SDK-managed request headers. [JsonPropertyName("headers")] public required IDictionary Headers { get; set; } } /// The none variant of . [Experimental(Diagnostics.Experimental)] public partial class McpHeadersHandlePendingHeadersRefreshRequestNone : McpHeadersHandlePendingHeadersRefreshRequest { /// [JsonIgnore] public override string Kind => "none"; } /// MCP headers refresh request id and the host response. [Experimental(Diagnostics.Experimental)] internal sealed class McpHeadersHandlePendingHeadersRefreshRequestRequest { /// Headers refresh request identifier from mcp.headers_refresh_required. [JsonPropertyName("requestId")] public string RequestId { get; set; } = string.Empty; /// Host response: supply dynamic headers or decline this refresh. [JsonPropertyName("result")] public McpHeadersHandlePendingHeadersRefreshRequest Result { get => field ??= new(); set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// MCP Apps resource content with URI, optional MIME type, text or base64 blob, and resource metadata. [Experimental(Diagnostics.Experimental)] public sealed class McpAppsResourceContent { /// Resource-level metadata (CSP, permissions, etc.). [JsonPropertyName("_meta")] public IDictionary? Meta { get; set; } /// Base64-encoded binary content. [JsonPropertyName("blob")] public string? Blob { get; set; } /// MIME type of the content. [JsonPropertyName("mimeType")] public string? MimeType { get; set; } /// Text content (e.g. HTML). [JsonPropertyName("text")] public string? Text { get; set; } /// The resource URI (typically ui://...). [JsonPropertyName("uri")] public string Uri { get; set; } = string.Empty; } /// Resource contents returned by the MCP server. [Experimental(Diagnostics.Experimental)] public sealed class McpAppsReadResourceResult { /// Resource contents returned by the server. [JsonPropertyName("contents")] public IList Contents { get => field ??= []; set; } } /// MCP server and resource URI to fetch. [Experimental(Diagnostics.Experimental)] internal sealed class McpAppsReadResourceRequest { /// Name of the MCP server hosting the resource. [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; /// Resource URI (typically ui://...). [JsonPropertyName("uri")] public string Uri { get; set; } = string.Empty; } /// App-callable tools from the named MCP server. [Experimental(Diagnostics.Experimental)] public sealed class McpAppsListToolsResult { /// App-callable tools from the server. [JsonPropertyName("tools")] public IList> Tools { get => field ??= []; set; } } /// MCP server to list app-callable tools for. [Experimental(Diagnostics.Experimental)] internal sealed class McpAppsListToolsRequest { /// **Required.** Server whose ui:// view issued the request. Per SEP-1865 ('callable by the app from this server only'), the call is rejected when this differs from `serverName`, and rejected outright when missing. [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("originServerName")] public string OriginServerName { get; set; } = string.Empty; /// MCP server hosting the app. [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; } /// MCP server, tool name, and arguments to invoke from an MCP App view. [Experimental(Diagnostics.Experimental)] internal sealed class McpAppsCallToolRequest { /// Tool arguments. [JsonPropertyName("arguments")] public IDictionary? Arguments { get; set; } /// **Required.** Server whose ui:// view issued the request. Per SEP-1865 ('callable by the app from this server only'), the call is rejected when this differs from `serverName`, and rejected outright when missing. [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("originServerName")] public string OriginServerName { get; set; } = string.Empty; /// MCP server hosting the tool. [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; /// MCP tool name. [JsonPropertyName("toolName")] public string ToolName { get; set; } = string.Empty; } /// Host context advertised to MCP App guests. [Experimental(Diagnostics.Experimental)] public sealed class McpAppsSetHostContextDetails { /// Display modes the host supports. [JsonPropertyName("availableDisplayModes")] public IList? AvailableDisplayModes { get; set; } /// Current display mode (SEP-1865). [JsonPropertyName("displayMode")] public McpAppsSetHostContextDetailsDisplayMode? DisplayMode { get; set; } /// BCP-47 locale, e.g. 'en-US'. [JsonPropertyName("locale")] public string? Locale { get; set; } /// Platform type for responsive design. [JsonPropertyName("platform")] public McpAppsSetHostContextDetailsPlatform? Platform { get; set; } /// UI theme preference per SEP-1865. [JsonPropertyName("theme")] public McpAppsSetHostContextDetailsTheme? Theme { get; set; } /// IANA timezone, e.g. 'America/New_York'. [JsonPropertyName("timeZone")] public string? TimeZone { get; set; } /// Host application identifier. [JsonPropertyName("userAgent")] public string? UserAgent { get; set; } } /// Host context to advertise to MCP App guests. [Experimental(Diagnostics.Experimental)] internal sealed class McpAppsSetHostContextRequest { /// Host context advertised to MCP App guests. [JsonPropertyName("context")] public McpAppsSetHostContextDetails Context { get => field ??= new(); set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Current host context. [Experimental(Diagnostics.Experimental)] public sealed class McpAppsHostContextDetails { /// Display modes the host supports. [JsonPropertyName("availableDisplayModes")] public IList? AvailableDisplayModes { get; set; } /// Current display mode (SEP-1865). [JsonPropertyName("displayMode")] public McpAppsHostContextDetailsDisplayMode? DisplayMode { get; set; } /// BCP-47 locale, e.g. 'en-US'. [JsonPropertyName("locale")] public string? Locale { get; set; } /// Platform type for responsive design. [JsonPropertyName("platform")] public McpAppsHostContextDetailsPlatform? Platform { get; set; } /// UI theme preference per SEP-1865. [JsonPropertyName("theme")] public McpAppsHostContextDetailsTheme? Theme { get; set; } /// IANA timezone, e.g. 'America/New_York'. [JsonPropertyName("timeZone")] public string? TimeZone { get; set; } /// Host application identifier. [JsonPropertyName("userAgent")] public string? UserAgent { get; set; } } /// Current host context advertised to MCP App guests. [Experimental(Diagnostics.Experimental)] public sealed class McpAppsHostContext { /// Current host context. [JsonPropertyName("context")] public McpAppsHostContextDetails Context { get => field ??= new(); set; } } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionMcpAppsGetHostContextRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Capability negotiation snapshot. [Experimental(Diagnostics.Experimental)] public sealed class McpAppsDiagnoseCapability { /// Whether the runtime advertises `extensions.io.modelcontextprotocol/ui` to MCP servers. [JsonPropertyName("advertised")] public bool Advertised { get; set; } /// Whether the MCP_APPS feature flag (or COPILOT_MCP_APPS env override) is on. [JsonPropertyName("featureFlagEnabled")] public bool FeatureFlagEnabled { get; set; } /// Whether the session has the `mcp-apps` capability. [JsonPropertyName("sessionHasMcpApps")] public bool SessionHasMcpApps { get; set; } } /// What the server returned for this session. [Experimental(Diagnostics.Experimental)] public sealed class McpAppsDiagnoseServer { /// Whether the named server is currently connected. [JsonPropertyName("connected")] public bool Connected { get; set; } /// Up to 5 tool names with `_meta.ui` for quick inspection. [JsonPropertyName("sampleToolNames")] public IList SampleToolNames { get => field ??= []; set; } /// Total tools returned by the server's tools/list. [JsonPropertyName("toolCount")] public double ToolCount { get; set; } /// Tools whose `_meta.ui` is populated (resourceUri and/or visibility set). [JsonPropertyName("toolsWithUiMeta")] public double ToolsWithUiMeta { get; set; } } /// Diagnostic snapshot of MCP Apps wiring for the named server. [Experimental(Diagnostics.Experimental)] public sealed class McpAppsDiagnoseResult { /// Capability negotiation snapshot. [JsonPropertyName("capability")] public McpAppsDiagnoseCapability Capability { get => field ??= new(); set; } /// What the server returned for this session. [JsonPropertyName("server")] public McpAppsDiagnoseServer Server { get => field ??= new(); set; } } /// MCP server to diagnose MCP Apps wiring for. [Experimental(Diagnostics.Experimental)] internal sealed class McpAppsDiagnoseRequest { /// MCP server to probe. [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; } /// MCP resource content with URI, optional MIME type, text or base64 blob, and resource metadata. [Experimental(Diagnostics.Experimental)] public sealed class McpResourceContent { /// Resource-level metadata (CSP, permissions, etc.). [JsonPropertyName("_meta")] public IDictionary? Meta { get; set; } /// Base64-encoded binary content. [JsonPropertyName("blob")] public string? Blob { get; set; } /// MIME type of the content. [JsonPropertyName("mimeType")] public string? MimeType { get; set; } /// Text content (e.g. HTML). [JsonPropertyName("text")] public string? Text { get; set; } /// The resource URI. [JsonPropertyName("uri")] public string Uri { get; set; } = string.Empty; } /// Resource contents returned by the MCP server. [Experimental(Diagnostics.Experimental)] public sealed class McpResourcesReadResult { /// Resource contents returned by the server. [JsonPropertyName("contents")] public IList Contents { get => field ??= []; set; } } /// MCP server and resource URI to fetch. [Experimental(Diagnostics.Experimental)] internal sealed class McpResourcesReadRequest { /// Name of the MCP server hosting the resource. [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; /// Resource URI. [JsonPropertyName("uri")] public string Uri { get; set; } = string.Empty; } /// Standard MCP resource annotations plus preserved non-standard annotation fields. [Experimental(Diagnostics.Experimental)] public sealed class McpResourceAnnotations { /// Server-provided non-standard annotation fields preserved from the MCP response. [JsonPropertyName("additionalProperties")] public IDictionary? AdditionalProperties { get; set; } /// Intended audience roles for this resource. [JsonPropertyName("audience")] public IList? Audience { get; set; } /// Last-modified timestamp hint. [JsonPropertyName("lastModified")] public string? LastModified { get; set; } /// Priority hint for model/client use. [JsonPropertyName("priority")] public double? Priority { get; set; } } /// A resource icon descriptor plus preserved non-standard icon fields. [Experimental(Diagnostics.Experimental)] public sealed class McpResourceIcon { /// Server-provided non-standard icon fields preserved from the MCP response. [JsonPropertyName("additionalProperties")] public IDictionary? AdditionalProperties { get; set; } /// Icon MIME type, when known. [JsonPropertyName("mimeType")] public string? MimeType { get; set; } /// Icon sizes hint. [JsonPropertyName("sizes")] public string? Sizes { get; set; } /// Icon URI. [JsonPropertyName("src")] public string Src { get; set; } = string.Empty; /// Theme hint for this icon. [JsonPropertyName("theme")] public string? Theme { get; set; } } /// An MCP resource descriptor (spec `Resource`): URI, name, and optional title, description, MIME type, size, icons, annotations, and metadata. Server-provided fields outside the standard descriptor shape are exposed under `additionalProperties`. [Experimental(Diagnostics.Experimental)] public sealed class McpResource { /// Resource-level metadata. [JsonPropertyName("_meta")] public IDictionary? Meta { get; set; } /// Server-provided non-standard descriptor fields preserved from the MCP response. [JsonPropertyName("additionalProperties")] public IDictionary? AdditionalProperties { get; set; } /// Model/client annotations associated with this resource. [JsonPropertyName("annotations")] public McpResourceAnnotations? Annotations { get; set; } /// Optional description of what this resource represents. [JsonPropertyName("description")] public string? Description { get; set; } /// Icons associated with this resource. [JsonPropertyName("icons")] public IList? Icons { get; set; } /// MIME type of the resource, if known. [JsonPropertyName("mimeType")] public string? MimeType { get; set; } /// The programmatic name of the resource. [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; /// Resource size in bytes, when known. [JsonPropertyName("size")] public long? Size { get; set; } /// Optional human-readable display title. [JsonPropertyName("title")] public string? Title { get; set; } /// The resource URI (e.g. ui://... or file:///...). [JsonPropertyName("uri")] public string Uri { get; set; } = string.Empty; } /// One page of resources advertised by the named MCP server. [Experimental(Diagnostics.Experimental)] public sealed class McpResourcesListResult { /// Opaque cursor for the next page, if the server has more resources. [JsonPropertyName("nextCursor")] public string? NextCursor { get; set; } /// Resources advertised by the server (proxied MCP `resources/list`). [JsonPropertyName("resources")] public IList Resources { get => field ??= []; set; } } /// MCP server whose resources to enumerate. [Experimental(Diagnostics.Experimental)] internal sealed class McpResourcesListRequest { /// Opaque MCP pagination cursor from a prior `nextCursor` value. [JsonPropertyName("cursor")] public string? Cursor { get; set; } /// Name of the MCP server whose resources to enumerate. [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; } /// An MCP resource template descriptor (spec `ResourceTemplate`): an RFC 6570 URI template, name, and optional title, description, MIME type, icons, annotations, and metadata. Server-provided fields outside the standard descriptor shape are exposed under `additionalProperties`. [Experimental(Diagnostics.Experimental)] public sealed class McpResourceTemplate { /// Resource-template-level metadata. [JsonPropertyName("_meta")] public IDictionary? Meta { get; set; } /// Server-provided non-standard descriptor fields preserved from the MCP response. [JsonPropertyName("additionalProperties")] public IDictionary? AdditionalProperties { get; set; } /// Model/client annotations associated with this template. [JsonPropertyName("annotations")] public McpResourceAnnotations? Annotations { get; set; } /// Optional description of what this template is for. [JsonPropertyName("description")] public string? Description { get; set; } /// Icons associated with resources matching this template. [JsonPropertyName("icons")] public IList? Icons { get; set; } /// MIME type for resources matching this template, if uniform. [JsonPropertyName("mimeType")] public string? MimeType { get; set; } /// The programmatic name of the resource template. [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; /// Optional human-readable display title. [JsonPropertyName("title")] public string? Title { get; set; } /// An RFC 6570 URI template for constructing resource URIs. [JsonPropertyName("uriTemplate")] public string UriTemplate { get; set; } = string.Empty; } /// One page of resource templates advertised by the named MCP server. [Experimental(Diagnostics.Experimental)] public sealed class McpResourcesListTemplatesResult { /// Opaque cursor for the next page, if the server has more resource templates. [JsonPropertyName("nextCursor")] public string? NextCursor { get; set; } /// Resource templates advertised by the server (proxied MCP `resources/templates/list`). [JsonPropertyName("resourceTemplates")] public IList ResourceTemplates { get => field ??= []; set; } } /// MCP server whose resource templates to enumerate. [Experimental(Diagnostics.Experimental)] internal sealed class McpResourcesListTemplatesRequest { /// Opaque MCP pagination cursor from a prior `nextCursor` value. [JsonPropertyName("cursor")] public string? Cursor { get; set; } /// Name of the MCP server whose resource templates to enumerate. [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; } /// Session plugin metadata, with name, marketplace, optional version, and enabled state. [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; } /// RPC data type for SessionPluginsReload operations. [Experimental(Diagnostics.Experimental)] public sealed class SessionPluginsReloadRequest { /// When true, skip repo-level hooks during the hook reload. Use before folder trust is confirmed; load them post-trust via `sessions.loadDeferredRepoHooks`. [JsonPropertyName("deferRepoHooks")] public bool? DeferRepoHooks { get; set; } /// Re-run custom-agent discovery after refreshing plugins. Defaults to true. [JsonPropertyName("reloadCustomAgents")] public bool? ReloadCustomAgents { get; set; } /// Re-discover and relaunch subprocess extensions (including plugin-shipped extensions) after refreshing plugins. Defaults to true. Has no effect when the session has no active extension controller (e.g. extensions were not requested for the session). [JsonPropertyName("reloadExtensions")] public bool? ReloadExtensions { get; set; } /// Re-load user, plugin, and (subject to `deferRepoHooks`) repo hooks. Defaults to true. Has no effect when the host has not registered a hook reloader (e.g. remote sessions). [JsonPropertyName("reloadHooks")] public bool? ReloadHooks { get; set; } /// Reload MCP server connections after refreshing plugins. Defaults to true. [JsonPropertyName("reloadMcp")] public bool? ReloadMcp { get; set; } } /// RPC data type for SessionPluginsReloadRequestWithSession operations. [Experimental(Diagnostics.Experimental)] internal sealed class SessionPluginsReloadRequestWithSession { /// When true, skip repo-level hooks during the hook reload. Use before folder trust is confirmed; load them post-trust via `sessions.loadDeferredRepoHooks`. [JsonPropertyName("deferRepoHooks")] public bool? DeferRepoHooks { get; set; } /// Re-run custom-agent discovery after refreshing plugins. Defaults to true. [JsonPropertyName("reloadCustomAgents")] public bool? ReloadCustomAgents { get; set; } /// Re-discover and relaunch subprocess extensions (including plugin-shipped extensions) after refreshing plugins. Defaults to true. Has no effect when the session has no active extension controller (e.g. extensions were not requested for the session). [JsonPropertyName("reloadExtensions")] public bool? ReloadExtensions { get; set; } /// Re-load user, plugin, and (subject to `deferRepoHooks`) repo hooks. Defaults to true. Has no effect when the host has not registered a hook reloader (e.g. remote sessions). [JsonPropertyName("reloadHooks")] public bool? ReloadHooks { get; set; } /// Reload MCP server connections after refreshing plugins. Defaults to true. [JsonPropertyName("reloadMcp")] public bool? ReloadMcp { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Short-lived, rotating credential the caller must send on every request, in addition to `apiKey` if one is present. Omitted when the endpoint does not require one. [Experimental(Diagnostics.Experimental)] public sealed class ProviderSessionToken { /// When the token expires, if known. Callers should refresh by calling `getEndpoint` again before this time, or reactively on any 401/403 response from `baseUrl`. [JsonPropertyName("expiresAt")] public DateTimeOffset? ExpiresAt { get; set; } /// HTTP header name the token must be sent under. [JsonPropertyName("header")] public string Header { get; set; } = string.Empty; /// The model the token is bound to, when applicable. When set, the token is only valid for requests against this model. [JsonPropertyName("model")] public string? Model { get; set; } /// The short-lived token value. [JsonPropertyName("token")] public string Token { get; set; } = string.Empty; } /// A snapshot of the provider endpoint the session is currently configured to talk to. [Experimental(Diagnostics.Experimental)] public sealed class ProviderEndpoint { /// A credential the caller should use with this endpoint. Omitted only when the endpoint accepts unauthenticated requests. [JsonPropertyName("apiKey")] public string? ApiKey { get; set; } /// Base URL to pass to the LLM client library. [Url] [StringSyntax(StringSyntaxAttribute.Uri)] [JsonPropertyName("baseUrl")] public string BaseUrl { get; set; } = string.Empty; /// HTTP headers the caller must include on every outbound request. [JsonPropertyName("headers")] public IDictionary Headers { get => field ??= new Dictionary(); set; } /// Short-lived, rotating credential the caller must send on every request, in addition to `apiKey` if one is present. Omitted when the endpoint does not require one. [JsonPropertyName("sessionToken")] public ProviderSessionToken? SessionToken { get; set; } /// Transport to be used for provider requests. [JsonPropertyName("transport")] public ProviderEndpointTransport? Transport { get; set; } /// Provider family. Matches the `type` field of a BYOK provider config. [JsonPropertyName("type")] public ProviderEndpointType Type { get; set; } /// Wire API to be used, when required for the provider type. [JsonPropertyName("wireApi")] public ProviderEndpointWireApi? WireApi { get; set; } } /// RPC data type for SessionProviderGetEndpoint operations. [Experimental(Diagnostics.Experimental)] public sealed class SessionProviderGetEndpointRequest { /// Model identifier the caller intends to use against the returned endpoint. Used to pick the correct wire shape. Omit to use whichever model the session is currently using. [JsonPropertyName("modelId")] public string? ModelId { get; set; } } /// RPC data type for SessionProviderGetEndpointRequestWithSession operations. [Experimental(Diagnostics.Experimental)] internal sealed class SessionProviderGetEndpointRequestWithSession { /// Model identifier the caller intends to use against the returned endpoint. Used to pick the correct wire shape. Omit to use whichever model the session is currently using. [JsonPropertyName("modelId")] public string? ModelId { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// The selectable model entries synthesized for the models added by this call. [Experimental(Diagnostics.Experimental)] public sealed class ProviderAddResult { /// Synthesized selectable model entries for the newly added BYOK models, each under its provider-qualified selection id (`provider/id`). Empty when only providers were added. [JsonPropertyName("models")] public IList Models { get => field ??= []; set; } } /// A BYOK model definition referencing a named provider. [Experimental(Diagnostics.Experimental)] public sealed class ProviderModelConfig { /// Optional capability overrides (vision, tool_calls, reasoning, etc.). [JsonPropertyName("capabilities")] public ModelCapabilitiesOverride? Capabilities { get; set; } /// Provider-local model id, unique within its provider. The session-wide selection id (shown in the model list and passed to switchTo) is the provider-qualified `provider/id`. [JsonPropertyName("id")] public string Id { get; set; } = string.Empty; /// Maximum context window tokens for the model. [JsonPropertyName("maxContextWindowTokens")] public double? MaxContextWindowTokens { get; set; } /// Maximum output tokens for the model. [JsonPropertyName("maxOutputTokens")] public double? MaxOutputTokens { get; set; } /// Maximum prompt/input tokens for the model. [JsonPropertyName("maxPromptTokens")] public double? MaxPromptTokens { get; set; } /// Well-known base model id used for behavior/capability/config lookup. Defaults to `id`. [JsonPropertyName("modelId")] public string? ModelId { get; set; } /// Display name for model pickers. Defaults to the provider-qualified selection id (`provider/id`). [JsonPropertyName("name")] public string? Name { get; set; } /// Name of the configured provider that serves this model. [JsonPropertyName("provider")] public string Provider { get; set; } = string.Empty; /// The model name sent to the provider API for inference. Defaults to `id`. [JsonPropertyName("wireModel")] public string? WireModel { get; set; } } /// Azure-specific provider options. [Experimental(Diagnostics.Experimental)] public sealed class ProviderConfigAzure { /// API version. When set, uses the versioned deployment route. When omitted, uses the GA versionless v1 route. [JsonPropertyName("apiVersion")] public string? ApiVersion { get; set; } } /// External SDK input for a named custom model provider. Ingested by the native protocol boundary before host dispatch. [Experimental(Diagnostics.Experimental)] public sealed class NamedProviderConfig { /// Static API key used to authenticate provider requests. [JsonPropertyName("apiKey")] public string? ApiKey { get; set; } /// Azure authentication configuration for the provider. [JsonPropertyName("azure")] public ProviderConfigAzure? Azure { get; set; } /// Base URL for provider API requests. [JsonPropertyName("baseUrl")] public string BaseUrl { get; set; } = string.Empty; /// Static bearer token used to authenticate provider requests. [JsonPropertyName("bearerToken")] public string? BearerToken { get; set; } /// Whether the host supplies bearer tokens dynamically. [JsonPropertyName("hasBearerTokenProvider")] public bool? HasBearerTokenProvider { get; set; } /// Additional HTTP headers included with provider requests. [JsonPropertyName("headers")] public IDictionary? Headers { get; set; } /// Unique provider name used to qualify model selection IDs. [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; /// Transport used to communicate with the provider. [JsonPropertyName("transport")] public ProviderConfigTransport? Transport { get; set; } /// Provider protocol family. [JsonPropertyName("type")] public ProviderConfigType? Type { get; set; } /// Wire API used to communicate with the provider. [JsonPropertyName("wireApi")] public ProviderConfigWireApi? WireApi { get; set; } } /// BYOK providers and/or models to add to the session's registry at runtime. Both fields are optional; provide providers, models, or both. [Experimental(Diagnostics.Experimental)] internal sealed class ProviderAddRequest { /// BYOK model definitions to register. Each must reference a provider that is already registered or included in this same call. Selection ids (`provider/id`) must be unique across the registry. [JsonPropertyName("models")] public IList? Models { get; set; } /// Named BYOK provider connections to register, additive to any providers already in the registry. Each name must be unique across the registry and must not contain '/'. [JsonPropertyName("providers")] public IList? Providers { get; set; } /// 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 { /// Number of hooks loaded from installed plugins, returned when installedPlugins is updated. [JsonPropertyName("pluginHookCount")] public long? PluginHookCount { get; set; } /// Whether the operation succeeded. [JsonPropertyName("success")] public bool Success { get; set; } } /// Source descriptor for a `session.options.update` content-exclusion rule, with source name and type. [Experimental(Diagnostics.Experimental)] public sealed class OptionsUpdateAdditionalContentExclusionPolicyRuleSource { /// Name of the policy source. [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; /// Type of the policy source. [JsonPropertyName("type")] public string Type { get; set; } = string.Empty; } /// Single content-exclusion rule supplied to `session.options.update`, with paths, match conditions, and source. [Experimental(Diagnostics.Experimental)] public sealed class OptionsUpdateAdditionalContentExclusionPolicyRule { /// Conditions of which at least one must match. [JsonPropertyName("ifAnyMatch")] public IList? IfAnyMatch { get; set; } /// Conditions none of which may match. [JsonPropertyName("ifNoneMatch")] public IList? IfNoneMatch { get; set; } /// Path patterns covered by this rule. [JsonPropertyName("paths")] public IList Paths { get => field ??= []; set; } /// Source descriptor for a `session.options.update` content-exclusion rule, with source name and type. [JsonPropertyName("source")] public OptionsUpdateAdditionalContentExclusionPolicyRuleSource Source { get => field ??= new(); set; } } /// Content-exclusion policy supplied to `session.options.update`, with rules, last-updated data, and scope. [Experimental(Diagnostics.Experimental)] public sealed class OptionsUpdateAdditionalContentExclusionPolicy { /// Opaque policy update timestamp supplied by the host. [JsonPropertyName("last_updated_at")] public JsonElement LastUpdatedAt { get; set; } /// Content-exclusion rules to apply. [JsonPropertyName("rules")] public IList Rules { get => field ??= []; set; } /// Allowed values for the `OptionsUpdateAdditionalContentExclusionPolicyScope` enumeration. [JsonPropertyName("scope")] public OptionsUpdateAdditionalContentExclusionPolicyScope Scope { get; set; } } /// Options scoped to the built-in CAPI (Copilot API) provider. [Experimental(Diagnostics.Experimental)] public sealed class CapiSessionOptions { /// Routing preference for sessions whose model is `auto`. On create or cold resume, this establishes the preference sent as `tier` on CAPI `/auto` requests; when omitted on cold resume, the runtime restores the last committed preference. On resident resume, a different value requests a safe switch after resume succeeds and cannot change an in-flight turn. Successful switches are persisted for later cold resume. When no preference is supplied or restored, CAPI default routing is used. `fast` is an integrator-only latency preset, not a first-party GitHub Copilot product preference. [JsonPropertyName("autoTier")] public AutoTier? AutoTier { get; set; } /// Whether to use WebSocket transport for the CAPI Responses API. Enabled by default when the model advertises `ws:/responses` support; set to `false` to force the HTTP Responses transport in environments where WebSockets are blocked (e.g. behind a proxy). Setting this to `false` is equivalent to the `COPILOT_CLI_DISABLE_WEBSOCKET_RESPONSES` environment variable. [JsonPropertyName("enableWebSocketResponses")] public bool? EnableWebSocketResponses { get; set; } } /// Installed plugin record for a session, with marketplace, version, install time, enabled state, cache path, and source. [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; /// Absolute path of the marketplace directory a live plugin was resolved from. Present only on live, never-persisted records — those synthesized at session start for a directory/local marketplace, whose cache_path points at the real plugin directory on disk rather than a copy under the installed-plugins cache. Its presence is what marks a record as live, and no record carrying it is ever written to the persisted installedPlugins key. [JsonPropertyName("installed_from")] public string? InstalledFrom { get; set; } /// 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; } /// Per-plugin source fingerprint (a SHA-256 hash of the plugin's catalog source spec plus its resolved source subtree — NOT a Git commit SHA) captured at marketplace install/update time. Auto-update compares it against the freshly recomputed fingerprint to detect a content change that does not bump the version. Absent for pre-existing installs and for direct (non-marketplace) installs. [JsonPropertyName("source_sha")] public string? SourceSha { get; set; } /// Installed version, if known. [JsonPropertyName("version")] public string? Version { get; set; } } /// Custom model-provider configuration (BYOK). [Experimental(Diagnostics.Experimental)] public sealed class ProviderConfig { /// API key. Optional for local providers like Ollama. [JsonPropertyName("apiKey")] public string? ApiKey { get; set; } /// Azure-specific provider options. [JsonPropertyName("azure")] public ProviderConfigAzure? Azure { get; set; } /// API endpoint URL. [JsonPropertyName("baseUrl")] public string BaseUrl { get; set; } = string.Empty; /// Bearer token for authentication. Sets the Authorization header directly. Takes precedence over apiKey when both are set. [JsonPropertyName("bearerToken")] public string? BearerToken { get; set; } /// When true, the SDK client supplies bearer tokens on demand: the runtime calls the client-session `providerToken.getToken` callback before each request and applies the returned token as an `Authorization: Bearer <token>` header. This is the bearer/OAuth scheme used by Azure AD / managed-identity tokens and provider OAuth access tokens (including Anthropic's), not a provider-specific API-key header such as Anthropic's `x-api-key`. The token-acquiring function itself stays on the SDK side and is never serialized; only this flag crosses the wire. When set alongside `apiKey`/`bearerToken`, the callback takes precedence: the runtime applies the token returned by `providerToken.getToken` as the `Authorization: Bearer` header for each request and does not send the static credential. [JsonPropertyName("hasBearerTokenProvider")] public bool? HasBearerTokenProvider { get; set; } /// Custom HTTP headers to include in all outbound requests to the provider. [JsonPropertyName("headers")] public IDictionary? Headers { get; set; } /// Maximum context window tokens for the model. [JsonPropertyName("maxContextWindowTokens")] public double? MaxContextWindowTokens { get; set; } /// Maximum output tokens for the model. [JsonPropertyName("maxOutputTokens")] public double? MaxOutputTokens { get; set; } /// Maximum prompt/input tokens for the model. [JsonPropertyName("maxPromptTokens")] public double? MaxPromptTokens { get; set; } /// Overrides for model capabilities when they cannot be inferred from modelId. [JsonPropertyName("modelCapabilities")] public ModelCapabilitiesOverride? ModelCapabilities { get; set; } /// Well-known model ID used for capability lookup. When set, agent behavior config and token limits are inferred from this model. [JsonPropertyName("modelId")] public string? ModelId { get; set; } /// Provider name used for model and telemetry attribution. [JsonPropertyName("providerName")] public string? ProviderName { get; set; } /// Provider transport. Defaults to "http". [JsonPropertyName("transport")] public ProviderConfigTransport? Transport { get; set; } /// Provider type. Defaults to "openai" for generic OpenAI-compatible APIs. [JsonPropertyName("type")] public ProviderConfigType? Type { get; set; } /// Wire API format (openai/azure only). Defaults to "completions". [JsonPropertyName("wireApi")] public ProviderConfigWireApi? WireApi { get; set; } /// The model identifier sent to the provider API for inference (the "wire" model), as opposed to modelId which is the well-known base. [JsonPropertyName("wireModel")] public string? WireModel { get; set; } } /// Credential-injection capability flags applied while the sandbox is enabled. For the same capability independent of sandboxing, and matched to the credential's GitHub host, see `shell.credentials`; the two are additive. [Experimental(Diagnostics.Experimental)] public sealed class SandboxConfigAuth { /// Whether to export `GH_TOKEN` so the `gh` CLI authenticates inside the sandbox without the OS keyring the sandbox blocks. Default: false (opt-in). [JsonPropertyName("gh")] public bool? Gh { get; set; } /// Whether to inject git credentials as an `http.<url>.extraheader` so authenticated HTTPS git works inside the sandbox without the shell-based credential helper the sandbox blocks. github.com is served by the Copilot token; every other forge (Azure DevOps, GitHub Enterprise Server, GitLab, ...) by a credential the host resolves from the user's own helper before the sandbox is applied. Default: false (opt-in). [JsonPropertyName("git")] public bool? Git { get; set; } } /// macOS seatbelt experimental options. [Experimental(Diagnostics.Experimental)] public sealed class SandboxConfigUserPolicyExperimentalSeatbelt { /// Whether the macOS seatbelt profile may access the keychain. [JsonPropertyName("keychainAccess")] public bool? KeychainAccess { get; set; } } /// Platform-specific experimental policy fields. [Experimental(Diagnostics.Experimental)] public sealed class SandboxConfigUserPolicyExperimental { /// macOS seatbelt experimental options. [JsonPropertyName("seatbelt")] public SandboxConfigUserPolicyExperimentalSeatbelt? Seatbelt { get; set; } } /// Filesystem rules to merge into the base policy. [Experimental(Diagnostics.Experimental)] public sealed class SandboxConfigUserPolicyFilesystem { /// Whether to clear the policy when the session exits. [JsonPropertyName("clearPolicyOnExit")] public bool? ClearPolicyOnExit { get; set; } /// Paths explicitly denied. [JsonPropertyName("deniedPaths")] public IList? DeniedPaths { get; set; } /// Paths granted read-only access. [JsonPropertyName("readonlyPaths")] public IList? ReadonlyPaths { get; set; } /// Paths granted read/write access. [JsonPropertyName("readwritePaths")] public IList? ReadwritePaths { get; set; } } /// HTTP proxy configuration for sandboxed traffic. [Experimental(Diagnostics.Experimental)] public sealed class SandboxConfigUserPolicyNetworkProxy { /// Optional password for proxy authentication, combined with the URL at spawn time. The persisted value may be a literal password, a `${secret:…}` reference resolved from the OS keychain, or a `${VAR}`/`$VAR` environment reference; it is resolved just before the sandboxed process routes through the proxy. The /sandbox dialog stores a real password in the OS keychain and persists only a `${secret:…}` placeholder (never plaintext in settings.json); the field is masked in the dialog and redacted by /settings show. [JsonPropertyName("password")] public string? Password { get; set; } /// Proxy URL (e.g. http://proxy.example.com:8080). The port is optional and defaults to the scheme's standard port when omitted; an explicit port must be between 1 and 65535. Credentials must not be embedded here — a `user:pass@` authority is rejected; put them in the separate `username`/`password` fields. A credential-free http:// loopback proxy URL is routed through the localhost proxy automatically; loopback covers localhost and any *.localhost subdomain, the whole 127.0.0.0/8 range, ::1, and IPv4-mapped loopback (::ffff:127.0.0.1). An https:// URL, or one with a username/password set, is used as-is. [JsonPropertyName("url")] public string Url { get; set; } = string.Empty; /// Optional username for proxy authentication. Combined with the URL (and `password`) into `user:pass@host` when the sandboxed process routes through the proxy. [JsonPropertyName("username")] public string? Username { get; set; } } /// Network rules to merge into the base policy. [Experimental(Diagnostics.Experimental)] public sealed class SandboxConfigUserPolicyNetwork { /// Whether traffic to local/loopback addresses is allowed. [JsonPropertyName("allowLocalNetwork")] public bool? AllowLocalNetwork { get; set; } /// Whether outbound network traffic is allowed at all. [JsonPropertyName("allowOutbound")] public bool? AllowOutbound { get; set; } /// HTTP proxy for sandboxed process traffic. Linux restricts egress to the proxy endpoint, requires that endpoint to be reachable over IPv4 (the [::] dual-stack wildcard is accepted and routed through the IPv4 gateway), and does not support proxy credentials. macOS relies on applications honoring proxy environment variables. Windows also configures a per-AppContainer WinHTTP proxy, but enforcement depends on the application's networking stack. Configure supported credentials in the separate `username` and `password` fields. A credential-free http:// loopback URL uses the localhost proxy form, while an https:// or authenticated loopback URL uses the URL form. [JsonPropertyName("proxy")] public SandboxConfigUserPolicyNetworkProxy? Proxy { get; set; } } /// macOS seatbelt-specific options. [Experimental(Diagnostics.Experimental)] public sealed class SandboxConfigUserPolicySeatbelt { /// Whether the macOS seatbelt profile may access the keychain. [JsonPropertyName("keychainAccess")] public bool? KeychainAccess { get; set; } } /// User-managed sandbox policy fragment merged into the auto-discovered base policy. [Experimental(Diagnostics.Experimental)] public sealed class SandboxConfigUserPolicy { /// Deprecated legacy location for `seatbelt`; read only when the top-level `seatbelt` is absent. [JsonPropertyName("experimental")] public SandboxConfigUserPolicyExperimental? Experimental { get; set; } /// Filesystem rules to merge into the base policy. [JsonPropertyName("filesystem")] public SandboxConfigUserPolicyFilesystem? Filesystem { get; set; } /// Network rules to merge into the base policy. [JsonPropertyName("network")] public SandboxConfigUserPolicyNetwork? Network { get; set; } /// macOS seatbelt options to merge into the base policy. [JsonPropertyName("seatbelt")] public SandboxConfigUserPolicySeatbelt? Seatbelt { get; set; } } /// Resolved sandbox configuration. [Experimental(Diagnostics.Experimental)] public sealed class SandboxConfig { /// Whether to auto-add the current working directory to readwritePaths. Default: true. [JsonPropertyName("addCurrentWorkingDirectory")] public bool? AddCurrentWorkingDirectory { get; set; } /// Whether the agent may request that an individual command run outside the sandbox, which the host then approves or denies through the usual permission flow. A host capability flag rather than part of the policy: it is stripped from the effective spawn policy and only has an effect while `enabled` is true. Fail-closed, unlike the opt-out flags on this object: omitting it offers no bypass. Default: false (opt-in). [JsonPropertyName("allowBypass")] public bool? AllowBypass { get; set; } /// Whether to auto-grant read access to tool directories discovered on PATH and in toolchain environment variables (GOROOT, JAVA_HOME, VIRTUAL_ENV, and similar), and to common developer-tool caches, config, and toolchains. Writable grants cover scratch caches, the Unix GitHub CLI cache, and Cargo's registry, git store, and lock/tracker files. A relocated CARGO_HOME gets the same narrow split: registry and git are read-write; bin is read-only; the home root, config.toml, and credentials.toml stay ungranted. Set to false to disable every grant listed above; user-installed toolchains and caches then need explicit userPolicy.filesystem readonlyPaths and readwritePaths entries. The working directory (see addCurrentWorkingDirectory), temporary storage, session log paths, and system locations follow their own rules and stay granted. Default: true (enabled by default; set to false to opt out). [JsonPropertyName("allowDevToolAccess")] public bool? AllowDevToolAccess { get; set; } /// Credential-injection capability flags. [JsonPropertyName("auth")] public SandboxConfigAuth? Auth { get; set; } /// Whether sandboxing is enabled for the session. [JsonPropertyName("enabled")] public bool Enabled { get; set; } /// The `sandboxLspServers` counterpart of `managedMcpRoutingLocked`. [JsonInclude] [JsonPropertyName("managedLspRoutingLocked")] internal bool? ManagedLspRoutingLocked { get; set; } /// Set by the runtime when a managed policy forced `sandboxMcpServers` on and took the local opt-out away. Provenance rather than policy: it lets a sandbox startup failure point at the administrator instead of a setting the next managed merge would override, and it is ignored when comparing two configs for change. Only the managed merge may set it; a caller-supplied value is stripped. [JsonInclude] [JsonPropertyName("managedMcpRoutingLocked")] internal bool? ManagedMcpRoutingLocked { get; set; } /// Whether language servers the session launches are confined by the sandbox. Only an explicit `false` opts out. Ignored while `enabled` is false. Default: true (enabled by default; set to false to opt out). [JsonPropertyName("sandboxLspServers")] public bool? SandboxLspServers { get; set; } /// Whether MCP servers the session launches are confined by the sandbox. Only an explicit `false` opts out; doing so also lets remote-MCP egress leave the sandbox, so the flag and `enabled` are always read together. Ignored while `enabled` is false. Default: true (enabled by default; set to false to opt out). [JsonPropertyName("sandboxMcpServers")] public bool? SandboxMcpServers { get; set; } /// User-managed sandbox policy fragment merged into the auto-discovered base policy. [JsonPropertyName("userPolicy")] public SandboxConfigUserPolicy? UserPolicy { get; set; } } /// /// Command-scoped GitHub credential injection for the shell commands an agent runs. /// /// Each channel is opt-in and independent, and injection is scoped to the individual command /// spawn: the credential is resolved from the session's *current* authentication at every spawn /// and reaches only spawns whose script actually invokes `git` or `gh`. Because nothing is /// retained between spawns, replacing the session credential (`session.gitHubAuth.setCredentials`) /// changes what the next spawned command presents — which seeding a credential into the runtime /// process's own environment cannot do, since a child's environment is fixed at `exec`. /// /// The credential is matched to the host it authenticates to, so a github.com credential is never /// presented to a GitHub Enterprise host and vice versa. Where a channel cannot express that /// boundary it injects nothing rather than crossing it -- see `gh` below. /// /// This is independent of `sandboxConfig`: it is a decision about which identity the agent /// presents, not about what the agent may touch, and it works on every platform whether or not /// an OS sandboxing backend is available. `sandboxConfig.auth` remains the sandbox-scoped /// spelling and is additive with this one. /// [Experimental(Diagnostics.Experimental)] public sealed class ShellCredentials { /// /// Whether to authenticate the agent's `gh` commands as the session's GitHub credential, by /// exporting `GH_TOKEN` to a spawn that runs `gh`. Any inherited `gh` credential is removed from /// spawns that do not, so the credential stays command-scoped. /// /// Applies to a github.com credential only. `gh` picks its credential variable from the host a /// command targets rather than the one the credential belongs to, and the command can choose that /// target, so `GH_ENTERPRISE_TOKEN` would offer a single-tenant enterprise credential to every /// other enterprise host. A session whose credential is enterprise-scoped therefore runs `gh` /// unauthenticated; its `git` commands are unaffected, because `http.<host>.extraheader` is scoped /// to one host by construction. Default: false (opt-in). /// [JsonPropertyName("gh")] public bool? Gh { get; set; } /// /// Whether to authenticate the agent's `git` commands as the session's GitHub credential, by /// injecting an `http.<host>.extraheader` (plus `insteadOf` rewrites so SSH-spelled remotes for /// that host use the authenticated HTTPS transport). Applied only to a spawn that runs a /// remote-contacting `git` subcommand. Default: false (opt-in). /// [JsonPropertyName("git")] public bool? Git { get; set; } } /// A host-provided script sourced before each built-in shell command when its shell target matches the active shell. [Experimental(Diagnostics.Experimental)] public sealed class ShellInitScript { /// Path to the script to source. [JsonPropertyName("path")] public string Path { get; set; } = string.Empty; /// Built-in shell that may source this script. [JsonPropertyName("shell")] public ShellInitScriptShell Shell { get; set; } } /// Per-session settings for built-in shell tools. [Experimental(Diagnostics.Experimental)] public sealed class ShellOptions { /// Command-scoped GitHub credential injection for shell commands. [JsonPropertyName("credentials")] public ShellCredentials? Credentials { get; set; } /// Controls automatic non-interactive profile loading where supported. Explicit initScripts are unaffected. [JsonPropertyName("initProfile")] public ShellInitProfile? InitProfile { get; set; } /// /// Ordered host-provided script paths sourced before each built-in shell command when the /// entry's shell target matches the active shell. Use these for rc files, environment setup scripts, /// or other custom scripts. A script that returns a nonzero status is reported, and later scripts /// and the user command continue while the shell remains running. Because scripts are sourced into /// the command shell, `exit`, `exec`, failures under `set -e`, or other shell-terminating behavior /// can prevent continuation. Script standard output is preserved; Bash script stderr is discarded, /// PowerShell exception messages are replaced, and runtime-generated failure notices omit /// configured script paths. When sandboxing is enabled, each script must already be readable under /// the active sandbox filesystem policy. Pass an empty array to clear the list. /// [JsonPropertyName("initScripts")] public IList? InitScripts { get; set; } /// /// Flags passed to the active built-in shell process on startup, replacing its default flags. /// When omitted, the built-in Bash shell uses `--norc --noprofile`, /// and the built-in PowerShell shell uses `-NoProfile -NoLogo`. /// [JsonPropertyName("processFlags")] public IList? ProcessFlags { 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. [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 include instructions from every MCP server in the system prompt instead of only allowlisted servers. [JsonPropertyName("allowAllMcpServerInstructions")] public bool? AllowAllMcpServerInstructions { 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; } /// Options scoped to the built-in CAPI (Copilot API) provider. [JsonPropertyName("capi")] public CapiSessionOptions? Capi { 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; } /// Context tier for models with tiered pricing. The session uses this to derive effective `modelCapabilitiesOverrides` so compaction, truncation, token display, and request limits honor the selected tier. [JsonPropertyName("contextTier")] public OptionsUpdateContextTier? ContextTier { 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 enable loading of `.github/hooks/` filesystem hooks. Separate from the SDK callback hook mechanism. [JsonPropertyName("enableFileHooks")] public bool? EnableFileHooks { get; set; } /// Whether to enable host git operations (context resolution, child repo scanning, git info in system prompt). [JsonPropertyName("enableHostGitOperations")] public bool? EnableHostGitOperations { 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`. [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 enable cross-session store writes and reads. [JsonPropertyName("enableSessionStore")] public bool? EnableSessionStore { get; set; } /// Whether skill loading is enabled. Explicit false disables every source, including a bound SDK provider; changing the value invalidates the loaded skill snapshot. When omitted, creation falls back to enableConfigDiscovery unless an SDK skill provider is registered. [JsonPropertyName("enableSkills")] public bool? EnableSkills { 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; } /// Whether subagent callback events should be forwarded into the session event log sink. [JsonPropertyName("eventsLogIncludesSubagents")] public bool? EventsLogIncludesSubagents { get; set; } /// Built-in subagent names to exclude from this session. Excluded built-ins are hidden from agent discovery and cannot be dispatched unless a custom agent with the same name is available. [JsonPropertyName("excludedBuiltinAgents")] public IList? ExcludedBuiltinAgents { 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; } /// Built-in subagent names to include in this session. When specified, only these built-ins are available, subject to runtime availability and exclusions. Custom agents with the same name remain available. Set to null to remove the allowlist restriction. [JsonPropertyName("includedBuiltinAgents")] public IList? IncludedBuiltinAgents { get; set; } /// Built-in skill names to include in this session. When specified, only these runtime-bundled skills are available. Skills from other sources with the same name remain available. Set to null to remove the allowlist restriction. [JsonPropertyName("includedBuiltinSkills")] public IList? IncludedBuiltinSkills { 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; } /// Maximum decoded byte size of a single model-facing binary tool result (e.g. an image) persisted inline in session events and re-presented to the model on later turns / resume. Larger results are persisted as a metadata-only marker and shown to the model as a short text note. Defaults to 10 MB. [JsonPropertyName("maxInlineBinaryBytes")] public long? MaxInlineBinaryBytes { get; set; } /// The model ID to use for assistant turns. [JsonPropertyName("model")] public string? Model { get; set; } /// Per-property model capability overrides for the selected model. [JsonPropertyName("modelCapabilitiesOverrides")] public ModelCapabilitiesOverride? ModelCapabilitiesOverrides { get; set; } /// Organization-level custom instructions to inject into the system prompt. [JsonPropertyName("organizationCustomInstructions")] public string? OrganizationCustomInstructions { get; set; } /// Custom model-provider configuration (BYOK). [JsonPropertyName("provider")] public ProviderConfig? Provider { get; set; } /// Reasoning effort for the selected model. CAPI values are model-defined and validated against the selected model; BYOK providers may define additional values. When omitted, no effort override is applied. [JsonPropertyName("reasoningEffort")] public string? ReasoningEffort { get; set; } /// Reasoning summary mode for supported model clients. [JsonPropertyName("reasoningSummary")] public OptionsUpdateReasoningSummary? ReasoningSummary { get; set; } /// Whether the session is running in an interactive UI. [JsonPropertyName("runningInInteractiveMode")] public bool? RunningInInteractiveMode { get; set; } /// Resolved sandbox configuration. [JsonPropertyName("sandboxConfig")] public SandboxConfig? SandboxConfig { get; set; } /// Origin of the sandbox choice. The runtime uses this only for internal telemetry provenance; managed policy is derived independently. [JsonInclude] [JsonPropertyName("sandboxConfigSource")] internal SandboxConfigSource? SandboxConfigSource { get; set; } /// Replaces the session's capability set with the given list. Use to enable or disable capabilities mid-session (e.g., remove `memory` for reproducible scripted runs). Omit the field to leave the existing capability set unchanged. [JsonPropertyName("sessionCapabilities")] public IList? SessionCapabilities { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; /// Optional session limits. Pass null to clear the session limits. [JsonPropertyName("sessionLimits")] public SessionLimitsConfig? SessionLimits { get; set; } /// Per-session settings for built-in shell tools. [JsonPropertyName("shell")] public ShellOptions? Shell { get; set; } /// Use shell.initProfile instead. Shell init profile (`None` or `NonInteractive`). [EditorBrowsable(EditorBrowsableState.Never)] #if NET5_0_OR_GREATER [Obsolete("This member is deprecated and will be removed in a future version.", DiagnosticId = "GHCP001")] #endif [JsonPropertyName("shellInitProfile")] public string? ShellInitProfile { get; set; } /// PowerShell process flags applied to built-in and user-requested shell commands. [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; } /// Whether to skip embedding retrieval pipeline initialization and execution. [JsonPropertyName("skipEmbeddingRetrieval")] public bool? SkipEmbeddingRetrieval { get; set; } /// When true, the selected custom agent's prompt is not injected into the user message (skill context is still injected). Used by automation triggers where the agent prompt is already in the problem statement. [JsonPropertyName("suppressCustomAgentPrompt")] public bool? SuppressCustomAgentPrompt { get; set; } /// Controls how availableTools (allowlist) and excludedTools (denylist) combine when both are set. [JsonPropertyName("toolFilterPrecedence")] public OptionsUpdateToolFilterPrecedence? ToolFilterPrecedence { get; set; } /// Optional path for trajectory output. [JsonPropertyName("trajectoryFile")] public string? TrajectoryFile { get; set; } /// Output verbosity level for supported models. [JsonPropertyName("verbosity")] public Verbosity? Verbosity { 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; } } /// Discovered extension metadata, including source-qualified ID, name, discovery source, status, and optional process ID. [Experimental(Diagnostics.Experimental)] public sealed class Extension { /// Source-qualified ID (e.g., 'project:my-ext', 'user:auth-helper', 'plugin:my-plugin:my-ext'). [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/), user (~/.copilot/extensions/), plugin (installed plugin), or session (session-state/<id>/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; } /// Attachment union accepted by push input, covering files, directories, GitHub objects, blobs, snippets, and extension context. /// Polymorphic base type discriminated by type. [Experimental(Diagnostics.Experimental)] [JsonPolymorphic( TypeDiscriminatorPropertyName = "type", UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToBaseType)] [JsonDerivedType(typeof(PushAttachmentFile), "file")] [JsonDerivedType(typeof(PushAttachmentDirectory), "directory")] [JsonDerivedType(typeof(PushAttachmentSelection), "selection")] [JsonDerivedType(typeof(PushAttachmentGitHubReference), "github_reference")] [JsonDerivedType(typeof(PushAttachmentGitHubCommit), "github_commit")] [JsonDerivedType(typeof(PushAttachmentGitHubRelease), "github_release")] [JsonDerivedType(typeof(PushAttachmentGitHubActionsJob), "github_actions_job")] [JsonDerivedType(typeof(PushAttachmentGitHubRepository), "github_repository")] [JsonDerivedType(typeof(PushAttachmentGitHubFileDiff), "github_file_diff")] [JsonDerivedType(typeof(PushAttachmentGitHubTreeComparison), "github_tree_comparison")] [JsonDerivedType(typeof(PushAttachmentGitHubUrl), "github_url")] [JsonDerivedType(typeof(PushAttachmentGitHubFile), "github_file")] [JsonDerivedType(typeof(PushAttachmentGitHubSnippet), "github_snippet")] [JsonDerivedType(typeof(PushAttachmentBlob), "blob")] [JsonDerivedType(typeof(PushAttachmentExtensionContext), "extension_context")] public partial class PushAttachment { /// 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 PushAttachmentFileLineRange { /// 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 PushAttachmentFile : PushAttachment { /// [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 PushAttachmentFileLineRange? 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 PushAttachmentDirectory : PushAttachment { /// [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 PushAttachmentSelectionDetailsEnd { /// 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 PushAttachmentSelectionDetailsStart { /// 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 PushAttachmentSelectionDetails { /// End position of the selection. [JsonPropertyName("end")] public PushAttachmentSelectionDetailsEnd End { get => field ??= new(); set; } /// Start position of the selection. [JsonPropertyName("start")] public PushAttachmentSelectionDetailsStart Start { get => field ??= new(); set; } } /// Code selection attachment from an editor. /// The selection variant of . [Experimental(Diagnostics.Experimental)] public partial class PushAttachmentSelection : PushAttachment { /// [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 PushAttachmentSelectionDetails 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 PushAttachmentGitHubReference : PushAttachment { /// [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 PushAttachmentGitHubReferenceType 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; } } /// Pointer to a GitHub repository. [Experimental(Diagnostics.Experimental)] public sealed class PushGitHubRepoRef { /// Numeric GitHub repository id. [JsonPropertyName("id")] public long? Id { get; set; } /// Repository name (without owner). [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; /// Repository owner login (user or organization). [JsonPropertyName("owner")] public string Owner { get; set; } = string.Empty; } /// Pointer to a GitHub commit. /// The github_commit variant of . [Experimental(Diagnostics.Experimental)] public partial class PushAttachmentGitHubCommit : PushAttachment { /// [JsonIgnore] public override string Type => "github_commit"; /// First line of the commit message. [JsonPropertyName("message")] public required string Message { get; set; } /// Full commit SHA. [JsonPropertyName("oid")] public required string Oid { get; set; } /// Repository the commit belongs to. [JsonPropertyName("repo")] public required PushGitHubRepoRef Repo { get; set; } /// URL to the commit on GitHub. [JsonPropertyName("url")] public required string Url { get; set; } } /// Pointer to a GitHub release. /// The github_release variant of . [Experimental(Diagnostics.Experimental)] public partial class PushAttachmentGitHubRelease : PushAttachment { /// [JsonIgnore] public override string Type => "github_release"; /// Human-readable release name. [JsonPropertyName("name")] public required string Name { get; set; } /// Repository the release belongs to. [JsonPropertyName("repo")] public required PushGitHubRepoRef Repo { get; set; } /// Git tag the release is anchored to. [JsonPropertyName("tagName")] public required string TagName { get; set; } /// URL to the release on GitHub. [JsonPropertyName("url")] public required string Url { get; set; } } /// Pointer to a GitHub Actions job. /// The github_actions_job variant of . [Experimental(Diagnostics.Experimental)] public partial class PushAttachmentGitHubActionsJob : PushAttachment { /// [JsonIgnore] public override string Type => "github_actions_job"; /// Terminal conclusion of the job when finished (e.g., success, failure, cancelled). Absent for in-progress jobs. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("conclusion")] public string? Conclusion { get; set; } /// Job id within the workflow run. [JsonPropertyName("jobId")] public required long JobId { get; set; } /// Display name of the job. [JsonPropertyName("jobName")] public required string JobName { get; set; } /// Repository the workflow run belongs to. [JsonPropertyName("repo")] public required PushGitHubRepoRef Repo { get; set; } /// URL to the job on GitHub. [JsonPropertyName("url")] public required string Url { get; set; } /// Display name of the workflow the job ran in. [JsonPropertyName("workflowName")] public required string WorkflowName { get; set; } } /// Pointer to a GitHub repository. /// The github_repository variant of . [Experimental(Diagnostics.Experimental)] public partial class PushAttachmentGitHubRepository : PushAttachment { /// [JsonIgnore] public override string Type => "github_repository"; /// Short description of the repository. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("description")] public string? Description { get; set; } /// Git ref this attachment is anchored at (branch, tag, or commit). When absent the default branch is implied. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("ref")] public string? Ref { get; set; } /// Repository pointer. [JsonPropertyName("repo")] public required PushGitHubRepoRef Repo { get; set; } /// URL to the repository on GitHub. [JsonPropertyName("url")] public required string Url { get; set; } } /// One side of a file diff (head or base). [Experimental(Diagnostics.Experimental)] public sealed class PushAttachmentGitHubFileDiffSide { /// Repository-relative path to the file. [JsonPropertyName("path")] public string Path { get; set; } = string.Empty; /// Git ref (branch, tag, or commit SHA) the file is read at. [JsonPropertyName("ref")] public string Ref { get; set; } = string.Empty; /// Repository the file lives in. [JsonPropertyName("repo")] public PushGitHubRepoRef Repo { get => field ??= new(); set; } } /// Pointer to a single-file diff. At least one of `head` and `base` must be present. /// The github_file_diff variant of . [Experimental(Diagnostics.Experimental)] public partial class PushAttachmentGitHubFileDiff : PushAttachment { /// [JsonIgnore] public override string Type => "github_file_diff"; /// File location on the base side of the diff. Absent for additions. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("base")] public PushAttachmentGitHubFileDiffSide? Base { get; set; } /// File location on the head side of the diff. Absent for deletions. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("head")] public PushAttachmentGitHubFileDiffSide? Head { get; set; } /// URL to the diff on GitHub (e.g., a commit, compare, or PR-file URL). [JsonPropertyName("url")] public required string Url { get; set; } } /// One side of a tree comparison (head or base). [Experimental(Diagnostics.Experimental)] public sealed class PushAttachmentGitHubTreeComparisonSide { /// Repository the revision belongs to. [JsonPropertyName("repo")] public PushGitHubRepoRef Repo { get => field ??= new(); set; } /// Git revision (branch, tag, or commit SHA). [JsonPropertyName("revision")] public string Revision { get; set; } = string.Empty; } /// Pointer to a comparison between two git revisions. /// The github_tree_comparison variant of . [Experimental(Diagnostics.Experimental)] public partial class PushAttachmentGitHubTreeComparison : PushAttachment { /// [JsonIgnore] public override string Type => "github_tree_comparison"; /// Base side of the comparison. [JsonPropertyName("base")] public required PushAttachmentGitHubTreeComparisonSide Base { get; set; } /// Head side of the comparison. [JsonPropertyName("head")] public required PushAttachmentGitHubTreeComparisonSide Head { get; set; } /// URL to the comparison on GitHub. [JsonPropertyName("url")] public required string Url { get; set; } } /// Generic GitHub URL reference. /// The github_url variant of . [Experimental(Diagnostics.Experimental)] public partial class PushAttachmentGitHubUrl : PushAttachment { /// [JsonIgnore] public override string Type => "github_url"; /// URL to the GitHub resource. [JsonPropertyName("url")] public required string Url { get; set; } } /// Pointer to a file in a GitHub repository at a specific ref. /// The github_file variant of . [Experimental(Diagnostics.Experimental)] public partial class PushAttachmentGitHubFile : PushAttachment { /// [JsonIgnore] public override string Type => "github_file"; /// Repository-relative path to the file. [JsonPropertyName("path")] public required string Path { get; set; } /// Git ref the file is read at (branch, tag, or commit SHA). [JsonPropertyName("ref")] public required string Ref { get; set; } /// Repository the file lives in. [JsonPropertyName("repo")] public required PushGitHubRepoRef Repo { get; set; } /// URL to the file on GitHub. [JsonPropertyName("url")] public required string Url { get; set; } } /// Pointer to a line range inside a file in a GitHub repository. /// The github_snippet variant of . [Experimental(Diagnostics.Experimental)] public partial class PushAttachmentGitHubSnippet : PushAttachment { /// [JsonIgnore] public override string Type => "github_snippet"; /// Line range the snippet covers. [JsonPropertyName("lineRange")] public required PushAttachmentFileLineRange LineRange { get; set; } /// Repository-relative path to the file. [JsonPropertyName("path")] public required string Path { get; set; } /// Git ref the file is read at (branch, tag, or commit SHA). [JsonPropertyName("ref")] public required string Ref { get; set; } /// Repository the file lives in. [JsonPropertyName("repo")] public required PushGitHubRepoRef Repo { get; set; } /// URL to the snippet on GitHub (with line anchor). [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 PushAttachmentBlob : PushAttachment { /// [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; } } /// Slim input shape for extension_context attachments; identity fields are runtime-derived. /// The extension_context variant of . [Experimental(Diagnostics.Experimental)] public partial class PushAttachmentExtensionContext : PushAttachment { /// [JsonIgnore] public override string Type => "extension_context"; /// Caller-supplied JSON payload (required, may be null but not undefined). [JsonPropertyName("payload")] public required JsonElement Payload { get; set; } /// Human-readable composer pill label. [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("title")] public required string Title { get; set; } } /// Parameters for session.extensions.sendAttachmentsToMessage. [Experimental(Diagnostics.Experimental)] internal sealed class SendAttachmentsToMessageParams { /// Attachments to push into the next user-message turn. extension_context entries take the slim shape; standard variants take their full AttachmentSchema shape. [JsonPropertyName("attachments")] public IList Attachments { get => field ??= []; set; } /// Optional canvas instance binding the push for provenance. When supplied, the runtime resolves the canvas, verifies it is owned by the calling extension, and stamps canvasId/instanceId onto each extension_context entry. When omitted, no resolution runs and those fields stay unset on the attachment. [JsonPropertyName("instanceId")] public string? InstanceId { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// A tool name and arguments to execute through the session's native invocation pipeline. [Experimental(Diagnostics.Experimental)] internal sealed class ToolsExecuteRequest { /// Arguments supplied to the tool. [JsonPropertyName("arguments")] public JsonElement Arguments { get; set; } /// Name of the currently offered tool to execute. [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; /// Optional identifier used to correlate this invocation with its tool call. [JsonPropertyName("toolCallId")] public string? ToolCallId { get; set; } } /// Custom grammar input format accepted by a built-in tool. [Experimental(Diagnostics.Experimental)] public sealed class BuiltinToolFormat { /// Grammar definition accepted by the tool. [JsonPropertyName("definition")] public string Definition { get; set; } = string.Empty; /// Grammar syntax used by the format definition. [JsonPropertyName("syntax")] public string Syntax { get; set; } = string.Empty; /// Custom input-format discriminator. [JsonPropertyName("type")] public BuiltinToolFormatType Type { get; set; } } /// JSON Schema object accepted by a built-in tool. [Experimental(Diagnostics.Experimental)] public sealed class BuiltinToolInputSchema { /// Root type of the tool input schema. [JsonPropertyName("type")] public BuiltinToolInputSchemaType Type { get; set; } } /// Rust-owned metadata and input schema for a built-in tool. [Experimental(Diagnostics.Experimental)] public sealed class BuiltinToolDescriptor { /// Model-facing description of the tool's behavior. [JsonPropertyName("description")] public string Description { get; set; } = string.Empty; /// Optional custom input format used instead of a JSON Schema. [JsonPropertyName("format")] public BuiltinToolFormat? Format { get; set; } /// Whether the tool provides a specialized intention summary. [JsonPropertyName("hasSummariseIntention")] public bool HasSummariseIntention { get; set; } /// JSON Schema for the tool input, or null when the tool uses a custom format. [JsonPropertyName("inputSchema")] public BuiltinToolInputSchema? InputSchema { get; set; } /// Optional supplemental usage instructions for the tool. [JsonPropertyName("instructions")] public string? Instructions { get; set; } /// Whether the tool executes commands in a terminal. [JsonPropertyName("isTerminal")] public bool IsTerminal { get; set; } /// Stable name used to invoke the built-in tool. [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; /// Policy describing which tool metadata may be recorded without obfuscation. [JsonPropertyName("safeForTelemetry")] public JsonElement SafeForTelemetry { get; set; } /// Optional human-readable title for the tool. [JsonPropertyName("title")] public string? Title { get; set; } /// Optional tool category discriminator. [JsonPropertyName("type")] public string? Type { get; set; } } /// Rust-owned built-in tool descriptors for the session. [Experimental(Diagnostics.Experimental)] public sealed class ToolsGetBuiltinDescriptorsResult { /// Built-in tool descriptors materialized for the session. [JsonPropertyName("tools")] public IList Tools { get => field ??= []; set; } } /// Shell-specific names and description lines used to materialize built-in shell tool descriptors. [Experimental(Diagnostics.Experimental)] public sealed class ToolsShellDescriptorConfig { /// Additional model-facing shell description lines. [JsonPropertyName("descriptionLines")] public IList DescriptionLines { get => field ??= []; set; } /// Human-readable shell name. [JsonPropertyName("displayName")] public string DisplayName { get; set; } = string.Empty; /// Tool name used to list active shells. [JsonPropertyName("listShellsToolName")] public string ListShellsToolName { get; set; } = string.Empty; /// Tool name used to read shell output. [JsonPropertyName("readShellToolName")] public string ReadShellToolName { get; set; } = string.Empty; /// Tool name used to start shell commands. [JsonPropertyName("shellToolName")] public string ShellToolName { get; set; } = string.Empty; /// Stable shell type identifier. [JsonPropertyName("shellType")] public string ShellType { get; set; } = string.Empty; /// Tool name used to stop shell commands. [JsonPropertyName("stopShellToolName")] public string StopShellToolName { get; set; } = string.Empty; } /// Options controlling how Rust-owned built-in tool descriptors are materialized. [Experimental(Diagnostics.Experimental)] internal sealed class ToolsGetBuiltinDescriptorsRequest { /// Whether background task completion notifications are enabled. [JsonPropertyName("backgroundTaskNotificationsEnabled")] public bool? BackgroundTaskNotificationsEnabled { get; set; } /// Whether tool descriptors should include authoring metadata. [JsonPropertyName("includeAuthor")] public bool? IncludeAuthor { get; set; } /// Whether descriptors should favor fewer user-intervention prompts. [JsonPropertyName("reduceUserIntervention")] public bool? ReduceUserIntervention { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; /// Shell-specific names and description lines for shell tools. [JsonPropertyName("shellConfig")] public ToolsShellDescriptorConfig? ShellConfig { get; set; } /// Whether the configured shell supports PowerShell 7 syntax. [JsonPropertyName("shellSupportsPowerShell7Syntax")] public bool? ShellSupportsPowerShell7Syntax { get; set; } /// Default shell timeout in milliseconds. [JsonPropertyName("shellTimeoutMs")] public double? ShellTimeoutMs { get; set; } /// Whether semantic skill lookup is available. [JsonPropertyName("skillEmbeddingEnabled")] public bool? SkillEmbeddingEnabled { get; set; } } /// Task completion notification with summary from the agent. [Experimental(Diagnostics.Experimental)] public sealed class TaskCompleteData { /// Active autopilot objective ID evaluated by the completion reviewer. [JsonPropertyName("objectiveId")] public long? ObjectiveId { get; set; } /// Semantic completion decision. Absent on legacy events and invalid tool calls. [JsonPropertyName("outcome")] public TaskCompletionOutcome? Outcome { get; set; } /// Label-safe runtime rationale for the completion decision (e.g. a cancellation or pause/resume downgrade), when one applies. Reviewer-authored rationale is intentionally omitted here because this event has no IFC label channel; the reviewer's findings remain available through its own labeled sub-agent events. [JsonPropertyName("reason")] public string? Reason { get; set; } /// Whether the task was accepted as complete. False when validation failed or completion was rejected or blocked by the reviewer. [JsonPropertyName("success")] public bool? Success { get; set; } /// Summary of the completed task, provided by the agent. [JsonPropertyName("summary")] public string? Summary { get; set; } } /// Binary result returned by a tool for the model. [Experimental(Diagnostics.Experimental)] public sealed class ExternalToolTextResultForLlmBinaryResultsForLlm { /// Base64-encoded binary data. [Base64String] [JsonPropertyName("data")] public string Data { get; set; } = string.Empty; /// Human-readable description of the binary data. [JsonPropertyName("description")] public string? Description { get; set; } /// Optional metadata from the producing tool. [JsonPropertyName("metadata")] public IDictionary? Metadata { get; set; } /// MIME type of the binary data. [JsonPropertyName("mimeType")] public string MimeType { get; set; } = string.Empty; /// Binary result type discriminator. Use "image" for images and "resource" for other binary data. [JsonPropertyName("type")] public ExternalToolTextResultForLlmBinaryResultsForLlmType Type { get; set; } } /// A content block within a tool result, which may be text, terminal output, image, audio, or a resource. /// Polymorphic base type discriminated by type. [Experimental(Diagnostics.Experimental)] [JsonPolymorphic( TypeDiscriminatorPropertyName = "type", UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToBaseType)] [JsonDerivedType(typeof(ExternalToolTextResultForLlmContentText), "text")] [JsonDerivedType(typeof(ExternalToolTextResultForLlmContentTerminal), "terminal")] [JsonDerivedType(typeof(ExternalToolTextResultForLlmContentShellExit), "shell_exit")] [JsonDerivedType(typeof(ExternalToolTextResultForLlmContentImage), "image")] [JsonDerivedType(typeof(ExternalToolTextResultForLlmContentAudio), "audio")] [JsonDerivedType(typeof(ExternalToolTextResultForLlmContentResourceLink), "resource_link")] [JsonDerivedType(typeof(ExternalToolTextResultForLlmContentResource), "resource")] public partial class ExternalToolTextResultForLlmContent { /// The type discriminator. [JsonPropertyName("type")] public virtual string Type { get; set; } = string.Empty; } /// Plain text content block. /// The text variant of . [Experimental(Diagnostics.Experimental)] public partial class ExternalToolTextResultForLlmContentText : ExternalToolTextResultForLlmContent { /// [JsonIgnore] public override string Type => "text"; /// The text content. [JsonPropertyName("text")] public required string Text { get; set; } } /// Terminal/shell output content block with optional exit code and working directory. /// The terminal variant of . [Experimental(Diagnostics.Experimental)] public partial class ExternalToolTextResultForLlmContentTerminal : ExternalToolTextResultForLlmContent { /// [JsonIgnore] public override string Type => "terminal"; /// Working directory where the command was executed. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("cwd")] public string? Cwd { get; set; } /// Process exit code, if the command has completed. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("exitCode")] public long? ExitCode { get; set; } /// Terminal/shell output text. [JsonPropertyName("text")] public required string Text { get; set; } } /// Shell command exit metadata with optional output preview. /// The shell_exit variant of . [Experimental(Diagnostics.Experimental)] public partial class ExternalToolTextResultForLlmContentShellExit : ExternalToolTextResultForLlmContent { /// [JsonIgnore] public override string Type => "shell_exit"; /// Working directory where the shell command was executed. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("cwd")] public string? Cwd { get; set; } /// Exit code from the completed shell command. [JsonPropertyName("exitCode")] public required long ExitCode { get; set; } /// Path reported in the shell session's filesystem namespace when shell output exceeded the configured large-output threshold. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("outputFilePath")] public string? OutputFilePath { get; set; } /// Output associated with this shell command, if available. May be partial, truncated, or a preview; not guaranteed to be full output. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("outputPreview")] public string? OutputPreview { get; set; } /// Whether outputPreview is known to be incomplete or truncated. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("outputTruncated")] public bool? OutputTruncated { get; set; } /// Shell id, as assigned by Copilot runtime. [JsonPropertyName("shellId")] public required string ShellId { get; set; } } /// Image content block with base64-encoded data. /// The image variant of . [Experimental(Diagnostics.Experimental)] public partial class ExternalToolTextResultForLlmContentImage : ExternalToolTextResultForLlmContent { /// [JsonIgnore] public override string Type => "image"; /// Base64-encoded image data. [Base64String] [JsonPropertyName("data")] public required string Data { get; set; } /// MIME type of the image (e.g., image/png, image/jpeg). [JsonPropertyName("mimeType")] public required string MimeType { get; set; } } /// Audio content block with base64-encoded data. /// The audio variant of . [Experimental(Diagnostics.Experimental)] public partial class ExternalToolTextResultForLlmContentAudio : ExternalToolTextResultForLlmContent { /// [JsonIgnore] public override string Type => "audio"; /// Base64-encoded audio data. [Base64String] [JsonPropertyName("data")] public required string Data { get; set; } /// MIME type of the audio (e.g., audio/wav, audio/mpeg). [JsonPropertyName("mimeType")] public required string MimeType { get; set; } } /// Icon image for a resource. [Experimental(Diagnostics.Experimental)] public sealed class ExternalToolTextResultForLlmContentResourceLinkIcon { /// MIME type of the icon image. [JsonPropertyName("mimeType")] public string? MimeType { get; set; } /// Available icon sizes (e.g., ['16x16', '32x32']). [JsonPropertyName("sizes")] public IList? Sizes { get; set; } /// URL or path to the icon image. [JsonPropertyName("src")] public string Src { get; set; } = string.Empty; /// Theme variant this icon is intended for. [JsonPropertyName("theme")] public ExternalToolTextResultForLlmContentResourceLinkIconTheme? Theme { get; set; } } /// Resource link content block referencing an external resource. /// The resource_link variant of . [Experimental(Diagnostics.Experimental)] public partial class ExternalToolTextResultForLlmContentResourceLink : ExternalToolTextResultForLlmContent { /// [JsonIgnore] public override string Type => "resource_link"; /// Human-readable description of the resource. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("description")] public string? Description { get; set; } /// Icons associated with this resource. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("icons")] public IList? Icons { get; set; } /// MIME type of the resource content. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("mimeType")] public string? MimeType { get; set; } /// Resource name identifier. [JsonPropertyName("name")] public required string Name { get; set; } /// Size of the resource in bytes. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("size")] public long? Size { get; set; } /// Human-readable display title for the resource. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("title")] public string? Title { get; set; } /// URI identifying the resource. [JsonPropertyName("uri")] public required string Uri { get; set; } } /// Embedded resource content block with inline text or binary data. /// The resource variant of . [Experimental(Diagnostics.Experimental)] public partial class ExternalToolTextResultForLlmContentResource : ExternalToolTextResultForLlmContent { /// [JsonIgnore] public override string Type => "resource"; /// The embedded resource contents, either text or base64-encoded binary. [JsonPropertyName("resource")] public required JsonElement Resource { get; set; } } /// A message injected by a tool result. [Experimental(Diagnostics.Experimental)] public sealed class ToolResultNewMessage { /// Message content to inject after the tool result. [JsonPropertyName("content")] public string Content { get; set; } = string.Empty; /// Source attributed to the injected message. [JsonPropertyName("source")] public string Source { get; set; } = string.Empty; } /// RPC data type for TaskCompletionDecision operations. [Experimental(Diagnostics.Experimental)] public sealed class TaskCompletionDecision { /// Objective eligibility token captured when the decision was evaluated. [JsonPropertyName("completionEligibilityToken")] public long? CompletionEligibilityToken { get; set; } /// Whether completion was accepted after the reviewer-rejection budget was exhausted. [JsonPropertyName("completionRejectionBudgetExhausted")] public bool? CompletionRejectionBudgetExhausted { get; set; } /// Active autopilot objective evaluated by the completion reviewer. [JsonPropertyName("objectiveId")] public long? ObjectiveId { get; set; } /// Semantic result of evaluating the task completion request. [JsonPropertyName("outcome")] public TaskCompletionOutcome Outcome { get; set; } /// Rationale for the completion decision, when one is available. [JsonPropertyName("reason")] public string? Reason { get; set; } /// Whether the rationale was derived from completion-reviewer output. [JsonPropertyName("reviewerDerived")] public bool? ReviewerDerived { get; set; } /// Information-flow metadata captured from the completion reviewer. [JsonPropertyName("reviewerResultMeta")] public JsonElement? ReviewerResultMeta { get; set; } } /// Expanded canonical result returned by a session tool. [Experimental(Diagnostics.Experimental)] public sealed class ToolResultExpanded { /// Base64-encoded binary results returned to the model. [JsonPropertyName("binaryResultsForLlm")] public IList? BinaryResultsForLlm { get; set; } /// Sources returned by the tool that the model may cite. [JsonPropertyName("citableSources")] public IList? CitableSources { get; set; } /// Structured content blocks returned to the model. [JsonPropertyName("contents")] public IList? Contents { get; set; } /// Error message for an unsuccessful execution. [JsonPropertyName("error")] public string? Error { get; set; } /// Metadata propagated with the tool result, including information-flow labels. [JsonPropertyName("mcpMeta")] public IDictionary? McpMeta { get; set; } /// Messages to inject after the tool result. [JsonPropertyName("newMessages")] public IList? NewMessages { get; set; } /// Whether post-tool-use failure hooks have already processed this result. [JsonPropertyName("postToolUseFailureHooksProcessed")] public bool? PostToolUseFailureHooksProcessed { get; set; } /// Execution outcome classification. [JsonPropertyName("resultType")] public ToolResultType ResultType { get; set; } /// Detailed log content available for session display. [JsonPropertyName("sessionLog")] public string? SessionLog { get; set; } /// Skill invocation metadata produced by the tool. [JsonPropertyName("skillInvocation")] public JsonElement? SkillInvocation { get; set; } /// Whether large-output post-processing should be skipped. [JsonPropertyName("skipLargeOutputProcessing")] public bool? SkipLargeOutputProcessing { get; set; } /// Structured result content in addition to the model-facing text. [JsonPropertyName("structuredContent")] public JsonElement? StructuredContent { get; set; } /// Completion-review decision produced by the task-completion tool. [JsonPropertyName("taskCompletionDecision")] public TaskCompletionDecision? TaskCompletionDecision { get; set; } /// Text result returned to the model. [JsonPropertyName("textResultForLlm")] public string TextResultForLlm { get; set; } = string.Empty; /// Deferred tool names made available by this result. [JsonPropertyName("toolReferences")] public IList? ToolReferences { get; set; } /// Tool-specific telemetry payload. [JsonPropertyName("toolTelemetry")] public JsonElement? ToolTelemetry { get; set; } /// Optional UI resource produced by the tool. [JsonPropertyName("uiResource")] public JsonElement? UiResource { get; set; } } /// Task-completion tool arguments and final result used to build a label-safe session event payload. [Experimental(Diagnostics.Experimental)] internal sealed class ToolsTaskCompleteEventDataRequest { /// Final expanded result returned by the task_complete tool. [JsonPropertyName("finalResult")] public ToolResultExpanded FinalResult { get => field ??= new(); set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; /// Arguments supplied to the completed task_complete tool call. [JsonPropertyName("toolArgs")] public JsonElement ToolArgs { get; set; } } /// 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; } /// Lightweight metadata for a currently initialized session tool. [Experimental(Diagnostics.Experimental)] public sealed class CurrentToolMetadata { /// Whether the tool is loaded on demand via tool search. [JsonPropertyName("deferLoading")] public bool? DeferLoading { get; set; } /// Tool description. [JsonPropertyName("description")] public string Description { get; set; } = string.Empty; /// JSON Schema for tool input. [JsonPropertyName("input_schema")] public IDictionary? InputSchema { get; set; } /// MCP server name for MCP-backed tools. [JsonPropertyName("mcpServerName")] public string? McpServerName { get; set; } /// Raw MCP tool name for MCP-backed tools. [JsonPropertyName("mcpToolName")] public string? McpToolName { get; set; } /// Model-facing tool name. [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; /// Optional MCP/config namespaced tool name. [JsonPropertyName("namespacedName")] public string? NamespacedName { get; set; } } /// Current lightweight tool metadata snapshot for the session. [Experimental(Diagnostics.Experimental)] public sealed class ToolsGetCurrentMetadataResult { /// Current tool metadata, or null when tools have not been initialized yet. [JsonPropertyName("tools")] public IList? Tools { get; set; } } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionToolsGetCurrentMetadataRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Empty result after replacing the calling connection's externally implemented tools. [Experimental(Diagnostics.Experimental)] public sealed class ToolsSetResult { } /// Serializable definition of a caller-implemented tool whose execution is handled over the SDK connection. [Experimental(Diagnostics.Experimental)] public sealed class ProtocolExternalToolDefinition { /// Tool-loading deferral policy. [JsonPropertyName("defer")] public ProtocolExternalToolDefer? Defer { get; set; } /// Model-visible explanation of what the tool does. [JsonPropertyName("description")] public string Description { get; set; } = string.Empty; /// Whether the tool executes commands in a terminal. [JsonPropertyName("isTerminal")] public bool? IsTerminal { get; set; } /// Optional caller-defined metadata associated with the tool. [JsonPropertyName("metadata")] public IDictionary? Metadata { get; set; } /// Unique model-visible tool name. [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; /// Whether this definition replaces a built-in tool with the same name. [JsonPropertyName("overridesBuiltInTool")] public bool? OverridesBuiltInTool { get; set; } /// JSON Schema describing the tool's input arguments. [JsonPropertyName("parameters")] public IDictionary? Parameters { get; set; } /// Whether execution bypasses the normal tool permission prompt. [JsonPropertyName("skipPermission")] public bool? SkipPermission { get; set; } /// Optional human-readable display title. [JsonPropertyName("title")] public string? Title { get; set; } } /// Complete externally implemented tool list for the calling connection. An empty list removes every tool previously supplied by that connection. [Experimental(Diagnostics.Experimental)] internal sealed class ToolsSetRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; /// Complete replacement list for the calling connection. [JsonPropertyName("tools")] public IList Tools { get => field ??= []; set; } } /// Empty result after applying subagent settings. [Experimental(Diagnostics.Experimental)] public sealed class ToolsUpdateSubagentSettingsResult { } /// Subagent model, reasoning effort, context tier, and auto-invocation settings. [Experimental(Diagnostics.Experimental)] public sealed class SubagentSettingsEntry { /// Whether this agent's runtime-defined proactive invocation prompting is enabled, if supported. Currently consumed by the built-in rubber-duck agent. [JsonPropertyName("autoInvoke")] public bool? AutoInvoke { get; set; } /// Context tier override for matching subagents. [JsonPropertyName("contextTier")] public SubagentSettingsEntryContextTier? ContextTier { get; set; } /// Reasoning effort override for matching subagents. [JsonPropertyName("effortLevel")] public string? EffortLevel { get; set; } /// Model override for matching subagents. [JsonPropertyName("model")] public string? Model { get; set; } /// Whether the configured model strategy is preferred or required. [JsonPropertyName("modelPolicy")] public AgentModelPolicy? ModelPolicy { get; set; } } /// Configured per-agent subagent overrides. public sealed class UpdateSubagentSettingsRequestSubagents { /// Per-agent settings keyed by subagent agent_type. [JsonPropertyName("agents")] public IDictionary? Agents { get; set; } /// Names of subagents the user has turned off; they cannot be dispatched. [JsonPropertyName("disabledSubagents")] public IList? DisabledSubagents { get; set; } /// Maximum number of subagents that can run concurrently; applies to usage-based billing users only. [JsonPropertyName("maxConcurrency")] public int? MaxConcurrency { get; set; } /// Maximum subagent nesting depth; applies to usage-based billing users only. [JsonPropertyName("maxDepth")] public int? MaxDepth { get; set; } } /// Subagent settings to apply to the current session. [Experimental(Diagnostics.Experimental)] internal sealed class UpdateSubagentSettingsRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; /// Subagent settings to apply, or null to clear the live session override. [JsonPropertyName("subagents")] public UpdateSubagentSettingsRequestSubagents? Subagents { get; set; } } /// RPC data type for SessionCommandsList operations. [Experimental(Diagnostics.Experimental)] public sealed class SessionCommandsListRequest { /// 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; } } /// RPC data type for SessionCommandsListRequestWithSession operations. [Experimental(Diagnostics.Experimental)] internal sealed class SessionCommandsListRequestWithSession { /// 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, completion, or subcommand selection). /// 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")] [JsonDerivedType(typeof(SlashCommandInvocationResultAddTimelineEntry), "add-timeline-entry")] [JsonDerivedType(typeof(SlashCommandInvocationResultShowDialog), "show-dialog")] [JsonDerivedType(typeof(SlashCommandInvocationResultSetModel), "set-model")] [JsonDerivedType(typeof(SlashCommandInvocationResultSetPlanModel), "set-plan-model")] public partial class SlashCommandInvocationResult { /// The type discriminator. [JsonPropertyName("kind")] public virtual string Kind { get; set; } = string.Empty; } /// Slash-command invocation result containing text output plus Markdown/ANSI rendering flags. /// 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; } } /// Slash-command invocation result that submits an agent prompt, with display prompt, optional mode, optional user-facing notice, and settings-change flag. /// 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; } /// Optional user-facing notice to show before the prompt is submitted. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("notice")] public string? Notice { 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; } } /// Slash-command invocation result indicating completion, with optional message and settings-change flag. /// 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; } /// Optional target session mode applied without submitting an agent prompt. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("mode")] public SessionMode? Mode { 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; } } /// Selectable slash-command subcommand option with name, description, and optional group label. [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; } /// Slash-command invocation result asking the client to present subcommand options for a parent command. /// 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; } } /// RPC data type for SlashCommandTimelineEntry operations. [Experimental(Diagnostics.Experimental)] public sealed class SlashCommandTimelineEntry { /// What the user must do to recover, when the entry reports a failure the runtime knows an action for. The `text` never names a client affordance, so a client that offers one renders it from this value. [JsonPropertyName("remediation")] public RemediationAction? Remediation { get; set; } /// Text displayed for the timeline entry. [JsonPropertyName("text")] public string Text { get; set; } = string.Empty; /// Timeline entry presentation type. [JsonPropertyName("type")] public string Type { get; set; } = string.Empty; /// Optional URL associated with the timeline entry. [JsonPropertyName("url")] public string? Url { get; set; } } /// The add-timeline-entry variant of . [Experimental(Diagnostics.Experimental)] public partial class SlashCommandInvocationResultAddTimelineEntry : SlashCommandInvocationResult { /// [JsonIgnore] public override string Kind => "add-timeline-entry"; /// Timeline entry the host should append. [JsonPropertyName("entry")] public required SlashCommandTimelineEntry Entry { get; set; } /// Optional text the host should prefill into the input editor. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("prefillInput")] public string? PrefillInput { get; set; } /// Whether command execution changed persisted runtime settings. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("runtimeSettingsChanged")] public bool? RuntimeSettingsChanged { get; set; } } /// RPC data type for SlashCommandModelPickerDialog operations. [Experimental(Diagnostics.Experimental)] public sealed class SlashCommandModelPickerDialog { /// Discriminator for a model-picker dialog. [JsonPropertyName("kind")] public string Kind { get; set; } = string.Empty; /// Model that should be enabled before it can be selected. [JsonPropertyName("modelToEnable")] public string? ModelToEnable { get; set; } /// Settings scope the picker should modify. [JsonPropertyName("scope")] public string? Scope { get; set; } /// Model-selection target represented by the picker. [JsonPropertyName("target")] public string? Target { get; set; } } /// The show-dialog variant of . [Experimental(Diagnostics.Experimental)] public partial class SlashCommandInvocationResultShowDialog : SlashCommandInvocationResult { /// [JsonIgnore] public override string Kind => "show-dialog"; /// Dialog the host should display. [JsonPropertyName("dialog")] public required SlashCommandModelPickerDialog Dialog { get; set; } /// Whether command execution changed persisted runtime settings. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("runtimeSettingsChanged")] public bool? RuntimeSettingsChanged { get; set; } } /// User-settings snapshot to restore if the host cancels the model switch. public sealed class SlashCommandInvocationResultSetModelRevertOnCancel { } /// The set-model variant of . [Experimental(Diagnostics.Experimental)] public partial class SlashCommandInvocationResultSetModel : SlashCommandInvocationResult { /// [JsonIgnore] public override string Kind => "set-model"; /// Model selected by the command. [JsonPropertyName("model")] public required string Model { get; set; } /// Reasoning effort selected for the model. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("reasoningEffort")] public string? ReasoningEffort { get; set; } /// Repository settings scope modified by the command. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("repoScope")] public string? RepoScope { get; set; } /// User-settings snapshot to restore if the host cancels the model switch. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("revertOnCancel")] public SlashCommandInvocationResultSetModelRevertOnCancel? RevertOnCancel { get; set; } /// Whether command execution changed persisted runtime settings. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("runtimeSettingsChanged")] public bool? RuntimeSettingsChanged { get; set; } /// Settings scope modified by the command. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("scope")] public string? Scope { get; set; } /// User-facing warning produced while selecting the model. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("warning")] public string? Warning { get; set; } } /// The set-plan-model variant of . [Experimental(Diagnostics.Experimental)] public partial class SlashCommandInvocationResultSetPlanModel : SlashCommandInvocationResult { /// [JsonIgnore] public override string Kind => "set-plan-model"; /// User-facing confirmation message for the plan-model selection. [JsonPropertyName("message")] public required string Message { get; set; } /// Dedicated model selected for plan mode. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("planModel")] public string? PlanModel { get; set; } /// Whether command execution changed persisted runtime settings. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("runtimeSettingsChanged")] public bool? RuntimeSettingsChanged { 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; /// Optional client surface that initiated the invocation. [JsonPropertyName("origin")] public CommandsInvocationOrigin? Origin { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Whether finalizing the invocation effect succeeded, and the failure reason when it did not. [Experimental(Diagnostics.Experimental)] internal sealed class CommandsFinalizeInvocationEffectResult { /// Failure reason when the invocation effect could not be finalized. [JsonPropertyName("error")] public string? Error { get; set; } /// Whether the pending invocation effect was finalized successfully. [JsonPropertyName("success")] public bool Success { get; set; } } /// The slash-command result object that produced the pending effect, echoed back unchanged. public sealed class CommandsFinalizeInvocationEffectRequestEffect { } /// The pending slash-command invocation effect to finalize, plus whether the host applied or cancelled it. [Experimental(Diagnostics.Experimental)] internal sealed class CommandsFinalizeInvocationEffectRequest { /// The slash-command result object that produced the pending effect, echoed back unchanged. [JsonPropertyName("effect")] public CommandsFinalizeInvocationEffectRequestEffect Effect { get => field ??= new(); set; } /// Whether the host applied or cancelled the pending invocation effect. [JsonPropertyName("outcome")] public CommandsInvocationEffectOutcome Outcome { get; set; } /// 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; /// Optional user-facing text for the queue row. The command string is shown when omitted. [JsonPropertyName("displayText")] public string? DisplayText { get; set; } /// 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; } /// Telemetry engagement ID for the session, when available. [Experimental(Diagnostics.Experimental)] public sealed class SessionTelemetryEngagement { /// Current telemetry engagement ID, when available. [JsonPropertyName("engagementId")] public string? EngagementId { get; set; } } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionTelemetryGetEngagementIdRequest { /// 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; } /// Completed transient query. Ordered chunks and the terminal outcome are also delivered through `ui.ephemeral_query` session events while it runs. [Experimental(Diagnostics.Experimental)] public sealed class UIEphemeralQueryResult { /// Answer returned by the model. [JsonPropertyName("answer")] public string Answer { get; set; } = string.Empty; } /// Transient question to answer without adding it to conversation history. [Experimental(Diagnostics.Experimental)] internal sealed class UIEphemeralQueryRequest { /// Question to answer from the current conversation context. [JsonPropertyName("question")] public string Question { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// MCP response metadata. public sealed class UIElicitationResponseMeta { } /// The elicitation response (accept with form values, decline, or cancel). [Experimental(Diagnostics.Experimental)] public sealed class UIElicitationResponse { /// MCP response metadata. [JsonPropertyName("_meta")] public UIElicitationResponseMeta? Meta { get; set; } /// 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; } } /// MCP request metadata. public sealed class UIElicitationRequestMeta { } /// 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; } /// Metadata controlling an MCP task's lifetime. [Experimental(Diagnostics.Experimental)] public sealed class McpTaskMetadata { /// Task time-to-live. [JsonPropertyName("ttl")] public long? Ttl { get; set; } } /// Prompt message and JSON schema describing the form fields to elicit from the user. [Experimental(Diagnostics.Experimental)] internal sealed class UIElicitationRequest { /// MCP request metadata. [JsonPropertyName("_meta")] public UIElicitationRequestMeta? Meta { get; set; } /// Message describing what information is needed from the user. [JsonPropertyName("message")] public string Message { get; set; } = string.Empty; /// Elicitation mode. Omitted and form are equivalent for structured elicitation. [JsonPropertyName("mode")] public McpElicitationFormMode? Mode { get; set; } /// 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; /// MCP task metadata. [JsonPropertyName("task")] public McpTaskMetadata? Task { get; set; } } /// 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; } } /// User response for a pending user-input request, with answer text and whether it was typed freeform. [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; /// User response for a pending user-input request, with answer text and whether it was typed freeform. [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; } /// The user's selected action for an exhausted session limit. [Experimental(Diagnostics.Experimental)] public sealed class UISessionLimitsExhaustedResponse { /// Action selected by the user. [JsonPropertyName("action")] public UISessionLimitsExhaustedResponseAction Action { get; set; } /// AI Credits to add to the current max when action is 'add'. [JsonPropertyName("additionalAiCredits")] public double? AdditionalAiCredits { get; set; } /// New absolute max AI Credits when action is 'set'. [JsonPropertyName("maxAiCredits")] public double? MaxAiCredits { get; set; } } /// Request ID of a pending `session_limits_exhausted.requested` event and the user's selected limit action. [Experimental(Diagnostics.Experimental)] internal sealed class UIHandlePendingSessionLimitsExhaustedRequest { /// The unique request ID from the session_limits_exhausted.requested event. [JsonPropertyName("requestId")] public string RequestId { get; set; } = string.Empty; /// The selected session-limit action. [JsonPropertyName("response")] public UISessionLimitsExhaustedResponse Response { get => field ??= new(); set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// User response for a pending exit-plan-mode request, with approval state, selected action, auto-approve flag, and feedback. [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; } /// When true, the agent is instructed to end its turn without starting implementation so the client can restore the session model and auto-submit a fresh implementation turn on it. Set only when a distinct plan configuration (a different model, reasoning effort, or context tier) actually ran the planning turn. [JsonPropertyName("deferImplementation")] public bool? DeferImplementation { 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; /// User response for a pending exit-plan-mode request, with approval state, selected action, auto-approve flag, and feedback. [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; } } /// Source descriptor for a `session.permissions.configure` content-exclusion rule, with source name and type. [Experimental(Diagnostics.Experimental)] public sealed class PermissionsConfigureAdditionalContentExclusionPolicyRuleSource { /// Name of the policy source. [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; /// Type of the policy source. [JsonPropertyName("type")] public string Type { get; set; } = string.Empty; } /// Single content-exclusion rule supplied to `session.permissions.configure`, with paths, match conditions, and source. [Experimental(Diagnostics.Experimental)] public sealed class PermissionsConfigureAdditionalContentExclusionPolicyRule { /// Conditions of which at least one must match. [JsonPropertyName("ifAnyMatch")] public IList? IfAnyMatch { get; set; } /// Conditions none of which may match. [JsonPropertyName("ifNoneMatch")] public IList? IfNoneMatch { get; set; } /// Path patterns covered by this rule. [JsonPropertyName("paths")] public IList Paths { get => field ??= []; set; } /// Source descriptor for a `session.permissions.configure` content-exclusion rule, with source name and type. [JsonPropertyName("source")] public PermissionsConfigureAdditionalContentExclusionPolicyRuleSource Source { get => field ??= new(); set; } } /// Content-exclusion policy supplied to `session.permissions.configure`, with rules, last-updated data, and scope. [Experimental(Diagnostics.Experimental)] public sealed class PermissionsConfigureAdditionalContentExclusionPolicy { /// Opaque policy update timestamp supplied by the host. [JsonPropertyName("last_updated_at")] public JsonElement LastUpdatedAt { get; set; } /// Content-exclusion rules to apply. [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). Conventional `.github/skills/` and `.github/agents/` definitions under them also join the session catalogs when their subsystem gates are enabled, so supplying a directory is a trust decision for configuration stored there. 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; } /// Permission-decision request variant to approve only the current permission request. /// The approve-once variant of . [Experimental(Diagnostics.Experimental)] public partial class PermissionDecisionApproveOnce : PermissionDecision { /// [JsonIgnore] public override string Kind => "approve-once"; /// True only when a host surfaced this request to a user who approved it. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("approvedInteractively")] public bool? ApprovedInteractively { get; set; } } /// 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(PermissionDecisionApproveForSessionApprovalFactory), "factory")] [JsonDerivedType(typeof(PermissionDecisionApproveForSessionApprovalExtensionPermissionAccess), "extension-permission-access")] [JsonDerivedType(typeof(PermissionDecisionApproveForSessionApprovalExtensionEnvAccess), "extension-env-access")] public partial class PermissionDecisionApproveForSessionApproval { /// The type discriminator. [JsonPropertyName("kind")] public virtual string Kind { get; set; } = string.Empty; } /// Session-scoped approval details for specific command identifiers. /// 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; } } /// Session-scoped approval details for read-only filesystem operations. /// The read variant of . [Experimental(Diagnostics.Experimental)] public partial class PermissionDecisionApproveForSessionApprovalRead : PermissionDecisionApproveForSessionApproval { /// [JsonIgnore] public override string Kind => "read"; } /// Session-scoped approval details for filesystem write operations. /// The write variant of . [Experimental(Diagnostics.Experimental)] public partial class PermissionDecisionApproveForSessionApprovalWrite : PermissionDecisionApproveForSessionApproval { /// [JsonIgnore] public override string Kind => "write"; } /// Session-scoped approval details for an MCP server tool, or all tools on the server when `toolName` is null. /// 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; } } /// Session-scoped approval details for MCP sampling requests from a server. /// 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; } } /// Session-scoped approval details for writes to long-term memory. /// The memory variant of . [Experimental(Diagnostics.Experimental)] public partial class PermissionDecisionApproveForSessionApprovalMemory : PermissionDecisionApproveForSessionApproval { /// [JsonIgnore] public override string Kind => "memory"; } /// Session-scoped approval details for a custom tool, keyed by tool name. /// 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; } } /// Session-scoped approval details for extension-management operations, optionally narrowed by operation. /// 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; } } /// Session-scoped factory approval, optionally narrowed by approval key. /// The factory variant of . [Experimental(Diagnostics.Experimental)] public partial class PermissionDecisionApproveForSessionApprovalFactory : PermissionDecisionApproveForSessionApproval { /// [JsonIgnore] public override string Kind => "factory"; /// Optional factory operation name or canonical approval key; when omitted, the approval covers all factory operations. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("approvalKey")] public string? ApprovalKey { get; set; } } /// Session-scoped approval details for an extension's permission-gated capability access, keyed by extension name. /// 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; } } /// Session-scoped approval details for an extension's access to sensitive environment variables, keyed by extension name and the exact set of variable names. /// The extension-env-access variant of . [Experimental(Diagnostics.Experimental)] public partial class PermissionDecisionApproveForSessionApprovalExtensionEnvAccess : PermissionDecisionApproveForSessionApproval { /// [JsonIgnore] public override string Kind => "extension-env-access"; /// Names of the sensitive environment variables this approval covers. Values are never persisted. [JsonPropertyName("environmentVariables")] public required IList EnvironmentVariables { get; set; } /// Extension name. [JsonPropertyName("extensionName")] public required string ExtensionName { get; set; } } /// Permission-decision request variant to approve for the rest of the session, with optional tool approval or URL domain. /// 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(PermissionDecisionApproveForLocationApprovalFactory), "factory")] [JsonDerivedType(typeof(PermissionDecisionApproveForLocationApprovalExtensionPermissionAccess), "extension-permission-access")] [JsonDerivedType(typeof(PermissionDecisionApproveForLocationApprovalExtensionEnvAccess), "extension-env-access")] public partial class PermissionDecisionApproveForLocationApproval { /// The type discriminator. [JsonPropertyName("kind")] public virtual string Kind { get; set; } = string.Empty; } /// Location-scoped approval details for specific command identifiers. /// 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; } } /// Location-scoped approval details for read-only filesystem operations. /// The read variant of . [Experimental(Diagnostics.Experimental)] public partial class PermissionDecisionApproveForLocationApprovalRead : PermissionDecisionApproveForLocationApproval { /// [JsonIgnore] public override string Kind => "read"; } /// Location-scoped approval details for filesystem write operations. /// The write variant of . [Experimental(Diagnostics.Experimental)] public partial class PermissionDecisionApproveForLocationApprovalWrite : PermissionDecisionApproveForLocationApproval { /// [JsonIgnore] public override string Kind => "write"; } /// Location-scoped approval details for an MCP server tool, or all tools on the server when `toolName` is null. /// 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; } } /// Location-scoped approval details for MCP sampling requests from a server. /// 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; } } /// Location-scoped approval details for writes to long-term memory. /// The memory variant of . [Experimental(Diagnostics.Experimental)] public partial class PermissionDecisionApproveForLocationApprovalMemory : PermissionDecisionApproveForLocationApproval { /// [JsonIgnore] public override string Kind => "memory"; } /// Location-scoped approval details for a custom tool, keyed by tool name. /// 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; } } /// Location-scoped approval details for extension-management operations, optionally narrowed by operation. /// 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; } } /// Location-scoped factory approval, optionally narrowed by approval key. /// The factory variant of . [Experimental(Diagnostics.Experimental)] public partial class PermissionDecisionApproveForLocationApprovalFactory : PermissionDecisionApproveForLocationApproval { /// [JsonIgnore] public override string Kind => "factory"; /// Optional factory operation name or canonical approval key; when omitted, the approval covers all factory operations. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("approvalKey")] public string? ApprovalKey { get; set; } } /// Location-scoped approval details for an extension's permission-gated capability access, keyed by extension name. /// 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; } } /// Location-scoped approval details for an extension's access to sensitive environment variables, keyed by extension name and the exact set of variable names. /// The extension-env-access variant of . [Experimental(Diagnostics.Experimental)] public partial class PermissionDecisionApproveForLocationApprovalExtensionEnvAccess : PermissionDecisionApproveForLocationApproval { /// [JsonIgnore] public override string Kind => "extension-env-access"; /// Names of the sensitive environment variables this approval covers. Values are never persisted. [JsonPropertyName("environmentVariables")] public required IList EnvironmentVariables { get; set; } /// Extension name. [JsonPropertyName("extensionName")] public required string ExtensionName { get; set; } } /// Permission-decision request variant to approve and persist a permission for a project location, with approval details and location key. /// 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; } } /// Permission-decision request variant to permanently approve a URL domain across sessions. /// 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; } } /// Permission-decision request variant to reject a pending permission request, with optional feedback. /// 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; } } /// Permission-decision variant indicating no user was available to confirm the request. /// The user-not-available variant of . [Experimental(Diagnostics.Experimental)] public partial class PermissionDecisionUserNotAvailable : PermissionDecision { /// [JsonIgnore] public override string Kind => "user-not-available"; } /// Permission-decision variant indicating the request was approved. /// The approved variant of . [Experimental(Diagnostics.Experimental)] public partial class PermissionDecisionApproved : PermissionDecision { /// [JsonIgnore] public override string Kind => "approved"; } /// Permission-decision variant indicating approval was remembered for the session, with approval details. /// 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; } } /// Permission-decision variant indicating approval was persisted for a project location, with approval details and location key. /// 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; } } /// Permission-decision variant indicating the request was cancelled before use, with an optional reason. /// 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; } } /// Permission-decision variant indicating explicit denial by permission rules, with the matching rules. /// 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; } } /// Permission-decision variant indicating no approval rule matched and user confirmation was unavailable. /// 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"; } /// Permission-decision variant indicating the user denied an interactive prompt, with optional feedback and force-reject flag. /// 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; } } /// Permission-decision variant indicating denial by content-exclusion policy, with path and message. /// 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; } } /// Permission-decision variant indicating denial by a permission request hook, with optional message and interrupt flag. /// 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 { /// Optional informational context describing how and where this response was made. Omit it to preserve legacy behavior without attributing an origin. [JsonPropertyName("decisionContext")] public PermissionDecisionContext? DecisionContext { get; set; } /// 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; } /// Pending permission prompt reconstructed from event history, with request ID and user-facing prompt details. [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 requested permission mode was applied and reports the authoritative post-mutation mode. [Experimental(Diagnostics.Experimental)] public sealed class PermissionsSetModeResult { /// Authoritative permission mode after the mutation. [JsonPropertyName("mode")] public PermissionMode Mode { get; set; } /// Whether the operation succeeded. [JsonPropertyName("success")] public bool Success { get; set; } } /// Permission mode to apply for the session. [Experimental(Diagnostics.Experimental)] internal sealed class PermissionsSetModeRequest { /// Optional judge model id for assisted mode. When omitted, the session resolves the provider default: `gpt-5.5` for CAPI sessions and the active session model for BYOK sessions. [JsonPropertyName("assistedApprovalModel")] public string? AssistedApprovalModel { get; set; } /// Permission mode to apply. [JsonPropertyName("mode")] public PermissionMode Mode { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; /// Optional source for permission-mode telemetry. Defaults to `rpc` when omitted for SDK callers. [JsonPropertyName("source")] public PermissionModeSource? Source { get; set; } } /// Current permission mode. [Experimental(Diagnostics.Experimental)] public sealed class PermissionsGetModeResult { /// Current permission mode. [JsonPropertyName("mode")] public PermissionMode Mode { get; set; } } /// No parameters. [Experimental(Diagnostics.Experimental)] internal sealed class PermissionsGetModeRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// 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; } } /// Clears session-scoped tool permission approvals, and optionally the location-scoped ones. [Experimental(Diagnostics.Experimental)] internal sealed class PermissionsResetSessionApprovalsRequest { /// Whether location-scoped approvals are cleared too. Defaults to `true`. [JsonPropertyName("includeLocation")] public bool? IncludeLocation { 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 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, then loads conventional `.github/skills/` and `.github/agents/` definitions under it when their subsystem gates are enabled. Adding the directory is therefore also a trust decision for configuration stored there. [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(PermissionsLocationsAddToolApprovalDetailsFactory), "factory")] [JsonDerivedType(typeof(PermissionsLocationsAddToolApprovalDetailsExtensionPermissionAccess), "extension-permission-access")] [JsonDerivedType(typeof(PermissionsLocationsAddToolApprovalDetailsExtensionEnvAccess), "extension-env-access")] public partial class PermissionsLocationsAddToolApprovalDetails { /// The type discriminator. [JsonPropertyName("kind")] public virtual string Kind { get; set; } = string.Empty; } /// Location-persisted tool approval details for specific command identifiers. /// 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; } } /// Location-persisted tool approval details for read-only filesystem operations. /// The read variant of . [Experimental(Diagnostics.Experimental)] public partial class PermissionsLocationsAddToolApprovalDetailsRead : PermissionsLocationsAddToolApprovalDetails { /// [JsonIgnore] public override string Kind => "read"; } /// Location-persisted tool approval details for filesystem write operations. /// The write variant of . [Experimental(Diagnostics.Experimental)] public partial class PermissionsLocationsAddToolApprovalDetailsWrite : PermissionsLocationsAddToolApprovalDetails { /// [JsonIgnore] public override string Kind => "write"; } /// Location-persisted tool approval details for an MCP server tool, or all tools when `toolName` is null. /// 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; } } /// Location-persisted tool approval details for MCP sampling requests from a server. /// 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; } } /// Location-persisted tool approval details for writes to long-term memory. /// The memory variant of . [Experimental(Diagnostics.Experimental)] public partial class PermissionsLocationsAddToolApprovalDetailsMemory : PermissionsLocationsAddToolApprovalDetails { /// [JsonIgnore] public override string Kind => "memory"; } /// Location-persisted tool approval details for a custom tool, keyed by tool name. /// 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; } } /// Location-persisted tool approval details for extension-management operations, optionally narrowed by operation. /// 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; } } /// Location-persisted factory approval, optionally narrowed by approval key. /// The factory variant of . [Experimental(Diagnostics.Experimental)] public partial class PermissionsLocationsAddToolApprovalDetailsFactory : PermissionsLocationsAddToolApprovalDetails { /// [JsonIgnore] public override string Kind => "factory"; /// Optional factory operation name or canonical approval key; when omitted, the approval covers all factory operations. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("approvalKey")] public string? ApprovalKey { get; set; } } /// Location-persisted tool approval details for an extension's permission-gated capability access, keyed by extension name. /// 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-persisted tool approval details for an extension's access to sensitive environment variables, keyed by extension name and the exact set of variable names. /// The extension-env-access variant of . [Experimental(Diagnostics.Experimental)] public partial class PermissionsLocationsAddToolApprovalDetailsExtensionEnvAccess : PermissionsLocationsAddToolApprovalDetails { /// [JsonIgnore] public override string Kind => "extension-env-access"; /// Names of the sensitive environment variables this approval covers. Values are never persisted. [JsonPropertyName("environmentVariables")] public required IList EnvironmentVariables { get; set; } /// 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; } /// Whether the display name was explicitly set by the user. [JsonPropertyName("user_named")] public bool? UserNamed { 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; } /// Runtime client name associated with the session (telemetry identifier). [JsonPropertyName("clientName")] public string? ClientName { 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; /// Current session limits, or null when no limits are active. [JsonPropertyName("sessionLimits")] public SessionLimitsConfig? SessionLimits { get; set; } /// 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; } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionMetadataGetClientMetadataRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Atomic patch for client-owned session metadata. Operations apply in clear, remove, then set order. The resulting bag must satisfy the ClientMetadata entry and serialized-size limits. Local storage coordinates concurrent runtime processes; custom SessionFs providers must serialize writers that access the same session from multiple processes. [Experimental(Diagnostics.Experimental)] internal sealed class MetadataUpdateClientMetadataRequest { /// Remove every existing client metadata entry before applying remove and set. Defaults to false. [JsonPropertyName("clear")] public bool? Clear { get; set; } /// Case-sensitive keys to remove. Missing keys are ignored. Each key must be non-empty, at most 256 UTF-8 bytes, and outside the reserved `copilot/` and `github/` namespaces. [JsonPropertyName("remove")] public IList? Remove { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; /// String entries to add or replace. Set wins when a key also appears in remove. Each key must be non-empty, at most 256 UTF-8 bytes, and outside the reserved `copilot/` and `github/` namespaces. Each value may contain at most 16 KiB of UTF-8 data. [JsonPropertyName("set")] public IDictionary? Set { get; set; } } /// 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; } /// Current activity flags for the session. [Experimental(Diagnostics.Experimental)] public sealed class SessionActivity { /// Whether an in-flight operation can currently be aborted. [JsonPropertyName("abortable")] public bool Abortable { get; set; } /// Whether the session currently has active work, including running turns or tasks. [JsonPropertyName("hasActiveWork")] public bool HasActiveWork { get; set; } } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionMetadataActivityRequest { /// 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; } /// Prompt token limit plus the model's full output token limit. [JsonPropertyName("limit")] public long Limit { get; set; } /// Tokens consumed by MCP tool definitions (subset of toolDefinitionsTokens, excludes deferred tools). [JsonPropertyName("mcpToolsTokens")] public long McpToolsTokens { 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; } /// The six normalized `/context` header buckets, computed from the same tokenization as `entries` so the two never disagree. Convenience rollups: `freeSpace` and `buffer` describe window capacity rather than occupied context, so the values do not sum to `totalTokens`. public sealed class MetadataContextAttributionResultContextAttributionCategories { /// Output reserve plus post-blocking-threshold buffer. [JsonPropertyName("buffer")] public long Buffer { get; set; } /// Custom-instructions tokens (0 when none are configured). [JsonPropertyName("customInstructions")] public long CustomInstructions { get; set; } /// Remaining unused window capacity (clamped at 0). [JsonPropertyName("freeSpace")] public long FreeSpace { get; set; } /// MCP tool-definition tokens. [JsonPropertyName("mcpTools")] public long McpTools { get; set; } /// Conversation (user/assistant/tool) message tokens. [JsonPropertyName("messages")] public long Messages { get; set; } /// System prompt tokens, excluding custom instructions. [JsonPropertyName("systemPrompt")] public long SystemPrompt { get; set; } /// Non-MCP tool-definition tokens. [JsonPropertyName("systemTools")] public long SystemTools { get; set; } } /// Successful compaction history for the session. public sealed class MetadataContextAttributionResultContextAttributionCompactions { /// Number of successful compactions in this session. [JsonPropertyName("count")] public long Count { get; set; } } /// RPC data type for MetadataContextAttributionResultContextAttributionEntry operations. public sealed class MetadataContextAttributionResultContextAttributionEntry { /// Supplementary per-entry metadata (e.g. `messageCount`, `role`, `evictable`, `pluginSource`). Values are stringified; parse as needed and ignore unrecognized keys. [JsonPropertyName("attributes")] public IDictionary? Attributes { get; set; } /// Identifier for this entry, formed by joining its `kind` and source name (e.g. `tool:bash`, `skill:tmux`, `toolDefinition:bash`); unique within the snapshot. Use it to match the same entry across snapshots, to correlate with other APIs (skill/agent/MCP registries), and as the `parentId` target for nesting. Distinct from the human-facing `label`. [JsonPropertyName("id")] public string Id { get; set; } = string.Empty; /// Source category for this entry. Not a closed set — tolerate unknown values. Known values today: `skill`, `subagent`, `mcpServer`, `tool`, `system`, `toolDefinition`, `plugin`. [JsonPropertyName("kind")] public string Kind { get; set; } = string.Empty; /// Human-readable display label, e.g. `bash` or `skill: tmux`. Presentation-only; may be localized/reformatted without notice — do not key off it. [JsonPropertyName("label")] public string Label { get; set; } = string.Empty; /// Optional `id` of the parent entry: e.g. a `plugin` entry parenting its `skill`/`mcpServer` entries, or the `system` entry parenting `toolDefinition` entries. Omitted for top-level entries. [JsonPropertyName("parentId")] public string? ParentId { get; set; } /// Token count currently in context attributable to this entry. [JsonPropertyName("tokens")] public long Tokens { get; set; } } /// Per-source token attribution snapshot for the current context window. The heaviest individual messages are available separately via `metadata.getContextHeaviestMessages`. public sealed class MetadataContextAttributionResultContextAttribution { /// Output reserve plus the tokens past the buffer-exhaustion blocking threshold. Mirrors `SessionContextInfo.bufferTokens`. [JsonPropertyName("bufferTokens")] public long BufferTokens { get; set; } /// The six normalized `/context` header buckets, computed from the same tokenization as `entries` so the two never disagree. Convenience rollups: `freeSpace` and `buffer` describe window capacity rather than occupied context, so the values do not sum to `totalTokens`. [JsonPropertyName("categories")] public MetadataContextAttributionResultContextAttributionCategories Categories { get => field ??= new(); set; } /// Successful compaction history for the session. [JsonPropertyName("compactions")] public MetadataContextAttributionResultContextAttributionCompactions Compactions { get => field ??= new(); set; } /// Token count at which background compaction starts. Mirrors `SessionContextInfo.compactionThreshold`. [JsonPropertyName("compactionThreshold")] public long CompactionThreshold { get; set; } /// Flat list of per-source attribution entries. Group by `kind` and render unrecognized kinds generically. Nesting and rollups are expressed via `parentId`. [JsonPropertyName("entries")] public IList Entries { get => field ??= []; set; } /// Prompt limit plus the model's output reserve: the full context window `categories.freeSpace` and `categories.buffer` are measured against. Mirrors `SessionContextInfo.limit`. [JsonPropertyName("limit")] public long Limit { get; set; } /// The concrete model id the entire breakdown was tokenized against (feeds the per-model token multiplier). Under `Auto` (Free/Student) this is the resolved model, not the literal `auto` sentinel, so totals are not undercounted. A single-model approximation of a potentially multi-model Auto session. [JsonPropertyName("modelId")] public string ModelId { get; set; } = string.Empty; /// How `modelId` was chosen. Not a closed set — tolerate unknown values. Known values today: `autoResolved` (the model Auto resolved to), `selected` (the user's explicitly selected model), `default` (a fallback before any model is known). [JsonPropertyName("modelSource")] public string ModelSource { get; set; } = string.Empty; /// Maximum prompt tokens the resolved model accepts — the denominator for a `##k/###k` context-usage display. Mirrors `SessionContextInfo.promptTokenLimit`. [JsonPropertyName("promptTokenLimit")] public long PromptTokenLimit { get; set; } /// Total token count of the current context window the entries are measured against (system message + conversation messages + tool definitions — the same total reported by /context). Divide an entry's `tokens` by this to derive its share. [JsonPropertyName("totalTokens")] public long TotalTokens { get; set; } } /// Per-source attribution breakdown for the session's current context window, or null if uninitialized. [Experimental(Diagnostics.Experimental)] public sealed class MetadataContextAttributionResult { /// Per-source context-window attribution, or null if the session has not yet been initialized (no system prompt or tool metadata cached). [JsonPropertyName("contextAttribution")] public MetadataContextAttributionResultContextAttribution? ContextAttribution { get; set; } } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionMetadataGetContextAttributionRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// A single large message currently in context. [Experimental(Diagnostics.Experimental)] public sealed class ContextHeaviestMessage { /// Stable identifier for this message within the snapshot. [JsonPropertyName("id")] public string Id { get; set; } = string.Empty; /// Human-readable source label, e.g. `tool: bash` or `skill: tmux`. Presentation-only. [JsonPropertyName("label")] public string Label { get; set; } = string.Empty; /// Role of the chat message (`user`, `assistant`, or `tool`). [JsonPropertyName("role")] public string Role { get; set; } = string.Empty; /// Token count currently in context for this individual message. [JsonPropertyName("tokens")] public long Tokens { get; set; } } /// The heaviest individual messages in the session's context window, most-expensive first. [Experimental(Diagnostics.Experimental)] public sealed class MetadataContextHeaviestMessagesResult { /// Heaviest messages, most-expensive first. [JsonPropertyName("messages")] public IList Messages { get => field ??= []; set; } /// Total token count of the current context window, so callers can compute each message's share without a second call. [JsonPropertyName("totalTokens")] public long TotalTokens { get; set; } } /// Parameters for the heaviest-messages query. [Experimental(Diagnostics.Experimental)] internal sealed class MetadataContextHeaviestMessagesRequest { /// Maximum number of messages to return, most-expensive first. Omit for the server default. [JsonPropertyName("limit")] public long? Limit { 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). For a local session, a report whose `cwd` diverges from the session's current working directory is ignored (the call still succeeds but records nothing and emits no event); move a local session's working directory via `metadata.setWorkingDirectory` instead. [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 any related side-effects (file index, etc.); it does NOT change the process working directory (a session's cwd is per-session, not process-global). For local sessions the runtime validates the target first (an absolute path that exists on disk) and re-bases the permission primary directory; a rejected validation fails the call before anything is mutated, persisted, or emitted. Location-scoped permission rules are then re-keyed to the new directory (best-effort). Remote sessions only record the 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. For local sessions the path must be absolute and exist on disk: it is validated before any session state changes, and a failing validation rejects the call with nothing mutated, persisted, or emitted. Remote sessions record the path as-is. [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; } /// Availability of built-in job tools surfaced to boundary consumers. [Experimental(Diagnostics.Experimental)] public sealed class SessionSettingsBuiltInToolAvailabilitySnapshot { /// Whether the create-pull-request tool is available. [JsonPropertyName("createPullRequest")] public bool? CreatePullRequest { get; set; } /// Whether the report-progress tool is available. [JsonPropertyName("reportProgress")] public bool? ReportProgress { get; set; } } /// Redacted job settings for a session. The job nonce is excluded. [Experimental(Diagnostics.Experimental)] public sealed class SessionSettingsJobSnapshot { /// Availability of job-specific built-in tools. [JsonPropertyName("builtInToolAvailability")] public SessionSettingsBuiltInToolAvailabilitySnapshot? BuiltInToolAvailability { get; set; } /// GitHub Actions event type for the job. [JsonPropertyName("eventType")] public string? EventType { get; set; } /// Whether this is the workflow's trigger job. [JsonPropertyName("isTriggerJob")] public bool? IsTriggerJob { get; set; } } /// Redacted model routing settings for a session. [Experimental(Diagnostics.Experimental)] public sealed class SessionSettingsModelSnapshot { /// Agent service callback URL for job and progress updates. [JsonPropertyName("callbackUrl")] public string? CallbackUrl { get; set; } /// Default reasoning effort for the selected model. [JsonPropertyName("defaultReasoningEffort")] public string? DefaultReasoningEffort { get; set; } /// Agent job identifier for the session. [JsonPropertyName("instanceId")] public string? InstanceId { get; set; } /// Selected model identifier. [JsonPropertyName("model")] public string? Model { get; set; } } /// Online-evaluation settings safe to expose across the SDK boundary. [Experimental(Diagnostics.Experimental)] public sealed class SessionSettingsOnlineEvaluationSnapshot { /// Whether online evaluation is disabled. [JsonPropertyName("disableOnlineEvaluation")] public bool? DisableOnlineEvaluation { get; set; } /// Whether online-evaluation output-file generation is enabled. [JsonPropertyName("enableOnlineEvaluationOutputFile")] public bool? EnableOnlineEvaluationOutputFile { get; set; } } /// Redacted repository and GitHub host settings for a session. [Experimental(Diagnostics.Experimental)] public sealed class SessionSettingsRepoSnapshot { /// Checked-out repository branch. [JsonPropertyName("branch")] public string? Branch { get; set; } /// Checked-out commit SHA. [JsonPropertyName("commit")] public string? Commit { get; set; } /// GitHub server host name. [JsonPropertyName("host")] public string? Host { get; set; } /// Protocol used to access the GitHub host. [JsonPropertyName("hostProtocol")] public string? HostProtocol { get; set; } /// GitHub repository database ID. [JsonPropertyName("id")] public double? Id { get; set; } /// Repository name. [JsonPropertyName("name")] public string? Name { get; set; } /// GitHub repository owner database ID. [JsonPropertyName("ownerId")] public double? OwnerId { get; set; } /// Repository owner login. [JsonPropertyName("ownerName")] public string? OwnerName { get; set; } /// Number of commits in the pull request. [JsonPropertyName("prCommitCount")] public double? PrCommitCount { get; set; } /// Whether the repository is writable. [JsonPropertyName("readWrite")] public bool? ReadWrite { get; set; } /// GitHub secret-scanning service URL. [JsonPropertyName("secretScanningUrl")] public string? SecretScanningUrl { get; set; } /// GitHub server base URL. [JsonPropertyName("serverUrl")] public string? ServerUrl { get; set; } } /// Redacted validation and memory-tool settings for a session. [Experimental(Diagnostics.Experimental)] public sealed class SessionSettingsValidationSnapshot { /// Whether advisory validation is enabled. [JsonPropertyName("advisoryEnabled")] public bool? AdvisoryEnabled { get; set; } /// Whether CodeQL validation is enabled. [JsonPropertyName("codeqlEnabled")] public bool? CodeqlEnabled { get; set; } /// Whether code-review validation is enabled. [JsonPropertyName("codeReviewEnabled")] public bool? CodeReviewEnabled { get; set; } /// Model used for code-review validation. [JsonPropertyName("codeReviewModel")] public string? CodeReviewModel { get; set; } /// Dependabot validation timeout budget in seconds. [JsonPropertyName("dependabotTimeout")] public double? DependabotTimeout { get; set; } /// Whether the memory-store tool is enabled. [JsonPropertyName("memoryStoreEnabled")] public bool? MemoryStoreEnabled { get; set; } /// Whether the memory-vote tool is enabled. [JsonPropertyName("memoryVoteEnabled")] public bool? MemoryVoteEnabled { get; set; } /// Whether secret-scanning validation is enabled. [JsonPropertyName("secretScanningEnabled")] public bool? SecretScanningEnabled { get; set; } /// General validation timeout budget in seconds. [JsonPropertyName("timeout")] public double? Timeout { get; set; } } /// Redacted, serializable view of session runtime settings for SDK boundary consumers. Secrets and raw feature flags are intentionally excluded. [Experimental(Diagnostics.Experimental)] internal sealed class SessionSettingsSnapshot { /// Name of the SDK client that created the session. [JsonPropertyName("clientName")] public string? ClientName { get; set; } /// Redacted job settings. [JsonPropertyName("job")] public SessionSettingsJobSnapshot Job { get => field ??= new(); set; } /// Redacted model routing settings. [JsonPropertyName("model")] public SessionSettingsModelSnapshot Model { get => field ??= new(); set; } /// Online-evaluation settings safe for SDK consumers. [JsonPropertyName("onlineEvaluation")] public SessionSettingsOnlineEvaluationSnapshot OnlineEvaluation { get => field ??= new(); set; } /// Redacted repository and host settings. [JsonPropertyName("repo")] public SessionSettingsRepoSnapshot Repo { get => field ??= new(); set; } /// Session start time as Unix epoch milliseconds. [JsonPropertyName("startTimeMs")] public double? StartTimeMs { get; set; } /// Session timeout in milliseconds. [JsonPropertyName("timeoutMs")] public double? TimeoutMs { get; set; } /// Redacted validation and memory-tool settings. [JsonPropertyName("validation")] public SessionSettingsValidationSnapshot Validation { get => field ??= new(); set; } /// Agent runtime version selector copied from the session settings, such as `latest` or a runtime release identifier. [JsonPropertyName("version")] public string? Version { get; set; } } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionSettingsSnapshotRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Result of evaluating a Rust-owned settings predicate. [Experimental(Diagnostics.Experimental)] internal sealed class SessionSettingsEvaluatePredicateResult { /// Whether the named settings predicate evaluated to enabled. [JsonPropertyName("enabled")] public bool Enabled { get; set; } } /// Named Rust-owned settings predicate to evaluate for this session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionSettingsEvaluatePredicateRequest { /// Predicate name. The runtime owns the raw feature-flag names and composition logic. [JsonPropertyName("name")] public SessionSettingsPredicateName Name { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; /// Tool name for tool-scoped predicates such as trivial-change handling. [JsonPropertyName("toolName")] public string? ToolName { get; set; } } /// Content-exclusion decision for one requested path. [Experimental(Diagnostics.Experimental)] public sealed class ContentExclusionPathCheck { /// Whether the session's complete content-exclusion policy excludes the path. [JsonPropertyName("excluded")] public bool Excluded { get; set; } /// The path supplied by the caller. [JsonPropertyName("path")] public string Path { get; set; } = string.Empty; } /// Batch content-exclusion result. Callers must fail closed when policy evaluation is unavailable. [Experimental(Diagnostics.Experimental)] public sealed class ContentExclusionCheckPathsResult { /// Whether the session's policy service was available for the complete batch. When false, checks is empty and callers must treat every requested path as excluded. [JsonPropertyName("available")] public bool Available { get; set; } /// Per-path decisions in request order. Empty when available is false. [JsonPropertyName("checks")] public IList Checks { get => field ??= []; set; } } /// Local file system absolute paths within the session working directory to check against its content-exclusion policy. [Experimental(Diagnostics.Experimental)] internal sealed class ContentExclusionCheckPathsRequest { /// Local file system absolute paths within the session working directory to check. Results are returned in the same order, including duplicates. [JsonPropertyName("paths")] public IList Paths { get => field ??= []; set; } /// 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; } } /// Result of a user-requested shell command. [Experimental(Diagnostics.Experimental)] public sealed class UserRequestedShellCommandResult { /// Error output when the execution failed. [JsonPropertyName("error")] public string? Error { get; set; } /// Process exit code, when available. [JsonPropertyName("exitCode")] public long? ExitCode { get; set; } /// Captured command output. [JsonPropertyName("output")] public string Output { get; set; } = string.Empty; /// Whether the command completed successfully. [JsonPropertyName("success")] public bool Success { get; set; } /// Tool call id emitted for the shell execution. [JsonPropertyName("toolCallId")] public string ToolCallId { get; set; } = string.Empty; } /// User-requested shell command and cancellation handle. [Experimental(Diagnostics.Experimental)] internal sealed class ShellExecuteUserRequestedRequest { /// Shell command to execute. [JsonPropertyName("command")] public string Command { get; set; } = string.Empty; /// Caller-provided cancellation handle for this execution. [JsonPropertyName("requestId")] public string RequestId { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Cancellation result for a user-requested shell command. [Experimental(Diagnostics.Experimental)] public sealed class CancelUserRequestedShellCommandResult { /// Whether an in-flight execution was found and signalled to cancel. [JsonPropertyName("cancelled")] public bool Cancelled { get; set; } } /// User-requested shell execution cancellation handle. [Experimental(Diagnostics.Experimental)] internal sealed class ShellCancelUserRequestedRequest { /// Request ID previously passed to executeUserRequested. [JsonPropertyName("requestId")] public string RequestId { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// 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; } } /// RPC data type for SessionHistoryCompact operations. [Experimental(Diagnostics.Experimental)] public sealed class SessionHistoryCompactRequest { /// 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; } /// Context window token limit this compaction is targeting, recorded as the `tokenLimit` on the persisted `session.compaction_start` / `session.compaction_complete` events. Set it when the compaction targets a window other than the compacting model's own, e.g. switching to a model with a smaller context window: the compaction still runs on the current model, so the limit that motivated it would otherwise be lost. When absent, the events record the compacting model's own resolved limit. Attribution metadata only - it does not change how much the compaction removes. [JsonPropertyName("tokenLimit")] public long? TokenLimit { get; set; } /// What initiated this compaction request, recorded as the `trigger` on the persisted `session.compaction_start` / `session.compaction_complete` events. When absent, the compaction is persisted without trigger attribution (initiator unknown). [JsonPropertyName("trigger")] public SessionHistoryCompactRequestTrigger? Trigger { get; set; } } /// RPC data type for SessionHistoryCompactRequestWithSession operations. [Experimental(Diagnostics.Experimental)] internal sealed class SessionHistoryCompactRequestWithSession { /// 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; /// Context window token limit this compaction is targeting, recorded as the `tokenLimit` on the persisted `session.compaction_start` / `session.compaction_complete` events. Set it when the compaction targets a window other than the compacting model's own, e.g. switching to a model with a smaller context window: the compaction still runs on the current model, so the limit that motivated it would otherwise be lost. When absent, the events record the compacting model's own resolved limit. Attribution metadata only - it does not change how much the compaction removes. [JsonPropertyName("tokenLimit")] public long? TokenLimit { get; set; } /// What initiated this compaction request, recorded as the `trigger` on the persisted `session.compaction_start` / `session.compaction_complete` events. When absent, the compaction is persisted without trigger attribution (initiator unknown). [JsonPropertyName("trigger")] public SessionHistoryCompactRequestTrigger? Trigger { get; set; } } /// Number of events that were removed by the truncation. [Experimental(Diagnostics.Experimental)] public sealed class HistoryTruncateResult { /// Failure detail when checkpointCleanupFailed is true. [JsonPropertyName("checkpointCleanupError")] public string? CheckpointCleanupError { get; set; } /// True when conversation truncation succeeded but post-truncation workspace checkpoint cleanup failed. History is already truncated; callers may still prune snapshots but should report a checkpoint-cleanup rather than a truncation failure. [JsonPropertyName("checkpointCleanupFailed")] public bool? CheckpointCleanupFailed { get; set; } /// 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; } /// A root user turn that the session can rewind to. [Experimental(Diagnostics.Experimental)] public sealed class HistoryRewindPoint { /// Whether at least one file in this turn or a later turn can be restored. [JsonPropertyName("canRestoreFiles")] public bool CanRestoreFiles { get; set; } /// ID of the user.message event that begins the discarded suffix. [JsonPropertyName("eventId")] public string EventId { get; set; } = string.Empty; /// Number of unique files in this turn and all later turns that have captured changes. [JsonPropertyName("fileCount")] public long FileCount { get; set; } /// Whether this turn was an automatically injected autopilot continuation. [JsonPropertyName("isAutopilotContinuation")] public bool IsAutopilotContinuation { get; set; } /// Lines added by this turn's captured file changes. [JsonPropertyName("linesAdded")] public long LinesAdded { get; set; } /// Lines removed by this turn's captured file changes. [JsonPropertyName("linesRemoved")] public long LinesRemoved { get; set; } /// ISO timestamp of the user turn. [JsonPropertyName("timestamp")] public string Timestamp { get; set; } = string.Empty; /// Whether this turn itself captured any file changes. [JsonPropertyName("turnChangedFiles")] public bool TurnChangedFiles { get; set; } /// User-visible message text for the turn. [JsonPropertyName("userMessage")] public string UserMessage { get; set; } = string.Empty; } /// Rewind points and file-change-tracking availability for the session. [Experimental(Diagnostics.Experimental)] public sealed class HistoryListRewindPointsResult { /// Whether this session captured file changes from its first turn. [JsonPropertyName("fileChangeTrackingEnabled")] public bool FileChangeTrackingEnabled { get; set; } /// Root user turns in chronological order. Empty when `unavailableReason` is set. [JsonPropertyName("points")] public IList Points { get => field ??= []; set; } /// Why the listed points could not be produced, when applicable; the points list is empty whenever it is set. `unsupported-remote-session` is permanent for the session and comes with `fileChangeTrackingEnabled: false`. `session-busy` is transient and only ever reported by a session that *is* tracking (`fileChangeTrackingEnabled: true`), because the file-change captures cannot be read while work that may still mutate them is in flight; the same request succeeds once the session settles, so a client that wants points should retry rather than treat it as a failure. It is never `file-change-tracking-disabled`: an untracked local session still lists conversation-only points and reports that through `fileChangeTrackingEnabled: false`. [JsonPropertyName("unavailableReason")] public HistoryRewindUnavailableReason? UnavailableReason { get; set; } } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionHistoryListRewindPointsRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// A file that a conversation-and-files rewind would restore. [Experimental(Diagnostics.Experimental)] public sealed class HistoryRewindFilePreview { /// Aggregate change made across the discarded turns. [JsonPropertyName("changeType")] public HistoryRewindChangeType ChangeType { get; set; } /// Lines added across the discarded turns. [JsonPropertyName("linesAdded")] public long LinesAdded { get; set; } /// Lines removed across the discarded turns. [JsonPropertyName("linesRemoved")] public long LinesRemoved { get; set; } /// Absolute path of the captured file. [JsonPropertyName("path")] public string Path { get; set; } = string.Empty; } /// Files and aggregate changes for a prospective rewind. [Experimental(Diagnostics.Experimental)] public sealed class HistoryPreviewRewindResult { /// Whether file restore is available for this session. This is authoritative: switch on it and read `reason` only when it is false. [JsonPropertyName("available")] public bool Available { get; set; } /// Number of unique files in the preview. [JsonPropertyName("fileCount")] public long FileCount { get; set; } /// Files ordered by path. [JsonPropertyName("files")] public IList Files { get => field ??= []; set; } /// Why file restore is unavailable, when applicable. Populated only when `available` is false and never set when `available` is true. [JsonPropertyName("reason")] public HistoryRewindUnavailableReason? Reason { get; set; } } /// Event boundary to preview for conversation-and-files rewind. [Experimental(Diagnostics.Experimental)] internal sealed class HistoryPreviewRewindRequest { /// ID of the user.message event that begins the discarded suffix. [JsonPropertyName("eventId")] public string EventId { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// A captured file that rewind intentionally left unchanged. [Experimental(Diagnostics.Experimental)] public sealed class HistorySkippedFileRestore { /// Absolute path of the skipped file. [JsonPropertyName("path")] public string Path { get; set; } = string.Empty; /// Reason the file was not restored. [JsonPropertyName("reason")] public HistoryFileRestoreSkipReason Reason { get; set; } } /// Structured outcome of a rewind request. [Experimental(Diagnostics.Experimental)] public sealed class HistoryRewindResult { /// Failure detail. Set only for the failure and partial-failure outcomes (`files-rolled-back`, `rollback-incomplete`, `truncation-failed`, `checkpoint-cleanup-failed`, `snapshot-prune-failed`); omitted for `success` and for the unavailable outcomes (`session-busy`, `file-change-tracking-disabled`, `unsupported-remote-session`). [JsonPropertyName("error")] public string? Error { get; set; } /// Number of persisted events removed by conversation truncation. Present only when truncation succeeded (outcomes `success`, `checkpoint-cleanup-failed`, and `snapshot-prune-failed`); omitted for every unavailable outcome (`session-busy`, `file-change-tracking-disabled`, `unsupported-remote-session`) and for `truncation-failed`, `files-rolled-back`, and `rollback-incomplete`. [JsonPropertyName("eventsRemoved")] public long? EventsRemoved { get; set; } /// Overall rewind outcome. This discriminates the result: it governs which of the remaining fields are populated, so consumers must switch on it before reading `eventsRemoved`, `restoredFiles`, `skippedFiles`, or `error`. See each field for the outcomes that populate it. [JsonPropertyName("outcome")] public HistoryRewindOutcome Outcome { get; set; } /// Absolute paths restored to their captured preimages. Always empty for conversation-only rewinds and for the unavailable outcomes (`session-busy`, `file-change-tracking-disabled`, `unsupported-remote-session`); only conversation-and-files outcomes that reached the file-restore stage populate it. [JsonPropertyName("restoredFiles")] public IList RestoredFiles { get => field ??= []; set; } /// Captured files intentionally left unchanged. Always empty for conversation-only rewinds and for the unavailable outcomes (`session-busy`, `file-change-tracking-disabled`, `unsupported-remote-session`); only conversation-and-files outcomes that reached the file-restore stage populate it. [JsonPropertyName("skippedFiles")] public IList SkippedFiles { get => field ??= []; set; } } /// Boundary and mode for rewinding session history. [Experimental(Diagnostics.Experimental)] internal sealed class HistoryRewindRequest { /// ID of the user.message event that begins the discarded suffix. [JsonPropertyName("eventId")] public string EventId { get; set; } = string.Empty; /// Whether to rewind only conversation history or also restore captured files. [JsonPropertyName("mode")] public HistoryRewindMode Mode { get; set; } /// 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; } /// What a successful clear removed. A clear that could not be applied rejects instead of reporting a count. [Experimental(Diagnostics.Experimental)] public sealed class HistoryClearContextResult { /// Number of non-system, non-developer messages that were removed from the conversation. Zero only when the window already held no conversation. [JsonPropertyName("messagesCleared")] public long MessagesCleared { get; set; } } /// Parameters for clearing the conversation and seeding the window that replaces it. [Experimental(Diagnostics.Experimental)] internal sealed class HistoryClearContextRequest { /// First user message of the fresh context window. Required: a cleared window holding only system and developer messages is not a conversation a model can answer, so every clear seeds the window it creates. Delivered by the enclosing turn driver once the agentic loop exits, which is why the call must be made from inside a tool handler. [JsonPropertyName("prompt")] public string Prompt { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// User-facing pending queue entry, with kind and display text for a queued message, slash command, or model change. [Experimental(Diagnostics.Experimental)] public sealed class QueuePendingItems { /// Agent mode stored on this queued entry, as stamped when it was enqueued. Items without an explicit mode report interactive. This is not necessarily the mode that will constrain the turn: a plan or autopilot session applies its own write gate, continuation loop and permission posture to every drained item regardless of the mode stored here. [JsonPropertyName("agentMode")] public SendAgentMode AgentMode { get; set; } /// Human-readable text to display for this queue entry in the UI. [JsonPropertyName("displayText")] public string DisplayText { get; set; } = string.Empty; /// Stable opaque id for the canonical queued item. Batch rows share one id. [JsonPropertyName("id")] public string Id { 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; } /// Stable identity of the queued user message. Present for message rows and absent for slash commands and model changes. [JsonPropertyName("messageId")] public string? MessageId { get; set; } } /// Snapshot of the session's pending queued items and immediate-steering messages. [Experimental(Diagnostics.Experimental)] public sealed class QueuePendingItemsResult { /// How many leading entries of `steeringMessages` have already been folded into the running turn (and so have an emitted `user.message`), as opposed to still waiting for one. Absent for hosts that do not distinguish the two. [JsonPropertyName("inFlightSteeringCount")] public long? InFlightSteeringCount { get; set; } /// 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; } /// Internal snapshot of native queue state for local session orchestration. [Experimental(Diagnostics.Experimental)] internal sealed class QueueSnapshotResult { /// Insertion orders for queued items, aligned with `items`. [JsonPropertyName("itemOrders")] public IList? ItemOrders { get; set; } /// User-facing pending items in FIFO order. [JsonPropertyName("items")] public IList Items { get => field ??= []; set; } /// Insertion orders for immediate steering messages, aligned with `steeringMessages`. [JsonPropertyName("steeringMessageOrders")] public IList? SteeringMessageOrders { get; set; } /// Immediate steering messages waiting for an active turn. [JsonPropertyName("steeringMessages")] public IList SteeringMessages { get => field ??= []; set; } } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionQueueSnapshotRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Result of moving a queued item. [Experimental(Diagnostics.Experimental)] public sealed class QueueMoveItemResult { /// True when the item changed position; false when it was already at the requested position. [JsonPropertyName("changed")] public bool Changed { get; set; } } /// Parameters for moving a queued item by stable id. [Experimental(Diagnostics.Experimental)] internal sealed class QueueMoveItemRequest { /// Stable opaque queued-item id. [JsonPropertyName("id")] public string Id { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; /// Zero-based target position in the public visible queue. Values outside the queue clamp to an end. [JsonPropertyName("toPosition")] public long ToPosition { get; set; } } /// Result of inserting a queued message. [Experimental(Diagnostics.Experimental)] public sealed class QueueInsertAtResult { /// Fresh stable opaque id assigned to the inserted item. [JsonPropertyName("id")] public string Id { get; set; } = string.Empty; } /// Serializable message fields accepted by queue.insertAt. [Experimental(Diagnostics.Experimental)] public sealed class QueueInsertMessage { /// Optional explicit agent mode. When omitted, the session's current mode is assigned. [JsonPropertyName("agentMode")] public SendAgentMode? AgentMode { get; set; } /// Optional attachments for the message. [JsonPropertyName("attachments")] public IList? Attachments { get; set; } /// Whether the message is billable. [JsonPropertyName("billable")] public bool? Billable { get; set; } /// Accepted for internal SendOptions compatibility but ignored; delivery is derived from current session activity. [JsonPropertyName("delivery")] public string? Delivery { get; set; } /// Optional user-facing display text. [JsonPropertyName("displayPrompt")] public string? DisplayPrompt { get; set; } /// Accepted for SendOptions compatibility but ignored; inserted items always use queued delivery semantics. [JsonPropertyName("mode")] public SendMode? Mode { get; set; } /// Accepted for SendOptions compatibility but ignored; the requested public position controls placement. [JsonPropertyName("prepend")] public bool? Prepend { get; set; } /// The user message text. [JsonPropertyName("prompt")] public string Prompt { get; set; } = string.Empty; /// Per-turn request headers. [JsonPropertyName("requestHeaders")] public IDictionary? RequestHeaders { get; set; } /// Required tool name for the turn, when any. [JsonPropertyName("requiredTool")] public string? RequiredTool { get; set; } /// Optional provenance source. `system` is rejected: it would hide the inserted row from `pendingItems` and make it unaddressable while still executing, so inserted items must stay visible. [JsonPropertyName("source")] public string? Source { get; set; } /// Accepted for SendOptions compatibility but ignored; insertion scheduling is controlled by the queue drain state. [JsonPropertyName("wait")] public bool? Wait { get; set; } } /// Parameters for inserting a queued message at a public visible position. [Experimental(Diagnostics.Experimental)] internal sealed class QueueInsertAtRequest { /// Queued message contents and delivery metadata. [JsonPropertyName("message")] public QueueInsertMessage Message { get => field ??= new(); set; } /// Zero-based position in the public visible queue. Values outside the queue clamp to an end. [JsonPropertyName("position")] public long Position { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Result of removing a queued item. [Experimental(Diagnostics.Experimental)] public sealed class QueueRemoveAtResult { /// True when the addressed item was removed. [JsonPropertyName("removed")] public bool Removed { get; set; } } /// Parameters for removing a queued item by stable id. [Experimental(Diagnostics.Experimental)] internal sealed class QueueRemoveAtRequest { /// Stable opaque ID of the queued item to remove. [JsonPropertyName("id")] public string Id { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Result of editing a queued message. [Experimental(Diagnostics.Experimental)] public sealed class QueueUpdateTextResult { /// True when the stored text changed. [JsonPropertyName("updated")] public bool Updated { get; set; } } /// Parameters for editing a single queued message. [Experimental(Diagnostics.Experimental)] internal sealed class QueueUpdateTextRequest { /// Optional replacement prompt displayed to the user. [JsonPropertyName("displayPrompt")] public string? DisplayPrompt { get; set; } /// Stable opaque ID of the queued item to edit. [JsonPropertyName("id")] public string Id { get; set; } = string.Empty; /// Replacement prompt sent to the model. [JsonPropertyName("prompt")] public string Prompt { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Result of duplicating a queued item. [Experimental(Diagnostics.Experimental)] public sealed class QueueDuplicateAtResult { /// Fresh stable opaque id assigned to the duplicate. [JsonPropertyName("id")] public string Id { get; set; } = string.Empty; } /// Parameters for duplicating a queued item. [Experimental(Diagnostics.Experimental)] internal sealed class QueueDuplicateAtRequest { /// Stable opaque ID of the queued item to duplicate. [JsonPropertyName("id")] public string Id { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Parameters for acquiring or releasing the queued-lane drain pause. Acquisition is exclusive and non-idempotent: `paused: true` against an already-paused session fails with `queue_already_paused`. The pause is never released automatically — it is not tied to the caller's lifetime, so a client that exits without sending `paused: false` leaves the lane frozen. Release is unowned: `paused: false` clears the pause for any caller, including one that never acquired it. [Experimental(Diagnostics.Experimental)] internal sealed class QueueSetDrainPausedRequest { /// Whether queued-lane draining should be paused. [JsonPropertyName("paused")] public bool Paused { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Result of trying to steer a queued message into a live turn. [Experimental(Diagnostics.Experimental)] public sealed class QueueSendNowResult { /// True when the item was accepted into the steering lane; false when no main turn was live. [JsonPropertyName("steered")] public bool Steered { get; set; } } /// Parameters for steering a queued message into a live turn. [Experimental(Diagnostics.Experimental)] internal sealed class QueueSendNowRequest { /// Stable opaque ID of the queued item to steer into the live turn. [JsonPropertyName("id")] public string Id { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Whether the native queue has pending work. [Experimental(Diagnostics.Experimental)] internal sealed class QueueHasPendingResult { /// True when queued or immediate native work is pending. [JsonPropertyName("hasPending")] public bool HasPending { get; set; } } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionQueueHasPendingRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Whether a deferred-idle drain should run. [Experimental(Diagnostics.Experimental)] internal sealed class QueueBeginDeferredIdleDrainResult { /// True when the host should run finishDeferredIdleDrain asynchronously. [JsonPropertyName("shouldDrain")] public bool ShouldDrain { get; set; } } /// Inputs for starting a deferred-idle drain. [Experimental(Diagnostics.Experimental)] internal sealed class QueueBeginDeferredIdleDrainRequest { /// Whether the host still has active background work. [JsonPropertyName("activeBackgroundWork")] public bool ActiveBackgroundWork { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Action selected by the native deferred-idle drain. [Experimental(Diagnostics.Experimental)] internal sealed class QueueFinishDeferredIdleDrainResult { /// Whether the deferred idle was caused by an aborted foreground turn. [JsonPropertyName("aborted")] public bool Aborted { get; set; } /// One of none, processQueue, or emitSessionIdle. [JsonPropertyName("action")] public string Action { get; set; } = string.Empty; } /// Inputs for completing a deferred-idle drain. [Experimental(Diagnostics.Experimental)] internal sealed class QueueFinishDeferredIdleDrainRequest { /// Whether the host still has active background work. [JsonPropertyName("activeBackgroundWork")] public bool ActiveBackgroundWork { get; set; } /// Whether native queued work remains. [JsonPropertyName("hasPending")] public bool HasPending { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Inputs for marking session.idle deferred in native state. [Experimental(Diagnostics.Experimental)] internal sealed class QueueDeferSessionIdleRequest { /// Whether the deferred idle was caused by an aborted foreground turn. [JsonPropertyName("aborted")] public bool Aborted { get; set; } /// 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; } /// Internal filter for consuming queued system notifications. [Experimental(Diagnostics.Experimental)] internal sealed class QueueConsumeSystemNotificationsRequest { /// Opaque runtime-owned filter object. [JsonPropertyName("filter")] public JsonElement Filter { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Result of enqueueing the resume-pending wake item. [Experimental(Diagnostics.Experimental)] internal sealed class QueueEnqueueResumePendingResult { /// True when a wake item was newly queued. [JsonPropertyName("queued")] public bool Queued { get; set; } } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionQueueEnqueueResumePendingRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionQueueProcessRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Cursor, batch size, and optional long-poll/filter parameters for reading session events. [Experimental(Diagnostics.Experimental)] internal sealed class EventLogReadRequest { /// Optional non-empty list of subagent identifiers. When provided, only events owned by one of these agents are returned; ownership recognizes the event envelope's agentId plus legacy data.agentId and data.parentToolCallId markers. This filter takes precedence over agentScope. [JsonPropertyName("agentIds")] public IList? AgentIds { get; set; } /// 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; } /// Direction to page through the session's persisted event history. 'forward' (default) pages from the cursor toward newer events (or from the start of history when no cursor is given). 'backward' enables tail-first reads: with no cursor it returns the NEWEST `max` events, and the returned cursor pages toward OLDER events on subsequent backward reads. Events within a returned batch are always in chronological (oldest-to-newest) order, even for a backward read. Backward reads cover PERSISTED history only; ephemeral events are never returned by a backward read. `direction` selects the INITIAL read only: the returned cursor is self-describing, so a continuation read pages in the cursor's own direction regardless of the `direction` passed alongside it — a forward cursor always pages forward and a backward cursor always pages backward. Pass the direction that matches the cursor to avoid confusion. [JsonPropertyName("direction")] public EventsReadDirection? Direction { get; set; } /// When false, skip ephemeral events entirely and return only durable (persisted) events. History-backfill callers that discard ephemerals anyway should set this so the read is bounded by the durable log length instead of racing the ephemeral ring on a busy session. Defaults to true (ephemerals are interleaved with durable events in creation order). Ignored by backward reads, which always cover persisted history only. [JsonPropertyName("includeEphemeral")] public bool? IncludeEphemeral { get; set; } /// Maximum number of events to return in this batch (1–1000, default 200). [JsonPropertyName("max")] public long? 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). This applies to forward reads only: a backward read always returns immediately and ignores `waitMs`, because backward paging covers persisted history only while new events append at the tail (the opposite end from a backward page), so no blocking or ephemeral delivery can occur. [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 interactive OAuth token acquisition to the consumer via `mcp.oauth_required` events; when no interest is registered the runtime still attempts non-interactive reconnect from cached or refreshable tokens, and only marks the server `needs-auth` if usable credentials are unavailable — it does not open a browser or start interactive OAuth without a consumer). 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`, `session_limits_exhausted.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; } /// 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; } } /// Per-model token-detail entry containing the accumulated token count for one token 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; } } /// Per-model usage metrics, including request counts/costs, token usage, nano-AI units, and per-token-type details. [Experimental(Diagnostics.Experimental)] public sealed class UsageMetricsModelMetric { /// Latest known prompt-cache expiration for this model. A timestamp in the past indicates that the observed cache has expired. [JsonPropertyName("cacheExpiresAt")] public DateTimeOffset? CacheExpiresAt { get; set; } /// 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; } } /// Usage attributed to one agent instance, including its identity, API duration, AI units, and per-model breakdown. [Experimental(Diagnostics.Experimental)] public sealed class UsageMetricsAgentMetric { /// Human-readable label for this subagent invocation, copied from the originating `subagent.started` event. For task-tool subagents this is the invocation's task description rather than the agent's configured display name, so group by `agentName` for stable per-agent labels. [JsonPropertyName("agentDisplayName")] public string? AgentDisplayName { get; set; } /// Configured agent name, when this is a subagent. [JsonPropertyName("agentName")] public string? AgentName { get; set; } /// Per-model usage for this agent, keyed by model identifier. [JsonPropertyName("modelMetrics")] public IDictionary ModelMetrics { get => field ??= new Dictionary(); set; } /// Time spent in model API calls by this agent, in milliseconds. [JsonConverter(typeof(MillisecondsTimeSpanConverter))] [JsonPropertyName("totalApiDurationMs")] public TimeSpan TotalApiDuration { get; set; } /// Accumulated nano-AI units cost for this agent. [JsonPropertyName("totalNanoAiu")] public double TotalNanoAiu { get; set; } } /// 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; } } /// Session-wide token-detail entry containing the accumulated token count for one token 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 { /// Per-agent usage metrics, keyed by agent instance identifier. The main conversation uses the stable key `main`. [JsonPropertyName("agentMetrics")] public IDictionary? AgentMetrics { get; set; } /// 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; } /// Prediction result. Available results include prediction details; unavailable results include an explicit reason. /// Polymorphic base type discriminated by kind. [Experimental(Diagnostics.Experimental)] [JsonPolymorphic( TypeDiscriminatorPropertyName = "kind", UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToBaseType)] [JsonDerivedType(typeof(SessionLimitPredictionResultAvailable), "available")] [JsonDerivedType(typeof(SessionLimitPredictionResultUnavailable), "unavailable")] public partial class SessionLimitPredictionResult { /// The type discriminator. [JsonPropertyName("kind")] public virtual string Kind { get; set; } = string.Empty; } /// Baseline data provenance for a prediction. [Experimental(Diagnostics.Experimental)] public sealed class SessionLimitPredictionBaselineData { /// End of the baseline data slice. [JsonPropertyName("windowEnd")] public string WindowEnd { get; set; } = string.Empty; /// Start of the baseline data slice. [JsonPropertyName("windowStart")] public string WindowStart { get; set; } = string.Empty; } /// Semantic usage tier and its AI-credit cap. [Experimental(Diagnostics.Experimental)] public sealed class SessionLimitPredictionTierOption { /// AI-credit cap for this tier. [JsonPropertyName("cap")] public double Cap { get; set; } /// Semantic usage tier. [JsonPropertyName("tier")] public SessionLimitPredictionTier Tier { get; set; } } /// Explainable AI-credit session-limit prediction. [Experimental(Diagnostics.Experimental)] public sealed class SessionLimitPredictionDetails { /// Baseline data provenance. [JsonPropertyName("baselineData")] public SessionLimitPredictionBaselineData BaselineData { get => field ??= new(); set; } /// Client population used for the prediction. [JsonPropertyName("clientType")] public SessionLimitPredictionClientType ClientType { get; set; } /// Resolved model family when known. [JsonPropertyName("family")] public string? Family { get; set; } /// Model identifier used for lookup. [JsonPropertyName("modelId")] public string ModelId { get; set; } = string.Empty; /// Recommended maximum AI credits for this session. [JsonPropertyName("recommendedCap")] public double RecommendedCap { get; set; } /// Tier chosen as the recommended cap. [JsonPropertyName("recommendedTier")] public SessionLimitPredictionTier RecommendedTier { get; set; } /// Baseline fallback level used to create the prediction. [JsonPropertyName("source")] public SessionLimitPredictionSource Source { get; set; } /// Key matched at the source level, such as a model id, family id, or `global`. [JsonPropertyName("sourceKey")] public string SourceKey { get; set; } = string.Empty; /// Ordered usage tiers and their AI-credit caps. [JsonPropertyName("tiers")] public IList Tiers { get => field ??= []; set; } } /// The available variant of . [Experimental(Diagnostics.Experimental)] public partial class SessionLimitPredictionResultAvailable : SessionLimitPredictionResult { /// [JsonIgnore] public override string Kind => "available"; /// Predicted session limit details. [JsonPropertyName("prediction")] public required SessionLimitPredictionDetails Prediction { get; set; } } /// The unavailable variant of . [Experimental(Diagnostics.Experimental)] public partial class SessionLimitPredictionResultUnavailable : SessionLimitPredictionResult { /// [JsonIgnore] public override string Kind => "unavailable"; /// Reason no prediction is available. [JsonPropertyName("reason")] public required SessionLimitPredictionUnavailableReason Reason { get; set; } } /// RPC data type for SessionLimitPredictionPredict operations. [Experimental(Diagnostics.Experimental)] public sealed class SessionLimitPredictionPredictRequest { /// Client type to size for. Defaults to `cli-interactive`. [JsonPropertyName("clientType")] public SessionLimitPredictionClientType? ClientType { get; set; } /// Optional model identifier override. If omitted, the session's current model is used. [JsonPropertyName("modelId")] public string? ModelId { get; set; } } /// RPC data type for SessionLimitPredictionPredictRequestWithSession operations. [Experimental(Diagnostics.Experimental)] internal sealed class SessionLimitPredictionPredictRequestWithSession { /// Client type to size for. Defaults to `cli-interactive`. [JsonPropertyName("clientType")] public SessionLimitPredictionClientType? ClientType { get; set; } /// Optional model identifier override. If omitted, the session's current model is used. [JsonPropertyName("modelId")] public string? ModelId { get; set; } /// 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; } /// Current sharing status and shareable GitHub URL for a session. [Experimental(Diagnostics.Experimental)] public sealed class VisibilityGetResult { /// Shareable GitHub URL for the session. Present when the session is synced and the URL can be resolved. [Url] [StringSyntax(StringSyntaxAttribute.Uri)] [JsonPropertyName("shareUrl")] public string? ShareUrl { get; set; } /// Current sharing status. Absent when the session is not synced or the status could not be retrieved (e.g. the user is not authenticated). [JsonPropertyName("status")] public SessionVisibilityStatus? Status { get; set; } /// Whether the session has been synced to Mission Control (i.e. has a GitHub task). When false, the session cannot be shared and `status`/`shareUrl` are absent. [JsonPropertyName("synced")] public bool Synced { get; set; } } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionVisibilityGetRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Effective sharing status and shareable GitHub URL after updating session visibility. [Experimental(Diagnostics.Experimental)] public sealed class VisibilitySetResult { /// Shareable GitHub URL for the session. Present when the session is synced and the URL can be resolved. [Url] [StringSyntax(StringSyntaxAttribute.Uri)] [JsonPropertyName("shareUrl")] public string? ShareUrl { get; set; } /// Effective sharing status after the update. May differ from the requested status for task types that are already visible to repository readers by default. Absent when the update could not be applied (e.g. the session is not synced or the user is not authenticated). [JsonPropertyName("status")] public SessionVisibilityStatus? Status { get; set; } /// Whether the session has been synced to Mission Control (i.e. has a GitHub task). When false, the visibility change could not be applied and `status`/`shareUrl` are absent. [JsonPropertyName("synced")] public bool Synced { get; set; } } /// Desired sharing status for the session. [Experimental(Diagnostics.Experimental)] internal sealed class VisibilitySetRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; /// Sharing status to apply. "repo" makes the session visible to repository readers; "unshared" restricts it to the creator and collaborators. [JsonPropertyName("status")] public SessionVisibilityStatus Status { get; set; } } /// Scheduled prompt entry with ID, timing (`intervalMs`, `cron`, or `at`), prompt text, recurrence, and next run time. [Experimental(Diagnostics.Experimental)] public sealed class ScheduleEntry { /// Absolute fire time (epoch milliseconds) for a one-shot calendar schedule. [JsonPropertyName("at")] public long? At { get; set; } /// 5-field cron expression for a recurring calendar schedule, evaluated in `tz`. [JsonPropertyName("cron")] public string? Cron { get; set; } /// 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 (relative-interval schedules). [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; } /// True for a self-paced (`dynamic`) schedule: no fixed cadence; the model arms each next run via the `manage_schedule` `wakeup` action. `nextRunAt` is model-controlled. [JsonPropertyName("selfPaced")] public bool? SelfPaced { get; set; } /// IANA timezone the `cron` expression is evaluated in. [JsonPropertyName("tz")] public string? Tz { 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; } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionScheduleHydrateRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Whether the session currently has an active self-paced schedule. [Experimental(Diagnostics.Experimental)] internal sealed class ScheduleHasSelfPacedResult { /// True when at least one active schedule is self-paced. [JsonPropertyName("hasSelfPaced")] public bool HasSelfPaced { get; set; } } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] internal sealed class SessionScheduleHasSelfPacedRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Result of registering or re-arming a scheduled prompt. [Experimental(Diagnostics.Experimental)] internal sealed class ScheduleAddResult { /// The registered or updated schedule entry. [JsonPropertyName("entry")] public ScheduleEntry? Entry { get; set; } /// User-facing validation error, when registration failed. [JsonPropertyName("error")] public string? Error { get; set; } } /// Register a relative-interval scheduled prompt. [Experimental(Diagnostics.Experimental)] internal sealed class ScheduleAddRequest { /// Optional display-only prompt label. [JsonPropertyName("displayPrompt")] public string? DisplayPrompt { get; set; } /// Human-readable interval such as `30s`, `5m`, or `2h`. [JsonPropertyName("interval")] public string Interval { get; set; } = string.Empty; /// Prompt text to enqueue when the schedule fires. [JsonPropertyName("prompt")] public string Prompt { get; set; } = string.Empty; /// Whether the schedule should re-arm after each tick. Defaults to true. [JsonPropertyName("recurring")] public bool? Recurring { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Register a cron scheduled prompt. [Experimental(Diagnostics.Experimental)] internal sealed class ScheduleAddCronRequest { /// 5-field cron expression. [JsonPropertyName("cron")] public string Cron { get; set; } = string.Empty; /// Optional display-only prompt label. [JsonPropertyName("displayPrompt")] public string? DisplayPrompt { get; set; } /// Prompt text to enqueue when the schedule fires. [JsonPropertyName("prompt")] public string Prompt { get; set; } = string.Empty; /// Whether the schedule should re-arm after each tick. Defaults to true. [JsonPropertyName("recurring")] public bool? Recurring { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; /// IANA timezone for evaluating the cron expression. [JsonPropertyName("tz")] public string? Tz { get; set; } } /// Register an absolute-time scheduled prompt. [Experimental(Diagnostics.Experimental)] internal sealed class ScheduleAddAtRequest { /// Epoch milliseconds when the prompt should fire. [JsonPropertyName("at")] public long At { get; set; } /// Optional display-only prompt label. [JsonPropertyName("displayPrompt")] public string? DisplayPrompt { get; set; } /// Prompt text to enqueue when the schedule fires. [JsonPropertyName("prompt")] public string Prompt { get; set; } = string.Empty; /// Whether the schedule should re-arm after each tick. Defaults to false. [JsonPropertyName("recurring")] public bool? Recurring { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Register a self-paced scheduled prompt. [Experimental(Diagnostics.Experimental)] internal sealed class ScheduleAddSelfPacedRequest { /// Optional display-only prompt label. [JsonPropertyName("displayPrompt")] public string? DisplayPrompt { get; set; } /// Prompt text to enqueue when the schedule fires. [JsonPropertyName("prompt")] public string Prompt { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Re-arm a self-paced scheduled prompt. [Experimental(Diagnostics.Experimental)] internal sealed class ScheduleRearmSelfPacedRequest { /// Epoch milliseconds when the prompt should next fire. [JsonPropertyName("at")] public long At { get; set; } /// Id of the self-paced scheduled prompt. [JsonPropertyName("id")] public long Id { get; set; } /// 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; } /// A bearer token supplied by the SDK client for a BYOK provider. The runtime sets it as `Authorization: Bearer <token>` on the outbound request and does no caching; the SDK consumer owns token caching and refresh. [Experimental(Diagnostics.Experimental)] public sealed class ProviderTokenAcquireResult { /// The bearer token value (without the `Bearer ` prefix). [JsonPropertyName("token")] public string Token { get; set; } = string.Empty; } /// Asks the SDK client to acquire a bearer token for a BYOK provider whose config set `hasBearerTokenProvider: true`. Issued by the runtime before each outbound model request; the runtime does no caching, so this is sent once per request. [Experimental(Diagnostics.Experimental)] public sealed class ProviderTokenAcquireRequest { /// Name of the BYOK provider needing a token. For the legacy whole-session provider this is the implicit provider name; for named providers it is the configured provider name. [JsonPropertyName("providerName")] public string ProviderName { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Result returned by an extension factory closure. [Experimental(Diagnostics.Experimental)] public sealed class FactoryExecuteResult { /// Factory result value. [JsonPropertyName("result")] public JsonElement? Result { get; set; } } /// Parameters sent to the owning extension to execute a factory closure. [Experimental(Diagnostics.Experimental)] public sealed class FactoryExecuteRequest { /// Factory input value. [JsonPropertyName("args")] public JsonElement Args { get; set; } /// Opaque token identifying this factory execution attempt. [JsonPropertyName("executionToken")] public string ExecutionToken { get; set; } = string.Empty; /// Registered factory name. [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; /// Factory run identifier. [JsonPropertyName("runId")] public string RunId { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Parameters for cooperatively aborting a factory body. [Experimental(Diagnostics.Experimental)] public sealed class FactoryAbortRequest { /// Opaque token identifying the execution attempt to abort. [JsonPropertyName("executionToken")] public string ExecutionToken { get; set; } = string.Empty; /// Factory run identifier. [JsonPropertyName("runId")] public string RunId { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Whether the client authoritatively confirmed its external work stopped. [Experimental(Diagnostics.Experimental)] public sealed class ClientTaskCancelResult { /// True only when the owner confirms that external work stopped before responding. [JsonPropertyName("cancelled")] public bool Cancelled { get; set; } } /// Runtime-to-owner cancellation request for a client-owned task. [Experimental(Diagnostics.Experimental)] public sealed class ClientTaskCancelRequest { /// Opaque identifier shared by coalesced cancellation callers. [JsonPropertyName("cancellationId")] public string CancellationId { get; set; } = string.Empty; /// Owner-scoped task key included for correlation. [JsonPropertyName("clientTaskId")] public string ClientTaskId { get; set; } = string.Empty; /// Canonical runtime-generated task identifier. [JsonPropertyName("id")] public string Id { get; set; } = string.Empty; /// Reason the runtime requests cancellation. [JsonPropertyName("reason")] public ClientTaskCancelReason Reason { get; set; } /// Session that owns the client task. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Describes a filesystem error. [Experimental(Diagnostics.Experimental)] 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. [Experimental(Diagnostics.Experimental)] 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. [Experimental(Diagnostics.Experimental)] 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. [Experimental(Diagnostics.Experimental)] 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. Implementations create parent directories as needed. [Experimental(Diagnostics.Experimental)] 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. [Experimental(Diagnostics.Experimental)] 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. [Experimental(Diagnostics.Experimental)] 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. [Experimental(Diagnostics.Experimental)] 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. [Experimental(Diagnostics.Experimental)] 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. [Experimental(Diagnostics.Experimental)] 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. [Experimental(Diagnostics.Experimental)] 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. [Experimental(Diagnostics.Experimental)] 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; } /// Directory entry returned by session filesystem `readdirWithTypes`, with name and entry type. [Experimental(Diagnostics.Experimental)] 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. [Experimental(Diagnostics.Experimental)] 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. [Experimental(Diagnostics.Experimental)] 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. [Experimental(Diagnostics.Experimental)] 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. [Experimental(Diagnostics.Experimental)] 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. [Experimental(Diagnostics.Experimental)] 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. The provider applies its SQLite busy timeout for every call. [Experimental(Diagnostics.Experimental)] 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; } /// Classified SQLite transaction failure. busyOrLocked guarantees rollback; postCommitAmbiguous must never be retried. [Experimental(Diagnostics.Experimental)] public sealed class SessionFsSqliteTransactionError { /// Machine-readable classification of the transaction failure. [JsonPropertyName("errorClass")] public SessionFsSqliteTransactionErrorClass ErrorClass { get; set; } /// Human-readable transaction failure message. [JsonPropertyName("message")] public string Message { get; set; } = string.Empty; } /// Per-statement results, or a classified transaction error. [Experimental(Diagnostics.Experimental)] public sealed class SessionFsSqliteTransactionResult { /// Classified transaction failure, when execution did not succeed. [JsonPropertyName("error")] public SessionFsSqliteTransactionError? Error { get; set; } /// Per-statement query results in input order. [JsonPropertyName("results")] public IList Results { get => field ??= []; set; } } /// One statement in an atomic SQLite transaction. [Experimental(Diagnostics.Experimental)] public sealed class SessionFsSqliteTransactionStatement { /// Optional named bind parameters. [JsonPropertyName("params")] public IDictionary? Params { get; set; } /// SQL statement to execute. [JsonPropertyName("query")] public string Query { get; set; } = string.Empty; /// How to execute the statement. [JsonPropertyName("queryType")] public SessionFsSqliteQueryType QueryType { get; set; } } /// Statements to execute atomically. Providers apply busy handling for every call. [Experimental(Diagnostics.Experimental)] public sealed class SessionFsSqliteTransactionRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; /// Ordered SQL statements to execute in one transaction. [JsonPropertyName("statements")] public IList Statements { get => field ??= []; set; } } /// Indicates whether the per-session SQLite database already exists. [Experimental(Diagnostics.Experimental)] 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; } /// Canvas open result returned by the provider. [Experimental(Diagnostics.Experimental)] public sealed class CanvasProviderOpenResult { /// Provider-supplied status text. [JsonPropertyName("status")] public string? Status { get; set; } /// Provider-supplied title. [JsonPropertyName("title")] public string? Title { get; set; } /// URL for web-rendered canvases. [JsonPropertyName("url")] public string? Url { get; set; } } /// Host capabilities. [Experimental(Diagnostics.Experimental)] public sealed class CanvasHostContextCapabilities { /// Whether canvas rendering is supported. [JsonPropertyName("canvases")] public bool? Canvases { get; set; } } /// Host context supplied by the runtime. [Experimental(Diagnostics.Experimental)] public sealed class CanvasHostContext { /// Host capabilities. [JsonPropertyName("capabilities")] public CanvasHostContextCapabilities? Capabilities { get; set; } } /// Session context supplied by the runtime. [Experimental(Diagnostics.Experimental)] public sealed class CanvasSessionContext { /// Active session working directory, when known. [JsonPropertyName("workingDirectory")] public string? WorkingDirectory { get; set; } } /// Canvas open parameters sent to the provider. [Experimental(Diagnostics.Experimental)] public sealed class CanvasProviderOpenRequest { /// Provider-local canvas identifier. [JsonPropertyName("canvasId")] public string CanvasId { get; set; } = string.Empty; /// Owning provider identifier. [JsonPropertyName("extensionId")] public string ExtensionId { get; set; } = string.Empty; /// Host context supplied by the runtime. [JsonPropertyName("host")] public CanvasHostContext? Host { get; set; } /// Canvas open input. [JsonPropertyName("input")] public JsonElement? Input { get; set; } /// Stable caller-supplied canvas instance identifier. [JsonPropertyName("instanceId")] public string InstanceId { get; set; } = string.Empty; /// Session context supplied by the runtime. [JsonPropertyName("session")] public CanvasSessionContext? Session { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Canvas close parameters sent to the provider. [Experimental(Diagnostics.Experimental)] public sealed class CanvasProviderCloseRequest { /// Provider-local canvas identifier. [JsonPropertyName("canvasId")] public string CanvasId { get; set; } = string.Empty; /// Owning provider identifier. [JsonPropertyName("extensionId")] public string ExtensionId { get; set; } = string.Empty; /// Host context supplied by the runtime. [JsonPropertyName("host")] public CanvasHostContext? Host { get; set; } /// Canvas instance identifier. [JsonPropertyName("instanceId")] public string InstanceId { get; set; } = string.Empty; /// Session context supplied by the runtime. [JsonPropertyName("session")] public CanvasSessionContext? Session { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Canvas action invocation parameters sent to the provider. [Experimental(Diagnostics.Experimental)] public sealed class CanvasProviderInvokeActionRequest { /// Action name to invoke. [JsonPropertyName("actionName")] public string ActionName { get; set; } = string.Empty; /// Provider-local canvas identifier. [JsonPropertyName("canvasId")] public string CanvasId { get; set; } = string.Empty; /// Owning provider identifier. [JsonPropertyName("extensionId")] public string ExtensionId { get; set; } = string.Empty; /// Host context supplied by the runtime. [JsonPropertyName("host")] public CanvasHostContext? Host { get; set; } /// Action input. [JsonPropertyName("input")] public JsonElement? Input { get; set; } /// Canvas instance identifier. [JsonPropertyName("instanceId")] public string InstanceId { get; set; } = string.Empty; /// Session context supplied by the runtime. [JsonPropertyName("session")] public CanvasSessionContext? Session { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } /// Opaque integrator-owned process launch profile for one extension entrypoint. [Experimental(Diagnostics.Experimental)] public sealed class ExtensionLaunchProfile { /// Opaque integrator-defined arguments passed to the executable. The runtime does not append the extension entrypoint. [JsonPropertyName("args")] public IList Args { get => field ??= []; set; } /// Opaque integrator-defined environment variables. Runtime-owned COPILOT_SDK_PATH, SESSION_ID, and COPILOT_EXTENSION_PARENT_PID values take precedence. [JsonPropertyName("env")] public IDictionary Env { get => field ??= new Dictionary(); set; } /// Executable used to launch the extension entrypoint. [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("executable")] public string Executable { get; set; } = string.Empty; } /// The launch profile for a supported entrypoint. Omit launch when the provider does not support the entrypoint. [Experimental(Diagnostics.Experimental)] public sealed class ExtensionLaunchProviderResolveResult { /// Opaque launch profile, omitted when this provider does not support the entrypoint. [JsonPropertyName("launch")] public ExtensionLaunchProfile? Launch { get; set; } } /// A discovered extension entrypoint that the registered integrator may classify and resolve to an opaque launch profile. [Experimental(Diagnostics.Experimental)] public sealed class ExtensionLaunchProviderResolveRequest { /// Source-qualified extension identifier. [JsonPropertyName("id")] public string Id { get; set; } = string.Empty; /// Absolute path to the discovered extension entrypoint. [JsonPropertyName("modulePath")] public string ModulePath { get; set; } = string.Empty; /// Human-readable extension name. [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; /// Discovery source for the extension entrypoint. [JsonPropertyName("source")] public ExtensionSource Source { get; set; } } /// Acknowledgement. Returning successfully simply means the SDK accepted the start frame; it does not imply the request will succeed. [Experimental(Diagnostics.Experimental)] public sealed class LlmInferenceHttpRequestStartResult { } /// The head of an outbound model-layer HTTP request. [Experimental(Diagnostics.Experimental)] public sealed class LlmInferenceHttpRequestStartRequest { /// Stable identity of the agent trajectory that issued this request. Present when the request originates from an agent turn; absent for requests outside any agent context. This is the same identity used by lifecycle and bridged session events and remains constant across turns and retries. [JsonPropertyName("agentId")] public string? AgentId { get; set; } /// Identity of the agent invocation (one agentic loop) that issued this request. It remains fixed across physical retries within the invocation and is distinct from the stable trajectory `agentId`. A caller-supplied invocation id always takes precedence (this covers auxiliary calls that have no model call id). Otherwise, first-party CAPI requests fall back to the runtime's agent task id — the same value the runtime emits as the `X-Agent-Task-Id` header — while custom-provider requests fall back to the model call id. [JsonPropertyName("agentInvocationId")] public string? AgentInvocationId { get; set; } /// HTTP request headers, preserving multiple values per name. [JsonPropertyName("headers")] public IDictionary> Headers { get => field ??= new Dictionary>(); set; } /// Coarse classification of the interaction that produced this request. Open string for forward-compatibility; known values include `conversation-agent`, `conversation-subagent`, `conversation-sampling`, `conversation-background`, `conversation-compaction`, and `conversation-user`. Absent when the runtime did not classify the request. Comes from the runtime's per-request agent context independently of transport; on the CAPI transport the runtime derives the upstream `X-Interaction-Type` header from this same context. [JsonPropertyName("interactionType")] public string? InteractionType { get; set; } /// HTTP method, e.g. GET, POST. [JsonPropertyName("method")] public string Method { get; set; } = string.Empty; /// Stable identity of the immediate parent trajectory. Present for child trajectories such as subagents and conversation-sampling requests; absent for root-agent and non-agent requests. [JsonPropertyName("parentAgentId")] public string? ParentAgentId { get; set; } /// Opaque runtime-minted id, unique per in-flight request. The SDK uses this to correlate httpRequestChunk frames and to address its httpResponseStart / httpResponseChunk replies back to the runtime. [JsonPropertyName("requestId")] public string RequestId { get; set; } = string.Empty; /// Id of the runtime session that triggered this request, when one is in scope. Absent for requests issued outside any session (e.g. startup model-catalog or capability resolution). This is a payload field — not a dispatch key — because the client-global API is registered process-wide rather than per session. [JsonPropertyName("sessionId")] public string? SessionId { get; set; } /// Transport the runtime would otherwise use for this request. `http` (the default when absent) covers plain HTTP and SSE responses; `websocket` indicates a full-duplex message channel where each body chunk maps to one WebSocket message and the `binary` flag distinguishes text from binary frames. The SDK consumer uses this to decide whether to service the request with an HTTP client or a WebSocket client. It is the one piece of request metadata the consumer cannot reliably infer from the URL or headers alone. [JsonPropertyName("transport")] public LlmInferenceHttpRequestStartTransport? Transport { get; set; } /// Absolute request URL. [JsonPropertyName("url")] public string Url { get; set; } = string.Empty; } /// Acknowledgement. The SDK is free to ignore the ack and treat chunk delivery as fire-and-forget. [Experimental(Diagnostics.Experimental)] public sealed class LlmInferenceHttpRequestChunkResult { } /// A request body chunk or cancellation signal. [Experimental(Diagnostics.Experimental)] public sealed class LlmInferenceHttpRequestChunkRequest { /// Identity of the agent invocation (one agentic loop) this body chunk belongs to, matching the `agentInvocationId` semantics on httpRequestStart. Carried per chunk so a persistent transport can attribute successive turns correctly: when a WebSocket connection is reused across turns, the httpRequestStart identity reflects only the turn that opened the connection, so each later turn stamps its own invocation id here. Absent when the runtime has no invocation context for the request, or on the plain-HTTP transport where every request has its own httpRequestStart. [JsonPropertyName("agentInvocationId")] public string? AgentInvocationId { get; set; } /// When true, `data` is base64-encoded bytes. When absent or false, `data` is UTF-8 text. [JsonPropertyName("binary")] public bool? Binary { get; set; } /// When true, the runtime is cancelling the in-flight request (e.g. upstream consumer aborted). `data` is ignored. Implies end-of-request. [JsonPropertyName("cancel")] public bool? Cancel { get; set; } /// Optional human-readable reason for the cancellation, propagated for logging. [JsonPropertyName("cancelReason")] public string? CancelReason { get; set; } /// Body byte range. UTF-8 text when `binary` is absent or false; base64-encoded bytes when `binary` is true. May be empty. [JsonPropertyName("data")] public string Data { get; set; } = string.Empty; /// When true, this is the final body chunk for the request. The SDK may rely on having received an end-marked chunk before treating the request body as complete. [JsonPropertyName("end")] public bool? End { get; set; } /// Matches the requestId from the originating httpRequestStart frame. [JsonPropertyName("requestId")] public string RequestId { get; set; } = string.Empty; } /// Client environment metadata describing the process that produced a telemetry event. [Experimental(Diagnostics.Experimental)] public sealed class GitHubTelemetryClientInfo { /// Copilot CLI version string. [JsonPropertyName("cli_version")] public string CliVersion { get; set; } = string.Empty; /// Name of the client application. [JsonPropertyName("client_name")] public string? ClientName { get; set; } /// Type of client. [JsonPropertyName("client_type")] public string? ClientType { get; set; } /// Copilot subscription plan, when known. [JsonPropertyName("copilot_plan")] public string? CopilotPlan { get; set; } /// Number of logical CPU cores on the host. [JsonPropertyName("cpu_count")] public long? CpuCount { get; set; } /// Distinct CPU model names for the host, comma-separated. [JsonPropertyName("cpu_model")] public string? CpuModel { get; set; } /// Stable machine identifier for the device. [JsonPropertyName("dev_device_id")] public string? DevDeviceId { get; set; } /// Whether the user is a GitHub/Microsoft staff member. [JsonPropertyName("is_staff")] public bool? IsStaff { get; set; } /// Node.js runtime version string. [JsonPropertyName("node_version")] public string NodeVersion { get; set; } = string.Empty; /// Operating system architecture (e.g. arm64, x64). [JsonPropertyName("os_arch")] public string OsArch { get; set; } = string.Empty; /// Operating system platform (e.g. darwin, linux, win32). [JsonPropertyName("os_platform")] public string OsPlatform { get; set; } = string.Empty; /// Operating system version string. [JsonPropertyName("os_version")] public string OsVersion { get; set; } = string.Empty; } /// A single telemetry event in the runtime's native GitHub-shaped telemetry format, forwarded verbatim to opted-in hosts. The `restricted` flag on the enclosing GitHubTelemetryNotification distinguishes standard from restricted events; the payload shape is identical for both. [Experimental(Diagnostics.Experimental)] public sealed class GitHubTelemetryEvent { /// Client environment metadata. [JsonPropertyName("client")] public GitHubTelemetryClientInfo? Client { get; set; } /// Copilot tracking ID for user-level attribution. [JsonPropertyName("copilot_tracking_id")] public string? CopilotTrackingId { get; set; } /// Timestamp when the event was created (ISO 8601 format). [JsonPropertyName("created_at")] public string? CreatedAt { get; set; } /// Experiment assignment context. [JsonPropertyName("exp_assignment_context")] public string? ExpAssignmentContext { get; set; } /// Feature flags enabled for this session, as a map from flag to value. [JsonPropertyName("features")] public IDictionary? Features { get; set; } /// Event type/kind (e.g. get_completion_with_tools_turn, tool_call_executed). [JsonPropertyName("kind")] public string Kind { get; set; } = string.Empty; /// Numeric metrics as a map from key to value. [JsonPropertyName("metrics")] public IDictionary Metrics { get => field ??= new Dictionary(); set; } /// Reference to the model call that produced this event. [JsonPropertyName("model_call_id")] public string? ModelCallId { get; set; } /// String-valued properties as a map from key to value. [JsonPropertyName("properties")] public IDictionary Properties { get => field ??= new Dictionary(); set; } /// Session identifier the event belongs to. [JsonPropertyName("session_id")] public string? SessionId { get; set; } } /// Payload for a `gitHubTelemetry.event` notification: a single GitHub telemetry event the runtime forwards to a host connection that opted into telemetry forwarding during the `server.connect` handshake. [Experimental(Diagnostics.Experimental)] public sealed class GitHubTelemetryNotification { /// The telemetry event, in the runtime's native GitHub-shaped telemetry format. [JsonPropertyName("event")] public GitHubTelemetryEvent Event { get => field ??= new(); set; } /// Whether this is a restricted telemetry event (cli.restricted_telemetry). Hosts must route restricted events to first-party Microsoft stores only. [JsonPropertyName("restricted")] public bool Restricted { get; set; } /// Session the telemetry event belongs to, when it is session-scoped. Omitted for sessionless events (for example, `server.sendTelemetry` calls with no session id), which are still forwarded to opted-in connections. [JsonPropertyName("sessionId")] public string? SessionId { get; set; } } /// SDK host response to a GitHub credential request. /// Polymorphic base type discriminated by kind. [Experimental(Diagnostics.Experimental)] [JsonPolymorphic( TypeDiscriminatorPropertyName = "kind", UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToBaseType)] [JsonDerivedType(typeof(GitHubTokenAcquireResultToken), "token")] [JsonDerivedType(typeof(GitHubTokenAcquireResultCancelled), "cancelled")] public partial class GitHubTokenAcquireResult { /// The type discriminator. [JsonPropertyName("kind")] public virtual string Kind { get; set; } = string.Empty; } /// The token variant of . [Experimental(Diagnostics.Experimental)] public partial class GitHubTokenAcquireResultToken : GitHubTokenAcquireResult { /// [JsonIgnore] public override string Kind => "token"; /// GitHub access token acquired by the SDK host. [JsonPropertyName("accessToken")] public required string AccessToken { get; set; } /// Remaining token lifetime in seconds when callback execution completes. It must exceed the one-hour preflight refresh threshold. [JsonPropertyName("expiresIn")] public required long ExpiresIn { get; set; } /// OAuth token type. Defaults to bearer when omitted. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("tokenType")] public string? TokenType { get; set; } } /// The cancelled variant of . [Experimental(Diagnostics.Experimental)] public partial class GitHubTokenAcquireResultCancelled : GitHubTokenAcquireResult { /// [JsonIgnore] public override string Kind => "cancelled"; } /// Asks the SDK client to acquire a GitHub access token from an opaque callback registration. [Experimental(Diagnostics.Experimental)] public sealed class GitHubTokenAcquireRequest { /// Effective GitHub host for which the callback must return a token. [JsonPropertyName("host")] public string Host { get; set; } = string.Empty; /// Why the runtime is requesting a GitHub credential. [JsonPropertyName("reason")] public GitHubTokenAcquireReason Reason { get; set; } /// Opaque identifier generated by the SDK for this callback registration. [JsonPropertyName("registrationId")] public string RegistrationId { get; set; } = string.Empty; /// Session receiving the token. Absent only before a cloud session has been assigned its id. [JsonPropertyName("sessionId")] public string? SessionId { get; set; } } /// Closed set of public task kinds a connection can negotiate. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct TaskKind : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public TaskKind(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Runtime-owned background agent task. public static TaskKind Agent { get; } = new("agent"); /// Runtime-owned shell task. public static TaskKind Shell { get; } = new("shell"); /// Client-owned externally executed task. public static TaskKind Client { get; } = new("client"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(TaskKind left, TaskKind right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(TaskKind left, TaskKind right) => !(left == right); /// public override bool Equals(object? obj) => obj is TaskKind other && Equals(other); /// public bool Equals(TaskKind 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 TaskKind Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, TaskKind value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(TaskKind)); } } } /// Hook event name. Discovery emits the file-configurable subset; SDK callbacks additionally support callback-only events. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct HookType : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public HookType(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Runs before a tool is invoked. public static HookType PreToolUse { get; } = new("preToolUse"); /// Runs before an MCP tool is invoked. public static HookType PreMcpToolCall { get; } = new("preMcpToolCall"); /// Runs after a tool completes successfully. public static HookType PostToolUse { get; } = new("postToolUse"); /// Runs after a tool fails. public static HookType PostToolUseFailure { get; } = new("postToolUseFailure"); /// Runs after the user submits a prompt. public static HookType UserPromptSubmitted { get; } = new("userPromptSubmitted"); /// Runs after the runtime transforms the submitted prompt for the model, before it is added to session history. public static HookType UserPromptTransformed { get; } = new("userPromptTransformed"); /// Runs when a session starts. public static HookType SessionStart { get; } = new("sessionStart"); /// Runs when a session ends. public static HookType SessionEnd { get; } = new("sessionEnd"); /// Runs after an agent result is produced. public static HookType PostResult { get; } = new("postResult"); /// Runs before a pull request description is generated. public static HookType PrePRDescription { get; } = new("prePRDescription"); /// Runs when the agent encounters an error. public static HookType ErrorOccurred { get; } = new("errorOccurred"); /// Runs when the agent stops. public static HookType AgentStop { get; } = new("agentStop"); /// Runs when a subagent starts. public static HookType SubagentStart { get; } = new("subagentStart"); /// Runs when a subagent stops. public static HookType SubagentStop { get; } = new("subagentStop"); /// Runs before conversation context is compacted. public static HookType PreCompact { get; } = new("preCompact"); /// Runs when the agent requests permission. public static HookType PermissionRequest { get; } = new("permissionRequest"); /// Runs when the agent emits a notification. public static HookType Notification { get; } = new("notification"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(HookType left, HookType right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(HookType left, HookType right) => !(left == right); /// public override bool Equals(object? obj) => obj is HookType other && Equals(other); /// public bool Equals(HookType 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 HookType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, HookType value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(HookType)); } } } /// Configuration tier that contributed a discovered hook action. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct HookOrigin : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public HookOrigin(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Hook loaded from user settings or the user's hook directory. public static HookOrigin User { get; } = new("user"); /// Hook loaded from repository settings or the repository hook directory. public static HookOrigin Repository { get; } = new("repository"); /// Hook provided by an enabled installed or explicit plugin. Projectless rows omit projectPath and do not expand a project directory. public static HookOrigin Plugin { get; } = new("plugin"); /// Hook enforced by centrally managed policy. public static HookOrigin Policy { get; } = new("policy"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(HookOrigin left, HookOrigin right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(HookOrigin left, HookOrigin right) => !(left == right); /// public override bool Equals(object? obj) => obj is HookOrigin other && Equals(other); /// public bool Equals(HookOrigin 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 HookOrigin Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, HookOrigin value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(HookOrigin)); } } } /// Resolved Anthropic adaptive-thinking capability for a model. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct AdaptiveThinkingSupport : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public AdaptiveThinkingSupport(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// The model does not accept thinking.type='adaptive'. public static AdaptiveThinkingSupport Unsupported { get; } = new("unsupported"); /// The model accepts adaptive thinking but also accepts thinking.type='enabled'. public static AdaptiveThinkingSupport Optional { get; } = new("optional"); /// The model only accepts adaptive thinking and rejects thinking.type='enabled' with HTTP 400 (e.g. opus-4.7/4.8). public static AdaptiveThinkingSupport Required { get; } = new("required"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(AdaptiveThinkingSupport left, AdaptiveThinkingSupport right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(AdaptiveThinkingSupport left, AdaptiveThinkingSupport right) => !(left == right); /// public override bool Equals(object? obj) => obj is AdaptiveThinkingSupport other && Equals(other); /// public bool Equals(AdaptiveThinkingSupport 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 AdaptiveThinkingSupport Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, AdaptiveThinkingSupport value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(AdaptiveThinkingSupport)); } } } /// Model capability category for grouping in the model picker. [Experimental(Diagnostics.Experimental)] [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. [Experimental(Diagnostics.Experimental)] [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. [Experimental(Diagnostics.Experimental)] [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 (deprecated), or memory. [Experimental(Diagnostics.Experimental)] [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 (deprecated). 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)); } } } /// A wire feature a caller can require of the catalog surface, negotiated per request. A grant means the runtime understands the feature's contract, not that the deployment has enabled the operation; typed unavailable results report availability separately. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct CatalogCapability : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public CatalogCapability(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Understands the current `application/mcp-server-card+json` media type. public static CatalogCapability McpServerCard { get; } = new("mcp-server-card"); /// Understands the legacy `application/mcp-server+json` media type. public static CatalogCapability LegacyMcpServerCard { get; } = new("legacy-mcp-server-card"); /// Understands `application/ai-skill` candidates as discovery-only and typed non-installable. public static CatalogCapability AiSkillDiscovery { get; } = new("ai-skill-discovery"); /// Understands side-effect-free MCP install-plan requests, results, and plan handles; `planning-unavailable` separately reports that planning is not enabled. public static CatalogCapability McpInstallPlanning { get; } = new("mcp-install-planning"); /// Understands plans that enumerate every eligible transport rather than a single preferred one. public static CatalogCapability MultipleTransportChoice { get; } = new("multiple-transport-choice"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(CatalogCapability left, CatalogCapability right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(CatalogCapability left, CatalogCapability right) => !(left == right); /// public override bool Equals(object? obj) => obj is CatalogCapability other && Equals(other); /// public bool Equals(CatalogCapability 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 CatalogCapability Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, CatalogCapability value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(CatalogCapability)); } } } /// Whether a planned configuration change would create or modify an entry. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct McpPlanConfigurationOperation : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public McpPlanConfigurationOperation(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Creates a configuration entry that does not exist yet. public static McpPlanConfigurationOperation Add { get; } = new("add"); /// Modifies a configuration entry that already exists. public static McpPlanConfigurationOperation Update { get; } = new("update"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(McpPlanConfigurationOperation left, McpPlanConfigurationOperation right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(McpPlanConfigurationOperation left, McpPlanConfigurationOperation right) => !(left == right); /// public override bool Equals(object? obj) => obj is McpPlanConfigurationOperation other && Equals(other); /// public bool Equals(McpPlanConfigurationOperation 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 McpPlanConfigurationOperation Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, McpPlanConfigurationOperation value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(McpPlanConfigurationOperation)); } } } /// Configuration scope an MCP install plan targets. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct McpPlanScope : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public McpPlanScope(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// The user's own MCP configuration. public static McpPlanScope User { get; } = new("user"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(McpPlanScope left, McpPlanScope right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(McpPlanScope left, McpPlanScope right) => !(left == right); /// public override bool Equals(object? obj) => obj is McpPlanScope other && Equals(other); /// public bool Equals(McpPlanScope 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 McpPlanScope Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, McpPlanScope value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(McpPlanScope)); } } } /// What policy decided for a planned server. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct McpPlanPolicyDecision : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public McpPlanPolicyDecision(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Policy permits the server. public static McpPlanPolicyDecision Allowed { get; } = new("allowed"); /// Policy forbids the server, so the plan cannot be applied. public static McpPlanPolicyDecision Blocked { get; } = new("blocked"); /// Policy permits the server only after an explicit approval. public static McpPlanPolicyDecision RequiresApproval { get; } = new("requires-approval"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(McpPlanPolicyDecision left, McpPlanPolicyDecision right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(McpPlanPolicyDecision left, McpPlanPolicyDecision right) => !(left == right); /// public override bool Equals(object? obj) => obj is McpPlanPolicyDecision other && Equals(other); /// public bool Equals(McpPlanPolicyDecision 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 McpPlanPolicyDecision Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, McpPlanPolicyDecision value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(McpPlanPolicyDecision)); } } } /// Which authority produced a policy decision. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct McpPlanPolicySource : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public McpPlanPolicySource(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// No policy applied, so the server is permitted by default. public static McpPlanPolicySource None { get; } = new("none"); /// An enterprise allowlist evaluated the server. public static McpPlanPolicySource EnterpriseAllowlist { get; } = new("enterprise-allowlist"); /// The registry the card came from evaluated the server. public static McpPlanPolicySource RegistryPolicy { get; } = new("registry-policy"); /// Local trust settings evaluated the server. public static McpPlanPolicySource LocalTrust { get; } = new("local-trust"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(McpPlanPolicySource left, McpPlanPolicySource right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(McpPlanPolicySource left, McpPlanPolicySource right) => !(left == right); /// public override bool Equals(object? obj) => obj is McpPlanPolicySource other && Equals(other); /// public bool Equals(McpPlanPolicySource 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 McpPlanPolicySource Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, McpPlanPolicySource value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(McpPlanPolicySource)); } } } /// Canonical digest algorithm for a validated MCP card. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct CardDigestAlgorithm : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public CardDigestAlgorithm(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// SHA-256 over RFC 8785 canonical JSON encoded as UTF-8. public static CardDigestAlgorithm Sha256Rfc8785 { get; } = new("sha256-rfc8785"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(CardDigestAlgorithm left, CardDigestAlgorithm right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(CardDigestAlgorithm left, CardDigestAlgorithm right) => !(left == right); /// public override bool Equals(object? obj) => obj is CardDigestAlgorithm other && Equals(other); /// public bool Equals(CardDigestAlgorithm 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 CardDigestAlgorithm Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, CardDigestAlgorithm value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(CardDigestAlgorithm)); } } } /// JSON MCP card media type accepted for install planning. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct McpServerCardMediaType : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public McpServerCardMediaType(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// The current MCP server card media type. public static McpServerCardMediaType ApplicationMcpServerCardJson { get; } = new("application/mcp-server-card+json"); /// The legacy MCP server card media type, accepted for compatibility. public static McpServerCardMediaType ApplicationMcpServerJson { get; } = new("application/mcp-server+json"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(McpServerCardMediaType left, McpServerCardMediaType right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(McpServerCardMediaType left, McpServerCardMediaType right) => !(left == right); /// public override bool Equals(object? obj) => obj is McpServerCardMediaType other && Equals(other); /// public bool Equals(McpServerCardMediaType 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 McpServerCardMediaType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, McpServerCardMediaType value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(McpServerCardMediaType)); } } } /// Where a required value is applied when the planned server is launched. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct McpPlanValueCategory : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public McpPlanValueCategory(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Set as an environment variable on the launched process. public static McpPlanValueCategory EnvironmentVariable { get; } = new("environment-variable"); /// Passed to the runtime that launches the package. public static McpPlanValueCategory RuntimeArgument { get; } = new("runtime-argument"); /// Passed to the packaged server itself. public static McpPlanValueCategory PackageArgument { get; } = new("package-argument"); /// Sent as a request header to a remote endpoint. public static McpPlanValueCategory Header { get; } = new("header"); /// Substituted into the remote endpoint URL. public static McpPlanValueCategory UrlVariable { get; } = new("url-variable"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(McpPlanValueCategory left, McpPlanValueCategory right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(McpPlanValueCategory left, McpPlanValueCategory right) => !(left == right); /// public override bool Equals(object? obj) => obj is McpPlanValueCategory other && Equals(other); /// public bool Equals(McpPlanValueCategory 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 McpPlanValueCategory Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, McpPlanValueCategory value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(McpPlanValueCategory)); } } } /// Scalar type a required value must conform to. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct McpPlanScalarValueType : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public McpPlanScalarValueType(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Free text. public static McpPlanScalarValueType String { get; } = new("string"); /// A number. public static McpPlanScalarValueType Number { get; } = new("number"); /// A boolean. public static McpPlanScalarValueType Boolean { get; } = new("boolean"); /// A filesystem path. public static McpPlanScalarValueType Path { get; } = new("path"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(McpPlanScalarValueType left, McpPlanScalarValueType right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(McpPlanScalarValueType left, McpPlanScalarValueType right) => !(left == right); /// public override bool Equals(object? obj) => obj is McpPlanScalarValueType other && Equals(other); /// public bool Equals(McpPlanScalarValueType 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 McpPlanScalarValueType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, McpPlanScalarValueType value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(McpPlanScalarValueType)); } } } /// Discriminator for an enumerated required value. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct McpPlanEnumValueType : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public McpPlanEnumValueType(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// One of a fixed, non-empty set of permitted values. public static McpPlanEnumValueType Enum { get; } = new("enum"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(McpPlanEnumValueType left, McpPlanEnumValueType right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(McpPlanEnumValueType left, McpPlanEnumValueType right) => !(left == right); /// public override bool Equals(object? obj) => obj is McpPlanEnumValueType other && Equals(other); /// public bool Equals(McpPlanEnumValueType 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 McpPlanEnumValueType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, McpPlanEnumValueType value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(McpPlanEnumValueType)); } } } /// Transport exposed by a locally launched package. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct McpPlanPackageTransport : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public McpPlanPackageTransport(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// A locally launched process spoken to over standard input and output. public static McpPlanPackageTransport Stdio { get; } = new("stdio"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(McpPlanPackageTransport left, McpPlanPackageTransport right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(McpPlanPackageTransport left, McpPlanPackageTransport right) => !(left == right); /// public override bool Equals(object? obj) => obj is McpPlanPackageTransport other && Equals(other); /// public bool Equals(McpPlanPackageTransport 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 McpPlanPackageTransport Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, McpPlanPackageTransport value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(McpPlanPackageTransport)); } } } /// Transport exposed by a remote endpoint. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct McpPlanRemoteTransport : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public McpPlanRemoteTransport(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// An HTTP endpoint. public static McpPlanRemoteTransport Http { get; } = new("http"); /// A streamable HTTP endpoint. public static McpPlanRemoteTransport StreamableHttp { get; } = new("streamable-http"); /// A server-sent events endpoint. public static McpPlanRemoteTransport Sse { get; } = new("sse"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(McpPlanRemoteTransport left, McpPlanRemoteTransport right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(McpPlanRemoteTransport left, McpPlanRemoteTransport right) => !(left == right); /// public override bool Equals(object? obj) => obj is McpPlanRemoteTransport other && Equals(other); /// public bool Equals(McpPlanRemoteTransport 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 McpPlanRemoteTransport Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, McpPlanRemoteTransport value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(McpPlanRemoteTransport)); } } } /// Why capability and protocol-version negotiation refused a caller. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct CatalogNegotiationRefusedReason : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public CatalogNegotiationRefusedReason(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// The caller's protocol version is below the lowest this runtime serves. public static CatalogNegotiationRefusedReason UnsupportedProtocolVersion { get; } = new("unsupported-protocol-version"); /// The caller requires at least one capability this runtime cannot honour. public static CatalogNegotiationRefusedReason UnsupportedCapability { get; } = new("unsupported-capability"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(CatalogNegotiationRefusedReason left, CatalogNegotiationRefusedReason right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(CatalogNegotiationRefusedReason left, CatalogNegotiationRefusedReason right) => !(left == right); /// public override bool Equals(object? obj) => obj is CatalogNegotiationRefusedReason other && Equals(other); /// public bool Equals(CatalogNegotiationRefusedReason 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 CatalogNegotiationRefusedReason Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, CatalogNegotiationRefusedReason value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(CatalogNegotiationRefusedReason)); } } } /// Which kind of opaque handle was presented. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct CatalogHandleType : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public CatalogHandleType(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// A search candidate handle. public static CatalogHandleType Candidate { get; } = new("candidate"); /// An install plan handle. public static CatalogHandleType Plan { get; } = new("plan"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(CatalogHandleType left, CatalogHandleType right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(CatalogHandleType left, CatalogHandleType right) => !(left == right); /// public override bool Equals(object? obj) => obj is CatalogHandleType other && Equals(other); /// public bool Equals(CatalogHandleType 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 CatalogHandleType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, CatalogHandleType value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(CatalogHandleType)); } } } /// Why a presented handle was rejected. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct CatalogHandleRejectionReason : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public CatalogHandleRejectionReason(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// The handle is unparseable, unknown, or was issued for a different operation. public static CatalogHandleRejectionReason Invalid { get; } = new("invalid"); /// The handle's time to live has elapsed. public static CatalogHandleRejectionReason Stale { get; } = new("stale"); /// The handle has already been used, and handles are single-use. public static CatalogHandleRejectionReason Replayed { get; } = new("replayed"); /// The handle was issued by a different runtime instance. public static CatalogHandleRejectionReason Foreign { get; } = new("foreign"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(CatalogHandleRejectionReason left, CatalogHandleRejectionReason right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(CatalogHandleRejectionReason left, CatalogHandleRejectionReason right) => !(left == right); /// public override bool Equals(object? obj) => obj is CatalogHandleRejectionReason other && Equals(other); /// public bool Equals(CatalogHandleRejectionReason 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 CatalogHandleRejectionReason Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, CatalogHandleRejectionReason value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(CatalogHandleRejectionReason)); } } } /// Which request field was rejected before any work was done. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct CatalogInvalidRequestField : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public CatalogInvalidRequestField(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// The search query was empty or longer than permitted. public static CatalogInvalidRequestField Query { get; } = new("query"); /// The requested result count fell outside its permitted range. public static CatalogInvalidRequestField Limit { get; } = new("limit"); /// The requested candidate kinds were empty or contained a duplicate. public static CatalogInvalidRequestField Kinds { get; } = new("kinds"); /// The negotiation block was missing or malformed. public static CatalogInvalidRequestField Contract { get; } = new("contract"); /// The plan source was missing or malformed. public static CatalogInvalidRequestField Source { get; } = new("source"); /// The supplied card was missing its media type, URL, or data. public static CatalogInvalidRequestField Card { get; } = new("card"); /// The requested configuration scope is not one this runtime writes. public static CatalogInvalidRequestField Scope { get; } = new("scope"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(CatalogInvalidRequestField left, CatalogInvalidRequestField right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(CatalogInvalidRequestField left, CatalogInvalidRequestField right) => !(left == right); /// public override bool Equals(object? obj) => obj is CatalogInvalidRequestField other && Equals(other); /// public bool Equals(CatalogInvalidRequestField 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 CatalogInvalidRequestField Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, CatalogInvalidRequestField value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(CatalogInvalidRequestField)); } } } /// Why the catalog authority did not accept the caller's identity. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct CatalogAuthenticationRequiredReason : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public CatalogAuthenticationRequiredReason(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// No credential was presented, so there is nothing to refresh and the caller must sign in. public static CatalogAuthenticationRequiredReason NoCredential { get; } = new("no-credential"); /// A credential was presented and its lifetime has elapsed. A silent refresh is worth attempting before prompting anyone. public static CatalogAuthenticationRequiredReason CredentialExpired { get; } = new("credential-expired"); /// A credential was presented and the authority refused it, for example because it was revoked, malformed, or issued for another audience. Refreshing the same rejected credential is not useful; the caller must sign in again. public static CatalogAuthenticationRequiredReason CredentialRejected { get; } = new("credential-rejected"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(CatalogAuthenticationRequiredReason left, CatalogAuthenticationRequiredReason right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(CatalogAuthenticationRequiredReason left, CatalogAuthenticationRequiredReason right) => !(left == right); /// public override bool Equals(object? obj) => obj is CatalogAuthenticationRequiredReason other && Equals(other); /// public bool Equals(CatalogAuthenticationRequiredReason 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 CatalogAuthenticationRequiredReason Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, CatalogAuthenticationRequiredReason value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(CatalogAuthenticationRequiredReason)); } } } /// Categorised network failure, low cardinality so it can be aggregated without carrying a URL. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct CatalogNetworkFailureReason : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public CatalogNetworkFailureReason(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// No network is available, so nothing was attempted. public static CatalogNetworkFailureReason Offline { get; } = new("offline"); /// The authority's name could not be resolved. public static CatalogNetworkFailureReason Dns { get; } = new("dns"); /// The request exceeded its time budget. public static CatalogNetworkFailureReason Timeout { get; } = new("timeout"); /// The TLS handshake or certificate validation failed. public static CatalogNetworkFailureReason Tls { get; } = new("tls"); /// The connection was refused or reset. public static CatalogNetworkFailureReason ConnectionRefused { get; } = new("connection-refused"); /// The configured proxy returned 407 and requires authentication. public static CatalogNetworkFailureReason ProxyAuthenticationRequired { get; } = new("proxy-authentication-required"); /// The authority rate-limited requests and supplied or implied a bounded cooldown. public static CatalogNetworkFailureReason RateLimited { get; } = new("rate-limited"); /// The authority returned a transient 5xx response. public static CatalogNetworkFailureReason ServiceUnavailable { get; } = new("service-unavailable"); /// The authority returned another status the runtime treats as a failure. public static CatalogNetworkFailureReason HttpStatus { get; } = new("http-status"); /// The response exceeded the permitted size. public static CatalogNetworkFailureReason ResponseTooLarge { get; } = new("response-too-large"); /// A redirect was refused by the runtime's redirect policy. public static CatalogNetworkFailureReason RedirectRejected { get; } = new("redirect-rejected"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(CatalogNetworkFailureReason left, CatalogNetworkFailureReason right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(CatalogNetworkFailureReason left, CatalogNetworkFailureReason right) => !(left == right); /// public override bool Equals(object? obj) => obj is CatalogNetworkFailureReason other && Equals(other); /// public bool Equals(CatalogNetworkFailureReason 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 CatalogNetworkFailureReason Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, CatalogNetworkFailureReason value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(CatalogNetworkFailureReason)); } } } /// Which hardened-fetch control refused a retrieval. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct CatalogUnsafeRetrievalReason : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public CatalogUnsafeRetrievalReason(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// The URL used a scheme the runtime refuses to fetch. public static CatalogUnsafeRetrievalReason BlockedScheme { get; } = new("blocked-scheme"); /// The URL embedded credentials. public static CatalogUnsafeRetrievalReason CredentialsInUrl { get; } = new("credentials-in-url"); /// The URL resolved to a loopback, private, link-local, or cloud metadata address. public static CatalogUnsafeRetrievalReason BlockedAddress { get; } = new("blocked-address"); /// A redirect target resolved to a blocked address. public static CatalogUnsafeRetrievalReason RedirectToBlockedAddress { get; } = new("redirect-to-blocked-address"); /// The configured proxy policy refused the request. public static CatalogUnsafeRetrievalReason ProxyRejected { get; } = new("proxy-rejected"); /// The authority is not permitted for card retrieval. public static CatalogUnsafeRetrievalReason HostNotPermitted { get; } = new("host-not-permitted"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(CatalogUnsafeRetrievalReason left, CatalogUnsafeRetrievalReason right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(CatalogUnsafeRetrievalReason left, CatalogUnsafeRetrievalReason right) => !(left == right); /// public override bool Equals(object? obj) => obj is CatalogUnsafeRetrievalReason other && Equals(other); /// public bool Equals(CatalogUnsafeRetrievalReason 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 CatalogUnsafeRetrievalReason Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, CatalogUnsafeRetrievalReason value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(CatalogUnsafeRetrievalReason)); } } } /// Media type a catalog card is interpreted as. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct CatalogMediaType : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public CatalogMediaType(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// The current MCP server card media type. public static CatalogMediaType ApplicationMcpServerCardJson { get; } = new("application/mcp-server-card+json"); /// The legacy MCP server card media type, accepted for compatibility. public static CatalogMediaType ApplicationMcpServerJson { get; } = new("application/mcp-server+json"); /// An AI skill card. Representable and searchable, but typed non-installable. public static CatalogMediaType ApplicationAiSkill { get; } = new("application/ai-skill"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(CatalogMediaType left, CatalogMediaType right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(CatalogMediaType left, CatalogMediaType right) => !(left == right); /// public override bool Equals(object? obj) => obj is CatalogMediaType other && Equals(other); /// public bool Equals(CatalogMediaType 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 CatalogMediaType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, CatalogMediaType value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(CatalogMediaType)); } } } /// How a card failed validation. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct CatalogMalformedCardReason : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public CatalogMalformedCardReason(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// The document is not well-formed JSON. public static CatalogMalformedCardReason InvalidJson { get; } = new("invalid-json"); /// The document does not satisfy its media type's schema. public static CatalogMalformedCardReason SchemaViolation { get; } = new("schema-violation"); /// The declared media type is not one this runtime understands. public static CatalogMalformedCardReason UnsupportedMediaType { get; } = new("unsupported-media-type"); /// A field the media type requires is absent. public static CatalogMalformedCardReason MissingRequiredField { get; } = new("missing-required-field"); /// The document exceeded the permitted size. public static CatalogMalformedCardReason SizeLimitExceeded { get; } = new("size-limit-exceeded"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(CatalogMalformedCardReason left, CatalogMalformedCardReason right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(CatalogMalformedCardReason left, CatalogMalformedCardReason right) => !(left == right); /// public override bool Equals(object? obj) => obj is CatalogMalformedCardReason other && Equals(other); /// public bool Equals(CatalogMalformedCardReason 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 CatalogMalformedCardReason Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, CatalogMalformedCardReason value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(CatalogMalformedCardReason)); } } } /// Which wire-contract rule an upstream response broke. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct CatalogContractViolationReason : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public CatalogContractViolationReason(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// A result carried both a URL and embedded data, when exactly one is permitted. public static CatalogContractViolationReason BothUrlAndData { get; } = new("both-url-and-data"); /// A result carried neither a URL nor embedded data, when exactly one is required. public static CatalogContractViolationReason NeitherUrlNorData { get; } = new("neither-url-nor-data"); /// Two results claimed the same normalised identity. public static CatalogContractViolationReason DuplicateIdentity { get; } = new("duplicate-identity"); /// A result declared no media type, or one this contract does not model. public static CatalogContractViolationReason UnknownMediaType { get; } = new("unknown-media-type"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(CatalogContractViolationReason left, CatalogContractViolationReason right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(CatalogContractViolationReason left, CatalogContractViolationReason right) => !(left == right); /// public override bool Equals(object? obj) => obj is CatalogContractViolationReason other && Equals(other); /// public bool Equals(CatalogContractViolationReason 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 CatalogContractViolationReason Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, CatalogContractViolationReason value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(CatalogContractViolationReason)); } } } /// Why no usable transport could be offered. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct CatalogUnavailableTransportReason : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public CatalogUnavailableTransportReason(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// The card advertises no transport this runtime can use. public static CatalogUnavailableTransportReason NoEligibleTransport { get; } = new("no-eligible-transport"); /// Every advertised transport is of a kind this runtime does not implement. public static CatalogUnavailableTransportReason TransportNotSupported { get; } = new("transport-not-supported"); /// Eligible remotes could not be enumerated, so no explicit choice can be offered. public static CatalogUnavailableTransportReason RemoteEnumerationUnavailable { get; } = new("remote-enumeration-unavailable"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(CatalogUnavailableTransportReason left, CatalogUnavailableTransportReason right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(CatalogUnavailableTransportReason left, CatalogUnavailableTransportReason right) => !(left == right); /// public override bool Equals(object? obj) => obj is CatalogUnavailableTransportReason other && Equals(other); /// public bool Equals(CatalogUnavailableTransportReason 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 CatalogUnavailableTransportReason Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, CatalogUnavailableTransportReason value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(CatalogUnavailableTransportReason)); } } } /// Why a discoverable candidate cannot be installed. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct CatalogNotInstallableReason : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public CatalogNotInstallableReason(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// This kind of resource is not installable through this surface. public static CatalogNotInstallableReason KindNotInstallable { get; } = new("kind-not-installable"); /// AI skills are discoverable but have no typed importer in this phase. public static CatalogNotInstallableReason AiSkillNotInstallable { get; } = new("ai-skill-not-installable"); /// Policy forbids installing this candidate. public static CatalogNotInstallableReason PolicyForbids { get; } = new("policy-forbids"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(CatalogNotInstallableReason left, CatalogNotInstallableReason right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(CatalogNotInstallableReason left, CatalogNotInstallableReason right) => !(left == right); /// public override bool Equals(object? obj) => obj is CatalogNotInstallableReason other && Equals(other); /// public bool Equals(CatalogNotInstallableReason 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 CatalogNotInstallableReason Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, CatalogNotInstallableReason value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(CatalogNotInstallableReason)); } } } /// Why a catalog operation is not available on this runtime. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct CatalogUnavailableReason : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public CatalogUnavailableReason(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Bounded search is not wired up on this runtime build. public static CatalogUnavailableReason SearchUnavailable { get; } = new("search-unavailable"); /// Install planning is not wired up on this runtime build. public static CatalogUnavailableReason PlanningUnavailable { get; } = new("planning-unavailable"); /// No catalog authority is configured for this runtime. public static CatalogUnavailableReason AuthorityNotConfigured { get; } = new("authority-not-configured"); /// The surface is disabled by policy on this runtime. public static CatalogUnavailableReason DisabledByPolicy { get; } = new("disabled-by-policy"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(CatalogUnavailableReason left, CatalogUnavailableReason right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(CatalogUnavailableReason left, CatalogUnavailableReason right) => !(left == right); /// public override bool Equals(object? obj) => obj is CatalogUnavailableReason other && Equals(other); /// public bool Equals(CatalogUnavailableReason 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 CatalogUnavailableReason Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, CatalogUnavailableReason value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(CatalogUnavailableReason)); } } } /// Persisted extension discovery source. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct DiscoveredExtensionSource : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public DiscoveredExtensionSource(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Extension discovered from the user's extensions directory. public static DiscoveredExtensionSource User { get; } = new("user"); /// Extension contributed by an installed plugin. public static DiscoveredExtensionSource Plugin { get; } = new("plugin"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(DiscoveredExtensionSource left, DiscoveredExtensionSource right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(DiscoveredExtensionSource left, DiscoveredExtensionSource right) => !(left == right); /// public override bool Equals(object? obj) => obj is DiscoveredExtensionSource other && Equals(other); /// public bool Equals(DiscoveredExtensionSource 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 DiscoveredExtensionSource Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, DiscoveredExtensionSource value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(DiscoveredExtensionSource)); } } } /// Effective extension loading and agent-management mode. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct DiscoveredExtensionMode : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public DiscoveredExtensionMode(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Extensions are not loaded. public static DiscoveredExtensionMode Disabled { get; } = new("disabled"); /// Extensions are loaded, but the agent cannot create, reload, or manage them. public static DiscoveredExtensionMode LoadOnly { get; } = new("load_only"); /// Extensions are loaded and the agent can create, reload, and manage them. public static DiscoveredExtensionMode LoadAndAugment { get; } = new("load_and_augment"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(DiscoveredExtensionMode left, DiscoveredExtensionMode right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(DiscoveredExtensionMode left, DiscoveredExtensionMode right) => !(left == right); /// public override bool Equals(object? obj) => obj is DiscoveredExtensionMode other && Equals(other); /// public bool Equals(DiscoveredExtensionMode 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 DiscoveredExtensionMode Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, DiscoveredExtensionMode value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(DiscoveredExtensionMode)); } } } /// Whether an MCP server candidate can be planned for installation. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct CatalogMcpServerInstallability : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public CatalogMcpServerInstallability(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// An install plan can be computed for this MCP server candidate. public static CatalogMcpServerInstallability Installable { get; } = new("installable"); /// Policy forbids installing this MCP server candidate. public static CatalogMcpServerInstallability NotInstallablePolicy { get; } = new("not-installable-policy"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(CatalogMcpServerInstallability left, CatalogMcpServerInstallability right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(CatalogMcpServerInstallability left, CatalogMcpServerInstallability right) => !(left == right); /// public override bool Equals(object? obj) => obj is CatalogMcpServerInstallability other && Equals(other); /// public bool Equals(CatalogMcpServerInstallability 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 CatalogMcpServerInstallability Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, CatalogMcpServerInstallability value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(CatalogMcpServerInstallability)); } } } /// What kind of resource a catalog candidate describes. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct CatalogCandidateKind : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public CatalogCandidateKind(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// An MCP server, which can be planned for installation. public static CatalogCandidateKind McpServer { get; } = new("mcp-server"); /// An AI skill, which is discoverable but not installable through this surface. public static CatalogCandidateKind AiSkill { get; } = new("ai-skill"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(CatalogCandidateKind left, CatalogCandidateKind right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(CatalogCandidateKind left, CatalogCandidateKind right) => !(left == right); /// public override bool Equals(object? obj) => obj is CatalogCandidateKind other && Equals(other); /// public bool Equals(CatalogCandidateKind 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 CatalogCandidateKind Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, CatalogCandidateKind value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(CatalogCandidateKind)); } } } /// Where completed plugin content was staged before atomic promotion. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct PluginInstallStagingMode : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public PluginInstallStagingMode(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// A sibling of the installed-plugins root, outside the recursively watched tree. public static PluginInstallStagingMode External { get; } = new("external"); /// A sibling of the destination plugin directory, used when external staging is unavailable. public static PluginInstallStagingMode DestinationSibling { get; } = new("destination_sibling"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(PluginInstallStagingMode left, PluginInstallStagingMode right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(PluginInstallStagingMode left, PluginInstallStagingMode right) => !(left == right); /// public override bool Equals(object? obj) => obj is PluginInstallStagingMode other && Equals(other); /// public bool Equals(PluginInstallStagingMode 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 PluginInstallStagingMode Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, PluginInstallStagingMode value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(PluginInstallStagingMode)); } } } /// Which tier this directory belongs to. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct SkillDiscoveryScope : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public SkillDiscoveryScope(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// A project's repository skill directory. public static SkillDiscoveryScope Project { get; } = new("project"); /// The user's personal Copilot skill directory. public static SkillDiscoveryScope PersonalCopilot { get; } = new("personal-copilot"); /// The user's personal agents skill directory. public static SkillDiscoveryScope PersonalAgents { get; } = new("personal-agents"); /// A configured custom skill directory. public static SkillDiscoveryScope Custom { get; } = new("custom"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(SkillDiscoveryScope left, SkillDiscoveryScope right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(SkillDiscoveryScope left, SkillDiscoveryScope right) => !(left == right); /// public override bool Equals(object? obj) => obj is SkillDiscoveryScope other && Equals(other); /// public bool Equals(SkillDiscoveryScope 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 SkillDiscoveryScope Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, SkillDiscoveryScope value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(SkillDiscoveryScope)); } } } /// 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)); } } } /// Which tier this directory belongs to. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct AgentDiscoveryPathScope : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public AgentDiscoveryPathScope(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// The user's personal agent configuration directory. public static AgentDiscoveryPathScope User { get; } = new("user"); /// A project's repository agent directory. public static AgentDiscoveryPathScope Project { get; } = new("project"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(AgentDiscoveryPathScope left, AgentDiscoveryPathScope right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(AgentDiscoveryPathScope left, AgentDiscoveryPathScope right) => !(left == right); /// public override bool Equals(object? obj) => obj is AgentDiscoveryPathScope other && Equals(other); /// public bool Equals(AgentDiscoveryPathScope 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 AgentDiscoveryPathScope Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, AgentDiscoveryPathScope value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(AgentDiscoveryPathScope)); } } } /// Where this source lives — used for UI grouping. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct InstructionSourceLocation : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public InstructionSourceLocation(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 InstructionSourceLocation User { get; } = new("user"); /// Instructions live in repository-level configuration. public static InstructionSourceLocation Repository { get; } = new("repository"); /// Instructions live under the current working directory. public static InstructionSourceLocation WorkingDirectory { get; } = new("working-directory"); /// Instructions live in plugin-provided configuration. public static InstructionSourceLocation Plugin { get; } = new("plugin"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(InstructionSourceLocation left, InstructionSourceLocation right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(InstructionSourceLocation left, InstructionSourceLocation right) => !(left == right); /// public override bool Equals(object? obj) => obj is InstructionSourceLocation other && Equals(other); /// public bool Equals(InstructionSourceLocation 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 InstructionSourceLocation Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, InstructionSourceLocation value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(InstructionSourceLocation)); } } } /// Category of instruction source — used for merge logic. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct InstructionSourceType : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public InstructionSourceType(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 InstructionSourceType Home { get; } = new("home"); /// Instructions loaded from repository-scoped files. public static InstructionSourceType Repo { get; } = new("repo"); /// Instructions loaded from model-specific files. public static InstructionSourceType Model { get; } = new("model"); /// Instructions loaded from VS Code instruction files. public static InstructionSourceType Vscode { get; } = new("vscode"); /// Instructions discovered from nested agent files. public static InstructionSourceType NestedAgents { get; } = new("nested-agents"); /// Instructions inherited from child instruction files. public static InstructionSourceType ChildInstructions { get; } = new("child-instructions"); /// Instructions supplied by an installed plugin. public static InstructionSourceType Plugin { get; } = new("plugin"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(InstructionSourceType left, InstructionSourceType right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(InstructionSourceType left, InstructionSourceType right) => !(left == right); /// public override bool Equals(object? obj) => obj is InstructionSourceType other && Equals(other); /// public bool Equals(InstructionSourceType 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 InstructionSourceType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, InstructionSourceType value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(InstructionSourceType)); } } } /// Whether the target is a single file or a directory of instruction files. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct InstructionDiscoveryPathKind : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public InstructionDiscoveryPathKind(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// The target is a single instruction file. public static InstructionDiscoveryPathKind File { get; } = new("file"); /// The target is a directory that holds instruction files. public static InstructionDiscoveryPathKind Directory { get; } = new("directory"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(InstructionDiscoveryPathKind left, InstructionDiscoveryPathKind right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(InstructionDiscoveryPathKind left, InstructionDiscoveryPathKind right) => !(left == right); /// public override bool Equals(object? obj) => obj is InstructionDiscoveryPathKind other && Equals(other); /// public bool Equals(InstructionDiscoveryPathKind 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 InstructionDiscoveryPathKind Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, InstructionDiscoveryPathKind value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(InstructionDiscoveryPathKind)); } } } /// Which tier this target belongs to. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct InstructionDiscoveryPathLocation : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public InstructionDiscoveryPathLocation(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 InstructionDiscoveryPathLocation User { get; } = new("user"); /// Instructions live in repository-level configuration. public static InstructionDiscoveryPathLocation Repository { get; } = new("repository"); /// Instructions live under the current working directory. public static InstructionDiscoveryPathLocation WorkingDirectory { get; } = new("working-directory"); /// Instructions live in plugin-provided configuration. public static InstructionDiscoveryPathLocation Plugin { get; } = new("plugin"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(InstructionDiscoveryPathLocation left, InstructionDiscoveryPathLocation right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(InstructionDiscoveryPathLocation left, InstructionDiscoveryPathLocation right) => !(left == right); /// public override bool Equals(object? obj) => obj is InstructionDiscoveryPathLocation other && Equals(other); /// public bool Equals(InstructionDiscoveryPathLocation 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 InstructionDiscoveryPathLocation Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, InstructionDiscoveryPathLocation value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(InstructionDiscoveryPathLocation)); } } } /// 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)); } } } /// Path conventions used by this filesystem. [Experimental(Diagnostics.Experimental)] [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)); } } } /// 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)); } } } /// What a remote host says one of its sessions is doing right now. Deliberately coarse: this is what a host can report for EVERY session in a catalogue listing, without a client subscribing to each one. AHP's `SessionSummary.status` is the source today; `input-needed` covers both a permission prompt and an `ask_user` question, since the summary does not say which. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct RemoteSessionHostStatus : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public RemoteSessionHostStatus(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// No turn is running. public static RemoteSessionHostStatus Idle { get; } = new("idle"); /// A turn is running. public static RemoteSessionHostStatus Working { get; } = new("working"); /// The session is blocked on the user: a permission prompt or an `ask_user` question. public static RemoteSessionHostStatus InputNeeded { get; } = new("input-needed"); /// The session ended its last turn in an error. public static RemoteSessionHostStatus Error { get; } = new("error"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(RemoteSessionHostStatus left, RemoteSessionHostStatus right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(RemoteSessionHostStatus left, RemoteSessionHostStatus right) => !(left == right); /// public override bool Equals(object? obj) => obj is RemoteSessionHostStatus other && Equals(other); /// public bool Equals(RemoteSessionHostStatus 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 RemoteSessionHostStatus Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, RemoteSessionHostStatus value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(RemoteSessionHostStatus)); } } } /// Whether the remote task originated from CCA or CLI `--remote`. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct RemoteSessionMetadataTaskType : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public RemoteSessionMetadataTaskType(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// GitHub Copilot coding agent task. public static RemoteSessionMetadataTaskType Cca { get; } = new("cca"); /// CLI remote task. public static RemoteSessionMetadataTaskType Cli { get; } = new("cli"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(RemoteSessionMetadataTaskType left, RemoteSessionMetadataTaskType right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(RemoteSessionMetadataTaskType left, RemoteSessionMetadataTaskType right) => !(left == right); /// public override bool Equals(object? obj) => obj is RemoteSessionMetadataTaskType other && Equals(other); /// public bool Equals(RemoteSessionMetadataTaskType 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 RemoteSessionMetadataTaskType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, RemoteSessionMetadataTaskType value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(RemoteSessionMetadataTaskType)); } } } /// Step status. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct SessionsOpenProgressStatus : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public SessionsOpenProgressStatus(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// The step has started and has not yet finished. public static SessionsOpenProgressStatus InProgress { get; } = new("in-progress"); /// The step has completed successfully. public static SessionsOpenProgressStatus Complete { get; } = new("complete"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(SessionsOpenProgressStatus left, SessionsOpenProgressStatus right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(SessionsOpenProgressStatus left, SessionsOpenProgressStatus right) => !(left == right); /// public override bool Equals(object? obj) => obj is SessionsOpenProgressStatus other && Equals(other); /// public bool Equals(SessionsOpenProgressStatus 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 SessionsOpenProgressStatus Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, SessionsOpenProgressStatus value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(SessionsOpenProgressStatus)); } } } /// Handoff step. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct SessionsOpenProgressStep : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public SessionsOpenProgressStep(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Loading the source session's events from the remote service. public static SessionsOpenProgressStep LoadSession { get; } = new("load-session"); /// Validating that the local repository matches the remote session's repository. public static SessionsOpenProgressStep ValidateRepo { get; } = new("validate-repo"); /// Checking the local working tree for uncommitted changes that would block the handoff. public static SessionsOpenProgressStep CheckChanges { get; } = new("check-changes"); /// Checking out the branch associated with the remote session in the local working tree. public static SessionsOpenProgressStep CheckoutBranch { get; } = new("checkout-branch"); /// Creating the new local session and seeding it with the source session's events. public static SessionsOpenProgressStep CreateSession { get; } = new("create-session"); /// Persisting the newly-created local session to disk. public static SessionsOpenProgressStep SaveSession { get; } = new("save-session"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(SessionsOpenProgressStep left, SessionsOpenProgressStep right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(SessionsOpenProgressStep left, SessionsOpenProgressStep right) => !(left == right); /// public override bool Equals(object? obj) => obj is SessionsOpenProgressStep other && Equals(other); /// public bool Equals(SessionsOpenProgressStep 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 SessionsOpenProgressStep Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, SessionsOpenProgressStep value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(SessionsOpenProgressStep)); } } } /// Outcome of the open request. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct SessionsOpenStatus : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public SessionsOpenStatus(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// A new session was created. public static SessionsOpenStatus Created { get; } = new("created"); /// An existing session was loaded or reattached. public static SessionsOpenStatus Resumed { get; } = new("resumed"); /// No matching persisted session was found. public static SessionsOpenStatus NotFound { get; } = new("not_found"); /// Connected to an existing remote session. public static SessionsOpenStatus Connected { get; } = new("connected"); /// Remote session was handed off to a new local session. public static SessionsOpenStatus HandedOff { get; } = new("handed_off"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(SessionsOpenStatus left, SessionsOpenStatus right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(SessionsOpenStatus left, SessionsOpenStatus right) => !(left == right); /// public override bool Equals(object? obj) => obj is SessionsOpenStatus other && Equals(other); /// public bool Equals(SessionsOpenStatus 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 SessionsOpenStatus Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, SessionsOpenStatus value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(SessionsOpenStatus)); } } } /// 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)); } } } /// Which session sources to include. Defaults to `local` for backward compatibility. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct SessionSource : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public SessionSource(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Return only local sessions. public static SessionSource Local { get; } = new("local"); /// Return only remote sessions. public static SessionSource Remote { get; } = new("remote"); /// Return both local and remote sessions. public static SessionSource All { get; } = new("all"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(SessionSource left, SessionSource right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(SessionSource left, SessionSource right) => !(left == right); /// public override bool Equals(object? obj) => obj is SessionSource other && Equals(other); /// public bool Equals(SessionSource 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 SessionSource Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, SessionSource value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(SessionSource)); } } } /// 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 fell back to a boundary of the remaining history (the beginning for a forward read, the tail for a backward read). The fallback page is a fresh boundary snapshot, not a continuation of the requested cursor, so it may overlap already-rendered events; on 'expired' a consumer should reset/rebase its pagination state (or deduplicate by event id) before continuing from the returned cursor. [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)); } } } /// Direction to page through the session's persisted event history. 'forward' pages from the cursor toward newer events; 'backward' returns the newest window first (tail-first) and pages toward older events. Events within a returned batch are always chronological (oldest-to-newest), even for a backward read. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct EventsReadDirection : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public EventsReadDirection(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Page from the cursor toward newer events (default). public static EventsReadDirection Forward { get; } = new("forward"); /// Tail-first: return the newest events and page toward older events. public static EventsReadDirection Backward { get; } = new("backward"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(EventsReadDirection left, EventsReadDirection right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(EventsReadDirection left, EventsReadDirection right) => !(left == right); /// public override bool Equals(object? obj) => obj is EventsReadDirection other && Equals(other); /// public bool Equals(EventsReadDirection 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 EventsReadDirection Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, EventsReadDirection value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(EventsReadDirection)); } } } /// Kind of attention required when status === "attention". Meaningful only when status === "attention". [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct AgentRegistryLiveTargetEntryAttentionKind : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public AgentRegistryLiveTargetEntryAttentionKind(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Session is blocked on an unrecoverable error. public static AgentRegistryLiveTargetEntryAttentionKind Error { get; } = new("error"); /// Session is waiting for a tool-permission decision. public static AgentRegistryLiveTargetEntryAttentionKind Permission { get; } = new("permission"); /// Session is waiting for the user to approve or reject a plan. public static AgentRegistryLiveTargetEntryAttentionKind ExitPlan { get; } = new("exit_plan"); /// Session is waiting on an elicitation prompt. public static AgentRegistryLiveTargetEntryAttentionKind Elicitation { get; } = new("elicitation"); /// Session is waiting for free-form user input. public static AgentRegistryLiveTargetEntryAttentionKind UserInput { get; } = new("user_input"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(AgentRegistryLiveTargetEntryAttentionKind left, AgentRegistryLiveTargetEntryAttentionKind right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(AgentRegistryLiveTargetEntryAttentionKind left, AgentRegistryLiveTargetEntryAttentionKind right) => !(left == right); /// public override bool Equals(object? obj) => obj is AgentRegistryLiveTargetEntryAttentionKind other && Equals(other); /// public bool Equals(AgentRegistryLiveTargetEntryAttentionKind 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 AgentRegistryLiveTargetEntryAttentionKind Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, AgentRegistryLiveTargetEntryAttentionKind value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(AgentRegistryLiveTargetEntryAttentionKind)); } } } /// Process kind tag for the registry entry. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct AgentRegistryLiveTargetEntryKind : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public AgentRegistryLiveTargetEntryKind(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Interactive Copilot CLI exposing a UI server (legacy/normal CLI process). public static AgentRegistryLiveTargetEntryKind UiServer { get; } = new("ui-server"); /// Headless `--server --managed-server` child spawned by a controller. public static AgentRegistryLiveTargetEntryKind ManagedServer { get; } = new("managed-server"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(AgentRegistryLiveTargetEntryKind left, AgentRegistryLiveTargetEntryKind right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(AgentRegistryLiveTargetEntryKind left, AgentRegistryLiveTargetEntryKind right) => !(left == right); /// public override bool Equals(object? obj) => obj is AgentRegistryLiveTargetEntryKind other && Equals(other); /// public bool Equals(AgentRegistryLiveTargetEntryKind 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 AgentRegistryLiveTargetEntryKind Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, AgentRegistryLiveTargetEntryKind value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(AgentRegistryLiveTargetEntryKind)); } } } /// How the most recent turn ended (clean vs aborted). Lets the renderer distinguish done from done_cancelled. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct AgentRegistryLiveTargetEntryLastTerminalEvent : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public AgentRegistryLiveTargetEntryLastTerminalEvent(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Last turn ended cleanly (model returned a final assistant message). public static AgentRegistryLiveTargetEntryLastTerminalEvent TurnEnd { get; } = new("turn_end"); /// Last turn was aborted (e.g. user interrupted). public static AgentRegistryLiveTargetEntryLastTerminalEvent Abort { get; } = new("abort"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(AgentRegistryLiveTargetEntryLastTerminalEvent left, AgentRegistryLiveTargetEntryLastTerminalEvent right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(AgentRegistryLiveTargetEntryLastTerminalEvent left, AgentRegistryLiveTargetEntryLastTerminalEvent right) => !(left == right); /// public override bool Equals(object? obj) => obj is AgentRegistryLiveTargetEntryLastTerminalEvent other && Equals(other); /// public bool Equals(AgentRegistryLiveTargetEntryLastTerminalEvent 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 AgentRegistryLiveTargetEntryLastTerminalEvent Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, AgentRegistryLiveTargetEntryLastTerminalEvent value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(AgentRegistryLiveTargetEntryLastTerminalEvent)); } } } /// Coarse lifecycle status of the foreground session. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct AgentRegistryLiveTargetEntryStatus : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public AgentRegistryLiveTargetEntryStatus(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Session is actively processing a turn. public static AgentRegistryLiveTargetEntryStatus Working { get; } = new("working"); /// Session is idle, waiting for input. public static AgentRegistryLiveTargetEntryStatus Waiting { get; } = new("waiting"); /// Last turn completed successfully. public static AgentRegistryLiveTargetEntryStatus Done { get; } = new("done"); /// Session needs user attention (see attentionKind for the specific reason). public static AgentRegistryLiveTargetEntryStatus Attention { get; } = new("attention"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(AgentRegistryLiveTargetEntryStatus left, AgentRegistryLiveTargetEntryStatus right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(AgentRegistryLiveTargetEntryStatus left, AgentRegistryLiveTargetEntryStatus right) => !(left == right); /// public override bool Equals(object? obj) => obj is AgentRegistryLiveTargetEntryStatus other && Equals(other); /// public bool Equals(AgentRegistryLiveTargetEntryStatus 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 AgentRegistryLiveTargetEntryStatus Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, AgentRegistryLiveTargetEntryStatus value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(AgentRegistryLiveTargetEntryStatus)); } } } /// Categorized reason for log-open failure. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct AgentRegistryLogCaptureOpenErrorReason : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public AgentRegistryLogCaptureOpenErrorReason(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Filesystem permission denied opening the log file. public static AgentRegistryLogCaptureOpenErrorReason Permission { get; } = new("permission"); /// No space left on device. public static AgentRegistryLogCaptureOpenErrorReason DiskFull { get; } = new("disk_full"); /// Other / uncategorized open failure. public static AgentRegistryLogCaptureOpenErrorReason Other { get; } = new("other"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(AgentRegistryLogCaptureOpenErrorReason left, AgentRegistryLogCaptureOpenErrorReason right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(AgentRegistryLogCaptureOpenErrorReason left, AgentRegistryLogCaptureOpenErrorReason right) => !(left == right); /// public override bool Equals(object? obj) => obj is AgentRegistryLogCaptureOpenErrorReason other && Equals(other); /// public bool Equals(AgentRegistryLogCaptureOpenErrorReason 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 AgentRegistryLogCaptureOpenErrorReason Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, AgentRegistryLogCaptureOpenErrorReason value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(AgentRegistryLogCaptureOpenErrorReason)); } } } /// Which parameter field was invalid. Omitted when the rejection is not field-specific. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct AgentRegistrySpawnValidationErrorField : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public AgentRegistrySpawnValidationErrorField(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// The cwd parameter. public static AgentRegistrySpawnValidationErrorField Cwd { get; } = new("cwd"); /// The session name parameter. public static AgentRegistrySpawnValidationErrorField Name { get; } = new("name"); /// The agentName parameter. public static AgentRegistrySpawnValidationErrorField AgentName { get; } = new("agentName"); /// The model parameter. public static AgentRegistrySpawnValidationErrorField Model { get; } = new("model"); /// The permissionMode parameter. public static AgentRegistrySpawnValidationErrorField PermissionMode { get; } = new("permissionMode"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(AgentRegistrySpawnValidationErrorField left, AgentRegistrySpawnValidationErrorField right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(AgentRegistrySpawnValidationErrorField left, AgentRegistrySpawnValidationErrorField right) => !(left == right); /// public override bool Equals(object? obj) => obj is AgentRegistrySpawnValidationErrorField other && Equals(other); /// public bool Equals(AgentRegistrySpawnValidationErrorField 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 AgentRegistrySpawnValidationErrorField Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, AgentRegistrySpawnValidationErrorField value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(AgentRegistrySpawnValidationErrorField)); } } } /// Categorized reason for the rejection. Low-cardinality enum so telemetry can aggregate by reason without leaking raw paths or agent/model names. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct AgentRegistrySpawnValidationErrorReason : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public AgentRegistrySpawnValidationErrorReason(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Provided cwd does not exist on disk. public static AgentRegistrySpawnValidationErrorReason CwdNotFound { get; } = new("cwd-not-found"); /// Provided cwd exists but is not a directory. public static AgentRegistrySpawnValidationErrorReason CwdNotDirectory { get; } = new("cwd-not-directory"); /// Session name failed validateSessionName. public static AgentRegistrySpawnValidationErrorReason InvalidName { get; } = new("invalid-name"); /// Requested agent name was not found in builtin or custom agents. public static AgentRegistrySpawnValidationErrorReason UnknownAgent { get; } = new("unknown-agent"); /// Requested model is not available to this session. public static AgentRegistrySpawnValidationErrorReason UnknownModel { get; } = new("unknown-model"); /// Caller asked for permissionMode='yolo' but the controller is not currently in allow-all mode. public static AgentRegistrySpawnValidationErrorReason YoloNotAllowed { get; } = new("yolo-not-allowed"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(AgentRegistrySpawnValidationErrorReason left, AgentRegistrySpawnValidationErrorReason right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(AgentRegistrySpawnValidationErrorReason left, AgentRegistrySpawnValidationErrorReason right) => !(left == right); /// public override bool Equals(object? obj) => obj is AgentRegistrySpawnValidationErrorReason other && Equals(other); /// public bool Equals(AgentRegistrySpawnValidationErrorReason 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 AgentRegistrySpawnValidationErrorReason Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, AgentRegistrySpawnValidationErrorReason value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(AgentRegistrySpawnValidationErrorReason)); } } } /// Permission posture for the new session. 'yolo' requires the controller-local session to currently be in allow-all mode. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct AgentRegistrySpawnPermissionMode : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public AgentRegistrySpawnPermissionMode(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Standard permission posture (prompts for each request). public static AgentRegistrySpawnPermissionMode Default { get; } = new("default"); /// Full allow-all (requires the controller-local session to currently be in allow-all mode). public static AgentRegistrySpawnPermissionMode Yolo { get; } = new("yolo"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(AgentRegistrySpawnPermissionMode left, AgentRegistrySpawnPermissionMode right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(AgentRegistrySpawnPermissionMode left, AgentRegistrySpawnPermissionMode right) => !(left == right); /// public override bool Equals(object? obj) => obj is AgentRegistrySpawnPermissionMode other && Equals(other); /// public bool Equals(AgentRegistrySpawnPermissionMode 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 AgentRegistrySpawnPermissionMode Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, AgentRegistrySpawnPermissionMode value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(AgentRegistrySpawnPermissionMode)); } } } /// 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)); } } } /// 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)); } } } /// Disposition of a permission request as observed by the responding client. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct PermissionDecisionOutcome : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public PermissionDecisionOutcome(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// The request was approved automatically without a new human decision. public static PermissionDecisionOutcome AutoApproved { get; } = new("auto_approved"); /// The request was denied without an interactive user decision; source records why. public static PermissionDecisionOutcome AutopilotDenied { get; } = new("autopilot_denied"); /// The response came from an interactive user prompt. public static PermissionDecisionOutcome PromptedUser { get; } = new("prompted_user"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(PermissionDecisionOutcome left, PermissionDecisionOutcome right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(PermissionDecisionOutcome left, PermissionDecisionOutcome right) => !(left == right); /// public override bool Equals(object? obj) => obj is PermissionDecisionOutcome other && Equals(other); /// public bool Equals(PermissionDecisionOutcome 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 PermissionDecisionOutcome Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, PermissionDecisionOutcome value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(PermissionDecisionOutcome)); } } } /// Response capability available to the client when it settled a permission request. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct PermissionResponseCapability : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public PermissionResponseCapability(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// The client could ask a user for this decision. public static PermissionResponseCapability Interactive { get; } = new("interactive"); /// The client could return an automated response but could not ask a user. public static PermissionResponseCapability Headless { get; } = new("headless"); /// The client had no response path available. public static PermissionResponseCapability None { get; } = new("none"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(PermissionResponseCapability left, PermissionResponseCapability right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(PermissionResponseCapability left, PermissionResponseCapability right) => !(left == right); /// public override bool Equals(object? obj) => obj is PermissionResponseCapability other && Equals(other); /// public bool Equals(PermissionResponseCapability 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 PermissionResponseCapability Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, PermissionResponseCapability value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(PermissionResponseCapability)); } } } /// Controlled reason or actor responsible for a permission response. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct PermissionDecisionSource : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public PermissionDecisionSource(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// The response followed the assisted-approval judge recommendation. public static PermissionDecisionSource AssistedApproval { get; } = new("assisted_approval"); /// A human supplied the response through an interactive prompt. public static PermissionDecisionSource HumanResponse { get; } = new("human_response"); /// The host applied a standing policy or override rather than a judge recommendation or human decision. public static PermissionDecisionSource HostPolicy { get; } = new("host_policy"); /// The host denied the request because no interactive user response was available. public static PermissionDecisionSource UnattendedFallback { get; } = new("unattended_fallback"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(PermissionDecisionSource left, PermissionDecisionSource right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(PermissionDecisionSource left, PermissionDecisionSource right) => !(left == right); /// public override bool Equals(object? obj) => obj is PermissionDecisionSource other && Equals(other); /// public bool Equals(PermissionDecisionSource 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 PermissionDecisionSource Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, PermissionDecisionSource value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(PermissionDecisionSource)); } } } /// Client surface that submitted a permission response. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct PermissionDecisionSurface : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public PermissionDecisionSurface(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// The interactive Copilot CLI terminal UI. public static PermissionDecisionSurface Tui { get; } = new("tui"); /// The non-interactive Copilot CLI prompt mode. public static PermissionDecisionSurface PromptMode { get; } = new("prompt_mode"); /// The Copilot App client. public static PermissionDecisionSurface CopilotApp { get; } = new("copilot_app"); /// An Agent Client Protocol host. public static PermissionDecisionSurface Acp { get; } = new("acp"); /// A generic Copilot SDK client. public static PermissionDecisionSurface Sdk { get; } = new("sdk"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(PermissionDecisionSurface left, PermissionDecisionSurface right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(PermissionDecisionSurface left, PermissionDecisionSurface right) => !(left == right); /// public override bool Equals(object? obj) => obj is PermissionDecisionSurface other && Equals(other); /// public bool Equals(PermissionDecisionSurface 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 PermissionDecisionSurface Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, PermissionDecisionSurface value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(PermissionDecisionSurface)); } } } /// 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 an SDK GitHub token callback. public static AuthInfoType TokenProvider { get; } = new("token-provider"); /// 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)); } } } /// Source category for a collected debug bundle entry. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct DebugCollectLogsSource : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public DebugCollectLogsSource(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Session event log. public static DebugCollectLogsSource Events { get; } = new("events"); /// Process log for the session. public static DebugCollectLogsSource ProcessLog { get; } = new("process-log"); /// Interactive shell log for the session. public static DebugCollectLogsSource ShellLog { get; } = new("shell-log"); /// Caller-provided diagnostic entry. public static DebugCollectLogsSource Additional { get; } = new("additional"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(DebugCollectLogsSource left, DebugCollectLogsSource right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(DebugCollectLogsSource left, DebugCollectLogsSource right) => !(left == right); /// public override bool Equals(object? obj) => obj is DebugCollectLogsSource other && Equals(other); /// public bool Equals(DebugCollectLogsSource 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 DebugCollectLogsSource Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, DebugCollectLogsSource value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(DebugCollectLogsSource)); } } } /// Destination kind that was written. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct DebugCollectLogsResultKind : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public DebugCollectLogsResultKind(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// A .tgz archive was written. public static DebugCollectLogsResultKind Archive { get; } = new("archive"); /// A directory containing redacted files was written. public static DebugCollectLogsResultKind Directory { get; } = new("directory"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(DebugCollectLogsResultKind left, DebugCollectLogsResultKind right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(DebugCollectLogsResultKind left, DebugCollectLogsResultKind right) => !(left == right); /// public override bool Equals(object? obj) => obj is DebugCollectLogsResultKind other && Equals(other); /// public bool Equals(DebugCollectLogsResultKind 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 DebugCollectLogsResultKind Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, DebugCollectLogsResultKind value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(DebugCollectLogsResultKind)); } } } /// Kind of caller-provided debug log entry. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct DebugCollectLogsEntryKind : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public DebugCollectLogsEntryKind(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Include a single server-local file. public static DebugCollectLogsEntryKind File { get; } = new("file"); /// Include files from a server-local directory recursively. public static DebugCollectLogsEntryKind Directory { get; } = new("directory"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(DebugCollectLogsEntryKind left, DebugCollectLogsEntryKind right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(DebugCollectLogsEntryKind left, DebugCollectLogsEntryKind right) => !(left == right); /// public override bool Equals(object? obj) => obj is DebugCollectLogsEntryKind other && Equals(other); /// public bool Equals(DebugCollectLogsEntryKind 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 DebugCollectLogsEntryKind Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, DebugCollectLogsEntryKind value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(DebugCollectLogsEntryKind)); } } } /// How a collected debug entry should be redacted before being staged. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct DebugCollectLogsRedaction : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public DebugCollectLogsRedaction(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Redact the file as plain UTF-8 log text. public static DebugCollectLogsRedaction PlainText { get; } = new("plain-text"); /// Redact each non-empty line as a session event JSON object, falling back to plain-text redaction for malformed lines. public static DebugCollectLogsRedaction EventsJsonl { get; } = new("events-jsonl"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(DebugCollectLogsRedaction left, DebugCollectLogsRedaction right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(DebugCollectLogsRedaction left, DebugCollectLogsRedaction right) => !(left == right); /// public override bool Equals(object? obj) => obj is DebugCollectLogsRedaction other && Equals(other); /// public bool Equals(DebugCollectLogsRedaction 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 DebugCollectLogsRedaction Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, DebugCollectLogsRedaction value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(DebugCollectLogsRedaction)); } } } /// Cumulative resource ceiling that stopped a factory run. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct FactoryRunFailureKind : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public FactoryRunFailureKind(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// The run admitted the approved maximum total number of subagents. public static FactoryRunFailureKind MaxTotalSubagents { get; } = new("maxTotalSubagents"); /// The run reached the approved accumulated active-execution time in seconds. public static FactoryRunFailureKind TimeoutSeconds { get; } = new("timeoutSeconds"); /// The run's settled subagent model usage exceeded the approved AI-credit ceiling, or no headroom remained for another subagent. public static FactoryRunFailureKind MaxAiCredits { get; } = new("maxAiCredits"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(FactoryRunFailureKind left, FactoryRunFailureKind right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(FactoryRunFailureKind left, FactoryRunFailureKind right) => !(left == right); /// public override bool Equals(object? obj) => obj is FactoryRunFailureKind other && Equals(other); /// public bool Equals(FactoryRunFailureKind 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 FactoryRunFailureKind Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, FactoryRunFailureKind value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(FactoryRunFailureKind)); } } } /// Execution-critical factory storage operation. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct FactoryDurableOperation : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public FactoryDurableOperation(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Creating the durable run and declared phases. public static FactoryDurableOperation CreateRun { get; } = new("createRun"); /// Persisting the transition to running. public static FactoryDurableOperation MarkRunStarted { get; } = new("markRunStarted"); /// Persisting the terminal run envelope. public static FactoryDurableOperation FinishRun { get; } = new("finishRun"); /// Persisting subagent admission accounting. public static FactoryDurableOperation ReserveAgent { get; } = new("reserveAgent"); /// Rolling back an uncommitted subagent admission. public static FactoryDurableOperation ReleaseAgent { get; } = new("releaseAgent"); /// Persisting an idempotent model-usage charge. public static FactoryDurableOperation ChargeCredit { get; } = new("chargeCredit"); /// Persisting active execution time. public static FactoryDurableOperation AddElapsed { get; } = new("addElapsed"); /// Reading the authoritative AI-credit total. public static FactoryDurableOperation ReconcileCreditTotal { get; } = new("reconcileCreditTotal"); /// Reading a journal entry without treating storage failure as a cache miss. public static FactoryDurableOperation JournalGet { get; } = new("journalGet"); /// Persisting a journal entry before reporting success. public static FactoryDurableOperation JournalPut { get; } = new("journalPut"); /// Renewing the durable owner lease that proves this process still owns the run. public static FactoryDurableOperation RefreshLease { get; } = new("refreshLease"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(FactoryDurableOperation left, FactoryDurableOperation right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(FactoryDurableOperation left, FactoryDurableOperation right) => !(left == right); /// public override bool Equals(object? obj) => obj is FactoryDurableOperation other && Equals(other); /// public bool Equals(FactoryDurableOperation 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 FactoryDurableOperation Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, FactoryDurableOperation value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(FactoryDurableOperation)); } } } /// Current or terminal state of a factory run. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct FactoryRunStatus : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public FactoryRunStatus(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// The run was minted and is awaiting approval. public static FactoryRunStatus Pending { get; } = new("pending"); /// The run is executing. public static FactoryRunStatus Running { get; } = new("running"); /// The run completed successfully. public static FactoryRunStatus Completed { get; } = new("completed"); /// The run was interrupted while resource budget remained. public static FactoryRunStatus Halted { get; } = new("halted"); /// The current attempt stopped intentionally and the run may be resumed. public static FactoryRunStatus Paused { get; } = new("paused"); /// The run was cancelled before completion. public static FactoryRunStatus Cancelled { get; } = new("cancelled"); /// The factory body failed or reached a cumulative resource ceiling. public static FactoryRunStatus Error { get; } = new("error"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(FactoryRunStatus left, FactoryRunStatus right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(FactoryRunStatus left, FactoryRunStatus right) => !(left == right); /// public override bool Equals(object? obj) => obj is FactoryRunStatus other && Equals(other); /// public bool Equals(FactoryRunStatus 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 FactoryRunStatus Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, FactoryRunStatus value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(FactoryRunStatus)); } } } /// Derived lifecycle state of a factory phase. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct FactoryPhaseStatus : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public FactoryPhaseStatus(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// The phase has not been entered yet. public static FactoryPhaseStatus Pending { get; } = new("pending"); /// The phase is currently entered and accumulating active time. public static FactoryPhaseStatus Active { get; } = new("active"); /// The phase was entered and has since been closed. public static FactoryPhaseStatus Completed { get; } = new("completed"); /// The phase was never entered because a later phase was entered or the run reached a terminal state. public static FactoryPhaseStatus Skipped { get; } = new("skipped"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(FactoryPhaseStatus left, FactoryPhaseStatus right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(FactoryPhaseStatus left, FactoryPhaseStatus right) => !(left == right); /// public override bool Equals(object? obj) => obj is FactoryPhaseStatus other && Equals(other); /// public bool Equals(FactoryPhaseStatus 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 FactoryPhaseStatus Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, FactoryPhaseStatus value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(FactoryPhaseStatus)); } } } /// Kind of factory progress line. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct FactoryLogLineKind : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public FactoryLogLineKind(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// A narrator log line. public static FactoryLogLineKind Log { get; } = new("log"); /// A named factory phase marker. public static FactoryLogLineKind Phase { get; } = new("phase"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(FactoryLogLineKind left, FactoryLogLineKind right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(FactoryLogLineKind left, FactoryLogLineKind right) => !(left == right); /// public override bool Equals(object? obj) => obj is FactoryLogLineKind other && Equals(other); /// public bool Equals(FactoryLogLineKind 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 FactoryLogLineKind Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, FactoryLogLineKind value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(FactoryLogLineKind)); } } } /// Action the runtime selected for a durable factory pause checkpoint. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct FactoryPauseCheckpointAction : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public FactoryPauseCheckpointAction(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// The checkpoint was committed by a prior paused attempt, so execution may continue. public static FactoryPauseCheckpointAction Continue { get; } = new("continue"); /// This attempt claimed the checkpoint and must cooperatively stop. public static FactoryPauseCheckpointAction Pause { get; } = new("pause"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(FactoryPauseCheckpointAction left, FactoryPauseCheckpointAction right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(FactoryPauseCheckpointAction left, FactoryPauseCheckpointAction right) => !(left == right); /// public override bool Equals(object? obj) => obj is FactoryPauseCheckpointAction other && Equals(other); /// public bool Equals(FactoryPauseCheckpointAction 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 FactoryPauseCheckpointAction Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, FactoryPauseCheckpointAction value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(FactoryPauseCheckpointAction)); } } } /// Whether the requested preference was already effective or was accepted for later transactional activation. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct ModelSwitchAutoTierStatus : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public ModelSwitchAutoTierStatus(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// The requested preference is already effective. No activation is pending for it, although this request may have cancelled an earlier unclaimed preference reported in `supersededAutoTier`. public static ModelSwitchAutoTierStatus Unchanged { get; } = new("unchanged"); /// The request was accepted but has not committed. A later user turn using the `auto` model must mint and validate the replacement before it becomes effective. public static ModelSwitchAutoTierStatus Pending { get; } = new("pending"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(ModelSwitchAutoTierStatus left, ModelSwitchAutoTierStatus right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(ModelSwitchAutoTierStatus left, ModelSwitchAutoTierStatus right) => !(left == right); /// public override bool Equals(object? obj) => obj is ModelSwitchAutoTierStatus other && Equals(other); /// public bool Equals(ModelSwitchAutoTierStatus 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 ModelSwitchAutoTierStatus Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, ModelSwitchAutoTierStatus value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(ModelSwitchAutoTierStatus)); } } } /// 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)); } } } /// Type of change represented by this file diff. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct WorkspaceDiffFileChangeType : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public WorkspaceDiffFileChangeType(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// The file was added. public static WorkspaceDiffFileChangeType Added { get; } = new("added"); /// The file was modified. public static WorkspaceDiffFileChangeType Modified { get; } = new("modified"); /// The file was deleted. public static WorkspaceDiffFileChangeType Deleted { get; } = new("deleted"); /// The file was renamed. public static WorkspaceDiffFileChangeType Renamed { get; } = new("renamed"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(WorkspaceDiffFileChangeType left, WorkspaceDiffFileChangeType right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(WorkspaceDiffFileChangeType left, WorkspaceDiffFileChangeType right) => !(left == right); /// public override bool Equals(object? obj) => obj is WorkspaceDiffFileChangeType other && Equals(other); /// public bool Equals(WorkspaceDiffFileChangeType 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 WorkspaceDiffFileChangeType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, WorkspaceDiffFileChangeType value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(WorkspaceDiffFileChangeType)); } } } /// Diff mode requested by the client. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct WorkspaceDiffMode : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public WorkspaceDiffMode(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Return staged, unstaged, and untracked working tree changes. public static WorkspaceDiffMode Unstaged { get; } = new("unstaged"); /// Return changes compared with the default branch. public static WorkspaceDiffMode Branch { get; } = new("branch"); /// Return the cumulative diff of files Copilot changed this session (used in non-git workspaces). public static WorkspaceDiffMode Session { get; } = new("session"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(WorkspaceDiffMode left, WorkspaceDiffMode right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(WorkspaceDiffMode left, WorkspaceDiffMode right) => !(left == right); /// public override bool Equals(object? obj) => obj is WorkspaceDiffMode other && Equals(other); /// public bool Equals(WorkspaceDiffMode 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 WorkspaceDiffMode Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, WorkspaceDiffMode value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(WorkspaceDiffMode)); } } } /// Reason a rewind read (rewind points, file-restore preview, or session diff) could not be answered from the session's file-change captures. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct HistoryRewindUnavailableReason : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public HistoryRewindUnavailableReason(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// The session did not opt into file-change tracking before its first turn. public static HistoryRewindUnavailableReason FileChangeTrackingDisabled { get; } = new("file-change-tracking-disabled"); /// The session still has work that may mutate files or history. Transient: the same request succeeds once the session settles, so callers should retry rather than treat it as a failure. public static HistoryRewindUnavailableReason SessionBusy { get; } = new("session-busy"); /// Remote-backed rewind routing is not supported. public static HistoryRewindUnavailableReason UnsupportedRemoteSession { get; } = new("unsupported-remote-session"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(HistoryRewindUnavailableReason left, HistoryRewindUnavailableReason right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(HistoryRewindUnavailableReason left, HistoryRewindUnavailableReason right) => !(left == right); /// public override bool Equals(object? obj) => obj is HistoryRewindUnavailableReason other && Equals(other); /// public bool Equals(HistoryRewindUnavailableReason 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 HistoryRewindUnavailableReason Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, HistoryRewindUnavailableReason value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(HistoryRewindUnavailableReason)); } } } /// Current normalized autopilot objective lifecycle status. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct AutopilotObjectiveStatus : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public AutopilotObjectiveStatus(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// The objective is actively running. public static AutopilotObjectiveStatus Active { get; } = new("active"); /// The objective is paused and may be resumed. public static AutopilotObjectiveStatus Paused { get; } = new("paused"); /// The objective completed. public static AutopilotObjectiveStatus Completed { get; } = new("completed"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(AutopilotObjectiveStatus left, AutopilotObjectiveStatus right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(AutopilotObjectiveStatus left, AutopilotObjectiveStatus right) => !(left == right); /// public override bool Equals(object? obj) => obj is AutopilotObjectiveStatus other && Equals(other); /// public bool Equals(AutopilotObjectiveStatus 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 AutopilotObjectiveStatus Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, AutopilotObjectiveStatus value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(AutopilotObjectiveStatus)); } } } /// 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)); } } } /// Client-owned tasks always execute outside the runtime in background mode. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct TaskClientExecutionMode : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public TaskClientExecutionMode(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Gets the background value. public static TaskClientExecutionMode Background { get; } = new("background"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(TaskClientExecutionMode left, TaskClientExecutionMode right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(TaskClientExecutionMode left, TaskClientExecutionMode right) => !(left == right); /// public override bool Equals(object? obj) => obj is TaskClientExecutionMode other && Equals(other); /// public bool Equals(TaskClientExecutionMode 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 TaskClientExecutionMode Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, TaskClientExecutionMode value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(TaskClientExecutionMode)); } } } /// Connection class owning a client task. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct TaskClientOwnerKind : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public TaskClientOwnerKind(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// A discovered extension connection owns the task. public static TaskClientOwnerKind Extension { get; } = new("extension"); /// A generic SDK connection owns the task. public static TaskClientOwnerKind Sdk { get; } = new("sdk"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(TaskClientOwnerKind left, TaskClientOwnerKind right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(TaskClientOwnerKind left, TaskClientOwnerKind right) => !(left == right); /// public override bool Equals(object? obj) => obj is TaskClientOwnerKind other && Equals(other); /// public bool Equals(TaskClientOwnerKind 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 TaskClientOwnerKind Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, TaskClientOwnerKind value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(TaskClientOwnerKind)); } } } /// Presence of the task's bound join. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct TaskClientOwnerPresence : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public TaskClientOwnerPresence(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// The bound session join is connected. public static TaskClientOwnerPresence Connected { get; } = new("connected"); /// The bound session join is disconnected. public static TaskClientOwnerPresence Disconnected { get; } = new("disconnected"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(TaskClientOwnerPresence left, TaskClientOwnerPresence right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(TaskClientOwnerPresence left, TaskClientOwnerPresence right) => !(left == right); /// public override bool Equals(object? obj) => obj is TaskClientOwnerPresence other && Equals(other); /// public bool Equals(TaskClientOwnerPresence 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 TaskClientOwnerPresence Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, TaskClientOwnerPresence value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(TaskClientOwnerPresence)); } } } /// Lifecycle status of a client-owned task. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct TaskClientStatus : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public TaskClientStatus(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// The external owner is actively working. public static TaskClientStatus Running { get; } = new("running"); /// The external owner is connected but waiting. public static TaskClientStatus Idle { get; } = new("idle"); /// The owner reported successful completion. public static TaskClientStatus Completed { get; } = new("completed"); /// The owner reported failure. public static TaskClientStatus Failed { get; } = new("failed"); /// The owner reported or confirmed cancellation. public static TaskClientStatus Cancelled { get; } = new("cancelled"); /// The bound owner join disappeared; external executor state is unknown. public static TaskClientStatus Orphaned { get; } = new("orphaned"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(TaskClientStatus left, TaskClientStatus right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(TaskClientStatus left, TaskClientStatus right) => !(left == right); /// public override bool Equals(object? obj) => obj is TaskClientStatus other && Equals(other); /// public bool Equals(TaskClientStatus 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 TaskClientStatus Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, TaskClientStatus value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(TaskClientStatus)); } } } /// 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)); } } } /// Discriminator for a client-owned task. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct TaskClientType : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public TaskClientType(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Gets the client value. public static TaskClientType Client { get; } = new("client"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(TaskClientType left, TaskClientType right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(TaskClientType left, TaskClientType right) => !(left == right); /// public override bool Equals(object? obj) => obj is TaskClientType other && Equals(other); /// public bool Equals(TaskClientType 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 TaskClientType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, TaskClientType value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(TaskClientType)); } } } /// Active status a client owner may publish with a progress update. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct TaskClientActiveStatus : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public TaskClientActiveStatus(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// The external owner is actively working. public static TaskClientActiveStatus Running { get; } = new("running"); /// The external owner is connected but waiting. public static TaskClientActiveStatus Idle { get; } = new("idle"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(TaskClientActiveStatus left, TaskClientActiveStatus right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(TaskClientActiveStatus left, TaskClientActiveStatus right) => !(left == right); /// public override bool Equals(object? obj) => obj is TaskClientActiveStatus other && Equals(other); /// public bool Equals(TaskClientActiveStatus 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 TaskClientActiveStatus Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, TaskClientActiveStatus value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(TaskClientActiveStatus)); } } } /// Consumer allowed to call an MCP tool. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct McpToolUiVisibility : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public McpToolUiVisibility(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// The model may call the tool. public static McpToolUiVisibility Model { get; } = new("model"); /// An MCP App view may call the tool. public static McpToolUiVisibility App { get; } = new("app"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(McpToolUiVisibility left, McpToolUiVisibility right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(McpToolUiVisibility left, McpToolUiVisibility right) => !(left == right); /// public override bool Equals(object? obj) => obj is McpToolUiVisibility other && Equals(other); /// public bool Equals(McpToolUiVisibility 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 McpToolUiVisibility Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, McpToolUiVisibility value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(McpToolUiVisibility)); } } } /// 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)); } } } /// OAuth grant type override for this login. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct McpOauthLoginGrantType : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public McpOauthLoginGrantType(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Interactive browser-based OAuth flow using an authorization code, typically with PKCE. public static McpOauthLoginGrantType AuthorizationCode { get; } = new("authorization_code"); /// Headless OAuth flow where a confidential client authenticates directly with a client secret. public static McpOauthLoginGrantType ClientCredentials { get; } = new("client_credentials"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(McpOauthLoginGrantType left, McpOauthLoginGrantType right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(McpOauthLoginGrantType left, McpOauthLoginGrantType right) => !(left == right); /// public override bool Equals(object? obj) => obj is McpOauthLoginGrantType other && Equals(other); /// public bool Equals(McpOauthLoginGrantType 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 McpOauthLoginGrantType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, McpOauthLoginGrantType value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(McpOauthLoginGrantType)); } } } /// Why a passive MCP OAuth probe determined authentication is needed. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct McpOauthProbeNeedsAuthReason : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public McpOauthProbeNeedsAuthReason(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// No token was sent and the server requires authentication. public static McpOauthProbeNeedsAuthReason Initial { get; } = new("initial"); /// A cached token was sent and rejected. public static McpOauthProbeNeedsAuthReason Refresh { get; } = new("refresh"); /// The server returned a 403 insufficient_scope challenge, indicating additional scopes or audience are needed. public static McpOauthProbeNeedsAuthReason Upscope { get; } = new("upscope"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(McpOauthProbeNeedsAuthReason left, McpOauthProbeNeedsAuthReason right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(McpOauthProbeNeedsAuthReason left, McpOauthProbeNeedsAuthReason right) => !(left == right); /// public override bool Equals(object? obj) => obj is McpOauthProbeNeedsAuthReason other && Equals(other); /// public bool Equals(McpOauthProbeNeedsAuthReason 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 McpOauthProbeNeedsAuthReason Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, McpOauthProbeNeedsAuthReason value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(McpOauthProbeNeedsAuthReason)); } } } /// Allowed values for the `McpAppsSetHostContextDetailsAvailableDisplayMode` enumeration. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct McpAppsSetHostContextDetailsAvailableDisplayMode : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public McpAppsSetHostContextDetailsAvailableDisplayMode(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Rendered inline within the host conversation surface. public static McpAppsSetHostContextDetailsAvailableDisplayMode Inline { get; } = new("inline"); /// Rendered as a fullscreen overlay. public static McpAppsSetHostContextDetailsAvailableDisplayMode Fullscreen { get; } = new("fullscreen"); /// Rendered as a picture-in-picture floating panel. public static McpAppsSetHostContextDetailsAvailableDisplayMode Pip { get; } = new("pip"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(McpAppsSetHostContextDetailsAvailableDisplayMode left, McpAppsSetHostContextDetailsAvailableDisplayMode right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(McpAppsSetHostContextDetailsAvailableDisplayMode left, McpAppsSetHostContextDetailsAvailableDisplayMode right) => !(left == right); /// public override bool Equals(object? obj) => obj is McpAppsSetHostContextDetailsAvailableDisplayMode other && Equals(other); /// public bool Equals(McpAppsSetHostContextDetailsAvailableDisplayMode 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 McpAppsSetHostContextDetailsAvailableDisplayMode Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, McpAppsSetHostContextDetailsAvailableDisplayMode value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(McpAppsSetHostContextDetailsAvailableDisplayMode)); } } } /// Current display mode (SEP-1865). [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct McpAppsSetHostContextDetailsDisplayMode : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public McpAppsSetHostContextDetailsDisplayMode(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Rendered inline within the host conversation surface. public static McpAppsSetHostContextDetailsDisplayMode Inline { get; } = new("inline"); /// Rendered as a fullscreen overlay. public static McpAppsSetHostContextDetailsDisplayMode Fullscreen { get; } = new("fullscreen"); /// Rendered as a picture-in-picture floating panel. public static McpAppsSetHostContextDetailsDisplayMode Pip { get; } = new("pip"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(McpAppsSetHostContextDetailsDisplayMode left, McpAppsSetHostContextDetailsDisplayMode right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(McpAppsSetHostContextDetailsDisplayMode left, McpAppsSetHostContextDetailsDisplayMode right) => !(left == right); /// public override bool Equals(object? obj) => obj is McpAppsSetHostContextDetailsDisplayMode other && Equals(other); /// public bool Equals(McpAppsSetHostContextDetailsDisplayMode 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 McpAppsSetHostContextDetailsDisplayMode Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, McpAppsSetHostContextDetailsDisplayMode value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(McpAppsSetHostContextDetailsDisplayMode)); } } } /// Platform type for responsive design. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct McpAppsSetHostContextDetailsPlatform : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public McpAppsSetHostContextDetailsPlatform(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Host runs in a web browser. public static McpAppsSetHostContextDetailsPlatform Web { get; } = new("web"); /// Host runs as a desktop application. public static McpAppsSetHostContextDetailsPlatform Desktop { get; } = new("desktop"); /// Host runs on a mobile device. public static McpAppsSetHostContextDetailsPlatform Mobile { get; } = new("mobile"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(McpAppsSetHostContextDetailsPlatform left, McpAppsSetHostContextDetailsPlatform right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(McpAppsSetHostContextDetailsPlatform left, McpAppsSetHostContextDetailsPlatform right) => !(left == right); /// public override bool Equals(object? obj) => obj is McpAppsSetHostContextDetailsPlatform other && Equals(other); /// public bool Equals(McpAppsSetHostContextDetailsPlatform 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 McpAppsSetHostContextDetailsPlatform Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, McpAppsSetHostContextDetailsPlatform value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(McpAppsSetHostContextDetailsPlatform)); } } } /// UI theme preference per SEP-1865. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct McpAppsSetHostContextDetailsTheme : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public McpAppsSetHostContextDetailsTheme(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Light UI theme. public static McpAppsSetHostContextDetailsTheme Light { get; } = new("light"); /// Dark UI theme. public static McpAppsSetHostContextDetailsTheme Dark { get; } = new("dark"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(McpAppsSetHostContextDetailsTheme left, McpAppsSetHostContextDetailsTheme right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(McpAppsSetHostContextDetailsTheme left, McpAppsSetHostContextDetailsTheme right) => !(left == right); /// public override bool Equals(object? obj) => obj is McpAppsSetHostContextDetailsTheme other && Equals(other); /// public bool Equals(McpAppsSetHostContextDetailsTheme 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 McpAppsSetHostContextDetailsTheme Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, McpAppsSetHostContextDetailsTheme value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(McpAppsSetHostContextDetailsTheme)); } } } /// Allowed values for the `McpAppsHostContextDetailsAvailableDisplayMode` enumeration. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct McpAppsHostContextDetailsAvailableDisplayMode : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public McpAppsHostContextDetailsAvailableDisplayMode(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Rendered inline within the host conversation surface. public static McpAppsHostContextDetailsAvailableDisplayMode Inline { get; } = new("inline"); /// Rendered as a fullscreen overlay. public static McpAppsHostContextDetailsAvailableDisplayMode Fullscreen { get; } = new("fullscreen"); /// Rendered as a picture-in-picture floating panel. public static McpAppsHostContextDetailsAvailableDisplayMode Pip { get; } = new("pip"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(McpAppsHostContextDetailsAvailableDisplayMode left, McpAppsHostContextDetailsAvailableDisplayMode right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(McpAppsHostContextDetailsAvailableDisplayMode left, McpAppsHostContextDetailsAvailableDisplayMode right) => !(left == right); /// public override bool Equals(object? obj) => obj is McpAppsHostContextDetailsAvailableDisplayMode other && Equals(other); /// public bool Equals(McpAppsHostContextDetailsAvailableDisplayMode 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 McpAppsHostContextDetailsAvailableDisplayMode Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, McpAppsHostContextDetailsAvailableDisplayMode value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(McpAppsHostContextDetailsAvailableDisplayMode)); } } } /// Current display mode (SEP-1865). [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct McpAppsHostContextDetailsDisplayMode : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public McpAppsHostContextDetailsDisplayMode(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Rendered inline within the host conversation surface. public static McpAppsHostContextDetailsDisplayMode Inline { get; } = new("inline"); /// Rendered as a fullscreen overlay. public static McpAppsHostContextDetailsDisplayMode Fullscreen { get; } = new("fullscreen"); /// Rendered as a picture-in-picture floating panel. public static McpAppsHostContextDetailsDisplayMode Pip { get; } = new("pip"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(McpAppsHostContextDetailsDisplayMode left, McpAppsHostContextDetailsDisplayMode right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(McpAppsHostContextDetailsDisplayMode left, McpAppsHostContextDetailsDisplayMode right) => !(left == right); /// public override bool Equals(object? obj) => obj is McpAppsHostContextDetailsDisplayMode other && Equals(other); /// public bool Equals(McpAppsHostContextDetailsDisplayMode 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 McpAppsHostContextDetailsDisplayMode Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, McpAppsHostContextDetailsDisplayMode value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(McpAppsHostContextDetailsDisplayMode)); } } } /// Platform type for responsive design. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct McpAppsHostContextDetailsPlatform : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public McpAppsHostContextDetailsPlatform(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Host runs in a web browser. public static McpAppsHostContextDetailsPlatform Web { get; } = new("web"); /// Host runs as a desktop application. public static McpAppsHostContextDetailsPlatform Desktop { get; } = new("desktop"); /// Host runs on a mobile device. public static McpAppsHostContextDetailsPlatform Mobile { get; } = new("mobile"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(McpAppsHostContextDetailsPlatform left, McpAppsHostContextDetailsPlatform right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(McpAppsHostContextDetailsPlatform left, McpAppsHostContextDetailsPlatform right) => !(left == right); /// public override bool Equals(object? obj) => obj is McpAppsHostContextDetailsPlatform other && Equals(other); /// public bool Equals(McpAppsHostContextDetailsPlatform 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 McpAppsHostContextDetailsPlatform Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, McpAppsHostContextDetailsPlatform value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(McpAppsHostContextDetailsPlatform)); } } } /// UI theme preference per SEP-1865. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct McpAppsHostContextDetailsTheme : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public McpAppsHostContextDetailsTheme(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Light UI theme. public static McpAppsHostContextDetailsTheme Light { get; } = new("light"); /// Dark UI theme. public static McpAppsHostContextDetailsTheme Dark { get; } = new("dark"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(McpAppsHostContextDetailsTheme left, McpAppsHostContextDetailsTheme right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(McpAppsHostContextDetailsTheme left, McpAppsHostContextDetailsTheme right) => !(left == right); /// public override bool Equals(object? obj) => obj is McpAppsHostContextDetailsTheme other && Equals(other); /// public bool Equals(McpAppsHostContextDetailsTheme 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 McpAppsHostContextDetailsTheme Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, McpAppsHostContextDetailsTheme value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(McpAppsHostContextDetailsTheme)); } } } /// Transport to be used for provider requests. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct ProviderEndpointTransport : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public ProviderEndpointTransport(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// HTTP request/streaming transport. public static ProviderEndpointTransport Http { get; } = new("http"); /// WebSocket transport. public static ProviderEndpointTransport Websockets { get; } = new("websockets"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(ProviderEndpointTransport left, ProviderEndpointTransport right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(ProviderEndpointTransport left, ProviderEndpointTransport right) => !(left == right); /// public override bool Equals(object? obj) => obj is ProviderEndpointTransport other && Equals(other); /// public bool Equals(ProviderEndpointTransport 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 ProviderEndpointTransport Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, ProviderEndpointTransport value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(ProviderEndpointTransport)); } } } /// Provider family. Matches the `type` field of a BYOK provider config. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct ProviderEndpointType : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public ProviderEndpointType(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// OpenAI-compatible endpoint (use the OpenAI client library). public static ProviderEndpointType Openai { get; } = new("openai"); /// Azure OpenAI endpoint (use the OpenAI client library with the Azure base URL). public static ProviderEndpointType Azure { get; } = new("azure"); /// Anthropic endpoint (use the Anthropic client library). public static ProviderEndpointType Anthropic { get; } = new("anthropic"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(ProviderEndpointType left, ProviderEndpointType right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(ProviderEndpointType left, ProviderEndpointType right) => !(left == right); /// public override bool Equals(object? obj) => obj is ProviderEndpointType other && Equals(other); /// public bool Equals(ProviderEndpointType 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 ProviderEndpointType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, ProviderEndpointType value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(ProviderEndpointType)); } } } /// Wire API to be used, when required for the provider type. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct ProviderEndpointWireApi : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public ProviderEndpointWireApi(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Classic chat-completions request shape. public static ProviderEndpointWireApi Completions { get; } = new("completions"); /// Newer responses request shape. public static ProviderEndpointWireApi Responses { get; } = new("responses"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(ProviderEndpointWireApi left, ProviderEndpointWireApi right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(ProviderEndpointWireApi left, ProviderEndpointWireApi right) => !(left == right); /// public override bool Equals(object? obj) => obj is ProviderEndpointWireApi other && Equals(other); /// public bool Equals(ProviderEndpointWireApi 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 ProviderEndpointWireApi Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, ProviderEndpointWireApi value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(ProviderEndpointWireApi)); } } } /// Provider transport. Defaults to "http". [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct ProviderConfigTransport : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public ProviderConfigTransport(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// HTTP request/streaming transport. public static ProviderConfigTransport Http { get; } = new("http"); /// WebSocket transport. public static ProviderConfigTransport Websockets { get; } = new("websockets"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(ProviderConfigTransport left, ProviderConfigTransport right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(ProviderConfigTransport left, ProviderConfigTransport right) => !(left == right); /// public override bool Equals(object? obj) => obj is ProviderConfigTransport other && Equals(other); /// public bool Equals(ProviderConfigTransport 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 ProviderConfigTransport Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, ProviderConfigTransport value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(ProviderConfigTransport)); } } } /// Provider type. Defaults to "openai" for generic OpenAI-compatible APIs. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct ProviderConfigType : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public ProviderConfigType(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Generic OpenAI-compatible API. public static ProviderConfigType Openai { get; } = new("openai"); /// Azure OpenAI Service endpoint. public static ProviderConfigType Azure { get; } = new("azure"); /// Anthropic API endpoint. public static ProviderConfigType Anthropic { get; } = new("anthropic"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(ProviderConfigType left, ProviderConfigType right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(ProviderConfigType left, ProviderConfigType right) => !(left == right); /// public override bool Equals(object? obj) => obj is ProviderConfigType other && Equals(other); /// public bool Equals(ProviderConfigType 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 ProviderConfigType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, ProviderConfigType value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(ProviderConfigType)); } } } /// Wire API format (openai/azure only). Defaults to "completions". [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct ProviderConfigWireApi : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public ProviderConfigWireApi(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// OpenAI Chat Completions wire format. public static ProviderConfigWireApi Completions { get; } = new("completions"); /// OpenAI Responses API wire format. public static ProviderConfigWireApi Responses { get; } = new("responses"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(ProviderConfigWireApi left, ProviderConfigWireApi right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(ProviderConfigWireApi left, ProviderConfigWireApi right) => !(left == right); /// public override bool Equals(object? obj) => obj is ProviderConfigWireApi other && Equals(other); /// public bool Equals(ProviderConfigWireApi 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 ProviderConfigWireApi Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, ProviderConfigWireApi value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(ProviderConfigWireApi)); } } } /// Allowed values for the `OptionsUpdateAdditionalContentExclusionPolicyScope` enumeration. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct OptionsUpdateAdditionalContentExclusionPolicyScope : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public OptionsUpdateAdditionalContentExclusionPolicyScope(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 OptionsUpdateAdditionalContentExclusionPolicyScope Repo { get; } = new("repo"); /// The content exclusion policy applies across all repositories. public static OptionsUpdateAdditionalContentExclusionPolicyScope All { get; } = new("all"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(OptionsUpdateAdditionalContentExclusionPolicyScope left, OptionsUpdateAdditionalContentExclusionPolicyScope right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(OptionsUpdateAdditionalContentExclusionPolicyScope left, OptionsUpdateAdditionalContentExclusionPolicyScope right) => !(left == right); /// public override bool Equals(object? obj) => obj is OptionsUpdateAdditionalContentExclusionPolicyScope other && Equals(other); /// public bool Equals(OptionsUpdateAdditionalContentExclusionPolicyScope 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 OptionsUpdateAdditionalContentExclusionPolicyScope Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, OptionsUpdateAdditionalContentExclusionPolicyScope value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(OptionsUpdateAdditionalContentExclusionPolicyScope)); } } } /// Context tier for models with tiered pricing. The session uses this to derive effective `modelCapabilitiesOverrides` so compaction, truncation, token display, and request limits honor the selected tier. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct OptionsUpdateContextTier : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public OptionsUpdateContextTier(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Use the model's default context tier and its standard token limits / pricing. public static OptionsUpdateContextTier Default { get; } = new("default"); /// Use the model's long-context tier (when available) so larger inputs are accepted and tier-specific pricing applies. public static OptionsUpdateContextTier LongContext { get; } = new("long_context"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(OptionsUpdateContextTier left, OptionsUpdateContextTier right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(OptionsUpdateContextTier left, OptionsUpdateContextTier right) => !(left == right); /// public override bool Equals(object? obj) => obj is OptionsUpdateContextTier other && Equals(other); /// public bool Equals(OptionsUpdateContextTier 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 OptionsUpdateContextTier Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, OptionsUpdateContextTier value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(OptionsUpdateContextTier)); } } } /// 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)); } } } /// Reasoning summary mode for supported model clients. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct OptionsUpdateReasoningSummary : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public OptionsUpdateReasoningSummary(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Do not request reasoning summaries from the model. public static OptionsUpdateReasoningSummary None { get; } = new("none"); /// Request a concise summary of model reasoning. public static OptionsUpdateReasoningSummary Concise { get; } = new("concise"); /// Request a detailed summary of model reasoning. public static OptionsUpdateReasoningSummary Detailed { get; } = new("detailed"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(OptionsUpdateReasoningSummary left, OptionsUpdateReasoningSummary right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(OptionsUpdateReasoningSummary left, OptionsUpdateReasoningSummary right) => !(left == right); /// public override bool Equals(object? obj) => obj is OptionsUpdateReasoningSummary other && Equals(other); /// public bool Equals(OptionsUpdateReasoningSummary 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 OptionsUpdateReasoningSummary Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, OptionsUpdateReasoningSummary value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(OptionsUpdateReasoningSummary)); } } } /// Origin of the sandbox choice supplied by an internal client. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct SandboxConfigSource : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public SandboxConfigSource(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// The client applied the default because no sandbox preference was configured. public static SandboxConfigSource NeverConfigured { get; } = new("never_configured"); /// The user's persisted settings enabled the sandbox. public static SandboxConfigSource UserEnabled { get; } = new("user_enabled"); /// The user's persisted settings disabled the sandbox. public static SandboxConfigSource UserDisabled { get; } = new("user_disabled"); /// A command-line flag selected the sandbox state for this session. public static SandboxConfigSource SessionFlag { get; } = new("session_flag"); /// The user disabled the sandbox for the current session. public static SandboxConfigSource SessionDisabled { get; } = new("session_disabled"); /// The client disabled the sandbox because the host cannot enforce it. public static SandboxConfigSource UnsupportedHost { get; } = new("unsupported_host"); /// A repository policy selected the sandbox state. public static SandboxConfigSource RepositoryPolicy { get; } = new("repository_policy"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(SandboxConfigSource left, SandboxConfigSource right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(SandboxConfigSource left, SandboxConfigSource right) => !(left == right); /// public override bool Equals(object? obj) => obj is SandboxConfigSource other && Equals(other); /// public bool Equals(SandboxConfigSource 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 SandboxConfigSource Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, SandboxConfigSource value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(SandboxConfigSource)); } } } /// Session capability enabled for this session. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct SessionCapability : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public SessionCapability(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// TUI-specific prompt hints such as keyboard shortcuts. public static SessionCapability TuiHints { get; } = new("tui-hints"); /// Plan-mode handling and instructions. public static SessionCapability PlanMode { get; } = new("plan-mode"); /// Memory tool and memories prompt section. public static SessionCapability Memory { get; } = new("memory"); /// Copilot CLI documentation tool and prompt section. public static SessionCapability CliDocumentation { get; } = new("cli-documentation"); /// Interactive ask_user tool support. public static SessionCapability AskUser { get; } = new("ask-user"); /// Interactive CLI identity and behavior. public static SessionCapability InteractiveMode { get; } = new("interactive-mode"); /// Automatic hidden system notifications. public static SessionCapability SystemNotifications { get; } = new("system-notifications"); /// SDK elicitation support. public static SessionCapability Elicitation { get; } = new("elicitation"); /// Cross-session history tools and session-store SQL prompt/tool metadata. public static SessionCapability SessionStore { get; } = new("session-store"); /// MCP Apps UI passthrough. public static SessionCapability McpApps { get; } = new("mcp-apps"); /// Host-provided canvas rendering support. public static SessionCapability CanvasRenderer { get; } = new("canvas-renderer"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(SessionCapability left, SessionCapability right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(SessionCapability left, SessionCapability right) => !(left == right); /// public override bool Equals(object? obj) => obj is SessionCapability other && Equals(other); /// public bool Equals(SessionCapability 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 SessionCapability Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, SessionCapability value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(SessionCapability)); } } } /// Controls automatic non-interactive profile loading where supported. Explicit initScripts are unaffected. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct ShellInitProfile : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public ShellInitProfile(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Disable automatic non-interactive profile loading. Explicit initScripts still run. public static ShellInitProfile None { get; } = new("none"); /// Allow automatic non-interactive profile loading when supported. Explicit initScripts still run. public static ShellInitProfile NonInteractive { get; } = new("non-interactive"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(ShellInitProfile left, ShellInitProfile right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(ShellInitProfile left, ShellInitProfile right) => !(left == right); /// public override bool Equals(object? obj) => obj is ShellInitProfile other && Equals(other); /// public bool Equals(ShellInitProfile 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 ShellInitProfile Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, ShellInitProfile value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(ShellInitProfile)); } } } /// Supported built-in shells for initialization scripts. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct ShellInitScriptShell : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public ShellInitScriptShell(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Source the script in the built-in Bash shell on macOS and Linux. public static ShellInitScriptShell Bash { get; } = new("bash"); /// Source the script in the built-in PowerShell shell on Windows. public static ShellInitScriptShell Powershell { get; } = new("powershell"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(ShellInitScriptShell left, ShellInitScriptShell right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(ShellInitScriptShell left, ShellInitScriptShell right) => !(left == right); /// public override bool Equals(object? obj) => obj is ShellInitScriptShell other && Equals(other); /// public bool Equals(ShellInitScriptShell 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 ShellInitScriptShell Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, ShellInitScriptShell value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(ShellInitScriptShell)); } } } /// Controls how availableTools (allowlist) and excludedTools (denylist) combine when both are set. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct OptionsUpdateToolFilterPrecedence : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public OptionsUpdateToolFilterPrecedence(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// If availableTools is set, it is the only constraint that applies (excludedTools is ignored). Preserves CLI / pre-existing client behavior. Default. public static OptionsUpdateToolFilterPrecedence Available { get; } = new("available"); /// A tool is enabled if and only if it matches the allowlist (or the allowlist is unset) AND it does not match the denylist. Makes 'all except X' expressible by combining the two lists. public static OptionsUpdateToolFilterPrecedence Excluded { get; } = new("excluded"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(OptionsUpdateToolFilterPrecedence left, OptionsUpdateToolFilterPrecedence right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(OptionsUpdateToolFilterPrecedence left, OptionsUpdateToolFilterPrecedence right) => !(left == right); /// public override bool Equals(object? obj) => obj is OptionsUpdateToolFilterPrecedence other && Equals(other); /// public bool Equals(OptionsUpdateToolFilterPrecedence 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 OptionsUpdateToolFilterPrecedence Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, OptionsUpdateToolFilterPrecedence value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(OptionsUpdateToolFilterPrecedence)); } } } /// Discovery source: project (.github/extensions/), user (~/.copilot/extensions/), plugin (installed plugin), or session (session-state/<id>/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"); /// Extension contributed by an installed plugin. public static ExtensionSource Plugin { get; } = new("plugin"); /// Extension discovered from the current session's state directory (loaded only for this session). public static ExtensionSource Session { get; } = new("session"); /// 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)); } } } /// Type of GitHub reference. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct PushAttachmentGitHubReferenceType : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public PushAttachmentGitHubReferenceType(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// GitHub issue reference. public static PushAttachmentGitHubReferenceType Issue { get; } = new("issue"); /// GitHub pull request reference. public static PushAttachmentGitHubReferenceType Pr { get; } = new("pr"); /// GitHub discussion reference. public static PushAttachmentGitHubReferenceType Discussion { get; } = new("discussion"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(PushAttachmentGitHubReferenceType left, PushAttachmentGitHubReferenceType right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(PushAttachmentGitHubReferenceType left, PushAttachmentGitHubReferenceType right) => !(left == right); /// public override bool Equals(object? obj) => obj is PushAttachmentGitHubReferenceType other && Equals(other); /// public bool Equals(PushAttachmentGitHubReferenceType 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 PushAttachmentGitHubReferenceType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, PushAttachmentGitHubReferenceType value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(PushAttachmentGitHubReferenceType)); } } } /// Custom input-format kind. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct BuiltinToolFormatType : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public BuiltinToolFormatType(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// The tool input is parsed with the supplied grammar. public static BuiltinToolFormatType Grammar { get; } = new("grammar"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(BuiltinToolFormatType left, BuiltinToolFormatType right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(BuiltinToolFormatType left, BuiltinToolFormatType right) => !(left == right); /// public override bool Equals(object? obj) => obj is BuiltinToolFormatType other && Equals(other); /// public bool Equals(BuiltinToolFormatType 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 BuiltinToolFormatType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, BuiltinToolFormatType value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(BuiltinToolFormatType)); } } } /// Root JSON Schema type for a built-in tool input. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct BuiltinToolInputSchemaType : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public BuiltinToolInputSchemaType(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// The tool accepts a JSON object. public static BuiltinToolInputSchemaType Object { get; } = new("object"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(BuiltinToolInputSchemaType left, BuiltinToolInputSchemaType right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(BuiltinToolInputSchemaType left, BuiltinToolInputSchemaType right) => !(left == right); /// public override bool Equals(object? obj) => obj is BuiltinToolInputSchemaType other && Equals(other); /// public bool Equals(BuiltinToolInputSchemaType 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 BuiltinToolInputSchemaType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, BuiltinToolInputSchemaType value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(BuiltinToolInputSchemaType)); } } } /// Binary result type discriminator. Use "image" for images and "resource" for other binary data. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct ExternalToolTextResultForLlmBinaryResultsForLlmType : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public ExternalToolTextResultForLlmBinaryResultsForLlmType(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Binary image data. public static ExternalToolTextResultForLlmBinaryResultsForLlmType Image { get; } = new("image"); /// Other binary resource data. public static ExternalToolTextResultForLlmBinaryResultsForLlmType Resource { get; } = new("resource"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(ExternalToolTextResultForLlmBinaryResultsForLlmType left, ExternalToolTextResultForLlmBinaryResultsForLlmType right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(ExternalToolTextResultForLlmBinaryResultsForLlmType left, ExternalToolTextResultForLlmBinaryResultsForLlmType right) => !(left == right); /// public override bool Equals(object? obj) => obj is ExternalToolTextResultForLlmBinaryResultsForLlmType other && Equals(other); /// public bool Equals(ExternalToolTextResultForLlmBinaryResultsForLlmType 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 ExternalToolTextResultForLlmBinaryResultsForLlmType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, ExternalToolTextResultForLlmBinaryResultsForLlmType value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(ExternalToolTextResultForLlmBinaryResultsForLlmType)); } } } /// Theme variant this icon is intended for. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct ExternalToolTextResultForLlmContentResourceLinkIconTheme : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public ExternalToolTextResultForLlmContentResourceLinkIconTheme(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Icon intended for light themes. public static ExternalToolTextResultForLlmContentResourceLinkIconTheme Light { get; } = new("light"); /// Icon intended for dark themes. public static ExternalToolTextResultForLlmContentResourceLinkIconTheme Dark { get; } = new("dark"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(ExternalToolTextResultForLlmContentResourceLinkIconTheme left, ExternalToolTextResultForLlmContentResourceLinkIconTheme right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(ExternalToolTextResultForLlmContentResourceLinkIconTheme left, ExternalToolTextResultForLlmContentResourceLinkIconTheme right) => !(left == right); /// public override bool Equals(object? obj) => obj is ExternalToolTextResultForLlmContentResourceLinkIconTheme other && Equals(other); /// public bool Equals(ExternalToolTextResultForLlmContentResourceLinkIconTheme 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 ExternalToolTextResultForLlmContentResourceLinkIconTheme Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, ExternalToolTextResultForLlmContentResourceLinkIconTheme value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(ExternalToolTextResultForLlmContentResourceLinkIconTheme)); } } } /// Execution outcome classification. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct ToolResultType : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public ToolResultType(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// The tool completed successfully. public static ToolResultType Success { get; } = new("success"); /// The tool failed. public static ToolResultType Failure { get; } = new("failure"); /// The tool exceeded its execution timeout. public static ToolResultType Timeout { get; } = new("timeout"); /// The tool request was rejected before execution. public static ToolResultType Rejected { get; } = new("rejected"); /// Permission policy denied the tool request. public static ToolResultType Denied { get; } = new("denied"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(ToolResultType left, ToolResultType right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(ToolResultType left, ToolResultType right) => !(left == right); /// public override bool Equals(object? obj) => obj is ToolResultType other && Equals(other); /// public bool Equals(ToolResultType 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 ToolResultType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, ToolResultType value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(ToolResultType)); } } } /// Controls whether the runtime may defer loading an external tool definition. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct ProtocolExternalToolDefer : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public ProtocolExternalToolDefer(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// The runtime may defer the tool according to its tool-loading policy. public static ProtocolExternalToolDefer Auto { get; } = new("auto"); /// The runtime must include the tool without deferring it. public static ProtocolExternalToolDefer Never { get; } = new("never"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(ProtocolExternalToolDefer left, ProtocolExternalToolDefer right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(ProtocolExternalToolDefer left, ProtocolExternalToolDefer right) => !(left == right); /// public override bool Equals(object? obj) => obj is ProtocolExternalToolDefer other && Equals(other); /// public bool Equals(ProtocolExternalToolDefer 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 ProtocolExternalToolDefer Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, ProtocolExternalToolDefer value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(ProtocolExternalToolDefer)); } } } /// Context tier override for matching subagents. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct SubagentSettingsEntryContextTier : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public SubagentSettingsEntryContextTier(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Inherit the parent session's effective context tier at dispatch time. public static SubagentSettingsEntryContextTier Inherit { get; } = new("inherit"); /// Use the model's default context window. public static SubagentSettingsEntryContextTier Default { get; } = new("default"); /// Pin the subagent to the long-context tier when supported. public static SubagentSettingsEntryContextTier LongContext { get; } = new("long_context"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(SubagentSettingsEntryContextTier left, SubagentSettingsEntryContextTier right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(SubagentSettingsEntryContextTier left, SubagentSettingsEntryContextTier right) => !(left == right); /// public override bool Equals(object? obj) => obj is SubagentSettingsEntryContextTier other && Equals(other); /// public bool Equals(SubagentSettingsEntryContextTier 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 SubagentSettingsEntryContextTier Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, SubagentSettingsEntryContextTier value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(SubagentSettingsEntryContextTier)); } } } /// Defines the allowed values. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct CommandsInvocationOrigin : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public CommandsInvocationOrigin(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Gets the settings value. public static CommandsInvocationOrigin Settings { get; } = new("settings"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(CommandsInvocationOrigin left, CommandsInvocationOrigin right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(CommandsInvocationOrigin left, CommandsInvocationOrigin right) => !(left == right); /// public override bool Equals(object? obj) => obj is CommandsInvocationOrigin other && Equals(other); /// public bool Equals(CommandsInvocationOrigin 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 CommandsInvocationOrigin Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, CommandsInvocationOrigin value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(CommandsInvocationOrigin)); } } } /// Whether a pending slash-command invocation effect was applied or cancelled by the host. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct CommandsInvocationEffectOutcome : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public CommandsInvocationEffectOutcome(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// The host applied the pending invocation effect. public static CommandsInvocationEffectOutcome Applied { get; } = new("applied"); /// The host cancelled the pending invocation effect, so any provisional state must be reverted. public static CommandsInvocationEffectOutcome Cancelled { get; } = new("cancelled"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(CommandsInvocationEffectOutcome left, CommandsInvocationEffectOutcome right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(CommandsInvocationEffectOutcome left, CommandsInvocationEffectOutcome right) => !(left == right); /// public override bool Equals(object? obj) => obj is CommandsInvocationEffectOutcome other && Equals(other); /// public bool Equals(CommandsInvocationEffectOutcome 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 CommandsInvocationEffectOutcome Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, CommandsInvocationEffectOutcome value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(CommandsInvocationEffectOutcome)); } } } /// 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)); } } } /// Structured MCP elicitation mode. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct McpElicitationFormMode : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public McpElicitationFormMode(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Gets the form value. public static McpElicitationFormMode Form { get; } = new("form"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(McpElicitationFormMode left, McpElicitationFormMode right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(McpElicitationFormMode left, McpElicitationFormMode right) => !(left == right); /// public override bool Equals(object? obj) => obj is McpElicitationFormMode other && Equals(other); /// public bool Equals(McpElicitationFormMode 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 McpElicitationFormMode Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, McpElicitationFormMode value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(McpElicitationFormMode)); } } } /// 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)); } } } /// User action selected for an exhausted session limit. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct UISessionLimitsExhaustedResponseAction : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public UISessionLimitsExhaustedResponseAction(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Increase the current max by an exact AI Credits amount. public static UISessionLimitsExhaustedResponseAction Add { get; } = new("add"); /// Set a new absolute max AI Credits value. public static UISessionLimitsExhaustedResponseAction Set { get; } = new("set"); /// Remove the current session limit. public static UISessionLimitsExhaustedResponseAction Unset { get; } = new("unset"); /// Leave the limit unchanged and cancel the blocked model request. public static UISessionLimitsExhaustedResponseAction Cancel { get; } = new("cancel"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(UISessionLimitsExhaustedResponseAction left, UISessionLimitsExhaustedResponseAction right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(UISessionLimitsExhaustedResponseAction left, UISessionLimitsExhaustedResponseAction right) => !(left == right); /// public override bool Equals(object? obj) => obj is UISessionLimitsExhaustedResponseAction other && Equals(other); /// public bool Equals(UISessionLimitsExhaustedResponseAction 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 UISessionLimitsExhaustedResponseAction Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, UISessionLimitsExhaustedResponseAction value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(UISessionLimitsExhaustedResponseAction)); } } } /// 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 at startup by the `defaultPermissionMode` user setting. public static PermissionsSetApproveAllSource UserSetting { get; } = new("user_setting"); /// 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)); } } } /// Optional source for permission-mode telemetry. Defaults to `rpc` when omitted for SDK callers. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct PermissionModeSource : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public PermissionModeSource(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// The mode was set from a CLI command-line flag. public static PermissionModeSource CliFlag { get; } = new("cli_flag"); /// The mode was set by a slash command. public static PermissionModeSource SlashCommand { get; } = new("slash_command"); /// The mode was set by confirming autopilot behavior. public static PermissionModeSource AutopilotConfirmation { get; } = new("autopilot_confirmation"); /// The mode was set at startup by the `defaultPermissionMode` user setting. public static PermissionModeSource UserSetting { get; } = new("user_setting"); /// The mode was set through an RPC caller. public static PermissionModeSource Rpc { get; } = new("rpc"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(PermissionModeSource left, PermissionModeSource right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(PermissionModeSource left, PermissionModeSource right) => !(left == right); /// public override bool Equals(object? obj) => obj is PermissionModeSource other && Equals(other); /// public bool Equals(PermissionModeSource 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 PermissionModeSource Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, PermissionModeSource value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(PermissionModeSource)); } } } /// 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)); } } } /// Rust-owned settings predicates exposed across the SDK boundary. Raw feature-flag names are intentionally not part of the contract. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct SessionSettingsPredicateName : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public SessionSettingsPredicateName(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Whether the security-tools feature flag enables security tool wiring. public static SessionSettingsPredicateName SecurityToolsEnabled { get; } = new("securityToolsEnabled"); /// Whether third-party security tools should receive the security prompt. public static SessionSettingsPredicateName ThirdPartySecurityPromptEnabled { get; } = new("thirdPartySecurityPromptEnabled"); /// Whether validation may run in parallel. public static SessionSettingsPredicateName ParallelValidationEnabled { get; } = new("parallelValidationEnabled"); /// Whether runtime timing telemetry is enabled. public static SessionSettingsPredicateName RuntimeTimingTelemetryEnabled { get; } = new("runtimeTimingTelemetryEnabled"); /// Whether the co-author hook is enabled. public static SessionSettingsPredicateName CoAuthorHookEnabled { get; } = new("coAuthorHookEnabled"); /// Whether Chronicle integration is enabled. public static SessionSettingsPredicateName ChronicleEnabled { get; } = new("chronicleEnabled"); /// Whether content-exclusion policy may self-fetch data. public static SessionSettingsPredicateName ContentExclusionSelfFetchEnabled { get; } = new("contentExclusionSelfFetchEnabled"); /// Whether Claude Opus token-limit caps should be applied. public static SessionSettingsPredicateName CapClaudeOpusTokenLimitsEnabled { get; } = new("capClaudeOpusTokenLimitsEnabled"); /// Whether code-review behavior is enabled. public static SessionSettingsPredicateName CodeReviewFeatureEnabled { get; } = new("codeReviewFeatureEnabled"); /// Whether CCA should use the TypeScript autofind behavior. public static SessionSettingsPredicateName CcaUseTsAutofindEnabled { get; } = new("ccaUseTsAutofindEnabled"); /// Whether the dependency checker is enabled. public static SessionSettingsPredicateName DependencyCheckerEnabled { get; } = new("dependencyCheckerEnabled"); /// Whether the Dependabot checker is enabled. public static SessionSettingsPredicateName DependabotCheckerEnabled { get; } = new("dependabotCheckerEnabled"); /// Whether the CodeQL checker is enabled. public static SessionSettingsPredicateName CodeqlCheckerEnabled { get; } = new("codeqlCheckerEnabled"); /// Whether trivial-change handling is enabled. public static SessionSettingsPredicateName TrivialChangeEnabled { get; } = new("trivialChangeEnabled"); /// Whether trivial-change skip behavior is enabled. public static SessionSettingsPredicateName TrivialChangeSkipEnabled { get; } = new("trivialChangeSkipEnabled"); /// Whether trivial-change handling is enabled for code review. public static SessionSettingsPredicateName TrivialChangeEnabledForCodeReview { get; } = new("trivialChangeEnabledForCodeReview"); /// Whether trivial-change skip behavior is enabled for code review. public static SessionSettingsPredicateName TrivialChangeSkipEnabledForCodeReview { get; } = new("trivialChangeSkipEnabledForCodeReview"); /// Whether trivial-change handling is enabled for a specific tool. public static SessionSettingsPredicateName TrivialChangeEnabledForTool { get; } = new("trivialChangeEnabledForTool"); /// Whether trivial-change skip behavior is enabled for a specific tool. public static SessionSettingsPredicateName TrivialChangeSkipEnabledForTool { get; } = new("trivialChangeSkipEnabledForTool"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(SessionSettingsPredicateName left, SessionSettingsPredicateName right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(SessionSettingsPredicateName left, SessionSettingsPredicateName right) => !(left == right); /// public override bool Equals(object? obj) => obj is SessionSettingsPredicateName other && Equals(other); /// public bool Equals(SessionSettingsPredicateName 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 SessionSettingsPredicateName Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, SessionSettingsPredicateName value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(SessionSettingsPredicateName)); } } } /// 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)); } } } /// What initiated this compaction request, recorded as the `trigger` on the persisted `session.compaction_start` / `session.compaction_complete` events. When absent, the compaction is persisted without trigger attribution (initiator unknown). [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct SessionHistoryCompactRequestTrigger : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public SessionHistoryCompactRequestTrigger(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// User-requested compaction, e.g. the /compact command or a direct history.compact call. public static SessionHistoryCompactRequestTrigger Manual { get; } = new("manual"); /// Compaction requested while switching to a model with a smaller context window. public static SessionHistoryCompactRequestTrigger ModelSwitch { get; } = new("model_switch"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(SessionHistoryCompactRequestTrigger left, SessionHistoryCompactRequestTrigger right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(SessionHistoryCompactRequestTrigger left, SessionHistoryCompactRequestTrigger right) => !(left == right); /// public override bool Equals(object? obj) => obj is SessionHistoryCompactRequestTrigger other && Equals(other); /// public bool Equals(SessionHistoryCompactRequestTrigger 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 SessionHistoryCompactRequestTrigger Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, SessionHistoryCompactRequestTrigger value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(SessionHistoryCompactRequestTrigger)); } } } /// Aggregate file change represented by a rewind preview. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct HistoryRewindChangeType : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public HistoryRewindChangeType(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// The discarded turns created the file. public static HistoryRewindChangeType Created { get; } = new("created"); /// The discarded turns deleted the file. public static HistoryRewindChangeType Deleted { get; } = new("deleted"); /// The discarded turns modified the file. public static HistoryRewindChangeType Modified { get; } = new("modified"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(HistoryRewindChangeType left, HistoryRewindChangeType right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(HistoryRewindChangeType left, HistoryRewindChangeType right) => !(left == right); /// public override bool Equals(object? obj) => obj is HistoryRewindChangeType other && Equals(other); /// public bool Equals(HistoryRewindChangeType 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 HistoryRewindChangeType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, HistoryRewindChangeType value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(HistoryRewindChangeType)); } } } /// Outcome of a rewind request. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct HistoryRewindOutcome : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public HistoryRewindOutcome(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// The requested rewind completed; reachable in either mode. public static HistoryRewindOutcome Success { get; } = new("success"); /// The session still has work that may mutate files or history; reachable in either mode. public static HistoryRewindOutcome SessionBusy { get; } = new("session-busy"); /// A conversation-and-files rewind was requested for a session that did not enable capture; conversation-only rewinds never produce this. public static HistoryRewindOutcome FileChangeTrackingDisabled { get; } = new("file-change-tracking-disabled"); /// Remote-backed rewind routing is not supported; reachable in either mode. public static HistoryRewindOutcome UnsupportedRemoteSession { get; } = new("unsupported-remote-session"); /// File restore failed and all applied file changes were rolled back; only conversation-and-files rewinds produce this. public static HistoryRewindOutcome FilesRolledBack { get; } = new("files-rolled-back"); /// File restore failed and its rollback could not fully restore the pre-rewind state; only conversation-and-files rewinds produce this. public static HistoryRewindOutcome RollbackIncomplete { get; } = new("rollback-incomplete"); /// Conversation truncation failed. In conversation-and-files mode any files that were restored are left in place because conversation history cannot be un-truncated; in conversation-only mode no files are restored. Consult restoredFiles for what, if anything, was applied. public static HistoryRewindOutcome TruncationFailed { get; } = new("truncation-failed"); /// The conversation was rewound (and, in conversation-and-files mode, captured files were restored), but persisted checkpoints could not be cleaned up; reachable in either mode. public static HistoryRewindOutcome CheckpointCleanupFailed { get; } = new("checkpoint-cleanup-failed"); /// Files and conversation were rewound, but obsolete file snapshots could not be removed; only conversation-and-files rewinds produce this. public static HistoryRewindOutcome SnapshotPruneFailed { get; } = new("snapshot-prune-failed"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(HistoryRewindOutcome left, HistoryRewindOutcome right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(HistoryRewindOutcome left, HistoryRewindOutcome right) => !(left == right); /// public override bool Equals(object? obj) => obj is HistoryRewindOutcome other && Equals(other); /// public bool Equals(HistoryRewindOutcome 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 HistoryRewindOutcome Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, HistoryRewindOutcome value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(HistoryRewindOutcome)); } } } /// Reason a captured file was not restored. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct HistoryFileRestoreSkipReason : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public HistoryFileRestoreSkipReason(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// The file changed after Copilot's last captured write. public static HistoryFileRestoreSkipReason UserModified { get; } = new("user-modified"); /// A faithful preimage was not captured. public static HistoryFileRestoreSkipReason SkippedCapture { get; } = new("skipped-capture"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(HistoryFileRestoreSkipReason left, HistoryFileRestoreSkipReason right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(HistoryFileRestoreSkipReason left, HistoryFileRestoreSkipReason right) => !(left == right); /// public override bool Equals(object? obj) => obj is HistoryFileRestoreSkipReason other && Equals(other); /// public bool Equals(HistoryFileRestoreSkipReason 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 HistoryFileRestoreSkipReason Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, HistoryFileRestoreSkipReason value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(HistoryFileRestoreSkipReason)); } } } /// Scope of a rewind operation. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct HistoryRewindMode : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public HistoryRewindMode(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Discard conversation events while leaving files unchanged. public static HistoryRewindMode Conversation { get; } = new("conversation"); /// Discard conversation events and restore captured files changed by those turns. public static HistoryRewindMode ConversationAndFiles { get; } = new("conversation-and-files"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(HistoryRewindMode left, HistoryRewindMode right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(HistoryRewindMode left, HistoryRewindMode right) => !(left == right); /// public override bool Equals(object? obj) => obj is HistoryRewindMode other && Equals(other); /// public bool Equals(HistoryRewindMode 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 HistoryRewindMode Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, HistoryRewindMode value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(HistoryRewindMode)); } } } /// 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)); } } } /// 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)); } } } /// Client population used for the prediction baseline. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct SessionLimitPredictionClientType : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public SessionLimitPredictionClientType(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Interactive CLI sessions where a user can accept, edit, or top up the limit. public static SessionLimitPredictionClientType CliInteractive { get; } = new("cli-interactive"); /// Prompt/non-interactive CLI sessions where the initial limit must cover more of the run. public static SessionLimitPredictionClientType CliPrompt { get; } = new("cli-prompt"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(SessionLimitPredictionClientType left, SessionLimitPredictionClientType right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(SessionLimitPredictionClientType left, SessionLimitPredictionClientType right) => !(left == right); /// public override bool Equals(object? obj) => obj is SessionLimitPredictionClientType other && Equals(other); /// public bool Equals(SessionLimitPredictionClientType 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 SessionLimitPredictionClientType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, SessionLimitPredictionClientType value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(SessionLimitPredictionClientType)); } } } /// Semantic usage tier used for a recommended cap or additional headroom. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct SessionLimitPredictionTier : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public SessionLimitPredictionTier(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Recommended starting tier. public static SessionLimitPredictionTier Recommended { get; } = new("recommended"); /// Additional headroom for longer-running sessions. public static SessionLimitPredictionTier AdditionalHeadroom { get; } = new("additional_headroom"); /// Generous headroom for unusually high usage. public static SessionLimitPredictionTier GenerousHeadroom { get; } = new("generous_headroom"); /// Maximum available headroom tier. public static SessionLimitPredictionTier MaximumHeadroom { get; } = new("maximum_headroom"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(SessionLimitPredictionTier left, SessionLimitPredictionTier right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(SessionLimitPredictionTier left, SessionLimitPredictionTier right) => !(left == right); /// public override bool Equals(object? obj) => obj is SessionLimitPredictionTier other && Equals(other); /// public bool Equals(SessionLimitPredictionTier 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 SessionLimitPredictionTier Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, SessionLimitPredictionTier value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(SessionLimitPredictionTier)); } } } /// Baseline fallback level used to create the prediction. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct SessionLimitPredictionSource : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public SessionLimitPredictionSource(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// The prediction used the exact resolved model's baseline cell. public static SessionLimitPredictionSource Model { get; } = new("model"); /// The exact model was unavailable, so the prediction used the model family's baseline cell. public static SessionLimitPredictionSource Family { get; } = new("family"); /// No model or family cell was available, so the prediction used the global client-type baseline cell. public static SessionLimitPredictionSource Global { get; } = new("global"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(SessionLimitPredictionSource left, SessionLimitPredictionSource right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(SessionLimitPredictionSource left, SessionLimitPredictionSource right) => !(left == right); /// public override bool Equals(object? obj) => obj is SessionLimitPredictionSource other && Equals(other); /// public bool Equals(SessionLimitPredictionSource 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 SessionLimitPredictionSource Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, SessionLimitPredictionSource value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(SessionLimitPredictionSource)); } } } /// Reason a prediction could not be computed. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct SessionLimitPredictionUnavailableReason : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public SessionLimitPredictionUnavailableReason(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// The current model is auto and has not resolved to a concrete model yet. public static SessionLimitPredictionUnavailableReason AutoUnresolved { get; } = new("auto_unresolved"); /// No model was provided and the session does not currently have a selected model. public static SessionLimitPredictionUnavailableReason NoModel { get; } = new("no_model"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(SessionLimitPredictionUnavailableReason left, SessionLimitPredictionUnavailableReason right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(SessionLimitPredictionUnavailableReason left, SessionLimitPredictionUnavailableReason right) => !(left == right); /// public override bool Equals(object? obj) => obj is SessionLimitPredictionUnavailableReason other && Equals(other); /// public bool Equals(SessionLimitPredictionUnavailableReason 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 SessionLimitPredictionUnavailableReason Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, SessionLimitPredictionUnavailableReason value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(SessionLimitPredictionUnavailableReason)); } } } /// 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)); } } } /// Sharing status for a synced session. "repo" makes the session visible to anyone with read access to the repository; "unshared" restricts it to the creator and collaborators. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct SessionVisibilityStatus : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public SessionVisibilityStatus(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// The session is visible to repository readers. public static SessionVisibilityStatus Repo { get; } = new("repo"); /// The session is restricted to its creator and collaborators. public static SessionVisibilityStatus Unshared { get; } = new("unshared"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(SessionVisibilityStatus left, SessionVisibilityStatus right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(SessionVisibilityStatus left, SessionVisibilityStatus right) => !(left == right); /// public override bool Equals(object? obj) => obj is SessionVisibilityStatus other && Equals(other); /// public bool Equals(SessionVisibilityStatus 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 SessionVisibilityStatus Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, SessionVisibilityStatus value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(SessionVisibilityStatus)); } } } /// Why the runtime requests client-task cancellation. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct ClientTaskCancelReason : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public ClientTaskCancelReason(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// A caller requested task cancellation. public static ClientTaskCancelReason CancelRequested { get; } = new("cancel_requested"); /// The session is shutting down. public static ClientTaskCancelReason SessionShutdown { get; } = new("session_shutdown"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(ClientTaskCancelReason left, ClientTaskCancelReason right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(ClientTaskCancelReason left, ClientTaskCancelReason right) => !(left == right); /// public override bool Equals(object? obj) => obj is ClientTaskCancelReason other && Equals(other); /// public bool Equals(ClientTaskCancelReason 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 ClientTaskCancelReason Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, ClientTaskCancelReason value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(ClientTaskCancelReason)); } } } /// Error classification. [Experimental(Diagnostics.Experimental)] [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. [Experimental(Diagnostics.Experimental)] [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). [Experimental(Diagnostics.Experimental)] [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)); } } } /// SQLite transaction failure classification. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct SessionFsSqliteTransactionErrorClass : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public SessionFsSqliteTransactionErrorClass(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// SQLite reported BUSY or LOCKED before commit; the transaction was rolled back and may be retried. public static SessionFsSqliteTransactionErrorClass BusyOrLocked { get; } = new("busyOrLocked"); /// The statement, database, or provider failed definitively and must not be retried automatically. public static SessionFsSqliteTransactionErrorClass Fatal { get; } = new("fatal"); /// The transport failed after the provider may have committed; retrying could duplicate effects. public static SessionFsSqliteTransactionErrorClass PostCommitAmbiguous { get; } = new("postCommitAmbiguous"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(SessionFsSqliteTransactionErrorClass left, SessionFsSqliteTransactionErrorClass right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(SessionFsSqliteTransactionErrorClass left, SessionFsSqliteTransactionErrorClass right) => !(left == right); /// public override bool Equals(object? obj) => obj is SessionFsSqliteTransactionErrorClass other && Equals(other); /// public bool Equals(SessionFsSqliteTransactionErrorClass 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 SessionFsSqliteTransactionErrorClass Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, SessionFsSqliteTransactionErrorClass value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(SessionFsSqliteTransactionErrorClass)); } } } /// Transport the runtime would otherwise use for this request. `http` (the default when absent) covers plain HTTP and SSE responses; `websocket` indicates a full-duplex message channel where each body chunk maps to one WebSocket message and the `binary` flag distinguishes text from binary frames. The SDK consumer uses this to decide whether to service the request with an HTTP client or a WebSocket client. It is the one piece of request metadata the consumer cannot reliably infer from the URL or headers alone. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct LlmInferenceHttpRequestStartTransport : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public LlmInferenceHttpRequestStartTransport(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Plain HTTP or SSE response. Each body chunk is an opaque byte range; the response is a status line, headers, and a (possibly streamed) body. public static LlmInferenceHttpRequestStartTransport Http { get; } = new("http"); /// Full-duplex WebSocket channel. Each body chunk maps to exactly one WebSocket message and the `binary` flag distinguishes text from binary frames; request and response chunks flow concurrently. public static LlmInferenceHttpRequestStartTransport Websocket { get; } = new("websocket"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(LlmInferenceHttpRequestStartTransport left, LlmInferenceHttpRequestStartTransport right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(LlmInferenceHttpRequestStartTransport left, LlmInferenceHttpRequestStartTransport right) => !(left == right); /// public override bool Equals(object? obj) => obj is LlmInferenceHttpRequestStartTransport other && Equals(other); /// public bool Equals(LlmInferenceHttpRequestStartTransport 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 LlmInferenceHttpRequestStartTransport Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, LlmInferenceHttpRequestStartTransport value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(LlmInferenceHttpRequestStartTransport)); } } } /// Why the runtime is requesting a GitHub credential. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct GitHubTokenAcquireReason : IEquatable { private readonly string? _value; /// Initializes a new instance of the struct. /// The value to associate with this . [JsonConstructor] public GitHubTokenAcquireReason(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// The runtime is acquiring the registration's first credential. public static GitHubTokenAcquireReason Initial { get; } = new("initial"); /// The runtime is replacing a credential that is approaching expiry. public static GitHubTokenAcquireReason Refresh { get; } = new("refresh"); /// Returns a value indicating whether two instances are equivalent. public static bool operator ==(GitHubTokenAcquireReason left, GitHubTokenAcquireReason right) => left.Equals(right); /// Returns a value indicating whether two instances are not equivalent. public static bool operator !=(GitHubTokenAcquireReason left, GitHubTokenAcquireReason right) => !(left == right); /// public override bool Equals(object? obj) => obj is GitHubTokenAcquireReason other && Equals(other); /// public bool Equals(GitHubTokenAcquireReason 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 GitHubTokenAcquireReason Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// public override void Write(Utf8JsonWriter writer, GitHubTokenAcquireReason value, JsonSerializerOptions options) { GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(GitHubTokenAcquireReason)); } } } /// 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. [Experimental(Diagnostics.Experimental)] 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. Marked internal because this is JSON-RPC transport plumbing invoked automatically by an SDK client's own `connect()` wrapper, not a user-facing method. Stays internal as long as the SDK client owns the handshake; would only become public if the SDK ever exposed the raw schema surface to consumers without a connection wrapper. /// Opt this connection in to GitHub telemetry forwarding for its lifetime. When set, the runtime forwards every internal telemetry event it emits — across all sessions, plus sessionless events — to this connection over the `gitHubTelemetry.event` notification. Regular events are also written to the runtime's normal GitHub/CTS path (dual-write); host-only compatibility events are forward-only and intentionally skip that path. Intended for first-party hosts that re-emit the events into their own telemetry stores. Both unrestricted and restricted events are forwarded, each tagged with a `restricted` discriminator; a backstop drops restricted events when restricted telemetry is disabled — using the process-global gate for ordinary events and an explicit session-scoped decision for host-only events. /// Identity of the integrating host. Optional; omit it to keep the default attribution. /// Task kinds this connection can decode when observing session tasks. Omit to retain agent and shell compatibility. /// 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. [Experimental(Diagnostics.Experimental)] internal async Task ConnectAsync(bool? enableGitHubTelemetryForwarding = null, ConnectClientInfo? clientInfo = null, IList? supportedTaskKinds = null, string? token = null, CancellationToken cancellationToken = default) { var request = new ConnectRequest { EnableGitHubTelemetryForwarding = enableGitHubTelemetryForwarding, ClientInfo = clientInfo, SupportedTaskKinds = supportedTaskKinds, Token = token }; return await CopilotClient.InvokeRpcAsync(_rpc, "connect", [request], cancellationToken); } /// Registers the calling SDK client as the per-entrypoint extension launch provider. Call before creating any sessions. When omitted, the runtime uses its built-in extension launcher. /// The to monitor for cancellation requests. The default is . [Experimental(Diagnostics.Experimental)] public async Task RegisterExtensionLaunchProviderAsync(CancellationToken cancellationToken = default) { await CopilotClient.InvokeRpcAsync(_rpc, "registerExtensionLaunchProvider", [], cancellationToken); } /// Hooks APIs. public ServerHooksApi Hooks => field ?? Interlocked.CompareExchange(ref field, new(_rpc), null) ?? field; /// 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; /// Extensions APIs. public ServerExtensionsApi Extensions => field ?? Interlocked.CompareExchange(ref field, new(_rpc), null) ?? field; /// Catalog APIs. public ServerCatalogApi Catalog => field ?? Interlocked.CompareExchange(ref field, new(_rpc), null) ?? field; /// Plugins APIs. public ServerPluginsApi Plugins => field ?? Interlocked.CompareExchange(ref field, new(_rpc), null) ?? field; /// Skills APIs. public ServerSkillsApi Skills => field ?? Interlocked.CompareExchange(ref field, new(_rpc), null) ?? field; /// Agents APIs. public ServerAgentsApi Agents => field ?? Interlocked.CompareExchange(ref field, new(_rpc), null) ?? field; /// Instructions APIs. public ServerInstructionsApi Instructions => field ?? Interlocked.CompareExchange(ref field, new(_rpc), null) ?? field; /// Commands APIs. public ServerCommandsApi Commands => field ?? Interlocked.CompareExchange(ref field, new(_rpc), null) ?? field; /// User APIs. public ServerUserApi User => field ?? Interlocked.CompareExchange(ref field, new(_rpc), null) ?? field; /// ManagedSettings APIs. public ServerManagedSettingsApi ManagedSettings => field ?? Interlocked.CompareExchange(ref field, new(_rpc), null) ?? field; /// Runtime APIs. public ServerRuntimeApi Runtime => field ?? Interlocked.CompareExchange(ref field, new(_rpc), null) ?? field; /// SessionFs APIs. public ServerSessionFsApi SessionFs => field ?? Interlocked.CompareExchange(ref field, new(_rpc), null) ?? field; /// LlmInference APIs. public ServerLlmInferenceApi LlmInference => field ?? Interlocked.CompareExchange(ref field, new(_rpc), null) ?? field; /// Sessions APIs. public ServerSessionsApi Sessions => field ?? Interlocked.CompareExchange(ref field, new(_rpc), null) ?? field; /// AgentRegistry APIs. public ServerAgentRegistryApi AgentRegistry => field ?? Interlocked.CompareExchange(ref field, new(_rpc), null) ?? field; } /// Provides server-scoped Hooks APIs. [Experimental(Diagnostics.Experimental)] public sealed class ServerHooksApi { private readonly JsonRpc _rpc; internal ServerHooksApi(JsonRpc rpc) { _rpc = rpc; } /// Discovers hook actions enabled under server-side discovery settings from user, repository, plugin, and managed-policy sources. /// Optional project directory paths whose trusted repository and project-expanded plugin hooks should be discovered. When omitted or empty, user, managed-policy, and globally enabled installed or explicit plugin hooks are returned without project expansion. /// When true, omit host-owned user and plugin hook rows and their diagnostics. Managed-policy hooks and trusted repository hooks remain visible, and host disabledHooks still contribute to each remaining row's effective enabled state. This filters sources rather than simulating a host with no settings. /// The to monitor for cancellation requests. The default is . /// Server-discovered hook actions and partial-load diagnostics from user, repository, plugin, and managed-policy sources. Concrete sessions may include additional session-specific hook sources. public async Task DiscoverAsync(IList? projectPaths = null, bool? excludeHostHooks = null, CancellationToken cancellationToken = default) { var request = new HooksDiscoverRequest { ProjectPaths = projectPaths, ExcludeHostHooks = excludeHostHooks }; return await CopilotClient.InvokeRpcAsync(_rpc, "hooks.discover", [request], cancellationToken); } } /// Provides server-scoped Models APIs. [Experimental(Diagnostics.Experimental)] public sealed class ServerModelsApi { private readonly JsonRpc _rpc; internal ServerModelsApi(JsonRpc rpc) { _rpc = rpc; } /// Lists Copilot models available to the authenticated user. /// Opaque account identifier returned by `account.getAllUsers`. When omitted, the current account is used. /// GitHub token accepted for compatibility with existing SDK clients. When provided, resolves this token instead of using the current account. /// 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? selectionId = null, string? gitHubToken = null, CancellationToken cancellationToken = default) { var request = new ModelsListRequest { SelectionId = selectionId, GitHubToken = gitHubToken }; return await CopilotClient.InvokeRpcAsync(_rpc, "models.list", [request], cancellationToken); } /// Returns the running runtime's complete catalog of well-known built-in model IDs without authentication or network access. /// The to monitor for cancellation requests. The default is . /// The running runtime's complete catalog of well-known built-in model IDs, including supported models and additional IDs with built-in metadata. public async Task GetBuiltInCatalogAsync(CancellationToken cancellationToken = default) { return await CopilotClient.InvokeRpcAsync(_rpc, "models.getBuiltInCatalog", [], cancellationToken); } } /// Provides server-scoped Tools APIs. [Experimental(Diagnostics.Experimental)] 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. [Experimental(Diagnostics.Experimental)] public sealed class ServerAccountApi { private readonly JsonRpc _rpc; internal ServerAccountApi(JsonRpc rpc) { _rpc = rpc; } /// Gets Copilot quota usage for the current or opaquely selected authenticated user. /// Opaque account identifier returned by `account.getAllUsers`. When omitted, the current account is used. /// GitHub token accepted for compatibility with existing SDK clients. When provided, resolves this token instead of using the current account. /// 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? selectionId = null, string? gitHubToken = null, CancellationToken cancellationToken = default) { var request = new AccountGetQuotaRequest { SelectionId = selectionId, GitHubToken = gitHubToken }; return await CopilotClient.InvokeRpcAsync(_rpc, "account.getQuota", [request], cancellationToken); } /// Gets the currently active authentication credentials from the global auth manager. /// The to monitor for cancellation requests. The default is . /// Current authentication state. public async Task GetCurrentAuthAsync(CancellationToken cancellationToken = default) { return await CopilotClient.InvokeRpcAsync(_rpc, "account.getCurrentAuth", [], cancellationToken); } /// Gets all authenticated users available for account switching. /// The to monitor for cancellation requests. The default is . /// List of all authenticated users. public async Task> GetAllUsersAsync(CancellationToken cancellationToken = default) { return await CopilotClient.InvokeRpcAsync>(_rpc, "account.getAllUsers", [], cancellationToken); } /// Validates and stores authentication credentials. When login is omitted, resolves the authenticated user from the token before persistence. /// GitHub host URL. /// GitHub authentication token. /// User login/username. When omitted, the runtime validates the token and resolves the login from GitHub. /// The to monitor for cancellation requests. The default is . /// Result of a successful login; throws on failure. public async Task LoginAsync(string host, string token, string? login = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(host); ArgumentNullException.ThrowIfNull(token); var request = new AccountLoginRequest { Host = host, Token = token, Login = login }; return await CopilotClient.InvokeRpcAsync(_rpc, "account.login", [request], cancellationToken); } /// Removes user authentication from keychain and persisted state. /// Opaque account identifier returned by `account.getAllUsers`. /// Authentication information for the user to log out. /// The to monitor for cancellation requests. The default is . /// Logout result indicating if more users remain. public async Task LogoutAsync(string? selectionId = null, AuthInfo? authInfo = null, CancellationToken cancellationToken = default) { var request = new AccountLogoutRequest { SelectionId = selectionId, AuthInfo = authInfo }; return await CopilotClient.InvokeRpcAsync(_rpc, "account.logout", [request], cancellationToken); } } /// Provides server-scoped Secrets APIs. [Experimental(Diagnostics.Experimental)] 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. [Experimental(Diagnostics.Experimental)] 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). /// Whether to include canonical effectiveSource metadata for each discovered server. Callers must opt in so protocol-3 clients retain the legacy closed response shape. /// 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, bool? includeEffectiveSource = null, CancellationToken cancellationToken = default) { var request = new McpDiscoverRequest { WorkingDirectory = workingDirectory, IncludeEffectiveSource = includeEffectiveSource }; return await CopilotClient.InvokeRpcAsync(_rpc, "mcp.discover", [request], cancellationToken); } /// Requests a side-effect-free MCP install plan from a catalog candidate handle or a caller-supplied card. This host-implemented server method is available through SDK/TUI hosts; standalone and C-ABI runtimes whose host does not implement server-method dispatch return JSON-RPC MethodNotFound. A runtime with planning available returns a normalised plan and opaque single-use plan handle; a runtime without it returns the typed planning-unavailable result. A completed plan reports resource identity, provenance, eligible transport choices, the user-scope target, required typed values and secret placeholders, the policy result, the configuration changes installing would make, and whether a reload would be needed. Planning never writes configuration, stores a secret, or reloads MCP servers, so abandoning a plan needs no call and leaves nothing behind. /// Protocol version and capabilities the caller requires. /// What to plan: either a candidate handle from a previous search, or a card supplied directly. /// Configuration scope the plan targets. Defaults to user scope when omitted. /// The to monitor for cancellation requests. The default is . /// Outcome of an mcp.planInstall call: either a normalised plan, or one typed refusal. Nothing is written in either case. public async Task PlanInstallAsync(CatalogClientContract contract, McpPlanInstallSource source, McpPlanScope? scope = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(contract); ArgumentNullException.ThrowIfNull(source); var request = new McpPlanInstallRequest { Contract = contract, Source = source, Scope = scope }; return await CopilotClient.InvokeRpcAsync(_rpc, "mcp.planInstall", [request], cancellationToken); } /// Config APIs. public ServerMcpConfigApi Config => field ?? Interlocked.CompareExchange(ref field, new(_rpc), null) ?? field; } /// Provides server-scoped McpConfig APIs. [Experimental(Diagnostics.Experimental)] 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. /// OAuth Client ID Metadata Document URL whose persisted credentials should also be removed. /// The to monitor for cancellation requests. The default is . public async Task RemoveAsync(string name, string? authClientIdMetadataUrl = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(name); var request = new McpConfigRemoveRequest { Name = name, AuthClientIdMetadataUrl = authClientIdMetadataUrl }; 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); } /// Drops this runtime process's in-memory MCP server-definition cache so the next MCP config read observes disk. /// The to monitor for cancellation requests. The default is . public async Task ReloadAsync(CancellationToken cancellationToken = default) { await CopilotClient.InvokeRpcAsync(_rpc, "mcp.config.reload", [], cancellationToken); } } /// Provides server-scoped Extensions APIs. [Experimental(Diagnostics.Experimental)] public sealed class ServerExtensionsApi { private readonly JsonRpc _rpc; internal ServerExtensionsApi(JsonRpc rpc) { _rpc = rpc; } /// Discovers user and enabled installed-plugin extensions from persisted Copilot home state, including enablement preferences. Launch-scoped additional plugins are not included. /// The to monitor for cancellation requests. The default is . /// Extensions discovered from persisted Copilot home state and their effective loading mode. Launch-scoped additional plugins are not included. public async Task DiscoverAsync(CancellationToken cancellationToken = default) { return await CopilotClient.InvokeRpcAsync(_rpc, "extensions.discover", [], cancellationToken); } /// Persistently enables extension IDs for future sessions. Active sessions are unchanged; use session.extensions.enable to update them. /// Source-qualified user or plugin extension IDs to enable. /// The to monitor for cancellation requests. The default is . public async Task EnableAsync(IList ids, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(ids); var request = new DiscoveredExtensionsEnableRequest { Ids = ids }; await CopilotClient.InvokeRpcAsync(_rpc, "extensions.enable", [request], cancellationToken); } /// Persistently disables extension IDs for future sessions. Active sessions are unchanged; use session.extensions.disable to update them. /// Source-qualified user or plugin extension IDs to disable. /// The to monitor for cancellation requests. The default is . public async Task DisableAsync(IList ids, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(ids); var request = new DiscoveredExtensionsDisableRequest { Ids = ids }; await CopilotClient.InvokeRpcAsync(_rpc, "extensions.disable", [request], cancellationToken); } } /// Provides server-scoped Catalog APIs. [Experimental(Diagnostics.Experimental)] public sealed class ServerCatalogApi { private readonly JsonRpc _rpc; internal ServerCatalogApi(JsonRpc rpc) { _rpc = rpc; } /// Requests a bounded catalog search. This host-implemented server method is available through SDK/TUI hosts; standalone and C-ABI runtimes whose host does not implement server-method dispatch return JSON-RPC MethodNotFound. A runtime with search available returns inert candidate summaries, each with an opaque single-use handle scoped to this runtime instance; a runtime without it returns the typed search-unavailable result. Public authorities may be searched anonymously, while an authority that requires credentials yields the typed authentication-required result. All returned text, URLs, and package metadata are untrusted external data and can never trigger instructions, tools, or installation. Read-only: nothing is installed, configured, or persisted. /// Protocol version and capabilities the caller requires. /// Free-text search query. Persisted as tool input for session continuity, but omitted from telemetry. /// Maximum number of candidates to return. Defaults to 10 when omitted. /// Restrict results to these candidate kinds. When omitted, every kind the runtime supports is searched. /// The to monitor for cancellation requests. The default is . /// Outcome of a catalog.search call: either bounded inert candidates, or one typed refusal. Never a partial success. public async Task SearchAsync(CatalogClientContract contract, string query, int? limit = null, IList? kinds = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(contract); ArgumentNullException.ThrowIfNull(query); var request = new CatalogSearchRequest { Contract = contract, Query = query, Limit = limit, Kinds = kinds }; return await CopilotClient.InvokeRpcAsync(_rpc, "catalog.search", [request], cancellationToken); } } /// Provides server-scoped Plugins APIs. [Experimental(Diagnostics.Experimental)] public sealed class ServerPluginsApi { private readonly JsonRpc _rpc; internal ServerPluginsApi(JsonRpc rpc) { _rpc = rpc; } /// Lists plugins installed in user/global state. /// The to monitor for cancellation requests. The default is . /// Plugins installed in user/global state. public async Task ListAsync(CancellationToken cancellationToken = default) { return await CopilotClient.InvokeRpcAsync(_rpc, "plugins.list", [], cancellationToken); } /// Installs a plugin from a marketplace, GitHub repo, URL, or local path. /// Plugin install spec. Accepts the same forms as the CLI: "plugin@marketplace" (marketplace install), "owner/repo" or "owner/repo:subpath" (GitHub direct), an http/https/ssh URL, or a local path. Direct (non-marketplace) installs are deprecated and will produce a deprecationWarning in the result. /// Working directory used to resolve relative local paths in `source`. Defaults to the server's current working directory. /// The to monitor for cancellation requests. The default is . /// Result of installing a plugin. public async Task InstallAsync(string source, string? workingDirectory = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(source); var request = new PluginsInstallRequest { Source = source, WorkingDirectory = workingDirectory }; return await CopilotClient.InvokeRpcAsync(_rpc, "plugins.install", [request], cancellationToken); } /// Uninstalls an installed plugin. /// Plugin name or "plugin@marketplace" spec to uninstall. When ambiguous, prefer the fully-qualified spec. /// Stable source identity for a direct (non-marketplace) install. Disambiguates uninstall when multiple installed plugins share the same name. /// The to monitor for cancellation requests. The default is . public async Task UninstallAsync(string name, string? directSourceId = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(name); var request = new PluginsUninstallRequest { Name = name, DirectSourceId = directSourceId }; await CopilotClient.InvokeRpcAsync(_rpc, "plugins.uninstall", [request], cancellationToken); } /// Updates an installed plugin to its latest published version. /// Plugin name or "plugin@marketplace" spec to update. /// The to monitor for cancellation requests. The default is . /// Result of updating a single plugin. public async Task UpdateAsync(string name, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(name); var request = new PluginsUpdateRequest { Name = name }; return await CopilotClient.InvokeRpcAsync(_rpc, "plugins.update", [request], cancellationToken); } /// Updates every installed plugin to its latest published version. /// The to monitor for cancellation requests. The default is . /// Result of updating all installed plugins. public async Task UpdateAllAsync(CancellationToken cancellationToken = default) { return await CopilotClient.InvokeRpcAsync(_rpc, "plugins.updateAll", [], cancellationToken); } /// Enables installed plugins for new sessions. /// Plugin names or "plugin@marketplace" specs to enable. Unknown names are ignored. Non-marketplace direct installs are always enabled and cannot be toggled via this API. /// Working directory whose repository `enabledPlugins` overlay decides whether this mutation is repository-controlled. Hosts that serve sessions across several repositories (the SDK server) should pass the session's directory; otherwise the guard is evaluated against the server process's own working directory, which may belong to a different repository. Defaults to the server's current working directory. /// The to monitor for cancellation requests. The default is . public async Task EnableAsync(IList names, string? workingDirectory = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(names); var request = new PluginsEnableRequest { Names = names, WorkingDirectory = workingDirectory }; await CopilotClient.InvokeRpcAsync(_rpc, "plugins.enable", [request], cancellationToken); } /// Disables installed plugins for new sessions. /// Plugin names or "plugin@marketplace" specs to disable. Unknown names are ignored. Non-marketplace direct installs cannot be disabled via this API; uninstall them instead. Plugin-owned MCP servers are stopped in active sessions immediately; other plugin contributions remain available until each session reloads plugins. /// Working directory whose repository `enabledPlugins` overlay decides whether this mutation is repository-controlled. Hosts that serve sessions across several repositories (the SDK server) should pass the session's directory; otherwise the guard is evaluated against the server process's own working directory, which may belong to a different repository. Defaults to the server's current working directory. /// The to monitor for cancellation requests. The default is . public async Task DisableAsync(IList names, string? workingDirectory = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(names); var request = new PluginsDisableRequest { Names = names, WorkingDirectory = workingDirectory }; await CopilotClient.InvokeRpcAsync(_rpc, "plugins.disable", [request], cancellationToken); } /// Builtin APIs. public ServerPluginsBuiltinApi Builtin => field ?? Interlocked.CompareExchange(ref field, new(_rpc), null) ?? field; /// Marketplaces APIs. public ServerPluginsMarketplacesApi Marketplaces => field ?? Interlocked.CompareExchange(ref field, new(_rpc), null) ?? field; } /// Provides server-scoped PluginsBuiltin APIs. [Experimental(Diagnostics.Experimental)] public sealed class ServerPluginsBuiltinApi { private readonly JsonRpc _rpc; internal ServerPluginsBuiltinApi(JsonRpc rpc) { _rpc = rpc; } /// Replaces this server's trusted built-in plugin directories while no sessions are active. /// Complete replacement set of trusted built-in plugin directories. Every entry must be an absolute local filesystem path no longer than 4096 characters. /// The to monitor for cancellation requests. The default is . public async Task SetAsync(IList paths, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(paths); var request = new PluginsBuiltinSetRequest { Paths = paths }; await CopilotClient.InvokeRpcAsync(_rpc, "plugins.builtin.set", [request], cancellationToken); } } /// Provides server-scoped PluginsMarketplaces APIs. [Experimental(Diagnostics.Experimental)] public sealed class ServerPluginsMarketplacesApi { private readonly JsonRpc _rpc; internal ServerPluginsMarketplacesApi(JsonRpc rpc) { _rpc = rpc; } /// Lists all registered marketplaces (defaults + user-added). /// The to monitor for cancellation requests. The default is . /// All registered marketplaces, including built-in defaults. public async Task ListAsync(CancellationToken cancellationToken = default) { return await CopilotClient.InvokeRpcAsync(_rpc, "plugins.marketplaces.list", [], cancellationToken); } /// Registers a new marketplace from a source (owner/repo, URL, or local path). /// Marketplace source. Accepts the same forms as the CLI: "owner/repo" or "owner/repo#ref" (GitHub), an http/https/ssh URL (optionally with #ref), a git scp-style URL (user@host:path), or a local path. The marketplace's own name (from its manifest) is used as the registration key. /// Working directory used to resolve relative local paths in `source`. Defaults to the server's current working directory. /// The to monitor for cancellation requests. The default is . /// Result of registering a new marketplace. public async Task AddAsync(string source, string? workingDirectory = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(source); var request = new PluginsMarketplacesAddRequest { Source = source, WorkingDirectory = workingDirectory }; return await CopilotClient.InvokeRpcAsync(_rpc, "plugins.marketplaces.add", [request], cancellationToken); } /// Removes a previously-registered marketplace. When the marketplace has dependent plugins and `force` is not set, the marketplace is left intact and the result lists the dependents so the caller can decide whether to retry with `force=true`. /// Marketplace name to remove. /// When true, also uninstall every plugin sourced from this marketplace. When false (default), removal is a no-op if any plugin from this marketplace is installed and the dependent plugin names are returned in the result. /// The to monitor for cancellation requests. The default is . /// Outcome of the remove attempt, including dependent-plugin info when applicable. public async Task RemoveAsync(string name, bool? force = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(name); var request = new PluginsMarketplacesRemoveRequest { Name = name, Force = force }; return await CopilotClient.InvokeRpcAsync(_rpc, "plugins.marketplaces.remove", [request], cancellationToken); } /// Lists plugins advertised by a registered marketplace. /// Marketplace name to browse. /// The to monitor for cancellation requests. The default is . /// Plugins advertised by the marketplace. public async Task BrowseAsync(string name, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(name); var request = new PluginsMarketplacesBrowseRequest { Name = name }; return await CopilotClient.InvokeRpcAsync(_rpc, "plugins.marketplaces.browse", [request], cancellationToken); } /// Re-fetches one or all registered marketplace catalogs. /// Marketplace name to refresh. When omitted, every registered marketplace is refreshed. /// The to monitor for cancellation requests. The default is . /// Result of refreshing one or more marketplace catalogs. public async Task RefreshAsync(string? name = null, CancellationToken cancellationToken = default) { var request = new PluginsMarketplacesRefreshRequest { Name = name }; return await CopilotClient.InvokeRpcAsync(_rpc, "plugins.marketplaces.refresh", [request], cancellationToken); } } /// Provides server-scoped Skills APIs. [Experimental(Diagnostics.Experimental)] 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. /// When true, omit skills from the host's global sources (personal, custom, plugin, and built-in), returning only project-scoped skills. For multitenant deployments. /// 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, bool? excludeHostSkills = null, CancellationToken cancellationToken = default) { var request = new SkillsDiscoverRequest { ProjectPaths = projectPaths, SkillDirectories = skillDirectories, ExcludeHostSkills = excludeHostSkills }; return await CopilotClient.InvokeRpcAsync(_rpc, "skills.discover", [request], cancellationToken); } /// Returns the canonical directories where a client may create skills that the runtime will recognize, including ones that do not exist yet. Project directories become active once created. /// Optional list of project directory paths. When omitted or empty, only personal and custom directories are returned. /// When true, omit the host's personal and custom skill directories, leaving only project directories. For multitenant deployments. /// The to monitor for cancellation requests. The default is . /// Canonical locations where skills can be created so the runtime will recognize them. public async Task GetDiscoveryPathsAsync(IList? projectPaths = null, bool? excludeHostSkills = null, CancellationToken cancellationToken = default) { var request = new SkillsGetDiscoveryPathsRequest { ProjectPaths = projectPaths, ExcludeHostSkills = excludeHostSkills }; return await CopilotClient.InvokeRpcAsync(_rpc, "skills.getDiscoveryPaths", [request], cancellationToken); } /// Config APIs. public ServerSkillsConfigApi Config => field ?? Interlocked.CompareExchange(ref field, new(_rpc), null) ?? field; } /// Provides server-scoped SkillsConfig APIs. [Experimental(Diagnostics.Experimental)] 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); } /// Atomically adds or removes one skill from the disabled list. /// Name of the skill to add to or remove from the disabled list. /// True to disable the skill, false to enable it. /// The to monitor for cancellation requests. The default is . public async Task SetSkillDisabledAsync(string name, bool disabled, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(name); var request = new SkillsConfigSetSkillDisabledRequest { Name = name, Disabled = disabled }; await CopilotClient.InvokeRpcAsync(_rpc, "skills.config.setSkillDisabled", [request], cancellationToken); } } /// Provides server-scoped Agents APIs. [Experimental(Diagnostics.Experimental)] public sealed class ServerAgentsApi { private readonly JsonRpc _rpc; internal ServerAgentsApi(JsonRpc rpc) { _rpc = rpc; } /// Discovers custom agents across user, project, plugin, and remote sources. /// Optional list of project directory paths to scan for project-scoped agents. When omitted or empty, only user/plugin/remote-independent agents are returned (no project scan). /// When true, omit the host's agents (the user-level agent directory and all plugin agents), leaving only project and remote agents. For multitenant deployments. /// The to monitor for cancellation requests. The default is . /// Agents discovered across user, project, plugin, and remote sources. public async Task DiscoverAsync(IList? projectPaths = null, bool? excludeHostAgents = null, CancellationToken cancellationToken = default) { var request = new AgentsDiscoverRequest { ProjectPaths = projectPaths, ExcludeHostAgents = excludeHostAgents }; return await CopilotClient.InvokeRpcAsync(_rpc, "agents.discover", [request], cancellationToken); } /// Returns the canonical directories where a client may create custom agents that the runtime will recognize, including ones that do not exist yet. Project directories become active once created. /// Optional list of project directory paths. When omitted or empty, only the user-level directory is returned. /// When true, omit the host's user-level agent directory, leaving only project directories. For multitenant deployments (mirrors `discover`'s `excludeHostAgents`). /// The to monitor for cancellation requests. The default is . /// Canonical locations where custom agents can be created so the runtime will recognize them. public async Task GetDiscoveryPathsAsync(IList? projectPaths = null, bool? excludeHostAgents = null, CancellationToken cancellationToken = default) { var request = new AgentsGetDiscoveryPathsRequest { ProjectPaths = projectPaths, ExcludeHostAgents = excludeHostAgents }; return await CopilotClient.InvokeRpcAsync(_rpc, "agents.getDiscoveryPaths", [request], cancellationToken); } } /// Provides server-scoped Instructions APIs. [Experimental(Diagnostics.Experimental)] public sealed class ServerInstructionsApi { private readonly JsonRpc _rpc; internal ServerInstructionsApi(JsonRpc rpc) { _rpc = rpc; } /// Discovers instruction sources across user, repository, and plugin sources. /// Optional list of project directory paths to scan for repository/working-directory instruction sources. When omitted or empty, only user-level and plugin instruction sources are returned (no project scan). /// When true, omit the host's instruction sources (user/home-level files and plugin rules), leaving only repository and working-directory sources. For multitenant deployments. /// The to monitor for cancellation requests. The default is . /// Instruction sources discovered across user, repository, and plugin sources. public async Task DiscoverAsync(IList? projectPaths = null, bool? excludeHostInstructions = null, CancellationToken cancellationToken = default) { var request = new InstructionsDiscoverRequest { ProjectPaths = projectPaths, ExcludeHostInstructions = excludeHostInstructions }; return await CopilotClient.InvokeRpcAsync(_rpc, "instructions.discover", [request], cancellationToken); } /// Returns the canonical files and directories where a client may create custom instructions that the runtime will recognize, including ones that do not exist yet. Repository targets become active once created. /// Optional list of project directory paths. When omitted or empty, only the user-level targets are returned. /// When true, omit the host's user-level instruction targets, leaving only repository targets. For multitenant deployments (mirrors `discover`'s `excludeHostInstructions`). /// The to monitor for cancellation requests. The default is . /// Canonical files and directories where custom instructions can be created so the runtime will recognize them. public async Task GetDiscoveryPathsAsync(IList? projectPaths = null, bool? excludeHostInstructions = null, CancellationToken cancellationToken = default) { var request = new InstructionsGetDiscoveryPathsRequest { ProjectPaths = projectPaths, ExcludeHostInstructions = excludeHostInstructions }; return await CopilotClient.InvokeRpcAsync(_rpc, "instructions.getDiscoveryPaths", [request], cancellationToken); } } /// Provides server-scoped Commands APIs. [Experimental(Diagnostics.Experimental)] public sealed class ServerCommandsApi { private readonly JsonRpc _rpc; internal ServerCommandsApi(JsonRpc rpc) { _rpc = rpc; } /// Lists the well-known built-in slash commands that work as the first message in a new session (e.g. /plan, /env), without requiring an active session. Commands that depend on session state, authentication, or a synced session are omitted. /// 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(CancellationToken cancellationToken = default) { return await CopilotClient.InvokeRpcAsync(_rpc, "commands.list", [], cancellationToken); } } /// Provides server-scoped User APIs. [Experimental(Diagnostics.Experimental)] public sealed class ServerUserApi { private readonly JsonRpc _rpc; internal ServerUserApi(JsonRpc rpc) { _rpc = rpc; } /// Settings APIs. public ServerUserSettingsApi Settings => field ?? Interlocked.CompareExchange(ref field, new(_rpc), null) ?? field; } /// Provides server-scoped UserSettings APIs. [Experimental(Diagnostics.Experimental)] public sealed class ServerUserSettingsApi { private readonly JsonRpc _rpc; internal ServerUserSettingsApi(JsonRpc rpc) { _rpc = rpc; } /// Drops this runtime process's in-memory user settings cache so the next settings read observes disk. /// The to monitor for cancellation requests. The default is . public async Task ReloadAsync(CancellationToken cancellationToken = default) { await CopilotClient.InvokeRpcAsync(_rpc, "user.settings.reload", [], cancellationToken); } /// Lists every known user setting (settings.json overlaid with the legacy config.json, config.json wins), each with its effective value, its default, and whether it is at the default — so settings the user has never set still appear with their default value. Does not include repository- or enterprise-managed overrides that the runtime layers on top at session time. /// The to monitor for cancellation requests. The default is . /// Per-key metadata for every known user setting (settings.json overlaid with the legacy config.json, config.json wins), including settings left at their default. Excludes repository- and enterprise-managed overrides. public async Task GetAsync(CancellationToken cancellationToken = default) { return await CopilotClient.InvokeRpcAsync(_rpc, "user.settings.get", [], cancellationToken); } /// Writes one or more user settings to settings.json, replacing each provided top-level key. A key whose value is null is removed. Returns the keys whose new value is shadowed by a legacy config.json entry (config.json wins on read), which the runtime leaves in place — such writes do not take effect until the legacy value is removed. /// Partial user settings to write, as a free-form object keyed by setting name. /// The to monitor for cancellation requests. The default is . /// Outcome of writing user settings. public async Task SetAsync(object settings, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(settings); var request = new UserSettingsSetRequest { Settings = CopilotClient.ToJsonElementForWire(settings)!.Value }; return await CopilotClient.InvokeRpcAsync(_rpc, "user.settings.set", [request], cancellationToken); } } /// Provides server-scoped ManagedSettings APIs. [Experimental(Diagnostics.Experimental)] public sealed class ServerManagedSettingsApi { private readonly JsonRpc _rpc; internal ServerManagedSettingsApi(JsonRpc rpc) { _rpc = rpc; } /// Discovers device-managed settings from production MDM and managed-file sources, validates them against the runtime-owned managed-settings schema, and returns the canonical JSON without requiring a session. /// The to monitor for cancellation requests. The default is . /// Validated device-managed settings discovered before a session exists. public async Task ReadAsync(CancellationToken cancellationToken = default) { return await CopilotClient.InvokeRpcAsync(_rpc, "managedSettings.read", [], cancellationToken); } /// Force-refreshes enterprise managed settings for every account: wipes the persistent server-policy cache (the whole `<cacheHome>/managed-settings` directory) and drops this runtime process's in-memory retained server policy. It does not itself fetch policy — the effect is that the next time a session resolves managed settings for an account, that resolution re-fetches the account's org policy from the network instead of serving a cached response. Note that `managedSettings.read` returns only device/MDM settings and never triggers the account server-policy fetch, so a host implementing "sync account policy" should start a fresh session resolution rather than treat a subsequent `managedSettings.read` as the refreshed org policy. Mirrors the invalidation a sign-out performs, broadened from the one signing-out account to all of them; device/MDM layers describe the machine, not the account, and are left untouched. Rejects if the on-disk cache cannot be removed. /// The to monitor for cancellation requests. The default is . public async Task ClearCacheAsync(CancellationToken cancellationToken = default) { await CopilotClient.InvokeRpcAsync(_rpc, "managedSettings.clearCache", [], cancellationToken); } } /// Provides server-scoped Runtime APIs. [Experimental(Diagnostics.Experimental)] public sealed class ServerRuntimeApi { private readonly JsonRpc _rpc; internal ServerRuntimeApi(JsonRpc rpc) { _rpc = rpc; } /// Gracefully shuts down an SDK-owned runtime. The response is sent only after cleanup completes; callers may then terminate the owned runtime process. /// The to monitor for cancellation requests. The default is . public async Task ShutdownAsync(CancellationToken cancellationToken = default) { await CopilotClient.InvokeRpcAsync(_rpc, "runtime.shutdown", [], cancellationToken); } } /// Provides server-scoped SessionFs APIs. [Experimental(Diagnostics.Experimental)] 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 LlmInference APIs. [Experimental(Diagnostics.Experimental)] public sealed class ServerLlmInferenceApi { private readonly JsonRpc _rpc; internal ServerLlmInferenceApi(JsonRpc rpc) { _rpc = rpc; } /// Registers an SDK client as the LLM inference callback provider. /// The to monitor for cancellation requests. The default is . /// Indicates whether the calling client was registered as the LLM inference provider. public async Task SetProviderAsync(CancellationToken cancellationToken = default) { return await CopilotClient.InvokeRpcAsync(_rpc, "llmInference.setProvider", [], cancellationToken); } /// Delivers the response head (status + headers) for an in-flight request, correlated by the requestId the runtime supplied in httpRequestStart. Must be called exactly once per request before any httpResponseChunk frames. /// Matches the requestId from the originating httpRequestStart frame. /// HTTP status code. /// HTTP response headers, preserving multiple values per name. /// Optional HTTP status reason phrase. /// The to monitor for cancellation requests. The default is . /// Whether the start frame was accepted. public async Task HttpResponseStartAsync(string requestId, long status, IDictionary> headers, string? statusText = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(requestId); ArgumentNullException.ThrowIfNull(headers); var request = new LlmInferenceHttpResponseStartRequest { RequestId = requestId, Status = status, Headers = headers, StatusText = statusText }; return await CopilotClient.InvokeRpcAsync(_rpc, "llmInference.httpResponseStart", [request], cancellationToken); } /// Delivers a body byte range (or a terminal transport error) for an in-flight response, correlated by requestId. Set `end` true on the last chunk. When `error` is set the response terminates with a transport-level failure and the runtime raises an APIConnectionError. /// Matches the requestId from the originating httpRequestStart frame. /// Body byte range. UTF-8 text when `binary` is absent or false; base64-encoded bytes when `binary` is true. May be empty (e.g. when the response body is empty: send a single chunk with empty data and end=true). /// When true, `data` is base64-encoded bytes. When absent or false, `data` is UTF-8 text. /// When true, this is the final body chunk for the response. The runtime treats the response body as complete after receiving an end-marked chunk. /// Set to terminate the response with a transport-level failure. Implies end-of-stream; any further chunks for this requestId are ignored. /// The to monitor for cancellation requests. The default is . /// Whether the chunk was accepted. public async Task HttpResponseChunkAsync(string requestId, string data, bool? binary = null, bool? end = null, LlmInferenceHttpResponseChunkError? error = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(requestId); ArgumentNullException.ThrowIfNull(data); var request = new LlmInferenceHttpResponseChunkRequest { RequestId = requestId, Data = data, Binary = binary, End = end, Error = error }; return await CopilotClient.InvokeRpcAsync(_rpc, "llmInference.httpResponseChunk", [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 or resumes a local session and returns the opened session ID. /// The to monitor for cancellation requests. The default is . /// Result of opening a session. public async Task OpenAsync(CancellationToken cancellationToken = default) { return await CopilotClient.InvokeRpcAsync(_rpc, "sessions.open", [], cancellationToken); } /// 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 sessions, optionally filtered by source and working-directory context. Returned entries are discriminated by `isRemote`: local entries carry only the lightweight `LocalSessionMetadataValue` shape; remote entries carry the full `RemoteSessionMetadataValue` shape (repository, PR number, taskType, etc.). /// Which session sources to include. Defaults to `local` for backward compatibility. /// When provided, only the first N local 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 local session. Has no effect on remote entries (which always carry their full shape). /// Optional filter applied to the returned sessions. /// When true, include detached maintenance sessions. Defaults to false for user-facing session lists. /// Only meaningful when `source` includes remote. When true, propagates errors from the remote service instead of silently returning an empty remote list. Defaults to false. /// The to monitor for cancellation requests. The default is . /// Sessions matching the filter, ordered most-recently-modified first. public async Task ListAsync(SessionSource? source = null, long? metadataLimit = null, SessionListFilter? filter = null, bool? includeDetached = null, bool? throwOnError = null, CancellationToken cancellationToken = default) { var request = new SessionsListRequest { Source = source, MetadataLimit = metadataLimit, Filter = filter, IncludeDetached = includeDetached, ThrowOnError = throwOnError }; return await CopilotClient.InvokeRpcAsync(_rpc, "sessions.list", [request], cancellationToken); } /// Reads lightweight persisted metadata for one local session without opening it. /// Session ID to inspect. /// The to monitor for cancellation requests. The default is . /// Persisted local session metadata when the session exists. internal async Task GetMetadataAsync(string sessionId, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(sessionId); var request = new SessionsGetMetadataRequest { SessionId = sessionId }; return await CopilotClient.InvokeRpcAsync(_rpc, "sessions.getMetadata", [request], cancellationToken); } /// Reads client-owned metadata for multiple persisted local sessions without opening them. Results preserve request order and report missing, corrupt, unsupported, or temporarily unavailable sessions independently. /// Session IDs to inspect. Results preserve this order. /// Case-sensitive keys to project from each valid bag. Each key must be non-empty, at most 256 UTF-8 bytes, and outside the reserved `copilot/` and `github/` namespaces. Omit to return every entry. /// The to monitor for cancellation requests. The default is . /// Ordered client metadata outcomes for the requested local sessions. public async Task> GetClientMetadataAsync(IList sessionIds, IList? keys = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(sessionIds); var request = new SessionsGetClientMetadataRequest { SessionIds = sessionIds, Keys = keys }; return await CopilotClient.InvokeRpcAsync>(_rpc, "sessions.getClientMetadata", [request], cancellationToken); } /// Reads a page of durable events directly from a local session's persisted journal without creating, resuming, or activating the session. The initial backward read uses a bounded tail scan for fast first paint; cursor continuations preserve the session event-log paging semantics. Persisted events may omit payloads that are reconstructed only for an active session. /// Session ID whose persisted event journal should be read. /// Opaque cursor returned by a previous persisted-event read. Omit on the first call. /// Maximum number of events to return in this batch (1–1000, default 200). /// Direction to page through persisted history. Forward starts at the beginning; backward starts with the newest events. Events in each page remain chronological. /// 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 ReadPersistedEventsAsync(string sessionId, string? cursor = null, long? max = null, EventsReadDirection? direction = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(sessionId); var request = new SessionsReadPersistedEventsRequest { SessionId = sessionId, Cursor = cursor, Max = max, Direction = direction }; return await CopilotClient.InvokeRpcAsync(_rpc, "sessions.readPersistedEvents", [request], cancellationToken); } /// Lists recent local session IDs that contain user-visible history, omitting housekeeping-only sessions. /// Maximum number of session IDs to return. /// The to monitor for cancellation requests. The default is . /// Recent local session IDs that contain user-visible history. internal async Task ListNonEmptySessionIdsAsync(long? limit = null, CancellationToken cancellationToken = default) { var request = new SessionsListNonEmptySessionIdsRequest { Limit = limit }; return await CopilotClient.InvokeRpcAsync(_rpc, "sessions.listNonEmptySessionIds", [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. Internal: filesystem paths are only meaningful in-process (CLI and runtime share a filesystem). Currently used by the CLI's contribution-graph feature to read historical events directly. Remote SDK consumers must not depend on this; a proper event-query API would replace it if the contribution graph ever needed to work over the wire. /// 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. internal 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. Internal: this is CLI-specific book-keeping used by `--continue` / `--resume` to inherit the prior session's remote-steerable preference. SDK consumers that want similar behavior should manage their own persistence around start/stop calls rather than relying on this runtime-side flag. /// 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. internal 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 one local session from disk after running the same lifecycle hooks as the session manager. /// Session ID to delete. /// Internal resolved session directory path to delete. /// The to monitor for cancellation requests. The default is . internal async Task DeleteAsync(string sessionId, string? sessionPath = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(sessionId); var request = new SessionsDeleteRequest { SessionId = sessionId, SessionPath = sessionPath }; await CopilotClient.InvokeRpcAsync(_rpc, "sessions.delete", [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 enriched metadata records, with summary and context fields backfilled where available. Sessions confirmed empty and unnamed are omitted. 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); } /// Gets the dynamic-context board entry count associated with a session, when available. Internal: this exists solely so CLI telemetry events (`rem_spawn_gate`, `rem_consolidation_complete`) can pair START / END board counts around the detached rem-agent spawn. "Dynamic context board" is a runtime-internal concept that is not part of the public SDK contract; the long-term plan is to relocate the telemetry emission into the runtime so this method can be deleted entirely. /// Session ID whose board entry count should be returned. /// The to monitor for cancellation requests. The default is . /// Dynamic-context board entry count, when available. internal async Task GetBoardEntryCountAsync(string sessionId, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(sessionId); var request = new SessionsGetBoardEntryCountRequest { SessionId = sessionId }; return await CopilotClient.InvokeRpcAsync(_rpc, "sessions.getBoardEntryCount", [request], cancellationToken); } /// Attaches the runtime-managed remote-control singleton to a session, awaiting initial setup. If remote control is already attached to a different session, the singleton is transferred (preserving the underlying Mission Control connection). Returns the final status. /// Local session id to attach remote control to. /// Configuration for the runtime-managed remote-control singleton. /// The to monitor for cancellation requests. The default is . /// Wrapper for the singleton's current status. public async Task StartRemoteControlAsync(string sessionId, RemoteControlConfig config, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(sessionId); ArgumentNullException.ThrowIfNull(config); var request = new SessionsStartRemoteControlRequest { SessionId = sessionId, Config = config }; return await CopilotClient.InvokeRpcAsync(_rpc, "sessions.startRemoteControl", [request], cancellationToken); } /// Atomically rebinds the remote-control singleton to a different session, preserving the underlying Mission Control connection. When `expectedFromSessionId` is provided and does not match the singleton's current `attachedSessionId`, the transfer is rejected with `transferred: false` and the current status is returned unchanged. /// Local session id to point remote control at. /// When provided, the transfer is rejected unless the singleton currently points at this session id (compare-and-swap semantics to avoid clobbering newer state). /// The to monitor for cancellation requests. The default is . /// Outcome of a transferRemoteControl call. public async Task TransferRemoteControlAsync(string toSessionId, string? expectedFromSessionId = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(toSessionId); var request = new SessionsTransferRemoteControlRequest { ToSessionId = toSessionId, ExpectedFromSessionId = expectedFromSessionId }; return await CopilotClient.InvokeRpcAsync(_rpc, "sessions.transferRemoteControl", [request], cancellationToken); } /// Patches the steering state of the active remote-control singleton. When remote control is off, this is a no-op and the off status is returned. Today only `enabled: true` is actionable on the underlying exporter; passing `false` is reserved for future use. /// Target steering state. Today only `true` is actionable on the underlying exporter; `false` is reserved for future use. /// The to monitor for cancellation requests. The default is . /// Wrapper for the singleton's current status. public async Task SetRemoteControlSteeringAsync(bool enabled, CancellationToken cancellationToken = default) { var request = new SessionsSetRemoteControlSteeringRequest { Enabled = enabled }; return await CopilotClient.InvokeRpcAsync(_rpc, "sessions.setRemoteControlSteering", [request], cancellationToken); } /// Stops the remote-control singleton. When `expectedSessionId` is provided and does not match the singleton's current `attachedSessionId`, the stop is rejected with `stopped: false` and the current status is returned unchanged (unless `force` is set, in which case the singleton is unconditionally torn down). /// When provided, the stop is rejected unless the singleton currently points at this session id (compare-and-swap semantics). /// When true, the singleton is unconditionally torn down regardless of `expectedSessionId`. Use during shutdown or explicit `/remote off`. /// The to monitor for cancellation requests. The default is . /// Outcome of a stopRemoteControl call. public async Task StopRemoteControlAsync(string? expectedSessionId = null, bool? force = null, CancellationToken cancellationToken = default) { var request = new SessionsStopRemoteControlRequest { ExpectedSessionId = expectedSessionId, Force = force }; return await CopilotClient.InvokeRpcAsync(_rpc, "sessions.stopRemoteControl", [request], cancellationToken); } /// Returns the current state of the remote-control singleton, including the attached session id and frontend URL when active. /// The to monitor for cancellation requests. The default is . /// Wrapper for the singleton's current status. public async Task GetRemoteControlStatusAsync(CancellationToken cancellationToken = default) { return await CopilotClient.InvokeRpcAsync(_rpc, "sessions.getRemoteControlStatus", [], cancellationToken); } /// Registers extension-provided tools on the given session, gated by an optional `enabled` callback. Returns an opaque unsubscribe function the caller must invoke to deregister the tools when the extension is torn down. Marked internal because `loader`, `enabled`, and the returned `unsubscribe` are in-process handles that cannot cross the JSON-RPC boundary. Disappears once extension discovery / launch / tool registration are owned by the runtime: SDK consumers will pass pure config (search paths, disabled ids) via `SessionOptions` and the runtime will resolve, launch, register, and tear down extensions itself. /// Session to register extension tools on. /// Optional registration options. /// The to monitor for cancellation requests. The default is . /// Handle for releasing the extension tool registration. internal async Task RegisterExtensionToolsOnSessionAsync(string sessionId, SessionsRegisterExtensionToolsOnSessionOptions? options = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(sessionId); var request = new RegisterExtensionToolsParams { SessionId = sessionId, Options = options }; return await CopilotClient.InvokeRpcAsync(_rpc, "sessions.registerExtensionToolsOnSession", [request], cancellationToken); } /// Attaches (or detaches) an in-process ExtensionController delegate for the given session, used by shared-API surfaces that need to query or modify the session's extension state. Pass `controller: undefined` to detach. Marked internal because the controller is an in-process object that cannot cross the JSON-RPC boundary. Disappears alongside `registerExtensionToolsOnSession`: once the runtime owns extension management, the public surface exposes list/enable/disable/reload as dedicated RPCs served by the runtime. /// Session to attach the extension controller delegate to. /// The to monitor for cancellation requests. The default is . internal async Task ConfigureSessionExtensionsAsync(string sessionId, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(sessionId); var request = new ConfigureSessionExtensionsParams { SessionId = sessionId }; await CopilotClient.InvokeRpcAsync(_rpc, "sessions.configureSessionExtensions", [request], cancellationToken); } } /// Provides server-scoped AgentRegistry APIs. [Experimental(Diagnostics.Experimental)] public sealed class ServerAgentRegistryApi { private readonly JsonRpc _rpc; internal ServerAgentRegistryApi(JsonRpc rpc) { _rpc = rpc; } /// Spawns a managed-server child with the supplied configuration and returns a discriminated-union result. The caller (typically the CLI controller) is responsible for attaching to the spawned child and sending any follow-up prompt. When the controller-local spawn gate is closed the server returns JSON-RPC MethodNotFound. /// Working directory for the spawned child (must be an existing directory). /// Custom or built-in agent name (e.g. 'explore'). When omitted, the child uses its own default. /// Model identifier to apply to the new session. /// Friendly session name. Must satisfy validateSessionName: non-empty, no leading/trailing whitespace, <=100 chars, no control chars, no double quotes. /// Permission posture for the new session. 'yolo' requires the controller-local session to currently be in allow-all mode. /// Optional first user message. Forwarded to the caller (the CLI's spawn wrapper sends it post-attach via the standard LocalRpcSession.send path). /// The to monitor for cancellation requests. The default is . /// Outcome of an agentRegistry.spawn call. public async Task SpawnAsync(string cwd, string? agentName = null, string? model = null, string? name = null, AgentRegistrySpawnPermissionMode? permissionMode = null, string? initialPrompt = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(cwd); var request = new AgentRegistrySpawnRequest { Cwd = cwd, AgentName = agentName, Model = model, Name = name, PermissionMode = permissionMode, InitialPrompt = initialPrompt }; return await CopilotClient.InvokeRpcAsync(_rpc, "agentRegistry.spawn", [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; /// Sandbox APIs. public SandboxApi Sandbox => field ?? Interlocked.CompareExchange(ref field, new(_session), null) ?? field; /// GitHubAuth APIs. public GitHubAuthApi GitHubAuth => field ?? Interlocked.CompareExchange(ref field, new(_session), null) ?? field; /// Debug APIs. public DebugApi Debug => field ?? Interlocked.CompareExchange(ref field, new(_session), null) ?? field; /// Canvas APIs. public CanvasApi Canvas => field ?? Interlocked.CompareExchange(ref field, new(_session), null) ?? field; /// Factory APIs. public FactoryApi Factory => 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; /// AutopilotObjective APIs. public AutopilotObjectiveApi AutopilotObjective => field ?? Interlocked.CompareExchange(ref field, new(_session), null) ?? field; /// Completions APIs. public CompletionsApi Completions => 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; /// Provider APIs. public ProviderApi Provider => 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; /// Settings APIs. public SettingsApi Settings => field ?? Interlocked.CompareExchange(ref field, new(_session), null) ?? field; /// ContentExclusion APIs. public ContentExclusionApi ContentExclusion => 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; /// LimitPrediction APIs. public LimitPredictionApi LimitPrediction => field ?? Interlocked.CompareExchange(ref field, new(_session), null) ?? field; /// Remote APIs. public RemoteApi Remote => field ?? Interlocked.CompareExchange(ref field, new(_session), null) ?? field; /// Visibility APIs. public VisibilityApi Visibility => 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. Must be `user`, `system`, `command-<command-id>` for command-originated messages, `schedule-<numeric-id>` for scheduled prompts, or `agent-<agent-id>` for prompts sent by another agent. /// 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. Transport-dependent tail semantics: on a LOCAL (in-process) session the wait additionally blocks until the completed turn's event tail has been dispatched to this session's in-process subscribers, so a subsequent read of subscriber state already reflects the turn; on a REMOTE session the wait resolves once the loop completes and mirrored delivery follows over the wire. Callers that need the stronger local guarantee on remote sessions should await the event stream explicitly. /// 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, string? 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 = source, AgentMode = agentMode, RequestHeaders = requestHeaders, Traceparent = traceparent, Tracestate = tracestate, Wait = wait }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.send", [request], cancellationToken); } /// Sends zero or more user messages to the session in a single turn and returns their message IDs. All provided messages are appended to the conversation in order, then exactly one agent turn runs over the resulting history. When the list is empty, one turn runs over the existing history with no new user message. Remote-backed (Mission Control) sessions do not support this method and will return an error. /// The user messages to append to the conversation, in order. May be empty, in which case a single turn runs over the existing history with no new user message. /// How to deliver the messages. `enqueue` (default) appends to the message queue. `immediate` interjects during an in-progress turn. /// If true, adds the messages to the front of the queue instead of the end. /// The UI mode the agent was in when these messages were 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 turn before returning. Defaults to false (fire-and-forget). When true, the result still contains the same `messageIds`; the caller can rely on the agent having processed the messages before the call resolves. Transport-dependent tail semantics: on a LOCAL (in-process) session the wait additionally blocks until the completed turn's event tail has been dispatched to this session's in-process subscribers, so a subsequent read of subscriber state already reflects the turn; on a REMOTE session the wait resolves once the loop completes and mirrored delivery follows over the wire. Callers that need the stronger local guarantee on remote sessions should await the event stream explicitly. /// The to monitor for cancellation requests. The default is . /// Result of sending zero or more user messages. [Experimental(Diagnostics.Experimental)] public async Task SendMessagesAsync(IList messages, SendMode? mode = null, bool? prepend = null, SendAgentMode? agentMode = null, IDictionary? requestHeaders = null, string? traceparent = null, string? tracestate = null, bool? wait = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(messages); _session.ThrowIfDisposed(); var request = new SendMessagesRequest { SessionId = _session.SessionId, Messages = messages, Mode = mode, Prepend = prepend, AgentMode = agentMode, RequestHeaders = requestHeaders, Traceparent = traceparent, Tracestate = tracestate, Wait = wait }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.sendMessages", [request], cancellationToken); } /// Queues or sends an internal system notification to the session according to its passive policy. /// Notification text to deliver to the model. /// Optional structured notification kind. /// Internal delivery options, including passive policy. /// The to monitor for cancellation requests. The default is . [Experimental(Diagnostics.Experimental)] internal async Task SendSystemNotificationAsync(string message, object? kind = null, object? options = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(message); _session.ThrowIfDisposed(); var request = new SendSystemNotificationRequest { SessionId = _session.SessionId, Message = message, Kind = CopilotClient.ToJsonElementForWire(kind), Options = CopilotClient.ToJsonElementForWire(options) }; await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.sendSystemNotification", [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); } /// Interrupts the current main agent turn while leaving running background work (subagents, sidekicks, and promoted attached shells) alive. No-op when the main loop is not processing. /// When true, the user's queued prompts are preserved and run as the next turn once the interrupted turn unwinds; when false (the default), the queue is cleared like a plain abort. /// The to monitor for cancellation requests. The default is . /// Result of interrupting the main agent turn. [Experimental(Diagnostics.Experimental)] public async Task InterruptMainTurnAsync(bool? flushQueued = null, CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new InterruptMainTurnRequest { SessionId = _session.SessionId, FlushQueued = flushQueued }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.interruptMainTurn", [request], cancellationToken); } /// Cancels every running background agent (task-registry subagents plus sidekick agents) without interrupting the main agent loop. Promoted attached shells are left running. /// The to monitor for cancellation requests. The default is . /// The number of running background agents (task-registry agents) that were cancelled. [Experimental(Diagnostics.Experimental)] public async Task CancelAllBackgroundAgentsAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionCancelAllBackgroundAgentsRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.cancelAllBackgroundAgents", [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 Sandbox APIs. [Experimental(Diagnostics.Experimental)] public sealed class SandboxApi { private readonly CopilotSession _session; internal SandboxApi(CopilotSession session) { _session = session; } /// Returns whether managed policy requires sandbox enforcement and whether an enforcement failure has permanently blocked the session. /// The to monitor for cancellation requests. The default is . /// Managed sandbox enforcement state for a session. public async Task GetEnforcementStatusAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionSandboxGetEnforcementStatusRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.sandbox.getEnforcementStatus", [request], cancellationToken); } /// Disables sandboxing for the remainder of the current session and approves the referenced pending sandbox-bypass permission request. The request is rejected unless the exact request is still pending and the effective sandbox policy permits bypass. /// Identifier of the exact pending sandbox-bypass permission request that authorized the session opt-out. /// Optional attribution for the permission decision. /// The to monitor for cancellation requests. The default is . /// Result of attempting to disable sandboxing for the current session. public async Task DisableForSessionAsync(string requestId, PermissionDecisionContext? decisionContext = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(requestId); _session.ThrowIfDisposed(); var request = new SandboxDisableForSessionRequest { SessionId = _session.SessionId, RequestId = requestId, DecisionContext = decisionContext }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.sandbox.disableForSession", [request], cancellationToken); } } /// Provides session-scoped GitHubAuth APIs. [Experimental(Diagnostics.Experimental)] public sealed class GitHubAuthApi { private readonly CopilotSession _session; internal GitHubAuthApi(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 SessionGitHubAuthGetStatusRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.gitHubAuth.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 installs the supplied value immediately for outbound model/API requests. When the credential carries a raw token (`token`, `env`, or `gh-cli`) but no `copilotUser`, the runtime additionally re-resolves `copilotUser` server-side (best-effort, asynchronously, after the synchronous install) so plan/quota/billing metadata regains fidelity; on resolution failure the verbatim credential remains installed. It does NOT otherwise validate the credential. 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(SettableAuthInfo? credentials = null, CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionSetCredentialsParams { SessionId = _session.SessionId, Credentials = credentials }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.gitHubAuth.setCredentials", [request], cancellationToken); } /// Gets the current authentication information for internal session hosts. /// The to monitor for cancellation requests. The default is . /// Current authentication information, or null when no authentication is active. internal async Task GetCurrentAuthInfoAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionGitHubAuthGetCurrentAuthInfoRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.gitHubAuth.getCurrentAuthInfo", [request], cancellationToken); } /// Gets all authentication accounts available to the internal session host. /// The to monitor for cancellation requests. The default is . /// Authentication accounts available to the internal session host. internal async Task> GetAllAuthAvailableAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionGitHubAuthGetAllAuthAvailableRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync>(_session.Rpc, "session.gitHubAuth.getAllAuthAvailable", [request], cancellationToken); } /// Refreshes Copilot account metadata for the current authentication. /// The to monitor for cancellation requests. The default is . /// Current authentication information, or null when no authentication is active. internal async Task RefreshCopilotUserAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionGitHubAuthRefreshCopilotUserRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.gitHubAuth.refreshCopilotUser", [request], cancellationToken); } /// Logs in a GitHub user through the internal session host. /// GitHub host URL. /// GitHub login. /// GitHub authentication token. /// Whether to persist the token after login. /// The to monitor for cancellation requests. The default is . /// Authentication credentials accepted only at native protocol ingress. Runtime outputs use credential-free `AuthIdentity` metadata. internal async Task LoginAsync(string host, string login, string token, bool? persist = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(host); ArgumentNullException.ThrowIfNull(login); ArgumentNullException.ThrowIfNull(token); _session.ThrowIfDisposed(); var request = new SessionAuthLoginRequest { SessionId = _session.SessionId, Host = host, Login = login, Token = token, Persist = persist }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.gitHubAuth.login", [request], cancellationToken); } /// Switches the session to another available authentication. /// Authentication information to activate. /// Optional token paired with the authentication information. /// The to monitor for cancellation requests. The default is . internal async Task SwitchToAuthAsync(AuthInfo authInfo, string? token = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(authInfo); _session.ThrowIfDisposed(); var request = new SessionAuthSwitchRequest { SessionId = _session.SessionId, AuthInfo = authInfo, Token = token }; await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.gitHubAuth.switchToAuth", [request], cancellationToken); } /// Logs out the session's current GitHub authentication. /// The to monitor for cancellation requests. The default is . /// Whether the current authentication was logged out. internal async Task LogoutAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionGitHubAuthLogoutRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.gitHubAuth.logout", [request], cancellationToken); } /// Logs out a specific GitHub authentication. /// Authentication information to log out. /// The to monitor for cancellation requests. The default is . /// Whether the requested authentication was logged out. internal async Task LogoutUserAsync(AuthInfo authInfo, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(authInfo); _session.ThrowIfDisposed(); var request = new SessionAuthLogoutUserRequest { SessionId = _session.SessionId, AuthInfo = authInfo }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.gitHubAuth.logoutUser", [request], cancellationToken); } /// Gets validation errors from the most recent authentication attempt. /// The to monitor for cancellation requests. The default is . /// Validation errors from the most recent authentication attempt. internal async Task> LastAuthErrorsAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionGitHubAuthLastAuthErrorsRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync>(_session.Rpc, "session.gitHubAuth.lastAuthErrors", [request], cancellationToken); } } /// Provides session-scoped Debug APIs. [Experimental(Diagnostics.Experimental)] public sealed class DebugApi { private readonly CopilotSession _session; internal DebugApi(CopilotSession session) { _session = session; } /// Collects a redacted session debug log bundle into a local archive or staging directory. The runtime includes session-owned logs by default and accepts caller-provided diagnostic entries so host applications can add their own files without changing this API shape. /// Where the redacted bundle should be written. Use `archive` to produce a .tgz, or `directory` to stage redacted files for caller-managed upload/post-processing. /// Which built-in session diagnostics to include. Omitted fields default to true. /// Caller-provided server-local files or directories to include in addition to the runtime's built-in session diagnostics. This lets host applications add their own diagnostics without changing the API shape. /// The to monitor for cancellation requests. The default is . /// Result of collecting a redacted debug bundle. public async Task CollectLogsAsync(DebugCollectLogsDestination destination, DebugCollectLogsInclude? include = null, IList? additionalEntries = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(destination); _session.ThrowIfDisposed(); var request = new DebugCollectLogsRequest { SessionId = _session.SessionId, Destination = destination, Include = include, AdditionalEntries = additionalEntries }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.debug.collectLogs", [request], cancellationToken); } } /// Provides session-scoped Canvas APIs. [Experimental(Diagnostics.Experimental)] public sealed class CanvasApi { private readonly CopilotSession _session; internal CanvasApi(CopilotSession session) { _session = session; } /// Lists canvases declared for the session. /// The to monitor for cancellation requests. The default is . /// Declared canvases available in this session. public async Task ListAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionCanvasListRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.canvas.list", [request], cancellationToken); } /// Lists currently open canvas instances for the live session. /// The to monitor for cancellation requests. The default is . /// Live open-canvas snapshot. public async Task ListOpenAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionCanvasListOpenRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.canvas.listOpen", [request], cancellationToken); } /// Opens or focuses a canvas instance. /// Provider-local canvas identifier. /// Caller-supplied stable instance identifier. /// Owning provider identifier. Optional when the canvasId is unique across providers; required to disambiguate when multiple providers register the same canvasId. /// Canvas open input. /// The to monitor for cancellation requests. The default is . /// Open canvas instance snapshot. public async Task OpenAsync(string canvasId, string instanceId, string? extensionId = null, object? input = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(canvasId); ArgumentNullException.ThrowIfNull(instanceId); _session.ThrowIfDisposed(); var request = new CanvasOpenRequest { SessionId = _session.SessionId, CanvasId = canvasId, InstanceId = instanceId, ExtensionId = extensionId, Input = CopilotClient.ToJsonElementForWire(input) }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.canvas.open", [request], cancellationToken); } /// Closes an open canvas instance. /// Open canvas instance identifier. /// The to monitor for cancellation requests. The default is . public async Task CloseAsync(string instanceId, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(instanceId); _session.ThrowIfDisposed(); var request = new CanvasCloseRequest { SessionId = _session.SessionId, InstanceId = instanceId }; await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.canvas.close", [request], cancellationToken); } /// Action APIs. public CanvasActionApi Action => field ?? Interlocked.CompareExchange(ref field, new(_session), null) ?? field; /// Provider APIs. public CanvasProviderApi Provider => field ?? Interlocked.CompareExchange(ref field, new(_session), null) ?? field; } /// Provides session-scoped CanvasAction APIs. [Experimental(Diagnostics.Experimental)] public sealed class CanvasActionApi { private readonly CopilotSession _session; internal CanvasActionApi(CopilotSession session) { _session = session; } /// Invokes an action on an open canvas instance. /// Open canvas instance identifier. /// Action name to invoke. /// Action input. /// The to monitor for cancellation requests. The default is . /// Canvas action invocation result. public async Task InvokeAsync(string instanceId, string actionName, object? input = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(instanceId); ArgumentNullException.ThrowIfNull(actionName); _session.ThrowIfDisposed(); var request = new CanvasActionInvokeRequest { SessionId = _session.SessionId, InstanceId = instanceId, ActionName = actionName, Input = CopilotClient.ToJsonElementForWire(input) }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.canvas.action.invoke", [request], cancellationToken); } } /// Provides session-scoped CanvasProvider APIs. [Experimental(Diagnostics.Experimental)] public sealed class CanvasProviderApi { private readonly CopilotSession _session; internal CanvasProviderApi(CopilotSession session) { _session = session; } /// Registers an internal canvas provider connection and its contributions. /// Connection identifier for callback routing. /// Provider metadata supplied by the host. /// Canvas contributions supplied by the provider. /// The to monitor for cancellation requests. The default is . internal async Task RegisterAsync(string connectionId, object info, IList canvases, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(connectionId); ArgumentNullException.ThrowIfNull(info); ArgumentNullException.ThrowIfNull(canvases); _session.ThrowIfDisposed(); var request = new CanvasProviderRegisterRequest { SessionId = _session.SessionId, ConnectionId = connectionId, Info = CopilotClient.ToJsonElementForWire(info)!.Value, Canvases = canvases.Select(static v => CopilotClient.ToJsonElementForWire(v)!.Value).ToList() }; await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.canvas.provider.register", [request], cancellationToken); } /// Unregisters an internal canvas provider connection. /// Connection identifier to unregister. /// The to monitor for cancellation requests. The default is . internal async Task UnregisterAsync(string connectionId, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(connectionId); _session.ThrowIfDisposed(); var request = new CanvasProviderUnregisterRequest { SessionId = _session.SessionId, ConnectionId = connectionId }; await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.canvas.provider.unregister", [request], cancellationToken); } } /// Provides session-scoped Factory APIs. [Experimental(Diagnostics.Experimental)] public sealed class FactoryApi { private readonly CopilotSession _session; internal FactoryApi(CopilotSession session) { _session = session; } /// Runs a registered factory by name at the top level. /// Registered factory name. /// Factory input value. /// Factory invocation options. /// The to monitor for cancellation requests. The default is . /// Complete current or terminal factory run envelope. public async Task RunAsync(string name, object args, RunOptions? options = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(name); ArgumentNullException.ThrowIfNull(args); _session.ThrowIfDisposed(); var request = new FactoryRunRequest { SessionId = _session.SessionId, Name = name, Args = CopilotClient.ToJsonElementForWire(args)!.Value, Options = options }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.factory.run", [request], cancellationToken); } /// Resumes a factory run using its persisted name, arguments, journal, and accounting. /// Factory run identifier. /// Optional per-invocation resource ceiling overrides. /// Whether to notify the originating session when the factory completes. /// Whether to emit factory phase names to the session transcript. /// The to monitor for cancellation requests. The default is . /// Resolved persisted factory identity and resumed run envelope. public async Task ResumeAsync(string runId, FactoryRunLimits? limits = null, bool? notifyOnComplete = null, bool? logPhaseNames = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(runId); _session.ThrowIfDisposed(); var request = new FactoryResumeRequest { SessionId = _session.SessionId, RunId = runId, Limits = limits, NotifyOnComplete = notifyOnComplete, LogPhaseNames = logPhaseNames }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.factory.resume", [request], cancellationToken); } /// Internal tool-originated factory invocation. /// Registered factory name. /// Factory input value. /// Tool-originated factory invocation options. /// Opaque identifier of the originating tool call. /// The to monitor for cancellation requests. The default is . /// Complete current or terminal factory run envelope. internal async Task RunFromToolAsync(string name, object args, FactoryToolRunOptions? options = null, string? toolCallId = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(name); ArgumentNullException.ThrowIfNull(args); _session.ThrowIfDisposed(); var request = new FactoryToolRunRequest { SessionId = _session.SessionId, Name = name, Args = CopilotClient.ToJsonElementForWire(args)!.Value, Options = options, ToolCallId = toolCallId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.factory.runFromTool", [request], cancellationToken); } /// Internal tool-originated factory resume. /// Factory run identifier. /// Optional per-invocation resource ceiling overrides. /// Opaque identifier of the originating tool call. /// The to monitor for cancellation requests. The default is . /// Resolved persisted factory identity and resumed run envelope. internal async Task ResumeFromToolAsync(string runId, FactoryRunLimits? limits = null, string? toolCallId = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(runId); _session.ThrowIfDisposed(); var request = new FactoryToolResumeRequest { SessionId = _session.SessionId, RunId = runId, Limits = limits, ToolCallId = toolCallId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.factory.resumeFromTool", [request], cancellationToken); } /// Gets the current or settled envelope for a factory run. /// Factory run identifier. /// The to monitor for cancellation requests. The default is . /// Complete current or terminal factory run envelope. public async Task GetRunAsync(string runId, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(runId); _session.ThrowIfDisposed(); var request = new FactoryGetRunRequest { SessionId = _session.SessionId, RunId = runId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.factory.getRun", [request], cancellationToken); } /// Lists durable factory runs for this session in creation order. /// Exclusive forward cursor. /// Exclusive backward cursor. /// Maximum terminal runs to return. Defaults to 200 and is capped at 500. /// The to monitor for cancellation requests. The default is . /// A page of factory runs in durable creation order. public async Task ListRunsAsync(long? afterSeq = null, long? beforeSeq = null, int? limit = null, CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new FactoryListRunsRequest { SessionId = _session.SessionId, AfterSeq = afterSeq, BeforeSeq = beforeSeq, Limit = limit }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.factory.listRuns", [request], cancellationToken); } /// Gets durable and live observability detail for one factory run. /// Factory run identifier. /// The to monitor for cancellation requests. The default is . /// Full factory run observability detail. public async Task GetRunDetailAsync(string runId, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(runId); _session.ThrowIfDisposed(); var request = new FactoryGetRunRequest { SessionId = _session.SessionId, RunId = runId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.factory.getRunDetail", [request], cancellationToken); } /// Pages durable progress for one factory run. /// Factory run identifier. /// Optional phase identifier used to scope records and cursors. /// Exclusive forward cursor. /// Exclusive backward cursor. /// Maximum records to return. Defaults to 200 and is capped at 500. /// The to monitor for cancellation requests. The default is . /// A bidirectional page of factory progress. public async Task GetRunProgressAsync(string runId, string? phaseId = null, long? afterSeq = null, long? beforeSeq = null, int? limit = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(runId); _session.ThrowIfDisposed(); var request = new FactoryGetRunProgressRequest { SessionId = _session.SessionId, RunId = runId, PhaseId = phaseId, AfterSeq = afterSeq, BeforeSeq = beforeSeq, Limit = limit }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.factory.getRunProgress", [request], cancellationToken); } /// Requests cancellation of a factory run and returns its run envelope. /// Factory run identifier. /// The to monitor for cancellation requests. The default is . /// Complete current or terminal factory run envelope. public async Task CancelAsync(string runId, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(runId); _session.ThrowIfDisposed(); var request = new FactoryCancelRequest { SessionId = _session.SessionId, RunId = runId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.factory.cancel", [request], cancellationToken); } /// Pauses a running factory and returns its settled run envelope. /// Factory run identifier. /// The to monitor for cancellation requests. The default is . /// Complete current or terminal factory run envelope. public async Task PauseAsync(string runId, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(runId); _session.ThrowIfDisposed(); var request = new FactoryPauseRequest { SessionId = _session.SessionId, RunId = runId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.factory.pause", [request], cancellationToken); } /// Atomically pauses an owned factory attempt at a durable checkpoint. /// Factory run identifier. /// Opaque token identifying the execution attempt that reached the checkpoint. /// Stable author-defined checkpoint key. /// The to monitor for cancellation requests. The default is . internal async Task PauseAtCheckpointAsync(string runId, string executionToken, string key, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(runId); ArgumentNullException.ThrowIfNull(executionToken); ArgumentNullException.ThrowIfNull(key); _session.ThrowIfDisposed(); var request = new FactoryPauseCheckpointRequest { SessionId = _session.SessionId, RunId = runId, ExecutionToken = executionToken, Key = key }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.factory.pauseAtCheckpoint", [request], cancellationToken); } /// Records a batch of ordered factory progress lines. /// Factory run identifier. /// Opaque token identifying the current factory execution attempt. /// Ordered progress lines to append. /// The to monitor for cancellation requests. The default is . /// Acknowledgement that a factory request was accepted. public async Task LogAsync(string runId, string executionToken, IList lines, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(runId); ArgumentNullException.ThrowIfNull(executionToken); ArgumentNullException.ThrowIfNull(lines); _session.ThrowIfDisposed(); var request = new FactoryLogRequest { SessionId = _session.SessionId, RunId = runId, ExecutionToken = executionToken, Lines = lines }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.factory.log", [request], cancellationToken); } /// Runs one factory-scoped subagent and returns its result. /// Factory run identifier that owns the subagent. /// Opaque token identifying the current factory execution attempt. /// Prompt to send to the subagent. /// Subagent execution options. /// The to monitor for cancellation requests. The default is . /// Result of one factory-scoped subagent call. public async Task AgentAsync(string factoryRunId, string executionToken, string prompt, FactoryAgentOptions opts, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(factoryRunId); ArgumentNullException.ThrowIfNull(executionToken); ArgumentNullException.ThrowIfNull(prompt); ArgumentNullException.ThrowIfNull(opts); _session.ThrowIfDisposed(); var request = new FactoryAgentRequest { SessionId = _session.SessionId, FactoryRunId = factoryRunId, ExecutionToken = executionToken, Prompt = prompt, Opts = opts }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.factory.agent", [request], cancellationToken); } /// Journal APIs. public FactoryJournalApi Journal => field ?? Interlocked.CompareExchange(ref field, new(_session), null) ?? field; } /// Provides session-scoped FactoryJournal APIs. [Experimental(Diagnostics.Experimental)] public sealed class FactoryJournalApi { private readonly CopilotSession _session; internal FactoryJournalApi(CopilotSession session) { _session = session; } /// Reads a memoized factory journal entry. /// Factory run identifier. /// Opaque token identifying the current factory execution attempt. /// Namespaced journal key. /// The to monitor for cancellation requests. The default is . /// Result of reading a factory journal entry. public async Task GetAsync(string runId, string executionToken, string key, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(runId); ArgumentNullException.ThrowIfNull(executionToken); ArgumentNullException.ThrowIfNull(key); _session.ThrowIfDisposed(); var request = new FactoryJournalGetRequest { SessionId = _session.SessionId, RunId = runId, ExecutionToken = executionToken, Key = key }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.factory.journal.get", [request], cancellationToken); } /// Stores a memoized factory journal entry. /// Factory run identifier. /// Opaque token identifying the current factory execution attempt. /// Namespaced journal key. /// JSON result to memoize. /// The to monitor for cancellation requests. The default is . /// Acknowledgement that a factory request was accepted. public async Task PutAsync(string runId, string executionToken, string key, object resultJson, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(runId); ArgumentNullException.ThrowIfNull(executionToken); ArgumentNullException.ThrowIfNull(key); ArgumentNullException.ThrowIfNull(resultJson); _session.ThrowIfDisposed(); var request = new FactoryJournalPutRequest { SessionId = _session.SessionId, RunId = runId, ExecutionToken = executionToken, Key = key, ResultJson = CopilotClient.ToJsonElementForWire(resultJson)!.Value }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.factory.journal.put", [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 session's authoritative model snapshot, including the committed Auto preference and any newer unclaimed Auto preference waiting for a future user turn. /// The to monitor for cancellation requests. The default is . /// The session's authoritative model snapshot. Auto preference fields are configuration for the virtual `auto` model and do not change the selected model identifier. The context tier reflects `Session.getContextTier()`, restored from the session journal on resume. 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 selection id to switch to, as returned by `list`. A bare id (e.g. `claude-sonnet-4.6`) names a Copilot (CAPI) model; a provider-qualified id (`provider/id`, e.g. `acme/claude-sonnet`) targets a registry BYOK model. /// Optional Auto routing preference to stage atomically with selecting `auto`. Pass null to return to provider-default Auto routing. This field is rejected when `modelId` is not `auto`. /// Reasoning effort level to use for the model. CAPI values are model-defined and validated against the selected model; BYOK providers may define additional values. "none" disables reasoning. When omitted, no effort override is applied. /// Reasoning summary mode to request for supported model clients. /// Output verbosity level to request for supported models. /// Override individual model capabilities resolved by the runtime. /// Explicit context tier for the selected model. `"default"` / `"long_context"` apply the requested tier; omit this field to use normal model behavior with no explicit tier. /// Origin to record on the effective `session.model_change` event for trusted in-process calls. Transport SDK calls are always recorded as `sdk`, regardless of this value. /// When true, defer this switch (enqueue it) if another model change is already queued, even when no turn is active — so it drains last (FIFO) and wins over the already-queued change. Intended for genuine user-initiated model selections; internal restore/reapply switches omit it and apply immediately when no turn is active. When no other model change is queued this has no effect (a switch still applies immediately unless a turn is active). /// Explicit response to a model-switch compaction preflight. Omit to request a confirmation projection when compaction is necessary. /// When true, evaluate context-window compaction policy before applying the switch. /// Optional repository settings scope to persist after the switch commits. /// Settings scope used when persisting the selected model. /// Require the target to be currently available and enabled before applying the switch. /// Optional settings context and explicit-override flags used to persist a picker selection. /// 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, AutoTier? autoTier = null, string? reasoningEffort = null, ReasoningSummary? reasoningSummary = null, Verbosity? verbosity = null, ModelCapabilitiesOverride? modelCapabilities = null, ContextTier? contextTier = null, ModelChangeSource? source = null, bool? deferIfModelChangeQueued = null, string? compactionDecision = null, bool? runCompactionPreflight = null, string? repoScope = null, string? modelChangeScope = null, bool? requireAvailable = null, ModelPickerPersistenceRequest? pickerPersistence = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(modelId); _session.ThrowIfDisposed(); var request = new ModelSwitchToRequest { SessionId = _session.SessionId, ModelId = modelId, AutoTier = autoTier, ReasoningEffort = reasoningEffort, ReasoningSummary = reasoningSummary, Verbosity = verbosity, ModelCapabilities = modelCapabilities, ContextTier = contextTier, Source = source, DeferIfModelChangeQueued = deferIfModelChangeQueued, CompactionDecision = compactionDecision, RunCompactionPreflight = runCompactionPreflight, RepoScope = repoScope, ModelChangeScope = modelChangeScope, RequireAvailable = requireAvailable, PickerPersistence = pickerPersistence }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.model.switchTo", [request], cancellationToken); } /// Requests an Auto preference change without changing the session's selected model. The latest unclaimed request wins; the runtime commits it only after a later prompt using the `auto` model mints a usable model and token pair. A `pending` response confirms that the request was accepted, not that it committed. Observe eventual success through `session.model_change`, failure through the ephemeral `session.auto_tier_switch_failed` event, or current unclaimed state through `session.model.getCurrent`. /// Auto preference to activate when a future user turn using the `auto` model safely mints a replacement model and token pair. Pass null to return to provider-default Auto routing. /// Origin to record on the effective `session.model_change` event. Defaults to `sdk` when omitted. /// The to monitor for cancellation requests. The default is . /// Immediate acknowledgement and Auto preference snapshot after a switch request. This result never implies that a pending preference committed. public async Task SwitchAutoTierAsync(AutoTier? autoTier, ModelChangeSource? source = null, CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new ModelSwitchAutoTierRequest { SessionId = _session.SessionId, AutoTier = autoTier, Source = source }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.model.switchAutoTier", [request], cancellationToken); } /// Resolves and applies organization-managed and repository model overlays. /// Model required by device-managed policy, when configured. /// Model required by server-managed policy, when configured. /// Startup default model from the enterprise policy helper, when configured. Weakest of the managed sources: it applies only when neither device nor server policy names a model, and an explicit user selection still wins. /// Model selected by repository settings, when configured. /// Reasoning effort selected by repository settings, when configured. /// Context tier selected by repository settings, when configured. /// Model explicitly selected by the CLI, when provided. /// Whether the overlay is being applied while resuming a deferred session. /// The to monitor for cancellation requests. The default is . /// The model identifier active on the session after the switch. internal async Task ApplyStartupOverlayAsync(string? deviceManagedModel = null, string? serverManagedModel = null, string? policyHelperModel = null, string? repoModel = null, string? repoReasoningEffort = null, string? repoContextTier = null, string? cliModel = null, bool? deferredResume = null, CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new ModelApplyStartupOverlayRequest { SessionId = _session.SessionId, DeviceManagedModel = deviceManagedModel, ServerManagedModel = serverManagedModel, PolicyHelperModel = policyHelperModel, RepoModel = repoModel, RepoReasoningEffort = repoReasoningEffort, RepoContextTier = repoContextTier, CliModel = cliModel, DeferredResume = deferredResume }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.model.applyStartupOverlay", [request], cancellationToken); } /// Replaces or clears the host-supplied model allowlist for a running session. /// Exact model IDs to permit, or null to clear the host restriction. /// The to monitor for cancellation requests. The default is . /// The applied host allowlist and effective session model policy after intersection. public async Task SetAllowedModelsAsync(IList? allowedModels = null, CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new ModelSetAllowedModelsRequest { SessionId = _session.SessionId, AllowedModels = allowedModels }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.model.setAllowedModels", [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); } /// Lists models available to this session using its own auth and integration context. Connected hosts (CLI TUI, GitHub App) should call this through the session client so remote sessions return the remote CLI's available models rather than the caller's. /// Optional listing options. /// The to monitor for cancellation requests. The default is . /// The list of models available to this session. public async Task ListAsync(SessionModelListRequest? request = null, CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var rpcRequest = new SessionModelListRequestWithSession { SessionId = _session.SessionId, SkipCache = request?.SkipCache }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.model.list", [rpcRequest], 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. /// Session whose plan-mode base state should be inherited. /// Whether a dedicated plan model is configured. /// Dedicated model to use in plan mode, when configured. /// Reasoning effort to use with the dedicated plan model. /// Context tier to use with the dedicated plan model. /// Explicit response to a model-switch compaction preflight. /// Whether leaving plan mode should restore the session's previous model. /// Whether the selected plan model should be persisted. /// Settings context used when persisting the selected plan model. /// Action to perform when leaving plan mode. /// The to monitor for cancellation requests. The default is . /// Outcome of a session mode change, including any model switch it triggered and follow-up the host must perform. public async Task SetAsync(SessionMode mode, string? inheritPlanBaseFromSessionId = null, bool? planModelConfigured = null, string? planModel = null, string? planReasoningEffort = null, string? planContextTier = null, string? compactionDecision = null, bool? restorePlanModel = null, bool? persistPlanSelection = null, ModelPickerSettingsContext? pickerSettingsContext = null, string? planExitAction = null, CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new ModeSetRequest { SessionId = _session.SessionId, Mode = mode, InheritPlanBaseFromSessionId = inheritPlanBaseFromSessionId, PlanModelConfigured = planModelConfigured, PlanModel = planModel, PlanReasoningEffort = planReasoningEffort, PlanContextTier = planContextTier, CompactionDecision = compactionDecision, RestorePlanModel = restorePlanModel, PersistPlanSelection = persistPlanSelection, PickerSettingsContext = pickerSettingsContext, PlanExitAction = planExitAction }; return 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); } /// Reads todo rows from the session SQL database for plan rendering. /// The to monitor for cancellation requests. The default is . /// Todo rows read from the session SQL database. Empty when no session database is available. public async Task ReadSqlTodosAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionPlanReadSqlTodosRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.plan.readSqlTodos", [request], cancellationToken); } /// Reads todo rows AND dependency edges from the session SQL database for structured progress UI. Same defensive behavior as readSqlTodos — returns empty arrays when the database, tables, or columns aren't available. Clients should call this on session start and after every `session.todos_changed` event to refresh structured-UI rendering. /// The to monitor for cancellation requests. The default is . /// Todo rows + dependency edges read from the session SQL database. public async Task ReadSqlTodosWithDependenciesAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionPlanReadSqlTodosWithDependenciesRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.plan.readSqlTodosWithDependencies", [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); } /// Updates workspace metadata for a local session and returns the refreshed workspace. /// Opaque workspace context supplied by the session host. /// Optional workspace display name override. /// 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 UpdateMetadataAsync(object? context = null, string? name = null, CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new WorkspacesUpdateMetadataRequest { SessionId = _session.SessionId, Context = CopilotClient.ToJsonElementForWire(context), Name = name }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.workspaces.updateMetadata", [request], cancellationToken); } /// Ensures a local session workspace exists and returns it. /// Opaque workspace context supplied by the session host. /// 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 EnsureAsync(object? context = null, CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new WorkspacesEnsureRequest { SessionId = _session.SessionId, Context = CopilotClient.ToJsonElementForWire(context) }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.workspaces.ensure", [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); } /// Adds a compaction summary checkpoint to the local session workspace. /// Summary title shown in checkpoint listings. /// Markdown summary content to persist. /// The to monitor for cancellation requests. The default is . /// Persisted summary metadata and refreshed workspace metadata. public async Task AddSummaryAsync(string title, string content, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(title); ArgumentNullException.ThrowIfNull(content); _session.ThrowIfDisposed(); var request = new WorkspacesAddSummaryRequest { SessionId = _session.SessionId, Title = title, Content = content }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.workspaces.addSummary", [request], cancellationToken); } /// Truncates local workspace compaction summaries after a rollback. /// Number of newest summaries to keep. /// 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 TruncateSummariesAsync(long keepCount, CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new WorkspacesTruncateSummariesRequest { SessionId = _session.SessionId, KeepCount = keepCount }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.workspaces.truncateSummaries", [request], cancellationToken); } /// Reads the autopilot objective state file from the local session workspace. /// The to monitor for cancellation requests. The default is . /// Autopilot objective file content, or null when missing. public async Task ReadAutopilotObjectiveAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionWorkspacesReadAutopilotObjectiveRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.workspaces.readAutopilotObjective", [request], cancellationToken); } /// Writes the autopilot objective state file in the local session workspace. /// Autopilot objective file content. /// The to monitor for cancellation requests. The default is . /// Result of writing the autopilot objective file. public async Task WriteAutopilotObjectiveAsync(string content, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(content); _session.ThrowIfDisposed(); var request = new WorkspacesWriteAutopilotObjectiveRequest { SessionId = _session.SessionId, Content = content }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.workspaces.writeAutopilotObjective", [request], cancellationToken); } /// Deletes the autopilot objective state file from the local session workspace. /// The to monitor for cancellation requests. The default is . /// Result of deleting the autopilot objective file. public async Task DeleteAutopilotObjectiveAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionWorkspacesDeleteAutopilotObjectiveRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.workspaces.deleteAutopilotObjective", [request], cancellationToken); } /// Checks whether the local session workspace has an autopilot objective state file. /// The to monitor for cancellation requests. The default is . /// Whether the autopilot objective file exists. public async Task AutopilotObjectiveExistsAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionWorkspacesAutopilotObjectiveExistsRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.workspaces.autopilotObjectiveExists", [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); } /// Computes a diff for the session workspace. Never rejects for a busy session: a `session`-mode diff that cannot read the session's file-change captures falls back to an unstaged git diff with `isFallback: true` and reports why in `unavailableReason`. /// Diff mode requested by the client. /// When true, ignore whitespace-only changes (git `--ignore-all-space`). Defaults to false. /// The to monitor for cancellation requests. The default is . /// Workspace diff result for the requested mode. public async Task DiffAsync(WorkspaceDiffMode mode, bool? ignoreWhitespace = null, CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new WorkspacesDiffRequest { SessionId = _session.SessionId, Mode = mode, IgnoreWhitespace = ignoreWhitespace }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.workspaces.diff", [request], cancellationToken); } } /// Provides session-scoped AutopilotObjective APIs. [Experimental(Diagnostics.Experimental)] public sealed class AutopilotObjectiveApi { private readonly CopilotSession _session; internal AutopilotObjectiveApi(CopilotSession session) { _session = session; } /// Reads the current canonical autopilot objective state for this session. /// The to monitor for cancellation requests. The default is . /// Canonical runtime state for the session's current autopilot objective. public async Task GetStateAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionAutopilotObjectiveGetStateRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.autopilotObjective.getState", [request], cancellationToken); } } /// Provides session-scoped Completions APIs. [Experimental(Diagnostics.Experimental)] public sealed class CompletionsApi { private readonly CopilotSession _session; internal CompletionsApi(CopilotSession session) { _session = session; } /// Gets the characters that should trigger host-driven completions for the session. Empty disables host-driven completions (e.g. local sessions, or a relay host that does not advertise them). /// The to monitor for cancellation requests. The default is . /// Characters that, when typed in the composer, should trigger a `completions.request`. Empty when the session has no host-driven completions (e.g. local sessions, or a relay host that does not advertise `completionTriggerCharacters`). public async Task GetTriggerCharactersAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionCompletionsGetTriggerCharactersRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.completions.getTriggerCharacters", [request], cancellationToken); } /// Requests host-driven completion items for the current composer input. Returns an empty list when the host has no items or does not support completions. /// The full composed composer input. /// Cursor offset within `text`, in UTF-16 code units. /// The to monitor for cancellation requests. The default is . /// Host-driven completion items for the current composer input. Empty when the host returns no items or does not support completions. public async Task RequestAsync(string text, long offset, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(text); _session.ThrowIfDisposed(); var request = new CompletionsRequestRequest { SessionId = _session.SessionId, Text = text, Offset = offset }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.completions.request", [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 agents available to the session. Defaults to custom agents only; pass includeBuiltInAgents to include the effective built-in agents. /// Controls whether built-in agents and authored prompt text are included. /// The to monitor for cancellation requests. The default is . /// Agents available to the session. public async Task ListAsync(SessionAgentListRequest? request = null, CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var rpcRequest = new SessionAgentListRequestWithSession { SessionId = _session.SessionId, IncludeBuiltInAgents = request?.IncludeBuiltInAgents, IncludePrompt = request?.IncludePrompt }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.agent.list", [rpcRequest], cancellationToken); } /// Sets an in-memory authored prompt override for an available agent. For built-in agents, this replaces only the static base prompt while preserving runtime-owned dynamic prompt composition and behavior. The special `general-purpose` agent is not overrideable. Overrides are not persisted; resumed and forked sessions start without them, so the host must re-apply them. /// Stable effective agent id. Plugin namespace separators are normalized. /// Replacement authored prompt. Empty text is valid. /// The to monitor for cancellation requests. The default is . public async Task SetPromptAsync(string id, string prompt, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(id); ArgumentNullException.ThrowIfNull(prompt); _session.ThrowIfDisposed(); var request = new AgentSetPromptRequest { SessionId = _session.SessionId, Id = id, Prompt = prompt }; await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.agent.setPrompt", [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. /// Friendly, non-unique name used when displaying the agent. /// 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); } /// Registers a client-owned task, or reclaims an orphaned task belonging to the same extension principal. /// Task kind. /// Owner-scoped idempotency key used for registration and reclaim. /// Human-readable description of the external work. /// Whether the owner supports runtime cancellation requests. /// Optional short display name for the external work. /// Expected current sequence for idempotent registration or orphan reclaim. /// The to monitor for cancellation requests. The default is . /// Result of registering or reclaiming a client-owned task. public async Task RegisterAsync(TaskClientType type, string clientTaskId, string description, bool cancellable, string? displayName = null, long? expectedSequence = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(clientTaskId); ArgumentNullException.ThrowIfNull(description); _session.ThrowIfDisposed(); var request = new TasksRegisterRequest { SessionId = _session.SessionId, Type = type, ClientTaskId = clientTaskId, Description = description, Cancellable = cancellable, DisplayName = displayName, ExpectedSequence = expectedSequence }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.tasks.register", [request], cancellationToken); } /// Publishes generic progress or a terminal outcome for a client-owned task. /// Canonical runtime-generated task identifier. /// Owner update sequence to apply. /// Progress or terminal update payload. /// The to monitor for cancellation requests. The default is . /// Result of publishing a client-owned task update. public async Task UpdateAsync(string id, long sequence, TaskClientUpdate update, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(id); ArgumentNullException.ThrowIfNull(update); _session.ThrowIfDisposed(); var request = new TasksUpdateRequest { SessionId = _session.SessionId, Id = id, Sequence = sequence, Update = update }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.tasks.update", [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, their connection status, and host-level state. The host-level state (disabled/filtered servers, failed/needs-auth/pending connections, mcp3p policy, full config) is empty/zero when no MCP host has been initialized for the session. /// The to monitor for cancellation requests. The default is . /// MCP servers configured for the session, with their connection status and host-level state. 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); } /// Lists the tools exposed by a connected MCP server on this session's host. This performs a live `tools/list` request. Tool UI metadata is returned independently of whether MCP Apps rendering is enabled for the session. /// Name of the connected MCP server whose tools to list. /// The to monitor for cancellation requests. The default is . /// Tools exposed by the connected MCP server. Throws when the server is not connected. public async Task ListToolsAsync(string serverName, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(serverName); _session.ThrowIfDisposed(); var request = new McpListToolsRequest { SessionId = _session.SessionId, ServerName = serverName }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.mcp.listTools", [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); } /// Releases any turns waiting on an in-flight MCP load without cancelling the load, letting the agent proceed while MCP servers finish connecting in the background. No-op when no MCP load is in flight or waiting turns were already released. /// The to monitor for cancellation requests. The default is . /// Result of moving in-flight MCP loading to the background. public async Task MoveLoadingToBackgroundAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionMcpMoveLoadingToBackgroundRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.mcp.moveLoadingToBackground", [request], cancellationToken); } /// Reloads MCP server connections for the session with an explicit host-provided configuration. /// The to monitor for cancellation requests. The default is . /// MCP server startup filtering result. internal async Task ReloadWithConfigAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new McpReloadWithConfigRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.mcp.reloadWithConfig", [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); } /// Configures the built-in GitHub MCP server for the session's current auth context. /// The to monitor for cancellation requests. The default is . /// Result of configuring GitHub MCP. internal async Task ConfigureGitHubAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new McpConfigureGitHubRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.mcp.configureGitHub", [request], cancellationToken); } /// Starts an individual MCP server on the live session. Omit `config` for a config-free start-by-name of an already-configured server (reuses the server's already-registered configuration); supply `config` to start from a caller-supplied configuration. Session-scoped and ephemeral: the server is added to this session's running set only and is reaped when the session ends. Does NOT modify persistent user configuration (`mcp.config.*`), so it does not affect future sessions. The server surfaces through `session.mcp.list` and the `session.mcp_servers_loaded` / `session.mcp_server_status_changed` events like any other server. /// Name of the MCP server to start. /// MCP server configuration (stdio process or remote HTTP/SSE). Omit to start the server with its already-registered configuration (config-free start-by-name). /// The to monitor for cancellation requests. The default is . public async Task StartServerAsync(string serverName, object? config = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(serverName); _session.ThrowIfDisposed(); var request = new McpStartServerRequest { SessionId = _session.SessionId, ServerName = serverName, Config = CopilotClient.ToJsonElementForWire(config) }; await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.mcp.startServer", [request], cancellationToken); } /// Restarts an individual MCP server on the live session (stops then starts). Omit `config` for a config-free restart-by-name of an already-configured server; supply `config` to restart with a replacement configuration. Session-scoped and ephemeral: does NOT modify persistent user configuration (`mcp.config.*`). /// Name of the MCP server to restart. /// Replacement MCP server configuration (stdio process or remote HTTP/SSE). Omit to restart the server with its already-registered configuration (config-free restart-by-name). /// The to monitor for cancellation requests. The default is . public async Task RestartServerAsync(string serverName, object? config = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(serverName); _session.ThrowIfDisposed(); var request = new McpRestartServerRequest { SessionId = _session.SessionId, ServerName = serverName, Config = CopilotClient.ToJsonElementForWire(config) }; await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.mcp.restartServer", [request], cancellationToken); } /// Stops an individual MCP server on the session's host. /// Name of the MCP server to stop. /// The to monitor for cancellation requests. The default is . public async Task StopServerAsync(string serverName, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(serverName); _session.ThrowIfDisposed(); var request = new McpStopServerRequest { SessionId = _session.SessionId, ServerName = serverName }; await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.mcp.stopServer", [request], cancellationToken); } /// Registers a pre-connected external MCP client (e.g. IDE) on the session's host. The caller retains lifecycle ownership of the client and transport. Marked internal because the `client` and `transport` arguments are in-process MCP SDK instances that cannot be serialized across the JSON-RPC boundary; once the CLI moves on top of the SDK, external clients will be expressed as transport configs the runtime can construct itself. /// Logical server name for the external client. /// The to monitor for cancellation requests. The default is . internal async Task RegisterExternalClientAsync(string serverName, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(serverName); _session.ThrowIfDisposed(); var request = new McpRegisterExternalClientRequest { SessionId = _session.SessionId, ServerName = serverName }; await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.mcp.registerExternalClient", [request], cancellationToken); } /// Unregisters a previously registered external MCP client by server name. Marked internal as the paired companion of `registerExternalClient`: only in-process callers that registered a client this way can meaningfully unregister it. Disappears alongside `registerExternalClient`: once external clients are described to the runtime as config rather than handed in as instances, lifecycle (including deregistration) is owned entirely by the runtime. /// Server name of the external client to unregister. /// The to monitor for cancellation requests. The default is . internal async Task UnregisterExternalClientAsync(string serverName, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(serverName); _session.ThrowIfDisposed(); var request = new McpUnregisterExternalClientRequest { SessionId = _session.SessionId, ServerName = serverName }; await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.mcp.unregisterExternalClient", [request], cancellationToken); } /// Checks whether a named MCP server is currently running on the session's host. /// Name of the MCP server to check. /// The to monitor for cancellation requests. The default is . /// Whether the named MCP server is running. public async Task IsServerRunningAsync(string serverName, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(serverName); _session.ThrowIfDisposed(); var request = new McpIsServerRunningRequest { SessionId = _session.SessionId, ServerName = serverName }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.mcp.isServerRunning", [request], cancellationToken); } /// Oauth APIs. public McpOauthApi Oauth => field ?? Interlocked.CompareExchange(ref field, new(_session), null) ?? field; /// Headers APIs. public McpHeadersApi Headers => field ?? Interlocked.CompareExchange(ref field, new(_session), null) ?? field; /// Apps APIs. public McpAppsApi Apps => field ?? Interlocked.CompareExchange(ref field, new(_session), null) ?? field; /// Resources APIs. public McpResourcesApi Resources => 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; } /// Resolves a pending MCP OAuth request with a host-provided token or cancellation. The pending request is emitted as mcp.oauth_required with the data necessary to authorize the request. /// OAuth request identifier from the mcp.oauth_required event. /// Host response to the pending OAuth request. /// The to monitor for cancellation requests. The default is . /// Indicates whether the pending MCP OAuth response was accepted. public async Task HandlePendingRequestAsync(string requestId, McpOauthPendingRequestResponse result, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(requestId); ArgumentNullException.ThrowIfNull(result); _session.ThrowIfDisposed(); var request = new McpOauthHandlePendingRequest { SessionId = _session.SessionId, RequestId = requestId, Result = result }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.mcp.oauth.handlePendingRequest", [request], cancellationToken); } /// Notifies the session that MCP OAuth authentication succeeded and updated credentials were persisted, so cached tool definitions can be refreshed. /// Name of the MCP server whose OAuth credentials were updated. Omit only when the host cannot identify the server. /// Whether the target session must mint a session-scoped access token instead of reusing a shared access token persisted by another session. /// The to monitor for cancellation requests. The default is . public async Task AuthenticationStateChangedAsync(string? serverName = null, bool? refreshSessionToken = null, CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new McpOauthAuthenticationStateChangedRequest { SessionId = _session.SessionId, ServerName = serverName, RefreshSessionToken = refreshSessionToken }; await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.mcp.oauth.authenticationStateChanged", [request], cancellationToken); } /// 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. /// Optional OAuth client ID override for this login. When set, the runtime uses this pre-registered static client instead of dynamic client registration. /// Optional OAuth client secret override for this login. The runtime treats this as an ephemeral host-owned secret, uses it for this authentication attempt and does not persist it. /// Optional override indicating whether the static OAuth client is public. When false, the runtime treats it as confidential and uses the per-login clientSecret if provided, otherwise retrieving the client secret from the MCP OAuth secret store. /// Optional OAuth grant type override for this login. Defaults to the server configuration, or authorization_code when no grant type is specified. /// 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, string? clientId = null, string? clientSecret = null, bool? publicClient = null, McpOauthLoginGrantType? grantType = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(serverName); _session.ThrowIfDisposed(); var request = new McpOauthLoginRequest { SessionId = _session.SessionId, ServerName = serverName, ForceReauth = forceReauth, ClientName = clientName, CallbackSuccessMessage = callbackSuccessMessage, ClientId = clientId, ClientSecret = clientSecret, PublicClient = publicClient, GrantType = grantType }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.mcp.oauth.login", [request], cancellationToken); } /// Passively probes a configured remote MCP server to classify whether OAuth is required or a cached/override token is accepted. Does not start OAuth, emit pending OAuth requests, or mutate MCP connection state. /// Name of the configured remote MCP server to probe. /// The to monitor for cancellation requests. The default is . /// Passive MCP OAuth probe result. `authenticated` means the server accepted the probe request while an OAuth-origin access token was attached; it does not prove the server required or independently validated that token. The probe does not make a second unauthenticated request. Failed is an expected probe-domain outcome; JSON-RPC errors are reserved for API-call failures. public async Task ProbeAsync(string serverName, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(serverName); _session.ThrowIfDisposed(); var request = new McpOauthProbeRequest { SessionId = _session.SessionId, ServerName = serverName }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.mcp.oauth.probe", [request], cancellationToken); } /// Responds to a pending MCP OAuth authorization request by its request id. /// OAuth request identifier from the mcp.oauth_required event. /// The to monitor for cancellation requests. The default is . /// Indicates whether the pending MCP OAuth response was accepted. public async Task RespondAsync(string requestId, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(requestId); _session.ThrowIfDisposed(); var request = new McpOauthRespondRequest { SessionId = _session.SessionId, RequestId = requestId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.mcp.oauth.respond", [request], cancellationToken); } } /// Provides session-scoped McpHeaders APIs. [Experimental(Diagnostics.Experimental)] public sealed class McpHeadersApi { private readonly CopilotSession _session; internal McpHeadersApi(CopilotSession session) { _session = session; } /// Responds to a pending MCP dynamic headers refresh request. Hosts that subscribe to `mcp.headers_refresh_required` use this to provide short-lived per-server headers or to indicate that no dynamic headers are available for this refresh. /// Headers refresh request identifier from mcp.headers_refresh_required. /// Host response: supply dynamic headers or decline this refresh. /// The to monitor for cancellation requests. The default is . /// Indicates whether the pending MCP headers refresh response was accepted. public async Task HandlePendingHeadersRefreshRequestAsync(string requestId, McpHeadersHandlePendingHeadersRefreshRequest result, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(requestId); ArgumentNullException.ThrowIfNull(result); _session.ThrowIfDisposed(); var request = new McpHeadersHandlePendingHeadersRefreshRequestRequest { SessionId = _session.SessionId, RequestId = requestId, Result = result }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.mcp.headers.handlePendingHeadersRefreshRequest", [request], cancellationToken); } } /// Provides session-scoped McpApps APIs. [Experimental(Diagnostics.Experimental)] public sealed class McpAppsApi { private readonly CopilotSession _session; internal McpAppsApi(CopilotSession session) { _session = session; } /// Fetch an MCP resource (typically a `ui://` MCP App bundle, per SEP-1865) from a connected server. Requires the `mcp-apps` session capability. /// Name of the MCP server hosting the resource. /// Resource URI (typically ui://...). /// The to monitor for cancellation requests. The default is . /// Resource contents returned by the MCP server. public async Task ReadResourceAsync(string serverName, string uri, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(serverName); ArgumentNullException.ThrowIfNull(uri); _session.ThrowIfDisposed(); var request = new McpAppsReadResourceRequest { SessionId = _session.SessionId, ServerName = serverName, Uri = uri }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.mcp.apps.readResource", [request], cancellationToken); } /// List tools that an MCP App view is allowed to call (SEP-1865 visibility filter). Returns tools whose `_meta.ui.visibility` is unset (default `["model","app"]`) or includes `"app"`. /// MCP server hosting the app. /// **Required.** Server whose ui:// view issued the request. Per SEP-1865 ('callable by the app from this server only'), the call is rejected when this differs from `serverName`, and rejected outright when missing. /// The to monitor for cancellation requests. The default is . /// App-callable tools from the named MCP server. public async Task ListToolsAsync(string serverName, string originServerName, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(serverName); ArgumentNullException.ThrowIfNull(originServerName); _session.ThrowIfDisposed(); var request = new McpAppsListToolsRequest { SessionId = _session.SessionId, ServerName = serverName, OriginServerName = originServerName }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.mcp.apps.listTools", [request], cancellationToken); } /// Call an MCP tool from an MCP App view (SEP-1865). Enforces the visibility check that prevents an app iframe from invoking model-only tools. Returns the standard MCP `CallToolResult`. /// MCP server hosting the tool. /// MCP tool name. /// **Required.** Server whose ui:// view issued the request. Per SEP-1865 ('callable by the app from this server only'), the call is rejected when this differs from `serverName`, and rejected outright when missing. /// Tool arguments. /// The to monitor for cancellation requests. The default is . /// Standard MCP CallToolResult. public async Task> CallToolAsync(string serverName, string toolName, string originServerName, IDictionary? arguments = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(serverName); ArgumentNullException.ThrowIfNull(toolName); ArgumentNullException.ThrowIfNull(originServerName); _session.ThrowIfDisposed(); var request = new McpAppsCallToolRequest { SessionId = _session.SessionId, ServerName = serverName, ToolName = toolName, OriginServerName = originServerName, Arguments = arguments }; return await CopilotClient.InvokeRpcAsync>(_session.Rpc, "session.mcp.apps.callTool", [request], cancellationToken); } /// Replace the host context returned to MCP App guests on `ui/initialize`. Hosts use this to advertise theme, locale, or other metadata to the guest UI. /// Host context advertised to MCP App guests. /// The to monitor for cancellation requests. The default is . public async Task SetHostContextAsync(McpAppsSetHostContextDetails context, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(context); _session.ThrowIfDisposed(); var request = new McpAppsSetHostContextRequest { SessionId = _session.SessionId, Context = context }; await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.mcp.apps.setHostContext", [request], cancellationToken); } /// Read the current host context advertised to MCP App guests. /// The to monitor for cancellation requests. The default is . /// Current host context advertised to MCP App guests. public async Task GetHostContextAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionMcpAppsGetHostContextRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.mcp.apps.getHostContext", [request], cancellationToken); } /// Diagnose MCP Apps wiring for a specific MCP server. Reports the session capability, feature-flag state, advertised extension, and how many tools have `_meta.ui` populated. /// MCP server to probe. /// The to monitor for cancellation requests. The default is . /// Diagnostic snapshot of MCP Apps wiring for the named server. public async Task DiagnoseAsync(string serverName, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(serverName); _session.ThrowIfDisposed(); var request = new McpAppsDiagnoseRequest { SessionId = _session.SessionId, ServerName = serverName }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.mcp.apps.diagnose", [request], cancellationToken); } } /// Provides session-scoped McpResources APIs. [Experimental(Diagnostics.Experimental)] public sealed class McpResourcesApi { private readonly CopilotSession _session; internal McpResourcesApi(CopilotSession session) { _session = session; } /// Fetch an MCP resource from a connected server by URI (proxies MCP `resources/read`). /// Name of the MCP server hosting the resource. /// Resource URI. /// The to monitor for cancellation requests. The default is . /// Resource contents returned by the MCP server. public async Task ReadAsync(string serverName, string uri, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(serverName); ArgumentNullException.ThrowIfNull(uri); _session.ThrowIfDisposed(); var request = new McpResourcesReadRequest { SessionId = _session.SessionId, ServerName = serverName, Uri = uri }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.mcp.resources.read", [request], cancellationToken); } /// Enumerate one page of resources a connected MCP server exposes (proxies MCP `resources/list`). Pass `cursor` to continue from a prior result's `nextCursor`. /// Name of the MCP server whose resources to enumerate. /// Opaque MCP pagination cursor from a prior `nextCursor` value. /// The to monitor for cancellation requests. The default is . /// One page of resources advertised by the named MCP server. public async Task ListAsync(string serverName, string? cursor = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(serverName); _session.ThrowIfDisposed(); var request = new McpResourcesListRequest { SessionId = _session.SessionId, ServerName = serverName, Cursor = cursor }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.mcp.resources.list", [request], cancellationToken); } /// Enumerate one page of resource templates a connected MCP server exposes (proxies MCP `resources/templates/list`). Pass `cursor` to continue from a prior result's `nextCursor`. /// Name of the MCP server whose resource templates to enumerate. /// Opaque MCP pagination cursor from a prior `nextCursor` value. /// The to monitor for cancellation requests. The default is . /// One page of resource templates advertised by the named MCP server. public async Task ListTemplatesAsync(string serverName, string? cursor = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(serverName); _session.ThrowIfDisposed(); var request = new McpResourcesListTemplatesRequest { SessionId = _session.SessionId, ServerName = serverName, Cursor = cursor }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.mcp.resources.listTemplates", [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); } /// Reloads the session's plugin set, refreshing MCP servers, custom agents, hooks, and skills cache so SDK-driven changes via `server.plugins.*` take effect immediately. /// Optional flags controlling which side effects the reload performs. /// The to monitor for cancellation requests. The default is . public async Task ReloadAsync(SessionPluginsReloadRequest? request = null, CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var rpcRequest = new SessionPluginsReloadRequestWithSession { SessionId = _session.SessionId, ReloadMcp = request?.ReloadMcp, ReloadCustomAgents = request?.ReloadCustomAgents, ReloadHooks = request?.ReloadHooks, ReloadExtensions = request?.ReloadExtensions, DeferRepoHooks = request?.DeferRepoHooks }; await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.plugins.reload", [rpcRequest], cancellationToken); } } /// Provides session-scoped Provider APIs. [Experimental(Diagnostics.Experimental)] public sealed class ProviderApi { private readonly CopilotSession _session; internal ProviderApi(CopilotSession session) { _session = session; } /// Returns the provider endpoint and credentials the session is currently configured to talk to, so the caller can make inference calls directly against the same backend the session uses. /// Optional model identifier to scope the endpoint snapshot to. /// The to monitor for cancellation requests. The default is . /// A snapshot of the provider endpoint the session is currently configured to talk to. public async Task GetEndpointAsync(SessionProviderGetEndpointRequest? request = null, CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var rpcRequest = new SessionProviderGetEndpointRequestWithSession { SessionId = _session.SessionId, ModelId = request?.ModelId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.provider.getEndpoint", [rpcRequest], cancellationToken); } /// Adds BYOK providers and/or models to the session's registry at runtime, extending the additive registry built from the session's `providers`/`models` options. Both fields are optional, so a call may add providers only, models only, or both. Within a single call providers are registered before models, so a model may reference a provider added in the same call; across calls a model may reference any provider already registered (from session creation or a prior add). A model whose referenced provider is not registered by the end of the call is rejected. Newly added models become selectable via `model.list` / `model.switchTo` and are inherited by sub-agents spawned afterwards. /// Named BYOK provider connections to register, additive to any providers already in the registry. Each name must be unique across the registry and must not contain '/'. /// BYOK model definitions to register. Each must reference a provider that is already registered or included in this same call. Selection ids (`provider/id`) must be unique across the registry. /// The to monitor for cancellation requests. The default is . /// The selectable model entries synthesized for the models added by this call. public async Task AddAsync(IList? providers = null, IList? models = null, CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new ProviderAddRequest { SessionId = _session.SessionId, Providers = providers, Models = models }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.provider.add", [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. /// Per-property model capability overrides for the selected model. /// Reasoning effort for the selected model. CAPI values are model-defined and validated against the selected model; BYOK providers may define additional values. When omitted, no effort override is applied. /// Reasoning summary mode for supported model clients. /// Output verbosity level for supported models. /// 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). /// Options scoped to the built-in CAPI (Copilot API) provider. /// Absolute working-directory path for shell tools. /// Allowlist of tool names available to this session. /// Denylist of tool names for this session. /// Built-in subagent names to include in this session. When specified, only these built-ins are available, subject to runtime availability and exclusions. Custom agents with the same name remain available. Set to null to remove the allowlist restriction. /// Built-in subagent names to exclude from this session. Excluded built-ins are hidden from agent discovery and cannot be dispatched unless a custom agent with the same name is available. /// Controls how availableTools (allowlist) and excludedTools (denylist) combine when both are set. /// Whether shell-script safety heuristics are enabled. /// Per-session settings for built-in shell tools. /// Use shell.initProfile instead. Shell init profile (`None` or `NonInteractive`). /// PowerShell process flags applied to built-in and user-requested shell commands. /// Resolved sandbox configuration. /// Origin of the sandbox choice. The runtime uses this only for internal telemetry provenance; managed policy is derived independently. /// Whether interactive shell sessions are logged. /// How env values are passed to MCP servers (`direct` inlines literal values; `indirect` resolves at launch). /// Whether to include instructions from every MCP server in the system prompt instead of only allowlisted servers. /// Additional directories to search for skills. /// Built-in skill names to include in this session. When specified, only these runtime-bundled skills are available. Skills from other sources with the same name remain available. Set to null to remove the allowlist restriction. /// 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`. /// Maximum decoded byte size of a single model-facing binary tool result (e.g. an image) persisted inline in session events and re-presented to the model on later turns / resume. Larger results are persisted as a metadata-only marker and shown to the model as a short text note. Defaults to 10 MB. /// 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. /// When true, the selected custom agent's prompt is not injected into the user message (skill context is still injected). Used by automation triggers where the agent prompt is already in the problem statement. /// 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. /// Whether subagent callback events should be forwarded into the session event log sink. /// Additional content-exclusion policies to merge into the session's policy 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). /// Replaces the session's capability set with the given list. Use to enable or disable capabilities mid-session (e.g., remove `memory` for reproducible scripted runs). Omit the field to leave the existing capability set unchanged. /// Whether to skip embedding retrieval pipeline initialization and execution. /// Organization-level custom instructions to inject into the system prompt. /// Whether to enable loading of `.github/hooks/` filesystem hooks. Separate from the SDK callback hook mechanism. /// Whether to enable host git operations (context resolution, child repo scanning, git info in system prompt). /// Whether to enable cross-session store writes and reads. /// Whether skill loading is enabled. Explicit false disables every source, including a bound SDK provider; changing the value invalidates the loaded skill snapshot. When omitted, creation falls back to enableConfigDiscovery unless an SDK skill provider is registered. /// Context tier for models with tiered pricing. The session uses this to derive effective `modelCapabilitiesOverrides` so compaction, truncation, token display, and request limits honor the selected tier. /// Optional session limits. Pass null to clear the session limits. /// 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, ModelCapabilitiesOverride? modelCapabilitiesOverrides = null, string? reasoningEffort = null, OptionsUpdateReasoningSummary? reasoningSummary = null, Verbosity? verbosity = null, string? clientName = null, string? lspClientName = null, string? integrationId = null, IDictionary? featureFlags = null, bool? isExperimentalMode = null, ProviderConfig? provider = null, CapiSessionOptions? capi = null, string? workingDirectory = null, IList? availableTools = null, IList? excludedTools = null, IList? includedBuiltinAgents = null, IList? excludedBuiltinAgents = null, OptionsUpdateToolFilterPrecedence? toolFilterPrecedence = null, bool? enableScriptSafety = null, ShellOptions? shell = null, string? shellInitProfile = null, IList? shellProcessFlags = null, SandboxConfig? sandboxConfig = null, SandboxConfigSource? sandboxConfigSource = null, bool? logInteractiveShells = null, OptionsUpdateEnvValueMode? envValueMode = null, bool? allowAllMcpServerInstructions = null, IList? skillDirectories = null, IList? includedBuiltinSkills = null, IList? disabledSkills = null, bool? enableOnDemandInstructionDiscovery = null, long? maxInlineBinaryBytes = null, IList? installedPlugins = null, bool? customAgentsLocalOnly = null, bool? suppressCustomAgentPrompt = 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, bool? eventsLogIncludesSubagents = null, IList? additionalContentExclusionPolicies = null, bool? manageScheduleEnabled = null, IList? sessionCapabilities = null, bool? skipEmbeddingRetrieval = null, string? organizationCustomInstructions = null, bool? enableFileHooks = null, bool? enableHostGitOperations = null, bool? enableSessionStore = null, bool? enableSkills = null, OptionsUpdateContextTier? contextTier = null, SessionLimitsConfig? sessionLimits = null, CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionUpdateOptionsParams { SessionId = _session.SessionId, Model = model, ModelCapabilitiesOverrides = modelCapabilitiesOverrides, ReasoningEffort = reasoningEffort, ReasoningSummary = reasoningSummary, Verbosity = verbosity, ClientName = clientName, LspClientName = lspClientName, IntegrationId = integrationId, FeatureFlags = featureFlags, IsExperimentalMode = isExperimentalMode, Provider = provider, Capi = capi, WorkingDirectory = workingDirectory, AvailableTools = availableTools, ExcludedTools = excludedTools, IncludedBuiltinAgents = includedBuiltinAgents, ExcludedBuiltinAgents = excludedBuiltinAgents, ToolFilterPrecedence = toolFilterPrecedence, EnableScriptSafety = enableScriptSafety, Shell = shell, ShellInitProfile = shellInitProfile, ShellProcessFlags = shellProcessFlags, SandboxConfig = sandboxConfig, SandboxConfigSource = sandboxConfigSource, LogInteractiveShells = logInteractiveShells, EnvValueMode = envValueMode, AllowAllMcpServerInstructions = allowAllMcpServerInstructions, SkillDirectories = skillDirectories, IncludedBuiltinSkills = includedBuiltinSkills, DisabledSkills = disabledSkills, EnableOnDemandInstructionDiscovery = enableOnDemandInstructionDiscovery, MaxInlineBinaryBytes = maxInlineBinaryBytes, InstalledPlugins = installedPlugins, CustomAgentsLocalOnly = customAgentsLocalOnly, SuppressCustomAgentPrompt = suppressCustomAgentPrompt, SkipCustomInstructions = skipCustomInstructions, DisabledInstructionSources = disabledInstructionSources, CoauthorEnabled = coauthorEnabled, TrajectoryFile = trajectoryFile, EnableStreaming = enableStreaming, CopilotUrl = copilotUrl, AskUserDisabled = askUserDisabled, ContinueOnAutoMode = continueOnAutoMode, RunningInInteractiveMode = runningInInteractiveMode, EnableReasoningSummaries = enableReasoningSummaries, AgentContext = agentContext, EventsLogDirectory = eventsLogDirectory, EventsLogIncludesSubagents = eventsLogIncludesSubagents, AdditionalContentExclusionPolicies = additionalContentExclusionPolicies, ManageScheduleEnabled = manageScheduleEnabled, SessionCapabilities = sessionCapabilities, SkipEmbeddingRetrieval = skipEmbeddingRetrieval, OrganizationCustomInstructions = organizationCustomInstructions, EnableFileHooks = enableFileHooks, EnableHostGitOperations = enableHostGitOperations, EnableSessionStore = enableSessionStore, EnableSkills = enableSkills, ContextTier = contextTier, SessionLimits = sessionLimits }; 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); } /// Push attachments into the next user-message turn from an extension. The host should surface them as composer pills and forward them via the next session.send call. Callable only by extension-owned connections. /// Attachments to push into the next user-message turn. extension_context entries take the slim shape; standard variants take their full AttachmentSchema shape. /// Optional canvas instance binding the push for provenance. When supplied, the runtime resolves the canvas, verifies it is owned by the calling extension, and stamps canvasId/instanceId onto each extension_context entry. When omitted, no resolution runs and those fields stay unset on the attachment. /// The to monitor for cancellation requests. The default is . public async Task SendAttachmentsToMessageAsync(IList attachments, string? instanceId = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(attachments); _session.ThrowIfDisposed(); var request = new SendAttachmentsToMessageParams { SessionId = _session.SessionId, Attachments = attachments, InstanceId = instanceId }; await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.extensions.sendAttachmentsToMessage", [request], cancellationToken); } } /// Provides session-scoped Tools APIs. [Experimental(Diagnostics.Experimental)] public sealed class ToolsApi { private readonly CopilotSession _session; internal ToolsApi(CopilotSession session) { _session = session; } /// Executes one tool from the session's currently offered tool set through the native invocation pipeline. /// Name of the currently offered tool to execute. /// Arguments supplied to the tool. /// Optional identifier used to correlate this invocation with its tool call. /// The to monitor for cancellation requests. The default is . /// Canonical result returned by a session tool. public async Task ExecuteAsync(string name, object arguments, string? toolCallId = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(name); ArgumentNullException.ThrowIfNull(arguments); _session.ThrowIfDisposed(); var request = new ToolsExecuteRequest { SessionId = _session.SessionId, Name = name, Arguments = CopilotClient.ToJsonElementForWire(arguments)!.Value, ToolCallId = toolCallId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.tools.execute", [request], cancellationToken); } /// Returns the Rust-owned built-in tool descriptors used to construct the session's offered tool set. /// Whether descriptors should favor fewer user-intervention prompts. /// Whether tool descriptors should include authoring metadata. /// Whether semantic skill lookup is available. /// Shell-specific names and description lines for shell tools. /// Whether the configured shell supports PowerShell 7 syntax. /// Default shell timeout in milliseconds. /// Whether background task completion notifications are enabled. /// The to monitor for cancellation requests. The default is . /// Rust-owned built-in tool descriptors for the session. public async Task GetBuiltinDescriptorsAsync(bool? reduceUserIntervention = null, bool? includeAuthor = null, bool? skillEmbeddingEnabled = null, ToolsShellDescriptorConfig? shellConfig = null, bool? shellSupportsPowerShell7Syntax = null, double? shellTimeoutMs = null, bool? backgroundTaskNotificationsEnabled = null, CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new ToolsGetBuiltinDescriptorsRequest { SessionId = _session.SessionId, ReduceUserIntervention = reduceUserIntervention, IncludeAuthor = includeAuthor, SkillEmbeddingEnabled = skillEmbeddingEnabled, ShellConfig = shellConfig, ShellSupportsPowerShell7Syntax = shellSupportsPowerShell7Syntax, ShellTimeoutMs = shellTimeoutMs, BackgroundTaskNotificationsEnabled = backgroundTaskNotificationsEnabled }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.tools.getBuiltinDescriptors", [request], cancellationToken); } /// Projects a completed task_complete tool call into its label-safe session event payload. /// Arguments supplied to the completed task_complete tool call. /// Final expanded result returned by the task_complete tool. /// The to monitor for cancellation requests. The default is . /// Task completion notification with summary from the agent. public async Task TaskCompleteEventDataAsync(object toolArgs, ToolResultExpanded finalResult, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(toolArgs); ArgumentNullException.ThrowIfNull(finalResult); _session.ThrowIfDisposed(); var request = new ToolsTaskCompleteEventDataRequest { SessionId = _session.SessionId, ToolArgs = CopilotClient.ToJsonElementForWire(toolArgs)!.Value, FinalResult = finalResult }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.tools.taskCompleteEventData", [request], cancellationToken); } /// 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); } /// Returns lightweight metadata for the session's currently initialized tools. /// The to monitor for cancellation requests. The default is . /// Current lightweight tool metadata snapshot for the session. public async Task GetCurrentMetadataAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionToolsGetCurrentMetadataRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.tools.getCurrentMetadata", [request], cancellationToken); } /// Atomically replaces the complete externally implemented tool list supplied by the calling connection. Built-in, MCP/plugin, extension-discovered, subagent, and tools supplied by other connections remain unchanged. /// Complete replacement list for the calling connection. /// The to monitor for cancellation requests. The default is . /// Empty result after replacing the calling connection's externally implemented tools. public async Task SetAsync(IList tools, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(tools); _session.ThrowIfDisposed(); var request = new ToolsSetRequest { SessionId = _session.SessionId, Tools = tools }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.tools.set", [request], cancellationToken); } /// Sets the current session's live subagent settings override, which takes precedence over persisted user settings until cleared. Persisted user settings remain the source of truth for future sessions. /// Subagent settings to apply, or null to clear the live session override. /// The to monitor for cancellation requests. The default is . /// Empty result after applying subagent settings. public async Task UpdateSubagentSettingsAsync(UpdateSubagentSettingsRequestSubagents? subagents = null, CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new UpdateSubagentSettingsRequest { SessionId = _session.SessionId, Subagents = subagents }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.tools.updateSubagentSettings", [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(SessionCommandsListRequest? request = null, CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var rpcRequest = new SessionCommandsListRequestWithSession { 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. /// Optional client surface that initiated the invocation. /// The to monitor for cancellation requests. The default is . /// Result of invoking the slash command (text output, prompt to send to the agent, completion, or subcommand selection). public async Task InvokeAsync(string name, string? input = null, CommandsInvocationOrigin? origin = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(name); _session.ThrowIfDisposed(); var request = new CommandsInvokeRequest { SessionId = _session.SessionId, Name = name, Input = input, Origin = origin }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.commands.invoke", [request], cancellationToken); } /// Finalizes persistence associated with a client-applied slash-command effect. /// The slash-command result object that produced the pending effect, echoed back unchanged. /// Whether the host applied or cancelled the pending invocation effect. /// The to monitor for cancellation requests. The default is . /// Whether finalizing the invocation effect succeeded, and the failure reason when it did not. internal async Task FinalizeInvocationEffectAsync(CommandsFinalizeInvocationEffectRequestEffect effect, CommandsInvocationEffectOutcome outcome, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(effect); _session.ThrowIfDisposed(); var request = new CommandsFinalizeInvocationEffectRequest { SessionId = _session.SessionId, Effect = effect, Outcome = outcome }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.commands.finalizeInvocationEffect", [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. /// Optional user-facing text for the queue row. The command string is shown when omitted. /// 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, string? displayText = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(command); _session.ThrowIfDisposed(); var request = new EnqueueCommandParams { SessionId = _session.SessionId, Command = command, DisplayText = displayText }; 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; } /// Gets the telemetry engagement ID currently associated with the session, when available. /// The to monitor for cancellation requests. The default is . /// Telemetry engagement ID for the session, when available. public async Task GetEngagementIdAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionTelemetryGetEngagementIdRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.telemetry.getEngagementId", [request], cancellationToken); } /// 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; } /// Runs a transient no-tools model query against the current conversation context. /// Question to answer from the current conversation context. /// The to monitor for cancellation requests. The default is . /// Completed transient query. Ordered chunks and the terminal outcome are also delivered through `ui.ephemeral_query` session events while it runs. public async Task EphemeralQueryAsync(string question, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(question); _session.ThrowIfDisposed(); var request = new UIEphemeralQueryRequest { SessionId = _session.SessionId, Question = question }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.ui.ephemeralQuery", [request], cancellationToken); } /// 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. /// Elicitation mode. Omitted and form are equivalent for structured elicitation. /// MCP request metadata. /// MCP task metadata. /// 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, McpElicitationFormMode? mode = null, UIElicitationRequestMeta? _meta = null, McpTaskMetadata? task = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(message); ArgumentNullException.ThrowIfNull(requestedSchema); _session.ThrowIfDisposed(); var request = new UIElicitationRequest { SessionId = _session.SessionId, Message = message, RequestedSchema = requestedSchema, Mode = mode, Meta = _meta, Task = task }; 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. /// User response for a pending user-input request, with answer text and whether it was typed freeform. /// 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 `session_limits_exhausted.requested` event with the user's selected limit action. /// The unique request ID from the session_limits_exhausted.requested event. /// The selected session-limit action. /// The to monitor for cancellation requests. The default is . /// Indicates whether the pending UI request was resolved by this call. public async Task HandlePendingSessionLimitsExhaustedAsync(string requestId, UISessionLimitsExhaustedResponse response, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(requestId); ArgumentNullException.ThrowIfNull(response); _session.ThrowIfDisposed(); var request = new UIHandlePendingSessionLimitsExhaustedRequest { SessionId = _session.SessionId, RequestId = requestId, Response = response }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.ui.handlePendingSessionLimitsExhausted", [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. /// User response for a pending exit-plan-mode request, with approval state, selected action, auto-approve flag, and feedback. /// 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. /// Optional informational context describing how and where this response was made. Omit it to preserve legacy behavior without attributing an origin. /// 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, PermissionDecisionContext? decisionContext = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(requestId); ArgumentNullException.ThrowIfNull(result); _session.ThrowIfDisposed(); var request = new PermissionDecisionRequest { SessionId = _session.SessionId, RequestId = requestId, Result = result, DecisionContext = decisionContext }; 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); } /// Sets the permission mode for the session. `manual` follows the normal approval flow, `assisted` attaches LLM safety recommendations, and `allow-all` automatically approves permission requests. The result returns the authoritative post-mutation mode so callers can update local state without racing the `session.permissions_changed` notification. /// Permission mode to apply. /// Optional judge model id for assisted mode. When omitted, the session resolves the provider default: `gpt-5.5` for CAPI sessions and the active session model for BYOK sessions. /// Optional source for permission-mode telemetry. Defaults to `rpc` when omitted for SDK callers. /// The to monitor for cancellation requests. The default is . /// Indicates whether the requested permission mode was applied and reports the authoritative post-mutation mode. public async Task SetModeAsync(PermissionMode mode, string? assistedApprovalModel = null, PermissionModeSource? source = null, CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new PermissionsSetModeRequest { SessionId = _session.SessionId, Mode = mode, AssistedApprovalModel = assistedApprovalModel, Source = source }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.permissions.setMode", [request], cancellationToken); } /// Returns the current permission mode for the session. /// The to monitor for cancellation requests. The default is . /// Current permission mode. public async Task GetModeAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new PermissionsGetModeRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.permissions.getMode", [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. /// Whether location-scoped approvals are cleared too. Defaults to `true`. /// The to monitor for cancellation requests. The default is . /// Indicates whether the operation succeeded. public async Task ResetSessionApprovalsAsync(bool? includeLocation = null, CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new PermissionsResetSessionApprovalsRequest { SessionId = _session.SessionId, IncludeLocation = includeLocation }; 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 and activates conventional skill and agent definitions under it. /// Directory to add to the allow-list. The runtime resolves and validates the path before adding, then loads conventional `.github/skills/` and `.github/agents/` definitions under it when their subsystem gates are enabled. Adding the directory is therefore also a trust decision for configuration stored there. /// 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); } /// Returns the client-owned string metadata persisted with this local session. The metadata is not included in model context, events, telemetry, snapshots, or remote exports. /// The to monitor for cancellation requests. The default is . /// Client-owned, case-sensitive string metadata persisted with a local session. Clients should namespace keys by owner. Keys must be non-empty and at most 256 UTF-8 bytes; keys under `copilot/` and `github/` are reserved. Values may contain at most 16 KiB of UTF-8 data. A bag may contain at most 128 entries and its serialized sidecar may contain at most 64 KiB. The runtime stores but never interprets these values. public async Task> GetClientMetadataAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionMetadataGetClientMetadataRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync>(_session.Rpc, "session.metadata.getClientMetadata", [request], cancellationToken); } /// Atomically patches the client-owned string metadata persisted with this local session and returns the committed bag. /// Remove every existing client metadata entry before applying remove and set. Defaults to false. /// Case-sensitive keys to remove. Missing keys are ignored. Each key must be non-empty, at most 256 UTF-8 bytes, and outside the reserved `copilot/` and `github/` namespaces. /// String entries to add or replace. Set wins when a key also appears in remove. Each key must be non-empty, at most 256 UTF-8 bytes, and outside the reserved `copilot/` and `github/` namespaces. Each value may contain at most 16 KiB of UTF-8 data. /// The to monitor for cancellation requests. The default is . /// Client-owned, case-sensitive string metadata persisted with a local session. Clients should namespace keys by owner. Keys must be non-empty and at most 256 UTF-8 bytes; keys under `copilot/` and `github/` are reserved. Values may contain at most 16 KiB of UTF-8 data. A bag may contain at most 128 entries and its serialized sidecar may contain at most 64 KiB. The runtime stores but never interprets these values. public async Task> UpdateClientMetadataAsync(bool? clear = null, IList? remove = null, IDictionary? set = null, CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new MetadataUpdateClientMetadataRequest { SessionId = _session.SessionId, Clear = clear, Remove = remove, Set = set }; return await CopilotClient.InvokeRpcAsync>(_session.Rpc, "session.metadata.updateClientMetadata", [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 a snapshot of activity flags for the session. /// The to monitor for cancellation requests. The default is . /// Current activity flags for the session. public async Task ActivityAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionMetadataActivityRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.metadata.activity", [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); } /// Returns the experimental per-source attribution breakdown of the session's current context window as a flat list of entries (skills, subagents, MCP servers, built-in tools, plugin rollups, system/tool-definition costs, with nesting via parentId), plus the successful compaction count. The heaviest individual messages are available separately via `metadata.getContextHeaviestMessages`. Returns null until the session has initialized its system prompt and tool metadata. /// The to monitor for cancellation requests. The default is . /// Per-source attribution breakdown for the session's current context window, or null if uninitialized. public async Task GetContextAttributionAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionMetadataGetContextAttributionRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.metadata.getContextAttribution", [request], cancellationToken); } /// Returns the largest individual messages currently in the session's context window, most-expensive first. Companion to `metadata.getContextAttribution`. Returns an empty list until the session has initialized. /// Maximum number of messages to return, most-expensive first. Omit for the server default. /// The to monitor for cancellation requests. The default is . /// The heaviest individual messages in the session's context window, most-expensive first. public async Task GetContextHeaviestMessagesAsync(long? limit = null, CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new MetadataContextHeaviestMessagesRequest { SessionId = _session.SessionId, Limit = limit }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.metadata.getContextHeaviestMessages", [request], cancellationToken); } /// Records a working-directory/git context change and emits a `session.context_changed` event. For a local session, a report whose `cwd` diverges from the session's current working directory is ignored (the call still succeeds but records nothing and emits no event): a local session's working directory is authoritative and is moved via `metadata.setWorkingDirectory` (or an SDK `session.resume` that supplies a `workingDirectory`), not by this method. /// 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). For a local session, a report whose `cwd` diverges from the session's current working directory is ignored (the call still succeeds but records nothing and emits no event); move a local session's working directory via `metadata.setWorkingDirectory` instead. 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 working directory. For local sessions the target is validated first (an absolute path that exists on disk) and the permission primary directory is re-based; a rejected validation fails the call before any session state changes. /// 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 any related side-effects (file index, etc.); it does NOT change the process working directory (a session's cwd is per-session, not process-global). For local sessions the runtime validates the target first (an absolute path that exists on disk) and re-bases the permission primary directory; a rejected validation fails the call before anything is mutated, persisted, or emitted. Location-scoped permission rules are then re-keyed to the new directory (best-effort). Remote sessions only record the 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 Settings APIs. [Experimental(Diagnostics.Experimental)] public sealed class SettingsApi { private readonly CopilotSession _session; internal SettingsApi(CopilotSession session) { _session = session; } /// Returns a redacted snapshot of session runtime settings, with secrets and raw feature flags excluded. Internal: the runtime settings shape is a runtime-internal surface and is deliberately kept out of the public SDK, because consumers should not depend on the runtime's internal settings layout. It remains callable in-process and is expected to be reworked as the runtime internals are consolidated. /// The to monitor for cancellation requests. The default is . /// Redacted, serializable view of session runtime settings for SDK boundary consumers. Secrets and raw feature flags are intentionally excluded. internal async Task SnapshotAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionSettingsSnapshotRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.settings.snapshot", [request], cancellationToken); } /// Evaluates a named Rust-owned settings predicate without exposing raw feature flags. Internal: the raw feature-flag names and composition are runtime-internal, so this predicate-evaluation helper is kept out of the public SDK surface and is callable in-process only. /// Predicate name. The runtime owns the raw feature-flag names and composition logic. /// Tool name for tool-scoped predicates such as trivial-change handling. /// The to monitor for cancellation requests. The default is . /// Result of evaluating a Rust-owned settings predicate. internal async Task EvaluatePredicateAsync(SessionSettingsPredicateName name, string? toolName = null, CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionSettingsEvaluatePredicateRequest { SessionId = _session.SessionId, Name = name, ToolName = toolName }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.settings.evaluatePredicate", [request], cancellationToken); } } /// Provides session-scoped ContentExclusion APIs. [Experimental(Diagnostics.Experimental)] public sealed class ContentExclusionApi { private readonly CopilotSession _session; internal ContentExclusionApi(CopilotSession session) { _session = session; } /// Checks local file system absolute paths within the session working directory against its content-exclusion policy. Results preserve input order. Unsupported paths/filesystems and unavailable policy evaluation return available false, and callers must treat every requested path as excluded. /// Local file system absolute paths within the session working directory to check. Results are returned in the same order, including duplicates. /// The to monitor for cancellation requests. The default is . /// Batch content-exclusion result. Callers must fail closed when policy evaluation is unavailable. public async Task CheckPathsAsync(IList paths, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(paths); _session.ThrowIfDisposed(); var request = new ContentExclusionCheckPathsRequest { SessionId = _session.SessionId, Paths = paths }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.contentExclusion.checkPaths", [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. The command runs as the leader of its own process group (POSIX) or in a dedicated job object (Windows), so a forced termination — via "shell.kill", the request timeout, or session disposal — signals that whole group/job rather than only the direct child. Two gaps are worth planning for: a command that exits on its own does not trigger that teardown, and on POSIX a descendant that moves itself into a new session or process group (for example via "setsid") leaves the signalled group, so either can leave a background process running. /// 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". The signal targets the command's whole process group (POSIX) or job object (Windows), so descendants still in that group are signalled too, not just the direct child. On POSIX a descendant that moved itself into a new session or process group (for example via "setsid") is no longer in the signalled group and survives. /// 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); } /// Executes a user-requested shell command through the session runtime. /// Caller-provided cancellation handle for this execution. /// Shell command to execute. /// The to monitor for cancellation requests. The default is . /// Result of a user-requested shell command. public async Task ExecuteUserRequestedAsync(string requestId, string command, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(requestId); ArgumentNullException.ThrowIfNull(command); _session.ThrowIfDisposed(); var request = new ShellExecuteUserRequestedRequest { SessionId = _session.SessionId, RequestId = requestId, Command = command }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.shell.executeUserRequested", [request], cancellationToken); } /// Cancels a user-requested shell command by request ID. /// Request ID previously passed to executeUserRequested. /// The to monitor for cancellation requests. The default is . /// Cancellation result for a user-requested shell command. public async Task CancelUserRequestedAsync(string requestId, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(requestId); _session.ThrowIfDisposed(); var request = new ShellCancelUserRequestedRequest { SessionId = _session.SessionId, RequestId = requestId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.shell.cancelUserRequested", [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(SessionHistoryCompactRequest? request = null, CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var rpcRequest = new SessionHistoryCompactRequestWithSession { SessionId = _session.SessionId, CustomInstructions = request?.CustomInstructions, Trigger = request?.Trigger, TokenLimit = request?.TokenLimit }; 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); } /// Lists the user turns that the session can rewind to. Never rejects for a busy session: rewind reads need the session's file-change captures to be settled, so a session that still holds active work answers with `unavailableReason: "session-busy"` and no points, which the caller can retry. /// The to monitor for cancellation requests. The default is . /// Rewind points and file-change-tracking availability for the session. public async Task ListRewindPointsAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionHistoryListRewindPointsRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.history.listRewindPoints", [request], cancellationToken); } /// Previews the files that a conversation-and-files rewind would restore. /// ID of the user.message event that begins the discarded suffix. /// The to monitor for cancellation requests. The default is . /// Files and aggregate changes for a prospective rewind. public async Task PreviewRewindAsync(string eventId, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(eventId); _session.ThrowIfDisposed(); var request = new HistoryPreviewRewindRequest { SessionId = _session.SessionId, EventId = eventId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.history.previewRewind", [request], cancellationToken); } /// Rewinds the session conversation, optionally restoring files changed by the discarded turns. Not crash-atomic: file restore and conversation truncation are separate stores, applied in that order, so a process crash between them can leave the workspace rewound while the conversation still contains the discarded turns. There is no recovery journal; re-running the same rewind is the recovery path for a crash before truncation lands, since file restore is idempotent (already-restored files are reported as skipped) and truncation is re-derived from the still-retained boundary event. After truncation lands that boundary no longer exists, so the same request is rejected; the only stage that can still be outstanding is snapshot pruning, whose failure leaves orphan snapshots the capture store tolerates. The reverse inconsistency cannot occur, because truncation is never applied before file restore succeeds. /// ID of the user.message event that begins the discarded suffix. /// Whether to rewind only conversation history or also restore captured files. /// The to monitor for cancellation requests. The default is . /// Structured outcome of a rewind request. public async Task RewindAsync(string eventId, HistoryRewindMode mode, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(eventId); _session.ThrowIfDisposed(); var request = new HistoryRewindRequest { SessionId = _session.SessionId, EventId = eventId, Mode = mode }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.history.rewind", [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); } /// Clears the session's conversation history, keeping only system and developer messages, and seeds the fresh context window with a first user message. Must be called from inside a tool handler: the clear has to drop the results of the tool calls its wipe orphans, and it rejects when no tool call is in flight. /// First user message of the fresh context window. Required: a cleared window holding only system and developer messages is not a conversation a model can answer, so every clear seeds the window it creates. Delivered by the enclosing turn driver once the agentic loop exits, which is why the call must be made from inside a tool handler. /// The to monitor for cancellation requests. The default is . /// What a successful clear removed. A clear that could not be applied rejects instead of reporting a count. public async Task ClearContextAsync(string prompt, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(prompt); _session.ThrowIfDisposed(); var request = new HistoryClearContextRequest { SessionId = _session.SessionId, Prompt = prompt }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.history.clearContext", [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); } /// Returns the internal native queue snapshot for in-process session orchestration. /// The to monitor for cancellation requests. The default is . /// Internal snapshot of native queue state for local session orchestration. internal async Task SnapshotAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionQueueSnapshotRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.queue.snapshot", [request], cancellationToken); } /// Moves an addressable queued item to a public visible position. /// Stable opaque queued-item id. /// Zero-based target position in the public visible queue. Values outside the queue clamp to an end. /// The to monitor for cancellation requests. The default is . /// Result of moving a queued item. public async Task MoveItemAsync(string id, long toPosition, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(id); _session.ThrowIfDisposed(); var request = new QueueMoveItemRequest { SessionId = _session.SessionId, Id = id, ToPosition = toPosition }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.queue.moveItem", [request], cancellationToken); } /// Inserts a new queued message at a public visible position. /// Zero-based position in the public visible queue. Values outside the queue clamp to an end. /// Queued message contents and delivery metadata. /// The to monitor for cancellation requests. The default is . /// Result of inserting a queued message. public async Task InsertAtAsync(long position, QueueInsertMessage message, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(message); _session.ThrowIfDisposed(); var request = new QueueInsertAtRequest { SessionId = _session.SessionId, Position = position, Message = message }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.queue.insertAt", [request], cancellationToken); } /// Removes an addressable queued item by its stable id. /// Stable opaque ID of the queued item to remove. /// The to monitor for cancellation requests. The default is . /// Result of removing a queued item. public async Task RemoveAtAsync(string id, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(id); _session.ThrowIfDisposed(); var request = new QueueRemoveAtRequest { SessionId = _session.SessionId, Id = id }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.queue.removeAt", [request], cancellationToken); } /// Updates the text of an addressable single-message queue item. /// Stable opaque ID of the queued item to edit. /// Replacement prompt sent to the model. /// Optional replacement prompt displayed to the user. /// The to monitor for cancellation requests. The default is . /// Result of editing a queued message. public async Task UpdateTextAsync(string id, string prompt, string? displayPrompt = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(id); ArgumentNullException.ThrowIfNull(prompt); _session.ThrowIfDisposed(); var request = new QueueUpdateTextRequest { SessionId = _session.SessionId, Id = id, Prompt = prompt, DisplayPrompt = displayPrompt }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.queue.updateText", [request], cancellationToken); } /// Duplicates an addressable queued item immediately after its source. /// Stable opaque ID of the queued item to duplicate. /// The to monitor for cancellation requests. The default is . /// Result of duplicating a queued item. public async Task DuplicateAtAsync(string id, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(id); _session.ThrowIfDisposed(); var request = new QueueDuplicateAtRequest { SessionId = _session.SessionId, Id = id }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.queue.duplicateAt", [request], cancellationToken); } /// Acquires or releases the queued-lane drain pause. /// Whether queued-lane draining should be paused. /// The to monitor for cancellation requests. The default is . public async Task SetDrainPausedAsync(bool paused, CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new QueueSetDrainPausedRequest { SessionId = _session.SessionId, Paused = paused }; await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.queue.setDrainPaused", [request], cancellationToken); } /// Moves an addressable queued message into the live turn's steering lane. /// Stable opaque ID of the queued item to steer into the live turn. /// The to monitor for cancellation requests. The default is . /// Result of trying to steer a queued message into a live turn. public async Task SendNowAsync(string id, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(id); _session.ThrowIfDisposed(); var request = new QueueSendNowRequest { SessionId = _session.SessionId, Id = id }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.queue.sendNow", [request], cancellationToken); } /// Reports whether the local session has native queued work pending. /// The to monitor for cancellation requests. The default is . /// Whether the native queue has pending work. internal async Task HasPendingAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionQueueHasPendingRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.queue.hasPending", [request], cancellationToken); } /// Begins a native deferred-idle drain when background work has quiesced. /// Whether the host still has active background work. /// The to monitor for cancellation requests. The default is . /// Whether a deferred-idle drain should run. internal async Task BeginDeferredIdleDrainAsync(bool activeBackgroundWork, CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new QueueBeginDeferredIdleDrainRequest { SessionId = _session.SessionId, ActiveBackgroundWork = activeBackgroundWork }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.queue.beginDeferredIdleDrain", [request], cancellationToken); } /// Finishes a native deferred-idle drain and reports whether to drain queue work or emit idle. /// Whether the host still has active background work. /// Whether native queued work remains. /// The to monitor for cancellation requests. The default is . /// Action selected by the native deferred-idle drain. internal async Task FinishDeferredIdleDrainAsync(bool activeBackgroundWork, bool hasPending, CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new QueueFinishDeferredIdleDrainRequest { SessionId = _session.SessionId, ActiveBackgroundWork = activeBackgroundWork, HasPending = hasPending }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.queue.finishDeferredIdleDrain", [request], cancellationToken); } /// Marks session.idle as deferred by native background work state. /// Whether the deferred idle was caused by an aborted foreground turn. /// The to monitor for cancellation requests. The default is . internal async Task DeferSessionIdleAsync(bool aborted, CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new QueueDeferSessionIdleRequest { SessionId = _session.SessionId, Aborted = aborted }; await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.queue.deferSessionIdle", [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); } /// Consumes queued native system notifications matching an internal filter. /// Opaque runtime-owned filter object. /// The to monitor for cancellation requests. The default is . /// Indicates whether a user-facing pending item was removed. internal async Task ConsumeSystemNotificationsAsync(object filter, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(filter); _session.ThrowIfDisposed(); var request = new QueueConsumeSystemNotificationsRequest { SessionId = _session.SessionId, Filter = CopilotClient.ToJsonElementForWire(filter)!.Value }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.queue.consumeSystemNotifications", [request], cancellationToken); } /// Enqueues the internal resume-pending wake item when orphan handling needs a follow-up turn. /// The to monitor for cancellation requests. The default is . /// Result of enqueueing the resume-pending wake item. internal async Task EnqueueResumePendingAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionQueueEnqueueResumePendingRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.queue.enqueueResumePending", [request], cancellationToken); } /// Drains the native local-session work queue for in-process session orchestration. /// The to monitor for cancellation requests. The default is . internal async Task ProcessAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionQueueProcessRequest { SessionId = _session.SessionId }; await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.queue.process", [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. Supports tail-first reads via `direction: backward`. /// 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). This applies to forward reads only: a backward read always returns immediately and ignores `waitMs`, because backward paging covers persisted history only while new events append at the tail (the opposite end from a backward page), so no blocking or ephemeral delivery can occur. /// 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. /// Optional non-empty list of subagent identifiers. When provided, only events owned by one of these agents are returned; ownership recognizes the event envelope's agentId plus legacy data.agentId and data.parentToolCallId markers. This filter takes precedence over agentScope. /// Direction to page through the session's persisted event history. 'forward' (default) pages from the cursor toward newer events (or from the start of history when no cursor is given). 'backward' enables tail-first reads: with no cursor it returns the NEWEST `max` events, and the returned cursor pages toward OLDER events on subsequent backward reads. Events within a returned batch are always in chronological (oldest-to-newest) order, even for a backward read. Backward reads cover PERSISTED history only; ephemeral events are never returned by a backward read. `direction` selects the INITIAL read only: the returned cursor is self-describing, so a continuation read pages in the cursor's own direction regardless of the `direction` passed alongside it — a forward cursor always pages forward and a backward cursor always pages backward. Pass the direction that matches the cursor to avoid confusion. /// When false, skip ephemeral events entirely and return only durable (persisted) events. History-backfill callers that discard ephemerals anyway should set this so the read is bounded by the durable log length instead of racing the ephemeral ring on a busy session. Defaults to true (ephemerals are interleaved with durable events in creation order). Ignored by backward reads, which always cover persisted history only. /// 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, long? max = null, TimeSpan? waitMs = null, object? types = null, EventsAgentScope? agentScope = null, IList? agentIds = null, EventsReadDirection? direction = null, bool? includeEphemeral = 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, AgentIds = agentIds, Direction = direction, IncludeEphemeral = includeEphemeral }; 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 interactive OAuth token acquisition to the consumer via `mcp.oauth_required` events; when no interest is registered the runtime still attempts non-interactive reconnect from cached or refreshable tokens, and only marks the server `needs-auth` if usable credentials are unavailable — it does not open a browser or start interactive OAuth without a consumer). 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`, `session_limits_exhausted.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 LimitPrediction APIs. [Experimental(Diagnostics.Experimental)] public sealed class LimitPredictionApi { private readonly CopilotSession _session; internal LimitPredictionApi(CopilotSession session) { _session = session; } /// Predicts an AI-credit session limit for the session's resolved model. Returns an unavailable result instead of falling back when the current model is unresolved auto. /// Parameters for predicting an AI-credit session limit. Omitting `modelId` uses the session's currently selected model. /// The to monitor for cancellation requests. The default is . /// Prediction result. Available results include prediction details; unavailable results include an explicit reason. public async Task PredictAsync(SessionLimitPredictionPredictRequest? request = null, CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var rpcRequest = new SessionLimitPredictionPredictRequestWithSession { SessionId = _session.SessionId, ModelId = request?.ModelId, ClientType = request?.ClientType }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.limitPrediction.predict", [rpcRequest], 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 Visibility APIs. [Experimental(Diagnostics.Experimental)] public sealed class VisibilityApi { private readonly CopilotSession _session; internal VisibilityApi(CopilotSession session) { _session = session; } /// Returns the session's current Mission Control sharing status and shareable GitHub URL. Reflects whether the synced session is visible to repository readers ("repo") or restricted to its creator and collaborators ("unshared"). /// The to monitor for cancellation requests. The default is . /// Current sharing status and shareable GitHub URL for a session. public async Task GetAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionVisibilityGetRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.visibility.get", [request], cancellationToken); } /// Sets the session's Mission Control sharing status, controlling whether the synced session is visible to repository readers. Returns the effective status and shareable GitHub URL after the change. /// Sharing status to apply. "repo" makes the session visible to repository readers; "unshared" restricts it to the creator and collaborators. /// The to monitor for cancellation requests. The default is . /// Effective sharing status and shareable GitHub URL after updating session visibility. public async Task SetAsync(SessionVisibilityStatus status, CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new VisibilitySetRequest { SessionId = _session.SessionId, Status = status }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.visibility.set", [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); } /// Hydrates the native schedule registry from persisted session events. /// The to monitor for cancellation requests. The default is . internal async Task HydrateAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionScheduleHydrateRequest { SessionId = _session.SessionId }; await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.schedule.hydrate", [request], cancellationToken); } /// Reports whether the session has an active self-paced scheduled prompt. /// The to monitor for cancellation requests. The default is . /// Whether the session currently has an active self-paced schedule. internal async Task HasSelfPacedAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new SessionScheduleHasSelfPacedRequest { SessionId = _session.SessionId }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.schedule.hasSelfPaced", [request], cancellationToken); } /// Registers a relative-interval scheduled prompt. /// Human-readable interval such as `30s`, `5m`, or `2h`. /// Prompt text to enqueue when the schedule fires. /// Whether the schedule should re-arm after each tick. Defaults to true. /// Optional display-only prompt label. /// The to monitor for cancellation requests. The default is . /// Result of registering or re-arming a scheduled prompt. internal async Task AddAsync(string interval, string prompt, bool? recurring = null, string? displayPrompt = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(interval); ArgumentNullException.ThrowIfNull(prompt); _session.ThrowIfDisposed(); var request = new ScheduleAddRequest { SessionId = _session.SessionId, Interval = interval, Prompt = prompt, Recurring = recurring, DisplayPrompt = displayPrompt }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.schedule.add", [request], cancellationToken); } /// Registers a recurring cron scheduled prompt. /// 5-field cron expression. /// Prompt text to enqueue when the schedule fires. /// Whether the schedule should re-arm after each tick. Defaults to true. /// Optional display-only prompt label. /// IANA timezone for evaluating the cron expression. /// The to monitor for cancellation requests. The default is . /// Result of registering or re-arming a scheduled prompt. internal async Task AddCronAsync(string cron, string prompt, bool? recurring = null, string? displayPrompt = null, string? tz = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(cron); ArgumentNullException.ThrowIfNull(prompt); _session.ThrowIfDisposed(); var request = new ScheduleAddCronRequest { SessionId = _session.SessionId, Cron = cron, Prompt = prompt, Recurring = recurring, DisplayPrompt = displayPrompt, Tz = tz }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.schedule.addCron", [request], cancellationToken); } /// Registers an absolute-time scheduled prompt. /// Epoch milliseconds when the prompt should fire. /// Prompt text to enqueue when the schedule fires. /// Whether the schedule should re-arm after each tick. Defaults to false. /// Optional display-only prompt label. /// The to monitor for cancellation requests. The default is . /// Result of registering or re-arming a scheduled prompt. internal async Task AddAtAsync(long at, string prompt, bool? recurring = null, string? displayPrompt = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(prompt); _session.ThrowIfDisposed(); var request = new ScheduleAddAtRequest { SessionId = _session.SessionId, At = at, Prompt = prompt, Recurring = recurring, DisplayPrompt = displayPrompt }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.schedule.addAt", [request], cancellationToken); } /// Registers a self-paced scheduled prompt. /// Prompt text to enqueue when the schedule fires. /// Optional display-only prompt label. /// The to monitor for cancellation requests. The default is . /// Result of registering or re-arming a scheduled prompt. internal async Task AddSelfPacedAsync(string prompt, string? displayPrompt = null, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(prompt); _session.ThrowIfDisposed(); var request = new ScheduleAddSelfPacedRequest { SessionId = _session.SessionId, Prompt = prompt, DisplayPrompt = displayPrompt }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.schedule.addSelfPaced", [request], cancellationToken); } /// Re-arms an active self-paced scheduled prompt. /// Id of the self-paced scheduled prompt. /// Epoch milliseconds when the prompt should next fire. /// The to monitor for cancellation requests. The default is . /// Result of registering or re-arming a scheduled prompt. internal async Task RearmSelfPacedAsync(long id, long at, CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); var request = new ScheduleRearmSelfPacedRequest { SessionId = _session.SessionId, Id = id, At = at }; return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.schedule.rearmSelfPaced", [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 `providerToken` client session API methods. [Experimental(Diagnostics.Experimental)] public interface IProviderTokenHandler { /// Asks the SDK client to get a bearer token for a BYOK provider whose config set `hasBearerTokenProvider: true`. Session-scoped: the runtime calls it back on the connection that most recently supplied that provider's config for the session (the creating connection, or a resuming connection if the session was resumed — distinct providers may be owned by different connections), passing the provider name, and uses the returned token as the Authorization header for the outbound model request. The runtime does no caching — it calls this once per outbound request; the SDK consumer owns token acquisition, caching, and refresh. /// Asks the SDK client to acquire a bearer token for a BYOK provider whose config set `hasBearerTokenProvider: true`. Issued by the runtime before each outbound model request; the runtime does no caching, so this is sent once per request. /// The to monitor for cancellation requests. The default is . /// A bearer token supplied by the SDK client for a BYOK provider. The runtime sets it as `Authorization: Bearer <token>` on the outbound request and does no caching; the SDK consumer owns token caching and refresh. Task GetTokenAsync(ProviderTokenAcquireRequest request, CancellationToken cancellationToken = default); } /// Handles `factory` client session API methods. [Experimental(Diagnostics.Experimental)] public interface IFactoryHandler { /// Asks the owning extension connection to execute a registered factory closure. /// Parameters sent to the owning extension to execute a factory closure. /// The to monitor for cancellation requests. The default is . /// Result returned by an extension factory closure. Task ExecuteAsync(FactoryExecuteRequest request, CancellationToken cancellationToken = default); /// Asks the owning extension connection to abort a running factory cooperatively. /// Parameters for cooperatively aborting a factory body. /// The to monitor for cancellation requests. The default is . /// Acknowledgement that a factory request was accepted. Task AbortAsync(FactoryAbortRequest request, CancellationToken cancellationToken = default); } /// Handles `tasks` client session API methods. [Experimental(Diagnostics.Experimental)] public interface ITasksHandler { /// Asks the client currently bound to a client-owned session task to confirm that its external work stopped. /// Runtime-to-owner cancellation request for a client-owned task. /// The to monitor for cancellation requests. The default is . /// Whether the client authoritatively confirmed its external work stopped. Task CancelAsync(ClientTaskCancelRequest request, CancellationToken cancellationToken = default); } /// Handles `sessionFs` client session API methods. [Experimental(Diagnostics.Experimental)] 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, creating parent directories as needed. /// File path, content to append, and optional mode for the client-provided session filesystem. Implementations create parent directories as needed. /// 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. Providers apply busy handling for every call. /// SQL query, query type, and optional bind parameters for executing a SQLite query against the per-session database. The provider applies its SQLite busy timeout for every call. /// 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); /// Executes SQLite statements atomically on the provider-owned connection. /// Statements to execute atomically. Providers apply busy handling for every call. /// The to monitor for cancellation requests. The default is . /// Per-statement results, or a classified transaction error. Task SqliteTransactionAsync(SessionFsSqliteTransactionRequest 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); } /// Handles `canvas` client session API methods. [Experimental(Diagnostics.Experimental)] public interface ICanvasHandler { /// Opens a canvas instance on the provider. /// Canvas open parameters sent to the provider. /// The to monitor for cancellation requests. The default is . /// Canvas open result returned by the provider. Task OpenAsync(CanvasProviderOpenRequest request, CancellationToken cancellationToken = default); /// Closes a canvas instance on the provider. /// Canvas close parameters sent to the provider. /// The to monitor for cancellation requests. The default is . Task CloseAsync(CanvasProviderCloseRequest request, CancellationToken cancellationToken = default); /// Invokes an action on an open canvas instance via the provider. /// Canvas action invocation parameters sent to the provider. /// The to monitor for cancellation requests. The default is . /// Provider-supplied action result. Task InvokeAsync(CanvasProviderInvokeActionRequest request, CancellationToken cancellationToken = default); } /// Provides all client session API handler groups for a session. public sealed class ClientSessionApiHandlers { /// Optional handler for ProviderToken client session API methods. public IProviderTokenHandler? ProviderToken { get; set; } /// Optional handler for Factory client session API methods. public IFactoryHandler? Factory { get; set; } /// Optional handler for Tasks client session API methods. public ITasksHandler? Tasks { get; set; } /// Optional handler for SessionFs client session API methods. public ISessionFsHandler? SessionFs { get; set; } /// Optional handler for Canvas client session API methods. public ICanvasHandler? Canvas { 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("providerToken.getToken", (Func>)(async (request, cancellationToken) => { var handler = getHandlers(request.SessionId).ProviderToken; if (handler is null) throw new InvalidOperationException($"No providerToken handler registered for session: {request.SessionId}"); return await handler.GetTokenAsync(request, cancellationToken); }), singleObjectParam: true); rpc.SetLocalRpcMethod("factory.execute", (Func>)(async (request, cancellationToken) => { var handler = getHandlers(request.SessionId).Factory; if (handler is null) throw new InvalidOperationException($"No factory handler registered for session: {request.SessionId}"); return await handler.ExecuteAsync(request, cancellationToken); }), singleObjectParam: true); rpc.SetLocalRpcMethod("factory.abort", (Func>)(async (request, cancellationToken) => { var handler = getHandlers(request.SessionId).Factory; if (handler is null) throw new InvalidOperationException($"No factory handler registered for session: {request.SessionId}"); return await handler.AbortAsync(request, cancellationToken); }), singleObjectParam: true); rpc.SetLocalRpcMethod("tasks.cancel", (Func>)(async (request, cancellationToken) => { var handler = getHandlers(request.SessionId).Tasks; if (handler is null) throw new InvalidOperationException($"No tasks handler registered for session: {request.SessionId}"); return await handler.CancelAsync(request, cancellationToken); }), singleObjectParam: true); 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.sqliteTransaction", (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.SqliteTransactionAsync(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); rpc.SetLocalRpcMethod("canvas.open", (Func>)(async (request, cancellationToken) => { var handler = getHandlers(request.SessionId).Canvas; if (handler is null) throw new InvalidOperationException($"No canvas handler registered for session: {request.SessionId}"); return await handler.OpenAsync(request, cancellationToken); }), singleObjectParam: true); rpc.SetLocalRpcMethod("canvas.close", (Func)(async (request, cancellationToken) => { var handler = getHandlers(request.SessionId).Canvas; if (handler is null) throw new InvalidOperationException($"No canvas handler registered for session: {request.SessionId}"); await handler.CloseAsync(request, cancellationToken); }), singleObjectParam: true); rpc.SetLocalRpcMethod("canvas.action.invoke", (Func>)(async (request, cancellationToken) => { var handler = getHandlers(request.SessionId).Canvas; if (handler is null) throw new InvalidOperationException($"No canvas handler registered for session: {request.SessionId}"); return await handler.InvokeAsync(request, cancellationToken); }), singleObjectParam: true); } } /// Handles `extensionLaunchProvider` client global API methods. [Experimental(Diagnostics.Experimental)] public interface IExtensionLaunchProviderHandler { /// Asks the registered SDK client to resolve an opaque process launch profile for one discovered extension entrypoint immediately before launch or reload. The provider must respond within 15 seconds. /// A discovered extension entrypoint that the registered integrator may classify and resolve to an opaque launch profile. /// The to monitor for cancellation requests. The default is . /// The launch profile for a supported entrypoint. Omit launch when the provider does not support the entrypoint. Task ResolveAsync(ExtensionLaunchProviderResolveRequest request, CancellationToken cancellationToken = default); } /// Handles `llmInference` client global API methods. [Experimental(Diagnostics.Experimental)] public interface ILlmInferenceHandler { /// Announces an outbound model-layer HTTP request the runtime wants the SDK client to service. Carries the request head only; the body always follows as one or more httpRequestChunk frames keyed by the same requestId, even when the body is empty (a single chunk with end=true). /// The head of an outbound model-layer HTTP request. /// The to monitor for cancellation requests. The default is . /// Acknowledgement. Returning successfully simply means the SDK accepted the start frame; it does not imply the request will succeed. Task HttpRequestStartAsync(LlmInferenceHttpRequestStartRequest request, CancellationToken cancellationToken = default); /// Delivers a body byte range (or a cancellation signal) for a request previously announced via httpRequestStart, correlated by requestId. The runtime fires at least one chunk per request — when there is no body, a single chunk with empty data and end=true. Mid-stream the runtime may send a chunk with cancel=true to abort the request; the SDK then stops issuing httpResponseChunk frames and may emit a terminal httpResponseChunk with error set. /// A request body chunk or cancellation signal. /// The to monitor for cancellation requests. The default is . /// Acknowledgement. The SDK is free to ignore the ack and treat chunk delivery as fire-and-forget. Task HttpRequestChunkAsync(LlmInferenceHttpRequestChunkRequest request, CancellationToken cancellationToken = default); } /// Handles `gitHubTelemetry` client global API methods. [Experimental(Diagnostics.Experimental)] public interface IGitHubTelemetryHandler { /// Forwards a single GitHub telemetry event to a host connection that opted into telemetry forwarding during the `server.connect` handshake. Opted-in connections receive every event the runtime emits after the handshake — across all sessions, plus sessionless events (for example, `server.sendTelemetry` calls with no session id). /// Payload for a `gitHubTelemetry.event` notification: a single GitHub telemetry event the runtime forwards to a host connection that opted into telemetry forwarding during the `server.connect` handshake. /// The to monitor for cancellation requests. The default is . Task EventAsync(GitHubTelemetryNotification request, CancellationToken cancellationToken = default); } /// Handles `gitHubToken` client global API methods. [Experimental(Diagnostics.Experimental)] public interface IGitHubTokenHandler { /// Asks the SDK client to mint a GitHub access token for a session whose configuration supplied a GitHub token provider. The runtime acquires the initial token during bootstrap and refreshes it during expiry preflight when one hour or less remains. /// Asks the SDK client to acquire a GitHub access token from an opaque callback registration. /// The to monitor for cancellation requests. The default is . /// SDK host response to a GitHub credential request. Task GetTokenAsync(GitHubTokenAcquireRequest request, CancellationToken cancellationToken = default); } /// Provides all client global API handler groups for a connection. public sealed class ClientGlobalApiHandlers { /// Optional handler for ExtensionLaunchProvider client global API methods. public IExtensionLaunchProviderHandler? ExtensionLaunchProvider { get; set; } /// Optional handler for LlmInference client global API methods. public ILlmInferenceHandler? LlmInference { get; set; } /// Optional handler for GitHubTelemetry client global API methods. public IGitHubTelemetryHandler? GitHubTelemetry { get; set; } /// Optional handler for GitHubToken client global API methods. public IGitHubTokenHandler? GitHubToken { get; set; } } /// Registers client global API handlers on a JSON-RPC connection. internal static class ClientGlobalApiRegistration { /// /// Registers handlers for server-to-client global API calls. /// Unlike client session APIs, these methods carry no implicit /// sessionId dispatch key — a single set of handlers serves the /// entire connection. /// public static void RegisterClientGlobalApiHandlers(JsonRpc rpc, ClientGlobalApiHandlers handlers) { rpc.SetLocalRpcMethod("extensionLaunchProvider.resolve", (Func>)(async (request, cancellationToken) => { var handler = handlers.ExtensionLaunchProvider ?? throw new InvalidOperationException("No extensionLaunchProvider client-global handler registered"); return await handler.ResolveAsync(request, cancellationToken); }), singleObjectParam: true); rpc.SetLocalRpcMethod("llmInference.httpRequestStart", (Func>)(async (request, cancellationToken) => { var handler = handlers.LlmInference ?? throw new InvalidOperationException("No llmInference client-global handler registered"); return await handler.HttpRequestStartAsync(request, cancellationToken); }), singleObjectParam: true); rpc.SetLocalRpcMethod("llmInference.httpRequestChunk", (Func>)(async (request, cancellationToken) => { var handler = handlers.LlmInference ?? throw new InvalidOperationException("No llmInference client-global handler registered"); return await handler.HttpRequestChunkAsync(request, cancellationToken); }), singleObjectParam: true); rpc.SetLocalRpcMethod("gitHubTelemetry.event", (Func)(async (request, cancellationToken) => { var handler = handlers.GitHubTelemetry ?? throw new InvalidOperationException("No gitHubTelemetry client-global handler registered"); await handler.EventAsync(request, cancellationToken); }), singleObjectParam: true); rpc.SetLocalRpcMethod("gitHubToken.getToken", (Func>)(async (request, cancellationToken) => { var handler = handlers.GitHubToken ?? throw new InvalidOperationException("No gitHubToken client-global handler registered"); return await handler.GetTokenAsync(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.AgentInterruptedActivity), TypeInfoPropertyName = "SessionEventsAgentInterruptedActivity")] [JsonSerializable(typeof(GitHub.Copilot.AgentInterruptedCancelPhase), TypeInfoPropertyName = "SessionEventsAgentInterruptedCancelPhase")] [JsonSerializable(typeof(GitHub.Copilot.AgentInterruptedData), TypeInfoPropertyName = "SessionEventsAgentInterruptedData")] [JsonSerializable(typeof(GitHub.Copilot.AgentInterruptedEvent), TypeInfoPropertyName = "SessionEventsAgentInterruptedEvent")] [JsonSerializable(typeof(GitHub.Copilot.AgentModelPolicy), TypeInfoPropertyName = "SessionEventsAgentModelPolicy")] [JsonSerializable(typeof(GitHub.Copilot.AssistantFusionPhaseActivityEvent), TypeInfoPropertyName = "SessionEventsAssistantFusionPhaseActivityEvent")] [JsonSerializable(typeof(GitHub.Copilot.AssistantFusionPhaseCompletedEvent), TypeInfoPropertyName = "SessionEventsAssistantFusionPhaseCompletedEvent")] [JsonSerializable(typeof(GitHub.Copilot.AssistantFusionPhaseFailedEvent), TypeInfoPropertyName = "SessionEventsAssistantFusionPhaseFailedEvent")] [JsonSerializable(typeof(GitHub.Copilot.AssistantFusionPhaseStartedEvent), TypeInfoPropertyName = "SessionEventsAssistantFusionPhaseStartedEvent")] [JsonSerializable(typeof(GitHub.Copilot.AssistantIdleData), TypeInfoPropertyName = "SessionEventsAssistantIdleData")] [JsonSerializable(typeof(GitHub.Copilot.AssistantIdleEvent), TypeInfoPropertyName = "SessionEventsAssistantIdleEvent")] [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.AssistantMessageReasoningBlocks), TypeInfoPropertyName = "SessionEventsAssistantMessageReasoningBlocks")] [JsonSerializable(typeof(GitHub.Copilot.AssistantMessageServerTools), TypeInfoPropertyName = "SessionEventsAssistantMessageServerTools")] [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.AssistantMessageToolRequestCaller), TypeInfoPropertyName = "SessionEventsAssistantMessageToolRequestCaller")] [JsonSerializable(typeof(GitHub.Copilot.AssistantMessageToolRequestCallerType), TypeInfoPropertyName = "SessionEventsAssistantMessageToolRequestCallerType")] [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.AssistantServerToolProgressData), TypeInfoPropertyName = "SessionEventsAssistantServerToolProgressData")] [JsonSerializable(typeof(GitHub.Copilot.AssistantServerToolProgressEvent), TypeInfoPropertyName = "SessionEventsAssistantServerToolProgressEvent")] [JsonSerializable(typeof(GitHub.Copilot.AssistantStreamingDeltaData), TypeInfoPropertyName = "SessionEventsAssistantStreamingDeltaData")] [JsonSerializable(typeof(GitHub.Copilot.AssistantStreamingDeltaEvent), TypeInfoPropertyName = "SessionEventsAssistantStreamingDeltaEvent")] [JsonSerializable(typeof(GitHub.Copilot.AssistantToolCallDeltaData), TypeInfoPropertyName = "SessionEventsAssistantToolCallDeltaData")] [JsonSerializable(typeof(GitHub.Copilot.AssistantToolCallDeltaEvent), TypeInfoPropertyName = "SessionEventsAssistantToolCallDeltaEvent")] [JsonSerializable(typeof(GitHub.Copilot.AssistantTurnEndData), TypeInfoPropertyName = "SessionEventsAssistantTurnEndData")] [JsonSerializable(typeof(GitHub.Copilot.AssistantTurnEndEvent), TypeInfoPropertyName = "SessionEventsAssistantTurnEndEvent")] [JsonSerializable(typeof(GitHub.Copilot.AssistantTurnRetryData), TypeInfoPropertyName = "SessionEventsAssistantTurnRetryData")] [JsonSerializable(typeof(GitHub.Copilot.AssistantTurnRetryEvent), TypeInfoPropertyName = "SessionEventsAssistantTurnRetryEvent")] [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.AssistantUsageCopilotUsage), TypeInfoPropertyName = "SessionEventsAssistantUsageCopilotUsage")] [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.AssistantUsageTransport), TypeInfoPropertyName = "SessionEventsAssistantUsageTransport")] [JsonSerializable(typeof(GitHub.Copilot.AssistedApprovalJudgeFailureReason), TypeInfoPropertyName = "SessionEventsAssistedApprovalJudgeFailureReason")] [JsonSerializable(typeof(GitHub.Copilot.AssistedApprovalRecommendation), TypeInfoPropertyName = "SessionEventsAssistedApprovalRecommendation")] [JsonSerializable(typeof(GitHub.Copilot.Attachment), TypeInfoPropertyName = "SessionEventsAttachment")] [JsonSerializable(typeof(GitHub.Copilot.AttachmentBlob), TypeInfoPropertyName = "SessionEventsAttachmentBlob")] [JsonSerializable(typeof(GitHub.Copilot.AttachmentDirectory), TypeInfoPropertyName = "SessionEventsAttachmentDirectory")] [JsonSerializable(typeof(GitHub.Copilot.AttachmentExtensionContext), TypeInfoPropertyName = "SessionEventsAttachmentExtensionContext")] [JsonSerializable(typeof(GitHub.Copilot.AttachmentFile), TypeInfoPropertyName = "SessionEventsAttachmentFile")] [JsonSerializable(typeof(GitHub.Copilot.AttachmentFileLineRange), TypeInfoPropertyName = "SessionEventsAttachmentFileLineRange")] [JsonSerializable(typeof(GitHub.Copilot.AttachmentGitHubActionsJob), TypeInfoPropertyName = "SessionEventsAttachmentGitHubActionsJob")] [JsonSerializable(typeof(GitHub.Copilot.AttachmentGitHubCommit), TypeInfoPropertyName = "SessionEventsAttachmentGitHubCommit")] [JsonSerializable(typeof(GitHub.Copilot.AttachmentGitHubFile), TypeInfoPropertyName = "SessionEventsAttachmentGitHubFile")] [JsonSerializable(typeof(GitHub.Copilot.AttachmentGitHubFileDiff), TypeInfoPropertyName = "SessionEventsAttachmentGitHubFileDiff")] [JsonSerializable(typeof(GitHub.Copilot.AttachmentGitHubFileDiffSide), TypeInfoPropertyName = "SessionEventsAttachmentGitHubFileDiffSide")] [JsonSerializable(typeof(GitHub.Copilot.AttachmentGitHubReference), TypeInfoPropertyName = "SessionEventsAttachmentGitHubReference")] [JsonSerializable(typeof(GitHub.Copilot.AttachmentGitHubReferenceType), TypeInfoPropertyName = "SessionEventsAttachmentGitHubReferenceType")] [JsonSerializable(typeof(GitHub.Copilot.AttachmentGitHubRelease), TypeInfoPropertyName = "SessionEventsAttachmentGitHubRelease")] [JsonSerializable(typeof(GitHub.Copilot.AttachmentGitHubRepository), TypeInfoPropertyName = "SessionEventsAttachmentGitHubRepository")] [JsonSerializable(typeof(GitHub.Copilot.AttachmentGitHubSnippet), TypeInfoPropertyName = "SessionEventsAttachmentGitHubSnippet")] [JsonSerializable(typeof(GitHub.Copilot.AttachmentGitHubTreeComparison), TypeInfoPropertyName = "SessionEventsAttachmentGitHubTreeComparison")] [JsonSerializable(typeof(GitHub.Copilot.AttachmentGitHubTreeComparisonSide), TypeInfoPropertyName = "SessionEventsAttachmentGitHubTreeComparisonSide")] [JsonSerializable(typeof(GitHub.Copilot.AttachmentGitHubUrl), TypeInfoPropertyName = "SessionEventsAttachmentGitHubUrl")] [JsonSerializable(typeof(GitHub.Copilot.AttachmentSelection), TypeInfoPropertyName = "SessionEventsAttachmentSelection")] [JsonSerializable(typeof(GitHub.Copilot.AttachmentSelectionDetails), TypeInfoPropertyName = "SessionEventsAttachmentSelectionDetails")] [JsonSerializable(typeof(GitHub.Copilot.AttachmentSelectionDetailsEnd), TypeInfoPropertyName = "SessionEventsAttachmentSelectionDetailsEnd")] [JsonSerializable(typeof(GitHub.Copilot.AttachmentSelectionDetailsStart), TypeInfoPropertyName = "SessionEventsAttachmentSelectionDetailsStart")] [JsonSerializable(typeof(GitHub.Copilot.AutoModeResolvedReasoningBucket), TypeInfoPropertyName = "SessionEventsAutoModeResolvedReasoningBucket")] [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.AutoTier), TypeInfoPropertyName = "SessionEventsAutoTier")] [JsonSerializable(typeof(GitHub.Copilot.AutoTierSwitchFailureReason), TypeInfoPropertyName = "SessionEventsAutoTierSwitchFailureReason")] [JsonSerializable(typeof(GitHub.Copilot.AutopilotObjectiveChangedOperation), TypeInfoPropertyName = "SessionEventsAutopilotObjectiveChangedOperation")] [JsonSerializable(typeof(GitHub.Copilot.AutopilotObjectiveChangedStatus), TypeInfoPropertyName = "SessionEventsAutopilotObjectiveChangedStatus")] [JsonSerializable(typeof(GitHub.Copilot.BinaryAssetReference), TypeInfoPropertyName = "SessionEventsBinaryAssetReference")] [JsonSerializable(typeof(GitHub.Copilot.BinaryAssetReferenceType), TypeInfoPropertyName = "SessionEventsBinaryAssetReferenceType")] [JsonSerializable(typeof(GitHub.Copilot.BinaryAssetType), TypeInfoPropertyName = "SessionEventsBinaryAssetType")] [JsonSerializable(typeof(GitHub.Copilot.CanvasRegistryChangedCanvas), TypeInfoPropertyName = "SessionEventsCanvasRegistryChangedCanvas")] [JsonSerializable(typeof(GitHub.Copilot.CanvasRegistryChangedCanvasAction), TypeInfoPropertyName = "SessionEventsCanvasRegistryChangedCanvasAction")] [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.CitableSource), TypeInfoPropertyName = "SessionEventsCitableSource")] [JsonSerializable(typeof(GitHub.Copilot.CitationLocation), TypeInfoPropertyName = "SessionEventsCitationLocation")] [JsonSerializable(typeof(GitHub.Copilot.CitationLocationBlock), TypeInfoPropertyName = "SessionEventsCitationLocationBlock")] [JsonSerializable(typeof(GitHub.Copilot.CitationLocationChar), TypeInfoPropertyName = "SessionEventsCitationLocationChar")] [JsonSerializable(typeof(GitHub.Copilot.CitationLocationPage), TypeInfoPropertyName = "SessionEventsCitationLocationPage")] [JsonSerializable(typeof(GitHub.Copilot.CitationProvider), TypeInfoPropertyName = "SessionEventsCitationProvider")] [JsonSerializable(typeof(GitHub.Copilot.CitationReference), TypeInfoPropertyName = "SessionEventsCitationReference")] [JsonSerializable(typeof(GitHub.Copilot.CitationSource), TypeInfoPropertyName = "SessionEventsCitationSource")] [JsonSerializable(typeof(GitHub.Copilot.CitationSpan), TypeInfoPropertyName = "SessionEventsCitationSpan")] [JsonSerializable(typeof(GitHub.Copilot.Citations), TypeInfoPropertyName = "SessionEventsCitations")] [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.CompactionTrigger), TypeInfoPropertyName = "SessionEventsCompactionTrigger")] [JsonSerializable(typeof(GitHub.Copilot.CompletionReceiptEventRange), TypeInfoPropertyName = "SessionEventsCompletionReceiptEventRange")] [JsonSerializable(typeof(GitHub.Copilot.CompletionReceiptFinalTool), TypeInfoPropertyName = "SessionEventsCompletionReceiptFinalTool")] [JsonSerializable(typeof(GitHub.Copilot.CompletionReceiptStopReason), TypeInfoPropertyName = "SessionEventsCompletionReceiptStopReason")] [JsonSerializable(typeof(GitHub.Copilot.CompletionReceiptToolStatus), TypeInfoPropertyName = "SessionEventsCompletionReceiptToolStatus")] [JsonSerializable(typeof(GitHub.Copilot.ContextTier), TypeInfoPropertyName = "SessionEventsContextTier")] [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.FactoryPermissionOperation), TypeInfoPropertyName = "SessionEventsFactoryPermissionOperation")] [JsonSerializable(typeof(GitHub.Copilot.FactoryPermissionPhase), TypeInfoPropertyName = "SessionEventsFactoryPermissionPhase")] [JsonSerializable(typeof(GitHub.Copilot.FactoryRunSettledData), TypeInfoPropertyName = "SessionEventsFactoryRunSettledData")] [JsonSerializable(typeof(GitHub.Copilot.FactoryRunSettledEvent), TypeInfoPropertyName = "SessionEventsFactoryRunSettledEvent")] [JsonSerializable(typeof(GitHub.Copilot.FactoryRunSettledStatus), TypeInfoPropertyName = "SessionEventsFactoryRunSettledStatus")] [JsonSerializable(typeof(GitHub.Copilot.FactoryRunStartedData), TypeInfoPropertyName = "SessionEventsFactoryRunStartedData")] [JsonSerializable(typeof(GitHub.Copilot.FactoryRunStartedEvent), TypeInfoPropertyName = "SessionEventsFactoryRunStartedEvent")] [JsonSerializable(typeof(GitHub.Copilot.FactoryRunUpdatedData), TypeInfoPropertyName = "SessionEventsFactoryRunUpdatedData")] [JsonSerializable(typeof(GitHub.Copilot.FactoryRunUpdatedEvent), TypeInfoPropertyName = "SessionEventsFactoryRunUpdatedEvent")] [JsonSerializable(typeof(GitHub.Copilot.FusionAttribution), TypeInfoPropertyName = "SessionEventsFusionAttribution")] [JsonSerializable(typeof(GitHub.Copilot.FusionConversationScope), TypeInfoPropertyName = "SessionEventsFusionConversationScope")] [JsonSerializable(typeof(GitHub.Copilot.FusionFollowUpAction), TypeInfoPropertyName = "SessionEventsFusionFollowUpAction")] [JsonSerializable(typeof(GitHub.Copilot.FusionFollowUpRecommendation), TypeInfoPropertyName = "SessionEventsFusionFollowUpRecommendation")] [JsonSerializable(typeof(GitHub.Copilot.FusionPattern), TypeInfoPropertyName = "SessionEventsFusionPattern")] [JsonSerializable(typeof(GitHub.Copilot.FusionPhaseActivityKind), TypeInfoPropertyName = "SessionEventsFusionPhaseActivityKind")] [JsonSerializable(typeof(GitHub.Copilot.FusionPhaseKind), TypeInfoPropertyName = "SessionEventsFusionPhaseKind")] [JsonSerializable(typeof(GitHub.Copilot.FusionPhasePlanStep), TypeInfoPropertyName = "SessionEventsFusionPhasePlanStep")] [JsonSerializable(typeof(GitHub.Copilot.FusionPhaseStatus), TypeInfoPropertyName = "SessionEventsFusionPhaseStatus")] [JsonSerializable(typeof(GitHub.Copilot.FusionPhaseUsage), TypeInfoPropertyName = "SessionEventsFusionPhaseUsage")] [JsonSerializable(typeof(GitHub.Copilot.FusionProjectionMode), TypeInfoPropertyName = "SessionEventsFusionProjectionMode")] [JsonSerializable(typeof(GitHub.Copilot.FusionScores), TypeInfoPropertyName = "SessionEventsFusionScores")] [JsonSerializable(typeof(GitHub.Copilot.FusionTurnKind), TypeInfoPropertyName = "SessionEventsFusionTurnKind")] [JsonSerializable(typeof(GitHub.Copilot.GitHubMcpToolConfig), TypeInfoPropertyName = "SessionEventsGitHubMcpToolConfig")] [JsonSerializable(typeof(GitHub.Copilot.GitHubRepoRef), TypeInfoPropertyName = "SessionEventsGitHubRepoRef")] [JsonSerializable(typeof(GitHub.Copilot.HandoffRepository), TypeInfoPropertyName = "SessionEventsHandoffRepository")] [JsonSerializable(typeof(GitHub.Copilot.HandoffSourceType), TypeInfoPropertyName = "SessionEventsHandoffSourceType")] [JsonSerializable(typeof(GitHub.Copilot.HeaderEntry), TypeInfoPropertyName = "SessionEventsHeaderEntry")] [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.HookProgressData), TypeInfoPropertyName = "SessionEventsHookProgressData")] [JsonSerializable(typeof(GitHub.Copilot.HookProgressEvent), TypeInfoPropertyName = "SessionEventsHookProgressEvent")] [JsonSerializable(typeof(GitHub.Copilot.HookStartData), TypeInfoPropertyName = "SessionEventsHookStartData")] [JsonSerializable(typeof(GitHub.Copilot.HookStartEvent), TypeInfoPropertyName = "SessionEventsHookStartEvent")] [JsonSerializable(typeof(GitHub.Copilot.ManagedSettingsEnforcedAction), TypeInfoPropertyName = "SessionEventsManagedSettingsEnforcedAction")] [JsonSerializable(typeof(GitHub.Copilot.ManagedSettingsEnforcedEscalation), TypeInfoPropertyName = "SessionEventsManagedSettingsEnforcedEscalation")] [JsonSerializable(typeof(GitHub.Copilot.ManagedSettingsResolvedSource), TypeInfoPropertyName = "SessionEventsManagedSettingsResolvedSource")] [JsonSerializable(typeof(GitHub.Copilot.McpAppToolCallCompleteData), TypeInfoPropertyName = "SessionEventsMcpAppToolCallCompleteData")] [JsonSerializable(typeof(GitHub.Copilot.McpAppToolCallCompleteError), TypeInfoPropertyName = "SessionEventsMcpAppToolCallCompleteError")] [JsonSerializable(typeof(GitHub.Copilot.McpAppToolCallCompleteEvent), TypeInfoPropertyName = "SessionEventsMcpAppToolCallCompleteEvent")] [JsonSerializable(typeof(GitHub.Copilot.McpAppToolCallCompleteToolMeta), TypeInfoPropertyName = "SessionEventsMcpAppToolCallCompleteToolMeta")] [JsonSerializable(typeof(GitHub.Copilot.McpAppToolCallCompleteToolMetaUI), TypeInfoPropertyName = "SessionEventsMcpAppToolCallCompleteToolMetaUI")] [JsonSerializable(typeof(GitHub.Copilot.McpHeadersRefreshCompletedData), TypeInfoPropertyName = "SessionEventsMcpHeadersRefreshCompletedData")] [JsonSerializable(typeof(GitHub.Copilot.McpHeadersRefreshCompletedEvent), TypeInfoPropertyName = "SessionEventsMcpHeadersRefreshCompletedEvent")] [JsonSerializable(typeof(GitHub.Copilot.McpHeadersRefreshCompletedOutcome), TypeInfoPropertyName = "SessionEventsMcpHeadersRefreshCompletedOutcome")] [JsonSerializable(typeof(GitHub.Copilot.McpHeadersRefreshRequiredData), TypeInfoPropertyName = "SessionEventsMcpHeadersRefreshRequiredData")] [JsonSerializable(typeof(GitHub.Copilot.McpHeadersRefreshRequiredEvent), TypeInfoPropertyName = "SessionEventsMcpHeadersRefreshRequiredEvent")] [JsonSerializable(typeof(GitHub.Copilot.McpHeadersRefreshRequiredReason), TypeInfoPropertyName = "SessionEventsMcpHeadersRefreshRequiredReason")] [JsonSerializable(typeof(GitHub.Copilot.McpOauthCompletedData), TypeInfoPropertyName = "SessionEventsMcpOauthCompletedData")] [JsonSerializable(typeof(GitHub.Copilot.McpOauthCompletedEvent), TypeInfoPropertyName = "SessionEventsMcpOauthCompletedEvent")] [JsonSerializable(typeof(GitHub.Copilot.McpOauthCompletionOutcome), TypeInfoPropertyName = "SessionEventsMcpOauthCompletionOutcome")] [JsonSerializable(typeof(GitHub.Copilot.McpOauthHttpResponse), TypeInfoPropertyName = "SessionEventsMcpOauthHttpResponse")] [JsonSerializable(typeof(GitHub.Copilot.McpOauthRequestReason), TypeInfoPropertyName = "SessionEventsMcpOauthRequestReason")] [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.McpOauthWWWAuthenticateParams), TypeInfoPropertyName = "SessionEventsMcpOauthWWWAuthenticateParams")] [JsonSerializable(typeof(GitHub.Copilot.McpPromptsListChangedEvent), TypeInfoPropertyName = "SessionEventsMcpPromptsListChangedEvent")] [JsonSerializable(typeof(GitHub.Copilot.McpResourcesListChangedEvent), TypeInfoPropertyName = "SessionEventsMcpResourcesListChangedEvent")] [JsonSerializable(typeof(GitHub.Copilot.McpServerMetadata), TypeInfoPropertyName = "SessionEventsMcpServerMetadata")] [JsonSerializable(typeof(GitHub.Copilot.McpServerSource), TypeInfoPropertyName = "SessionEventsMcpServerSource")] [JsonSerializable(typeof(GitHub.Copilot.McpServerStatus), TypeInfoPropertyName = "SessionEventsMcpServerStatus")] [JsonSerializable(typeof(GitHub.Copilot.McpServerTransport), TypeInfoPropertyName = "SessionEventsMcpServerTransport")] [JsonSerializable(typeof(GitHub.Copilot.McpServersLoadedServer), TypeInfoPropertyName = "SessionEventsMcpServersLoadedServer")] [JsonSerializable(typeof(GitHub.Copilot.McpToolsListChangedEvent), TypeInfoPropertyName = "SessionEventsMcpToolsListChangedEvent")] [JsonSerializable(typeof(GitHub.Copilot.ModelCallFailureBadRequestKind), TypeInfoPropertyName = "SessionEventsModelCallFailureBadRequestKind")] [JsonSerializable(typeof(GitHub.Copilot.ModelCallFailureData), TypeInfoPropertyName = "SessionEventsModelCallFailureData")] [JsonSerializable(typeof(GitHub.Copilot.ModelCallFailureEvent), TypeInfoPropertyName = "SessionEventsModelCallFailureEvent")] [JsonSerializable(typeof(GitHub.Copilot.ModelCallFailureKind), TypeInfoPropertyName = "SessionEventsModelCallFailureKind")] [JsonSerializable(typeof(GitHub.Copilot.ModelCallFailureRequestFingerprint), TypeInfoPropertyName = "SessionEventsModelCallFailureRequestFingerprint")] [JsonSerializable(typeof(GitHub.Copilot.ModelCallFailureSource), TypeInfoPropertyName = "SessionEventsModelCallFailureSource")] [JsonSerializable(typeof(GitHub.Copilot.ModelCallFailureTransport), TypeInfoPropertyName = "SessionEventsModelCallFailureTransport")] [JsonSerializable(typeof(GitHub.Copilot.ModelCallFinishedData), TypeInfoPropertyName = "SessionEventsModelCallFinishedData")] [JsonSerializable(typeof(GitHub.Copilot.ModelCallFinishedEvent), TypeInfoPropertyName = "SessionEventsModelCallFinishedEvent")] [JsonSerializable(typeof(GitHub.Copilot.ModelCallFinishedOutcome), TypeInfoPropertyName = "SessionEventsModelCallFinishedOutcome")] [JsonSerializable(typeof(GitHub.Copilot.ModelCallStartData), TypeInfoPropertyName = "SessionEventsModelCallStartData")] [JsonSerializable(typeof(GitHub.Copilot.ModelCallStartEvent), TypeInfoPropertyName = "SessionEventsModelCallStartEvent")] [JsonSerializable(typeof(GitHub.Copilot.ModelChangeSource), TypeInfoPropertyName = "SessionEventsModelChangeSource")] [JsonSerializable(typeof(GitHub.Copilot.OmittedBinaryOmittedReason), TypeInfoPropertyName = "SessionEventsOmittedBinaryOmittedReason")] [JsonSerializable(typeof(GitHub.Copilot.OmittedBinaryResult), TypeInfoPropertyName = "SessionEventsOmittedBinaryResult")] [JsonSerializable(typeof(GitHub.Copilot.OmittedBinaryType), TypeInfoPropertyName = "SessionEventsOmittedBinaryType")] [JsonSerializable(typeof(GitHub.Copilot.PendingMessagesModifiedData), TypeInfoPropertyName = "SessionEventsPendingMessagesModifiedData")] [JsonSerializable(typeof(GitHub.Copilot.PendingMessagesModifiedEvent), TypeInfoPropertyName = "SessionEventsPendingMessagesModifiedEvent")] [JsonSerializable(typeof(GitHub.Copilot.PermissionAssistedApproval), TypeInfoPropertyName = "SessionEventsPermissionAssistedApproval")] [JsonSerializable(typeof(GitHub.Copilot.PermissionCompletedData), TypeInfoPropertyName = "SessionEventsPermissionCompletedData")] [JsonSerializable(typeof(GitHub.Copilot.PermissionCompletedEvent), TypeInfoPropertyName = "SessionEventsPermissionCompletedEvent")] [JsonSerializable(typeof(GitHub.Copilot.PermissionMode), TypeInfoPropertyName = "SessionEventsPermissionMode")] [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.PermissionPromptRequestExtensionEnvAccess), TypeInfoPropertyName = "SessionEventsPermissionPromptRequestExtensionEnvAccess")] [JsonSerializable(typeof(GitHub.Copilot.PermissionPromptRequestExtensionManagement), TypeInfoPropertyName = "SessionEventsPermissionPromptRequestExtensionManagement")] [JsonSerializable(typeof(GitHub.Copilot.PermissionPromptRequestExtensionPermissionAccess), TypeInfoPropertyName = "SessionEventsPermissionPromptRequestExtensionPermissionAccess")] [JsonSerializable(typeof(GitHub.Copilot.PermissionPromptRequestFactory), TypeInfoPropertyName = "SessionEventsPermissionPromptRequestFactory")] [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.PermissionRecommendation), TypeInfoPropertyName = "SessionEventsPermissionRecommendation")] [JsonSerializable(typeof(GitHub.Copilot.PermissionRequest), TypeInfoPropertyName = "SessionEventsPermissionRequest")] [JsonSerializable(typeof(GitHub.Copilot.PermissionRequestCustomTool), TypeInfoPropertyName = "SessionEventsPermissionRequestCustomTool")] [JsonSerializable(typeof(GitHub.Copilot.PermissionRequestExtensionEnvAccess), TypeInfoPropertyName = "SessionEventsPermissionRequestExtensionEnvAccess")] [JsonSerializable(typeof(GitHub.Copilot.PermissionRequestExtensionManagement), TypeInfoPropertyName = "SessionEventsPermissionRequestExtensionManagement")] [JsonSerializable(typeof(GitHub.Copilot.PermissionRequestExtensionPermissionAccess), TypeInfoPropertyName = "SessionEventsPermissionRequestExtensionPermissionAccess")] [JsonSerializable(typeof(GitHub.Copilot.PermissionRequestFactory), TypeInfoPropertyName = "SessionEventsPermissionRequestFactory")] [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.PermissionRequestMemoryScope), TypeInfoPropertyName = "SessionEventsPermissionRequestMemoryScope")] [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.PermissionRequestShellCommandSegment), TypeInfoPropertyName = "SessionEventsPermissionRequestShellCommandSegment")] [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.PersistedBinaryImage), TypeInfoPropertyName = "SessionEventsPersistedBinaryImage")] [JsonSerializable(typeof(GitHub.Copilot.PersistedBinaryImageType), TypeInfoPropertyName = "SessionEventsPersistedBinaryImageType")] [JsonSerializable(typeof(GitHub.Copilot.PersistedBinaryResult), TypeInfoPropertyName = "SessionEventsPersistedBinaryResult")] [JsonSerializable(typeof(GitHub.Copilot.PlanChangedOperation), TypeInfoPropertyName = "SessionEventsPlanChangedOperation")] [JsonSerializable(typeof(GitHub.Copilot.PromptCacheBreakData), TypeInfoPropertyName = "SessionEventsPromptCacheBreakData")] [JsonSerializable(typeof(GitHub.Copilot.PromptCacheBreakEvent), TypeInfoPropertyName = "SessionEventsPromptCacheBreakEvent")] [JsonSerializable(typeof(GitHub.Copilot.ReasoningSummary), TypeInfoPropertyName = "SessionEventsReasoningSummary")] [JsonSerializable(typeof(GitHub.Copilot.RecommendedAutoTier), TypeInfoPropertyName = "SessionEventsRecommendedAutoTier")] [JsonSerializable(typeof(GitHub.Copilot.RemediationAction), TypeInfoPropertyName = "SessionEventsRemediationAction")] [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.SandboxDecisionData), TypeInfoPropertyName = "SessionEventsSandboxDecisionData")] [JsonSerializable(typeof(GitHub.Copilot.SandboxDecisionEvent), TypeInfoPropertyName = "SessionEventsSandboxDecisionEvent")] [JsonSerializable(typeof(GitHub.Copilot.ScheduleOrigin), TypeInfoPropertyName = "SessionEventsScheduleOrigin")] [JsonSerializable(typeof(GitHub.Copilot.SessionEvent), TypeInfoPropertyName = "SessionEventsSessionEvent")] [JsonSerializable(typeof(GitHub.Copilot.SessionLimitsConfig), TypeInfoPropertyName = "SessionEventsSessionLimitsConfig")] [JsonSerializable(typeof(GitHub.Copilot.SessionLimitsExhaustedCompletedData), TypeInfoPropertyName = "SessionEventsSessionLimitsExhaustedCompletedData")] [JsonSerializable(typeof(GitHub.Copilot.SessionLimitsExhaustedCompletedEvent), TypeInfoPropertyName = "SessionEventsSessionLimitsExhaustedCompletedEvent")] [JsonSerializable(typeof(GitHub.Copilot.SessionLimitsExhaustedRequestedData), TypeInfoPropertyName = "SessionEventsSessionLimitsExhaustedRequestedData")] [JsonSerializable(typeof(GitHub.Copilot.SessionLimitsExhaustedRequestedEvent), TypeInfoPropertyName = "SessionEventsSessionLimitsExhaustedRequestedEvent")] [JsonSerializable(typeof(GitHub.Copilot.SessionLimitsExhaustedResponse), TypeInfoPropertyName = "SessionEventsSessionLimitsExhaustedResponse")] [JsonSerializable(typeof(GitHub.Copilot.SessionLimitsExhaustedResponseAction), TypeInfoPropertyName = "SessionEventsSessionLimitsExhaustedResponseAction")] [JsonSerializable(typeof(GitHub.Copilot.SessionMode), TypeInfoPropertyName = "SessionEventsSessionMode")] [JsonSerializable(typeof(GitHub.Copilot.ShutdownAgentMetric), TypeInfoPropertyName = "SessionEventsShutdownAgentMetric")] [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.SkillInvokedTrigger), TypeInfoPropertyName = "SessionEventsSkillInvokedTrigger")] [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.SubagentConfiguredData), TypeInfoPropertyName = "SessionEventsSubagentConfiguredData")] [JsonSerializable(typeof(GitHub.Copilot.SubagentConfiguredEvent), TypeInfoPropertyName = "SessionEventsSubagentConfiguredEvent")] [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.SubagentModelSelectionSource), TypeInfoPropertyName = "SessionEventsSubagentModelSelectionSource")] [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.SubagentTaskModelSource), TypeInfoPropertyName = "SessionEventsSubagentTaskModelSource")] [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.SystemNotificationFactoryCompleted), TypeInfoPropertyName = "SessionEventsSystemNotificationFactoryCompleted")] [JsonSerializable(typeof(GitHub.Copilot.SystemNotificationFactoryCompletedStatus), TypeInfoPropertyName = "SessionEventsSystemNotificationFactoryCompletedStatus")] [JsonSerializable(typeof(GitHub.Copilot.SystemNotificationFactoryPauseInfo), TypeInfoPropertyName = "SessionEventsSystemNotificationFactoryPauseInfo")] [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.SystemNotificationUnclassified), TypeInfoPropertyName = "SessionEventsSystemNotificationUnclassified")] [JsonSerializable(typeof(GitHub.Copilot.TaskCompletionOutcome), TypeInfoPropertyName = "SessionEventsTaskCompletionOutcome")] [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.ToolExecutionCompleteContentShellExit), TypeInfoPropertyName = "SessionEventsToolExecutionCompleteContentShellExit")] [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.ToolExecutionCompleteToolDescription), TypeInfoPropertyName = "SessionEventsToolExecutionCompleteToolDescription")] [JsonSerializable(typeof(GitHub.Copilot.ToolExecutionCompleteToolDescriptionMeta), TypeInfoPropertyName = "SessionEventsToolExecutionCompleteToolDescriptionMeta")] [JsonSerializable(typeof(GitHub.Copilot.ToolExecutionCompleteToolDescriptionMetaUI), TypeInfoPropertyName = "SessionEventsToolExecutionCompleteToolDescriptionMetaUI")] [JsonSerializable(typeof(GitHub.Copilot.ToolExecutionCompleteToolDescriptionMetaUIVisibility), TypeInfoPropertyName = "SessionEventsToolExecutionCompleteToolDescriptionMetaUIVisibility")] [JsonSerializable(typeof(GitHub.Copilot.ToolExecutionCompleteUIResource), TypeInfoPropertyName = "SessionEventsToolExecutionCompleteUIResource")] [JsonSerializable(typeof(GitHub.Copilot.ToolExecutionCompleteUIResourceMeta), TypeInfoPropertyName = "SessionEventsToolExecutionCompleteUIResourceMeta")] [JsonSerializable(typeof(GitHub.Copilot.ToolExecutionCompleteUIResourceMetaUI), TypeInfoPropertyName = "SessionEventsToolExecutionCompleteUIResourceMetaUI")] [JsonSerializable(typeof(GitHub.Copilot.ToolExecutionCompleteUIResourceMetaUICsp), TypeInfoPropertyName = "SessionEventsToolExecutionCompleteUIResourceMetaUICsp")] [JsonSerializable(typeof(GitHub.Copilot.ToolExecutionCompleteUIResourceMetaUIPermissions), TypeInfoPropertyName = "SessionEventsToolExecutionCompleteUIResourceMetaUIPermissions")] [JsonSerializable(typeof(GitHub.Copilot.ToolExecutionCompleteUIResourceMetaUIPermissionsCamera), TypeInfoPropertyName = "SessionEventsToolExecutionCompleteUIResourceMetaUIPermissionsCamera")] [JsonSerializable(typeof(GitHub.Copilot.ToolExecutionCompleteUIResourceMetaUIPermissionsClipboardWrite), TypeInfoPropertyName = "SessionEventsToolExecutionCompleteUIResourceMetaUIPermissionsClipboardWrite")] [JsonSerializable(typeof(GitHub.Copilot.ToolExecutionCompleteUIResourceMetaUIPermissionsGeolocation), TypeInfoPropertyName = "SessionEventsToolExecutionCompleteUIResourceMetaUIPermissionsGeolocation")] [JsonSerializable(typeof(GitHub.Copilot.ToolExecutionCompleteUIResourceMetaUIPermissionsMicrophone), TypeInfoPropertyName = "SessionEventsToolExecutionCompleteUIResourceMetaUIPermissionsMicrophone")] [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.ToolExecutionStartShellToolInfo), TypeInfoPropertyName = "SessionEventsToolExecutionStartShellToolInfo")] [JsonSerializable(typeof(GitHub.Copilot.ToolExecutionStartToolDescription), TypeInfoPropertyName = "SessionEventsToolExecutionStartToolDescription")] [JsonSerializable(typeof(GitHub.Copilot.ToolExecutionStartToolDescriptionMeta), TypeInfoPropertyName = "SessionEventsToolExecutionStartToolDescriptionMeta")] [JsonSerializable(typeof(GitHub.Copilot.ToolExecutionStartToolDescriptionMetaUI), TypeInfoPropertyName = "SessionEventsToolExecutionStartToolDescriptionMetaUI")] [JsonSerializable(typeof(GitHub.Copilot.ToolExecutionStartToolDescriptionMetaUIVisibility), TypeInfoPropertyName = "SessionEventsToolExecutionStartToolDescriptionMetaUIVisibility")] [JsonSerializable(typeof(GitHub.Copilot.ToolSearchActivatedData), TypeInfoPropertyName = "SessionEventsToolSearchActivatedData")] [JsonSerializable(typeof(GitHub.Copilot.ToolSearchActivatedEvent), TypeInfoPropertyName = "SessionEventsToolSearchActivatedEvent")] [JsonSerializable(typeof(GitHub.Copilot.ToolUserRequestedData), TypeInfoPropertyName = "SessionEventsToolUserRequestedData")] [JsonSerializable(typeof(GitHub.Copilot.ToolUserRequestedEvent), TypeInfoPropertyName = "SessionEventsToolUserRequestedEvent")] [JsonSerializable(typeof(GitHub.Copilot.UIEphemeralQueryPhase), TypeInfoPropertyName = "SessionEventsUIEphemeralQueryPhase")] [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.UserMessageData), TypeInfoPropertyName = "SessionEventsUserMessageData")] [JsonSerializable(typeof(GitHub.Copilot.UserMessageDelivery), TypeInfoPropertyName = "SessionEventsUserMessageDelivery")] [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.UserToolSessionApprovalExtensionEnvAccess), TypeInfoPropertyName = "SessionEventsUserToolSessionApprovalExtensionEnvAccess")] [JsonSerializable(typeof(GitHub.Copilot.UserToolSessionApprovalExtensionManagement), TypeInfoPropertyName = "SessionEventsUserToolSessionApprovalExtensionManagement")] [JsonSerializable(typeof(GitHub.Copilot.UserToolSessionApprovalExtensionPermissionAccess), TypeInfoPropertyName = "SessionEventsUserToolSessionApprovalExtensionPermissionAccess")] [JsonSerializable(typeof(GitHub.Copilot.UserToolSessionApprovalFactory), TypeInfoPropertyName = "SessionEventsUserToolSessionApprovalFactory")] [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.Verbosity), TypeInfoPropertyName = "SessionEventsVerbosity")] [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(AccountAllUsers))] [JsonSerializable(typeof(AccountGetCurrentAuthResult))] [JsonSerializable(typeof(AccountGetQuotaRequest))] [JsonSerializable(typeof(AccountGetQuotaResult))] [JsonSerializable(typeof(AccountLoginRequest))] [JsonSerializable(typeof(AccountLoginResult))] [JsonSerializable(typeof(AccountLogoutRequest))] [JsonSerializable(typeof(AccountLogoutResult))] [JsonSerializable(typeof(AccountQuotaSnapshot))] [JsonSerializable(typeof(AgentDiscoveryPath))] [JsonSerializable(typeof(AgentDiscoveryPathList))] [JsonSerializable(typeof(AgentGetCurrentResult))] [JsonSerializable(typeof(AgentInfo))] [JsonSerializable(typeof(AgentList))] [JsonSerializable(typeof(AgentRegistryLiveTargetEntry))] [JsonSerializable(typeof(AgentRegistryLogCapture))] [JsonSerializable(typeof(AgentRegistrySpawnRequest))] [JsonSerializable(typeof(AgentRegistrySpawnResult))] [JsonSerializable(typeof(AgentReloadResult))] [JsonSerializable(typeof(AgentSelectRequest))] [JsonSerializable(typeof(AgentSelectResult))] [JsonSerializable(typeof(AgentSetPromptRequest))] [JsonSerializable(typeof(AgentsDiscoverRequest))] [JsonSerializable(typeof(AgentsGetDiscoveryPathsRequest))] [JsonSerializable(typeof(AuthIdentity))] [JsonSerializable(typeof(AuthInfo))] [JsonSerializable(typeof(AuthValidationError))] [JsonSerializable(typeof(AutopilotObjectiveCreditLimit))] [JsonSerializable(typeof(AutopilotObjectiveGetStateResult))] [JsonSerializable(typeof(AutopilotObjectiveState))] [JsonSerializable(typeof(BuiltInModelCatalog))] [JsonSerializable(typeof(BuiltInModelCatalogEntry))] [JsonSerializable(typeof(BuiltinToolDescriptor))] [JsonSerializable(typeof(BuiltinToolFormat))] [JsonSerializable(typeof(BuiltinToolInputSchema))] [JsonSerializable(typeof(CancelUserRequestedShellCommandResult))] [JsonSerializable(typeof(CanvasAction))] [JsonSerializable(typeof(CanvasActionInvokeRequest))] [JsonSerializable(typeof(CanvasActionInvokeResult))] [JsonSerializable(typeof(CanvasCloseRequest))] [JsonSerializable(typeof(CanvasHostContext))] [JsonSerializable(typeof(CanvasHostContextCapabilities))] [JsonSerializable(typeof(CanvasList))] [JsonSerializable(typeof(CanvasListOpenResult))] [JsonSerializable(typeof(CanvasOpenRequest))] [JsonSerializable(typeof(CanvasProviderCloseRequest))] [JsonSerializable(typeof(CanvasProviderInvokeActionRequest))] [JsonSerializable(typeof(CanvasProviderOpenRequest))] [JsonSerializable(typeof(CanvasProviderOpenResult))] [JsonSerializable(typeof(CanvasProviderRegisterRequest))] [JsonSerializable(typeof(CanvasProviderUnregisterRequest))] [JsonSerializable(typeof(CanvasSessionContext))] [JsonSerializable(typeof(CapiSessionOptions))] [JsonSerializable(typeof(CardDigest))] [JsonSerializable(typeof(CatalogAiSkillCandidateProvenance))] [JsonSerializable(typeof(CatalogCandidate))] [JsonSerializable(typeof(CatalogCandidateSource))] [JsonSerializable(typeof(CatalogClientContract))] [JsonSerializable(typeof(CatalogMcpServerCandidateProvenance))] [JsonSerializable(typeof(CatalogNegotiatedContract))] [JsonSerializable(typeof(CatalogSearchRequest))] [JsonSerializable(typeof(CatalogSearchResult))] [JsonSerializable(typeof(ClientTaskCancelRequest))] [JsonSerializable(typeof(ClientTaskCancelResult))] [JsonSerializable(typeof(CommandList))] [JsonSerializable(typeof(CommandsFinalizeInvocationEffectRequest))] [JsonSerializable(typeof(CommandsFinalizeInvocationEffectRequestEffect))] [JsonSerializable(typeof(CommandsFinalizeInvocationEffectResult))] [JsonSerializable(typeof(CommandsHandlePendingCommandRequest))] [JsonSerializable(typeof(CommandsHandlePendingCommandResult))] [JsonSerializable(typeof(CommandsInvokeRequest))] [JsonSerializable(typeof(CommandsRespondToQueuedCommandRequest))] [JsonSerializable(typeof(CommandsRespondToQueuedCommandResult))] [JsonSerializable(typeof(CompletionsGetTriggerCharactersResult))] [JsonSerializable(typeof(CompletionsRequestRequest))] [JsonSerializable(typeof(CompletionsRequestResult))] [JsonSerializable(typeof(ConfigureSessionExtensionsParams))] [JsonSerializable(typeof(ConnectClientInfo))] [JsonSerializable(typeof(ConnectRemoteSessionParams))] [JsonSerializable(typeof(ConnectRequest))] [JsonSerializable(typeof(ConnectResult))] [JsonSerializable(typeof(ConnectedRemoteSessionMetadata))] [JsonSerializable(typeof(ConnectedRemoteSessionMetadataRepository))] [JsonSerializable(typeof(ContentExclusionCheckPathsRequest))] [JsonSerializable(typeof(ContentExclusionCheckPathsResult))] [JsonSerializable(typeof(ContentExclusionPathCheck))] [JsonSerializable(typeof(ContextHeaviestMessage))] [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(CurrentToolMetadata))] [JsonSerializable(typeof(DebugCollectLogsCollectedEntry))] [JsonSerializable(typeof(DebugCollectLogsDestination))] [JsonSerializable(typeof(DebugCollectLogsEntry))] [JsonSerializable(typeof(DebugCollectLogsInclude))] [JsonSerializable(typeof(DebugCollectLogsRequest))] [JsonSerializable(typeof(DebugCollectLogsResult))] [JsonSerializable(typeof(DebugCollectLogsSkippedEntry))] [JsonSerializable(typeof(DiscoveredCanvas))] [JsonSerializable(typeof(DiscoveredExtension))] [JsonSerializable(typeof(DiscoveredExtensionPlugin))] [JsonSerializable(typeof(DiscoveredExtensions))] [JsonSerializable(typeof(DiscoveredExtensionsDisableRequest))] [JsonSerializable(typeof(DiscoveredExtensionsEnableRequest))] [JsonSerializable(typeof(DiscoveredHook))] [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(ExtensionLaunchProfile))] [JsonSerializable(typeof(ExtensionLaunchProviderResolveRequest))] [JsonSerializable(typeof(ExtensionLaunchProviderResolveResult))] [JsonSerializable(typeof(ExtensionList))] [JsonSerializable(typeof(ExtensionsDisableRequest))] [JsonSerializable(typeof(ExtensionsEnableRequest))] [JsonSerializable(typeof(ExternalToolTextResultForLlmBinaryResultsForLlm))] [JsonSerializable(typeof(ExternalToolTextResultForLlmContent))] [JsonSerializable(typeof(ExternalToolTextResultForLlmContentResourceLinkIcon))] [JsonSerializable(typeof(FactoryAbortRequest))] [JsonSerializable(typeof(FactoryAckResult))] [JsonSerializable(typeof(FactoryAgentOptions))] [JsonSerializable(typeof(FactoryAgentRequest))] [JsonSerializable(typeof(FactoryAgentResult))] [JsonSerializable(typeof(FactoryAgentSummary))] [JsonSerializable(typeof(FactoryCancelRequest))] [JsonSerializable(typeof(FactoryCurrentPhase))] [JsonSerializable(typeof(FactoryDeclaredLimits))] [JsonSerializable(typeof(FactoryExecuteRequest))] [JsonSerializable(typeof(FactoryExecuteResult))] [JsonSerializable(typeof(FactoryGetRunProgressRequest))] [JsonSerializable(typeof(FactoryGetRunRequest))] [JsonSerializable(typeof(FactoryJournalGetRequest))] [JsonSerializable(typeof(FactoryJournalGetResult))] [JsonSerializable(typeof(FactoryJournalPutRequest))] [JsonSerializable(typeof(FactoryListRunsRequest))] [JsonSerializable(typeof(FactoryListRunsResult))] [JsonSerializable(typeof(FactoryLogLine))] [JsonSerializable(typeof(FactoryLogRequest))] [JsonSerializable(typeof(FactoryPauseCheckpointRequest))] [JsonSerializable(typeof(FactoryPauseInfo))] [JsonSerializable(typeof(FactoryPauseRequest))] [JsonSerializable(typeof(FactoryPhaseObservation))] [JsonSerializable(typeof(FactoryProgressLine))] [JsonSerializable(typeof(FactoryProgressPage))] [JsonSerializable(typeof(FactoryResumeRequest))] [JsonSerializable(typeof(FactoryResumeResult))] [JsonSerializable(typeof(FactoryRunConsumed))] [JsonSerializable(typeof(FactoryRunDetail))] [JsonSerializable(typeof(FactoryRunFailure))] [JsonSerializable(typeof(FactoryRunLimits))] [JsonSerializable(typeof(FactoryRunRequest))] [JsonSerializable(typeof(FactoryRunResult))] [JsonSerializable(typeof(FactoryRunSummary))] [JsonSerializable(typeof(FactoryRunTerminal))] [JsonSerializable(typeof(FactoryToolResumeRequest))] [JsonSerializable(typeof(FactoryToolRunOptions))] [JsonSerializable(typeof(FactoryToolRunRequest))] [JsonSerializable(typeof(FleetStartRequest))] [JsonSerializable(typeof(FleetStartResult))] [JsonSerializable(typeof(FolderTrustAddParams))] [JsonSerializable(typeof(FolderTrustCheckParams))] [JsonSerializable(typeof(FolderTrustCheckResult))] [JsonSerializable(typeof(GitHubTelemetryClientInfo))] [JsonSerializable(typeof(GitHubTelemetryEvent))] [JsonSerializable(typeof(GitHubTelemetryNotification))] [JsonSerializable(typeof(GitHubTokenAcquireRequest))] [JsonSerializable(typeof(GitHubTokenAcquireResult))] [JsonSerializable(typeof(HandlePendingToolCallRequest))] [JsonSerializable(typeof(HandlePendingToolCallResult))] [JsonSerializable(typeof(HistoryAbortManualCompactionResult))] [JsonSerializable(typeof(HistoryCancelBackgroundCompactionResult))] [JsonSerializable(typeof(HistoryClearContextRequest))] [JsonSerializable(typeof(HistoryClearContextResult))] [JsonSerializable(typeof(HistoryCompactContextWindow))] [JsonSerializable(typeof(HistoryCompactResult))] [JsonSerializable(typeof(HistoryListRewindPointsResult))] [JsonSerializable(typeof(HistoryPreviewRewindRequest))] [JsonSerializable(typeof(HistoryPreviewRewindResult))] [JsonSerializable(typeof(HistoryRewindFilePreview))] [JsonSerializable(typeof(HistoryRewindPoint))] [JsonSerializable(typeof(HistoryRewindRequest))] [JsonSerializable(typeof(HistoryRewindResult))] [JsonSerializable(typeof(HistorySkippedFileRestore))] [JsonSerializable(typeof(HistorySummarizeForHandoffResult))] [JsonSerializable(typeof(HistoryTruncateRequest))] [JsonSerializable(typeof(HistoryTruncateResult))] [JsonSerializable(typeof(HooksDiscoverRequest))] [JsonSerializable(typeof(HooksDiscoverResult))] [JsonSerializable(typeof(IDictionary))] [JsonSerializable(typeof(IDictionary))] [JsonSerializable(typeof(IList))] [JsonSerializable(typeof(IList))] [JsonSerializable(typeof(IList))] [JsonSerializable(typeof(IList))] [JsonSerializable(typeof(InstalledPlugin))] [JsonSerializable(typeof(InstalledPluginInfo))] [JsonSerializable(typeof(InstructionDiscoveryPath))] [JsonSerializable(typeof(InstructionDiscoveryPathList))] [JsonSerializable(typeof(InstructionSource))] [JsonSerializable(typeof(InstructionsDiscoverRequest))] [JsonSerializable(typeof(InstructionsGetDiscoveryPathsRequest))] [JsonSerializable(typeof(InstructionsGetSourcesResult))] [JsonSerializable(typeof(InterruptMainTurnRequest))] [JsonSerializable(typeof(InterruptMainTurnResult))] [JsonSerializable(typeof(LlmInferenceHttpRequestChunkRequest))] [JsonSerializable(typeof(LlmInferenceHttpRequestChunkResult))] [JsonSerializable(typeof(LlmInferenceHttpRequestStartRequest))] [JsonSerializable(typeof(LlmInferenceHttpRequestStartResult))] [JsonSerializable(typeof(LlmInferenceHttpResponseChunkError))] [JsonSerializable(typeof(LlmInferenceHttpResponseChunkRequest))] [JsonSerializable(typeof(LlmInferenceHttpResponseChunkResult))] [JsonSerializable(typeof(LlmInferenceHttpResponseStartRequest))] [JsonSerializable(typeof(LlmInferenceHttpResponseStartResult))] [JsonSerializable(typeof(LlmInferenceSetProviderResult))] [JsonSerializable(typeof(LocalSessionMetadataValue))] [JsonSerializable(typeof(LogRequest))] [JsonSerializable(typeof(LogResult))] [JsonSerializable(typeof(LspInitializeRequest))] [JsonSerializable(typeof(ManagedSettingsReadResult))] [JsonSerializable(typeof(MarketplaceAddResult))] [JsonSerializable(typeof(MarketplaceBrowseResult))] [JsonSerializable(typeof(MarketplaceInfo))] [JsonSerializable(typeof(MarketplaceListResult))] [JsonSerializable(typeof(MarketplacePluginInfo))] [JsonSerializable(typeof(MarketplaceRefreshEntry))] [JsonSerializable(typeof(MarketplaceRefreshResult))] [JsonSerializable(typeof(MarketplaceRemoveResult))] [JsonSerializable(typeof(McpAllowedServer))] [JsonSerializable(typeof(McpAppsCallToolRequest))] [JsonSerializable(typeof(McpAppsDiagnoseCapability))] [JsonSerializable(typeof(McpAppsDiagnoseRequest))] [JsonSerializable(typeof(McpAppsDiagnoseResult))] [JsonSerializable(typeof(McpAppsDiagnoseServer))] [JsonSerializable(typeof(McpAppsHostContext))] [JsonSerializable(typeof(McpAppsHostContextDetails))] [JsonSerializable(typeof(McpAppsListToolsRequest))] [JsonSerializable(typeof(McpAppsListToolsResult))] [JsonSerializable(typeof(McpAppsReadResourceRequest))] [JsonSerializable(typeof(McpAppsReadResourceResult))] [JsonSerializable(typeof(McpAppsResourceContent))] [JsonSerializable(typeof(McpAppsSetHostContextDetails))] [JsonSerializable(typeof(McpAppsSetHostContextRequest))] [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(McpConfigureGitHubRequest))] [JsonSerializable(typeof(McpConfigureGitHubResult))] [JsonSerializable(typeof(McpDisableRequest))] [JsonSerializable(typeof(McpDiscoverRequest))] [JsonSerializable(typeof(McpDiscoverResult))] [JsonSerializable(typeof(McpEnableRequest))] [JsonSerializable(typeof(McpExecuteSamplingParams))] [JsonSerializable(typeof(McpExecuteSamplingRequest))] [JsonSerializable(typeof(McpExecuteSamplingResult))] [JsonSerializable(typeof(McpFailedServer))] [JsonSerializable(typeof(McpFilteredServer))] [JsonSerializable(typeof(McpHeadersHandlePendingHeadersRefreshRequest))] [JsonSerializable(typeof(McpHeadersHandlePendingHeadersRefreshRequestRequest))] [JsonSerializable(typeof(McpHeadersHandlePendingHeadersRefreshRequestResult))] [JsonSerializable(typeof(McpHostState))] [JsonSerializable(typeof(McpInstallPlan))] [JsonSerializable(typeof(McpIsServerRunningRequest))] [JsonSerializable(typeof(McpIsServerRunningResult))] [JsonSerializable(typeof(McpListToolsRequest))] [JsonSerializable(typeof(McpListToolsResult))] [JsonSerializable(typeof(McpOauthAuthenticationStateChangedRequest))] [JsonSerializable(typeof(McpOauthHandlePendingRequest))] [JsonSerializable(typeof(McpOauthHandlePendingResult))] [JsonSerializable(typeof(McpOauthLoginRequest))] [JsonSerializable(typeof(McpOauthLoginResult))] [JsonSerializable(typeof(McpOauthPendingRequestResponse))] [JsonSerializable(typeof(McpOauthProbeRequest))] [JsonSerializable(typeof(McpOauthProbeResult))] [JsonSerializable(typeof(McpOauthRespondRequest))] [JsonSerializable(typeof(McpOauthRespondResult))] [JsonSerializable(typeof(McpPlanConfigurationChange))] [JsonSerializable(typeof(McpPlanInstallRequest))] [JsonSerializable(typeof(McpPlanInstallResult))] [JsonSerializable(typeof(McpPlanInstallSource))] [JsonSerializable(typeof(McpPlanPolicyResult))] [JsonSerializable(typeof(McpPlanProvenance))] [JsonSerializable(typeof(McpPlanRequiredValue))] [JsonSerializable(typeof(McpPlanResourceIdentity))] [JsonSerializable(typeof(McpPlanSecretPlaceholder))] [JsonSerializable(typeof(McpPlanTarget))] [JsonSerializable(typeof(McpPlanTransportChoice))] [JsonSerializable(typeof(McpRegisterExternalClientRequest))] [JsonSerializable(typeof(McpReloadWithConfigRequest))] [JsonSerializable(typeof(McpRemoveGitHubResult))] [JsonSerializable(typeof(McpResource))] [JsonSerializable(typeof(McpResourceAnnotations))] [JsonSerializable(typeof(McpResourceContent))] [JsonSerializable(typeof(McpResourceIcon))] [JsonSerializable(typeof(McpResourceTemplate))] [JsonSerializable(typeof(McpResourcesListRequest))] [JsonSerializable(typeof(McpResourcesListResult))] [JsonSerializable(typeof(McpResourcesListTemplatesRequest))] [JsonSerializable(typeof(McpResourcesListTemplatesResult))] [JsonSerializable(typeof(McpResourcesReadRequest))] [JsonSerializable(typeof(McpResourcesReadResult))] [JsonSerializable(typeof(McpRestartServerRequest))] [JsonSerializable(typeof(McpSamplingExecutionResult))] [JsonSerializable(typeof(McpServer))] [JsonSerializable(typeof(McpServerCardReference))] [JsonSerializable(typeof(McpServerFailureInfo))] [JsonSerializable(typeof(McpServerList))] [JsonSerializable(typeof(McpServerNeedsAuthInfo))] [JsonSerializable(typeof(McpSetEnvValueModeParams))] [JsonSerializable(typeof(McpSetEnvValueModeResult))] [JsonSerializable(typeof(McpSourceFile))] [JsonSerializable(typeof(McpSourcePlugin))] [JsonSerializable(typeof(McpSourceRef))] [JsonSerializable(typeof(McpStartServerRequest))] [JsonSerializable(typeof(McpStartServersResult))] [JsonSerializable(typeof(McpStopServerRequest))] [JsonSerializable(typeof(McpTaskMetadata))] [JsonSerializable(typeof(McpToolUi))] [JsonSerializable(typeof(McpTools))] [JsonSerializable(typeof(McpUnregisterExternalClientRequest))] [JsonSerializable(typeof(MetadataContextAttributionResult))] [JsonSerializable(typeof(MetadataContextAttributionResultContextAttribution))] [JsonSerializable(typeof(MetadataContextAttributionResultContextAttributionCategories))] [JsonSerializable(typeof(MetadataContextAttributionResultContextAttributionCompactions))] [JsonSerializable(typeof(MetadataContextAttributionResultContextAttributionEntry))] [JsonSerializable(typeof(MetadataContextHeaviestMessagesRequest))] [JsonSerializable(typeof(MetadataContextHeaviestMessagesResult))] [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(MetadataUpdateClientMetadataRequest))] [JsonSerializable(typeof(ModeSetRequest))] [JsonSerializable(typeof(ModeSetResult))] [JsonSerializable(typeof(Model))] [JsonSerializable(typeof(ModelApplyStartupOverlayRequest))] [JsonSerializable(typeof(ModelBilling))] [JsonSerializable(typeof(ModelBillingPromo))] [JsonSerializable(typeof(ModelBillingTokenPrices))] [JsonSerializable(typeof(ModelBillingTokenPricesLongContext))] [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(ModelMessage))] [JsonSerializable(typeof(ModelPickerPersistenceRequest))] [JsonSerializable(typeof(ModelPickerSettingsContext))] [JsonSerializable(typeof(ModelPickerSettingsContextEnvironment))] [JsonSerializable(typeof(ModelPolicy))] [JsonSerializable(typeof(ModelSetAllowedModelsRequest))] [JsonSerializable(typeof(ModelSetAllowedModelsResult))] [JsonSerializable(typeof(ModelSetReasoningEffortRequest))] [JsonSerializable(typeof(ModelSetReasoningEffortResult))] [JsonSerializable(typeof(ModelSwitchAutoTierRequest))] [JsonSerializable(typeof(ModelSwitchAutoTierResult))] [JsonSerializable(typeof(ModelSwitchConfirmation))] [JsonSerializable(typeof(ModelSwitchToRequest))] [JsonSerializable(typeof(ModelSwitchToResult))] [JsonSerializable(typeof(ModelWarningText))] [JsonSerializable(typeof(ModelsListRequest))] [JsonSerializable(typeof(MoveMcpLoadingToBackgroundResult))] [JsonSerializable(typeof(NameGetResult))] [JsonSerializable(typeof(NameSetAutoRequest))] [JsonSerializable(typeof(NameSetAutoResult))] [JsonSerializable(typeof(NameSetRequest))] [JsonSerializable(typeof(NamedProviderConfig))] [JsonSerializable(typeof(OpenCanvasInstance))] [JsonSerializable(typeof(OptionsUpdateAdditionalContentExclusionPolicy))] [JsonSerializable(typeof(OptionsUpdateAdditionalContentExclusionPolicyRule))] [JsonSerializable(typeof(OptionsUpdateAdditionalContentExclusionPolicyRuleSource))] [JsonSerializable(typeof(PendingPermissionRequest))] [JsonSerializable(typeof(PendingPermissionRequestList))] [JsonSerializable(typeof(PermissionDecision))] [JsonSerializable(typeof(PermissionDecisionApproveForLocationApproval))] [JsonSerializable(typeof(PermissionDecisionApproveForSessionApproval))] [JsonSerializable(typeof(PermissionDecisionContext))] [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(PermissionsGetModeRequest))] [JsonSerializable(typeof(PermissionsGetModeResult))] [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(PermissionsSetModeRequest))] [JsonSerializable(typeof(PermissionsSetModeResult))] [JsonSerializable(typeof(PermissionsSetRequiredRequest))] [JsonSerializable(typeof(PermissionsSetRequiredResult))] [JsonSerializable(typeof(PermissionsUrlsSetUnrestrictedModeResult))] [JsonSerializable(typeof(PingRequest))] [JsonSerializable(typeof(PingResult))] [JsonSerializable(typeof(PlanReadResult))] [JsonSerializable(typeof(PlanReadSqlTodosResult))] [JsonSerializable(typeof(PlanReadSqlTodosWithDependenciesResult))] [JsonSerializable(typeof(PlanSqlTodoDependency))] [JsonSerializable(typeof(PlanSqlTodosRow))] [JsonSerializable(typeof(PlanUpdateRequest))] [JsonSerializable(typeof(Plugin))] [JsonSerializable(typeof(PluginInstallResult))] [JsonSerializable(typeof(PluginList))] [JsonSerializable(typeof(PluginListResult))] [JsonSerializable(typeof(PluginUpdateAllEntry))] [JsonSerializable(typeof(PluginUpdateAllResult))] [JsonSerializable(typeof(PluginUpdateResult))] [JsonSerializable(typeof(PluginsBuiltinSetRequest))] [JsonSerializable(typeof(PluginsDisableRequest))] [JsonSerializable(typeof(PluginsEnableRequest))] [JsonSerializable(typeof(PluginsInstallRequest))] [JsonSerializable(typeof(PluginsMarketplacesAddRequest))] [JsonSerializable(typeof(PluginsMarketplacesBrowseRequest))] [JsonSerializable(typeof(PluginsMarketplacesRefreshRequest))] [JsonSerializable(typeof(PluginsMarketplacesRemoveRequest))] [JsonSerializable(typeof(PluginsUninstallRequest))] [JsonSerializable(typeof(PluginsUpdateRequest))] [JsonSerializable(typeof(ProtocolExternalToolDefinition))] [JsonSerializable(typeof(ProviderAddRequest))] [JsonSerializable(typeof(ProviderAddResult))] [JsonSerializable(typeof(ProviderConfig))] [JsonSerializable(typeof(ProviderConfigAzure))] [JsonSerializable(typeof(ProviderEndpoint))] [JsonSerializable(typeof(ProviderModelConfig))] [JsonSerializable(typeof(ProviderSessionToken))] [JsonSerializable(typeof(ProviderTokenAcquireRequest))] [JsonSerializable(typeof(ProviderTokenAcquireResult))] [JsonSerializable(typeof(PushAttachment))] [JsonSerializable(typeof(PushAttachmentFileLineRange))] [JsonSerializable(typeof(PushAttachmentGitHubFileDiffSide))] [JsonSerializable(typeof(PushAttachmentGitHubTreeComparisonSide))] [JsonSerializable(typeof(PushAttachmentSelectionDetails))] [JsonSerializable(typeof(PushAttachmentSelectionDetailsEnd))] [JsonSerializable(typeof(PushAttachmentSelectionDetailsStart))] [JsonSerializable(typeof(PushGitHubRepoRef))] [JsonSerializable(typeof(QueueBeginDeferredIdleDrainRequest))] [JsonSerializable(typeof(QueueBeginDeferredIdleDrainResult))] [JsonSerializable(typeof(QueueConsumeSystemNotificationsRequest))] [JsonSerializable(typeof(QueueDeferSessionIdleRequest))] [JsonSerializable(typeof(QueueDuplicateAtRequest))] [JsonSerializable(typeof(QueueDuplicateAtResult))] [JsonSerializable(typeof(QueueEnqueueResumePendingResult))] [JsonSerializable(typeof(QueueFinishDeferredIdleDrainRequest))] [JsonSerializable(typeof(QueueFinishDeferredIdleDrainResult))] [JsonSerializable(typeof(QueueHasPendingResult))] [JsonSerializable(typeof(QueueInsertAtRequest))] [JsonSerializable(typeof(QueueInsertAtResult))] [JsonSerializable(typeof(QueueInsertMessage))] [JsonSerializable(typeof(QueueMoveItemRequest))] [JsonSerializable(typeof(QueueMoveItemResult))] [JsonSerializable(typeof(QueuePendingItems))] [JsonSerializable(typeof(QueuePendingItemsResult))] [JsonSerializable(typeof(QueueRemoveAtRequest))] [JsonSerializable(typeof(QueueRemoveAtResult))] [JsonSerializable(typeof(QueueRemoveMostRecentResult))] [JsonSerializable(typeof(QueueSendNowRequest))] [JsonSerializable(typeof(QueueSendNowResult))] [JsonSerializable(typeof(QueueSetDrainPausedRequest))] [JsonSerializable(typeof(QueueSnapshotResult))] [JsonSerializable(typeof(QueueUpdateTextRequest))] [JsonSerializable(typeof(QueueUpdateTextResult))] [JsonSerializable(typeof(QueuedCommandResult))] [JsonSerializable(typeof(RegisterEventInterestParams))] [JsonSerializable(typeof(RegisterEventInterestResult))] [JsonSerializable(typeof(RegisterExtensionToolsParams))] [JsonSerializable(typeof(RegisterExtensionToolsResult))] [JsonSerializable(typeof(ReleaseEventInterestParams))] [JsonSerializable(typeof(RemoteControlConfig))] [JsonSerializable(typeof(RemoteControlConfigExistingMcSession))] [JsonSerializable(typeof(RemoteControlStatus))] [JsonSerializable(typeof(RemoteControlStatusResult))] [JsonSerializable(typeof(RemoteControlStopResult))] [JsonSerializable(typeof(RemoteControlTransferResult))] [JsonSerializable(typeof(RemoteEnableRequest))] [JsonSerializable(typeof(RemoteEnableResult))] [JsonSerializable(typeof(RemoteNotifySteerableChangedRequest))] [JsonSerializable(typeof(RemoteNotifySteerableChangedResult))] [JsonSerializable(typeof(RemoteSessionConnectionResult))] [JsonSerializable(typeof(RemoteSessionMetadataRepository))] [JsonSerializable(typeof(RemoteSessionMetadataValue))] [JsonSerializable(typeof(RunOptions))] [JsonSerializable(typeof(SandboxConfig))] [JsonSerializable(typeof(SandboxConfigAuth))] [JsonSerializable(typeof(SandboxConfigUserPolicy))] [JsonSerializable(typeof(SandboxConfigUserPolicyExperimental))] [JsonSerializable(typeof(SandboxConfigUserPolicyExperimentalSeatbelt))] [JsonSerializable(typeof(SandboxConfigUserPolicyFilesystem))] [JsonSerializable(typeof(SandboxConfigUserPolicyNetwork))] [JsonSerializable(typeof(SandboxConfigUserPolicyNetworkProxy))] [JsonSerializable(typeof(SandboxConfigUserPolicySeatbelt))] [JsonSerializable(typeof(SandboxDisableForSessionRequest))] [JsonSerializable(typeof(SandboxDisableForSessionResult))] [JsonSerializable(typeof(SandboxEnforcementStatus))] [JsonSerializable(typeof(ScheduleAddAtRequest))] [JsonSerializable(typeof(ScheduleAddCronRequest))] [JsonSerializable(typeof(ScheduleAddRequest))] [JsonSerializable(typeof(ScheduleAddResult))] [JsonSerializable(typeof(ScheduleAddSelfPacedRequest))] [JsonSerializable(typeof(ScheduleEntry))] [JsonSerializable(typeof(ScheduleHasSelfPacedResult))] [JsonSerializable(typeof(ScheduleList))] [JsonSerializable(typeof(ScheduleRearmSelfPacedRequest))] [JsonSerializable(typeof(ScheduleStopRequest))] [JsonSerializable(typeof(ScheduleStopResult))] [JsonSerializable(typeof(SecretsAddFilterValuesRequest))] [JsonSerializable(typeof(SecretsAddFilterValuesResult))] [JsonSerializable(typeof(SendAttachmentsToMessageParams))] [JsonSerializable(typeof(SendMessageItem))] [JsonSerializable(typeof(SendMessagesRequest))] [JsonSerializable(typeof(SendMessagesResult))] [JsonSerializable(typeof(SendRequest))] [JsonSerializable(typeof(SendResult))] [JsonSerializable(typeof(SendSystemNotificationRequest))] [JsonSerializable(typeof(ServerAgentList))] [JsonSerializable(typeof(ServerInstructionSourceList))] [JsonSerializable(typeof(ServerSkill))] [JsonSerializable(typeof(ServerSkillList))] [JsonSerializable(typeof(SessionActivity))] [JsonSerializable(typeof(SessionAgentDeselectRequest))] [JsonSerializable(typeof(SessionAgentGetCurrentRequest))] [JsonSerializable(typeof(SessionAgentListRequest))] [JsonSerializable(typeof(SessionAgentListRequestWithSession))] [JsonSerializable(typeof(SessionAgentReloadRequest))] [JsonSerializable(typeof(SessionAuthLoginRequest))] [JsonSerializable(typeof(SessionAuthLogoutUserRequest))] [JsonSerializable(typeof(SessionAuthStatus))] [JsonSerializable(typeof(SessionAuthSwitchRequest))] [JsonSerializable(typeof(SessionAutopilotObjectiveGetStateRequest))] [JsonSerializable(typeof(SessionBulkDeleteResult))] [JsonSerializable(typeof(SessionCancelAllBackgroundAgentsRequest))] [JsonSerializable(typeof(SessionCanvasListOpenRequest))] [JsonSerializable(typeof(SessionCanvasListRequest))] [JsonSerializable(typeof(SessionCommandsListRequest))] [JsonSerializable(typeof(SessionCommandsListRequestWithSession))] [JsonSerializable(typeof(SessionCompletionItem))] [JsonSerializable(typeof(SessionCompletionsGetTriggerCharactersRequest))] [JsonSerializable(typeof(SessionContext))] [JsonSerializable(typeof(SessionEnrichMetadataResult))] [JsonSerializable(typeof(SessionEventLogTailRequest))] [JsonSerializable(typeof(SessionExtensionsListRequest))] [JsonSerializable(typeof(SessionExtensionsReloadRequest))] [JsonSerializable(typeof(SessionFactoryPauseAtCheckpointResult))] [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(SessionFsSqliteTransactionError))] [JsonSerializable(typeof(SessionFsSqliteTransactionRequest))] [JsonSerializable(typeof(SessionFsSqliteTransactionResult))] [JsonSerializable(typeof(SessionFsSqliteTransactionStatement))] [JsonSerializable(typeof(SessionFsStatRequest))] [JsonSerializable(typeof(SessionFsStatResult))] [JsonSerializable(typeof(SessionFsWriteFileRequest))] [JsonSerializable(typeof(SessionGitHubAuthGetAllAuthAvailableRequest))] [JsonSerializable(typeof(SessionGitHubAuthGetCurrentAuthInfoRequest))] [JsonSerializable(typeof(SessionGitHubAuthGetStatusRequest))] [JsonSerializable(typeof(SessionGitHubAuthLastAuthErrorsRequest))] [JsonSerializable(typeof(SessionGitHubAuthLogoutRequest))] [JsonSerializable(typeof(SessionGitHubAuthRefreshCopilotUserRequest))] [JsonSerializable(typeof(SessionHistoryAbortManualCompactionRequest))] [JsonSerializable(typeof(SessionHistoryCancelBackgroundCompactionRequest))] [JsonSerializable(typeof(SessionHistoryCompactRequest))] [JsonSerializable(typeof(SessionHistoryCompactRequestWithSession))] [JsonSerializable(typeof(SessionHistoryListRewindPointsRequest))] [JsonSerializable(typeof(SessionHistorySummarizeForHandoffRequest))] [JsonSerializable(typeof(SessionInstalledPlugin))] [JsonSerializable(typeof(SessionInstructionsGetSourcesRequest))] [JsonSerializable(typeof(SessionLimitPredictionBaselineData))] [JsonSerializable(typeof(SessionLimitPredictionDetails))] [JsonSerializable(typeof(SessionLimitPredictionPredictRequest))] [JsonSerializable(typeof(SessionLimitPredictionPredictRequestWithSession))] [JsonSerializable(typeof(SessionLimitPredictionResult))] [JsonSerializable(typeof(SessionLimitPredictionTierOption))] [JsonSerializable(typeof(SessionList))] [JsonSerializable(typeof(SessionListEntry))] [JsonSerializable(typeof(SessionListFilter))] [JsonSerializable(typeof(SessionLoadDeferredRepoHooksResult))] [JsonSerializable(typeof(SessionMcpAppsGetHostContextRequest))] [JsonSerializable(typeof(SessionMcpListRequest))] [JsonSerializable(typeof(SessionMcpMoveLoadingToBackgroundRequest))] [JsonSerializable(typeof(SessionMcpReloadRequest))] [JsonSerializable(typeof(SessionMcpRemoveGitHubRequest))] [JsonSerializable(typeof(SessionMetadataActivityRequest))] [JsonSerializable(typeof(SessionMetadataGetClientMetadataRequest))] [JsonSerializable(typeof(SessionMetadataGetContextAttributionRequest))] [JsonSerializable(typeof(SessionMetadataIsProcessingRequest))] [JsonSerializable(typeof(SessionMetadataSnapshot))] [JsonSerializable(typeof(SessionMetadataSnapshotRequest))] [JsonSerializable(typeof(SessionMetadataSnapshotWorkspace))] [JsonSerializable(typeof(SessionModeGetRequest))] [JsonSerializable(typeof(SessionModelGetCurrentRequest))] [JsonSerializable(typeof(SessionModelList))] [JsonSerializable(typeof(SessionModelListRequest))] [JsonSerializable(typeof(SessionModelListRequestWithSession))] [JsonSerializable(typeof(SessionModelPriceCategory))] [JsonSerializable(typeof(SessionNameGetRequest))] [JsonSerializable(typeof(SessionOpenResult))] [JsonSerializable(typeof(SessionPlanDeleteRequest))] [JsonSerializable(typeof(SessionPlanReadRequest))] [JsonSerializable(typeof(SessionPlanReadSqlTodosRequest))] [JsonSerializable(typeof(SessionPlanReadSqlTodosWithDependenciesRequest))] [JsonSerializable(typeof(SessionPluginsListRequest))] [JsonSerializable(typeof(SessionPluginsReloadRequest))] [JsonSerializable(typeof(SessionPluginsReloadRequestWithSession))] [JsonSerializable(typeof(SessionProviderGetEndpointRequest))] [JsonSerializable(typeof(SessionProviderGetEndpointRequestWithSession))] [JsonSerializable(typeof(SessionPruneResult))] [JsonSerializable(typeof(SessionQueueClearRequest))] [JsonSerializable(typeof(SessionQueueEnqueueResumePendingRequest))] [JsonSerializable(typeof(SessionQueueHasPendingRequest))] [JsonSerializable(typeof(SessionQueuePendingItemsRequest))] [JsonSerializable(typeof(SessionQueueProcessRequest))] [JsonSerializable(typeof(SessionQueueRemoveMostRecentRequest))] [JsonSerializable(typeof(SessionQueueSnapshotRequest))] [JsonSerializable(typeof(SessionRemoteDisableRequest))] [JsonSerializable(typeof(SessionSandboxGetEnforcementStatusRequest))] [JsonSerializable(typeof(SessionScheduleHasSelfPacedRequest))] [JsonSerializable(typeof(SessionScheduleHydrateRequest))] [JsonSerializable(typeof(SessionScheduleListRequest))] [JsonSerializable(typeof(SessionSetCredentialsParams))] [JsonSerializable(typeof(SessionSetCredentialsResult))] [JsonSerializable(typeof(SessionSettingsBuiltInToolAvailabilitySnapshot))] [JsonSerializable(typeof(SessionSettingsEvaluatePredicateRequest))] [JsonSerializable(typeof(SessionSettingsEvaluatePredicateResult))] [JsonSerializable(typeof(SessionSettingsJobSnapshot))] [JsonSerializable(typeof(SessionSettingsModelSnapshot))] [JsonSerializable(typeof(SessionSettingsOnlineEvaluationSnapshot))] [JsonSerializable(typeof(SessionSettingsRepoSnapshot))] [JsonSerializable(typeof(SessionSettingsSnapshot))] [JsonSerializable(typeof(SessionSettingsSnapshotRequest))] [JsonSerializable(typeof(SessionSettingsValidationSnapshot))] [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(SessionTelemetryEngagement))] [JsonSerializable(typeof(SessionTelemetryGetEngagementIdRequest))] [JsonSerializable(typeof(SessionToolsGetCurrentMetadataRequest))] [JsonSerializable(typeof(SessionToolsInitializeAndValidateRequest))] [JsonSerializable(typeof(SessionUiRegisterDirectAutoModeSwitchHandlerRequest))] [JsonSerializable(typeof(SessionUpdateOptionsParams))] [JsonSerializable(typeof(SessionUpdateOptionsResult))] [JsonSerializable(typeof(SessionUsageGetMetricsRequest))] [JsonSerializable(typeof(SessionVisibilityGetRequest))] [JsonSerializable(typeof(SessionWorkingDirectoryContext))] [JsonSerializable(typeof(SessionWorkspacesAutopilotObjectiveExistsRequest))] [JsonSerializable(typeof(SessionWorkspacesDeleteAutopilotObjectiveRequest))] [JsonSerializable(typeof(SessionWorkspacesGetWorkspaceRequest))] [JsonSerializable(typeof(SessionWorkspacesListCheckpointsRequest))] [JsonSerializable(typeof(SessionWorkspacesListFilesRequest))] [JsonSerializable(typeof(SessionWorkspacesReadAutopilotObjectiveRequest))] [JsonSerializable(typeof(SessionsBulkDeleteRequest))] [JsonSerializable(typeof(SessionsCheckInUseRequest))] [JsonSerializable(typeof(SessionsCheckInUseResult))] [JsonSerializable(typeof(SessionsClientMetadataEntry))] [JsonSerializable(typeof(SessionsCloseRequest))] [JsonSerializable(typeof(SessionsCloseResult))] [JsonSerializable(typeof(SessionsDeleteRequest))] [JsonSerializable(typeof(SessionsEnrichMetadataRequest))] [JsonSerializable(typeof(SessionsFindByPrefixRequest))] [JsonSerializable(typeof(SessionsFindByPrefixResult))] [JsonSerializable(typeof(SessionsFindByTaskIDRequest))] [JsonSerializable(typeof(SessionsFindByTaskIDResult))] [JsonSerializable(typeof(SessionsForkRequest))] [JsonSerializable(typeof(SessionsForkResult))] [JsonSerializable(typeof(SessionsGetBoardEntryCountRequest))] [JsonSerializable(typeof(SessionsGetBoardEntryCountResult))] [JsonSerializable(typeof(SessionsGetClientMetadataRequest))] [JsonSerializable(typeof(SessionsGetEventFilePathRequest))] [JsonSerializable(typeof(SessionsGetEventFilePathResult))] [JsonSerializable(typeof(SessionsGetLastForContextRequest))] [JsonSerializable(typeof(SessionsGetLastForContextResult))] [JsonSerializable(typeof(SessionsGetMetadataRequest))] [JsonSerializable(typeof(SessionsGetMetadataResult))] [JsonSerializable(typeof(SessionsGetPersistedRemoteSteerableRequest))] [JsonSerializable(typeof(SessionsGetPersistedRemoteSteerableResult))] [JsonSerializable(typeof(SessionsListNonEmptySessionIdsRequest))] [JsonSerializable(typeof(SessionsListNonEmptySessionIdsResult))] [JsonSerializable(typeof(SessionsListRequest))] [JsonSerializable(typeof(SessionsLoadDeferredRepoHooksRequest))] [JsonSerializable(typeof(SessionsOpenProgress))] [JsonSerializable(typeof(SessionsPruneOldRequest))] [JsonSerializable(typeof(SessionsReadPersistedEventsRequest))] [JsonSerializable(typeof(SessionsRegisterExtensionToolsOnSessionOptions))] [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(SessionsSetRemoteControlSteeringRequest))] [JsonSerializable(typeof(SessionsStartRemoteControlRequest))] [JsonSerializable(typeof(SessionsStopRemoteControlRequest))] [JsonSerializable(typeof(SessionsTransferRemoteControlRequest))] [JsonSerializable(typeof(SettableAuthInfo))] [JsonSerializable(typeof(ShellCancelUserRequestedRequest))] [JsonSerializable(typeof(ShellCredentials))] [JsonSerializable(typeof(ShellExecRequest))] [JsonSerializable(typeof(ShellExecResult))] [JsonSerializable(typeof(ShellExecuteUserRequestedRequest))] [JsonSerializable(typeof(ShellInitScript))] [JsonSerializable(typeof(ShellKillRequest))] [JsonSerializable(typeof(ShellKillResult))] [JsonSerializable(typeof(ShellOptions))] [JsonSerializable(typeof(ShutdownRequest))] [JsonSerializable(typeof(Skill))] [JsonSerializable(typeof(SkillDiscoveryPath))] [JsonSerializable(typeof(SkillDiscoveryPathList))] [JsonSerializable(typeof(SkillList))] [JsonSerializable(typeof(SkillsConfigSetDisabledSkillsRequest))] [JsonSerializable(typeof(SkillsConfigSetSkillDisabledRequest))] [JsonSerializable(typeof(SkillsDisableRequest))] [JsonSerializable(typeof(SkillsDiscoverRequest))] [JsonSerializable(typeof(SkillsEnableRequest))] [JsonSerializable(typeof(SkillsGetDiscoveryPathsRequest))] [JsonSerializable(typeof(SkillsGetInvokedResult))] [JsonSerializable(typeof(SkillsInvokedSkill))] [JsonSerializable(typeof(SkillsLoadDiagnostics))] [JsonSerializable(typeof(SlashCommandInfo))] [JsonSerializable(typeof(SlashCommandInput))] [JsonSerializable(typeof(SlashCommandInputChoice))] [JsonSerializable(typeof(SlashCommandInvocationResult))] [JsonSerializable(typeof(SlashCommandInvocationResultSetModelRevertOnCancel))] [JsonSerializable(typeof(SlashCommandModelPickerDialog))] [JsonSerializable(typeof(SlashCommandSelectSubcommandOption))] [JsonSerializable(typeof(SlashCommandTimelineEntry))] [JsonSerializable(typeof(SubagentSettingsEntry))] [JsonSerializable(typeof(TaskClientInfo))] [JsonSerializable(typeof(TaskClientOwner))] [JsonSerializable(typeof(TaskClientUpdate))] [JsonSerializable(typeof(TaskCompleteData))] [JsonSerializable(typeof(TaskCompletionDecision))] [JsonSerializable(typeof(TaskInfo))] [JsonSerializable(typeof(TaskList))] [JsonSerializable(typeof(TaskProgress))] [JsonSerializable(typeof(TaskProgressLine))] [JsonSerializable(typeof(TasksCancelRequest))] [JsonSerializable(typeof(TasksCancelResult))] [JsonSerializable(typeof(TasksGetCurrentPromotableResult))] [JsonSerializable(typeof(TasksGetProgressRequest))] [JsonSerializable(typeof(TasksGetProgressResult))] [JsonSerializable(typeof(TasksPromoteCurrentToBackgroundResult))] [JsonSerializable(typeof(TasksPromoteToBackgroundRequest))] [JsonSerializable(typeof(TasksPromoteToBackgroundResult))] [JsonSerializable(typeof(TasksRefreshResult))] [JsonSerializable(typeof(TasksRegisterRequest))] [JsonSerializable(typeof(TasksRegisterResult))] [JsonSerializable(typeof(TasksRemoveRequest))] [JsonSerializable(typeof(TasksRemoveResult))] [JsonSerializable(typeof(TasksSendMessageRequest))] [JsonSerializable(typeof(TasksSendMessageResult))] [JsonSerializable(typeof(TasksStartAgentRequest))] [JsonSerializable(typeof(TasksStartAgentResult))] [JsonSerializable(typeof(TasksUpdateRequest))] [JsonSerializable(typeof(TasksUpdateResult))] [JsonSerializable(typeof(TasksWaitForPendingResult))] [JsonSerializable(typeof(TelemetrySetFeatureOverridesRequest))] [JsonSerializable(typeof(Tool))] [JsonSerializable(typeof(ToolList))] [JsonSerializable(typeof(ToolResultExpanded))] [JsonSerializable(typeof(ToolResultNewMessage))] [JsonSerializable(typeof(ToolsExecuteRequest))] [JsonSerializable(typeof(ToolsGetBuiltinDescriptorsRequest))] [JsonSerializable(typeof(ToolsGetBuiltinDescriptorsResult))] [JsonSerializable(typeof(ToolsGetCurrentMetadataResult))] [JsonSerializable(typeof(ToolsInitializeAndValidateResult))] [JsonSerializable(typeof(ToolsListRequest))] [JsonSerializable(typeof(ToolsSetRequest))] [JsonSerializable(typeof(ToolsSetResult))] [JsonSerializable(typeof(ToolsShellDescriptorConfig))] [JsonSerializable(typeof(ToolsTaskCompleteEventDataRequest))] [JsonSerializable(typeof(ToolsUpdateSubagentSettingsResult))] [JsonSerializable(typeof(UIElicitationRequest))] [JsonSerializable(typeof(UIElicitationRequestMeta))] [JsonSerializable(typeof(UIElicitationResponse))] [JsonSerializable(typeof(UIElicitationResponseMeta))] [JsonSerializable(typeof(UIElicitationResult))] [JsonSerializable(typeof(UIElicitationSchema))] [JsonSerializable(typeof(UIEphemeralQueryRequest))] [JsonSerializable(typeof(UIEphemeralQueryResult))] [JsonSerializable(typeof(UIExitPlanModeResponse))] [JsonSerializable(typeof(UIHandlePendingAutoModeSwitchRequest))] [JsonSerializable(typeof(UIHandlePendingElicitationRequest))] [JsonSerializable(typeof(UIHandlePendingExitPlanModeRequest))] [JsonSerializable(typeof(UIHandlePendingResult))] [JsonSerializable(typeof(UIHandlePendingSamplingRequest))] [JsonSerializable(typeof(UIHandlePendingSamplingResponse))] [JsonSerializable(typeof(UIHandlePendingSessionLimitsExhaustedRequest))] [JsonSerializable(typeof(UIHandlePendingUserInputRequest))] [JsonSerializable(typeof(UIRegisterDirectAutoModeSwitchHandlerResult))] [JsonSerializable(typeof(UISessionLimitsExhaustedResponse))] [JsonSerializable(typeof(UIUnregisterDirectAutoModeSwitchHandlerRequest))] [JsonSerializable(typeof(UIUnregisterDirectAutoModeSwitchHandlerResult))] [JsonSerializable(typeof(UIUserInputResponse))] [JsonSerializable(typeof(UpdateSubagentSettingsRequest))] [JsonSerializable(typeof(UpdateSubagentSettingsRequestSubagents))] [JsonSerializable(typeof(UsageGetMetricsResult))] [JsonSerializable(typeof(UsageMetricsAgentMetric))] [JsonSerializable(typeof(UsageMetricsCodeChanges))] [JsonSerializable(typeof(UsageMetricsModelMetric))] [JsonSerializable(typeof(UsageMetricsModelMetricRequests))] [JsonSerializable(typeof(UsageMetricsModelMetricTokenDetail))] [JsonSerializable(typeof(UsageMetricsModelMetricUsage))] [JsonSerializable(typeof(UsageMetricsTokenDetail))] [JsonSerializable(typeof(UserRequestedShellCommandResult))] [JsonSerializable(typeof(UserSettingMetadata))] [JsonSerializable(typeof(UserSettingsGetResult))] [JsonSerializable(typeof(UserSettingsSetRequest))] [JsonSerializable(typeof(UserSettingsSetResult))] [JsonSerializable(typeof(VisibilityGetResult))] [JsonSerializable(typeof(VisibilitySetRequest))] [JsonSerializable(typeof(VisibilitySetResult))] [JsonSerializable(typeof(WorkspaceDiffFileChange))] [JsonSerializable(typeof(WorkspaceDiffResult))] [JsonSerializable(typeof(WorkspacesAddSummaryRequest))] [JsonSerializable(typeof(WorkspacesAddSummaryResult))] [JsonSerializable(typeof(WorkspacesAddSummaryResultSummary))] [JsonSerializable(typeof(WorkspacesAddSummaryResultWorkspace))] [JsonSerializable(typeof(WorkspacesAutopilotObjectiveExistsResult))] [JsonSerializable(typeof(WorkspacesCheckpoints))] [JsonSerializable(typeof(WorkspacesCreateFileRequest))] [JsonSerializable(typeof(WorkspacesDeleteAutopilotObjectiveResult))] [JsonSerializable(typeof(WorkspacesDiffRequest))] [JsonSerializable(typeof(WorkspacesEnsureRequest))] [JsonSerializable(typeof(WorkspacesGetWorkspaceResult))] [JsonSerializable(typeof(WorkspacesGetWorkspaceResultWorkspace))] [JsonSerializable(typeof(WorkspacesListCheckpointsResult))] [JsonSerializable(typeof(WorkspacesListFilesResult))] [JsonSerializable(typeof(WorkspacesReadAutopilotObjectiveResult))] [JsonSerializable(typeof(WorkspacesReadCheckpointRequest))] [JsonSerializable(typeof(WorkspacesReadCheckpointResult))] [JsonSerializable(typeof(WorkspacesReadFileRequest))] [JsonSerializable(typeof(WorkspacesReadFileResult))] [JsonSerializable(typeof(WorkspacesSaveLargePasteRequest))] [JsonSerializable(typeof(WorkspacesSaveLargePasteResult))] [JsonSerializable(typeof(WorkspacesSaveLargePasteResultSaved))] [JsonSerializable(typeof(WorkspacesTruncateSummariesRequest))] [JsonSerializable(typeof(WorkspacesUpdateMetadataRequest))] [JsonSerializable(typeof(WorkspacesWriteAutopilotObjectiveRequest))] [JsonSerializable(typeof(WorkspacesWriteAutopilotObjectiveResult))] internal partial class RpcJsonContext : JsonSerializerContext;