/*---------------------------------------------------------------------------------------------
* 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; }
///