diff --git a/.github/workflows/dotnet-sdk-tests.yml b/.github/workflows/dotnet-sdk-tests.yml index 707a99af30..b70278cc54 100644 --- a/.github/workflows/dotnet-sdk-tests.yml +++ b/.github/workflows/dotnet-sdk-tests.yml @@ -32,12 +32,9 @@ jobs: - os: windows-latest transport: default shard: full - # TODO(cli-1.0.81-2): @github/copilot 1.0.81-2 never completes a model-driven - # turn when the runtime is hosted in-process against the CAPI backend. A full - # run reported 241 failures across 43 classes and took 150-225 minutes, which - # also starved the rest of the matrix. The defect is specific to this pairing: - # the in-process BYOK cells below and the stdio capi cells are unaffected. - # Drop these two entries once a fixed CLI build is picked up. + # TODO(cli-1.0.81-4): in-process CAPI model turns eventually stop + # completing and poison the shared runtime until the job times out. + # Stdio CAPI and in-process BYOK cells remain enabled. - os: ubuntu-latest transport: inprocess - os: macos-latest diff --git a/dotnet/src/Generated/Rpc.cs b/dotnet/src/Generated/Rpc.cs index bd8f3b9d3a..75405b142d 100644 --- a/dotnet/src/Generated/Rpc.cs +++ b/dotnet/src/Generated/Rpc.cs @@ -1141,7637 +1141,7847 @@ internal sealed class McpDiscoverRequest public string? WorkingDirectory { get; set; } } -/// User-configured MCP servers, keyed by server name. +/// 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)] -public sealed class McpConfigList +[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 { - /// All MCP servers from user config, keyed by name. - [JsonPropertyName("servers")] - public IDictionary Servers { get => field ??= new Dictionary(); set; } + /// The type discriminator. + [JsonPropertyName("kind")] + public virtual string Kind { get; set; } = string.Empty; } -/// MCP server name and configuration to add to user configuration. + +/// The protocol version and capability set the runtime actually honoured for a successful catalog operation. [Experimental(Diagnostics.Experimental)] -internal sealed class McpConfigAddRequest +public sealed class CatalogNegotiatedContract { - /// MCP server configuration (stdio process or remote HTTP/SSE). - [JsonPropertyName("config")] - public JsonElement Config { get; set; } + /// 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; } - /// 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; + /// Protocol version of the runtime that served the request. + [JsonPropertyName("runtimeProtocolVersion")] + public long RuntimeProtocolVersion { get; set; } } -/// MCP server name and replacement configuration to write to user configuration. +/// One change applying the plan would make, described rather than serialised so the configuration payload stays behind the runtime boundary. [Experimental(Diagnostics.Experimental)] -internal sealed class McpConfigUpdateRequest +public sealed class McpPlanConfigurationChange { - /// MCP server configuration (stdio process or remote HTTP/SSE). - [JsonPropertyName("config")] - public JsonElement Config { get; set; } + /// Names of the configuration fields the change would set, without their values. + [JsonPropertyName("changedFields")] + public IList ChangedFields { get => field ??= []; set; } - /// Name of the MCP server to update. - [RegularExpression("^[^\\x00-\\x1f/\\x7f-\\x9f}]+(?:\\/[^\\x00-\\x1f/\\x7f-\\x9f}]+)*$")] + /// 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("name")] - public string Name { get; set; } = string.Empty; + [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; } } -/// MCP server name to remove from user configuration. +/// Normalised identity of the MCP server a plan targets, independent of how the card spelled it. [Experimental(Diagnostics.Experimental)] -internal sealed class McpConfigRemoveRequest +public sealed class McpPlanResourceIdentity { - /// Name of the MCP server to remove. - [RegularExpression("^[^\\x00-\\x1f/\\x7f-\\x9f}]+(?:\\/[^\\x00-\\x1f/\\x7f-\\x9f}]+)*$")] + /// 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("name")] - public string Name { get; set; } = string.Empty; -} + [JsonPropertyName("canonicalName")] + public string CanonicalName { 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; } + /// 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; } } -/// MCP server names to disable for new sessions. +/// Outcome of evaluating the planned server against registry and enterprise policy. Evaluation is read-only. [Experimental(Diagnostics.Experimental)] -internal sealed class McpConfigDisableRequest +public sealed class McpPlanPolicyResult { - /// 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; } + /// 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; } } -/// Installed plugin that contributes a discovered extension. +/// 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 DiscoveredExtensionPlugin +public sealed class CardDigest { - /// Installed plugin name. - [JsonPropertyName("name")] - public string Name { get; set; } = string.Empty; + /// 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; } -/// Discovered extension metadata and persistent enablement state. +/// 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 DiscoveredExtension +public sealed class McpPlanProvenance { - /// 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; + /// 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; - /// Absolute path to the extension entry module, suitable for revealing it in a file manager. - [JsonPropertyName("path")] - public string Path { 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; } - /// Containing plugin metadata for plugin-contributed extensions. - [JsonPropertyName("plugin")] - public DiscoveredExtensionPlugin? Plugin { get; set; } + /// JSON MCP media type the validated card was interpreted as. + [JsonPropertyName("mediaType")] + public McpServerCardMediaType MediaType { get; set; } - /// Discovery source. - [JsonPropertyName("source")] - public DiscoveredExtensionSource Source { 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; } -/// Extensions discovered from persisted Copilot home state and their effective loading mode. Launch-scoped additional plugins are not included. +/// Where a plan would be written. [Experimental(Diagnostics.Experimental)] -public sealed class DiscoveredExtensions +public sealed class McpPlanTarget { - /// Discovered user and enabled installed-plugin extensions from persisted Copilot home state. - [JsonPropertyName("extensions")] - public IList Extensions { get => field ??= []; set; } + /// 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; - /// Effective extension loading mode. Defaults to load_and_augment when unset. - [JsonPropertyName("mode")] - public DiscoveredExtensionMode Mode { get; set; } + /// Configuration scope the plan targets. + [JsonPropertyName("scope")] + public McpPlanScope Scope { get; set; } } -/// Source-qualified extension identifiers to persistently enable for future sessions. +/// 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)] -internal sealed class DiscoveredExtensionsEnableRequest +[JsonPolymorphic( + TypeDiscriminatorPropertyName = "installMethod", + UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToBaseType)] +[JsonDerivedType(typeof(McpPlanTransportChoicePackage), "package")] +[JsonDerivedType(typeof(McpPlanTransportChoiceRemote), "remote")] +public partial class McpPlanTransportChoice { - /// Source-qualified user or plugin extension IDs to enable. - [JsonPropertyName("ids")] - public IList Ids { get => field ??= []; set; } + /// The type discriminator. + [JsonPropertyName("installMethod")] + public virtual string InstallMethod { get; set; } = string.Empty; } -/// Source-qualified extension identifiers to persistently disable for future sessions. + +/// 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)] -internal sealed class DiscoveredExtensionsDisableRequest +[JsonPolymorphic( + TypeDiscriminatorPropertyName = "kind", + UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToBaseType)] +[JsonDerivedType(typeof(McpPlanRequiredValueScalar), "scalar")] +[JsonDerivedType(typeof(McpPlanRequiredValueEnum), "enum")] +public partial class McpPlanRequiredValue { - /// Source-qualified user or plugin extension IDs to disable. - [JsonPropertyName("ids")] - public IList Ids { get => field ??= []; set; } + /// The type discriminator. + [JsonPropertyName("kind")] + public virtual string Kind { get; set; } = string.Empty; } -/// Information about an installed plugin tracked in global state. + +/// One non-secret scalar value a transport choice needs before it can be applied. +/// The scalar variant of . [Experimental(Diagnostics.Experimental)] -public sealed class InstalledPluginInfo +public partial class McpPlanRequiredValueScalar : McpPlanRequiredValue { - /// 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; } + /// + [JsonIgnore] + public override string Kind => "scalar"; - /// Whether the plugin is currently enabled for new sessions. - [JsonPropertyName("enabled")] - public bool Enabled { get; set; } + /// Where the value is applied when the server is launched. + [JsonPropertyName("category")] + public required McpPlanValueCategory Category { get; set; } - /// Marketplace the plugin came from. Empty string ("") for direct repo / URL / local installs. - [JsonPropertyName("marketplace")] - public string Marketplace { get; set; } = string.Empty; + /// 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; } - /// Plugin name. - [JsonPropertyName("name")] - public string Name { get; set; } = string.Empty; + /// 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; } - /// Installed version (when reported by the plugin manifest). - [JsonPropertyName("version")] - public string? Version { get; set; } -} + /// Whether the value may be supplied more than once. + [JsonPropertyName("isRepeated")] + public required bool IsRepeated { 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; } + /// 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; } } -/// Result of installing a plugin. +/// 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 sealed class PluginInstallResult +public partial class McpPlanRequiredValueEnum : McpPlanRequiredValue { - /// 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; } + /// + [JsonIgnore] + public override string Kind => "enum"; - /// The newly installed plugin's metadata. - [JsonPropertyName("plugin")] - public InstalledPluginInfo Plugin { get => field ??= new(); set; } + /// Where the value is applied when the server is launched. + [JsonPropertyName("category")] + public required McpPlanValueCategory Category { get; set; } - /// Optional post-install message provided by the plugin (e.g. setup instructions). - [JsonPropertyName("postInstallMessage")] - public string? PostInstallMessage { 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; } - /// Number of skills discovered and installed from the plugin. - [JsonPropertyName("skillsInstalled")] - public long SkillsInstalled { 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; } -/// 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; + /// Non-empty permitted value set. Inert untrusted data. + [JsonPropertyName("enumValues")] + public required IList EnumValues { get; set; } - /// 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; } -} + /// Whether the value may be supplied more than once. + [JsonPropertyName("isRepeated")] + public required bool IsRepeated { 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; } + /// 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; } - /// Plugin name or "plugin@marketplace" spec to uninstall. When ambiguous, prefer the fully-qualified spec. - [JsonPropertyName("name")] - public string Name { get; set; } = string.Empty; + /// 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; } } -/// Result of updating a single plugin. +/// 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 PluginUpdateResult +public sealed class McpPlanSecretPlaceholder { - /// Version after the update, when reported by the plugin manifest. - [JsonPropertyName("newVersion")] - public string? NewVersion { get; set; } + /// 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; - /// Version that was previously installed, when available. - [JsonPropertyName("previousVersion")] - public string? PreviousVersion { get; set; } + /// The runtime-assigned `${secret:<id>}` placeholder written into configuration in place of the value. + [JsonPropertyName("placeholder")] + public string Placeholder { get; set; } = string.Empty; - /// Number of skills discovered and installed after the update. - [JsonPropertyName("skillsInstalled")] - public long SkillsInstalled { 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)] + [JsonPropertyName("title")] + public string? Title { get; set; } } -/// Name (or spec) of the plugin to update. +/// An eligible local-package transport choice. Package identity is required and a remote endpoint cannot be represented. +/// The package variant of . [Experimental(Diagnostics.Experimental)] -internal sealed class PluginsUpdateRequest +public partial class McpPlanTransportChoicePackage : McpPlanTransportChoice { - /// 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; } + /// + [JsonIgnore] + public override string InstallMethod => "package"; - /// Marketplace the plugin came from. Empty string ("") for direct installs. - [JsonPropertyName("marketplace")] - public string Marketplace { get; set; } = string.Empty; + /// 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; } - /// Plugin name that was updated. - [JsonPropertyName("name")] - public string Name { get; set; } = string.Empty; + /// 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; } - /// Version after the update, when available. - [JsonPropertyName("newVersion")] - public string? NewVersion { 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; } - /// Previously installed version, when available. - [JsonPropertyName("previousVersion")] - public string? PreviousVersion { get; set; } + /// Typed values this choice requires, excluding secrets. + [JsonPropertyName("requiredValues")] + public required IList RequiredValues { get; set; } - /// Number of skills installed after the update (success only). - [JsonPropertyName("skillsInstalled")] - public long? SkillsInstalled { get; set; } + /// Secrets this choice requires, referenced by placeholder only. + [JsonPropertyName("secretPlaceholders")] + public required IList SecretPlaceholders { get; set; } - /// Whether the update succeeded for this plugin. - [JsonPropertyName("success")] - public bool Success { get; set; } + /// Local process transport this package choice would use. + [JsonPropertyName("transport")] + public required McpPlanPackageTransport Transport { get; set; } } -/// Result of updating all installed plugins. +/// An eligible remote-endpoint transport choice. The endpoint is required and package identity cannot be represented. +/// The remote variant of . [Experimental(Diagnostics.Experimental)] -public sealed class PluginUpdateAllResult +public partial class McpPlanTransportChoiceRemote : McpPlanTransportChoice { - /// Per-plugin update results in deterministic order. - [JsonPropertyName("results")] - public IList Results { get => field ??= []; set; } -} + /// + [JsonIgnore] + public override string InstallMethod => "remote"; -/// Plugin names (or specs) to enable. -[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; } + /// 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; } } -/// Plugin names (or specs) to disable. +/// 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)] -internal sealed class PluginsDisableRequest +public sealed class McpInstallPlan { - /// 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; } + /// 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; } } -/// Trusted built-in plugin directories to use for this runtime process. +/// 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)] -internal sealed class PluginsBuiltinSetRequest +public partial class McpPlanInstallResultPlanned : McpPlanInstallResult { - /// 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; } + /// + [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; } } -/// Registered marketplace summary. +/// 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 sealed class MarketplaceInfo +public partial class McpPlanInstallResultNegotiationRefused : McpPlanInstallResult { - /// True when this is a default marketplace shipped with the runtime. Defaults are not removable. - [JsonPropertyName("isDefault")] - public bool? IsDefault { get; set; } + /// + [JsonIgnore] + public override string Kind => "negotiation-refused"; - /// Marketplace name (matches the @marketplace suffix in plugin specs). - [JsonPropertyName("name")] - public string Name { get; set; } = string.Empty; + /// 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; } - /// 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; + /// 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; } } -/// All registered marketplaces, including built-in defaults. +/// 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 sealed class MarketplaceListResult +public partial class McpPlanInstallResultHandleRejected : McpPlanInstallResult { - /// Registered marketplaces. - [JsonPropertyName("marketplaces")] - public IList Marketplaces { get => field ??= []; set; } + /// + [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; } } -/// Result of registering a new marketplace. +/// 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 sealed class MarketplaceAddResult +public partial class McpPlanInstallResultInvalidRequest : McpPlanInstallResult { - /// Final name of the marketplace as resolved from its manifest. - [JsonPropertyName("name")] - public string Name { get; set; } = string.Empty; + /// + [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; } } -/// Marketplace source and optional working directory for relative-path resolution. +/// 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)] -internal sealed class PluginsMarketplacesAddRequest +public partial class McpPlanInstallResultAuthenticationRequired : McpPlanInstallResult { - /// 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; + /// + [JsonIgnore] + public override string Kind => "authentication-required"; - /// 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; } + /// 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; } } -/// Outcome of the remove attempt, including dependent-plugin info when applicable. +/// Registry or enterprise policy refused the operation. +/// The policy-rejected variant of . [Experimental(Diagnostics.Experimental)] -public sealed class MarketplaceRemoveResult +public partial class McpPlanInstallResultPolicyRejected : McpPlanInstallResult { - /// Names of installed plugins that prevented removal. Populated only when `removed=false`. - [JsonPropertyName("dependentPlugins")] - public IList? DependentPlugins { get; set; } + /// + [JsonIgnore] + public override string Kind => "policy-rejected"; - /// 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; } + /// 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; } } -/// Name of the marketplace to remove and an optional force flag. +/// 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)] -internal sealed class PluginsMarketplacesRemoveRequest +public partial class McpPlanInstallResultNetworkFailure : McpPlanInstallResult { - /// 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; } + /// + [JsonIgnore] + public override string Kind => "network-failure"; - /// Marketplace name to remove. - [JsonPropertyName("name")] - public string Name { get; set; } = string.Empty; + /// 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; } + + /// HTTP status code, when the failure was a rejected response. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("statusCode")] + public int? StatusCode { get; set; } } -/// Plugin entry advertised by a marketplace. +/// 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 sealed class MarketplacePluginInfo +public partial class McpPlanInstallResultUnsafeRetrieval : McpPlanInstallResult { - /// Short description from the marketplace catalog, when present. - [JsonPropertyName("description")] - public string? Description { get; set; } + /// + [JsonIgnore] + public override string Kind => "unsafe-retrieval"; - /// Plugin name as listed in the marketplace catalog. - [JsonPropertyName("name")] - public string Name { get; set; } = string.Empty; + /// 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; } } -/// Plugins advertised by the marketplace. +/// 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 sealed class MarketplaceBrowseResult +public partial class McpPlanInstallResultMalformedCard : McpPlanInstallResult { - /// Plugins advertised by the marketplace. - [JsonPropertyName("plugins")] - public IList Plugins { get => field ??= []; set; } + /// + [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; } } -/// Name of the marketplace whose plugin catalog to fetch. +/// 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)] -internal sealed class PluginsMarketplacesBrowseRequest +public partial class McpPlanInstallResultContractViolation : McpPlanInstallResult { - /// Marketplace name to browse. - [JsonPropertyName("name")] - public string Name { get; set; } = string.Empty; + /// + [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; } } -/// Per-marketplace refresh result, including marketplace name, success flag, and optional failure error. +/// No transport this runtime can use is available for the requested server. +/// The unavailable-transport variant of . [Experimental(Diagnostics.Experimental)] -public sealed class MarketplaceRefreshEntry +public partial class McpPlanInstallResultUnavailableTransport : McpPlanInstallResult { - /// Error message (failure only). - [JsonPropertyName("error")] - public string? Error { get; set; } + /// + [JsonIgnore] + public override string Kind => "unavailable-transport"; - /// Marketplace name that was refreshed. - [JsonPropertyName("name")] - public string Name { get; set; } = string.Empty; + /// 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; } - /// Whether the refresh succeeded. - [JsonPropertyName("success")] - public bool Success { get; set; } + /// Why no transport could be offered. + [JsonPropertyName("reason")] + public required CatalogUnavailableTransportReason Reason { get; set; } } -/// Result of refreshing one or more marketplace catalogs. +/// 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 sealed class MarketplaceRefreshResult +public partial class McpPlanInstallResultNotInstallable : McpPlanInstallResult { - /// Per-marketplace refresh results in deterministic order. - [JsonPropertyName("results")] - public IList Results { get => field ??= []; set; } + /// + [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; } } -/// RPC data type for PluginsMarketplacesRefresh operations. +/// The operation is not available on this runtime. Distinct from a network failure: nothing was attempted. +/// The unavailable variant of . [Experimental(Diagnostics.Experimental)] -internal sealed class PluginsMarketplacesRefreshRequest +public partial class McpPlanInstallResultUnavailable : McpPlanInstallResult { - /// Marketplace name to refresh. When omitted, every registered marketplace is refreshed. - [JsonPropertyName("name")] - public string? Name { get; set; } + /// + [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; } } -/// Server-side skill metadata, including name, description, source, enabled/invocable state, path, project path, and argument hint. +/// 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 ServerSkill +public sealed class CatalogClientContract { - /// 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; + /// 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; } - /// Whether the skill is currently enabled (based on global config). - [JsonPropertyName("enabled")] - public bool Enabled { 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; } +} - /// Unique identifier for the skill. - [JsonPropertyName("name")] - public string Name { get; set; } = string.Empty; +/// 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; +} - /// 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; } +/// 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"; - /// Source location type (e.g., project, personal-copilot, plugin, builtin). - [JsonPropertyName("source")] - public SkillSource Source { get; set; } + /// 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; } - /// Whether the skill can be invoked by the user as a slash command. - [JsonPropertyName("userInvocable")] - public bool UserInvocable { 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; } } -/// Skills discovered across global and project sources. +/// 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)] -public sealed class ServerSkillList +[JsonPolymorphic( + TypeDiscriminatorPropertyName = "kind", + UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToBaseType)] +[JsonDerivedType(typeof(McpServerCardReferenceUrl), "url")] +[JsonDerivedType(typeof(McpServerCardReferenceEmbedded), "embedded")] +public partial class McpServerCardReference { - /// 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; } + /// The type discriminator. + [JsonPropertyName("kind")] + public virtual string Kind { get; set; } = string.Empty; } -/// Optional project paths and additional skill directories to include in discovery. + +/// An MCP server card to be retrieved from a URL through the runtime's hardened fetch boundary. +/// The url variant of . [Experimental(Diagnostics.Experimental)] -internal sealed class SkillsDiscoverRequest +public partial class McpServerCardReferenceUrl : McpServerCardReference { - /// 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; } + /// + [JsonIgnore] + public override string Kind => "url"; - /// Optional list of project directory paths to scan for project-scoped skills. - [JsonPropertyName("projectPaths")] - public IList? ProjectPaths { get; set; } + /// Media type the card is expected to conform to. + [JsonPropertyName("mediaType")] + public required McpServerCardMediaType MediaType { get; set; } - /// Optional list of additional skill directory paths to include. - [JsonPropertyName("skillDirectories")] - public IList? SkillDirectories { 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; } } -/// Canonical directory where skills can be discovered or created, with scope, preference, and optional project path. +/// An MCP server card supplied inline as an inert document. +/// The embedded variant of . [Experimental(Diagnostics.Experimental)] -public sealed class SkillDiscoveryPath +public partial class McpServerCardReferenceEmbedded : McpServerCardReference { - /// 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; } + /// + [JsonIgnore] + public override string Kind => "embedded"; - /// The input project path this directory was derived from (only for project scope). - [JsonPropertyName("projectPath")] - public string? ProjectPath { get; set; } + /// 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; } - /// Which tier this directory belongs to. - [JsonPropertyName("scope")] - public SkillDiscoveryScope Scope { get; set; } + /// Media type the card is expected to conform to. + [JsonPropertyName("mediaType")] + public required McpServerCardMediaType MediaType { get; set; } } -/// Canonical locations where skills can be created so the runtime will recognize them. +/// Plan from a card supplied directly by the caller, without a preceding search. +/// The card variant of . [Experimental(Diagnostics.Experimental)] -public sealed class SkillDiscoveryPathList +public partial class McpPlanInstallSourceCard : McpPlanInstallSource { - /// Canonical skill create/discovery directories, in priority order. - [JsonPropertyName("paths")] - public IList Paths { get => field ??= []; set; } + /// + [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; } } -/// Optional project paths to enumerate. +/// 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 SkillsGetDiscoveryPathsRequest +internal sealed class McpPlanInstallRequest { - /// 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; } + /// Protocol version and capabilities the caller requires. + [JsonPropertyName("contract")] + public CatalogClientContract Contract { get => field ??= new(); 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; } + /// 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; } } -/// Skill names to mark as disabled in global configuration, replacing any previous list. +/// User-configured MCP servers, keyed by server name. [Experimental(Diagnostics.Experimental)] -internal sealed class SkillsConfigSetDisabledSkillsRequest +public sealed class McpConfigList { - /// List of skill names to disable. - [JsonPropertyName("disabledSkills")] - public IList DisabledSkills { get => field ??= []; set; } + /// All MCP servers from user config, keyed by name. + [JsonPropertyName("servers")] + public IDictionary Servers { get => field ??= new Dictionary(); set; } } -/// Adds or removes a single skill from the global disabled list, leaving every other entry untouched. +/// MCP server name and configuration to add to user configuration. [Experimental(Diagnostics.Experimental)] -internal sealed class SkillsConfigSetSkillDisabledRequest +internal sealed class McpConfigAddRequest { - /// True to disable the skill, false to enable it. - [JsonPropertyName("disabled")] - public bool Disabled { get; set; } + /// MCP server configuration (stdio process or remote HTTP/SSE). + [JsonPropertyName("config")] + public JsonElement Config { get; set; } - /// Name of the skill to add to or remove from the disabled list. + /// 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; } -/// Agent metadata, including identifiers, display details, source, tools, model, MCP servers, skills, and file path. +/// MCP server name and replacement configuration to write to user configuration. [Experimental(Diagnostics.Experimental)] -public sealed class AgentInfo +internal sealed class McpConfigUpdateRequest { - /// Description of the agent's purpose. - [JsonPropertyName("description")] - public string Description { get; set; } = string.Empty; - - /// Human-readable display name. - [JsonPropertyName("displayName")] - public string DisplayName { get; set; } = string.Empty; - - /// Stable identifier for selection. For most agents this is the same as `name`; for plugin/builtin agents it may differ. Always populated; defaults to `name` when no distinct id was assigned. - [JsonPropertyName("id")] - public string Id { get; set; } = string.Empty; - - /// MCP server configurations attached to this agent, keyed by server name. Server config shape mirrors the MCP `mcpServers` schema. - [Experimental(Diagnostics.Experimental)] - [JsonPropertyName("mcpServers")] - public IDictionary? McpServers { get; set; } - - /// 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; } + /// MCP server configuration (stdio process or remote HTTP/SSE). + [JsonPropertyName("config")] + public JsonElement Config { get; set; } - /// Name of the agent. Use `id` as the stable selection identifier. + /// 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; - - /// 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. +/// MCP server name to remove from user configuration. [Experimental(Diagnostics.Experimental)] -public sealed class ServerAgentList +internal sealed class McpConfigRemoveRequest { - /// All discovered agents across all sources. - [JsonPropertyName("agents")] - public IList Agents { get => field ??= []; 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; } -/// Optional project paths to include in agent discovery. +/// MCP server names to enable for new sessions. [Experimental(Diagnostics.Experimental)] -internal sealed class AgentsDiscoverRequest +internal sealed class McpConfigEnableRequest { - /// 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; } + /// 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; } } -/// Canonical directory where custom agents can be discovered or created, with scope, preference, and optional project path. +/// MCP server names to disable for new sessions. [Experimental(Diagnostics.Experimental)] -public sealed class AgentDiscoveryPath +internal sealed class McpConfigDisableRequest { - /// 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; } + /// 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; } } -/// Optional project paths to include when enumerating agent discovery directories. +/// Installed plugin that contributes a discovered extension. [Experimental(Diagnostics.Experimental)] -internal sealed class AgentsGetDiscoveryPathsRequest +public sealed class DiscoveredExtensionPlugin { - /// 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; } + /// Installed plugin name. + [JsonPropertyName("name")] + public string Name { get; set; } = string.Empty; } -/// Loaded instruction source for a session, including path, content, category, location, applicability, and optional description. +/// Discovered extension metadata and persistent enablement state. [Experimental(Diagnostics.Experimental)] -public sealed class InstructionSource +public sealed class DiscoveredExtension { - /// 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; } + /// Whether this extension's persistent per-ID preference is enabled. + [JsonPropertyName("enabled")] + public bool Enabled { get; set; } - /// Unique identifier for this source (used for toggling). + /// Source-qualified ID accepted by both server and session extension enablement methods. [JsonPropertyName("id")] public string Id { get; set; } = string.Empty; - /// Human-readable label. - [JsonPropertyName("label")] - public string Label { get; set; } = string.Empty; + /// Human-readable extension name. + [JsonPropertyName("name")] + public string Name { get; set; } = string.Empty; - /// Where this source lives — used for UI grouping. - [JsonPropertyName("location")] - public InstructionSourceLocation Location { get; set; } + /// Absolute path to the extension entry module, suitable for revealing it in a file manager. + [JsonPropertyName("path")] + public string Path { get; set; } = string.Empty; - /// 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; } + /// Containing plugin metadata for plugin-contributed extensions. + [JsonPropertyName("plugin")] + public DiscoveredExtensionPlugin? Plugin { get; set; } - /// File path relative to repo or absolute for home. - [JsonPropertyName("sourcePath")] - public string SourcePath { get; set; } = string.Empty; + /// Discovery source. + [JsonPropertyName("source")] + public DiscoveredExtensionSource Source { get; set; } +} - /// Category of instruction source — used for merge logic. - [JsonPropertyName("type")] - public InstructionSourceType Type { 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; } } -/// Instruction sources discovered across user, repository, and plugin sources. +/// Source-qualified extension identifiers to persistently enable for future sessions. [Experimental(Diagnostics.Experimental)] -public sealed class ServerInstructionSourceList +internal sealed class DiscoveredExtensionsEnableRequest { - /// All discovered instruction sources. - [JsonPropertyName("sources")] - public IList Sources { get => field ??= []; set; } + /// Source-qualified user or plugin extension IDs to enable. + [JsonPropertyName("ids")] + public IList Ids { get => field ??= []; set; } } -/// Optional project paths to include in instruction discovery. +/// Source-qualified extension identifiers to persistently disable for future sessions. [Experimental(Diagnostics.Experimental)] -internal sealed class InstructionsDiscoverRequest +internal sealed class DiscoveredExtensionsDisableRequest { - /// 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; } + /// Source-qualified user or plugin extension IDs to disable. + [JsonPropertyName("ids")] + public IList Ids { get => field ??= []; 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; } +/// 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; } -/// Canonical file or directory where custom instructions can be discovered or created, with location, kind, preference, and project path. + +/// 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)] -public sealed class InstructionDiscoveryPath +[JsonPolymorphic( + TypeDiscriminatorPropertyName = "kind", + UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToBaseType)] +[JsonDerivedType(typeof(CatalogCandidateMcpServer), "mcp-server")] +[JsonDerivedType(typeof(CatalogCandidateAiSkill), "ai-skill")] +public partial class CatalogCandidate { - /// Whether the target is a single file or a directory of instruction files. + /// The type discriminator. [JsonPropertyName("kind")] - public InstructionDiscoveryPathKind Kind { get; set; } + public virtual string Kind { get; set; } = string.Empty; +} - /// 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; +/// 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; - /// 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; } + /// JSON MCP media type advertised for the referenced card. + [JsonPropertyName("mediaType")] + public McpServerCardMediaType MediaType { get; set; } - /// The input project path this target was derived from (only for repository targets). - [JsonPropertyName("projectPath")] - public string? ProjectPath { 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; } -/// Canonical files and directories where custom instructions can be created so the runtime will recognize them. +/// 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)] -public sealed class InstructionDiscoveryPathList +[JsonPolymorphic( + TypeDiscriminatorPropertyName = "kind", + UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToBaseType)] +[JsonDerivedType(typeof(CatalogCandidateSourceUrl), "url")] +[JsonDerivedType(typeof(CatalogCandidateSourceEmbedded), "embedded")] +public partial class CatalogCandidateSource { - /// Canonical instruction create/discovery files and directories, in priority order. - [JsonPropertyName("paths")] - public IList Paths { get => field ??= []; set; } + /// The type discriminator. + [JsonPropertyName("kind")] + public virtual string Kind { get; set; } = string.Empty; } -/// Optional project paths to include when enumerating instruction discovery targets. + +/// Candidate whose card is retrieved from a URL through the runtime's hardened fetch boundary. +/// The url variant of . [Experimental(Diagnostics.Experimental)] -internal sealed class InstructionsGetDiscoveryPathsRequest +public partial class CatalogCandidateSourceUrl : CatalogCandidateSource { - /// 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; } + /// + [JsonIgnore] + public override string Kind => "url"; - /// Optional list of project directory paths. When omitted or empty, only the user-level targets are returned. - [JsonPropertyName("projectPaths")] - public IList? ProjectPaths { get; set; } + /// 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; } } -/// A literal choice the command input accepts, with a human-facing description. +/// 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 sealed class SlashCommandInputChoice +public partial class CatalogCandidateSourceEmbedded : CatalogCandidateSource { - /// 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; + /// + [JsonIgnore] + public override string Kind => "embedded"; } -/// Optional unstructured input hint. +/// 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 sealed class SlashCommandInput +public partial class CatalogCandidateMcpServer : CatalogCandidate { - /// 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; } + /// + [JsonIgnore] + public override string Kind => "mcp-server"; - /// Optional completion hint for the input (e.g. 'directory' for filesystem path completion). - [JsonPropertyName("completion")] - public SlashCommandInputCompletion? Completion { get; set; } + /// 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; } - /// Hint to display when command input has not been provided. - [JsonPropertyName("hint")] - public string Hint { get; set; } = string.Empty; + /// 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; } - /// 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; } + /// 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; } - /// When true, the command requires non-empty input; clients should render the input hint as required. - [JsonPropertyName("required")] - public bool? Required { 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; } } -/// Slash-command metadata with name, aliases, description, kind, input hint, execution allowance, and schedulability. +/// 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 SlashCommandInfo +public sealed class CatalogAiSkillCandidateProvenance { - /// 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; } + /// 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; - /// Human-readable command description. - [JsonPropertyName("description")] - public string Description { get; set; } = string.Empty; + /// Media type advertised for the referenced AI skill card. + [JsonPropertyName("mediaType")] + public string MediaType { get; set; } = string.Empty; - /// Whether the command is experimental. - [JsonPropertyName("experimental")] - public bool? Experimental { 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; +} - /// Optional unstructured input hint. - [JsonPropertyName("input")] - public SlashCommandInput? Input { get; set; } +/// 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"; - /// 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; } + /// 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; } - /// Canonical command name without a leading slash. - [JsonPropertyName("name")] - public string Name { get; set; } = string.Empty; + /// 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; } - /// 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; } -} + /// 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; } -/// 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; } -} + /// ISO 8601 timestamp after which the handle is stale and will be rejected. + [JsonPropertyName("handleExpiresAt")] + public required string HandleExpiresAt { get; 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; } + /// AI skills are discovery-only and cannot be installed through this surface. + [JsonPropertyName("installability")] + public required string Installability { 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; } + /// Media type of the underlying AI skill card. + [JsonPropertyName("mediaType")] + public required string MediaType { get; set; } - /// The effective value: the user's value if set, otherwise the default. - [JsonPropertyName("value")] - public JsonElement Value { 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; } } -/// 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. +/// A completed catalog search: inert candidate summaries, each carrying a single-use handle. +/// The succeeded variant of . [Experimental(Diagnostics.Experimental)] -public sealed class UserSettingsGetResult +public partial class CatalogSearchResultSucceeded : CatalogSearchResult { - /// 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; } + /// + [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; } } -/// Outcome of writing user settings. +/// 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 sealed class UserSettingsSetResult +public partial class CatalogSearchResultNegotiationRefused : CatalogSearchResult { - /// 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; } + /// + [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; } } -/// 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. +/// The request asked for a candidate kind this runtime does not serve. +/// The unsupported-kind variant of . [Experimental(Diagnostics.Experimental)] -internal sealed class UserSettingsSetRequest +public partial class CatalogSearchResultUnsupportedKind : CatalogSearchResult { - /// Partial user settings to write, as a free-form object keyed by setting name. - [JsonPropertyName("settings")] - public JsonElement Settings { get; set; } + /// + [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; } } -/// Validated device-managed settings discovered before a session exists. +/// 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 sealed class ManagedSettingsReadResult +public partial class CatalogSearchResultInvalidRequest : CatalogSearchResult { - /// Discovery or validation error text when managed settings could not be read safely. - [JsonPropertyName("errorMessage")] - public string? ErrorMessage { get; set; } + /// + [JsonIgnore] + public override string Kind => "invalid-request"; - /// 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; } + /// 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; } } -/// Indicates whether the calling client was registered as the session filesystem provider. +/// 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 sealed class SessionFsSetProviderResult +public partial class CatalogSearchResultAuthenticationRequired : CatalogSearchResult { - /// Whether the provider was set successfully. - [JsonPropertyName("success")] - public bool Success { get; set; } + /// + [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; } } -/// Optional capabilities declared by the provider. +/// Registry or enterprise policy refused the operation. +/// The policy-rejected variant of . [Experimental(Diagnostics.Experimental)] -public sealed class SessionFsSetProviderCapabilities +public partial class CatalogSearchResultPolicyRejected : CatalogSearchResult { - /// Whether the provider supports SQLite query/exists operations. - [JsonPropertyName("sqlite")] - public bool? Sqlite { get; set; } + /// + [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; } } -/// Initial working directory, session-state path layout, and path conventions used to register the calling SDK client as the session filesystem provider. +/// 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)] -internal sealed class SessionFsSetProviderRequest +public partial class CatalogSearchResultNetworkFailure : CatalogSearchResult { - /// Optional capabilities declared by the provider. - [JsonPropertyName("capabilities")] - public SessionFsSetProviderCapabilities? Capabilities { get; set; } + /// + [JsonIgnore] + public override string Kind => "network-failure"; - /// Path conventions used by this filesystem. - [JsonPropertyName("conventions")] - public SessionFsSetProviderConventions Conventions { 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("message")] + public required string Message { get; set; } - /// Initial working directory for sessions. - [JsonPropertyName("initialCwd")] - public string InitialCwd { get; set; } = string.Empty; + /// Categorised failure, low cardinality so it can be aggregated without carrying a URL. + [JsonPropertyName("reason")] + public required CatalogNetworkFailureReason Reason { get; set; } - /// Path within each session's SessionFs where the runtime stores files for that session. - [JsonPropertyName("sessionStatePath")] - public string SessionStatePath { get; set; } = string.Empty; + /// HTTP status code, when the failure was a rejected response. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("statusCode")] + public int? StatusCode { get; set; } } -/// Indicates whether the calling client was registered as the LLM inference provider. +/// 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 sealed class LlmInferenceSetProviderResult +public partial class CatalogSearchResultUnsafeRetrieval : CatalogSearchResult { - /// Whether the provider was set successfully. - [JsonPropertyName("success")] - public bool Success { get; set; } -} + /// + [JsonIgnore] + public override string Kind => "unsafe-retrieval"; -/// 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; } + /// 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; } } -/// Response head. +/// A card could not be parsed or did not satisfy its declared media type's schema. +/// The malformed-card variant of . [Experimental(Diagnostics.Experimental)] -internal sealed class LlmInferenceHttpResponseStartRequest +public partial class CatalogSearchResultMalformedCard : CatalogSearchResult { - /// HTTP response headers, preserving multiple values per name. - [JsonPropertyName("headers")] - public IDictionary> Headers { get => field ??= new Dictionary>(); set; } + /// + [JsonIgnore] + public override string Kind => "malformed-card"; - /// Matches the requestId from the originating httpRequestStart frame. - [JsonPropertyName("requestId")] - public string RequestId { get; set; } = string.Empty; + /// 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; } - /// HTTP status code. - [JsonPropertyName("status")] - public long Status { 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; } - /// Optional HTTP status reason phrase. - [JsonPropertyName("statusText")] - public string? StatusText { get; set; } + /// How the card failed validation. + [JsonPropertyName("reason")] + public required CatalogMalformedCardReason Reason { get; set; } } -/// Whether the chunk was accepted. +/// 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 sealed class LlmInferenceHttpResponseChunkResult +public partial class CatalogSearchResultContractViolation : CatalogSearchResult { - /// True when the chunk was matched to a pending request; false when unknown. - [JsonPropertyName("accepted")] - public bool Accepted { get; set; } + /// + [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; } } -/// Set to terminate the response with a transport-level failure. Implies end-of-stream; any further chunks for this requestId are ignored. +/// The operation is not available on this runtime. Distinct from a network failure: nothing was attempted. +/// The unavailable variant of . [Experimental(Diagnostics.Experimental)] -public sealed class LlmInferenceHttpResponseChunkError +public partial class CatalogSearchResultUnavailable : CatalogSearchResult { - /// Optional machine-readable error code. - [JsonPropertyName("code")] - public string? Code { get; set; } + /// + [JsonIgnore] + public override string Kind => "unavailable"; - /// Human-readable failure description. + /// 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 string Message { get; set; } = string.Empty; + public required string Message { get; set; } + + /// Why the operation is unavailable. + [JsonPropertyName("reason")] + public required CatalogUnavailableReason Reason { get; set; } } -/// A response body chunk or terminal error. +/// 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 LlmInferenceHttpResponseChunkRequest +internal sealed class CatalogSearchRequest { - /// 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; + /// Protocol version and capabilities the caller requires. + [JsonPropertyName("contract")] + public CatalogClientContract Contract { get => field ??= new(); set; } - /// 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; } + /// Restrict results to these candidate kinds. When omitted, every kind the runtime supports is searched. + [JsonPropertyName("kinds")] + public IList? Kinds { 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; } + /// Maximum number of candidates to return. Defaults to 10 when omitted. + [JsonPropertyName("limit")] + public int? Limit { get; set; } - /// Matches the requestId from the originating httpRequestStart frame. - [JsonPropertyName("requestId")] - public string RequestId { get; set; } = string.Empty; + /// Free-text search query. Never written to logs or 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; } -/// Pre-resolved working-directory context for session startup. +/// Information about an installed plugin tracked in global state. [Experimental(Diagnostics.Experimental)] -public sealed class SessionContext +public sealed class InstalledPluginInfo { - /// 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; } + /// 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; } - /// Repository slug in `owner/name` form, when known. - [JsonPropertyName("repository")] - public string? Repository { get; set; } -} + /// Whether the plugin is currently enabled for new sessions. + [JsonPropertyName("enabled")] + public bool Enabled { 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; + /// Marketplace the plugin came from. Empty string ("") for direct repo / URL / local installs. + [JsonPropertyName("marketplace")] + public string Marketplace { get; set; } = string.Empty; - /// Repository name. + /// Plugin name. [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; - /// Repository owner. - [JsonPropertyName("owner")] - public string Owner { get; set; } = string.Empty; + /// Installed version (when reported by the plugin manifest). + [JsonPropertyName("version")] + public string? Version { get; set; } } -/// Remote session metadata for the session to hand off (typically obtained from `sessions.list` with `source: "remote"`). +/// Plugins installed in user/global state. [Experimental(Diagnostics.Experimental)] -public sealed class RemoteSessionMetadataValue +public sealed class PluginListResult { - /// 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; } + /// Installed plugins. + [JsonPropertyName("plugins")] + public IList Plugins { get => field ??= []; set; } } -/// `sessions.open` handoff progress update with step, status, and optional message. +/// Result of installing a plugin. [Experimental(Diagnostics.Experimental)] -public sealed class SessionsOpenProgress +public sealed class PluginInstallResult { - /// Optional step message. - [JsonPropertyName("message")] - public string? Message { get; set; } + /// 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; } - /// Step status. - [JsonPropertyName("status")] - public SessionsOpenProgressStatus Status { get; set; } + /// The newly installed plugin's metadata. + [JsonPropertyName("plugin")] + public InstalledPluginInfo Plugin { get => field ??= new(); set; } - /// Handoff step. - [JsonPropertyName("step")] - public SessionsOpenProgressStep Step { get; 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; } } -/// Result of opening a session. +/// Plugin source and optional working directory for relative-path resolution. [Experimental(Diagnostics.Experimental)] -public sealed class SessionOpenResult +internal sealed class PluginsInstallRequest { - /// 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; } + /// 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; - /// Outcome of the open request. - [JsonPropertyName("status")] - public SessionsOpenStatus Status { get; set; } + /// 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; } } -/// Identifier and optional friendly name assigned to the newly forked session. +/// Name (or spec) of the plugin to uninstall. [Experimental(Diagnostics.Experimental)] -public sealed class SessionsForkResult +internal sealed class PluginsUninstallRequest { - /// Friendly name assigned to the forked session, if any. - [JsonPropertyName("name")] - public string? Name { get; set; } + /// 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; } - /// The new forked session's ID. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// Plugin name or "plugin@marketplace" spec to uninstall. When ambiguous, prefer the fully-qualified spec. + [JsonPropertyName("name")] + public string Name { get; set; } = string.Empty; } -/// Source session identifier to fork from, optional event-ID boundary, and optional friendly name for the new session. +/// Result of updating a single plugin. [Experimental(Diagnostics.Experimental)] -internal sealed class SessionsForkRequest +public sealed class PluginUpdateResult { - /// Optional friendly name to assign to the forked session. - [JsonPropertyName("name")] - public string? Name { get; set; } + /// Version after the update, when reported by the plugin manifest. + [JsonPropertyName("newVersion")] + public string? NewVersion { get; set; } - /// Source session ID to fork from. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// Version that was previously installed, when available. + [JsonPropertyName("previousVersion")] + public string? PreviousVersion { get; set; } - /// 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; } + /// Number of skills discovered and installed after the update. + [JsonPropertyName("skillsInstalled")] + public long SkillsInstalled { get; set; } } -/// Repository associated with the connected remote session. +/// Name (or spec) of the plugin to update. [Experimental(Diagnostics.Experimental)] -public sealed class ConnectedRemoteSessionMetadataRepository +internal sealed class PluginsUpdateRequest { - /// Branch associated with the remote session. - [JsonPropertyName("branch")] - public string Branch { get; set; } = string.Empty; - - /// Repository name. + /// Plugin name or "plugin@marketplace" spec to update. [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. +/// Per-plugin result from updating all plugins, with versions, skills installed, success flag, and optional error. [Experimental(Diagnostics.Experimental)] -public sealed class ConnectedRemoteSessionMetadata +public sealed class PluginUpdateAllEntry { - /// Neutral SDK discriminator for the connected remote session kind. - [JsonPropertyName("kind")] - public ConnectedRemoteSessionMetadataKind Kind { get; set; } + /// Error message (failure only). + [JsonPropertyName("error")] + public string? Error { get; set; } - /// Last session update time as an ISO 8601 string. - [JsonPropertyName("modifiedTime")] - public DateTimeOffset ModifiedTime { get; set; } + /// Marketplace the plugin came from. Empty string ("") for direct installs. + [JsonPropertyName("marketplace")] + public string Marketplace { get; set; } = string.Empty; - /// Optional friendly session name. + /// Plugin name that was updated. [JsonPropertyName("name")] - public string? Name { get; set; } + public string Name { get; set; } = string.Empty; - /// Pull request number associated with the session. - [JsonPropertyName("pullRequestNumber")] - public long? PullRequestNumber { get; set; } + /// Version after the update, when available. + [JsonPropertyName("newVersion")] + public string? NewVersion { get; set; } - /// Repository associated with the connected remote session. - [JsonPropertyName("repository")] - public ConnectedRemoteSessionMetadataRepository Repository { get => field ??= new(); set; } + /// Previously installed version, when available. + [JsonPropertyName("previousVersion")] + public string? PreviousVersion { get; 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; } + /// Number of skills installed after the update (success only). + [JsonPropertyName("skillsInstalled")] + public long? SkillsInstalled { get; set; } - /// Optional session summary. - [JsonPropertyName("summary")] - public string? Summary { get; set; } + /// Whether the update succeeded for this plugin. + [JsonPropertyName("success")] + public bool Success { get; set; } } -/// Remote session connection result. +/// Result of updating all installed plugins. [Experimental(Diagnostics.Experimental)] -public sealed class RemoteSessionConnectionResult +public sealed class PluginUpdateAllResult { - /// 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; + /// Per-plugin update results in deterministic order. + [JsonPropertyName("results")] + public IList Results { get => field ??= []; set; } } -/// Remote session connection parameters. +/// Plugin names (or specs) to enable. [Experimental(Diagnostics.Experimental)] -internal sealed class ConnectRemoteSessionParams +internal sealed class PluginsEnableRequest { - /// Session ID to connect to. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// 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; } } -/// Local or remote session metadata entry. Narrow on `isRemote` to access source-specific fields. -/// Data type discriminated by isRemote. +/// Plugin names (or specs) to disable. [Experimental(Diagnostics.Experimental)] -public partial class SessionListEntry +internal sealed class PluginsDisableRequest { - /// 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; } + /// 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; } +} - /// 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; } +/// 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; } +} - /// Last-modified time of the session's persisted state, as ISO 8601. - [JsonPropertyName("modifiedTime")] - public required string ModifiedTime { get; 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; } - /// Optional human-friendly name set via /rename. - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + /// Marketplace name (matches the @marketplace suffix in plugin specs). [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; } + public string Name { get; set; } = string.Empty; - /// Short summary of the session, when one has been derived. - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("summary")] - public string? Summary { get; set; } + /// 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; +} - /// Whether the remote task originated from CCA or CLI `--remote`. - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("taskType")] - public RemoteSessionMetadataTaskType? TaskType { get; set; } +/// All registered marketplaces, including built-in defaults. +[Experimental(Diagnostics.Experimental)] +public sealed class MarketplaceListResult +{ + /// Registered marketplaces. + [JsonPropertyName("marketplaces")] + public IList Marketplaces { get => field ??= []; set; } } -/// Sessions matching the filter, ordered most-recently-modified first. +/// Result of registering a new marketplace. [Experimental(Diagnostics.Experimental)] -public sealed class SessionList +public sealed class MarketplaceAddResult { - /// Sessions ordered most-recently-modified first. Discriminated by `isRemote`. - [JsonPropertyName("sessions")] - public IList Sessions { get => field ??= []; set; } + /// Final name of the marketplace as resolved from its manifest. + [JsonPropertyName("name")] + public string Name { get; set; } = string.Empty; } -/// Optional filter applied to the returned sessions. +/// Marketplace source and optional working directory for relative-path resolution. [Experimental(Diagnostics.Experimental)] -public sealed class SessionListFilter +internal sealed class PluginsMarketplacesAddRequest { - /// Match sessions whose context.branch equals this value. - [JsonPropertyName("branch")] - public string? Branch { get; set; } + /// 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; - /// Match sessions whose context.cwd equals this value. - [JsonPropertyName("cwd")] - public string? Cwd { get; set; } + /// 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; } +} - /// Match sessions whose context.gitRoot equals this value. - [JsonPropertyName("gitRoot")] - public string? GitRoot { 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; } - /// Match sessions whose context.repository equals this value. - [JsonPropertyName("repository")] - public string? Repository { 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; } } -/// Optional source filter, metadata-load limit, and context filter applied to the returned sessions. +/// Name of the marketplace to remove and an optional force flag. [Experimental(Diagnostics.Experimental)] -internal sealed class SessionsListRequest +internal sealed class PluginsMarketplacesRemoveRequest { - /// 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 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; } - /// 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; } + /// Marketplace name to remove. + [JsonPropertyName("name")] + public string Name { get; set; } = string.Empty; +} - /// Which session sources to include. Defaults to `local` for backward compatibility. - [JsonPropertyName("source")] - public SessionSource? Source { get; set; } +/// 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; } - /// 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; } + /// Plugin name as listed in the marketplace catalog. + [JsonPropertyName("name")] + public string Name { get; set; } = string.Empty; } -/// Persisted local session metadata, including identifiers, timestamps, summary/name, client, context, detached state, and task ID. +/// Plugins advertised by the marketplace. [Experimental(Diagnostics.Experimental)] -public sealed class LocalSessionMetadataValue +public sealed class MarketplaceBrowseResult { - /// 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; } + /// Plugins advertised by the marketplace. + [JsonPropertyName("plugins")] + public IList Plugins { get => field ??= []; set; } } -/// Persisted local session metadata when the session exists. +/// Name of the marketplace whose plugin catalog to fetch. [Experimental(Diagnostics.Experimental)] -internal sealed class SessionsGetMetadataResult +internal sealed class PluginsMarketplacesBrowseRequest { - /// Local session metadata, omitted when the session does not exist. - [JsonPropertyName("session")] - public LocalSessionMetadataValue? Session { get; set; } + /// Marketplace name to browse. + [JsonPropertyName("name")] + public string Name { get; set; } = string.Empty; } -/// Session ID whose persisted metadata should be read. +/// Per-marketplace refresh result, including marketplace name, success flag, and optional failure error. [Experimental(Diagnostics.Experimental)] -internal sealed class SessionsGetMetadataRequest +public sealed class MarketplaceRefreshEntry { - /// Session ID to inspect. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; -} + /// Error message (failure only). + [JsonPropertyName("error")] + public string? Error { get; set; } -/// 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; } -} + /// Marketplace name that was refreshed. + [JsonPropertyName("name")] + public string Name { get; set; } = string.Empty; -/// 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; } + /// Whether the refresh succeeded. + [JsonPropertyName("success")] + public bool Success { get; set; } } -/// ID of the local session bound to the given GitHub task, or omitted when none. +/// Result of refreshing one or more marketplace catalogs. [Experimental(Diagnostics.Experimental)] -public sealed class SessionsFindByTaskIDResult +public sealed class MarketplaceRefreshResult { - /// Omitted when no local session is bound to that GitHub task. - [JsonPropertyName("sessionId")] - public string? SessionId { get; set; } + /// Per-marketplace refresh results in deterministic order. + [JsonPropertyName("results")] + public IList Results { get => field ??= []; set; } } -/// GitHub task ID to look up. +/// RPC data type for PluginsMarketplacesRefresh operations. [Experimental(Diagnostics.Experimental)] -internal sealed class SessionsFindByTaskIDRequest +internal sealed class PluginsMarketplacesRefreshRequest { - /// GitHub task ID to look up. - [JsonPropertyName("taskId")] - public string TaskId { get; set; } = string.Empty; + /// Marketplace name to refresh. When omitted, every registered marketplace is refreshed. + [JsonPropertyName("name")] + public string? Name { get; set; } } -/// Session ID matching the prefix, omitted when no unique match exists. +/// Server-side skill metadata, including name, description, source, enabled/invocable state, path, project path, and argument hint. [Experimental(Diagnostics.Experimental)] -public sealed class SessionsFindByPrefixResult +public sealed class ServerSkill { - /// Omitted when no unique session matches the prefix (no match or ambiguous). - [JsonPropertyName("sessionId")] - public string? SessionId { get; set; } -} + /// Optional freeform hint describing the skill's expected arguments, from the `argument-hint` frontmatter field. + [JsonPropertyName("argumentHint")] + public string? ArgumentHint { 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; + /// 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; } } -/// Most-relevant session ID for the supplied context, or omitted when no sessions exist. +/// Skills discovered across global and project sources. [Experimental(Diagnostics.Experimental)] -public sealed class SessionsGetLastForContextResult +public sealed class ServerSkillList { - /// Most-relevant session ID for the supplied context, or omitted when no sessions exist. - [JsonPropertyName("sessionId")] - public string? SessionId { get; set; } + /// 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 working-directory context used to score session relevance. +/// Optional project paths and additional skill directories to include in discovery. [Experimental(Diagnostics.Experimental)] -internal sealed class SessionsGetLastForContextRequest +internal sealed class SkillsDiscoverRequest { - /// Optional working-directory context used to score session relevance. When omitted the most-recently-modified session wins. - [JsonPropertyName("context")] - public SessionContext? Context { get; set; } + /// 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; } } -/// Absolute path to the session's events.jsonl file on disk. +/// Canonical directory where skills can be discovered or created, with scope, preference, and optional project path. [Experimental(Diagnostics.Experimental)] -internal sealed class SessionsGetEventFilePathResult +public sealed class SkillDiscoveryPath { - /// Absolute path to the session's events.jsonl file. - [JsonPropertyName("filePath")] - public string FilePath { get; set; } = string.Empty; + /// 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; } } -/// Session ID whose event-log file path to compute. +/// Canonical locations where skills can be created so the runtime will recognize them. [Experimental(Diagnostics.Experimental)] -internal sealed class SessionsGetEventFilePathRequest +public sealed class SkillDiscoveryPathList { - /// Session ID whose event-log file path to compute. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// Canonical skill create/discovery directories, in priority order. + [JsonPropertyName("paths")] + public IList Paths { get => field ??= []; set; } } -/// Map of sessionId -> on-disk size in bytes for each session's workspace directory. +/// Optional project paths to enumerate. [Experimental(Diagnostics.Experimental)] -public sealed class SessionSizes +internal sealed class SkillsGetDiscoveryPathsRequest { - /// Map of sessionId -> on-disk size in bytes for the session's workspace directory. - [JsonPropertyName("sizes")] - public IDictionary Sizes { get => field ??= new Dictionary(); set; } + /// 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; } } -/// Session IDs from the input set that are currently in use by another process. +/// Skill names to mark as disabled in global configuration, replacing any previous list. [Experimental(Diagnostics.Experimental)] -public sealed class SessionsCheckInUseResult +internal sealed class SkillsConfigSetDisabledSkillsRequest { - /// 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; } + /// List of skill names to disable. + [JsonPropertyName("disabledSkills")] + public IList DisabledSkills { get => field ??= []; set; } } -/// Session IDs to test for live in-use locks. +/// Adds or removes a single skill from the global disabled list, leaving every other entry untouched. [Experimental(Diagnostics.Experimental)] -internal sealed class SessionsCheckInUseRequest +internal sealed class SkillsConfigSetSkillDisabledRequest { - /// Session IDs to test for live in-use locks. - [JsonPropertyName("sessionIds")] - public IList SessionIds { get => field ??= []; set; } + /// 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; } -/// The session's persisted remote-steerable flag, or omitted when no value has been persisted. +/// Agent metadata, including identifiers, display details, source, tools, model, MCP servers, skills, and file path. [Experimental(Diagnostics.Experimental)] -internal sealed class SessionsGetPersistedRemoteSteerableResult +public sealed class AgentInfo { - /// The session's persisted remote-steerable flag if recorded; omitted when no value has been persisted. - [JsonPropertyName("remoteSteerable")] - public bool? RemoteSteerable { get; set; } -} + /// Description of the agent's purpose. + [JsonPropertyName("description")] + public string Description { get; set; } = string.Empty; -/// 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; + /// 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; } + + /// 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; } } -/// 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. +/// Agents discovered across user, project, plugin, and remote sources. [Experimental(Diagnostics.Experimental)] -public sealed class SessionsCloseResult +public sealed class ServerAgentList { + /// All discovered agents across all sources. + [JsonPropertyName("agents")] + public IList Agents { get => field ??= []; set; } } -/// Session ID to close. +/// Optional project paths to include in agent discovery. [Experimental(Diagnostics.Experimental)] -internal sealed class SessionsCloseRequest +internal sealed class AgentsDiscoverRequest { - /// Session ID to close. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// 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; } } -/// Map of sessionId -> bytes freed by removing the session's workspace directory. +/// Canonical directory where custom agents can be discovered or created, with scope, preference, and optional project path. [Experimental(Diagnostics.Experimental)] -public sealed class SessionBulkDeleteResult +public sealed class AgentDiscoveryPath { - /// 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; } + /// 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; } } -/// Session IDs to close, deactivate, and delete from disk. +/// Canonical locations where custom agents can be created so the runtime will recognize them. [Experimental(Diagnostics.Experimental)] -internal sealed class SessionsBulkDeleteRequest +public sealed class AgentDiscoveryPathList { - /// Session IDs to close, deactivate, and delete from disk. - [JsonPropertyName("sessionIds")] - public IList SessionIds { get => field ??= []; set; } + /// Canonical agent create/discovery directories, in priority order. + [JsonPropertyName("paths")] + public IList Paths { get => field ??= []; set; } } -/// Session ID to delete from disk. +/// Optional project paths to include when enumerating agent discovery directories. [Experimental(Diagnostics.Experimental)] -internal sealed class SessionsDeleteRequest +internal sealed class AgentsGetDiscoveryPathsRequest { - /// Session ID to delete. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// 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; } - /// Internal resolved session directory path to delete. - [JsonPropertyName("sessionPath")] - public string? SessionPath { 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; } } -/// Outcome of the prune operation: deleted IDs, dry-run candidates, skipped IDs, total bytes freed, and the dry-run flag. +/// Loaded instruction source for a session, including path, content, category, location, applicability, and optional description. [Experimental(Diagnostics.Experimental)] -public sealed class SessionPruneResult +public sealed class InstructionSource { - /// Session IDs that would be deleted in dry-run mode (always empty otherwise). - [JsonPropertyName("candidates")] - public IList Candidates { get => field ??= []; set; } + /// Glob pattern(s) from frontmatter — when set, this instruction applies only to matching files. + [JsonPropertyName("applyTo")] + public IList? ApplyTo { get; set; } - /// Session IDs that were deleted (always empty in dry-run mode). - [JsonPropertyName("deleted")] - public IList Deleted { get => field ??= []; set; } + /// Raw content of the instruction file. + [JsonPropertyName("content")] + public string Content { get; set; } = string.Empty; - /// True when no deletions were actually performed. - [JsonPropertyName("dryRun")] - public bool DryRun { get; set; } + /// When true, this source starts disabled and must be toggled on by the user. + [JsonPropertyName("defaultDisabled")] + public bool? DefaultDisabled { get; set; } - /// Total bytes freed (actual when not dry-run, projected when dry-run). - [JsonPropertyName("freedBytes")] - public long FreedBytes { get; set; } + /// Short description (body after frontmatter) for use in instruction tables. + [JsonPropertyName("description")] + public string? Description { get; set; } - /// Session IDs that were skipped (e.g., named sessions). - [JsonPropertyName("skipped")] - public IList Skipped { get => field ??= []; set; } -} + /// Unique identifier for this source (used for toggling). + [JsonPropertyName("id")] + public string Id { get; set; } = string.Empty; -/// 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; } + /// Human-readable label. + [JsonPropertyName("label")] + public string Label { get; set; } = string.Empty; - /// Session IDs that should never be considered for pruning. - [JsonPropertyName("excludeSessionIds")] - public IList? ExcludeSessionIds { get; set; } + /// Where this source lives — used for UI grouping. + [JsonPropertyName("location")] + public InstructionSourceLocation Location { get; set; } - /// When true, named sessions (set via /rename) are also eligible for pruning. - [JsonPropertyName("includeNamed")] - public bool? IncludeNamed { 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; } - /// Delete sessions whose modifiedTime is at least this many days old. - [JsonPropertyName("olderThanDays")] - public long OlderThanDays { 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; } } -/// Flush a session's pending events to disk. No-op when no writer exists for the session (e.g., already closed). +/// Instruction sources discovered across user, repository, and plugin sources. [Experimental(Diagnostics.Experimental)] -public sealed class SessionsSaveResult +public sealed class ServerInstructionSourceList { + /// All discovered instruction sources. + [JsonPropertyName("sources")] + public IList Sources { get => field ??= []; set; } } -/// Session ID whose pending events should be flushed to disk. +/// Optional project paths to include in instruction discovery. [Experimental(Diagnostics.Experimental)] -internal sealed class SessionsSaveRequest +internal sealed class InstructionsDiscoverRequest { - /// Session ID whose pending events should be flushed to disk. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// 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; } } -/// 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. +/// 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 SessionsReleaseLockResult +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; } } -/// Session ID whose in-use lock should be released. +/// Canonical files and directories where custom instructions can be created so the runtime will recognize them. [Experimental(Diagnostics.Experimental)] -internal sealed class SessionsReleaseLockRequest +public sealed class InstructionDiscoveryPathList { - /// Session ID whose in-use lock should be released. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// Canonical instruction create/discovery files and directories, in priority order. + [JsonPropertyName("paths")] + public IList Paths { get => field ??= []; set; } } -/// The enriched metadata records, with summary and context fields backfilled where available. Sessions confirmed empty and unnamed are omitted. +/// Optional project paths to include when enumerating instruction discovery targets. [Experimental(Diagnostics.Experimental)] -public sealed class SessionEnrichMetadataResult +internal sealed class InstructionsGetDiscoveryPathsRequest { - /// Enriched records, with summary and context backfilled. Sessions confirmed empty and unnamed may be omitted. - [JsonPropertyName("sessions")] - public IList Sessions { get => field ??= []; set; } -} + /// 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; } -/// 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; } + /// Optional list of project directory paths. When omitted or empty, only the user-level targets are returned. + [JsonPropertyName("projectPaths")] + public IList? ProjectPaths { get; 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. +/// A literal choice the command input accepts, with a human-facing description. [Experimental(Diagnostics.Experimental)] -public sealed class SessionsReloadPluginHooksResult +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; } -/// Active session ID and an optional flag for deferring repo-level hooks until folder trust. +/// Optional unstructured input hint. [Experimental(Diagnostics.Experimental)] -internal sealed class SessionsReloadPluginHooksRequest +public sealed class SlashCommandInput { - /// When true, skip repo-level hooks. Use before folder trust is confirmed; loadDeferredRepoHooks loads them post-trust. - [JsonPropertyName("deferRepoHooks")] - public bool? DeferRepoHooks { get; set; } + /// 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; } - /// Active session ID to reload hooks for. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; -} + /// Optional completion hint for the input (e.g. 'directory' for filesystem path completion). + [JsonPropertyName("completion")] + public SlashCommandInputCompletion? Completion { get; set; } -/// 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; } + /// Hint to display when command input has not been provided. + [JsonPropertyName("hint")] + public string Hint { get; set; } = string.Empty; - /// 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; } -} + /// 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; } -/// 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; + /// When true, the command requires non-empty input; clients should render the input hint as required. + [JsonPropertyName("required")] + public bool? Required { get; set; } } -/// 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. +/// Slash-command metadata with name, aliases, description, kind, input hint, execution allowance, and schedulability. [Experimental(Diagnostics.Experimental)] -public sealed class SessionsSetAdditionalPluginsResult +public sealed class SlashCommandInfo { -} + /// Canonical aliases without leading slashes. + [JsonPropertyName("aliases")] + public IList? Aliases { get; set; } -/// 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 command may run while an agent turn is active. + [JsonPropertyName("allowDuringAgentExecution")] + public bool AllowDuringAgentExecution { get; set; } - /// Whether the plugin is currently enabled. - [JsonPropertyName("enabled")] - public bool Enabled { get; set; } + /// Human-readable command description. + [JsonPropertyName("description")] + public string Description { get; set; } = string.Empty; - /// Installation timestamp. - [JsonPropertyName("installed_at")] - public string InstalledAt { get; set; } = string.Empty; + /// Whether the command is experimental. + [JsonPropertyName("experimental")] + public bool? Experimental { get; set; } - /// Marketplace the plugin came from (empty string for direct repo installs). - [JsonPropertyName("marketplace")] - public string Marketplace { get; set; } = string.Empty; + /// Optional unstructured input hint. + [JsonPropertyName("input")] + public SlashCommandInput? Input { get; set; } - /// Plugin name. + /// 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; - /// 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; } + /// 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; } } -/// Manager-wide additional plugins to register; replaces any previously-configured set. +/// Slash commands available in the session, after applying any include/exclude filters. [Experimental(Diagnostics.Experimental)] -internal sealed class SessionsSetAdditionalPluginsRequest +public sealed class CommandList { - /// 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; } + /// Commands available in this session. + [JsonPropertyName("commands")] + public IList Commands { get => field ??= []; set; } } -/// Dynamic-context board entry count, when available. +/// A single user setting's effective value alongside its default, so consumers can render settings left at their default. [Experimental(Diagnostics.Experimental)] -internal sealed class SessionsGetBoardEntryCountResult +public sealed class UserSettingMetadata { - /// Board entry count, when available. - [JsonPropertyName("count")] - public long? Count { get; set; } + /// 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; } } -/// Session ID whose board entry count should be returned. +/// 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)] -internal sealed class SessionsGetBoardEntryCountRequest +public sealed class UserSettingsGetResult { - /// Session ID whose board entry count should be returned. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// 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; } } -/// State of the runtime-managed remote-control singleton. -/// Polymorphic base type discriminated by state. +/// Outcome of writing user settings. [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 +public sealed class UserSettingsSetResult { - /// The type discriminator. - [JsonPropertyName("state")] - public virtual string State { get; set; } = string.Empty; + /// 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; } } - -/// Remote control is not connected. -/// The off variant of . +/// 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)] -public partial class RemoteControlStatusOff : RemoteControlStatus +internal sealed class UserSettingsSetRequest { - /// - [JsonIgnore] - public override string State => "off"; + /// Partial user settings to write, as a free-form object keyed by setting name. + [JsonPropertyName("settings")] + public JsonElement Settings { get; set; } } -/// Remote control is in the middle of initial setup. -/// The connecting variant of . +/// Validated device-managed settings discovered before a session exists. [Experimental(Diagnostics.Experimental)] -public partial class RemoteControlStatusConnecting : RemoteControlStatus +public sealed class ManagedSettingsReadResult { - /// - [JsonIgnore] - public override string State => "connecting"; + /// Discovery or validation error text when managed settings could not be read safely. + [JsonPropertyName("errorMessage")] + public string? ErrorMessage { get; set; } - /// Session id the connection is attaching to. - [JsonPropertyName("attachedSessionId")] - public required string AttachedSessionId { 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; } } -/// Remote control is connected to a local session. -/// The active variant of . +/// Indicates whether the calling client was registered as the session filesystem provider. [Experimental(Diagnostics.Experimental)] -public partial class RemoteControlStatusActive : RemoteControlStatus +public sealed class SessionFsSetProviderResult { - /// - [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; } + /// Whether the provider was set successfully. + [JsonPropertyName("success")] + public bool Success { get; set; } } -/// The last setup attempt failed. The singleton is otherwise off. -/// The error variant of . +/// Optional capabilities declared by the provider. [Experimental(Diagnostics.Experimental)] -public partial class RemoteControlStatusError : RemoteControlStatus +public sealed class SessionFsSetProviderCapabilities { - /// - [JsonIgnore] - public override string State => "error"; + /// Whether the provider supports SQLite query/exists operations. + [JsonPropertyName("sqlite")] + public bool? Sqlite { get; set; } +} - /// Session id the failing setup attempt targeted, when known. - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("attachedSessionId")] - public string? AttachedSessionId { 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; } - /// Human-readable error message from the last setup attempt. - [JsonPropertyName("error")] - public required string Error { 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; } -/// Wrapper for the singleton's current status. +/// Indicates whether the calling client was registered as the LLM inference provider. [Experimental(Diagnostics.Experimental)] -public sealed class RemoteControlStatusResult +public sealed class LlmInferenceSetProviderResult { - /// State of the runtime-managed remote-control singleton. - [JsonPropertyName("status")] - public RemoteControlStatus Status { get => field ??= new(); set; } + /// Whether the provider was set successfully. + [JsonPropertyName("success")] + public bool Success { get; set; } } -/// Reattach to an existing MC session without creating a new one. +/// Whether the start frame was accepted. [Experimental(Diagnostics.Experimental)] -public sealed class RemoteControlConfigExistingMcSession +public sealed class LlmInferenceHttpResponseStartResult { - /// 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; + /// True when the response start was matched to a pending request; false when unknown. + [JsonPropertyName("accepted")] + public bool Accepted { get; set; } } -/// Configuration for the runtime-managed remote-control singleton. +/// Response head. [Experimental(Diagnostics.Experimental)] -public sealed class RemoteControlConfig +internal sealed class LlmInferenceHttpResponseStartRequest { - /// 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; } + /// HTTP response headers, preserving multiple values per name. + [JsonPropertyName("headers")] + public IDictionary> Headers { get => field ??= new Dictionary>(); set; } - /// When true, suppresses timeline messages on successful setup. - [JsonPropertyName("silent")] - public bool Silent { get; set; } + /// Matches the requestId from the originating httpRequestStart frame. + [JsonPropertyName("requestId")] + public string RequestId { get; set; } = string.Empty; - /// Whether the MC session may steer the local session (write mode). - [JsonPropertyName("steerable")] - public bool Steerable { get; set; } + /// HTTP status code. + [JsonPropertyName("status")] + public long Status { get; set; } - /// Existing Mission Control task ID to attach the exported session to. - [JsonPropertyName("taskId")] - public string? TaskId { get; set; } + /// Optional HTTP status reason phrase. + [JsonPropertyName("statusText")] + public string? StatusText { get; set; } } -/// Parameters for attaching the remote-control singleton to a session. +/// Whether the chunk was accepted. [Experimental(Diagnostics.Experimental)] -internal sealed class SessionsStartRemoteControlRequest +public sealed class LlmInferenceHttpResponseChunkResult { - /// 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; + /// True when the chunk was matched to a pending request; false when unknown. + [JsonPropertyName("accepted")] + public bool Accepted { get; set; } } -/// Outcome of a transferRemoteControl call. +/// 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 RemoteControlTransferResult +public sealed class LlmInferenceHttpResponseChunkError { - /// State of the runtime-managed remote-control singleton. - [JsonPropertyName("status")] - public RemoteControlStatus Status { get => field ??= new(); set; } + /// Optional machine-readable error code. + [JsonPropertyName("code")] + public string? Code { get; set; } - /// Whether the rebinding actually happened. - [JsonPropertyName("transferred")] - public bool Transferred { get; set; } + /// Human-readable failure description. + [JsonPropertyName("message")] + public string Message { get; set; } = string.Empty; } -/// Parameters for atomically rebinding the remote-control singleton. +/// A response body chunk or terminal error. [Experimental(Diagnostics.Experimental)] -internal sealed class SessionsTransferRemoteControlRequest +internal sealed class LlmInferenceHttpResponseChunkRequest { - /// 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; } + /// When true, `data` is base64-encoded bytes. When absent or false, `data` is UTF-8 text. + [JsonPropertyName("binary")] + public bool? Binary { get; set; } - /// Local session id to point remote control at. - [JsonPropertyName("toSessionId")] - public string ToSessionId { get; set; } = string.Empty; -} + /// 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; -/// 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; } -} + /// 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; } -/// 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; } + /// 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; } - /// Whether the singleton was actually torn down by this call. - [JsonPropertyName("stopped")] - public bool Stopped { get; set; } + /// Matches the requestId from the originating httpRequestStart frame. + [JsonPropertyName("requestId")] + public string RequestId { get; set; } = string.Empty; } -/// RPC data type for SessionsStopRemoteControl operations. +/// Pre-resolved working-directory context for session startup. [Experimental(Diagnostics.Experimental)] -internal sealed class SessionsStopRemoteControlRequest +public sealed class SessionContext { - /// 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; } + /// Active git branch. + [JsonPropertyName("branch")] + public string? Branch { 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; } -} + /// Most recent working directory for this session. + [JsonPropertyName("cwd")] + public string Cwd { get; set; } = string.Empty; -/// Handle for releasing the extension tool registration. -[Experimental(Diagnostics.Experimental)] -internal sealed class RegisterExtensionToolsResult -{ -} + /// Git repository root, if the cwd was inside a git repo. + [JsonPropertyName("gitRoot")] + public string? GitRoot { get; set; } -/// Optional registration options. -[Experimental(Diagnostics.Experimental)] -public sealed class SessionsRegisterExtensionToolsOnSessionOptions -{ + /// 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; } } -/// Params to attach an extension loader's tools to a session. +/// GitHub repository the remote session belongs to. [Experimental(Diagnostics.Experimental)] -internal sealed class RegisterExtensionToolsParams +public sealed class RemoteSessionMetadataRepository { - /// Optional registration options. - [JsonPropertyName("options")] - public SessionsRegisterExtensionToolsOnSessionOptions? Options { get; set; } + /// Branch associated with the remote session. + [JsonPropertyName("branch")] + public string Branch { get; set; } = string.Empty; - /// Session to register extension tools on. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; -} + /// Repository name. + [JsonPropertyName("name")] + public string Name { 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; + /// Repository owner. + [JsonPropertyName("owner")] + public string Owner { get; set; } = string.Empty; } -/// Outcome of an agentRegistry.spawn call. -/// Polymorphic base type discriminated by kind. +/// Remote session metadata for the session to hand off (typically obtained from `sessions.list` with `source: "remote"`). [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 +public sealed class RemoteSessionMetadataValue { - /// The type discriminator. - [JsonPropertyName("kind")] - public virtual string Kind { get; set; } = string.Empty; -} + /// 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; } -/// 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; } + /// 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; } - /// Git branch of the session (when known). - [JsonPropertyName("branch")] - public string? Branch { get; set; } + /// Always true for remote sessions. + [JsonPropertyName("isRemote")] + public bool IsRemote { 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; } + /// Last-modified time as an ISO 8601 timestamp. + [JsonPropertyName("modifiedTime")] + public string ModifiedTime { get; set; } = string.Empty; - /// How the most recent turn ended (clean vs aborted). Lets the renderer distinguish done from done_cancelled. - [JsonPropertyName("lastTerminalEvent")] - public AgentRegistryLiveTargetEntryLastTerminalEvent? LastTerminalEvent { get; set; } + /// Optional human-friendly name set via /rename. + [JsonPropertyName("name")] + public string? Name { get; set; } - /// Model identifier currently selected for the session. - [JsonPropertyName("model")] - public string? Model { get; set; } + /// Pull request number associated with the session. + [JsonPropertyName("pullRequestNumber")] + public long? PullRequestNumber { get; set; } - /// Operating-system pid of the process owning this entry. - [JsonPropertyName("pid")] - public long Pid { get; set; } + /// Backing remote session IDs (most recent first). + [JsonPropertyName("remoteSessionIds")] + public IList RemoteSessionIds { get => field ??= []; set; } - /// TCP port the entry's JSON-RPC server is listening on. - [JsonPropertyName("port")] - public long Port { get; set; } + /// GitHub repository the remote session belongs to. + [JsonPropertyName("repository")] + public RemoteSessionMetadataRepository Repository { get => field ??= new(); set; } - /// Registry entry schema version (1 = ui-server, 2 = managed-server). - [JsonPropertyName("schemaVersion")] - public long SchemaVersion { get; set; } + /// Original remote resource identifier (task ID or PR node ID). + [JsonPropertyName("resourceId")] + public string? ResourceId { get; set; } - /// Session ID of the foreground session for this entry. + /// Stable session identifier. [JsonPropertyName("sessionId")] - public string? SessionId { get; set; } + public string SessionId { get; set; } = string.Empty; - /// Friendly session name (when set). - [JsonPropertyName("sessionName")] - public string? SessionName { get; set; } + /// Deadline (ISO 8601) at which a CLI remote session becomes stale without further heartbeats. + [JsonPropertyName("staleAt")] + public string? StaleAt { get; set; } - /// ISO 8601 timestamp captured at registration. - [JsonPropertyName("startedAt")] - public string StartedAt { get; set; } = string.Empty; + /// Session creation time as an ISO 8601 timestamp. + [JsonPropertyName("startTime")] + public string StartTime { get; set; } = string.Empty; - /// Coarse lifecycle status of the foreground session. - [JsonPropertyName("status")] - public AgentRegistryLiveTargetEntryStatus? Status { get; set; } + /// Server-side task state returned by GitHub. + [JsonPropertyName("state")] + public string? State { get; set; } - /// Monotonic per-publisher revision counter incremented on every status update. Lets watchers detect transient flips. - [JsonPropertyName("statusRevision")] - public long? StatusRevision { get; set; } + /// Short summary of the session, when one has been derived. + [JsonPropertyName("summary")] + public string? Summary { get; set; } - /// Connection token (null when the target is unauthenticated). - [JsonInclude] - [JsonPropertyName("token")] - internal string? Token { get; set; } + /// Whether the remote task originated from CCA or CLI `--remote`. + [JsonPropertyName("taskType")] + public RemoteSessionMetadataTaskType? TaskType { get; set; } } -/// Per-spawn log-capture outcome; populated from spawnLiveTarget. +/// `sessions.open` handoff progress update with step, status, and optional message. [Experimental(Diagnostics.Experimental)] -public sealed class AgentRegistryLogCapture +public sealed class SessionsOpenProgress { - /// 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; } + /// Optional step message. + [JsonPropertyName("message")] + public string? Message { get; set; } - /// Categorized reason for log-open failure. - [JsonPropertyName("openErrorReason")] - public AgentRegistryLogCaptureOpenErrorReason? OpenErrorReason { get; set; } + /// Step status. + [JsonPropertyName("status")] + public SessionsOpenProgressStatus Status { get; set; } - /// Absolute path to the per-spawn log file (only set when enabled). - [JsonPropertyName("path")] - public string? Path { get; set; } + /// Handoff step. + [JsonPropertyName("step")] + public SessionsOpenProgressStep Step { get; set; } } -/// Managed-server child was spawned and registered successfully. -/// The spawned variant of . +/// Result of opening a session. [Experimental(Diagnostics.Experimental)] -public partial class AgentRegistrySpawnResultSpawned : AgentRegistrySpawnResult +public sealed class SessionOpenResult { - /// - [JsonIgnore] - public override string Kind => "spawned"; + /// Remote session metadata, present when status is `connected`. + [JsonPropertyName("metadata")] + public RemoteSessionMetadataValue? Metadata { get; set; } - /// 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; } + /// Handoff progress steps, present when status is `handed_off`. + [JsonPropertyName("progress")] + public IList? Progress { 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; } + /// Remote session ID, present when status is `connected`. + [JsonPropertyName("remoteSessionId")] + public string? RemoteSessionId { 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; } + /// Opened session ID. Omitted when status is `not_found`. + [JsonPropertyName("sessionId")] + public string? SessionId { get; set; } - /// Per-spawn log-capture outcome; populated from spawnLiveTarget. - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("logCapture")] - public AgentRegistryLogCapture? LogCapture { 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; } } -/// `child_process.spawn` itself failed before the child entered the registry. -/// The spawn-error variant of . +/// Identifier and optional friendly name assigned to the newly forked session. [Experimental(Diagnostics.Experimental)] -public partial class AgentRegistrySpawnResultSpawnError : AgentRegistrySpawnResult +public sealed class SessionsForkResult { - /// - [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; } + /// Friendly name assigned to the forked session, if any. + [JsonPropertyName("name")] + public string? Name { get; set; } - /// Human-readable error message. - [JsonPropertyName("message")] - public required string Message { get; set; } + /// The new forked session's ID. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; } -/// Spawn succeeded but the child did not publish a matching managed-server entry within the timeout. -/// The registry-timeout variant of . +/// Source session identifier to fork from, optional event-ID boundary, and optional friendly name for the new session. [Experimental(Diagnostics.Experimental)] -public partial class AgentRegistrySpawnResultRegistryTimeout : AgentRegistrySpawnResult +internal sealed class SessionsForkRequest { - /// - [JsonIgnore] - public override string Kind => "registry-timeout"; + /// Optional friendly name to assign to the forked session. + [JsonPropertyName("name")] + public string? Name { get; set; } - /// Process ID of the orphaned child (so the caller can offer 'kill the pid' guidance). - [JsonPropertyName("childPid")] - public required long ChildPid { get; set; } + /// Source session ID to fork from. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; - /// Per-spawn log-capture outcome; populated from spawnLiveTarget. - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("logCapture")] - public AgentRegistryLogCapture? LogCapture { get; set; } + /// 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; } } -/// Synchronous pre-validation rejected the spawn request. -/// The validation-error variant of . +/// Repository associated with the connected remote session. [Experimental(Diagnostics.Experimental)] -public partial class AgentRegistrySpawnResultValidationError : AgentRegistrySpawnResult +public sealed class ConnectedRemoteSessionMetadataRepository { - /// - [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; } + /// Branch associated with the remote session. + [JsonPropertyName("branch")] + public string Branch { get; set; } = string.Empty; - /// Human-readable explanation; safe to surface in the UI banner. Never logged to unrestricted telemetry. - [JsonPropertyName("message")] - public required string Message { get; set; } + /// Repository name. + [JsonPropertyName("name")] + public string Name { get; set; } = string.Empty; - /// 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; } + /// Repository owner or organization login. + [JsonPropertyName("owner")] + public string Owner { get; set; } = string.Empty; } -/// Inputs to spawn a managed-server child via the controller's spawn delegate. +/// Metadata for a connected remote session. [Experimental(Diagnostics.Experimental)] -internal sealed class AgentRegistrySpawnRequest +public sealed class ConnectedRemoteSessionMetadata { - /// 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; } + /// Neutral SDK discriminator for the connected remote session kind. + [JsonPropertyName("kind")] + public ConnectedRemoteSessionMetadataKind Kind { get; set; } - /// Model identifier to apply to the new session. - [JsonPropertyName("model")] - public string? Model { get; set; } + /// Last session update time as an ISO 8601 string. + [JsonPropertyName("modifiedTime")] + public DateTimeOffset ModifiedTime { get; set; } - /// Friendly session name. Must satisfy validateSessionName: non-empty, no leading/trailing whitespace, <=100 chars, no control chars, no double quotes. + /// Optional friendly session name. [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; } + /// 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; } } -/// Identifies the target session. +/// Remote session connection result. [Experimental(Diagnostics.Experimental)] -internal sealed class SessionSuspendRequest +public sealed class RemoteSessionConnectionResult { - /// Target session identifier. + /// 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; } -/// Result of sending a user message. +/// Remote session connection parameters. [Experimental(Diagnostics.Experimental)] -public sealed class SendResult +internal sealed class ConnectRemoteSessionParams { - /// Unique identifier assigned to the message. - [JsonPropertyName("messageId")] - public string MessageId { get; set; } = string.Empty; + /// Session ID to connect to. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; } -/// Parameters for sending a user message to the session. +/// Local or remote session metadata entry. Narrow on `isRemote` to access source-specific fields. +/// Data type discriminated by isRemote. [Experimental(Diagnostics.Experimental)] -internal sealed class SendRequest +public partial class SessionListEntry { - /// 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; } + /// The boolean discriminator. + [JsonPropertyName("isRemote")] + public bool IsRemote { get; set; } - /// Optional attachments (files, directories, selections, blobs, GitHub references) to include with the message. - [JsonPropertyName("attachments")] - public IList? Attachments { get; set; } + /// Runtime client name that created/last resumed this session. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("clientName")] + public string? ClientName { 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; } + /// Pre-resolved working-directory context for session startup. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("context")] + public SessionContext? Context { get; set; } - /// If provided, this is shown in the timeline instead of `prompt`. - [JsonPropertyName("displayPrompt")] - public string? DisplayPrompt { 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; } - /// 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; } + /// 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; } - /// If true, adds the message to the front of the queue instead of the end. - [JsonPropertyName("prepend")] - public bool? Prepend { 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; } - /// The user message text. - [JsonPropertyName("prompt")] - public string Prompt { get; set; } = string.Empty; + /// 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; } - /// 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; } + /// Last-modified time of the session's persisted state, as ISO 8601. + [JsonPropertyName("modifiedTime")] + public required string ModifiedTime { 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; } + /// Optional human-friendly name set via /rename. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("name")] + public string? Name { get; set; } - /// Target session identifier. + /// 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 string SessionId { get; set; } = string.Empty; + public required string SessionId { 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; } + /// 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; } - /// W3C Trace Context traceparent header for distributed tracing of this agent turn. - [JsonPropertyName("traceparent")] - public string? Traceparent { get; set; } + /// Session creation time as an ISO 8601 timestamp. + [JsonPropertyName("startTime")] + public required string StartTime { get; set; } - /// W3C Trace Context tracestate header for distributed tracing. - [JsonPropertyName("tracestate")] - public string? Tracestate { get; set; } + /// Server-side task state returned by GitHub. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("state")] + public string? State { 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; } + /// 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; } } -/// Result of sending zero or more user messages. +/// Sessions matching the filter, ordered most-recently-modified first. [Experimental(Diagnostics.Experimental)] -public sealed class SendMessagesResult +public sealed class SessionList { - /// 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; } + /// Sessions ordered most-recently-modified first. Discriminated by `isRemote`. + [JsonPropertyName("sessions")] + public IList Sessions { get => field ??= []; set; } } -/// A single user message to append to the session as part of a `session.sendMessages` turn. +/// Optional filter applied to the returned sessions. [Experimental(Diagnostics.Experimental)] -public sealed class SendMessageItem +public sealed class SessionListFilter { - /// 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; } + /// Match sessions whose context.branch equals this value. + [JsonPropertyName("branch")] + public string? Branch { get; set; } - /// The user message text. - [JsonPropertyName("prompt")] - public string Prompt { get; set; } = string.Empty; + /// Match sessions whose context.cwd equals this value. + [JsonPropertyName("cwd")] + public string? Cwd { 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; } + /// Match sessions whose context.gitRoot equals this value. + [JsonPropertyName("gitRoot")] + public string? GitRoot { 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; } + /// Match sessions whose context.repository equals this value. + [JsonPropertyName("repository")] + public string? Repository { 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. +/// Optional source filter, metadata-load limit, and context filter applied to the returned sessions. [Experimental(Diagnostics.Experimental)] -internal sealed class SendMessagesRequest +internal sealed class SessionsListRequest { - /// 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; } + /// Optional filter applied to the returned sessions. + [JsonPropertyName("filter")] + public SessionListFilter? Filter { 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; } + /// When true, include detached maintenance sessions. Defaults to false for user-facing session lists. + [JsonPropertyName("includeDetached")] + public bool? IncludeDetached { get; 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; } + /// 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; } - /// If true, adds the messages to the front of the queue instead of the end. - [JsonPropertyName("prepend")] - public bool? Prepend { get; set; } + /// Which session sources to include. Defaults to `local` for backward compatibility. + [JsonPropertyName("source")] + public SessionSource? Source { 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; } + /// 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; } +} - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; +/// 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; } - /// W3C Trace Context traceparent header for distributed tracing of this agent turn. - [JsonPropertyName("traceparent")] - public string? Traceparent { get; set; } + /// Pre-resolved working-directory context for session startup. + [JsonPropertyName("context")] + public SessionContext? Context { get; set; } - /// W3C Trace Context tracestate header for distributed tracing. - [JsonPropertyName("tracestate")] - public string? Tracestate { get; set; } + /// True for detached maintenance sessions that should be hidden from normal resume lists. + [JsonPropertyName("isDetached")] + public bool? IsDetached { 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; } -} + /// Always false for local sessions. + [JsonPropertyName("isRemote")] + public bool IsRemote { 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; } + /// 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; } - /// Notification text to deliver to the model. - [JsonPropertyName("message")] - public string Message { get; set; } = string.Empty; + /// Last-modified time of the session's persisted state, as ISO 8601. + [JsonPropertyName("modifiedTime")] + public string ModifiedTime { get; set; } = string.Empty; - /// Internal delivery options, including passive policy. - [JsonPropertyName("options")] - public JsonElement? Options { get; set; } + /// Optional human-friendly name set via /rename. + [JsonPropertyName("name")] + public string? Name { get; set; } - /// Target session identifier. + /// 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; } } -/// Result of aborting the current turn. +/// Persisted local session metadata when the session exists. [Experimental(Diagnostics.Experimental)] -public sealed class AbortResult +internal sealed class SessionsGetMetadataResult { - /// 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; } + /// Local session metadata, omitted when the session does not exist. + [JsonPropertyName("session")] + public LocalSessionMetadataValue? Session { get; set; } } -/// Parameters for aborting the current turn. +/// Session ID whose persisted metadata should be read. [Experimental(Diagnostics.Experimental)] -internal sealed class AbortRequest +internal sealed class SessionsGetMetadataRequest { - /// Finite reason code describing why the current turn was aborted. - [JsonPropertyName("reason")] - public AbortReason? Reason { get; set; } - - /// Target session identifier. + /// Session ID to inspect. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } -/// Result of interrupting the main agent turn. +/// Recent local session IDs that contain user-visible history. [Experimental(Diagnostics.Experimental)] -public sealed class InterruptMainTurnResult +internal sealed class SessionsListNonEmptySessionIdsResult { - /// Whether an in-flight main agent turn was interrupted. False when the main loop was not processing. - [JsonPropertyName("interrupted")] - public bool Interrupted { get; set; } + /// Session IDs ordered newest-first. + [JsonPropertyName("sessionIds")] + public IList SessionIds { get => field ??= []; set; } } -/// Parameters for interrupting the main agent turn. +/// Limit for non-empty local session IDs. [Experimental(Diagnostics.Experimental)] -internal sealed class InterruptMainTurnRequest +internal sealed class SessionsListNonEmptySessionIdsRequest { - /// 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; + /// Maximum number of session IDs to return. + [JsonPropertyName("limit")] + public long? Limit { get; set; } } -/// Identifies the target session. +/// ID of the local session bound to the given GitHub task, or omitted when none. [Experimental(Diagnostics.Experimental)] -internal sealed class SessionCancelAllBackgroundAgentsRequest +public sealed class SessionsFindByTaskIDResult { - /// Target session identifier. + /// Omitted when no local session is bound to that GitHub task. [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + public string? SessionId { get; set; } } -/// Parameters for shutting down the session. +/// GitHub task ID to look up. [Experimental(Diagnostics.Experimental)] -internal sealed class ShutdownRequest +internal sealed class SessionsFindByTaskIDRequest { - /// 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; } + /// GitHub task ID to look up. + [JsonPropertyName("taskId")] + public string TaskId { get; set; } = string.Empty; } -/// Identifier of the session event that was emitted for the log message. +/// Session ID matching the prefix, omitted when no unique match exists. [Experimental(Diagnostics.Experimental)] -public sealed class LogResult +public sealed class SessionsFindByPrefixResult { - /// The unique identifier of the emitted session event. - [JsonPropertyName("eventId")] - public Guid EventId { get; set; } + /// Omitted when no unique session matches the prefix (no match or ambiguous). + [JsonPropertyName("sessionId")] + public string? SessionId { get; set; } } -/// Message text, optional severity level, persistence flag, optional follow-up URL, and optional tip. +/// UUID prefix to resolve to a unique session ID. [Experimental(Diagnostics.Experimental)] -internal sealed class LogRequest +internal sealed class SessionsFindByPrefixRequest { - /// 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; } + /// 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; } -/// Authentication status and account metadata for the session. +/// Most-relevant session ID for the supplied context, or omitted when no sessions exist. [Experimental(Diagnostics.Experimental)] -public sealed class SessionAuthStatus +public sealed class SessionsGetLastForContextResult { - /// 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; } + /// Most-relevant session ID for the supplied context, or omitted when no sessions exist. + [JsonPropertyName("sessionId")] + public string? SessionId { get; set; } } -/// Identifies the target session. +/// Optional working-directory context used to score session relevance. [Experimental(Diagnostics.Experimental)] -internal sealed class SessionGitHubAuthGetStatusRequest +internal sealed class SessionsGetLastForContextRequest { - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// Optional working-directory context used to score session relevance. When omitted the most-recently-modified session wins. + [JsonPropertyName("context")] + public SessionContext? Context { get; set; } } -/// Indicates whether the credential update succeeded. +/// Absolute path to the session's events.jsonl file on disk. [Experimental(Diagnostics.Experimental)] -public sealed class SessionSetCredentialsResult +internal sealed class SessionsGetEventFilePathResult { - /// 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; } + /// Absolute path to the session's events.jsonl file. + [JsonPropertyName("filePath")] + public string FilePath { get; set; } = string.Empty; } -/// New auth credentials to install on the session. Omit to leave credentials unchanged. +/// Session ID whose event-log file path to compute. [Experimental(Diagnostics.Experimental)] -internal sealed class SessionSetCredentialsParams +internal sealed class SessionsGetEventFilePathRequest { - /// 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 AuthInfo? Credentials { get; set; } - - /// Target session identifier. + /// Session ID whose event-log file path to compute. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } -/// Credential-free authentication identity safe to expose to hosts and user interfaces. +/// Map of sessionId -> on-disk size in bytes for each session's workspace directory. [Experimental(Diagnostics.Experimental)] -public sealed class AuthIdentity +public sealed class SessionSizes { - /// 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; } + /// Map of sessionId -> on-disk size in bytes for the session's workspace directory. + [JsonPropertyName("sizes")] + public IDictionary Sizes { get => field ??= new Dictionary(); set; } +} - /// Authentication host. - [JsonPropertyName("host")] - public string Host { get; set; } = string.Empty; +/// 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; } +} - /// Authenticated login, when available. - [JsonPropertyName("login")] - public string? Login { get; 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; } +} - /// Authentication type. - [JsonPropertyName("type")] - public AuthInfoType Type { get; 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; } } -/// Identifies the target session. +/// Session ID to look up the persisted remote-steerable flag for. [Experimental(Diagnostics.Experimental)] -internal sealed class SessionGitHubAuthGetCurrentAuthInfoRequest +internal sealed class SessionsGetPersistedRemoteSteerableRequest { - /// Target session identifier. + /// Session ID to look up the persisted remote-steerable flag for. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } -/// Identifies the target session. +/// 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)] -internal sealed class SessionGitHubAuthGetAllAuthAvailableRequest +public sealed class SessionsCloseResult { - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; } -/// Identifies the target session. +/// Session ID to close. [Experimental(Diagnostics.Experimental)] -internal sealed class SessionGitHubAuthRefreshCopilotUserRequest +internal sealed class SessionsCloseRequest { - /// Target session identifier. + /// Session ID to close. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } -/// Internal GitHub login parameters. +/// Map of sessionId -> bytes freed by removing the session's workspace directory. [Experimental(Diagnostics.Experimental)] -internal sealed class SessionAuthLoginRequest +public sealed class SessionBulkDeleteResult { - /// GitHub host URL. - [JsonPropertyName("host")] - public string Host { get; set; } = string.Empty; - - /// GitHub login. - [JsonPropertyName("login")] - public string Login { get; set; } = string.Empty; + /// 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; } +} - /// Whether to persist the token after login. - [JsonPropertyName("persist")] - public bool? Persist { get; 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; } +} - /// Target session identifier. +/// 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; - /// GitHub authentication token. - [JsonPropertyName("token")] - public string Token { get; set; } = string.Empty; + /// Internal resolved session directory path to delete. + [JsonPropertyName("sessionPath")] + public string? SessionPath { get; set; } } -/// Parameters for switching the session's active authentication. +/// Outcome of the prune operation: deleted IDs, dry-run candidates, skipped IDs, total bytes freed, and the dry-run flag. [Experimental(Diagnostics.Experimental)] -internal sealed class SessionAuthSwitchRequest +public sealed class SessionPruneResult { - /// Authentication information to activate. - [JsonPropertyName("authInfo")] - public AuthInfo AuthInfo { get => field ??= new(); set; } + /// Session IDs that would be deleted in dry-run mode (always empty otherwise). + [JsonPropertyName("candidates")] + public IList Candidates { get => field ??= []; set; } - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// Session IDs that were deleted (always empty in dry-run mode). + [JsonPropertyName("deleted")] + public IList Deleted { get => field ??= []; set; } - /// Optional token paired with the authentication information. - [JsonPropertyName("token")] - public string? Token { get; 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; } } -/// Identifies the target session. +/// Age threshold and optional flags controlling which old sessions are pruned (or simulated when dryRun is true). [Experimental(Diagnostics.Experimental)] -internal sealed class SessionGitHubAuthLogoutRequest +internal sealed class SessionsPruneOldRequest { - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// 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; } } -/// Parameters identifying a GitHub authentication to log out. +/// Flush a session's pending events to disk. No-op when no writer exists for the session (e.g., already closed). [Experimental(Diagnostics.Experimental)] -internal sealed class SessionAuthLogoutUserRequest +public sealed class SessionsSaveResult { - /// Authentication information to log out. - [JsonPropertyName("authInfo")] - public AuthInfo AuthInfo { get => field ??= new(); set; } +} - /// Target session identifier. +/// 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; } -/// Validation error from an authentication attempt. +/// 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 AuthValidationError +public sealed class SessionsReleaseLockResult { - /// 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. +/// Session ID whose in-use lock should be released. [Experimental(Diagnostics.Experimental)] -internal sealed class SessionGitHubAuthLastAuthErrorsRequest +internal sealed class SessionsReleaseLockRequest { - /// Target session identifier. + /// Session ID whose in-use lock should be released. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } -/// A file included in the redacted debug bundle. +/// 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 DebugCollectLogsCollectedEntry +public sealed class SessionEnrichMetadataResult { - /// 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; } + /// Enriched records, with summary and context backfilled. Sessions confirmed empty and unnamed may be omitted. + [JsonPropertyName("sessions")] + public IList Sessions { get => field ??= []; set; } } -/// An optional debug bundle entry that could not be included. +/// Session metadata records to enrich with summary and context information. [Experimental(Diagnostics.Experimental)] -public sealed class DebugCollectLogsSkippedEntry +internal sealed class SessionsEnrichMetadataRequest { - /// 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; + /// Session metadata records to enrich. Records that already have summary and context are returned unchanged. + [JsonPropertyName("sessions")] + public IList Sessions { get => field ??= []; set; } } -/// Result of collecting a redacted debug bundle. +/// 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 DebugCollectLogsResult +public sealed class SessionsReloadPluginHooksResult { - /// 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. +/// Active session ID and an optional flag for deferring repo-level hooks until folder trust. [Experimental(Diagnostics.Experimental)] -public sealed class DebugCollectLogsEntry +internal sealed class SessionsReloadPluginHooksRequest { - /// Relative path to use inside the staged bundle/archive. - [JsonPropertyName("bundlePath")] - public string BundlePath { get; set; } = string.Empty; + /// When true, skip repo-level hooks. Use before folder trust is confirmed; loadDeferredRepoHooks loads them post-trust. + [JsonPropertyName("deferRepoHooks")] + public bool? DeferRepoHooks { get; set; } - /// Kind of source path to include. - [JsonPropertyName("kind")] - public DebugCollectLogsEntryKind Kind { get; set; } + /// Active session ID to reload hooks for. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} - /// 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. +/// Queued repo-level startup prompts and the total hook command count after loading. [Experimental(Diagnostics.Experimental)] -[JsonPolymorphic( - TypeDiscriminatorPropertyName = "kind", - UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToBaseType)] -[JsonDerivedType(typeof(DebugCollectLogsDestinationArchive), "archive")] -[JsonDerivedType(typeof(DebugCollectLogsDestinationDirectory), "directory")] -public partial class DebugCollectLogsDestination +public sealed class SessionLoadDeferredRepoHooksResult { - /// The type discriminator. - [JsonPropertyName("kind")] - public virtual string Kind { get; set; } = string.Empty; -} + /// 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; } +} -/// The archive variant of . +/// Active session ID whose deferred repo-level hooks should be loaded. [Experimental(Diagnostics.Experimental)] -public partial class DebugCollectLogsDestinationArchive : DebugCollectLogsDestination +internal sealed class SessionsLoadDeferredRepoHooksRequest { - /// - [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; } + /// Active session ID whose deferred repo-level hooks should be loaded. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; } -/// The directory variant of . +/// 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 partial class DebugCollectLogsDestinationDirectory : DebugCollectLogsDestination +public sealed class SessionsSetAdditionalPluginsResult { - /// - [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. +/// Installed plugin record from global state, with marketplace, version, install time, enabled state, cache path, and source. [Experimental(Diagnostics.Experimental)] -public sealed class DebugCollectLogsInclude +public sealed class InstalledPlugin { - /// 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; } + /// Path where the plugin is cached locally. + [JsonPropertyName("cache_path")] + public string? CachePath { get; set; } - /// Include the session event log (`events.jsonl`). Defaults to true. - [JsonPropertyName("events")] - public bool? Events { get; set; } + /// Whether the plugin is currently enabled. + [JsonPropertyName("enabled")] + public bool Enabled { 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; } + /// Installation timestamp. + [JsonPropertyName("installed_at")] + public string InstalledAt { get; set; } = string.Empty; - /// Maximum number of previous process logs to include. Defaults to 5. - [JsonPropertyName("previousProcessLogLimit")] - public long? PreviousProcessLogLimit { get; set; } + /// Marketplace the plugin came from (empty string for direct repo installs). + [JsonPropertyName("marketplace")] + public string Marketplace { get; set; } = string.Empty; - /// 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; } + /// Plugin name. + [JsonPropertyName("name")] + public string Name { get; set; } = string.Empty; - /// Include process logs for the session. Defaults to true. - [JsonPropertyName("processLogs")] - public bool? ProcessLogs { get; set; } + /// Source for direct repo installs (when marketplace is empty). + [JsonPropertyName("source")] + public JsonElement? Source { get; set; } - /// Include interactive shell logs written under the session's `shell-logs` directory. Defaults to true. - [JsonPropertyName("shellLogs")] - public bool? ShellLogs { 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; } } -/// Options for collecting a redacted session debug bundle. +/// Manager-wide additional plugins to register; replaces any previously-configured set. [Experimental(Diagnostics.Experimental)] -internal sealed class DebugCollectLogsRequest +internal sealed class SessionsSetAdditionalPluginsRequest { - /// 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; } + /// 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; } +} - /// Which built-in session diagnostics to include. Omitted fields default to true. - [JsonPropertyName("include")] - public DebugCollectLogsInclude? Include { get; 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; } +} - /// Target session identifier. +/// 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; } -/// Canvas action that the agent or host can invoke. To discover the input schema for a particular action, call the list_canvas_capabilities tool. +/// State of the runtime-managed remote-control singleton. +/// Polymorphic base type discriminated by state. [Experimental(Diagnostics.Experimental)] -public sealed class CanvasAction +[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 { - /// Description of the action. - [JsonPropertyName("description")] - public string? Description { get; set; } + /// The type discriminator. + [JsonPropertyName("state")] + public virtual string State { get; set; } = string.Empty; +} - /// 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; +/// Remote control is not connected. +/// The off variant of . +[Experimental(Diagnostics.Experimental)] +public partial class RemoteControlStatusOff : RemoteControlStatus +{ + /// + [JsonIgnore] + public override string State => "off"; } -/// Canvas available in the current session. +/// Remote control is in the middle of initial setup. +/// The connecting variant of . [Experimental(Diagnostics.Experimental)] -public sealed class DiscoveredCanvas +public partial class RemoteControlStatusConnecting : RemoteControlStatus { - /// 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; + /// + [JsonIgnore] + public override string State => "connecting"; - /// 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; + /// Session id the connection is attaching to. + [JsonPropertyName("attachedSessionId")] + public required string AttachedSessionId { get; set; } +} - /// Human-readable canvas name. - [JsonPropertyName("displayName")] - public string DisplayName { get; set; } = string.Empty; +/// 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"; - /// Owning provider identifier. - [JsonPropertyName("extensionId")] - public string ExtensionId { get; set; } = string.Empty; + /// Session id remote control is pointed at. + [JsonPropertyName("attachedSessionId")] + public required string AttachedSessionId { get; set; } - /// Owning extension display name, when available. - [JsonPropertyName("extensionName")] - public string? ExtensionName { 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; } - /// Host-local PNG path for the canvas icon, when supplied. - [JsonPropertyName("icon")] - public string? Icon { get; set; } + /// MC frontend URL for this session, when known. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("frontendUrl")] + public string? FrontendUrl { get; set; } - /// JSON Schema for canvas open input. - [JsonPropertyName("inputSchema")] - public JsonElement? InputSchema { get; set; } + /// Whether the MC session may steer this session. + [JsonPropertyName("isSteerable")] + public required bool IsSteerable { get; set; } } -/// Declared canvases available in this session. +/// The last setup attempt failed. The singleton is otherwise off. +/// The error variant of . [Experimental(Diagnostics.Experimental)] -public sealed class CanvasList +public partial class RemoteControlStatusError : RemoteControlStatus { - /// Declared canvases available in this session. - [JsonPropertyName("canvases")] - public IList Canvases { get => field ??= []; set; } -} + /// + [JsonIgnore] + public override string State => "error"; -/// Identifies the target session. -[Experimental(Diagnostics.Experimental)] -internal sealed class SessionCanvasListRequest -{ - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// 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; } } -/// Open canvas instance snapshot. +/// Wrapper for the singleton's current status. [Experimental(Diagnostics.Experimental)] -public sealed class OpenCanvasInstance +public sealed class RemoteControlStatusResult { - /// Provider-local canvas identifier. - [JsonPropertyName("canvasId")] - public string CanvasId { get; set; } = string.Empty; + /// State of the runtime-managed remote-control singleton. + [JsonPropertyName("status")] + public RemoteControlStatus Status { get => field ??= new(); set; } +} - /// Owning provider identifier. - [JsonPropertyName("extensionId")] - public string ExtensionId { get; set; } = string.Empty; +/// 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; - /// Owning extension display name, when available. - [JsonPropertyName("extensionName")] - public string? ExtensionName { get; set; } + /// Existing MC task ID for the reattached session. + [JsonPropertyName("mcTaskId")] + public string McTaskId { get; set; } = string.Empty; +} - /// Host-local PNG path for the canvas icon, when supplied. - [JsonPropertyName("icon")] - public string? Icon { get; set; } +/// 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; } - /// Input supplied when the instance was opened. - [JsonPropertyName("input")] - public JsonElement? Input { 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; } - /// Stable caller-supplied canvas instance identifier. - [JsonPropertyName("instanceId")] - public string InstanceId { get; set; } = string.Empty; + /// Whether remote export should be enabled. + [JsonPropertyName("remote")] + public bool Remote { get; set; } - /// Provider-supplied status text. - [JsonPropertyName("status")] - public string? Status { get; set; } + /// When true, suppresses timeline messages on successful setup. + [JsonPropertyName("silent")] + public bool Silent { get; set; } - /// Rendered title. - [JsonPropertyName("title")] - public string? Title { get; set; } + /// Whether the MC session may steer the local session (write mode). + [JsonPropertyName("steerable")] + public bool Steerable { get; set; } - /// URL for web-rendered canvases. - [JsonPropertyName("url")] - public string? Url { get; set; } + /// Existing Mission Control task ID to attach the exported session to. + [JsonPropertyName("taskId")] + public string? TaskId { get; set; } } -/// Live open-canvas snapshot. +/// Parameters for attaching the remote-control singleton to a session. [Experimental(Diagnostics.Experimental)] -public sealed class CanvasListOpenResult +internal sealed class SessionsStartRemoteControlRequest { - /// Currently open canvas instances. - [JsonPropertyName("openCanvases")] - public IList OpenCanvases { get => field ??= []; set; } -} + /// Configuration for the runtime-managed remote-control singleton. + [JsonPropertyName("config")] + public RemoteControlConfig Config { get => field ??= new(); set; } -/// Identifies the target session. -[Experimental(Diagnostics.Experimental)] -internal sealed class SessionCanvasListOpenRequest -{ - /// Target session identifier. + /// Local session id to attach remote control to. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } -/// Canvas open parameters. +/// Outcome of a transferRemoteControl call. [Experimental(Diagnostics.Experimental)] -internal sealed class CanvasOpenRequest +public sealed class RemoteControlTransferResult { - /// 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; + /// State of the runtime-managed remote-control singleton. + [JsonPropertyName("status")] + public RemoteControlStatus Status { get => field ??= new(); set; } - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// Whether the rebinding actually happened. + [JsonPropertyName("transferred")] + public bool Transferred { get; set; } } -/// Canvas close parameters. +/// Parameters for atomically rebinding the remote-control singleton. [Experimental(Diagnostics.Experimental)] -internal sealed class CanvasCloseRequest +internal sealed class SessionsTransferRemoteControlRequest { - /// Open canvas instance identifier. - [JsonPropertyName("instanceId")] - public string InstanceId { get; set; } = string.Empty; + /// 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; } - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// Local session id to point remote control at. + [JsonPropertyName("toSessionId")] + public string ToSessionId { get; set; } = string.Empty; } -/// Canvas action invocation result. +/// Patch for the singleton's steering state. [Experimental(Diagnostics.Experimental)] -public sealed class CanvasActionInvokeResult +internal sealed class SessionsSetRemoteControlSteeringRequest { - /// Provider-supplied action result. - [JsonPropertyName("result")] - public JsonElement? Result { get; set; } + /// 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; } } -/// Canvas action invocation parameters. +/// Outcome of a stopRemoteControl call. [Experimental(Diagnostics.Experimental)] -internal sealed class CanvasActionInvokeRequest +public sealed class RemoteControlStopResult { - /// Action name to invoke. - [JsonPropertyName("actionName")] - public string ActionName { get; set; } = string.Empty; + /// State of the runtime-managed remote-control singleton. + [JsonPropertyName("status")] + public RemoteControlStatus Status { get => field ??= new(); set; } - /// Action input. - [JsonPropertyName("input")] - public JsonElement? Input { get; set; } + /// Whether the singleton was actually torn down by this call. + [JsonPropertyName("stopped")] + public bool Stopped { get; set; } +} - /// Open canvas instance identifier. - [JsonPropertyName("instanceId")] - public string InstanceId { get; set; } = string.Empty; +/// 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; } - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// 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; } } -/// Internal canvas provider registration parameters. +/// Handle for releasing the extension tool registration. [Experimental(Diagnostics.Experimental)] -internal sealed class CanvasProviderRegisterRequest +internal sealed class RegisterExtensionToolsResult { - /// 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; +/// Optional registration options. +[Experimental(Diagnostics.Experimental)] +public sealed class SessionsRegisterExtensionToolsOnSessionOptions +{ +} - /// Provider metadata supplied by the host. - [JsonPropertyName("info")] - public JsonElement Info { get; set; } +/// 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; } - /// Target session identifier. + /// Session to register extension tools on. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } -/// Internal canvas provider unregistration parameters. +/// Params to attach or detach an in-process ExtensionController delegate. [Experimental(Diagnostics.Experimental)] -internal sealed class CanvasProviderUnregisterRequest +internal sealed class ConfigureSessionExtensionsParams { - /// Connection identifier to unregister. - [JsonPropertyName("connectionId")] - public string ConnectionId { get; set; } = string.Empty; - - /// Target session identifier. + /// Session to attach the extension controller delegate to. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } -/// Machine-readable factory run failure. -/// Polymorphic base type discriminated by type. +/// Outcome of an agentRegistry.spawn call. +/// Polymorphic base type discriminated by kind. [Experimental(Diagnostics.Experimental)] [JsonPolymorphic( - TypeDiscriminatorPropertyName = "type", + TypeDiscriminatorPropertyName = "kind", 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")] -public partial class FactoryRunFailure +[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("type")] - public virtual string Type { get; set; } = string.Empty; + [JsonPropertyName("kind")] + public virtual string Kind { get; set; } = string.Empty; } -/// The factory_limit_reached variant of . +/// 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 partial class FactoryRunFailureFactoryLimitReached : FactoryRunFailure +public sealed class AgentRegistryLiveTargetEntry { - /// - [JsonIgnore] - public override string Type => "factory_limit_reached"; - - /// Resource ceiling that stopped the run. - [JsonPropertyName("kind")] - public required FactoryRunFailureKind Kind { get; set; } + /// Kind of attention required when status === "attention". Meaningful only when status === "attention". + [JsonPropertyName("attentionKind")] + public AgentRegistryLiveTargetEntryAttentionKind? AttentionKind { get; set; } - /// Factory run identifier. - [JsonPropertyName("runId")] - public required string RunId { get; set; } + /// Git branch of the session (when known). + [JsonPropertyName("branch")] + public string? Branch { get; set; } - /// Approved effective ceiling that was reached. - [JsonPropertyName("value")] - public required double Value { 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; } } -/// The factory_resume_declined variant of . +/// Per-spawn log-capture outcome; populated from spawnLiveTarget. [Experimental(Diagnostics.Experimental)] -public partial class FactoryRunFailureFactoryResumeDeclined : FactoryRunFailure +public sealed class AgentRegistryLogCapture { - /// - [JsonIgnore] - public override string Type => "factory_resume_declined"; + /// Whether per-spawn log capture is on (false when env-disabled or open failed). + [JsonPropertyName("enabled")] + public bool Enabled { get; set; } - /// Human-readable reason the resume did not proceed. - [JsonPropertyName("reason")] - public required string Reason { 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; } - /// Factory run identifier whose changed limits were declined. - [JsonPropertyName("runId")] - public required string RunId { 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; } } -/// The factory_durable_failure variant of . +/// Managed-server child was spawned and registered successfully. +/// The spawned variant of . [Experimental(Diagnostics.Experimental)] -public partial class FactoryRunFailureFactoryDurableFailure : FactoryRunFailure +public partial class AgentRegistrySpawnResultSpawned : AgentRegistrySpawnResult { /// [JsonIgnore] - public override string Type => "factory_durable_failure"; + public override string Kind => "spawned"; - /// Stable failure code. - [JsonPropertyName("code")] - public required string Code { get; set; } + /// 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; } - /// Execution-critical durable operation that failed. - [JsonPropertyName("operation")] - public required FactoryDurableOperation Operation { 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; } - /// Factory run identifier. - [JsonPropertyName("runId")] - public required string RunId { 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; } } -/// The run stopped because its usage accounting could not be completed. -/// The factory_accounting_incomplete variant of . +/// `child_process.spawn` itself failed before the child entered the registry. +/// The spawn-error variant of . [Experimental(Diagnostics.Experimental)] -public partial class FactoryRunFailureFactoryAccountingIncomplete : FactoryRunFailure +public partial class AgentRegistrySpawnResultSpawnError : AgentRegistrySpawnResult { /// [JsonIgnore] - public override string Type => "factory_accounting_incomplete"; + public override string Kind => "spawn-error"; - /// Confirmed usage in nano-AIU, representing the floor of what the run spent. - [JsonPropertyName("drainedNanoAiu")] - public required long DrainedNanoAiu { get; set; } + /// Underlying errno code (e.g. ENOENT, EACCES) when available. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("code")] + public string? Code { get; set; } - /// Factory run identifier. - [JsonPropertyName("runId")] - public required string RunId { get; set; } + /// Human-readable error message. + [JsonPropertyName("message")] + public required string Message { get; set; } } -/// Complete current or terminal factory run envelope. +/// 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 sealed class FactoryRunResult +public partial class AgentRegistrySpawnResultRegistryTimeout : AgentRegistrySpawnResult { - /// Error message for an errored run. - [JsonPropertyName("error")] - public string? Error { get; set; } + /// + [JsonIgnore] + public override string Kind => "registry-timeout"; - /// Machine-readable failure details for an errored run. - [JsonPropertyName("failure")] - public FactoryRunFailure? Failure { get; set; } + /// Process ID of the orphaned child (so the caller can offer 'kill the pid' guidance). + [JsonPropertyName("childPid")] + public required long ChildPid { get; set; } - /// Reason for a halted or cancelled run. - [JsonPropertyName("reason")] - public string? Reason { get; set; } + /// Per-spawn log-capture outcome; populated from spawnLiveTarget. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("logCapture")] + public AgentRegistryLogCapture? LogCapture { get; set; } +} - /// Completed factory result. - [JsonPropertyName("result")] - public JsonElement? Result { 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"; - /// Factory run identifier. - [JsonPropertyName("runId")] - public string RunId { get; set; } = string.Empty; + /// Which parameter field was invalid. Omitted when the rejection is not field-specific. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("field")] + public AgentRegistrySpawnValidationErrorField? Field { get; set; } - /// Partial journal and progress snapshot for a halted, cancelled, or errored run. - [JsonPropertyName("snapshot")] - public JsonElement? Snapshot { 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; } - /// Current or terminal factory run status. - [JsonPropertyName("status")] - public FactoryRunStatus Status { 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; } } -/// Wire-only per-invocation factory resource ceiling overrides. +/// Inputs to spawn a managed-server child via the controller's spawn delegate. [Experimental(Diagnostics.Experimental)] -public sealed class FactoryRunLimits +internal sealed class AgentRegistrySpawnRequest { - /// 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; } + /// Custom or built-in agent name (e.g. 'explore'). When omitted, the child uses its own default. + [JsonPropertyName("agentName")] + public string? AgentName { get; set; } - /// Maximum number of factory subagents that may run concurrently. - [JsonPropertyName("maxConcurrentSubagents")] - public long? MaxConcurrentSubagents { get; set; } + /// Working directory for the spawned child (must be an existing directory). + [JsonPropertyName("cwd")] + public string Cwd { get; set; } = string.Empty; - /// Maximum total number of factory subagents that may be admitted. - [JsonPropertyName("maxTotalSubagents")] - public long? MaxTotalSubagents { get; set; } + /// 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; } - /// 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; } -} + /// Model identifier to apply to the new session. + [JsonPropertyName("model")] + public string? Model { 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; } + /// 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; } - /// Run identifier whose journal and progress should seed this resumed run. - [JsonPropertyName("resumeFromRunId")] - public string? ResumeFromRunId { 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; } } -/// Parameters for invoking a registered factory. +/// Identifies the target session. [Experimental(Diagnostics.Experimental)] -internal sealed class FactoryRunRequest +internal sealed class SessionSuspendRequest { - /// 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. +/// Result of sending a user message. [Experimental(Diagnostics.Experimental)] -public sealed class FactoryResumeResult +public sealed class SendResult { - /// 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; } + /// Unique identifier assigned to the message. + [JsonPropertyName("messageId")] + public string MessageId { get; set; } = string.Empty; } -/// Parameters for resuming a factory run from its persisted identity. +/// Parameters for sending a user message to the session. [Experimental(Diagnostics.Experimental)] -internal sealed class FactoryResumeRequest +internal sealed class SendRequest { - /// Optional per-invocation resource ceiling overrides. - [JsonPropertyName("limits")] - public FactoryRunLimits? Limits { get; set; } + /// 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; } - /// Factory run identifier. - [JsonPropertyName("runId")] - public string RunId { get; set; } = string.Empty; + /// 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; } } -/// Parameters for retrieving a factory run. +/// Result of sending zero or more user messages. [Experimental(Diagnostics.Experimental)] -internal sealed class FactoryGetRunRequest +public sealed class SendMessagesResult { - /// Factory run identifier. - [JsonPropertyName("runId")] - public string RunId { get; set; } = string.Empty; - - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// 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; } } -/// Declared or approved factory resource ceilings. +/// A single user message to append to the session as part of a `session.sendMessages` turn. [Experimental(Diagnostics.Experimental)] -public sealed class FactoryDeclaredLimits +public sealed class SendMessageItem { - /// Maximum AI credits consumed by subagents and descendants. - [JsonPropertyName("maxAiCredits")] - public double? MaxAiCredits { get; set; } + /// Optional attachments (files, directories, selections, blobs, GitHub references) to include with this message. + [JsonPropertyName("attachments")] + public IList? Attachments { get; set; } - /// Maximum concurrently active subagents. - [JsonPropertyName("maxConcurrentSubagents")] - public long? MaxConcurrentSubagents { 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; } - /// Maximum total subagents spawned by the run. - [JsonPropertyName("maxTotalSubagents")] - public long? MaxTotalSubagents { get; set; } + /// If provided, this is shown in the timeline instead of `prompt`. + [JsonPropertyName("displayPrompt")] + public string? DisplayPrompt { get; set; } - /// Maximum accumulated active execution time in seconds. - [JsonPropertyName("timeoutSeconds")] - public double? TimeoutSeconds { 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; } } -/// Durable factory resource consumption. +/// 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)] -public sealed class FactoryRunConsumed +internal sealed class SendMessagesRequest { - /// Accumulated active execution time in milliseconds. - [JsonPropertyName("activeMs")] - public long ActiveMs { get; set; } + /// 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; } - /// AI usage consumed by the run in nano-AIU. - [JsonPropertyName("nanoAiu")] - public long NanoAiu { 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; } - /// Total subagents spawned by the run. - [JsonPropertyName("subagents")] - public long Subagents { get; 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; } } -/// Current factory phase identity. +/// Internal request for sending a system notification. [Experimental(Diagnostics.Experimental)] -public sealed class FactoryCurrentPhase +internal sealed class SendSystemNotificationRequest { - /// Current phase identifier. - [JsonPropertyName("id")] - public string Id { get; set; } = string.Empty; + /// Optional structured notification kind. + [JsonPropertyName("kind")] + public JsonElement? Kind { get; set; } - /// Zero-based declared phase ordinal, or null for an undeclared phase. - [JsonPropertyName("ordinal")] - public long? Ordinal { 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; } -/// Prompt-safe terminal factory outcome. +/// Result of aborting the current turn. [Experimental(Diagnostics.Experimental)] -public sealed class FactoryRunTerminal +public sealed class AbortResult { - /// Human-readable terminal error. + /// Error message if the abort failed. [JsonPropertyName("error")] public string? Error { get; set; } - /// Machine-readable terminal failure. - [JsonPropertyName("failure")] - public FactoryRunFailure? Failure { get; set; } + /// Whether the abort completed successfully. + [JsonPropertyName("success")] + public bool Success { get; set; } +} - /// Human-readable terminal reason. +/// 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 string? Reason { get; set; } + public AbortReason? Reason { get; set; } - /// Prompt-safe preview of the completed result. - [JsonPropertyName("resultPreview")] - public string? ResultPreview { get; set; } + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; } -/// Durable factory run summary with read-time live overlays. +/// Result of interrupting the main agent turn. [Experimental(Diagnostics.Experimental)] -public sealed class FactoryRunSummary +public sealed class InterruptMainTurnResult { - /// 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; } - - /// Epoch milliseconds when the run completed, or null while nonterminal. - [JsonPropertyName("completedAt")] - public long? CompletedAt { get; set; } + /// Whether an in-flight main agent turn was interrupted. False when the main loop was not processing. + [JsonPropertyName("interrupted")] + public bool Interrupted { 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; } +/// 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; } - /// Resource ceilings declared by the factory. - [JsonPropertyName("declaredLimits")] - public FactoryDeclaredLimits DeclaredLimits { get => field ??= new(); set; } + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} - /// Number of phases declared by the factory. - [JsonPropertyName("declaredPhaseCount")] - public long DeclaredPhaseCount { get; set; } +/// Identifies the target session. +[Experimental(Diagnostics.Experimental)] +internal sealed class SessionCancelAllBackgroundAgentsRequest +{ + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} - /// Human-readable factory description. - [JsonPropertyName("description")] - public string Description { 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; } - /// Registered factory name. - [JsonPropertyName("factoryName")] - public string FactoryName { get; set; } = string.Empty; + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; - /// Number of direct factory agents currently live. - [JsonPropertyName("liveAgentCount")] - public long LiveAgentCount { get; set; } + /// Why the session is being shut down. Defaults to "routine" when omitted. + [JsonPropertyName("type")] + public ShutdownType? Type { get; set; } +} - /// Epoch milliseconds when this live-overlay snapshot was observed. - [JsonPropertyName("observedAt")] - public long ObservedAt { 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; } +} - /// Monotonic durable run revision. - [JsonPropertyName("revision")] - public long Revision { 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; } - /// Factory run identifier. - [JsonPropertyName("runId")] - public string RunId { get; set; } = string.Empty; + /// Log severity level. Determines how the message is displayed in the timeline. Defaults to "info". + [JsonPropertyName("level")] + public SessionLogLevel? Level { get; set; } - /// Epoch milliseconds when execution first started, or null before start. - [JsonPropertyName("startedAt")] - public long? StartedAt { get; set; } + /// Human-readable message. + [JsonPropertyName("message")] + public string Message { get; set; } = string.Empty; - /// Current factory run status. - [JsonPropertyName("status")] - public FactoryRunStatus Status { get; set; } + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; - /// Terminal run outcome, or null while nonterminal. - [JsonPropertyName("terminal")] - public FactoryRunTerminal? Terminal { get; set; } + /// Optional actionable tip displayed alongside the message. Only honored on `level: "info"`. + [JsonPropertyName("tip")] + public string? Tip { get; set; } - /// Total direct factory agents spawned across all attempts. - [JsonPropertyName("totalSpawnedAgentCount")] - public long TotalSpawnedAgentCount { 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; } - /// Epoch milliseconds when the durable run was last updated. - [JsonPropertyName("updatedAt")] - public long UpdatedAt { 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; } } -/// A page of factory runs in durable creation order. +/// Authentication status and account metadata for the session. [Experimental(Diagnostics.Experimental)] -public sealed class FactoryListRunsResult +public sealed class SessionAuthStatus { - /// Whether terminal runs newer than this page exist. - [JsonPropertyName("hasMoreNewer")] - public bool? HasMoreNewer { get; set; } + /// Authentication type. + [JsonPropertyName("authType")] + public AuthInfoType? AuthType { get; set; } - /// Newest terminal-run cursor in this page, or null when the terminal window is empty. - [JsonPropertyName("newestSeq")] - public long? NewestSeq { get; set; } + /// Copilot plan tier (e.g., individual_pro, business). + [JsonPropertyName("copilotPlan")] + public string? CopilotPlan { get; set; } - /// Oldest terminal-run cursor in this page, or null when the terminal window is empty. - [JsonPropertyName("oldestSeq")] - public long? OldestSeq { get; set; } + /// Authentication host URL. + [Url] + [StringSyntax(StringSyntaxAttribute.Uri)] + [JsonPropertyName("host")] + public string? Host { get; set; } - /// Number of terminal runs older than this page. - [JsonPropertyName("omittedOlder")] - public long? OmittedOlder { get; set; } + /// Whether the session has resolved authentication. + [JsonPropertyName("isAuthenticated")] + public bool IsAuthenticated { get; set; } - /// Factory run summaries in durable creation order. - [JsonPropertyName("runs")] - public IList Runs { get => field ??= []; 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; } } -/// Parameters for paging factory runs. +/// Identifies the target session. [Experimental(Diagnostics.Experimental)] -internal sealed class FactoryListRunsRequest +internal sealed class SessionGitHubAuthGetStatusRequest { - /// 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. +/// Indicates whether the credential update succeeded. [Experimental(Diagnostics.Experimental)] -public sealed class FactoryAgentSummary +public sealed class SessionSetCredentialsResult { - /// Accumulated active agent time in milliseconds. - [JsonPropertyName("activeMs")] - public long ActiveMs { get; set; } + /// 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; } - /// Prompt-safe live activity text. - [JsonPropertyName("activity")] - public string? Activity { get; set; } + /// Whether the operation succeeded. + [JsonPropertyName("success")] + public bool Success { get; set; } +} - /// Stable direct-agent identifier. - [JsonPropertyName("agentId")] - public string AgentId { get; set; } = string.Empty; +/// 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 AuthInfo? Credentials { get; set; } - /// Registered agent type. - [JsonPropertyName("agentType")] - public string AgentType { get; set; } = string.Empty; + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} - /// Epoch milliseconds when the agent completed. - [JsonPropertyName("completedAt")] - public long? CompletedAt { get; set; } +/// 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; } - /// Friendly, non-unique name intended for display. - [JsonPropertyName("displayName")] - public string? DisplayName { get; set; } + /// Name of the environment variable that supplied the credential, when applicable. + [JsonPropertyName("envVar")] + public string? EnvVar { get; set; } - /// Friendly, non-unique name intended for display. - [JsonPropertyName("label")] - public string Label { get; set; } = string.Empty; + /// Authentication host. + [JsonPropertyName("host")] + public string Host { get; set; } = string.Empty; - /// Phase identifier active when the agent was launched, or null. - [JsonPropertyName("phaseId")] - public string? PhaseId { get; set; } + /// Authenticated login, when available. + [JsonPropertyName("login")] + public string? Login { get; set; } - /// Model requested when the agent was launched. - [JsonPropertyName("requestedModel")] - public string? RequestedModel { get; set; } + /// Authentication type. + [JsonPropertyName("type")] + public AuthInfoType Type { get; set; } +} - /// Concrete model resolved for the agent. - [JsonPropertyName("resolvedModel")] - public string? ResolvedModel { 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; +} - /// 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; +/// Identifies the target session. +[Experimental(Diagnostics.Experimental)] +internal sealed class SessionGitHubAuthGetAllAuthAvailableRequest +{ + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; } -/// Durable lifecycle and timing for one factory phase. +/// Identifies the target session. [Experimental(Diagnostics.Experimental)] -public sealed class FactoryPhaseObservation +internal sealed class SessionGitHubAuthRefreshCopilotUserRequest { - /// 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; } + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} - /// Current live active time for this phase in milliseconds. - [JsonPropertyName("currentActiveMs")] - public long CurrentActiveMs { get; set; } +/// Internal GitHub login parameters. +[Experimental(Diagnostics.Experimental)] +internal sealed class SessionAuthLoginRequest +{ + /// GitHub host URL. + [JsonPropertyName("host")] + public string Host { get; set; } = string.Empty; - /// Optional human-readable phase detail. - [JsonPropertyName("detail")] - public string? Detail { get; set; } + /// GitHub login. + [JsonPropertyName("login")] + public string Login { get; set; } = string.Empty; - /// Number of times execution entered this phase. - [JsonPropertyName("entryCount")] - public long EntryCount { get; set; } + /// Whether to persist the token after login. + [JsonPropertyName("persist")] + public bool? Persist { get; set; } - /// Phase identifier. - [JsonPropertyName("id")] - public string Id { get; set; } = string.Empty; + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { 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; } + /// GitHub authentication token. + [JsonPropertyName("token")] + public string Token { get; set; } = string.Empty; +} - /// Direct agents in this phase that are currently live. - [JsonPropertyName("liveAgentCount")] - public long LiveAgentCount { get; set; } +/// 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; } - /// Zero-based declared phase ordinal, or null for an undeclared phase. - [JsonPropertyName("ordinal")] - public long? Ordinal { get; set; } + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; - /// 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; } + /// Optional token paired with the authentication information. + [JsonPropertyName("token")] + public string? Token { get; set; } +} - /// Derived lifecycle state of the phase. - [JsonPropertyName("status")] - public FactoryPhaseStatus Status { 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; +} - /// Human-readable phase title. - [JsonPropertyName("title")] - public string Title { 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; } - /// Total direct agents associated with this phase. - [JsonPropertyName("totalAgentCount")] - public long TotalAgentCount { get; set; } + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; } -/// One durable factory progress record. +/// Validation error from an authentication attempt. [Experimental(Diagnostics.Experimental)] -public sealed class FactoryProgressLine +public sealed class AuthValidationError { - /// Resume attempt that emitted this record. - [JsonPropertyName("attempt")] - public long Attempt { get; set; } + /// Optional message returned by GitHub. + [JsonPropertyName("githubMessage")] + public string? GitHubMessage { get; set; } - /// Progress record kind. - [JsonPropertyName("kind")] - public FactoryLogLineKind Kind { get; set; } + /// Authentication validation error message. + [JsonPropertyName("message")] + public string Message { get; set; } = string.Empty; +} - /// Phase active when the record was emitted, or null before any phase. - [JsonPropertyName("phaseId")] - public string? PhaseId { get; set; } +/// Identifies the target session. +[Experimental(Diagnostics.Experimental)] +internal sealed class SessionGitHubAuthLastAuthErrorsRequest +{ + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} - /// Epoch milliseconds when the record was persisted. - [JsonPropertyName("recordedAt")] - public long RecordedAt { get; set; } +/// 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; - /// Global monotonic sequence number within the run. - [JsonPropertyName("seq")] - public long Seq { get; set; } + /// Redacted output size in bytes. + [JsonPropertyName("sizeBytes")] + public long SizeBytes { get; set; } - /// Prompt-safe progress text. - [JsonPropertyName("text")] - public string Text { get; set; } = string.Empty; + /// Source category for this entry. + [JsonPropertyName("source")] + public DebugCollectLogsSource Source { get; set; } } -/// A bidirectional page of factory progress. +/// An optional debug bundle entry that could not be included. [Experimental(Diagnostics.Experimental)] -public sealed class FactoryProgressPage +public sealed class DebugCollectLogsSkippedEntry { - /// Whether progress records newer than this page exist. - [JsonPropertyName("hasMoreNewer")] - public bool HasMoreNewer { get; set; } + /// Relative path requested for this bundle entry. + [JsonPropertyName("bundlePath")] + public string BundlePath { get; set; } = string.Empty; - /// Whether progress records older than this page exist. - [JsonPropertyName("hasMoreOlder")] - public bool HasMoreOlder { get; set; } + /// Server-local source path that could not be read. + [JsonPropertyName("path")] + public string? Path { get; set; } - /// Newest sequence number in this page, or null when empty. - [JsonPropertyName("newestSeq")] - public long? NewestSeq { get; set; } + /// Reason the entry was skipped. + [JsonPropertyName("reason")] + public string Reason { get; set; } = string.Empty; +} - /// Oldest sequence number in this page, or null when empty. - [JsonPropertyName("oldestSeq")] - public long? OldestSeq { get; set; } +/// 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; } - /// Progress records in sequence order. - [JsonPropertyName("records")] - public IList Records { get => field ??= []; set; } + /// Destination kind that was written. + [JsonPropertyName("kind")] + public DebugCollectLogsResultKind Kind { get; set; } - /// Run revision reflected by this page. - [JsonPropertyName("revision")] - public long Revision { 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; } } -/// Full factory run observability detail. +/// A caller-provided server-local file or directory to include in the debug bundle. [Experimental(Diagnostics.Experimental)] -public sealed class FactoryRunDetail +public sealed class DebugCollectLogsEntry { - /// Epoch milliseconds when the current active segment started, or null while inactive. - [JsonPropertyName("activeSegmentStartedAt")] - public long? ActiveSegmentStartedAt { get; set; } + /// Relative path to use inside the staged bundle/archive. + [JsonPropertyName("bundlePath")] + public string BundlePath { get; set; } = string.Empty; - /// Durable identities and live statuses for direct factory agents. - [JsonPropertyName("agents")] - public IList Agents { get => field ??= []; set; } + /// Kind of source path to include. + [JsonPropertyName("kind")] + public DebugCollectLogsEntryKind Kind { get; set; } - /// Approved effective resource ceilings, or null until approved. - [JsonPropertyName("approved")] - public FactoryDeclaredLimits? Approved { get; set; } + /// Server-local source path to read. + [JsonPropertyName("path")] + public string Path { get; set; } = string.Empty; - /// Epoch milliseconds when the run completed, or null while nonterminal. - [JsonPropertyName("completedAt")] - public long? CompletedAt { get; set; } + /// How text content from this entry should be redacted. Defaults to plain-text. + [JsonPropertyName("redaction")] + public DebugCollectLogsRedaction? Redaction { get; set; } - /// Durable resource consumption. - [JsonPropertyName("consumed")] - public FactoryRunConsumed Consumed { get => field ??= new(); 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; } +} - /// 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; } +/// 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; +} - /// 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; +/// The archive variant of . +[Experimental(Diagnostics.Experimental)] +public partial class DebugCollectLogsDestinationArchive : DebugCollectLogsDestination +{ + /// + [JsonIgnore] + public override string Kind => "archive"; - /// Number of direct factory agents currently live. - [JsonPropertyName("liveAgentCount")] - public long LiveAgentCount { get; set; } + /// 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; } - /// Epoch milliseconds when this live-overlay snapshot was observed. - [JsonPropertyName("observedAt")] - public long ObservedAt { get; set; } + /// Absolute or server-relative path for the .tgz archive to create. + [JsonPropertyName("outputPath")] + public required string OutputPath { get; set; } +} - /// Lifecycle and timing observations for each factory phase. - [JsonPropertyName("phases")] - public IList Phases { get => field ??= []; set; } +/// The directory variant of . +[Experimental(Diagnostics.Experimental)] +public partial class DebugCollectLogsDestinationDirectory : DebugCollectLogsDestination +{ + /// + [JsonIgnore] + public override string Kind => "directory"; - /// Bidirectional page of durable factory progress. - [JsonPropertyName("progress")] - public FactoryProgressPage Progress { get => field ??= new(); set; } + /// Directory where redacted files should be staged. The directory is created if needed. + [JsonPropertyName("outputDirectory")] + public required string OutputDirectory { get; set; } +} - /// Monotonic durable run revision. - [JsonPropertyName("revision")] - public long Revision { 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; } - /// Factory run identifier. - [JsonPropertyName("runId")] - public string RunId { get; set; } = string.Empty; + /// Include the session event log (`events.jsonl`). Defaults to true. + [JsonPropertyName("events")] + public bool? Events { get; set; } - /// Epoch milliseconds when execution first started, or null before start. - [JsonPropertyName("startedAt")] - public long? StartedAt { 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; } - /// Current factory run status. - [JsonPropertyName("status")] - public FactoryRunStatus Status { get; set; } + /// Maximum number of previous process logs to include. Defaults to 5. + [JsonPropertyName("previousProcessLogLimit")] + public long? PreviousProcessLogLimit { get; set; } - /// Terminal run outcome, or null while nonterminal. - [JsonPropertyName("terminal")] - public FactoryRunTerminal? Terminal { 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; } - /// Total direct factory agents spawned across all attempts. - [JsonPropertyName("totalSpawnedAgentCount")] - public long TotalSpawnedAgentCount { get; set; } + /// Include process logs for the session. Defaults to true. + [JsonPropertyName("processLogs")] + public bool? ProcessLogs { get; set; } - /// Epoch milliseconds when the durable run was last updated. - [JsonPropertyName("updatedAt")] - public long UpdatedAt { get; set; } + /// Include interactive shell logs written under the session's `shell-logs` directory. Defaults to true. + [JsonPropertyName("shellLogs")] + public bool? ShellLogs { get; set; } } -/// Parameters for paging factory progress. +/// Options for collecting a redacted session debug bundle. [Experimental(Diagnostics.Experimental)] -internal sealed class FactoryGetRunProgressRequest +internal sealed class DebugCollectLogsRequest { - /// 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; } + /// 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; } - /// Optional phase identifier used to scope records and cursors. - [JsonPropertyName("phaseId")] - public string? PhaseId { 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; } - /// Factory run identifier. - [JsonPropertyName("runId")] - public string RunId { get; set; } = string.Empty; + /// 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; } -/// Parameters for cancelling a factory run. +/// 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)] -internal sealed class FactoryCancelRequest +public sealed class CanvasAction { - /// Factory run identifier. - [JsonPropertyName("runId")] - public string RunId { get; set; } = string.Empty; + /// Description of the action. + [JsonPropertyName("description")] + public string? Description { get; set; } - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; -} + /// JSON Schema for the action input. + [JsonPropertyName("inputSchema")] + public JsonElement? InputSchema { get; set; } -/// Acknowledgement that a factory request was accepted. -[Experimental(Diagnostics.Experimental)] -public sealed class FactoryAckResult -{ + /// Action name exposed by the canvas provider. + [JsonPropertyName("name")] + public string Name { get; set; } = string.Empty; } -/// One ordered factory progress line. +/// Canvas available in the current session. [Experimental(Diagnostics.Experimental)] -public sealed class FactoryLogLine +public sealed class DiscoveredCanvas { - /// Progress line kind. - [JsonPropertyName("kind")] - public FactoryLogLineKind Kind { get; set; } + /// Actions the agent or host may invoke on an open instance. + [JsonPropertyName("actions")] + public IList? Actions { get; set; } - /// Monotonic sequence number within the factory run. - [JsonPropertyName("seq")] - public long Seq { get; set; } + /// Provider-local canvas identifier. + [JsonPropertyName("canvasId")] + public string CanvasId { get; set; } = string.Empty; - /// Progress text. - [JsonPropertyName("text")] - public string Text { 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; -/// 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; + /// Human-readable canvas name. + [JsonPropertyName("displayName")] + public string DisplayName { get; set; } = string.Empty; - /// Ordered progress lines to append. - [JsonPropertyName("lines")] - public IList Lines { get => field ??= []; set; } + /// Owning provider identifier. + [JsonPropertyName("extensionId")] + public string ExtensionId { get; set; } = string.Empty; - /// Factory run identifier. - [JsonPropertyName("runId")] - public string RunId { get; set; } = string.Empty; + /// Owning extension display name, when available. + [JsonPropertyName("extensionName")] + public string? ExtensionName { get; set; } - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// 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; } } -/// Result of one factory-scoped subagent call. +/// Declared canvases available in this session. [Experimental(Diagnostics.Experimental)] -public sealed class FactoryAgentResult +public sealed class CanvasList { - /// Agent result, omitted when the agent produced no result. - [JsonPropertyName("result")] - public JsonElement? Result { get; set; } + /// Declared canvases available in this session. + [JsonPropertyName("canvases")] + public IList Canvases { get => field ??= []; set; } } -/// Options for one factory-scoped subagent call. +/// Identifies the target session. [Experimental(Diagnostics.Experimental)] -public sealed class FactoryAgentOptions +internal sealed class SessionCanvasListRequest { - /// Optional custom agent name for the subagent. This field is accepted but not yet honored. - [JsonPropertyName("agent")] - public string? Agent { get; set; } - - /// Optional context tier for the subagent. This field is accepted but not yet honored. - [JsonPropertyName("contextTier")] - public ContextTier? ContextTier { get; set; } + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} - /// Optional label distinguishing otherwise identical memoized agent calls. - [JsonPropertyName("label")] - public string? Label { get; set; } +/// Open canvas instance snapshot. +[Experimental(Diagnostics.Experimental)] +public sealed class OpenCanvasInstance +{ + /// Provider-local canvas identifier. + [JsonPropertyName("canvasId")] + public string CanvasId { get; set; } = string.Empty; - /// Optional model identifier for the subagent. - [JsonPropertyName("model")] - public string? Model { get; set; } + /// Owning provider identifier. + [JsonPropertyName("extensionId")] + public string ExtensionId { get; set; } = string.Empty; - /// Optional reasoning effort for the subagent. This field is accepted but not yet honored. - [JsonPropertyName("reasoningEffort")] - public string? ReasoningEffort { get; set; } + /// Owning extension display name, when available. + [JsonPropertyName("extensionName")] + public string? ExtensionName { get; set; } - /// Optional JSON Schema for structured agent output. - [JsonPropertyName("schema")] - public JsonElement? Schema { get; set; } -} + /// Host-local PNG path for the canvas icon, when supplied. + [JsonPropertyName("icon")] + public string? Icon { 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; + /// Input supplied when the instance was opened. + [JsonPropertyName("input")] + public JsonElement? Input { get; set; } - /// Factory run identifier that owns the subagent. - [JsonPropertyName("factoryRunId")] - public string FactoryRunId { get; set; } = string.Empty; + /// Stable caller-supplied canvas instance identifier. + [JsonPropertyName("instanceId")] + public string InstanceId { get; set; } = string.Empty; - /// Subagent execution options. - [JsonPropertyName("opts")] - public FactoryAgentOptions Opts { get => field ??= new(); set; } + /// Provider-supplied status text. + [JsonPropertyName("status")] + public string? Status { get; set; } - /// Prompt to send to the subagent. - [JsonPropertyName("prompt")] - public string Prompt { get; set; } = string.Empty; + /// Rendered title. + [JsonPropertyName("title")] + public string? Title { get; set; } - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// URL for web-rendered canvases. + [JsonPropertyName("url")] + public string? Url { get; set; } } -/// Result of reading a factory journal entry. +/// Live open-canvas snapshot. [Experimental(Diagnostics.Experimental)] -public sealed class FactoryJournalGetResult +public sealed class CanvasListOpenResult { - /// 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; } + /// Currently open canvas instances. + [JsonPropertyName("openCanvases")] + public IList OpenCanvases { get => field ??= []; set; } } -/// Parameters for reading a factory journal entry. +/// Identifies the target session. [Experimental(Diagnostics.Experimental)] -internal sealed class FactoryJournalGetRequest +internal sealed class SessionCanvasListOpenRequest { - /// 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. +/// Canvas open parameters. [Experimental(Diagnostics.Experimental)] -internal sealed class FactoryJournalPutRequest +internal sealed class CanvasOpenRequest { - /// Opaque token identifying the current factory execution attempt. - [JsonPropertyName("executionToken")] - public string ExecutionToken { get; set; } = string.Empty; + /// Provider-local canvas identifier. + [JsonPropertyName("canvasId")] + public string CanvasId { get; set; } = string.Empty; - /// Namespaced journal key. - [JsonPropertyName("key")] - public string Key { 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; } - /// JSON result to memoize. - [JsonPropertyName("resultJson")] - public JsonElement ResultJson { get; set; } + /// Canvas open input. + [JsonPropertyName("input")] + public JsonElement? Input { get; set; } - /// Factory run identifier. - [JsonPropertyName("runId")] - public string RunId { get; set; } = string.Empty; + /// 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; } -/// The currently selected model, reasoning effort, and context tier for the session. The context tier reflects `Session.getContextTier()`, restored from the session journal on resume. +/// Canvas close parameters. [Experimental(Diagnostics.Experimental)] -public sealed class CurrentModel +internal sealed class CanvasCloseRequest { - /// 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; } - - /// 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; } -} + /// Open canvas instance identifier. + [JsonPropertyName("instanceId")] + public string InstanceId { get; set; } = string.Empty; -/// 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. +/// Canvas action invocation result. [Experimental(Diagnostics.Experimental)] -public sealed class ModelSwitchConfirmation +public sealed class CanvasActionInvokeResult { - /// 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; + /// Provider-supplied action result. + [JsonPropertyName("result")] + public JsonElement? Result { get; set; } } -/// The model identifier active on the session after the switch. +/// Canvas action invocation parameters. [Experimental(Diagnostics.Experimental)] -public sealed class ModelSwitchToResult +internal sealed class CanvasActionInvokeRequest { - /// 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; } + /// Action name to invoke. + [JsonPropertyName("actionName")] + public string ActionName { get; set; } = string.Empty; - /// Persistence failure encountered after applying the model switch. - [JsonPropertyName("persistenceError")] - public string? PersistenceError { get; set; } + /// Action input. + [JsonPropertyName("input")] + public JsonElement? Input { get; set; } - /// Lifecycle result for the requested switch. - [JsonPropertyName("status")] - public string? Status { get; set; } + /// Open canvas instance identifier. + [JsonPropertyName("instanceId")] + public string InstanceId { get; set; } = string.Empty; - /// User-facing warning produced while applying the model switch. - [JsonPropertyName("warning")] - public string? Warning { get; set; } + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; } -/// Vision-specific limits. +/// Internal canvas provider registration parameters. [Experimental(Diagnostics.Experimental)] -public sealed class ModelCapabilitiesOverrideLimitsVision +internal sealed class CanvasProviderRegisterRequest { - /// Maximum image size in bytes. - [JsonPropertyName("max_prompt_image_size")] - public long? MaxPromptImageSize { get; set; } + /// Canvas contributions supplied by the provider. + [JsonPropertyName("canvases")] + public IList Canvases { get => field ??= []; set; } - /// Maximum number of images per prompt. - [JsonPropertyName("max_prompt_images")] - public long? MaxPromptImages { get; set; } + /// Connection identifier for callback routing. + [JsonPropertyName("connectionId")] + public string ConnectionId { get; set; } = string.Empty; - /// MIME types the model accepts. - [JsonPropertyName("supported_media_types")] - public IList? SupportedMediaTypes { get; set; } + /// 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; } -/// Token limits for prompts, outputs, and context window. +/// Internal canvas provider unregistration parameters. [Experimental(Diagnostics.Experimental)] -public sealed class ModelCapabilitiesOverrideLimits +internal sealed class CanvasProviderUnregisterRequest { - /// 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; } + /// Connection identifier to unregister. + [JsonPropertyName("connectionId")] + public string ConnectionId { get; set; } = string.Empty; - /// Vision-specific limits. - [JsonPropertyName("vision")] - public ModelCapabilitiesOverrideLimitsVision? Vision { get; set; } + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; } -/// Feature flags indicating what the model supports. +/// Machine-readable factory run failure. +/// Polymorphic base type discriminated by type. [Experimental(Diagnostics.Experimental)] -public sealed class ModelCapabilitiesOverrideSupports +[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")] +public partial class FactoryRunFailure { - /// 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; } + /// The type discriminator. + [JsonPropertyName("type")] + public virtual string Type { get; set; } = string.Empty; } -/// Optional capability overrides (vision, tool_calls, reasoning, etc.). + +/// The factory_limit_reached variant of . [Experimental(Diagnostics.Experimental)] -public sealed class ModelCapabilitiesOverride +public partial class FactoryRunFailureFactoryLimitReached : FactoryRunFailure { - /// Token limits for prompts, outputs, and context window. - [JsonPropertyName("limits")] - public ModelCapabilitiesOverrideLimits? Limits { get; set; } + /// + [JsonIgnore] + public override string Type => "factory_limit_reached"; - /// Feature flags indicating what the model supports. - [JsonPropertyName("supports")] - public ModelCapabilitiesOverrideSupports? Supports { get; set; } -} + /// Resource ceiling that stopped the run. + [JsonPropertyName("kind")] + public required FactoryRunFailureKind Kind { get; set; } -/// Environment variables consulted while resolving model-picker settings. -public sealed class ModelPickerSettingsContextEnvironment -{ + /// Factory run identifier. + [JsonPropertyName("runId")] + public required string RunId { get; set; } + + /// Approved effective ceiling that was reached. + [JsonPropertyName("value")] + public required double Value { get; set; } } -/// Filesystem and environment context used to resolve model-picker settings. +/// The factory_resume_declined variant of . [Experimental(Diagnostics.Experimental)] -public sealed class ModelPickerSettingsContext +public partial class FactoryRunFailureFactoryResumeDeclined : FactoryRunFailure { - /// Optional Copilot configuration directory containing persisted settings. - [JsonPropertyName("configDir")] - public string? ConfigDir { get; set; } + /// + [JsonIgnore] + public override string Type => "factory_resume_declined"; - /// Environment variables consulted while resolving model-picker settings. - [JsonPropertyName("environment")] - public ModelPickerSettingsContextEnvironment Environment { get => field ??= new(); set; } + /// Human-readable reason the resume did not proceed. + [JsonPropertyName("reason")] + public required string Reason { get; set; } - /// User home directory used when resolving persisted settings. - [JsonPropertyName("homeDirectory")] - public string HomeDirectory { get; set; } = string.Empty; + /// Factory run identifier whose changed limits were declined. + [JsonPropertyName("runId")] + public required string RunId { get; set; } } -/// RPC data type for ModelPickerPersistence operations. +/// The factory_durable_failure variant of . [Experimental(Diagnostics.Experimental)] -public sealed class ModelPickerPersistenceRequest +public partial class FactoryRunFailureFactoryDurableFailure : FactoryRunFailure { - /// Whether context tier was explicitly selected and should be persisted. - [JsonPropertyName("contextTierExplicit")] - public bool? ContextTierExplicit { get; set; } + /// + [JsonIgnore] + public override string Type => "factory_durable_failure"; - /// Whether reasoning effort was explicitly selected and should be persisted. - [JsonPropertyName("reasoningEffortExplicit")] - public bool? ReasoningEffortExplicit { get; set; } + /// Stable failure code. + [JsonPropertyName("code")] + public required string Code { get; set; } - /// Filesystem and environment context used to resolve settings persistence. - [JsonPropertyName("settingsContext")] - public ModelPickerSettingsContext SettingsContext { get => field ??= new(); 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; } } -/// Target model identifier and optional reasoning effort, summary, capability overrides, and context tier. +/// The run stopped because its usage accounting could not be completed. +/// The factory_accounting_incomplete variant of . [Experimental(Diagnostics.Experimental)] -internal sealed class ModelSwitchToRequest +public partial class FactoryRunFailureFactoryAccountingIncomplete : FactoryRunFailure { - /// 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; } + /// + [JsonIgnore] + public override string Type => "factory_accounting_incomplete"; - /// 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; } + /// Confirmed usage in nano-AIU, representing the floor of what the run spent. + [JsonPropertyName("drainedNanoAiu")] + public required long DrainedNanoAiu { get; set; } - /// Override individual model capabilities resolved by the runtime. - [JsonPropertyName("modelCapabilities")] - public ModelCapabilitiesOverride? ModelCapabilities { get; set; } + /// Factory run identifier. + [JsonPropertyName("runId")] + public required string RunId { get; set; } +} - /// Settings scope used when persisting the selected model. - [JsonPropertyName("modelChangeScope")] - public string? ModelChangeScope { get; set; } +/// Complete current or terminal factory run envelope. +[Experimental(Diagnostics.Experimental)] +public sealed class FactoryRunResult +{ + /// Error message for an errored run. + [JsonPropertyName("error")] + public string? Error { 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; + /// Machine-readable failure details for an errored run. + [JsonPropertyName("failure")] + public FactoryRunFailure? Failure { get; set; } - /// Optional settings context and explicit-override flags used to persist a picker selection. - [JsonPropertyName("pickerPersistence")] - public ModelPickerPersistenceRequest? PickerPersistence { get; set; } + /// Reason for a halted or cancelled run. + [JsonPropertyName("reason")] + public string? Reason { 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; } + /// Completed factory result. + [JsonPropertyName("result")] + public JsonElement? Result { get; set; } - /// Reasoning summary mode to request for supported model clients. - [JsonPropertyName("reasoningSummary")] - public ReasoningSummary? ReasoningSummary { get; set; } + /// Factory run identifier. + [JsonPropertyName("runId")] + public string RunId { get; set; } = string.Empty; - /// Optional repository settings scope to persist after the switch commits. - [JsonPropertyName("repoScope")] - public string? RepoScope { get; set; } + /// Partial journal and progress snapshot for a halted, cancelled, or errored run. + [JsonPropertyName("snapshot")] + public JsonElement? Snapshot { get; set; } - /// Require the target to be currently available and enabled before applying the switch. - [JsonPropertyName("requireAvailable")] - public bool? RequireAvailable { get; set; } + /// Current or terminal factory run status. + [JsonPropertyName("status")] + public FactoryRunStatus Status { get; set; } +} - /// When true, evaluate context-window compaction policy before applying the switch. - [JsonPropertyName("runCompactionPreflight")] - public bool? RunCompactionPreflight { 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; } - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// Maximum number of factory subagents that may run concurrently. + [JsonPropertyName("maxConcurrentSubagents")] + public long? MaxConcurrentSubagents { get; set; } - /// Origin to record on the effective `session.model_change` event. Defaults to `sdk` when omitted. - [JsonPropertyName("source")] - public ModelChangeSource? Source { get; set; } + /// Maximum total number of factory subagents that may be admitted. + [JsonPropertyName("maxTotalSubagents")] + public long? MaxTotalSubagents { get; set; } - /// Output verbosity level to request for supported models. - [JsonPropertyName("verbosity")] - public Verbosity? Verbosity { 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; } } -/// Managed, repository, and CLI model overrides to overlay onto the session at startup. +/// Options controlling factory invocation. [Experimental(Diagnostics.Experimental)] -internal sealed class ModelApplyStartupOverlayRequest +public sealed class RunOptions { - /// 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; } + /// Per-invocation resource ceiling overrides. + [JsonPropertyName("limits")] + public FactoryRunLimits? Limits { get; set; } - /// Context tier selected by repository settings, when configured. - [JsonPropertyName("repoContextTier")] - public string? RepoContextTier { get; set; } + /// Run identifier whose journal and progress should seed this resumed run. + [JsonPropertyName("resumeFromRunId")] + public string? ResumeFromRunId { get; set; } +} - /// Model selected by repository settings, when configured. - [JsonPropertyName("repoModel")] - public string? RepoModel { 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; } - /// Reasoning effort selected by repository settings, when configured. - [JsonPropertyName("repoReasoningEffort")] - public string? RepoReasoningEffort { get; set; } + /// Registered factory name. + [JsonPropertyName("name")] + public string Name { get; set; } = string.Empty; - /// Model required by server-managed policy, when configured. - [JsonPropertyName("serverManagedModel")] - public string? ServerManagedModel { get; set; } + /// Factory invocation options. + [JsonPropertyName("options")] + public RunOptions? Options { 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. +/// Resolved persisted factory identity and resumed run envelope. [Experimental(Diagnostics.Experimental)] -public sealed class ModelSetReasoningEffortResult +public sealed class FactoryResumeResult { - /// Reasoning effort level recorded on the session after the update. - [JsonPropertyName("reasoningEffort")] - public string ReasoningEffort { get; set; } = string.Empty; + /// 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; } } -/// Reasoning effort level to apply to the currently selected model. +/// Parameters for resuming a factory run from its persisted identity. [Experimental(Diagnostics.Experimental)] -internal sealed class ModelSetReasoningEffortRequest +internal sealed class FactoryResumeRequest { - /// 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; + /// 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; } -/// Cost-category metadata for a CAPI model. +/// Parameters for retrieving a factory run. [Experimental(Diagnostics.Experimental)] -public sealed class SessionModelPriceCategory +internal sealed class FactoryGetRunRequest { - /// CAPI model identifier. - [JsonPropertyName("id")] - public string Id { get; set; } = string.Empty; + /// Factory run identifier. + [JsonPropertyName("runId")] + public string RunId { get; set; } = string.Empty; - /// Cost category assigned to the model. - [JsonPropertyName("priceCategory")] - public ModelPickerPriceCategory PriceCategory { get; set; } + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; } -/// The list of models available to this session. +/// Declared or approved factory resource ceilings. [Experimental(Diagnostics.Experimental)] -public sealed class SessionModelList +public sealed class FactoryDeclaredLimits { - /// 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; } + /// Maximum AI credits consumed by subagents and descendants. + [JsonPropertyName("maxAiCredits")] + public double? MaxAiCredits { get; 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; } + /// Maximum concurrently active subagents. + [JsonPropertyName("maxConcurrentSubagents")] + public long? MaxConcurrentSubagents { get; set; } - /// Per-quota snapshots returned alongside the model list, keyed by quota type. - [JsonPropertyName("quotaSnapshots")] - public IDictionary? QuotaSnapshots { 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; } } -/// RPC data type for SessionModelList operations. +/// Durable factory resource consumption. [Experimental(Diagnostics.Experimental)] -public sealed class SessionModelListRequest +public sealed class FactoryRunConsumed { - /// If true, bypasses the per-session model list cache and re-fetches from CAPI. - [JsonPropertyName("skipCache")] - public bool? SkipCache { get; set; } + /// 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; } } -/// RPC data type for SessionModelListRequestWithSession operations. +/// Current factory phase identity. [Experimental(Diagnostics.Experimental)] -internal sealed class SessionModelListRequestWithSession +public sealed class FactoryCurrentPhase { - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// Current phase identifier. + [JsonPropertyName("id")] + public string Id { 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; } + /// Zero-based declared phase ordinal, or null for an undeclared phase. + [JsonPropertyName("ordinal")] + public long? Ordinal { get; set; } } -/// Identifies the target session. +/// Prompt-safe terminal factory outcome. [Experimental(Diagnostics.Experimental)] -internal sealed class SessionModeGetRequest +public sealed class FactoryRunTerminal { - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// Human-readable terminal error. + [JsonPropertyName("error")] + public string? Error { get; set; } + + /// Machine-readable terminal failure. + [JsonPropertyName("failure")] + public FactoryRunFailure? Failure { 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; } } -/// Outcome of a session mode change, including any model switch it triggered and follow-up the host must perform. +/// Durable factory run summary with read-time live overlays. [Experimental(Diagnostics.Experimental)] -public sealed class ModeSetResult +public sealed class FactoryRunSummary { - /// 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; } + /// Epoch milliseconds when the current active segment started, or null while inactive. + [JsonPropertyName("activeSegmentStartedAt")] + public long? ActiveSegmentStartedAt { get; set; } - /// Whether the host must defer implementing the requested mode change. - [JsonPropertyName("deferImplementation")] - public bool? DeferImplementation { get; set; } + /// Approved effective resource ceilings, or null until approved. + [JsonPropertyName("approved")] + public FactoryDeclaredLimits? Approved { get; set; } - /// Deprecation warnings associated with the model selected by the mode change. - [JsonPropertyName("deprecationWarnings")] - public IList? DeprecationWarnings { get; set; } + /// Epoch milliseconds when the run completed, or null while nonterminal. + [JsonPropertyName("completedAt")] + public long? CompletedAt { get; set; } - /// User-facing outcome message for the model switch triggered by the mode change. - [JsonPropertyName("message")] - public string? Message { get; set; } + /// Durable resource consumption. + [JsonPropertyName("consumed")] + public FactoryRunConsumed Consumed { get => field ??= new(); set; } - /// Whether applying the mode changed the active model. - [JsonPropertyName("modelChanged")] - public bool ModelChanged { get; set; } + /// Epoch milliseconds when the run was created. + [JsonPropertyName("createdAt")] + public long CreatedAt { get; set; } - /// Lifecycle status of the requested mode change. - [JsonPropertyName("status")] - public string Status { get; set; } = string.Empty; + /// Current phase identity, or null before any phase is entered. + [JsonPropertyName("currentPhase")] + public FactoryCurrentPhase? CurrentPhase { get; set; } - /// User-facing warning produced while applying the mode change. - [JsonPropertyName("warning")] - public string? Warning { get; set; } -} + /// Resource ceilings declared by the factory. + [JsonPropertyName("declaredLimits")] + public FactoryDeclaredLimits DeclaredLimits { get => field ??= new(); 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; } + /// Number of phases declared by the factory. + [JsonPropertyName("declaredPhaseCount")] + public long DeclaredPhaseCount { get; set; } - /// Session whose plan-mode base state should be inherited. - [JsonPropertyName("inheritPlanBaseFromSessionId")] - public string? InheritPlanBaseFromSessionId { get; set; } + /// Human-readable factory description. + [JsonPropertyName("description")] + public string Description { get; set; } = string.Empty; - /// The session mode the agent is operating in. - [JsonPropertyName("mode")] - public SessionMode Mode { get; set; } + /// Registered factory name. + [JsonPropertyName("factoryName")] + public string FactoryName { get; set; } = string.Empty; - /// Whether the selected plan model should be persisted. - [JsonPropertyName("persistPlanSelection")] - public bool? PersistPlanSelection { get; set; } + /// Number of direct factory agents currently live. + [JsonPropertyName("liveAgentCount")] + public long LiveAgentCount { get; set; } - /// Settings context used when persisting the selected plan model. - [JsonPropertyName("pickerSettingsContext")] - public ModelPickerSettingsContext? PickerSettingsContext { get; set; } + /// Epoch milliseconds when this live-overlay snapshot was observed. + [JsonPropertyName("observedAt")] + public long ObservedAt { get; set; } - /// Context tier to use with the dedicated plan model. - [JsonPropertyName("planContextTier")] - public string? PlanContextTier { get; set; } + /// Monotonic durable run revision. + [JsonPropertyName("revision")] + public long Revision { get; set; } - /// Action to perform when leaving plan mode. - [JsonPropertyName("planExitAction")] - public string? PlanExitAction { get; set; } + /// Factory run identifier. + [JsonPropertyName("runId")] + public string RunId { get; set; } = string.Empty; - /// Dedicated model to use in plan mode, when configured. - [JsonPropertyName("planModel")] - public string? PlanModel { get; set; } + /// Epoch milliseconds when execution first started, or null before start. + [JsonPropertyName("startedAt")] + public long? StartedAt { get; set; } - /// Whether a dedicated plan model is configured. - [JsonPropertyName("planModelConfigured")] - public bool? PlanModelConfigured { get; set; } + /// Current factory run status. + [JsonPropertyName("status")] + public FactoryRunStatus Status { get; set; } - /// Reasoning effort to use with the dedicated plan model. - [JsonPropertyName("planReasoningEffort")] - public string? PlanReasoningEffort { get; set; } + /// Terminal run outcome, or null while nonterminal. + [JsonPropertyName("terminal")] + public FactoryRunTerminal? Terminal { get; set; } - /// Whether leaving plan mode should restore the session's previous model. - [JsonPropertyName("restorePlanModel")] - public bool? RestorePlanModel { get; set; } + /// Total direct factory agents spawned across all attempts. + [JsonPropertyName("totalSpawnedAgentCount")] + public long TotalSpawnedAgentCount { get; set; } - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// Epoch milliseconds when the durable run was last updated. + [JsonPropertyName("updatedAt")] + public long UpdatedAt { get; set; } } -/// The session's friendly name, or null when not yet set. +/// A page of factory runs in durable creation order. [Experimental(Diagnostics.Experimental)] -public sealed class NameGetResult +public sealed class FactoryListRunsResult { - /// 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; + /// Whether terminal runs newer than this page exist. + [JsonPropertyName("hasMoreNewer")] + public bool? HasMoreNewer { get; set; } - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; -} + /// Newest terminal-run cursor in this page, or null when the terminal window is empty. + [JsonPropertyName("newestSeq")] + public long? NewestSeq { get; set; } -/// 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; } -} + /// Oldest terminal-run cursor in this page, or null when the terminal window is empty. + [JsonPropertyName("oldestSeq")] + public long? OldestSeq { 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; + /// Number of terminal runs older than this page. + [JsonPropertyName("omittedOlder")] + public long? OmittedOlder { get; set; } - /// Auto-generated session summary. Empty/whitespace-only values are ignored; values are trimmed before persisting. - [JsonPropertyName("summary")] - public string Summary { get; set; } = string.Empty; + /// Factory run summaries in durable creation order. + [JsonPropertyName("runs")] + public IList Runs { get => field ??= []; set; } } -/// Existence, contents, and resolved path of the session plan file. +/// Parameters for paging factory runs. [Experimental(Diagnostics.Experimental)] -public sealed class PlanReadResult +internal sealed class FactoryListRunsRequest { - /// The content of the plan file, or null if it does not exist. - [JsonPropertyName("content")] - public string? Content { get; set; } + /// Exclusive forward cursor. + [JsonPropertyName("afterSeq")] + public long? AfterSeq { get; set; } - /// Whether the plan file exists in the workspace. - [JsonPropertyName("exists")] - public bool Exists { get; set; } + /// Exclusive backward cursor. + [JsonPropertyName("beforeSeq")] + public long? BeforeSeq { get; set; } - /// Absolute file path of the plan file, or null if workspace is not enabled. - [JsonPropertyName("path")] - public string? Path { get; set; } -} + /// Maximum terminal runs to return. Defaults to 200 and is capped at 500. + [JsonPropertyName("limit")] + public int? Limit { 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. +/// Prompt-safe durable identity and live status for a direct factory agent. [Experimental(Diagnostics.Experimental)] -internal sealed class PlanUpdateRequest +public sealed class FactoryAgentSummary { - /// The new content for the plan file. - [JsonPropertyName("content")] - public string Content { get; set; } = string.Empty; + /// Accumulated active agent time in milliseconds. + [JsonPropertyName("activeMs")] + public long ActiveMs { get; set; } - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; -} + /// Prompt-safe live activity text. + [JsonPropertyName("activity")] + public string? Activity { get; set; } -/// Identifies the target session. -[Experimental(Diagnostics.Experimental)] -internal sealed class SessionPlanDeleteRequest -{ - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; -} + /// Stable direct-agent identifier. + [JsonPropertyName("agentId")] + public string AgentId { 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 description. - [JsonPropertyName("description")] - public string? Description { get; set; } + /// Registered agent type. + [JsonPropertyName("agentType")] + public string AgentType { get; set; } = string.Empty; - /// Todo identifier. - [JsonPropertyName("id")] - public string? Id { get; set; } + /// Epoch milliseconds when the agent completed. + [JsonPropertyName("completedAt")] + public long? CompletedAt { get; set; } - /// Todo status. - [JsonPropertyName("status")] - public string? Status { get; set; } + /// Friendly, non-unique name intended for display. + [JsonPropertyName("displayName")] + public string? DisplayName { get; set; } - /// Todo title. - [JsonPropertyName("title")] - public string? Title { get; set; } -} + /// Friendly, non-unique name intended for display. + [JsonPropertyName("label")] + public string Label { get; set; } = string.Empty; -/// 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; } -} + /// Phase identifier active when the agent was launched, or null. + [JsonPropertyName("phaseId")] + public string? PhaseId { get; set; } -/// Identifies the target session. -[Experimental(Diagnostics.Experimental)] -internal sealed class SessionPlanReadSqlTodosRequest -{ - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; -} + /// Model requested when the agent was launched. + [JsonPropertyName("requestedModel")] + public string? RequestedModel { get; set; } -/// 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; + /// Concrete model resolved for the agent. + [JsonPropertyName("resolvedModel")] + public string? ResolvedModel { get; set; } - /// ID of the todo that has the dependency. - [JsonPropertyName("todoId")] - public string TodoId { get; set; } = string.Empty; -} + /// Owning factory run identifier. + [JsonPropertyName("runId")] + public string RunId { 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; } + /// Epoch milliseconds when the agent started. + [JsonPropertyName("startedAt")] + public long? StartedAt { get; 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; } -} + /// Current durable or live agent status. + [JsonPropertyName("status")] + public string Status { get; set; } = string.Empty; -/// Identifies the target session. -[Experimental(Diagnostics.Experimental)] -internal sealed class SessionPlanReadSqlTodosWithDependenciesRequest -{ - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// Tool-call identifier that launched the agent. + [JsonPropertyName("toolCallId")] + public string ToolCallId { get; set; } = string.Empty; } -/// RPC data type for WorkspacesGetWorkspaceResultWorkspace operations. -public sealed class WorkspacesGetWorkspaceResultWorkspace +/// Durable lifecycle and timing for one factory phase. +[Experimental(Diagnostics.Experimental)] +public sealed class FactoryPhaseObservation { - /// 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; } + /// Completed active time accumulated by this phase in milliseconds. + [JsonPropertyName("accumulatedActiveMs")] + public long AccumulatedActiveMs { get; set; } - /// Timestamp when the workspace was created. - [JsonPropertyName("created_at")] - public DateTimeOffset? CreatedAt { 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 working directory associated with the workspace. - [JsonPropertyName("cwd")] - public string? Cwd { get; set; } + /// Current live active time for this phase in milliseconds. + [JsonPropertyName("currentActiveMs")] + public long CurrentActiveMs { get; set; } - /// Git repository root associated with the workspace. - [JsonPropertyName("git_root")] - public string? GitRoot { get; set; } + /// Optional human-readable phase detail. + [JsonPropertyName("detail")] + public string? Detail { get; set; } - /// Allowed values for the `WorkspacesWorkspaceDetailsHostType` enumeration. - [JsonPropertyName("host_type")] - public WorkspacesWorkspaceDetailsHostType? HostType { get; set; } + /// Number of times execution entered this phase. + [JsonPropertyName("entryCount")] + public long EntryCount { 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)] + /// Phase identifier. [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; } + /// Most recent run attempt that entered this phase, or `0` if the phase has never been entered. + [JsonPropertyName("lastEnteredRunAttempt")] + public long LastEnteredRunAttempt { get; set; } - /// Workspace display name. - [JsonPropertyName("name")] - public string? Name { get; set; } + /// Direct agents in this phase that are currently live. + [JsonPropertyName("liveAgentCount")] + public long LiveAgentCount { get; set; } - /// Whether the workspace session can be steered remotely. - [JsonPropertyName("remote_steerable")] - public bool? RemoteSteerable { get; set; } + /// Zero-based declared phase ordinal, or null for an undeclared phase. + [JsonPropertyName("ordinal")] + public long? Ordinal { get; set; } - /// Repository identifier associated with the workspace. - [JsonPropertyName("repository")] - public string? Repository { 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; } - /// Number of persisted summaries in the workspace. - [JsonPropertyName("summary_count")] - public long? SummaryCount { get; set; } + /// Derived lifecycle state of the phase. + [JsonPropertyName("status")] + public FactoryPhaseStatus Status { get; set; } - /// Timestamp when the workspace was last updated. - [JsonPropertyName("updated_at")] - public DateTimeOffset? UpdatedAt { get; set; } + /// Human-readable phase title. + [JsonPropertyName("title")] + public string Title { get; set; } = string.Empty; - /// Whether the workspace name was explicitly chosen by the user. - [JsonPropertyName("user_named")] - public bool? UserNamed { get; set; } + /// Total direct agents associated with this phase. + [JsonPropertyName("totalAgentCount")] + public long TotalAgentCount { get; set; } } -/// Current workspace metadata for the session, including its absolute filesystem path when available. +/// One durable factory progress record. [Experimental(Diagnostics.Experimental)] -public sealed class WorkspacesGetWorkspaceResult +public sealed class FactoryProgressLine { - /// 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; } + /// Resume attempt that emitted this record. + [JsonPropertyName("attempt")] + public long Attempt { get; set; } - /// Current workspace metadata, or null if not available. - [JsonPropertyName("workspace")] - public WorkspacesGetWorkspaceResultWorkspace? Workspace { 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; } -/// Identifies the target session. +/// A bidirectional page of factory progress. [Experimental(Diagnostics.Experimental)] -internal sealed class SessionWorkspacesGetWorkspaceRequest +public sealed class FactoryProgressPage { - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// 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; } } -/// Workspace metadata fields to update. +/// Full factory run observability detail. [Experimental(Diagnostics.Experimental)] -internal sealed class WorkspacesUpdateMetadataRequest +public sealed class FactoryRunDetail { - /// Opaque workspace context supplied by the session host. - [JsonPropertyName("context")] - public JsonElement? Context { get; set; } + /// Epoch milliseconds when the current active segment started, or null while inactive. + [JsonPropertyName("activeSegmentStartedAt")] + public long? ActiveSegmentStartedAt { get; set; } - /// Optional workspace display name override. - [JsonPropertyName("name")] - public string? Name { get; set; } + /// Durable identities and live statuses for direct factory agents. + [JsonPropertyName("agents")] + public IList Agents { get => field ??= []; set; } - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// Approved effective resource ceilings, or null until approved. + [JsonPropertyName("approved")] + public FactoryDeclaredLimits? Approved { 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; } } -/// Optional session context used when creating a local workspace. +/// Parameters for paging factory progress. [Experimental(Diagnostics.Experimental)] -internal sealed class WorkspacesEnsureRequest +internal sealed class FactoryGetRunProgressRequest { - /// Opaque workspace context supplied by the session host. - [JsonPropertyName("context")] - public JsonElement? Context { get; set; } + /// 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; } -/// Relative paths of files stored in the session workspace files directory. +/// Parameters for cancelling a factory run. [Experimental(Diagnostics.Experimental)] -public sealed class WorkspacesListFilesResult +internal sealed class FactoryCancelRequest { - /// Relative file paths in the workspace files directory. - [JsonPropertyName("files")] - public IList Files { get => field ??= []; set; } -} + /// Factory run identifier. + [JsonPropertyName("runId")] + public string RunId { get; set; } = string.Empty; -/// 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. +/// Acknowledgement that a factory request was accepted. [Experimental(Diagnostics.Experimental)] -public sealed class WorkspacesReadFileResult +public sealed class FactoryAckResult { - /// File content as a UTF-8 string. - [JsonPropertyName("content")] - public string Content { get; set; } = string.Empty; } -/// Relative path of the workspace file to read. +/// One ordered factory progress line. [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 +public sealed class FactoryLogLine { - /// File content to write as a UTF-8 string. - [JsonPropertyName("content")] - public string Content { get; set; } = string.Empty; + /// Progress line kind. + [JsonPropertyName("kind")] + public FactoryLogLineKind Kind { get; set; } - /// Relative path within the workspace files directory. - [JsonPropertyName("path")] - public string Path { get; set; } = string.Empty; + /// Monotonic sequence number within the factory run. + [JsonPropertyName("seq")] + public long Seq { get; set; } - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// Progress text. + [JsonPropertyName("text")] + public string Text { get; set; } = string.Empty; } -/// Workspace checkpoint metadata with assigned number, human-readable title, and checkpoint filename. +/// Parameters for recording factory progress. [Experimental(Diagnostics.Experimental)] -public sealed class WorkspacesCheckpoints +internal sealed class FactoryLogRequest { - /// 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; } + /// Opaque token identifying the current factory execution attempt. + [JsonPropertyName("executionToken")] + public string ExecutionToken { get; set; } = string.Empty; - /// Human-readable checkpoint title. - [JsonPropertyName("title")] - public string Title { get; set; } = string.Empty; -} + /// Ordered progress lines to append. + [JsonPropertyName("lines")] + public IList Lines { get => field ??= []; set; } -/// 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; } -} + /// Factory run identifier. + [JsonPropertyName("runId")] + public string RunId { get; set; } = string.Empty; -/// 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. +/// Result of one factory-scoped subagent call. [Experimental(Diagnostics.Experimental)] -public sealed class WorkspacesReadCheckpointResult +public sealed class FactoryAgentResult { - /// Checkpoint content as a UTF-8 string, or null when the checkpoint or workspace is missing. - [JsonPropertyName("content")] - public string? Content { get; set; } + /// Agent result, omitted when the agent produced no result. + [JsonPropertyName("result")] + public JsonElement? Result { get; set; } } -/// Checkpoint number to read. +/// Options for one factory-scoped subagent call. [Experimental(Diagnostics.Experimental)] -internal sealed class WorkspacesReadCheckpointRequest +public sealed class FactoryAgentOptions { - /// Checkpoint number to read. - [JsonPropertyName("number")] - public long Number { get; set; } + /// Optional custom agent name for the subagent. This field is accepted but not yet honored. + [JsonPropertyName("agent")] + public string? Agent { get; set; } - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; -} + /// Optional context tier for the subagent. This field is accepted but not yet honored. + [JsonPropertyName("contextTier")] + public ContextTier? ContextTier { get; set; } -/// Metadata for the persisted summary. -public sealed class WorkspacesAddSummaryResultSummary -{ -} + /// Optional label distinguishing otherwise identical memoized agent calls. + [JsonPropertyName("label")] + public string? Label { get; set; } -/// Refreshed metadata for the containing workspace. -public sealed class WorkspacesAddSummaryResultWorkspace -{ -} + /// Optional model identifier for the subagent. + [JsonPropertyName("model")] + public string? Model { get; set; } -/// 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; } + /// Optional reasoning effort for the subagent. This field is accepted but not yet honored. + [JsonPropertyName("reasoningEffort")] + public string? ReasoningEffort { get; set; } - /// Refreshed metadata for the containing workspace. - [JsonPropertyName("workspace")] - public WorkspacesAddSummaryResultWorkspace? Workspace { get; set; } + /// Optional JSON Schema for structured agent output. + [JsonPropertyName("schema")] + public JsonElement? Schema { get; set; } } -/// Compaction summary checkpoint to persist. +/// Parameters for one factory-scoped subagent call. [Experimental(Diagnostics.Experimental)] -internal sealed class WorkspacesAddSummaryRequest +internal sealed class FactoryAgentRequest { - /// Markdown summary content to persist. - [JsonPropertyName("content")] - public string Content { get; set; } = string.Empty; + /// Opaque token identifying the current factory execution attempt. + [JsonPropertyName("executionToken")] + public string ExecutionToken { get; set; } = string.Empty; - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// Factory run identifier that owns the subagent. + [JsonPropertyName("factoryRunId")] + public string FactoryRunId { get; set; } = string.Empty; - /// Summary title shown in checkpoint listings. - [JsonPropertyName("title")] - public string Title { get; set; } = string.Empty; -} + /// Subagent execution options. + [JsonPropertyName("opts")] + public FactoryAgentOptions Opts { get => field ??= new(); set; } -/// 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; } + /// 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; } -/// Autopilot objective file content, or null when missing. +/// Result of reading a factory journal entry. [Experimental(Diagnostics.Experimental)] -public sealed class WorkspacesReadAutopilotObjectiveResult +public sealed class FactoryJournalGetResult { - /// Autopilot objective file content, or null when missing. - [JsonPropertyName("content")] - public string? Content { get; set; } + /// 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; } } -/// Identifies the target session. +/// Parameters for reading a factory journal entry. [Experimental(Diagnostics.Experimental)] -internal sealed class SessionWorkspacesReadAutopilotObjectiveRequest +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; } -/// Result of writing the autopilot objective file. +/// Parameters for storing a factory journal entry. [Experimental(Diagnostics.Experimental)] -public sealed class WorkspacesWriteAutopilotObjectiveResult +internal sealed class FactoryJournalPutRequest { - /// Filesystem operation performed. - [JsonPropertyName("operation")] - public string Operation { get; set; } = string.Empty; -} + /// Opaque token identifying the current factory execution attempt. + [JsonPropertyName("executionToken")] + public string ExecutionToken { 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; + /// 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; } -/// Result of deleting the autopilot objective file. +/// The currently selected model, reasoning effort, and context tier for the session. The context tier reflects `Session.getContextTier()`, restored from the session journal on resume. [Experimental(Diagnostics.Experimental)] -public sealed class WorkspacesDeleteAutopilotObjectiveResult +public sealed class CurrentModel { - /// True when a file was deleted. - [JsonPropertyName("deleted")] - public bool Deleted { 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; } + + /// 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 SessionWorkspacesDeleteAutopilotObjectiveRequest +internal sealed class SessionModelGetCurrentRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } -/// Whether the autopilot objective file exists. +/// RPC data type for ModelSwitchConfirmation operations. [Experimental(Diagnostics.Experimental)] -public sealed class WorkspacesAutopilotObjectiveExistsResult +public sealed class ModelSwitchConfirmation { - /// True when the objective file exists. - [JsonPropertyName("exists")] - public bool Exists { get; set; } + /// 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; } -/// Identifies the target session. +/// The model identifier active on the session after the switch. [Experimental(Diagnostics.Experimental)] -internal sealed class SessionWorkspacesAutopilotObjectiveExistsRequest +public sealed class ModelSwitchToResult { - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; -} + /// Compaction confirmation projection when status is confirmation_required. + [JsonPropertyName("confirmation")] + public ModelSwitchConfirmation? Confirmation { get; set; } -/// 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; + /// 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; } - /// Absolute filesystem path to the saved paste file. - [JsonPropertyName("filePath")] - public string FilePath { get; set; } = string.Empty; + /// Deprecation warnings associated with the selected model or options. + [JsonPropertyName("deprecationWarnings")] + public IList? DeprecationWarnings { get; set; } - /// Size of the saved file in bytes. - [JsonPropertyName("sizeBytes")] - public long SizeBytes { get; set; } -} + /// User-facing outcome message for the model switch. + [JsonPropertyName("message")] + public string? Message { 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; } -} + /// Currently active model identifier after the switch. + [JsonPropertyName("modelId")] + public string? ModelId { 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; + /// Persistence failure encountered after applying the model switch. + [JsonPropertyName("persistenceError")] + public string? PersistenceError { get; set; } - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// 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; } } -/// A single changed file and its unified diff. +/// Vision-specific limits. [Experimental(Diagnostics.Experimental)] -public sealed class WorkspaceDiffFileChange +public sealed class ModelCapabilitiesOverrideLimitsVision { - /// 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; } + /// Maximum image size in bytes. + [JsonPropertyName("max_prompt_image_size")] + public long? MaxPromptImageSize { get; set; } - /// Original file path for renamed files. - [JsonPropertyName("oldPath")] - public string? OldPath { get; set; } + /// Maximum number of images per prompt. + [JsonPropertyName("max_prompt_images")] + public long? MaxPromptImages { 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; + /// MIME types the model accepts. + [JsonPropertyName("supported_media_types")] + public IList? SupportedMediaTypes { get; set; } } -/// Workspace diff result for the requested mode. +/// Token limits for prompts, outputs, and context window. [Experimental(Diagnostics.Experimental)] -public sealed class WorkspaceDiffResult +public sealed class ModelCapabilitiesOverrideLimits { - /// 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; } + /// Maximum total context window size in tokens. + [JsonPropertyName("max_context_window_tokens")] + public long? MaxContextWindowTokens { get; set; } - /// Effective mode used for the returned changes. - [JsonPropertyName("mode")] - public WorkspaceDiffMode Mode { get; set; } + /// Maximum number of output/completion tokens. + [JsonPropertyName("max_output_tokens")] + public long? MaxOutputTokens { get; set; } - /// Diff mode requested by the client. - [JsonPropertyName("requestedMode")] - public WorkspaceDiffMode RequestedMode { get; set; } + /// Maximum number of prompt/input tokens. + [JsonPropertyName("max_prompt_tokens")] + public long? MaxPromptTokens { 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; } + /// Vision-specific limits. + [JsonPropertyName("vision")] + public ModelCapabilitiesOverrideLimitsVision? Vision { get; set; } } -/// Parameters for computing a workspace diff. +/// Feature flags indicating what the model supports. [Experimental(Diagnostics.Experimental)] -internal sealed class WorkspacesDiffRequest +public sealed class ModelCapabilitiesOverrideSupports { - /// When true, ignore whitespace-only changes (git `--ignore-all-space`). Defaults to false. - [JsonPropertyName("ignoreWhitespace")] - public bool? IgnoreWhitespace { get; set; } + /// 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; } - /// Diff mode requested by the client. - [JsonPropertyName("mode")] - public WorkspaceDiffMode Mode { get; set; } + /// Whether this model supports reasoning effort configuration. + [JsonPropertyName("reasoningEffort")] + public bool? ReasoningEffort { get; set; } - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// Whether this model supports vision/image input. + [JsonPropertyName("vision")] + public bool? Vision { get; set; } } -/// 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`). +/// Optional capability overrides (vision, tool_calls, reasoning, etc.). [Experimental(Diagnostics.Experimental)] -public sealed class CompletionsGetTriggerCharactersResult +public sealed class ModelCapabilitiesOverride { - /// Trigger characters advertised by the host (e.g. `["@", "#"]`). Empty disables host-driven completions for the session. - [JsonPropertyName("triggerCharacters")] - public IList TriggerCharacters { get => field ??= []; set; } + /// 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; } } -/// Identifies the target session. -[Experimental(Diagnostics.Experimental)] -internal sealed class SessionCompletionsGetTriggerCharactersRequest +/// Environment variables consulted while resolving model-picker settings. +public sealed class ModelPickerSettingsContextEnvironment { - /// 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. +/// Filesystem and environment context used to resolve model-picker settings. [Experimental(Diagnostics.Experimental)] -public sealed class SessionCompletionItem +public sealed class ModelPickerSettingsContext { - /// 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; } + /// Optional Copilot configuration directory containing persisted settings. + [JsonPropertyName("configDir")] + public string? ConfigDir { get; set; } - /// End (exclusive) of the replacement range in `text`, in UTF-16 code units. - [JsonPropertyName("rangeEnd")] - public long? RangeEnd { get; set; } + /// Environment variables consulted while resolving model-picker settings. + [JsonPropertyName("environment")] + public ModelPickerSettingsContextEnvironment Environment { get => field ??= new(); set; } - /// Start of the replacement range in `text`, in UTF-16 code units. - [JsonPropertyName("rangeStart")] - public long? RangeStart { get; set; } + /// User home directory used when resolving persisted settings. + [JsonPropertyName("homeDirectory")] + public string HomeDirectory { get; set; } = string.Empty; } -/// Host-driven completion items for the current composer input. Empty when the host returns no items or does not support completions. +/// RPC data type for ModelPickerPersistence operations. [Experimental(Diagnostics.Experimental)] -public sealed class CompletionsRequestResult +public sealed class ModelPickerPersistenceRequest { - /// Completion items in host-ranked order. - [JsonPropertyName("items")] - public IList Items { get => field ??= []; set; } + /// 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; } } -/// Request host-driven completions for the current composer input. +/// Target model identifier and optional reasoning effort, summary, capability overrides, and context tier. [Experimental(Diagnostics.Experimental)] -internal sealed class CompletionsRequestRequest +internal sealed class ModelSwitchToRequest { - /// Cursor offset within `text`, in UTF-16 code units. - [JsonPropertyName("offset")] - public long Offset { 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; } - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// 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; } - /// The full composed composer input. - [JsonPropertyName("text")] - public string Text { get; set; } = string.Empty; -} + /// 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; } -/// 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; } -} + /// Override individual model capabilities resolved by the runtime. + [JsonPropertyName("modelCapabilities")] + public ModelCapabilitiesOverride? ModelCapabilities { get; set; } -/// Identifies the target session. -[Experimental(Diagnostics.Experimental)] -internal sealed class SessionInstructionsGetSourcesRequest -{ - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; -} + /// Settings scope used when persisting the selected model. + [JsonPropertyName("modelChangeScope")] + public string? ModelChangeScope { get; set; } -/// 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; } -} + /// 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 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; } + /// 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; -} -/// Agents available to the session. -[Experimental(Diagnostics.Experimental)] -public sealed class AgentList -{ - /// Available agents. - [JsonPropertyName("agents")] - public IList Agents { get => field ??= []; set; } + /// Origin to record on the effective `session.model_change` event. Defaults to `sdk` when omitted. + [JsonPropertyName("source")] + public ModelChangeSource? Source { get; set; } + + /// Output verbosity level to request for supported models. + [JsonPropertyName("verbosity")] + public Verbosity? Verbosity { get; set; } } -/// RPC data type for SessionAgentList operations. +/// Managed, repository, and CLI model overrides to overlay onto the session at startup. [Experimental(Diagnostics.Experimental)] -public sealed class SessionAgentListRequest +internal sealed class ModelApplyStartupOverlayRequest { - /// 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; } + /// Model explicitly selected by the CLI, when provided. + [JsonPropertyName("cliModel")] + public string? CliModel { 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; } -} + /// Whether the overlay is being applied while resuming a deferred session. + [JsonPropertyName("deferredResume")] + public bool? DeferredResume { 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; } + /// Model required by device-managed policy, when configured. + [JsonPropertyName("deviceManagedModel")] + public string? DeviceManagedModel { 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; } + /// Context tier selected by repository settings, when configured. + [JsonPropertyName("repoContextTier")] + public string? RepoContextTier { get; set; } - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; -} + /// Model selected by repository settings, when configured. + [JsonPropertyName("repoModel")] + public string? RepoModel { get; set; } -/// 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; + /// Reasoning effort selected by repository settings, when configured. + [JsonPropertyName("repoReasoningEffort")] + public string? RepoReasoningEffort { get; set; } - /// Replacement authored prompt. Empty text is valid. - [JsonPropertyName("prompt")] - public string Prompt { get; set; } = string.Empty; + /// 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 currently selected custom agent, or null when using the default agent. +/// 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 AgentGetCurrentResult +public sealed class ModelSetReasoningEffortResult { - /// Currently selected custom agent, or null if using the default agent. - [JsonPropertyName("agent")] - public AgentInfo? Agent { get; set; } + /// Reasoning effort level recorded on the session after the update. + [JsonPropertyName("reasoningEffort")] + public string ReasoningEffort { get; set; } = string.Empty; } -/// Identifies the target session. +/// Reasoning effort level to apply to the currently selected model. [Experimental(Diagnostics.Experimental)] -internal sealed class SessionAgentGetCurrentRequest +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; } -/// The newly selected custom agent. +/// Cost-category metadata for a CAPI model. [Experimental(Diagnostics.Experimental)] -public sealed class AgentSelectResult +public sealed class SessionModelPriceCategory { - /// The newly selected custom agent. - [JsonPropertyName("agent")] - public AgentInfo Agent { get => field ??= new(); set; } + /// 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; } } -/// Name of the custom agent to select for subsequent turns. +/// The list of models available to this session. [Experimental(Diagnostics.Experimental)] -internal sealed class AgentSelectRequest +public sealed class SessionModelList { - /// Name of the custom agent to select. - [JsonPropertyName("name")] - public string Name { get; set; } = string.Empty; + /// 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; } - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// 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; } } -/// Identifies the target session. +/// RPC data type for SessionModelList operations. [Experimental(Diagnostics.Experimental)] -internal sealed class SessionAgentDeselectRequest +public sealed class SessionModelListRequest { - /// 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; } } -/// Custom agents available to the session after reloading definitions from disk. +/// RPC data type for SessionModelListRequestWithSession operations. [Experimental(Diagnostics.Experimental)] -public sealed class AgentReloadResult +internal sealed class SessionModelListRequestWithSession { - /// Reloaded custom agents. - [JsonPropertyName("agents")] - public IList Agents { get => field ??= []; set; } + /// 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 SessionAgentReloadRequest +internal sealed class SessionModeGetRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } -/// Identifier assigned to the newly started background agent task. +/// 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 TasksStartAgentResult +public sealed class ModeSetResult { - /// Generated agent ID for the background task. - [JsonPropertyName("agentId")] - public string AgentId { get; set; } = string.Empty; -} + /// Whether the host should arm an interactive continuation after the mode change. + [JsonPropertyName("armInteractiveContinuation")] + public bool? ArmInteractiveContinuation { get; set; } -/// 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; + /// Compaction confirmation required before the mode change can complete. + [JsonPropertyName("confirmation")] + public ModelSwitchConfirmation? Confirmation { get; set; } - /// Short description of the task. - [JsonPropertyName("description")] - public string? Description { get; set; } + /// Whether the host must defer implementing the requested mode change. + [JsonPropertyName("deferImplementation")] + public bool? DeferImplementation { get; set; } - /// Optional model override. - [JsonPropertyName("model")] - public string? Model { get; set; } + /// Deprecation warnings associated with the model selected by the mode change. + [JsonPropertyName("deprecationWarnings")] + public IList? DeprecationWarnings { get; set; } - /// Friendly, non-unique name used when displaying the agent. - [JsonPropertyName("name")] - public string Name { get; set; } = string.Empty; + /// User-facing outcome message for the model switch triggered by the mode change. + [JsonPropertyName("message")] + public string? Message { get; set; } - /// Task prompt for the agent. - [JsonPropertyName("prompt")] - public string Prompt { get; set; } = string.Empty; + /// Whether applying the mode changed the active model. + [JsonPropertyName("modelChanged")] + public bool ModelChanged { get; set; } - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// 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; } } -/// Tracked task union returned by task APIs, containing either an agent task or a shell task. -/// Polymorphic base type discriminated by type. -[Experimental(Diagnostics.Experimental)] -[JsonPolymorphic( - TypeDiscriminatorPropertyName = "type", - UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToBaseType)] -[JsonDerivedType(typeof(TaskInfoAgent), "agent")] -[JsonDerivedType(typeof(TaskInfoShell), "shell")] -public partial class TaskInfo -{ - /// The type discriminator. - [JsonPropertyName("type")] - public virtual string Type { get; set; } = string.Empty; -} - - -/// Tracked background agent task metadata, including IDs, status, timing, agent type, prompt, model, result, and latest response. -/// The agent variant of . +/// Agent interaction mode to apply to the session. [Experimental(Diagnostics.Experimental)] -public partial class TaskInfoAgent : TaskInfo +internal sealed class ModeSetRequest { - /// - [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; } + /// Explicit response to a model-switch compaction preflight. + [JsonPropertyName("compactionDecision")] + public string? CompactionDecision { get; set; } - /// Whether task execution is synchronously awaited or managed in the background. - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("executionMode")] - public TaskExecutionMode? ExecutionMode { get; set; } + /// Session whose plan-mode base state should be inherited. + [JsonPropertyName("inheritPlanBaseFromSessionId")] + public string? InheritPlanBaseFromSessionId { get; set; } - /// Unique task identifier. - [JsonPropertyName("id")] - public required string Id { get; set; } + /// The session mode the agent is operating in. + [JsonPropertyName("mode")] + public SessionMode Mode { get; set; } - /// ISO 8601 timestamp when the agent entered idle state. - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("idleSince")] - public DateTimeOffset? IdleSince { get; set; } + /// Whether the selected plan model should be persisted. + [JsonPropertyName("persistPlanSelection")] + public bool? PersistPlanSelection { get; set; } - /// Most recent response text from the agent. - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("latestResponse")] - public string? LatestResponse { get; set; } + /// Settings context used when persisting the selected plan model. + [JsonPropertyName("pickerSettingsContext")] + public ModelPickerSettingsContext? PickerSettingsContext { get; set; } - /// Requested model override for the task when specified. - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("model")] - public string? Model { get; set; } + /// Context tier to use with the dedicated plan model. + [JsonPropertyName("planContextTier")] + public string? PlanContextTier { 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; } + /// Action to perform when leaving plan mode. + [JsonPropertyName("planExitAction")] + public string? PlanExitAction { get; set; } - /// Runtime model resolved for the task when available. - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("resolvedModel")] - public string? ResolvedModel { get; set; } + /// Dedicated model to use in plan mode, when configured. + [JsonPropertyName("planModel")] + public string? PlanModel { get; set; } - /// Result text from the task when available. - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("result")] - public string? Result { get; set; } + /// Whether a dedicated plan model is configured. + [JsonPropertyName("planModelConfigured")] + public bool? PlanModelConfigured { get; set; } - /// ISO 8601 timestamp when the task was started. - [JsonPropertyName("startedAt")] - public required DateTimeOffset StartedAt { get; set; } + /// Reasoning effort to use with the dedicated plan model. + [JsonPropertyName("planReasoningEffort")] + public string? PlanReasoningEffort { get; set; } - /// Current lifecycle status of the task. - [JsonPropertyName("status")] - public required TaskStatus Status { get; set; } + /// Whether leaving plan mode should restore the session's previous model. + [JsonPropertyName("restorePlanModel")] + public bool? RestorePlanModel { get; set; } - /// Tool call ID associated with this agent task. - [JsonPropertyName("toolCallId")] - public required string ToolCallId { get; set; } + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; } -/// Tracked shell task metadata, including ID, command, status, timing, attachment/execution mode, log path, and PID. -/// The shell variant of . +/// The session's friendly name, or null when not yet set. [Experimental(Diagnostics.Experimental)] -public partial class TaskInfoShell : TaskInfo +public sealed class NameGetResult { - /// - [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; } + /// The session name (user-set or auto-generated), or null if not yet set. + [JsonPropertyName("name")] + public string? Name { get; set; } } -/// Background tasks currently tracked by the session. +/// Identifies the target session. [Experimental(Diagnostics.Experimental)] -public sealed class TaskList +internal sealed class SessionNameGetRequest { - /// Currently tracked tasks. - [JsonPropertyName("tasks")] - public IList Tasks { get => field ??= []; set; } + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; } -/// Identifies the target session. +/// New friendly name to apply to the session. [Experimental(Diagnostics.Experimental)] -internal sealed class SessionTasksListRequest +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; } -/// 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. +/// Indicates whether the auto-generated summary was applied as the session's name. [Experimental(Diagnostics.Experimental)] -public sealed class TasksRefreshResult +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; } } -/// Identifies the target session. +/// Auto-generated session summary to apply as the session's name when no user-set name exists. [Experimental(Diagnostics.Experimental)] -internal sealed class SessionTasksRefreshRequest +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; } -/// 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). +/// Existence, contents, and resolved path of the session plan file. [Experimental(Diagnostics.Experimental)] -public sealed class TasksWaitForPendingResult +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 SessionTasksWaitForPendingRequest +internal sealed class SessionPlanReadRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } -/// Polymorphic base type discriminated by type. -[JsonPolymorphic( - TypeDiscriminatorPropertyName = "type", - UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToBaseType)] -[JsonDerivedType(typeof(TasksGetProgressResultProgressAgent), "agent")] -[JsonDerivedType(typeof(TasksGetProgressResultProgressShell), "shell")] -public partial class TasksGetProgressResultProgress +/// Replacement contents to write to the session plan file. +[Experimental(Diagnostics.Experimental)] +internal sealed class PlanUpdateRequest { - /// The type discriminator. - [JsonPropertyName("type")] - public virtual string Type { get; set; } = string.Empty; -} + /// 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; +} -/// Timestamped display line for task progress output or recent agent activity. +/// Identifies the target session. [Experimental(Diagnostics.Experimental)] -public sealed class TaskProgressLine +internal sealed class SessionPlanDeleteRequest { - /// 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; } + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; } -/// Progress snapshot for an agent task, with recent activity lines and optional latest intent. -/// The agent variant of . -public partial class TasksGetProgressResultProgressAgent : TasksGetProgressResultProgress +/// 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 { - /// - [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; } + /// 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; } - /// Recent tool execution events converted to display lines. - [JsonPropertyName("recentActivity")] - public required IList RecentActivity { get; set; } -} + /// Todo description. + [JsonPropertyName("description")] + public string? Description { get; set; } -/// Progress snapshot for a shell task, with recent stdout/stderr output and optional process ID. -/// The shell variant of . -public partial class TasksGetProgressResultProgressShell : TasksGetProgressResultProgress -{ - /// - [JsonIgnore] - public override string Type => "shell"; + /// Todo identifier. + [JsonPropertyName("id")] + public string? Id { get; set; } - /// Process ID when available. - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("pid")] - public long? Pid { get; set; } + /// Todo status. + [JsonPropertyName("status")] + public string? Status { get; set; } - /// Recent stdout/stderr lines from the running shell command. - [JsonPropertyName("recentOutput")] - public required string RecentOutput { get; set; } + /// Todo title. + [JsonPropertyName("title")] + public string? Title { get; set; } } -/// Progress information for the task, or null when no task with that ID is tracked. +/// Todo rows read from the session SQL database. Empty when no session database is available. [Experimental(Diagnostics.Experimental)] -public sealed class TasksGetProgressResult +public sealed class PlanReadSqlTodosResult { - /// Progress information for the task, discriminated by type. Returns null when no task with this ID is currently tracked. - [JsonPropertyName("progress")] - public TasksGetProgressResultProgress? Progress { get; set; } + /// 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; } } -/// Identifier of the background task to fetch progress for. +/// Identifies the target session. [Experimental(Diagnostics.Experimental)] -internal sealed class TasksGetProgressRequest +internal sealed class SessionPlanReadSqlTodosRequest { - /// 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. +/// 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 TasksGetCurrentPromotableResult +public sealed class PlanSqlTodoDependency { - /// 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; } + /// 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 SessionTasksGetCurrentPromotableRequest +internal sealed class SessionPlanReadSqlTodosWithDependenciesRequest { /// 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 +/// RPC data type for WorkspacesGetWorkspaceResultWorkspace operations. +public sealed class WorkspacesGetWorkspaceResultWorkspace { - /// Whether the task was successfully promoted to background mode. - [JsonPropertyName("promoted")] - public bool Promoted { get; set; } -} + /// Current Git branch. + [JsonPropertyName("branch")] + public string? Branch { get; set; } -/// Identifier of the task to promote to background mode. -[Experimental(Diagnostics.Experimental)] -internal sealed class TasksPromoteToBackgroundRequest -{ - /// Task identifier. + /// 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; - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { 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; } } -/// The promoted task as it now exists in background mode, omitted if no promotable task was waiting. +/// Current workspace metadata for the session, including its absolute filesystem path when available. [Experimental(Diagnostics.Experimental)] -public sealed class TasksPromoteCurrentToBackgroundResult +public sealed class WorkspacesGetWorkspaceResult { - /// 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; } + /// 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 SessionTasksPromoteCurrentToBackgroundRequest +internal sealed class SessionWorkspacesGetWorkspaceRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } -/// Indicates whether the background task was successfully cancelled. +/// Workspace metadata fields to update. [Experimental(Diagnostics.Experimental)] -public sealed class TasksCancelResult +internal sealed class WorkspacesUpdateMetadataRequest { - /// Whether the task was successfully cancelled. - [JsonPropertyName("cancelled")] - public bool Cancelled { get; set; } + /// 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; } -/// Identifier of the background task to cancel. +/// Optional session context used when creating a local workspace. [Experimental(Diagnostics.Experimental)] -internal sealed class TasksCancelRequest +internal sealed class WorkspacesEnsureRequest { - /// Task identifier. - [JsonPropertyName("id")] - public string Id { get; set; } = string.Empty; + /// 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; } -/// Indicates whether the task was removed. False when the task does not exist or is still running/idle. +/// Relative paths of files stored in the session workspace files directory. [Experimental(Diagnostics.Experimental)] -public sealed class TasksRemoveResult +public sealed class WorkspacesListFilesResult { - /// 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; } + /// Relative file paths in the workspace files directory. + [JsonPropertyName("files")] + public IList Files { get => field ??= []; set; } } -/// Identifier of the completed or cancelled task to remove from tracking. +/// Identifies the target session. [Experimental(Diagnostics.Experimental)] -internal sealed class TasksRemoveRequest +internal sealed class SessionWorkspacesListFilesRequest { - /// 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. +/// Contents of the requested workspace file as a UTF-8 string. [Experimental(Diagnostics.Experimental)] -public sealed class TasksSendMessageResult +public sealed class WorkspacesReadFileResult { - /// 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; } + /// File content as a UTF-8 string. + [JsonPropertyName("content")] + public string Content { get; set; } = string.Empty; } -/// Identifier of the target agent task, message content, and optional sender agent ID. +/// Relative path of the workspace file to read. [Experimental(Diagnostics.Experimental)] -internal sealed class TasksSendMessageRequest +internal sealed class WorkspacesReadFileRequest { - /// 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; + /// 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; } -/// Skill metadata available to a session, with name, description, source, enabled/invocable state, path, plugin, and argument hint. +/// Relative path and UTF-8 content for the workspace file to create or overwrite. [Experimental(Diagnostics.Experimental)] -public sealed class Skill +internal sealed class WorkspacesCreateFileRequest { - /// 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; + /// File content to write as a UTF-8 string. + [JsonPropertyName("content")] + public string Content { get; set; } = string.Empty; - /// Absolute path to the skill file. + /// Relative path within the workspace files directory. [JsonPropertyName("path")] - public string? Path { get; set; } + public string Path { get; set; } = string.Empty; - /// Name of the plugin that provides the skill, when source is 'plugin'. - [JsonPropertyName("pluginName")] - public string? PluginName { get; set; } + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} - /// Source location type (e.g., project, personal-copilot, plugin, builtin). - [JsonPropertyName("source")] - public SkillSource Source { get; set; } +/// 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; - /// Whether the skill can be invoked by the user as a slash command. - [JsonPropertyName("userInvocable")] - public bool UserInvocable { get; set; } + /// 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; } -/// Skills available to the session, with their enabled state. +/// Workspace checkpoints in chronological order; empty when the workspace is not enabled. [Experimental(Diagnostics.Experimental)] -public sealed class SkillList +public sealed class WorkspacesListCheckpointsResult { - /// Available skills. - [JsonPropertyName("skills")] - public IList Skills { get => field ??= []; set; } + /// 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 SessionSkillsListRequest +internal sealed class SessionWorkspacesListCheckpointsRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } -/// Skill invocation record with name, path, content, allowed tools, and turn number. +/// Checkpoint content as a UTF-8 string, or null when the checkpoint or workspace is missing. [Experimental(Diagnostics.Experimental)] -public sealed class SkillsInvokedSkill +public sealed class WorkspacesReadCheckpointResult { - /// 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. + /// Checkpoint content as a UTF-8 string, or null when the checkpoint or workspace is missing. [JsonPropertyName("content")] - public string Content { get; set; } = string.Empty; + public string? Content { get; set; } +} - /// Turn number when the skill was invoked. - [JsonPropertyName("invokedAtTurn")] - public long InvokedAtTurn { get; set; } +/// Checkpoint number to read. +[Experimental(Diagnostics.Experimental)] +internal sealed class WorkspacesReadCheckpointRequest +{ + /// Checkpoint number to read. + [JsonPropertyName("number")] + public long Number { get; set; } - /// Unique identifier for the skill. - [JsonPropertyName("name")] - public string Name { get; set; } = string.Empty; + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} - /// Path to the SKILL.md file. - [JsonPropertyName("path")] - public string Path { get; set; } = string.Empty; +/// Metadata for the persisted summary. +public sealed class WorkspacesAddSummaryResultSummary +{ } -/// Skills invoked during this session, ordered by invocation time (most recent last). -[Experimental(Diagnostics.Experimental)] -public sealed class SkillsGetInvokedResult +/// Refreshed metadata for the containing workspace. +public sealed class WorkspacesAddSummaryResultWorkspace { - /// Skills invoked during this session, ordered by invocation time (most recent last). - [JsonPropertyName("skills")] - public IList Skills { get => field ??= []; set; } } -/// Identifies the target session. +/// Persisted summary metadata and refreshed workspace metadata. [Experimental(Diagnostics.Experimental)] -internal sealed class SessionSkillsGetInvokedRequest +public sealed class WorkspacesAddSummaryResult { - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// 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; } } -/// Name of the skill to enable for the session. +/// Compaction summary checkpoint to persist. [Experimental(Diagnostics.Experimental)] -internal sealed class SkillsEnableRequest +internal sealed class WorkspacesAddSummaryRequest { - /// Name of the skill to enable. - [JsonPropertyName("name")] - public string Name { get; set; } = string.Empty; + /// 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; } -/// Name of the skill to disable for the session. +/// Rollback point for local workspace summaries. [Experimental(Diagnostics.Experimental)] -internal sealed class SkillsDisableRequest +internal sealed class WorkspacesTruncateSummariesRequest { - /// Name of the skill to disable. - [JsonPropertyName("name")] - public string Name { get; set; } = string.Empty; + /// 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; } -/// Diagnostics from reloading skill definitions, with warnings and errors as separate lists. +/// Autopilot objective file content, or null when missing. [Experimental(Diagnostics.Experimental)] -public sealed class SkillsLoadDiagnostics +public sealed class WorkspacesReadAutopilotObjectiveResult { - /// 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; } + /// 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 SessionSkillsReloadRequest +internal sealed class SessionWorkspacesReadAutopilotObjectiveRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } -/// Identifies the target session. +/// Result of writing the autopilot objective file. [Experimental(Diagnostics.Experimental)] -internal sealed class SessionSkillsEnsureLoadedRequest +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; } -/// Recorded MCP server connection failure. +/// Result of deleting the autopilot objective file. [Experimental(Diagnostics.Experimental)] -public sealed class McpServerFailureInfo +public sealed class WorkspacesDeleteAutopilotObjectiveResult { - /// 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; } + /// True when a file was deleted. + [JsonPropertyName("deleted")] + public bool Deleted { get; set; } } -/// Recorded MCP server pending-auth state. +/// Identifies the target session. [Experimental(Diagnostics.Experimental)] -public sealed class McpServerNeedsAuthInfo +internal sealed class SessionWorkspacesDeleteAutopilotObjectiveRequest { - /// epoch-ms timestamp at which the server signalled it needs authentication. - [JsonPropertyName("timestamp")] - public long Timestamp { get; set; } + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; } -/// Host-level state, omitted when no MCP host is initialized. +/// Whether the autopilot objective file exists. [Experimental(Diagnostics.Experimental)] -public sealed class McpHostState +public sealed class WorkspacesAutopilotObjectiveExistsResult { - /// 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; } + /// True when the objective file exists. + [JsonPropertyName("exists")] + public bool Exists { get; set; } } -/// MCP server status entry, including config source/plugin source and any connection error. +/// Identifies the target session. [Experimental(Diagnostics.Experimental)] -public sealed class McpServer +internal sealed class SessionWorkspacesAutopilotObjectiveExistsRequest { - /// Error message if the server failed to connect. - [JsonPropertyName("error")] - public string? Error { get; set; } - - /// Server name (config key). - [RegularExpression("^[^\\x00-\\x1f/\\x7f-\\x9f}]+(?:\\/[^\\x00-\\x1f/\\x7f-\\x9f}]+)*$")] - [UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "Safe for generated string properties: JSON Schema minLength/maxLength map to string length validation, not reflection over trimmed Count members")] - [MinLength(1)] - [JsonPropertyName("name")] - public string Name { get; set; } = string.Empty; - - /// Configuration source: user, workspace, plugin, or builtin. - [JsonPropertyName("source")] - public McpServerSource? Source { get; set; } + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} - /// Plugin name that provided this server, when source is plugin. - [JsonPropertyName("sourcePlugin")] - public string? SourcePlugin { get; set; } +/// 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; - /// Plugin version that provided this server, when source is plugin. - [JsonPropertyName("sourcePluginVersion")] - public string? SourcePluginVersion { get; set; } + /// Absolute filesystem path to the saved paste file. + [JsonPropertyName("filePath")] + public string FilePath { get; set; } = string.Empty; - /// Connection status: connected, failed, needs-auth, pending, disabled, stopped, or not_configured. - [JsonPropertyName("status")] - public McpServerStatus Status { get; set; } + /// Size of the saved file in bytes. + [JsonPropertyName("sizeBytes")] + public long SizeBytes { get; set; } } -/// MCP servers configured for the session, with their connection status and host-level state. +/// Descriptor for the saved paste file, or null when the workspace is unavailable. [Experimental(Diagnostics.Experimental)] -public sealed class McpServerList +public sealed class WorkspacesSaveLargePasteResult { - /// 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; } + /// 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; } } -/// Identifies the target session. +/// Pasted content to save as a UTF-8 file in the session workspace. [Experimental(Diagnostics.Experimental)] -internal sealed class SessionMcpListRequest +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; } -/// Normalized MCP Apps discovery metadata from a tool's `_meta.ui` block. +/// A single changed file and its unified diff. [Experimental(Diagnostics.Experimental)] -public sealed class McpToolUi +public sealed class WorkspaceDiffFileChange { - /// 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; } + /// Type of change represented by this file diff. + [JsonPropertyName("changeType")] + public WorkspaceDiffFileChangeType ChangeType { get; set; } - /// Tool visibility advertised by the server. When absent, MCP Apps defaults apply. - [JsonPropertyName("visibility")] - public IList? Visibility { get; set; } -} + /// Unified diff content for the file. Empty when the diff was truncated. + [JsonPropertyName("diff")] + public string Diff { get; set; } = string.Empty; -/// 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; } + /// Whether the diff content was omitted because it exceeded the per-file size limit. + [JsonPropertyName("isTruncated")] + public bool? IsTruncated { get; set; } - /// Tool name. - [JsonPropertyName("name")] - public string Name { get; set; } = string.Empty; + /// Original file path for renamed files. + [JsonPropertyName("oldPath")] + public string? OldPath { get; set; } - /// 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; } + /// 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; } -/// Tools exposed by the connected MCP server. Throws when the server is not connected. +/// Workspace diff result for the requested mode. [Experimental(Diagnostics.Experimental)] -public sealed class McpListToolsResult +public sealed class WorkspaceDiffResult { - /// Tools exposed by the server. - [JsonPropertyName("tools")] - public IList Tools { get => field ??= []; set; } -} + /// Default branch used for a branch diff, when branch mode was requested. + [JsonPropertyName("baseBranch")] + public string? BaseBranch { get; 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; + /// Changed files and their unified diffs. + [JsonPropertyName("changes")] + public IList Changes { get => field ??= []; set; } - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// 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; } } -/// Name of the MCP server to enable for the session. +/// Parameters for computing a workspace diff. [Experimental(Diagnostics.Experimental)] -internal sealed class McpEnableRequest +internal sealed class WorkspacesDiffRequest { - /// 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; + /// 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; } -/// Name of the MCP server to disable for the session. +/// 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)] -internal sealed class McpDisableRequest +public sealed class CompletionsGetTriggerCharactersResult { - /// 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; + /// 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 SessionMcpReloadRequest +internal sealed class SessionCompletionsGetTriggerCharactersRequest { /// 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. +/// 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 McpAllowedServer +public sealed class SessionCompletionItem { - /// Allowed server name. - [JsonPropertyName("name")] - public string Name { get; set; } = string.Empty; + /// Text spliced into the composer when the item is accepted. + [JsonPropertyName("insertText")] + public string InsertText { get; set; } = string.Empty; - /// PII-free note explaining why the server was allowed. - [JsonPropertyName("redactedNote")] - public string? RedactedNote { get; set; } + /// 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; } } -/// MCP server whose connection attempt failed. +/// 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 McpFailedServer +public sealed class CompletionsRequestResult { - /// 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; + /// Completion items in host-ranked order. + [JsonPropertyName("items")] + public IList Items { get => field ??= []; set; } } -/// MCP server filtered by policy, with name, reason, and optional redacted reason. +/// Request host-driven completions for the current composer input. [Experimental(Diagnostics.Experimental)] -public sealed class McpFilteredServer +internal sealed class CompletionsRequestRequest { - /// 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; + /// Cursor offset within `text`, in UTF-16 code units. + [JsonPropertyName("offset")] + public long Offset { get; set; } - /// Human-readable filter reason. - [JsonPropertyName("reason")] - public string Reason { get; set; } = string.Empty; + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; - /// PII-free filter reason. - [JsonPropertyName("redactedReason")] - public string? RedactedReason { get; set; } + /// The full composed composer input. + [JsonPropertyName("text")] + public string Text { get; set; } = string.Empty; } -/// MCP server startup filtering result. +/// Instruction sources loaded for the session, in merge order. [Experimental(Diagnostics.Experimental)] -internal sealed class McpStartServersResult +public sealed class InstructionsGetSourcesResult { - /// 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; } + /// Instruction sources for the session. + [JsonPropertyName("sources")] + public IList Sources { get => field ??= []; set; } } -/// Opaque MCP reload configuration. +/// Identifies the target session. [Experimental(Diagnostics.Experimental)] -internal sealed class McpReloadWithConfigRequest +internal sealed class SessionInstructionsGetSourcesRequest { /// 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. +/// Indicates whether fleet mode was successfully activated. [Experimental(Diagnostics.Experimental)] -public sealed class McpExecuteSamplingResult +public sealed class FleetStartResult { + /// Whether fleet mode was successfully activated. + [JsonPropertyName("started")] + public bool Started { get; set; } } -/// Outcome of an MCP sampling execution: success result, failure error, or cancellation. +/// Optional user prompt to combine with the fleet orchestration instructions. [Experimental(Diagnostics.Experimental)] -public sealed class McpSamplingExecutionResult +internal sealed class FleetStartRequest { - /// 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; } + /// Optional user prompt to combine with fleet instructions. + [JsonPropertyName("prompt")] + public string? Prompt { 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; } + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; } -/// 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. +/// Agents available to the session. [Experimental(Diagnostics.Experimental)] -public sealed class McpExecuteSamplingRequest +public sealed class AgentList { + /// Available agents. + [JsonPropertyName("agents")] + public IList Agents { get => field ??= []; set; } } -/// Identifiers and raw MCP CreateMessageRequest params used to run a sampling inference. +/// RPC data type for SessionAgentList operations. [Experimental(Diagnostics.Experimental)] -internal sealed class McpExecuteSamplingParams +public sealed class SessionAgentListRequest { - /// 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; + /// 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; } - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// 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; } } -/// Indicates whether an in-flight sampling execution with the given requestId was found and cancelled. +/// RPC data type for SessionAgentListRequestWithSession operations. [Experimental(Diagnostics.Experimental)] -public sealed class McpCancelSamplingExecutionResult +internal sealed class SessionAgentListRequestWithSession { - /// 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; } -} + /// 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; } -/// 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; + /// 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; } -/// Env-value mode recorded on the session after the update. +/// An in-memory authored prompt override for an available agent. [Experimental(Diagnostics.Experimental)] -public sealed class McpSetEnvValueModeResult +internal sealed class AgentSetPromptRequest { - /// Mode recorded on the session after the update. - [JsonPropertyName("mode")] - public McpSetEnvValueModeDetails Mode { get; set; } -} + /// Stable effective agent id. Plugin namespace separators are normalized. + [JsonPropertyName("id")] + public string Id { get; set; } = string.Empty; -/// 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; } + /// 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; } -/// Indicates whether the auto-managed `github` MCP server was removed (false when nothing to remove). +/// The currently selected custom agent, or null when using the default agent. [Experimental(Diagnostics.Experimental)] -public sealed class McpRemoveGitHubResult +public sealed class AgentGetCurrentResult { - /// 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; } + /// 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 SessionMcpRemoveGitHubRequest +internal sealed class SessionAgentGetCurrentRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } -/// Result of configuring GitHub MCP. +/// The newly selected custom agent. [Experimental(Diagnostics.Experimental)] -internal sealed class McpConfigureGitHubResult +public sealed class AgentSelectResult { - /// Whether GitHub MCP configuration changed. - [JsonPropertyName("changed")] - public bool Changed { get; set; } + /// The newly selected custom agent. + [JsonPropertyName("agent")] + public AgentInfo Agent { get => field ??= new(); set; } } -/// Credential-free authentication identity used to configure GitHub MCP. +/// Name of the custom agent to select for subsequent turns. [Experimental(Diagnostics.Experimental)] -internal sealed class McpConfigureGitHubRequest +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; } -/// 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. +/// Identifies the target session. [Experimental(Diagnostics.Experimental)] -internal sealed class McpStartServerRequest +internal sealed class SessionAgentDeselectRequest { - /// 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. +/// Custom agents available to the session after reloading definitions from disk. [Experimental(Diagnostics.Experimental)] -internal sealed class McpRestartServerRequest +public sealed class AgentReloadResult { - /// 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; + /// 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; } -/// Server name for an individual MCP server stop. +/// Identifier assigned to the newly started background agent task. [Experimental(Diagnostics.Experimental)] -internal sealed class McpStopServerRequest +public sealed class TasksStartAgentResult { - /// 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; + /// Generated agent ID for the background task. + [JsonPropertyName("agentId")] + public string AgentId { get; set; } = string.Empty; } -/// Registration parameters for an external MCP client. +/// Agent type, prompt, name, and optional description and model override for the new task. [Experimental(Diagnostics.Experimental)] -internal sealed class McpRegisterExternalClientRequest +internal sealed class TasksStartAgentRequest { - /// Logical server name for the external client. - [JsonPropertyName("serverName")] - public string ServerName { get; set; } = string.Empty; + /// 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; } -/// 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. +/// Tracked task union returned by task APIs, containing either an agent task or a shell task. +/// Polymorphic base type discriminated by type. [Experimental(Diagnostics.Experimental)] [JsonPolymorphic( - TypeDiscriminatorPropertyName = "kind", + TypeDiscriminatorPropertyName = "type", UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToBaseType)] -[JsonDerivedType(typeof(McpOauthPendingRequestResponseToken), "token")] -[JsonDerivedType(typeof(McpOauthPendingRequestResponseCancelled), "cancelled")] -public partial class McpOauthPendingRequestResponse +[JsonDerivedType(typeof(TaskInfoAgent), "agent")] +[JsonDerivedType(typeof(TaskInfoShell), "shell")] +public partial class TaskInfo { /// The type discriminator. - [JsonPropertyName("kind")] - public virtual string Kind { get; set; } = string.Empty; + [JsonPropertyName("type")] + public virtual string Type { get; set; } = string.Empty; } -/// The token variant of . +/// 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 McpOauthPendingRequestResponseToken : McpOauthPendingRequestResponse +public partial class TaskInfoAgent : TaskInfo { /// [JsonIgnore] - public override string Kind => "token"; + public override string Type => "agent"; - /// Access token acquired by the SDK host. - [JsonPropertyName("accessToken")] - public required string AccessToken { get; set; } + /// ISO 8601 timestamp when the current active period began. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("activeStartedAt")] + public DateTimeOffset? ActiveStartedAt { get; set; } - /// Token lifetime in seconds, if known. + /// Accumulated active execution time in milliseconds. + [JsonConverter(typeof(MillisecondsTimeSpanConverter))] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("expiresIn")] - public long? ExpiresIn { get; set; } + [JsonPropertyName("activeTimeMs")] + public TimeSpan? ActiveTime { get; set; } - /// OAuth token type. Defaults to Bearer when omitted. + /// 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("tokenType")] - public string? TokenType { get; set; } + [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; } } -/// The cancelled variant of . +/// 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 McpOauthPendingRequestResponseCancelled : McpOauthPendingRequestResponse +public partial class TaskInfoShell : TaskInfo { /// [JsonIgnore] - public override string Kind => "cancelled"; + 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; } } -/// Pending MCP OAuth request ID and host-provided token or cancellation response. +/// Background tasks currently tracked by the session. [Experimental(Diagnostics.Experimental)] -internal sealed class McpOauthHandlePendingRequest +public sealed class TaskList { - /// 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; } + /// 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; } -/// Identifies the MCP server whose persisted OAuth credentials were updated. +/// 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)] -internal sealed class McpOauthAuthenticationStateChangedRequest +public sealed class TasksRefreshResult { - /// 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; } +} +/// Identifies the target session. +[Experimental(Diagnostics.Experimental)] +internal sealed class SessionTasksRefreshRequest +{ /// 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. +/// 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 McpOauthLoginResult +public sealed class TasksWaitForPendingResult { - /// 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. +/// Identifies the target session. [Experimental(Diagnostics.Experimental)] -internal sealed class McpOauthLoginRequest +internal sealed class SessionTasksWaitForPendingRequest { - /// 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)] +/// Polymorphic base type discriminated by type. [JsonPolymorphic( - TypeDiscriminatorPropertyName = "status", + TypeDiscriminatorPropertyName = "type", 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 +[JsonDerivedType(typeof(TasksGetProgressResultProgressAgent), "agent")] +[JsonDerivedType(typeof(TasksGetProgressResultProgressShell), "shell")] +public partial class TasksGetProgressResultProgress { /// The type discriminator. - [JsonPropertyName("status")] - public virtual string Status { get; set; } = string.Empty; + [JsonPropertyName("type")] + public virtual string Type { get; set; } = string.Empty; } -/// The no-auth-required variant of . +/// Timestamped display line for task progress output or recent agent activity. [Experimental(Diagnostics.Experimental)] -public partial class McpOauthProbeResultNoAuthRequired : McpOauthProbeResult +public sealed class TaskProgressLine { - /// - [JsonIgnore] - public override string Status => "no-auth-required"; + /// Display message, e.g., "▸ bash", "✓ edit src/foo.ts". + [JsonPropertyName("message")] + public string Message { get; set; } = string.Empty; - /// HTTP response returned by the server. - [JsonPropertyName("httpResponse")] - public required McpOauthHttpResponse HttpResponse { get; set; } + /// ISO 8601 timestamp when this event occurred. + [JsonPropertyName("timestamp")] + public DateTimeOffset Timestamp { get; set; } } -/// The authenticated variant of . -[Experimental(Diagnostics.Experimental)] -public partial class McpOauthProbeResultAuthenticated : McpOauthProbeResult +/// Progress snapshot for an agent task, with recent activity lines and optional latest intent. +/// The agent variant of . +public partial class TasksGetProgressResultProgressAgent : TasksGetProgressResultProgress { /// [JsonIgnore] - public override string Status => "authenticated"; + public override string Type => "agent"; - /// HTTP response returned by the server. - [JsonPropertyName("httpResponse")] - public required McpOauthHttpResponse HttpResponse { get; set; } + /// 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; } } -/// The needs-auth variant of . -[Experimental(Diagnostics.Experimental)] -public partial class McpOauthProbeResultNeedsAuth : McpOauthProbeResult +/// Progress snapshot for a shell task, with recent stdout/stderr output and optional process ID. +/// The shell variant of . +public partial class TasksGetProgressResultProgressShell : TasksGetProgressResultProgress { /// [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; } + public override string Type => "shell"; - /// Parsed WWW-Authenticate challenge parameters, when present and parseable. + /// Process ID when available. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("wwwAuthenticateParams")] - public McpOauthWWWAuthenticateParams? WwwAuthenticateParams { get; set; } + [JsonPropertyName("pid")] + public long? Pid { get; set; } + + /// Recent stdout/stderr lines from the running shell command. + [JsonPropertyName("recentOutput")] + public required string RecentOutput { get; set; } } -/// The failed variant of . +/// Progress information for the task, or null when no task with that ID is tracked. [Experimental(Diagnostics.Experimental)] -public partial class McpOauthProbeResultFailed : McpOauthProbeResult +public sealed class TasksGetProgressResult { - /// - [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; } + /// Progress information for the task, discriminated by type. Returns null when no task with this ID is currently tracked. + [JsonPropertyName("progress")] + public TasksGetProgressResultProgress? Progress { get; set; } } -/// Remote MCP server name for a passive OAuth status probe. +/// Identifier of the background task to fetch progress for. [Experimental(Diagnostics.Experimental)] -internal sealed class McpOauthProbeRequest +internal sealed class TasksGetProgressRequest { - /// 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; + /// 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; } -/// Indicates whether the pending MCP OAuth response was accepted. +/// The first sync-waiting task that can currently be promoted to background mode. [Experimental(Diagnostics.Experimental)] -public sealed class McpOauthRespondResult +public sealed class TasksGetCurrentPromotableResult { - /// Whether the response was accepted. False if the request was unknown, timed out, or already resolved. - [JsonPropertyName("success")] - public bool Success { get; set; } + /// 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; } } -/// Pending MCP OAuth request id to respond to. +/// Identifies the target session. [Experimental(Diagnostics.Experimental)] -internal sealed class McpOauthRespondRequest +internal sealed class SessionTasksGetCurrentPromotableRequest { - /// 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. +/// Indicates whether the task was successfully promoted to background mode. [Experimental(Diagnostics.Experimental)] -public sealed class McpHeadersHandlePendingHeadersRefreshRequestResult +public sealed class TasksPromoteToBackgroundResult { - /// Whether the response was accepted. False if the request was unknown, timed out, or already resolved. - [JsonPropertyName("success")] - public bool Success { get; set; } + /// Whether the task was successfully promoted to background mode. + [JsonPropertyName("promoted")] + public bool Promoted { get; set; } } -/// Host response: supply dynamic headers or decline this refresh. -/// Polymorphic base type discriminated by kind. +/// Identifier of the task to promote to background mode. [Experimental(Diagnostics.Experimental)] -[JsonPolymorphic( - TypeDiscriminatorPropertyName = "kind", - UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToBaseType)] -[JsonDerivedType(typeof(McpHeadersHandlePendingHeadersRefreshRequestHeaders), "headers")] -[JsonDerivedType(typeof(McpHeadersHandlePendingHeadersRefreshRequestNone), "none")] -public partial class McpHeadersHandlePendingHeadersRefreshRequest +internal sealed class TasksPromoteToBackgroundRequest { - /// The type discriminator. - [JsonPropertyName("kind")] - public virtual string Kind { get; set; } = string.Empty; -} + /// Task identifier. + [JsonPropertyName("id")] + public string Id { get; set; } = string.Empty; + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} -/// The headers variant of . +/// The promoted task as it now exists in background mode, omitted if no promotable task was waiting. [Experimental(Diagnostics.Experimental)] -public partial class McpHeadersHandlePendingHeadersRefreshRequestHeaders : McpHeadersHandlePendingHeadersRefreshRequest +public sealed class TasksPromoteCurrentToBackgroundResult { - /// - [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 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; } } -/// The none variant of . +/// Identifies the target session. [Experimental(Diagnostics.Experimental)] -public partial class McpHeadersHandlePendingHeadersRefreshRequestNone : McpHeadersHandlePendingHeadersRefreshRequest +internal sealed class SessionTasksPromoteCurrentToBackgroundRequest { - /// - [JsonIgnore] - public override string Kind => "none"; + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; } -/// MCP headers refresh request id and the host response. +/// Indicates whether the background task was successfully cancelled. [Experimental(Diagnostics.Experimental)] -internal sealed class McpHeadersHandlePendingHeadersRefreshRequestRequest +public sealed class TasksCancelResult { - /// Headers refresh request identifier from mcp.headers_refresh_required. - [JsonPropertyName("requestId")] - public string RequestId { get; set; } = string.Empty; + /// Whether the task was successfully cancelled. + [JsonPropertyName("cancelled")] + public bool Cancelled { get; set; } +} - /// Host response: supply dynamic headers or decline this refresh. - [JsonPropertyName("result")] - public McpHeadersHandlePendingHeadersRefreshRequest Result { get => field ??= new(); 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; } -/// MCP Apps resource content with URI, optional MIME type, text or base64 blob, and resource metadata. +/// Indicates whether the task was removed. False when the task does not exist or is still running/idle. [Experimental(Diagnostics.Experimental)] -public sealed class McpAppsResourceContent +public sealed class TasksRemoveResult { - /// 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; } + /// 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; } } -/// MCP server and resource URI to fetch. +/// Identifier of the completed or cancelled task to remove from tracking. [Experimental(Diagnostics.Experimental)] -internal sealed class McpAppsReadResourceRequest +internal sealed class TasksRemoveRequest { - /// 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; + /// Task identifier. + [JsonPropertyName("id")] + public string Id { 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. +/// Indicates whether the message was delivered, with an error message when delivery failed. [Experimental(Diagnostics.Experimental)] -internal sealed class McpAppsListToolsRequest +public sealed class TasksSendMessageResult { - /// **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; + /// Error message if delivery failed. + [JsonPropertyName("error")] + public string? Error { get; set; } - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// Whether the message was successfully delivered or steered. + [JsonPropertyName("sent")] + public bool Sent { get; set; } } -/// MCP server, tool name, and arguments to invoke from an MCP App view. +/// Identifier of the target agent task, message content, and optional sender agent ID. [Experimental(Diagnostics.Experimental)] -internal sealed class McpAppsCallToolRequest +internal sealed class TasksSendMessageRequest { - /// Tool arguments. - [JsonPropertyName("arguments")] - public IDictionary? Arguments { get; set; } + /// Agent ID of the sender, if sent on behalf of another agent. + [JsonPropertyName("fromAgentId")] + public string? FromAgentId { 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; + /// Agent task identifier. + [JsonPropertyName("id")] + public string Id { 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; + /// 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; - - /// MCP tool name. - [JsonPropertyName("toolName")] - public string ToolName { get; set; } = string.Empty; } -/// Host context advertised to MCP App guests. +/// Skill metadata available to a session, with name, description, source, enabled/invocable state, path, plugin, and argument hint. [Experimental(Diagnostics.Experimental)] -public sealed class McpAppsSetHostContextDetails +public sealed class Skill { - /// Display modes the host supports. - [JsonPropertyName("availableDisplayModes")] - public IList? AvailableDisplayModes { get; set; } + /// Optional freeform hint describing the skill's expected arguments, from the `argument-hint` frontmatter field. + [JsonPropertyName("argumentHint")] + public string? ArgumentHint { get; set; } - /// Current display mode (SEP-1865). - [JsonPropertyName("displayMode")] - public McpAppsSetHostContextDetailsDisplayMode? DisplayMode { get; set; } + /// Canonical slash command name used to invoke the skill, without the leading '/'. + [JsonPropertyName("commandName")] + public string? CommandName { get; set; } - /// BCP-47 locale, e.g. 'en-US'. - [JsonPropertyName("locale")] - public string? Locale { get; set; } + /// Description of what the skill does. + [JsonPropertyName("description")] + public string Description { get; set; } = string.Empty; - /// Platform type for responsive design. - [JsonPropertyName("platform")] - public McpAppsSetHostContextDetailsPlatform? Platform { get; set; } + /// Whether the skill is currently enabled. + [JsonPropertyName("enabled")] + public bool Enabled { get; set; } - /// UI theme preference per SEP-1865. - [JsonPropertyName("theme")] - public McpAppsSetHostContextDetailsTheme? Theme { get; set; } + /// Unique identifier for the skill. + [JsonPropertyName("name")] + public string Name { get; set; } = string.Empty; - /// IANA timezone, e.g. 'America/New_York'. - [JsonPropertyName("timeZone")] - public string? TimeZone { get; set; } + /// Absolute path to the skill file. + [JsonPropertyName("path")] + public string? Path { get; set; } - /// Host application identifier. - [JsonPropertyName("userAgent")] - public string? UserAgent { 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; } } -/// Host context to advertise to MCP App guests. +/// Skills available to the session, with their enabled state. [Experimental(Diagnostics.Experimental)] -internal sealed class McpAppsSetHostContextRequest +public sealed class SkillList { - /// Host context advertised to MCP App guests. - [JsonPropertyName("context")] - public McpAppsSetHostContextDetails Context { get => field ??= new(); set; } + /// 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; } -/// Current host context. +/// Skill invocation record with name, path, content, allowed tools, and turn number. [Experimental(Diagnostics.Experimental)] -public sealed class McpAppsHostContextDetails +public sealed class SkillsInvokedSkill { - /// 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; } + /// Tools that should be auto-approved when this skill is active, captured at invocation time. + [JsonPropertyName("allowedTools")] + public IList? AllowedTools { get; set; } - /// Platform type for responsive design. - [JsonPropertyName("platform")] - public McpAppsHostContextDetailsPlatform? Platform { get; set; } + /// Full content of the skill file. + [JsonPropertyName("content")] + public string Content { get; set; } = string.Empty; - /// UI theme preference per SEP-1865. - [JsonPropertyName("theme")] - public McpAppsHostContextDetailsTheme? Theme { get; set; } + /// Turn number when the skill was invoked. + [JsonPropertyName("invokedAtTurn")] + public long InvokedAtTurn { get; set; } - /// IANA timezone, e.g. 'America/New_York'. - [JsonPropertyName("timeZone")] - public string? TimeZone { get; set; } + /// Unique identifier for the skill. + [JsonPropertyName("name")] + public string Name { get; set; } = string.Empty; - /// Host application identifier. - [JsonPropertyName("userAgent")] - public string? UserAgent { get; set; } + /// Path to the SKILL.md file. + [JsonPropertyName("path")] + public string Path { get; set; } = string.Empty; } -/// Current host context advertised to MCP App guests. +/// Skills invoked during this session, ordered by invocation time (most recent last). [Experimental(Diagnostics.Experimental)] -public sealed class McpAppsHostContext +public sealed class SkillsGetInvokedResult { - /// Current host context. - [JsonPropertyName("context")] - public McpAppsHostContextDetails Context { get => field ??= new(); set; } + /// 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 SessionMcpAppsGetHostContextRequest +internal sealed class SessionSkillsGetInvokedRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } -/// Capability negotiation snapshot. +/// Name of the skill to enable for the session. [Experimental(Diagnostics.Experimental)] -public sealed class McpAppsDiagnoseCapability +internal sealed class SkillsEnableRequest { - /// 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; } + /// Name of the skill to enable. + [JsonPropertyName("name")] + public string Name { get; set; } = string.Empty; - /// Whether the session has the `mcp-apps` capability. - [JsonPropertyName("sessionHasMcpApps")] - public bool SessionHasMcpApps { get; set; } + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; } -/// What the server returned for this session. +/// Name of the skill to disable for the session. [Experimental(Diagnostics.Experimental)] -public sealed class McpAppsDiagnoseServer +internal sealed class SkillsDisableRequest { - /// 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; } + /// Name of the skill to disable. + [JsonPropertyName("name")] + public string Name { get; set; } = string.Empty; - /// Tools whose `_meta.ui` is populated (resourceUri and/or visibility set). - [JsonPropertyName("toolsWithUiMeta")] - public double ToolsWithUiMeta { get; set; } + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; } -/// Diagnostic snapshot of MCP Apps wiring for the named server. +/// Diagnostics from reloading skill definitions, with warnings and errors as separate lists. [Experimental(Diagnostics.Experimental)] -public sealed class McpAppsDiagnoseResult +public sealed class SkillsLoadDiagnostics { - /// Capability negotiation snapshot. - [JsonPropertyName("capability")] - public McpAppsDiagnoseCapability Capability { get => field ??= new(); set; } + /// Errors emitted while loading skills (e.g. skills that failed to load entirely). + [JsonPropertyName("errors")] + public IList Errors { get => field ??= []; set; } - /// What the server returned for this session. - [JsonPropertyName("server")] - public McpAppsDiagnoseServer Server { get => field ??= new(); set; } + /// Warnings emitted while loading skills (e.g. skills that loaded but had issues). + [JsonPropertyName("warnings")] + public IList Warnings { get => field ??= []; set; } } -/// MCP server to diagnose MCP Apps wiring for. +/// Identifies the target session. [Experimental(Diagnostics.Experimental)] -internal sealed class McpAppsDiagnoseRequest +internal sealed class SessionSkillsReloadRequest { - /// 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. +/// Identifies the target session. [Experimental(Diagnostics.Experimental)] -public sealed class McpResourceContent +internal sealed class SessionSkillsEnsureLoadedRequest { - /// 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; + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; } -/// Resource contents returned by the MCP server. +/// Recorded MCP server connection failure. [Experimental(Diagnostics.Experimental)] -public sealed class McpResourcesReadResult +public sealed class McpServerFailureInfo { - /// Resource contents returned by the server. - [JsonPropertyName("contents")] - public IList Contents { get => field ??= []; set; } + /// 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; } } -/// MCP server and resource URI to fetch. +/// Recorded MCP server pending-auth state. [Experimental(Diagnostics.Experimental)] -internal sealed class McpResourcesReadRequest +public sealed class McpServerNeedsAuthInfo { - /// 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; + /// epoch-ms timestamp at which the server signalled it needs authentication. + [JsonPropertyName("timestamp")] + public long Timestamp { get; set; } } -/// Standard MCP resource annotations plus preserved non-standard annotation fields. +/// Host-level state, omitted when no MCP host is initialized. [Experimental(Diagnostics.Experimental)] -public sealed class McpResourceAnnotations +public sealed class McpHostState { - /// 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; } + /// Names of currently-connected MCP clients. + [JsonPropertyName("clients")] + public IList Clients { get => field ??= []; set; } - /// Priority hint for model/client use. - [JsonPropertyName("priority")] - public double? Priority { get; set; } -} + /// Configured servers that are explicitly disabled. + [JsonPropertyName("disabledServers")] + public IList DisabledServers { get => field ??= []; 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; } + /// Map of server name to recorded connection failure. + [JsonPropertyName("failedServers")] + public IDictionary FailedServers { get => field ??= new Dictionary(); set; } - /// Icon MIME type, when known. - [JsonPropertyName("mimeType")] - public string? MimeType { get; set; } + /// Configured servers filtered out by MCP server policy. + [JsonPropertyName("filteredServers")] + public IList FilteredServers { get => field ??= []; set; } - /// Icon sizes hint. - [JsonPropertyName("sizes")] - public string? Sizes { get; set; } + /// Whether third-party MCP servers are policy-enabled for this session. + [JsonPropertyName("mcp3pEnabled")] + public bool Mcp3pEnabled { get; set; } - /// Icon URI. - [JsonPropertyName("src")] - public string Src { get; set; } = string.Empty; + /// Map of server name to recorded pending-auth state. + [JsonPropertyName("needsAuthServers")] + public IDictionary NeedsAuthServers { get => field ??= new Dictionary(); set; } - /// Theme hint for this icon. - [JsonPropertyName("theme")] - public string? Theme { get; set; } + /// Names of servers with in-flight connection attempts. + [JsonPropertyName("pendingConnections")] + public IList PendingConnections { get => field ??= []; 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`. +/// MCP server status entry, including config source/plugin source and any connection error. [Experimental(Diagnostics.Experimental)] -public sealed class McpResource +public sealed class McpServer { - /// 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; } + /// Error message if the server failed to connect. + [JsonPropertyName("error")] + public string? Error { get; set; } - /// The programmatic name of the resource. + /// 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; - /// Resource size in bytes, when known. - [JsonPropertyName("size")] - public long? Size { get; set; } + /// Configuration source: user, workspace, plugin, or builtin. + [JsonPropertyName("source")] + public McpServerSource? Source { get; set; } - /// Optional human-readable display title. - [JsonPropertyName("title")] - public string? Title { get; set; } + /// Plugin name that provided this server, when source is plugin. + [JsonPropertyName("sourcePlugin")] + public string? SourcePlugin { get; set; } - /// The resource URI (e.g. ui://... or file:///...). - [JsonPropertyName("uri")] - public string Uri { get; set; } = string.Empty; + /// 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; } } -/// One page of resources advertised by the named MCP server. +/// MCP servers configured for the session, with their connection status and host-level state. [Experimental(Diagnostics.Experimental)] -public sealed class McpResourcesListResult +public sealed class McpServerList { - /// Opaque cursor for the next page, if the server has more resources. - [JsonPropertyName("nextCursor")] - public string? NextCursor { get; set; } + /// Host-level state, omitted when no MCP host is initialized. + [JsonPropertyName("host")] + public McpHostState? Host { get; set; } - /// Resources advertised by the server (proxied MCP `resources/list`). - [JsonPropertyName("resources")] - public IList Resources { get => field ??= []; set; } + /// Configured MCP servers. + [JsonPropertyName("servers")] + public IList Servers { get => field ??= []; set; } } -/// MCP server whose resources to enumerate. +/// Identifies the target session. [Experimental(Diagnostics.Experimental)] -internal sealed class McpResourcesListRequest +internal sealed class SessionMcpListRequest { - /// 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`. +/// Normalized MCP Apps discovery metadata from a tool's `_meta.ui` block. [Experimental(Diagnostics.Experimental)] -public sealed class McpResourceTemplate +public sealed class McpToolUi { - /// 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; } + /// 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; } - /// Model/client annotations associated with this template. - [JsonPropertyName("annotations")] - public McpResourceAnnotations? Annotations { get; set; } + /// Tool visibility advertised by the server. When absent, MCP Apps defaults apply. + [JsonPropertyName("visibility")] + public IList? Visibility { get; set; } +} - /// Optional description of what this template is for. +/// 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; } - /// 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. + /// Tool name. [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; - /// Optional human-readable display title. - [JsonPropertyName("title")] - public string? Title { get; set; } + /// 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; } +} - /// An RFC 6570 URI template for constructing resource URIs. - [JsonPropertyName("uriTemplate")] - public string UriTemplate { get; set; } = string.Empty; +/// 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; } } -/// One page of resource templates advertised by the named MCP server. +/// Server name whose tool list should be returned. [Experimental(Diagnostics.Experimental)] -public sealed class McpResourcesListTemplatesResult +internal sealed class McpListToolsRequest { - /// Opaque cursor for the next page, if the server has more resource templates. - [JsonPropertyName("nextCursor")] - public string? NextCursor { get; set; } + /// 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; - /// Resource templates advertised by the server (proxied MCP `resources/templates/list`). - [JsonPropertyName("resourceTemplates")] - public IList ResourceTemplates { get => field ??= []; set; } + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; } -/// MCP server whose resource templates to enumerate. +/// Name of the MCP server to enable for the session. [Experimental(Diagnostics.Experimental)] -internal sealed class McpResourcesListTemplatesRequest +internal sealed class McpEnableRequest { - /// 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. + /// 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)] @@ -8783,8152 +8993,11037 @@ internal sealed class McpResourcesListTemplatesRequest public string SessionId { get; set; } = string.Empty; } -/// Session plugin metadata, with name, marketplace, optional version, and enabled state. +/// Name of the MCP server to disable for the session. [Experimental(Diagnostics.Experimental)] -public sealed class Plugin +internal sealed class McpDisableRequest { - /// 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; + /// 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; - /// Plugin name. - [JsonPropertyName("name")] - public string Name { get; set; } = string.Empty; + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} - /// Installed version. - [JsonPropertyName("version")] - public string? Version { get; set; } +/// Identifies the target session. +[Experimental(Diagnostics.Experimental)] +internal sealed class SessionMcpReloadRequest +{ + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; } -/// Plugins installed for the session, with their enabled state and version metadata. +/// Result of moving in-flight MCP loading to the background. [Experimental(Diagnostics.Experimental)] -public sealed class PluginList +public sealed class MoveMcpLoadingToBackgroundResult { - /// Installed plugins. - [JsonPropertyName("plugins")] - public IList Plugins { get => field ??= []; set; } + /// 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 SessionPluginsListRequest +internal sealed class SessionMcpMoveLoadingToBackgroundRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } -/// RPC data type for SessionPluginsReload operations. +/// MCP server allowed by policy, with server name and optional PII-free explanatory note. [Experimental(Diagnostics.Experimental)] -public sealed class SessionPluginsReloadRequest +public sealed class McpAllowedServer { - /// 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; } + /// Allowed server name. + [JsonPropertyName("name")] + public string Name { get; set; } = string.Empty; - /// 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; } + /// PII-free note explaining why the server was allowed. + [JsonPropertyName("redactedNote")] + public string? RedactedNote { 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; } +/// 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; } - /// Reload MCP server connections after refreshing plugins. Defaults to true. - [JsonPropertyName("reloadMcp")] - public bool? ReloadMcp { get; set; } + /// The config key of the server that failed to connect. + [JsonPropertyName("name")] + public string Name { get; set; } = string.Empty; } -/// RPC data type for SessionPluginsReloadRequestWithSession operations. +/// MCP server filtered by policy, with name, reason, and optional redacted reason. [Experimental(Diagnostics.Experimental)] -internal sealed class SessionPluginsReloadRequestWithSession +public sealed class McpFilteredServer { - /// 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; } + /// 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; } - /// Re-run custom-agent discovery after refreshing plugins. Defaults to true. - [JsonPropertyName("reloadCustomAgents")] - public bool? ReloadCustomAgents { get; set; } + /// Filtered server name. + [JsonPropertyName("name")] + public string Name { get; set; } = string.Empty; - /// 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; } + /// Human-readable filter reason. + [JsonPropertyName("reason")] + public string Reason { get; set; } = string.Empty; - /// 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; } + /// PII-free filter reason. + [JsonPropertyName("redactedReason")] + public string? RedactedReason { get; set; } +} - /// Reload MCP server connections after refreshing plugins. Defaults to true. - [JsonPropertyName("reloadMcp")] - public bool? ReloadMcp { 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; } -/// 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. +/// 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 ProviderSessionToken +public sealed class McpExecuteSamplingResult { - /// 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; +/// 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; } - /// 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; } + /// Error description, present when action='failure'. + [JsonPropertyName("error")] + public string? Error { get; set; } - /// The short-lived token value. - [JsonPropertyName("token")] - public string Token { 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. + [JsonPropertyName("result")] + public McpExecuteSamplingResult? Result { get; set; } } -/// A snapshot of the provider endpoint the session is currently configured to talk to. +/// 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 ProviderEndpoint +public sealed class McpExecuteSamplingRequest { - /// 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; } +/// 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; } - /// 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; } + /// 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; } - /// Transport to be used for provider requests. - [JsonPropertyName("transport")] - public ProviderEndpointTransport? Transport { get; 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; - /// Provider family. Matches the `type` field of a BYOK provider config. - [JsonPropertyName("type")] - public ProviderEndpointType Type { get; set; } + /// Name of the MCP server that initiated the sampling request. + [JsonPropertyName("serverName")] + public string ServerName { get; set; } = string.Empty; - /// Wire API to be used, when required for the provider type. - [JsonPropertyName("wireApi")] - public ProviderEndpointWireApi? WireApi { get; set; } + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; } -/// RPC data type for SessionProviderGetEndpoint operations. +/// Indicates whether an in-flight sampling execution with the given requestId was found and cancelled. [Experimental(Diagnostics.Experimental)] -public sealed class SessionProviderGetEndpointRequest +public sealed class McpCancelSamplingExecutionResult { - /// 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; } + /// 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; } } -/// RPC data type for SessionProviderGetEndpointRequestWithSession operations. +/// The requestId previously passed to executeSampling that should be cancelled. [Experimental(Diagnostics.Experimental)] -internal sealed class SessionProviderGetEndpointRequestWithSession +internal sealed class McpCancelSamplingExecutionParams { - /// 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; } + /// 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; } -/// The selectable model entries synthesized for the models added by this call. +/// Env-value mode recorded on the session after the update. [Experimental(Diagnostics.Experimental)] -public sealed class ProviderAddResult +public sealed class McpSetEnvValueModeResult { - /// 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; } + /// Mode recorded on the session after the update. + [JsonPropertyName("mode")] + public McpSetEnvValueModeDetails Mode { get; set; } } -/// A BYOK model definition referencing a named provider. +/// Mode controlling how MCP server env values are resolved (`direct` or `indirect`). [Experimental(Diagnostics.Experimental)] -public sealed class ProviderModelConfig +internal sealed class McpSetEnvValueModeParams { - /// 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; + /// 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; } - /// The model name sent to the provider API for inference. Defaults to `id`. - [JsonPropertyName("wireModel")] - public string? WireModel { get; set; } + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; } -/// Azure-specific provider options. +/// Indicates whether the auto-managed `github` MCP server was removed (false when nothing to remove). [Experimental(Diagnostics.Experimental)] -public sealed class ProviderConfigAzure +public sealed class McpRemoveGitHubResult { - /// API version. When set, uses the versioned deployment route. When omitted, uses the GA versionless v1 route. - [JsonPropertyName("apiVersion")] - public string? ApiVersion { get; set; } + /// 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; } } -/// External SDK input for a named custom model provider. Ingested by the native protocol boundary before host dispatch. +/// Identifies the target session. [Experimental(Diagnostics.Experimental)] -public sealed class NamedProviderConfig +internal sealed class SessionMcpRemoveGitHubRequest { - /// 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; } + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} - /// Base URL for provider API requests. - [JsonPropertyName("baseUrl")] - public string BaseUrl { 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; } +} - /// Static bearer token used to authenticate provider requests. - [JsonPropertyName("bearerToken")] - public string? BearerToken { 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; +} - /// Whether the host supplies bearer tokens dynamically. - [JsonPropertyName("hasBearerTokenProvider")] - public bool? HasBearerTokenProvider { get; set; } +/// 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; } - /// Additional HTTP headers included with provider requests. - [JsonPropertyName("headers")] - public IDictionary? Headers { get; set; } + /// Name of the MCP server to start. + [JsonPropertyName("serverName")] + public string ServerName { get; set; } = string.Empty; - /// Unique provider name used to qualify model selection IDs. - [JsonPropertyName("name")] - public string Name { get; set; } = string.Empty; + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} - /// Transport used to communicate with the provider. - [JsonPropertyName("transport")] - public ProviderConfigTransport? Transport { get; set; } +/// 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; } - /// Provider protocol family. - [JsonPropertyName("type")] - public ProviderConfigType? Type { get; set; } + /// Name of the MCP server to restart. + [JsonPropertyName("serverName")] + public string ServerName { get; set; } = string.Empty; - /// Wire API used to communicate with the provider. - [JsonPropertyName("wireApi")] - public ProviderConfigWireApi? WireApi { get; set; } + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; } -/// BYOK providers and/or models to add to the session's registry at runtime. Both fields are optional; provide providers, models, or both. +/// Server name for an individual MCP server stop. [Experimental(Diagnostics.Experimental)] -internal sealed class ProviderAddRequest +internal sealed class McpStopServerRequest { - /// 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; } + /// 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; } -/// Indicates whether the session options patch was applied successfully. +/// Registration parameters for an external MCP client. [Experimental(Diagnostics.Experimental)] -public sealed class SessionUpdateOptionsResult +internal sealed class McpRegisterExternalClientRequest { - /// Number of hooks loaded from installed plugins, returned when installedPlugins is updated. - [JsonPropertyName("pluginHookCount")] - public long? PluginHookCount { get; set; } + /// Logical server name for the external client. + [JsonPropertyName("serverName")] + public string ServerName { get; set; } = string.Empty; - /// Whether the operation succeeded. - [JsonPropertyName("success")] - public bool Success { get; set; } + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; } -/// Source descriptor for a `session.options.update` content-exclusion rule, with source name and type. +/// Server name identifying the external client to remove. [Experimental(Diagnostics.Experimental)] -public sealed class OptionsUpdateAdditionalContentExclusionPolicyRuleSource +internal sealed class McpUnregisterExternalClientRequest { - /// Name of the policy source. - [JsonPropertyName("name")] - public string Name { get; set; } = string.Empty; + /// Server name of the external client to unregister. + [JsonPropertyName("serverName")] + public string ServerName { get; set; } = string.Empty; - /// Type of the policy source. - [JsonPropertyName("type")] - public string Type { get; set; } = string.Empty; + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; } -/// Single content-exclusion rule supplied to `session.options.update`, with paths, match conditions, and source. +/// Whether the named MCP server is running. [Experimental(Diagnostics.Experimental)] -public sealed class OptionsUpdateAdditionalContentExclusionPolicyRule +public sealed class McpIsServerRunningResult { - /// 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; } + /// True if the server has an active client and transport. + [JsonPropertyName("running")] + public bool Running { get; set; } } -/// Content-exclusion policy supplied to `session.options.update`, with rules, last-updated data, and scope. +/// Server name to check running status for. [Experimental(Diagnostics.Experimental)] -public sealed class OptionsUpdateAdditionalContentExclusionPolicy +internal sealed class McpIsServerRunningRequest { - /// 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; } + /// Name of the MCP server to check. + [JsonPropertyName("serverName")] + public string ServerName { get; set; } = string.Empty; - /// Allowed values for the `OptionsUpdateAdditionalContentExclusionPolicyScope` enumeration. - [JsonPropertyName("scope")] - public OptionsUpdateAdditionalContentExclusionPolicyScope Scope { get; set; } + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; } -/// Options scoped to the built-in CAPI (Copilot API) provider. +/// Indicates whether the pending MCP OAuth response was accepted. [Experimental(Diagnostics.Experimental)] -public sealed class CapiSessionOptions +public sealed class McpOauthHandlePendingResult { - /// 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; } + /// Whether the response was accepted. False if the request was unknown, timed out, or already resolved. + [JsonPropertyName("success")] + public bool Success { get; set; } } -/// Installed plugin record for a session, with marketplace, version, install time, enabled state, cache path, and source. +/// Host response to the pending OAuth request. +/// Polymorphic base type discriminated by kind. [Experimental(Diagnostics.Experimental)] -public sealed class SessionInstalledPlugin +[JsonPolymorphic( + TypeDiscriminatorPropertyName = "kind", + UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToBaseType)] +[JsonDerivedType(typeof(McpOauthPendingRequestResponseToken), "token")] +[JsonDerivedType(typeof(McpOauthPendingRequestResponseCancelled), "cancelled")] +public partial class McpOauthPendingRequestResponse { - /// 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; } + /// The type discriminator. + [JsonPropertyName("kind")] + public virtual string Kind { get; set; } = string.Empty; +} - /// Installation timestamp (ISO-8601). - [JsonPropertyName("installed_at")] - public string InstalledAt { get; set; } = string.Empty; - /// Marketplace the plugin came from (empty string for direct repo installs). - [JsonPropertyName("marketplace")] - public string Marketplace { get; set; } = string.Empty; +/// The token variant of . +[Experimental(Diagnostics.Experimental)] +public partial class McpOauthPendingRequestResponseToken : McpOauthPendingRequestResponse +{ + /// + [JsonIgnore] + public override string Kind => "token"; - /// Plugin name. - [JsonPropertyName("name")] - public string Name { get; set; } = string.Empty; + /// Access token acquired by the SDK host. + [JsonPropertyName("accessToken")] + public required string AccessToken { get; set; } - /// Source descriptor for direct repo installs (when marketplace is empty). - [JsonPropertyName("source")] - public JsonElement? Source { get; set; } + /// Token lifetime in seconds, if known. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("expiresIn")] + public long? ExpiresIn { 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; } + /// OAuth token type. Defaults to Bearer when omitted. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("tokenType")] + public string? TokenType { get; set; } +} - /// Installed version, if known. - [JsonPropertyName("version")] - public string? Version { get; set; } +/// The cancelled variant of . +[Experimental(Diagnostics.Experimental)] +public partial class McpOauthPendingRequestResponseCancelled : McpOauthPendingRequestResponse +{ + /// + [JsonIgnore] + public override string Kind => "cancelled"; } -/// Custom model-provider configuration (BYOK). +/// Pending MCP OAuth request ID and host-provided token or cancellation response. [Experimental(Diagnostics.Experimental)] -public sealed class ProviderConfig +internal sealed class McpOauthHandlePendingRequest { - /// API key. Optional for local providers like Ollama. - [JsonPropertyName("apiKey")] - public string? ApiKey { get; set; } + /// OAuth request identifier from the mcp.oauth_required event. + [JsonPropertyName("requestId")] + public string RequestId { get; set; } = string.Empty; - /// Azure-specific provider options. - [JsonPropertyName("azure")] - public ProviderConfigAzure? Azure { get; set; } + /// Host response to the pending OAuth request. + [JsonPropertyName("result")] + public McpOauthPendingRequestResponse Result { get => field ??= new(); set; } - /// API endpoint URL. - [JsonPropertyName("baseUrl")] - public string BaseUrl { get; set; } = string.Empty; + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { 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; } +/// 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; } - /// 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; } + /// 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; } - /// Custom HTTP headers to include in all outbound requests to the provider. - [JsonPropertyName("headers")] - public IDictionary? Headers { get; set; } + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} - /// Maximum context window tokens for the model. - [JsonPropertyName("maxContextWindowTokens")] - public double? MaxContextWindowTokens { get; set; } +/// 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; } +} - /// Maximum output tokens for the model. - [JsonPropertyName("maxOutputTokens")] - public double? MaxOutputTokens { 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; } - /// Maximum prompt/input tokens for the model. - [JsonPropertyName("maxPromptTokens")] - public double? MaxPromptTokens { 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; } - /// Overrides for model capabilities when they cannot be inferred from modelId. - [JsonPropertyName("modelCapabilities")] - public ModelCapabilitiesOverride? ModelCapabilities { 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; } - /// 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; } + /// 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; } - /// Provider name used for model and telemetry attribution. - [JsonPropertyName("providerName")] - public string? ProviderName { 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; } - /// Provider transport. Defaults to "http". - [JsonPropertyName("transport")] - public ProviderConfigTransport? Transport { 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; } - /// Provider type. Defaults to "openai" for generic OpenAI-compatible APIs. - [JsonPropertyName("type")] - public ProviderConfigType? Type { 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; } - /// Wire API format (openai/azure only). Defaults to "completions". - [JsonPropertyName("wireApi")] - public ProviderConfigWireApi? WireApi { 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; - /// 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; } + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; } -/// 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. +/// 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)] -public sealed class SandboxConfigAuth +[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 { - /// 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; } + /// The type discriminator. + [JsonPropertyName("status")] + public virtual string Status { get; set; } = string.Empty; } -/// macOS seatbelt experimental options. + +/// The no-auth-required variant of . [Experimental(Diagnostics.Experimental)] -public sealed class SandboxConfigUserPolicyExperimentalSeatbelt +public partial class McpOauthProbeResultNoAuthRequired : McpOauthProbeResult { - /// Whether the macOS seatbelt profile may access the keychain. - [JsonPropertyName("keychainAccess")] - public bool? KeychainAccess { get; set; } + /// + [JsonIgnore] + public override string Status => "no-auth-required"; + + /// HTTP response returned by the server. + [JsonPropertyName("httpResponse")] + public required McpOauthHttpResponse HttpResponse { get; set; } } -/// Platform-specific experimental policy fields. +/// The authenticated variant of . [Experimental(Diagnostics.Experimental)] -public sealed class SandboxConfigUserPolicyExperimental +public partial class McpOauthProbeResultAuthenticated : McpOauthProbeResult { - /// macOS seatbelt experimental options. - [JsonPropertyName("seatbelt")] - public SandboxConfigUserPolicyExperimentalSeatbelt? Seatbelt { get; set; } + /// + [JsonIgnore] + public override string Status => "authenticated"; + + /// HTTP response returned by the server. + [JsonPropertyName("httpResponse")] + public required McpOauthHttpResponse HttpResponse { get; set; } } -/// Filesystem rules to merge into the base policy. +/// The needs-auth variant of . [Experimental(Diagnostics.Experimental)] -public sealed class SandboxConfigUserPolicyFilesystem +public partial class McpOauthProbeResultNeedsAuth : McpOauthProbeResult { - /// Whether to clear the policy when the session exits. - [JsonPropertyName("clearPolicyOnExit")] - public bool? ClearPolicyOnExit { get; set; } + /// + [JsonIgnore] + public override string Status => "needs-auth"; - /// Paths explicitly denied. - [JsonPropertyName("deniedPaths")] - public IList? DeniedPaths { get; set; } + /// HTTP 401 or 403 response returned by the server. + [JsonPropertyName("httpResponse")] + public required McpOauthHttpResponse HttpResponse { get; set; } - /// Paths granted read-only access. - [JsonPropertyName("readonlyPaths")] - public IList? ReadonlyPaths { get; set; } + /// Why authentication is needed. + [JsonPropertyName("reason")] + public required McpOauthProbeNeedsAuthReason Reason { get; set; } - /// Paths granted read/write access. - [JsonPropertyName("readwritePaths")] - public IList? ReadwritePaths { get; set; } + /// Parsed WWW-Authenticate challenge parameters, when present and parseable. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("wwwAuthenticateParams")] + public McpOauthWWWAuthenticateParams? WwwAuthenticateParams { get; set; } } -/// HTTP proxy configuration for sandboxed traffic. +/// The failed variant of . [Experimental(Diagnostics.Experimental)] -public sealed class SandboxConfigUserPolicyNetworkProxy +public partial class McpOauthProbeResultFailed : McpOauthProbeResult { - /// 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; } + /// + [JsonIgnore] + public override string Status => "failed"; - /// Proxy URL (e.g. http://proxy.example.com:8080). The port is optional and defaults to the scheme's standard port when omitted. 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 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; + /// Human-readable probe failure detail. + [JsonPropertyName("error")] + public required string Error { get; set; } - /// 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; } + /// 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; } } -/// Network rules to merge into the base policy. +/// Remote MCP server name for a passive OAuth status probe. [Experimental(Diagnostics.Experimental)] -public sealed class SandboxConfigUserPolicyNetwork +internal sealed class McpOauthProbeRequest { - /// 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; } + /// 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; - /// HTTP proxy the sandboxed process routes traffic through. Enforced on Windows and cooperative (honored by well-behaved tools, not strictly enforced) on Linux and macOS. Credentials go in the separate `username`/`password` fields. A credential-free http:// loopback proxy URL is routed through the localhost proxy automatically; an https:// or authenticated loopback URL is used as-is. - [JsonPropertyName("proxy")] - public SandboxConfigUserPolicyNetworkProxy? Proxy { get; set; } + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; } -/// macOS seatbelt-specific options. +/// Indicates whether the pending MCP OAuth response was accepted. [Experimental(Diagnostics.Experimental)] -public sealed class SandboxConfigUserPolicySeatbelt +public sealed class McpOauthRespondResult { - /// Whether the macOS seatbelt profile may access the keychain. - [JsonPropertyName("keychainAccess")] - public bool? KeychainAccess { get; set; } + /// Whether the response was accepted. False if the request was unknown, timed out, or already resolved. + [JsonPropertyName("success")] + public bool Success { get; set; } } -/// User-managed sandbox policy fragment merged into the auto-discovered base policy. +/// Pending MCP OAuth request id to respond to. [Experimental(Diagnostics.Experimental)] -public sealed class SandboxConfigUserPolicy +internal sealed class McpOauthRespondRequest { - /// 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; } + /// OAuth request identifier from the mcp.oauth_required event. + [JsonPropertyName("requestId")] + public string RequestId { get; set; } = string.Empty; - /// macOS seatbelt options to merge into the base policy. - [JsonPropertyName("seatbelt")] - public SandboxConfigUserPolicySeatbelt? Seatbelt { get; set; } + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; } -/// Resolved sandbox configuration. +/// Indicates whether the pending MCP headers refresh response was accepted. [Experimental(Diagnostics.Experimental)] -public sealed class SandboxConfig +public sealed class McpHeadersHandlePendingHeadersRefreshRequestResult { - /// Whether to auto-add the current working directory to readwritePaths. Default: true. - [JsonPropertyName("addCurrentWorkingDirectory")] - public bool? AddCurrentWorkingDirectory { get; set; } + /// Whether the response was accepted. False if the request was unknown, timed out, or already resolved. + [JsonPropertyName("success")] + public bool Success { get; set; } +} - /// Whether to auto-grant read access to the tool directories discovered on PATH and in toolchain environment variables (GOROOT, CARGO_HOME, JAVA_HOME, VIRTUAL_ENV, and similar), and to common developer-tool caches, registries, and toolchains in their default home locations (cargo, go, npm, Maven, and more), plus read-write access to (and, on Unix, up-front creation of) the scratch caches builds write on every run (go-build, ccache, sccache, Gradle caches, Cargo lock/tracker files), so builds work without extra configuration; a relocated CARGO_HOME additionally gets its Cargo lock files granted read-write. Set to false to disable every grant listed above: user-installed toolchains (rustup, nvm, pyenv, conda, pipx) then need explicit userPolicy.filesystem entries — readonlyPaths to read them, plus readwriteFiles for a relocated CARGO_HOME's .package-cache and .global-cache, which Cargo locks on every build. Only these developer-tool grants are affected: the working directory (see addCurrentWorkingDirectory), temporary storage, session log paths, and system locations follow their own rules and stay granted, so commands still run. Default: true (enabled by default; set to false to opt out). - [JsonPropertyName("allowDevToolAccess")] - public bool? AllowDevToolAccess { 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; +} - /// 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 headers variant of . +[Experimental(Diagnostics.Experimental)] +public partial class McpHeadersHandlePendingHeadersRefreshRequestHeaders : McpHeadersHandlePendingHeadersRefreshRequest +{ + /// + [JsonIgnore] + public override string Kind => "headers"; - /// User-managed sandbox policy fragment merged into the auto-discovered base policy. - [JsonPropertyName("userPolicy")] - public SandboxConfigUserPolicy? UserPolicy { get; set; } + /// 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; } } -/// -/// 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. -/// +/// The none variant of . [Experimental(Diagnostics.Experimental)] -public sealed class ShellCredentials +public partial class McpHeadersHandlePendingHeadersRefreshRequestNone : McpHeadersHandlePendingHeadersRefreshRequest { - /// - /// 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; } + /// + [JsonIgnore] + public override string Kind => "none"; } -/// A host-provided script sourced before each built-in shell command when its shell target matches the active shell. +/// MCP headers refresh request id and the host response. [Experimental(Diagnostics.Experimental)] -public sealed class ShellInitScript +internal sealed class McpHeadersHandlePendingHeadersRefreshRequestRequest { - /// Path to the script to source. - [JsonPropertyName("path")] - public string Path { get; set; } = string.Empty; + /// Headers refresh request identifier from mcp.headers_refresh_required. + [JsonPropertyName("requestId")] + public string RequestId { get; set; } = string.Empty; - /// Built-in shell that may source this script. - [JsonPropertyName("shell")] - public ShellInitScriptShell Shell { get; set; } + /// 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; } -/// Per-session settings for built-in shell tools. +/// MCP Apps resource content with URI, optional MIME type, text or base64 blob, and resource metadata. [Experimental(Diagnostics.Experimental)] -public sealed class ShellOptions +public sealed class McpAppsResourceContent { - /// Command-scoped GitHub credential injection for shell commands. - [JsonPropertyName("credentials")] - public ShellCredentials? Credentials { get; set; } + /// Resource-level metadata (CSP, permissions, etc.). + [JsonPropertyName("_meta")] + public IDictionary? Meta { get; set; } - /// Controls automatic non-interactive profile loading where supported. Explicit initScripts are unaffected. - [JsonPropertyName("initProfile")] - public ShellInitProfile? InitProfile { get; set; } + /// Base64-encoded binary content. + [JsonPropertyName("blob")] + public string? Blob { 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; } + /// MIME type of the content. + [JsonPropertyName("mimeType")] + public string? MimeType { 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; } + /// 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; } -/// Patch of mutable session options to apply to the running session. +/// Resource contents returned by the MCP server. [Experimental(Diagnostics.Experimental)] -internal sealed class SessionUpdateOptionsParams +public sealed class McpAppsReadResourceResult { - /// Additional content-exclusion policies to merge into the session's policy set. - [Experimental(Diagnostics.Experimental)] - [JsonPropertyName("additionalContentExclusionPolicies")] - public IList? AdditionalContentExclusionPolicies { get; set; } + /// Resource contents returned by the server. + [JsonPropertyName("contents")] + public IList Contents { get => field ??= []; set; } +} - /// Runtime context discriminator (e.g., `cli`, `actions`). - [JsonPropertyName("agentContext")] - public string? AgentContext { get; 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; - /// Whether to include instructions from every MCP server in the system prompt instead of only allowlisted servers. - [JsonPropertyName("allowAllMcpServerInstructions")] - public bool? AllowAllMcpServerInstructions { get; set; } + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; - /// Whether to disable the `ask_user` tool (encourages autonomous behavior). - [JsonPropertyName("askUserDisabled")] - public bool? AskUserDisabled { get; set; } + /// Resource URI (typically ui://...). + [JsonPropertyName("uri")] + public string Uri { get; set; } = string.Empty; +} - /// Allowlist of tool names available to this session. - [JsonPropertyName("availableTools")] - public IList? AvailableTools { get; set; } +/// 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; } +} - /// Options scoped to the built-in CAPI (Copilot API) provider. - [JsonPropertyName("capi")] - public CapiSessionOptions? Capi { get; 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; - /// Identifier of the client driving the session. - [JsonPropertyName("clientName")] - public string? ClientName { get; set; } + /// 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; - /// Whether to include the `Co-authored-by` trailer in commit messages. - [JsonPropertyName("coauthorEnabled")] - public bool? CoauthorEnabled { get; set; } + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} - /// 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; } +/// 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; } - /// Whether to allow auto-mode continuation across turns. - [JsonPropertyName("continueOnAutoMode")] - public bool? ContinueOnAutoMode { 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; - /// Override URL for the Copilot API endpoint. - [JsonPropertyName("copilotUrl")] - public string? CopilotUrl { get; set; } + /// 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; - /// Whether to default custom agents to local-only execution. - [JsonPropertyName("customAgentsLocalOnly")] - public bool? CustomAgentsLocalOnly { get; set; } + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; - /// Instruction source IDs to exclude from the system prompt. - [JsonPropertyName("disabledInstructionSources")] - public IList? DisabledInstructionSources { get; set; } + /// MCP tool name. + [JsonPropertyName("toolName")] + public string ToolName { get; set; } = string.Empty; +} - /// Skill IDs that should be excluded from this session. - [JsonPropertyName("disabledSkills")] - public IList? DisabledSkills { get; set; } +/// 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; } - /// Whether to enable loading of `.github/hooks/` filesystem hooks. Separate from the SDK callback hook mechanism. - [JsonPropertyName("enableFileHooks")] - public bool? EnableFileHooks { get; set; } + /// Current display mode (SEP-1865). + [JsonPropertyName("displayMode")] + public McpAppsSetHostContextDetailsDisplayMode? DisplayMode { 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; } + /// BCP-47 locale, e.g. 'en-US'. + [JsonPropertyName("locale")] + public string? Locale { 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; } + /// Platform type for responsive design. + [JsonPropertyName("platform")] + public McpAppsSetHostContextDetailsPlatform? Platform { get; set; } - /// Whether to surface reasoning-summary events from the model. - [JsonPropertyName("enableReasoningSummaries")] - public bool? EnableReasoningSummaries { get; set; } + /// UI theme preference per SEP-1865. + [JsonPropertyName("theme")] + public McpAppsSetHostContextDetailsTheme? Theme { get; set; } - /// Whether shell-script safety heuristics are enabled. - [JsonPropertyName("enableScriptSafety")] - public bool? EnableScriptSafety { get; set; } + /// IANA timezone, e.g. 'America/New_York'. + [JsonPropertyName("timeZone")] + public string? TimeZone { get; set; } - /// Whether to enable cross-session store writes and reads. - [JsonPropertyName("enableSessionStore")] - public bool? EnableSessionStore { get; set; } + /// Host application identifier. + [JsonPropertyName("userAgent")] + public string? UserAgent { get; set; } +} - /// Whether to enable skill directory scanning and loading. Falls back to enableConfigDiscovery when unset. - [JsonPropertyName("enableSkills")] - public bool? EnableSkills { 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; } - /// Whether to stream model responses. - [JsonPropertyName("enableStreaming")] - public bool? EnableStreaming { get; set; } + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} - /// How env values are passed to MCP servers (`direct` inlines literal values; `indirect` resolves at launch). - [JsonPropertyName("envValueMode")] - public OptionsUpdateEnvValueMode? EnvValueMode { get; set; } +/// Current host context. +[Experimental(Diagnostics.Experimental)] +public sealed class McpAppsHostContextDetails +{ + /// Display modes the host supports. + [JsonPropertyName("availableDisplayModes")] + public IList? AvailableDisplayModes { 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; } + /// Current display mode (SEP-1865). + [JsonPropertyName("displayMode")] + public McpAppsHostContextDetailsDisplayMode? DisplayMode { get; set; } - /// Whether subagent callback events should be forwarded into the session event log sink. - [JsonPropertyName("eventsLogIncludesSubagents")] - public bool? EventsLogIncludesSubagents { get; set; } + /// BCP-47 locale, e.g. 'en-US'. + [JsonPropertyName("locale")] + public string? Locale { 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; } + /// Platform type for responsive design. + [JsonPropertyName("platform")] + public McpAppsHostContextDetailsPlatform? Platform { get; set; } - /// Denylist of tool names for this session. - [JsonPropertyName("excludedTools")] - public IList? ExcludedTools { get; set; } + /// UI theme preference per SEP-1865. + [JsonPropertyName("theme")] + public McpAppsHostContextDetailsTheme? Theme { 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; } - - /// 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; } + /// IANA timezone, e.g. 'America/New_York'. + [JsonPropertyName("timeZone")] + public string? TimeZone { get; set; } - /// Resolved sandbox configuration. - [JsonPropertyName("sandboxConfig")] - public SandboxConfig? SandboxConfig { get; set; } + /// Host application identifier. + [JsonPropertyName("userAgent")] + public string? UserAgent { 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; } +/// 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; +} - /// 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; } +/// 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; } - /// Additional directories to search for skills. - [JsonPropertyName("skillDirectories")] - public IList? SkillDirectories { get; set; } + /// Whether the MCP_APPS feature flag (or COPILOT_MCP_APPS env override) is on. + [JsonPropertyName("featureFlagEnabled")] + public bool FeatureFlagEnabled { get; set; } - /// Whether to skip loading custom instruction sources. - [JsonPropertyName("skipCustomInstructions")] - public bool? SkipCustomInstructions { get; set; } + /// Whether the session has the `mcp-apps` capability. + [JsonPropertyName("sessionHasMcpApps")] + public bool SessionHasMcpApps { get; set; } +} - /// Whether to skip embedding retrieval pipeline initialization and execution. - [JsonPropertyName("skipEmbeddingRetrieval")] - public bool? SkipEmbeddingRetrieval { 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; } - /// 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; } + /// Up to 5 tool names with `_meta.ui` for quick inspection. + [JsonPropertyName("sampleToolNames")] + public IList SampleToolNames { get => field ??= []; set; } - /// Controls how availableTools (allowlist) and excludedTools (denylist) combine when both are set. - [JsonPropertyName("toolFilterPrecedence")] - public OptionsUpdateToolFilterPrecedence? ToolFilterPrecedence { get; set; } + /// Total tools returned by the server's tools/list. + [JsonPropertyName("toolCount")] + public double ToolCount { get; set; } - /// Optional path for trajectory output. - [JsonPropertyName("trajectoryFile")] - public string? TrajectoryFile { get; set; } + /// Tools whose `_meta.ui` is populated (resourceUri and/or visibility set). + [JsonPropertyName("toolsWithUiMeta")] + public double ToolsWithUiMeta { get; set; } +} - /// Output verbosity level for supported models. - [JsonPropertyName("verbosity")] - public Verbosity? Verbosity { 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; } - /// Absolute working-directory path for shell tools. - [JsonPropertyName("workingDirectory")] - public string? WorkingDirectory { get; set; } + /// What the server returned for this session. + [JsonPropertyName("server")] + public McpAppsDiagnoseServer Server { get => field ??= new(); set; } } -/// Parameters for (re)loading the merged LSP configuration set. +/// MCP server to diagnose MCP Apps wiring for. [Experimental(Diagnostics.Experimental)] -internal sealed class LspInitializeRequest +internal sealed class McpAppsDiagnoseRequest { - /// 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; } + /// 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; - - /// 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. +/// MCP resource content with URI, optional MIME type, text or base64 blob, and resource metadata. [Experimental(Diagnostics.Experimental)] -public sealed class Extension +public sealed class McpResourceContent { - /// 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; + /// Resource-level metadata (CSP, permissions, etc.). + [JsonPropertyName("_meta")] + public IDictionary? Meta { get; set; } - /// Extension name (directory name). - [JsonPropertyName("name")] - public string Name { get; set; } = string.Empty; + /// Base64-encoded binary content. + [JsonPropertyName("blob")] + public string? Blob { get; set; } - /// Process ID if the extension is running. - [JsonPropertyName("pid")] - public long? Pid { get; set; } + /// MIME type of the content. + [JsonPropertyName("mimeType")] + public string? MimeType { 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; } + /// Text content (e.g. HTML). + [JsonPropertyName("text")] + public string? Text { get; set; } - /// Current status: running, disabled, failed, or starting. - [JsonPropertyName("status")] - public ExtensionStatus Status { get; set; } + /// The resource URI. + [JsonPropertyName("uri")] + public string Uri { get; set; } = string.Empty; } -/// Extensions discovered for the session, with their current status. +/// Resource contents returned by the MCP server. [Experimental(Diagnostics.Experimental)] -public sealed class ExtensionList +public sealed class McpResourcesReadResult { - /// Discovered extensions and their current status. - [JsonPropertyName("extensions")] - public IList Extensions { get => field ??= []; set; } + /// Resource contents returned by the server. + [JsonPropertyName("contents")] + public IList Contents { get => field ??= []; set; } } -/// Identifies the target session. +/// MCP server and resource URI to fetch. [Experimental(Diagnostics.Experimental)] -internal sealed class SessionExtensionsListRequest +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; } -/// Source-qualified extension identifier to enable for the session. +/// Standard MCP resource annotations plus preserved non-standard annotation fields. [Experimental(Diagnostics.Experimental)] -internal sealed class ExtensionsEnableRequest +public sealed class McpResourceAnnotations { - /// Source-qualified extension ID to enable. - [JsonPropertyName("id")] - public string Id { get; set; } = string.Empty; + /// Server-provided non-standard annotation fields preserved from the MCP response. + [JsonPropertyName("additionalProperties")] + public IDictionary? AdditionalProperties { get; set; } - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; -} + /// Intended audience roles for this resource. + [JsonPropertyName("audience")] + public IList? Audience { get; set; } -/// 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; + /// Last-modified timestamp hint. + [JsonPropertyName("lastModified")] + public string? LastModified { get; set; } - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// Priority hint for model/client use. + [JsonPropertyName("priority")] + public double? Priority { get; set; } } -/// Identifies the target session. +/// A resource icon descriptor plus preserved non-standard icon fields. [Experimental(Diagnostics.Experimental)] -internal sealed class SessionExtensionsReloadRequest +public sealed class McpResourceIcon { - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; -} + /// Server-provided non-standard icon fields preserved from the MCP response. + [JsonPropertyName("additionalProperties")] + public IDictionary? AdditionalProperties { get; set; } -/// 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; -} + /// Icon MIME type, when known. + [JsonPropertyName("mimeType")] + public string? MimeType { get; set; } + /// Icon sizes hint. + [JsonPropertyName("sizes")] + public string? Sizes { get; set; } -/// 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; } + /// Icon URI. + [JsonPropertyName("src")] + public string Src { get; set; } = string.Empty; - /// Start line number (1-based). - [JsonPropertyName("start")] - public long Start { get; set; } + /// Theme hint for this icon. + [JsonPropertyName("theme")] + public string? Theme { get; set; } } -/// File attachment. -/// The file variant of . +/// 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 partial class PushAttachmentFile : PushAttachment +public sealed class McpResource { - /// - [JsonIgnore] - public override string Type => "file"; - - /// User-facing display name for the attachment. - [JsonPropertyName("displayName")] - public required string DisplayName { get; set; } + /// Resource-level metadata. + [JsonPropertyName("_meta")] + public IDictionary? Meta { 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; } + /// Server-provided non-standard descriptor fields preserved from the MCP response. + [JsonPropertyName("additionalProperties")] + public IDictionary? AdditionalProperties { get; set; } - /// Absolute file path. - [JsonPropertyName("path")] - public required string Path { get; set; } -} + /// Model/client annotations associated with this resource. + [JsonPropertyName("annotations")] + public McpResourceAnnotations? Annotations { get; set; } -/// Directory attachment. -/// The directory variant of . -[Experimental(Diagnostics.Experimental)] -public partial class PushAttachmentDirectory : PushAttachment -{ - /// - [JsonIgnore] - public override string Type => "directory"; + /// Optional description of what this resource represents. + [JsonPropertyName("description")] + public string? Description { get; set; } - /// User-facing display name for the attachment. - [JsonPropertyName("displayName")] - public required string DisplayName { get; set; } + /// Icons associated with this resource. + [JsonPropertyName("icons")] + public IList? Icons { get; set; } - /// Absolute directory path. - [JsonPropertyName("path")] - public required string Path { get; set; } -} + /// MIME type of the resource, if known. + [JsonPropertyName("mimeType")] + public string? MimeType { 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; } + /// The programmatic name of the resource. + [JsonPropertyName("name")] + public string Name { get; set; } = string.Empty; - /// End line number (0-based). - [JsonPropertyName("line")] - public long Line { get; set; } -} + /// Resource size in bytes, when known. + [JsonPropertyName("size")] + public long? Size { 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; } + /// Optional human-readable display title. + [JsonPropertyName("title")] + public string? Title { get; set; } - /// Start line number (0-based). - [JsonPropertyName("line")] - public long Line { get; set; } + /// The resource URI (e.g. ui://... or file:///...). + [JsonPropertyName("uri")] + public string Uri { get; set; } = string.Empty; } -/// Position range of the selection within the file. +/// One page of resources advertised by the named MCP server. [Experimental(Diagnostics.Experimental)] -public sealed class PushAttachmentSelectionDetails +public sealed class McpResourcesListResult { - /// End position of the selection. - [JsonPropertyName("end")] - public PushAttachmentSelectionDetailsEnd End { get => field ??= new(); set; } + /// Opaque cursor for the next page, if the server has more resources. + [JsonPropertyName("nextCursor")] + public string? NextCursor { get; set; } - /// Start position of the selection. - [JsonPropertyName("start")] - public PushAttachmentSelectionDetailsStart Start { get => field ??= new(); set; } + /// Resources advertised by the server (proxied MCP `resources/list`). + [JsonPropertyName("resources")] + public IList Resources { get => field ??= []; set; } } -/// Code selection attachment from an editor. -/// The selection variant of . +/// MCP server whose resources to enumerate. [Experimental(Diagnostics.Experimental)] -public partial class PushAttachmentSelection : PushAttachment +internal sealed class McpResourcesListRequest { - /// - [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; } + /// Opaque MCP pagination cursor from a prior `nextCursor` value. + [JsonPropertyName("cursor")] + public string? Cursor { get; set; } - /// Position range of the selection within the file. - [JsonPropertyName("selection")] - public required PushAttachmentSelectionDetails Selection { 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; - /// The selected text content. - [JsonPropertyName("text")] - public required string Text { get; set; } + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; } -/// GitHub issue, pull request, or discussion reference. -/// The github_reference variant of . +/// 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 partial class PushAttachmentGitHubReference : PushAttachment +public sealed class McpResourceTemplate { - /// - [JsonIgnore] - public override string Type => "github_reference"; + /// Resource-template-level metadata. + [JsonPropertyName("_meta")] + public IDictionary? Meta { get; set; } - /// Issue, pull request, or discussion number. - [JsonPropertyName("number")] - public required long Number { get; set; } + /// Server-provided non-standard descriptor fields preserved from the MCP response. + [JsonPropertyName("additionalProperties")] + public IDictionary? AdditionalProperties { get; set; } - /// Type of GitHub reference. - [JsonPropertyName("referenceType")] - public required PushAttachmentGitHubReferenceType ReferenceType { get; set; } + /// Model/client annotations associated with this template. + [JsonPropertyName("annotations")] + public McpResourceAnnotations? Annotations { get; set; } - /// Current state of the referenced item (e.g., open, closed, merged). - [JsonPropertyName("state")] - public required string State { get; set; } + /// Optional description of what this template is for. + [JsonPropertyName("description")] + public string? Description { 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; } -} + /// Icons associated with resources matching this template. + [JsonPropertyName("icons")] + public IList? Icons { 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; } + /// MIME type for resources matching this template, if uniform. + [JsonPropertyName("mimeType")] + public string? MimeType { get; set; } - /// Repository name (without owner). + /// The programmatic name of the resource template. [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; - /// Repository owner login (user or organization). - [JsonPropertyName("owner")] - public string Owner { 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; } -/// Pointer to a GitHub commit. -/// The github_commit variant of . +/// One page of resource templates advertised by the named MCP server. [Experimental(Diagnostics.Experimental)] -public partial class PushAttachmentGitHubCommit : PushAttachment +public sealed class McpResourcesListTemplatesResult { - /// - [JsonIgnore] - public override string Type => "github_commit"; + /// Opaque cursor for the next page, if the server has more resource templates. + [JsonPropertyName("nextCursor")] + public string? NextCursor { get; set; } - /// First line of the commit message. - [JsonPropertyName("message")] - public required string Message { get; set; } + /// Resource templates advertised by the server (proxied MCP `resources/templates/list`). + [JsonPropertyName("resourceTemplates")] + public IList ResourceTemplates { get => field ??= []; set; } +} - /// Full commit SHA. - [JsonPropertyName("oid")] - public required string Oid { get; 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; } - /// Repository the commit belongs to. - [JsonPropertyName("repo")] - public required PushGitHubRepoRef Repo { 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; - /// URL to the commit on GitHub. - [JsonPropertyName("url")] - public required string Url { get; set; } + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; } -/// Pointer to a GitHub release. -/// The github_release variant of . +/// Session plugin metadata, with name, marketplace, optional version, and enabled state. [Experimental(Diagnostics.Experimental)] -public partial class PushAttachmentGitHubRelease : PushAttachment +public sealed class Plugin { - /// - [JsonIgnore] - public override string Type => "github_release"; - - /// Human-readable release name. - [JsonPropertyName("name")] - public required string Name { get; set; } + /// Whether the plugin is currently enabled. + [JsonPropertyName("enabled")] + public bool Enabled { get; set; } - /// Repository the release belongs to. - [JsonPropertyName("repo")] - public required PushGitHubRepoRef Repo { get; set; } + /// Marketplace the plugin came from. + [JsonPropertyName("marketplace")] + public string Marketplace { get; set; } = string.Empty; - /// Git tag the release is anchored to. - [JsonPropertyName("tagName")] - public required string TagName { get; set; } + /// Plugin name. + [JsonPropertyName("name")] + public string Name { get; set; } = string.Empty; - /// URL to the release on GitHub. - [JsonPropertyName("url")] - public required string Url { get; set; } + /// Installed version. + [JsonPropertyName("version")] + public string? Version { get; set; } } -/// Pointer to a GitHub Actions job. -/// The github_actions_job variant of . +/// Plugins installed for the session, with their enabled state and version metadata. [Experimental(Diagnostics.Experimental)] -public partial class PushAttachmentGitHubActionsJob : PushAttachment +public sealed class PluginList { - /// - [JsonIgnore] - public override string Type => "github_actions_job"; + /// Installed plugins. + [JsonPropertyName("plugins")] + public IList Plugins { get => field ??= []; set; } +} - /// 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; } +/// Identifies the target session. +[Experimental(Diagnostics.Experimental)] +internal sealed class SessionPluginsListRequest +{ + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} - /// Job id within the workflow run. - [JsonPropertyName("jobId")] - public required long JobId { get; set; } +/// 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; } - /// Display name of the job. - [JsonPropertyName("jobName")] - public required string JobName { get; set; } + /// Re-run custom-agent discovery after refreshing plugins. Defaults to true. + [JsonPropertyName("reloadCustomAgents")] + public bool? ReloadCustomAgents { get; set; } - /// Repository the workflow run belongs to. - [JsonPropertyName("repo")] - public required PushGitHubRepoRef Repo { 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; } - /// URL to the job on GitHub. - [JsonPropertyName("url")] - public required string Url { 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; } - /// Display name of the workflow the job ran in. - [JsonPropertyName("workflowName")] - public required string WorkflowName { get; set; } + /// Reload MCP server connections after refreshing plugins. Defaults to true. + [JsonPropertyName("reloadMcp")] + public bool? ReloadMcp { get; set; } } -/// Pointer to a GitHub repository. -/// The github_repository variant of . +/// RPC data type for SessionPluginsReloadRequestWithSession operations. [Experimental(Diagnostics.Experimental)] -public partial class PushAttachmentGitHubRepository : PushAttachment +internal sealed class SessionPluginsReloadRequestWithSession { - /// - [JsonIgnore] - public override string Type => "github_repository"; + /// 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; } - /// Short description of the repository. - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("description")] - public string? Description { get; set; } + /// Re-run custom-agent discovery after refreshing plugins. Defaults to true. + [JsonPropertyName("reloadCustomAgents")] + public bool? ReloadCustomAgents { 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; } + /// 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; } - /// Repository pointer. - [JsonPropertyName("repo")] - public required PushGitHubRepoRef Repo { 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; } - /// URL to the repository on GitHub. - [JsonPropertyName("url")] - public required string Url { 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; } -/// One side of a file diff (head or base). +/// 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 PushAttachmentGitHubFileDiffSide +public sealed class ProviderSessionToken { - /// Repository-relative path to the file. - [JsonPropertyName("path")] - public string Path { get; set; } = string.Empty; + /// 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; } - /// Git ref (branch, tag, or commit SHA) the file is read at. - [JsonPropertyName("ref")] - public string Ref { get; set; } = string.Empty; + /// HTTP header name the token must be sent under. + [JsonPropertyName("header")] + public string Header { get; set; } = string.Empty; - /// Repository the file lives in. - [JsonPropertyName("repo")] - public PushGitHubRepoRef Repo { get => field ??= new(); set; } + /// 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; } -/// Pointer to a single-file diff. At least one of `head` and `base` must be present. -/// The github_file_diff variant of . +/// A snapshot of the provider endpoint the session is currently configured to talk to. [Experimental(Diagnostics.Experimental)] -public partial class PushAttachmentGitHubFileDiff : PushAttachment +public sealed class ProviderEndpoint { - /// - [JsonIgnore] - public override string Type => "github_file_diff"; + /// A credential the caller should use with this endpoint. Omitted only when the endpoint accepts unauthenticated requests. + [JsonPropertyName("apiKey")] + public string? ApiKey { get; set; } - /// File location on the base side of the diff. Absent for additions. - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("base")] - public PushAttachmentGitHubFileDiffSide? Base { get; set; } + /// Base URL to pass to the LLM client library. + [Url] + [StringSyntax(StringSyntaxAttribute.Uri)] + [JsonPropertyName("baseUrl")] + public string BaseUrl { get; set; } = string.Empty; - /// File location on the head side of the diff. Absent for deletions. - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("head")] - public PushAttachmentGitHubFileDiffSide? Head { get; set; } + /// HTTP headers the caller must include on every outbound request. + [JsonPropertyName("headers")] + public IDictionary Headers { get => field ??= new Dictionary(); set; } - /// URL to the diff on GitHub (e.g., a commit, compare, or PR-file URL). - [JsonPropertyName("url")] - public required string Url { get; 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; } } -/// One side of a tree comparison (head or base). +/// RPC data type for SessionProviderGetEndpoint operations. [Experimental(Diagnostics.Experimental)] -public sealed class PushAttachmentGitHubTreeComparisonSide +public sealed class SessionProviderGetEndpointRequest { - /// 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; + /// 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; } } -/// Pointer to a comparison between two git revisions. -/// The github_tree_comparison variant of . +/// RPC data type for SessionProviderGetEndpointRequestWithSession operations. [Experimental(Diagnostics.Experimental)] -public partial class PushAttachmentGitHubTreeComparison : PushAttachment +internal sealed class SessionProviderGetEndpointRequestWithSession { - /// - [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; } + /// 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; } - /// URL to the comparison on GitHub. - [JsonPropertyName("url")] - public required string Url { get; set; } + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; } -/// Generic GitHub URL reference. -/// The github_url variant of . +/// The selectable model entries synthesized for the models added by this call. [Experimental(Diagnostics.Experimental)] -public partial class PushAttachmentGitHubUrl : PushAttachment +public sealed class ProviderAddResult { - /// - [JsonIgnore] - public override string Type => "github_url"; - - /// URL to the GitHub resource. - [JsonPropertyName("url")] - public required string Url { get; set; } + /// 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; } } -/// Pointer to a file in a GitHub repository at a specific ref. -/// The github_file variant of . +/// A BYOK model definition referencing a named provider. [Experimental(Diagnostics.Experimental)] -public partial class PushAttachmentGitHubFile : PushAttachment +public sealed class ProviderModelConfig { - /// - [JsonIgnore] - public override string Type => "github_file"; - - /// Repository-relative path to the file. - [JsonPropertyName("path")] - public required string Path { get; set; } + /// Optional capability overrides (vision, tool_calls, reasoning, etc.). + [JsonPropertyName("capabilities")] + public ModelCapabilitiesOverride? Capabilities { get; set; } - /// Git ref the file is read at (branch, tag, or commit SHA). - [JsonPropertyName("ref")] - public required string Ref { 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; - /// Repository the file lives in. - [JsonPropertyName("repo")] - public required PushGitHubRepoRef Repo { get; set; } + /// Maximum context window tokens for the model. + [JsonPropertyName("maxContextWindowTokens")] + public double? MaxContextWindowTokens { get; set; } - /// URL to the file on GitHub. - [JsonPropertyName("url")] - public required string Url { get; set; } -} + /// Maximum output tokens for the model. + [JsonPropertyName("maxOutputTokens")] + public double? MaxOutputTokens { 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"; + /// Maximum prompt/input tokens for the model. + [JsonPropertyName("maxPromptTokens")] + public double? MaxPromptTokens { get; set; } - /// Line range the snippet covers. - [JsonPropertyName("lineRange")] - public required PushAttachmentFileLineRange LineRange { get; set; } + /// Well-known base model id used for behavior/capability/config lookup. Defaults to `id`. + [JsonPropertyName("modelId")] + public string? ModelId { get; set; } - /// Repository-relative path to the file. - [JsonPropertyName("path")] - public required string Path { get; set; } + /// Display name for model pickers. Defaults to the provider-qualified selection id (`provider/id`). + [JsonPropertyName("name")] + public string? Name { get; set; } - /// Git ref the file is read at (branch, tag, or commit SHA). - [JsonPropertyName("ref")] - public required string Ref { get; set; } + /// Name of the configured provider that serves this model. + [JsonPropertyName("provider")] + public string Provider { get; set; } = string.Empty; - /// Repository the file lives in. - [JsonPropertyName("repo")] - public required PushGitHubRepoRef Repo { get; set; } + /// The model name sent to the provider API for inference. Defaults to `id`. + [JsonPropertyName("wireModel")] + public string? WireModel { get; set; } +} - /// URL to the snippet on GitHub (with line anchor). - [JsonPropertyName("url")] - public required string Url { 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; } } -/// Blob attachment with inline base64-encoded data. -/// The blob variant of . +/// External SDK input for a named custom model provider. Ingested by the native protocol boundary before host dispatch. [Experimental(Diagnostics.Experimental)] -public partial class PushAttachmentBlob : PushAttachment +public sealed class NamedProviderConfig { - /// - [JsonIgnore] - public override string Type => "blob"; + /// Static API key used to authenticate provider requests. + [JsonPropertyName("apiKey")] + public string? ApiKey { get; set; } - /// Base64-encoded content. - [Base64String] - [JsonPropertyName("data")] - public required string Data { get; set; } + /// Azure authentication configuration for the provider. + [JsonPropertyName("azure")] + public ProviderConfigAzure? Azure { get; set; } - /// User-facing display name for the attachment. - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("displayName")] - public string? DisplayName { get; set; } + /// Base URL for provider API requests. + [JsonPropertyName("baseUrl")] + public string BaseUrl { get; set; } = string.Empty; - /// MIME type of the inline data. - [JsonPropertyName("mimeType")] - public required string MimeType { get; set; } -} + /// Static bearer token used to authenticate provider requests. + [JsonPropertyName("bearerToken")] + public string? BearerToken { 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"; + /// Whether the host supplies bearer tokens dynamically. + [JsonPropertyName("hasBearerTokenProvider")] + public bool? HasBearerTokenProvider { get; set; } - /// Caller-supplied JSON payload (required, may be null but not undefined). - [JsonPropertyName("payload")] - public required JsonElement Payload { get; set; } + /// Additional HTTP headers included with provider requests. + [JsonPropertyName("headers")] + public IDictionary? Headers { 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; } -} + /// Unique provider name used to qualify model selection IDs. + [JsonPropertyName("name")] + public string Name { get; set; } = string.Empty; -/// 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; } + /// Transport used to communicate with the provider. + [JsonPropertyName("transport")] + public ProviderConfigTransport? Transport { get; 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; } + /// Provider protocol family. + [JsonPropertyName("type")] + public ProviderConfigType? Type { get; set; } - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// Wire API used to communicate with the provider. + [JsonPropertyName("wireApi")] + public ProviderConfigWireApi? WireApi { get; set; } } -/// A tool name and arguments to execute through the session's native invocation pipeline. +/// 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 ToolsExecuteRequest +internal sealed class ProviderAddRequest { - /// Arguments supplied to the tool. - [JsonPropertyName("arguments")] - public JsonElement Arguments { get; set; } + /// 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; } - /// Name of the currently offered tool to execute. - [JsonPropertyName("name")] - public string Name { get; set; } = string.Empty; + /// 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; - - /// 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. +/// Indicates whether the session options patch was applied successfully. [Experimental(Diagnostics.Experimental)] -public sealed class BuiltinToolFormat +public sealed class SessionUpdateOptionsResult { - /// 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; + /// Number of hooks loaded from installed plugins, returned when installedPlugins is updated. + [JsonPropertyName("pluginHookCount")] + public long? PluginHookCount { get; set; } - /// Custom input-format discriminator. - [JsonPropertyName("type")] - public BuiltinToolFormatType Type { get; set; } + /// Whether the operation succeeded. + [JsonPropertyName("success")] + public bool Success { get; set; } } -/// JSON Schema object accepted by a built-in tool. +/// Source descriptor for a `session.options.update` content-exclusion rule, with source name and type. [Experimental(Diagnostics.Experimental)] -public sealed class BuiltinToolInputSchema +public sealed class OptionsUpdateAdditionalContentExclusionPolicyRuleSource { - /// Root type of the tool input schema. + /// Name of the policy source. + [JsonPropertyName("name")] + public string Name { get; set; } = string.Empty; + + /// Type of the policy source. [JsonPropertyName("type")] - public BuiltinToolInputSchemaType Type { get; set; } + public string Type { get; set; } = string.Empty; } -/// Rust-owned metadata and input schema for a built-in tool. +/// Single content-exclusion rule supplied to `session.options.update`, with paths, match conditions, and source. [Experimental(Diagnostics.Experimental)] -public sealed class BuiltinToolDescriptor +public sealed class OptionsUpdateAdditionalContentExclusionPolicyRule { - /// 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; } + /// Conditions of which at least one must match. + [JsonPropertyName("ifAnyMatch")] + public IList? IfAnyMatch { get; set; } - /// Optional supplemental usage instructions for the tool. - [JsonPropertyName("instructions")] - public string? Instructions { get; set; } + /// Conditions none of which may match. + [JsonPropertyName("ifNoneMatch")] + public IList? IfNoneMatch { get; set; } - /// Whether the tool executes commands in a terminal. - [JsonPropertyName("isTerminal")] - public bool IsTerminal { get; set; } + /// Path patterns covered by this rule. + [JsonPropertyName("paths")] + public IList Paths { get => field ??= []; set; } - /// Stable name used to invoke the built-in tool. - [JsonPropertyName("name")] - public string Name { get; set; } = string.Empty; + /// Source descriptor for a `session.options.update` content-exclusion rule, with source name and type. + [JsonPropertyName("source")] + public OptionsUpdateAdditionalContentExclusionPolicyRuleSource Source { get => field ??= new(); set; } +} - /// Policy describing which tool metadata may be recorded without obfuscation. - [JsonPropertyName("safeForTelemetry")] - public JsonElement SafeForTelemetry { get; 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; } - /// Optional human-readable title for the tool. - [JsonPropertyName("title")] - public string? Title { get; set; } + /// Content-exclusion rules to apply. + [JsonPropertyName("rules")] + public IList Rules { get => field ??= []; set; } - /// Optional tool category discriminator. - [JsonPropertyName("type")] - public string? Type { get; set; } + /// Allowed values for the `OptionsUpdateAdditionalContentExclusionPolicyScope` enumeration. + [JsonPropertyName("scope")] + public OptionsUpdateAdditionalContentExclusionPolicyScope Scope { get; set; } } -/// Rust-owned built-in tool descriptors for the session. +/// Options scoped to the built-in CAPI (Copilot API) provider. [Experimental(Diagnostics.Experimental)] -public sealed class ToolsGetBuiltinDescriptorsResult +public sealed class CapiSessionOptions { - /// Built-in tool descriptors materialized for the session. - [JsonPropertyName("tools")] - public IList Tools { get => field ??= []; 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; } } -/// Shell-specific names and description lines used to materialize built-in shell tool descriptors. +/// Installed plugin record for a session, with marketplace, version, install time, enabled state, cache path, and source. [Experimental(Diagnostics.Experimental)] -public sealed class ToolsShellDescriptorConfig +public sealed class SessionInstalledPlugin { - /// Additional model-facing shell description lines. - [JsonPropertyName("descriptionLines")] - public IList DescriptionLines { get => field ??= []; set; } + /// Path where the plugin is cached locally. + [JsonPropertyName("cache_path")] + public string? CachePath { get; set; } - /// Human-readable shell name. - [JsonPropertyName("displayName")] - public string DisplayName { get; set; } = string.Empty; + /// Whether the plugin is currently enabled. + [JsonPropertyName("enabled")] + public bool Enabled { get; set; } - /// Tool name used to list active shells. - [JsonPropertyName("listShellsToolName")] - public string ListShellsToolName { get; set; } = string.Empty; + /// Installation timestamp (ISO-8601). + [JsonPropertyName("installed_at")] + public string InstalledAt { get; set; } = string.Empty; - /// Tool name used to read shell output. - [JsonPropertyName("readShellToolName")] - public string ReadShellToolName { get; set; } = string.Empty; + /// Marketplace the plugin came from (empty string for direct repo installs). + [JsonPropertyName("marketplace")] + public string Marketplace { get; set; } = string.Empty; - /// Tool name used to start shell commands. - [JsonPropertyName("shellToolName")] - public string ShellToolName { get; set; } = string.Empty; + /// Plugin name. + [JsonPropertyName("name")] + public string Name { get; set; } = string.Empty; - /// Stable shell type identifier. - [JsonPropertyName("shellType")] - public string ShellType { get; set; } = string.Empty; + /// Source descriptor for direct repo installs (when marketplace is empty). + [JsonPropertyName("source")] + public JsonElement? Source { get; set; } - /// Tool name used to stop shell commands. - [JsonPropertyName("stopShellToolName")] - public string StopShellToolName { get; set; } = string.Empty; + /// 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; } } -/// Options controlling how Rust-owned built-in tool descriptors are materialized. +/// Custom model-provider configuration (BYOK). [Experimental(Diagnostics.Experimental)] -internal sealed class ToolsGetBuiltinDescriptorsRequest +public sealed class ProviderConfig { - /// Whether background task completion notifications are enabled. - [JsonPropertyName("backgroundTaskNotificationsEnabled")] - public bool? BackgroundTaskNotificationsEnabled { get; set; } + /// API key. Optional for local providers like Ollama. + [JsonPropertyName("apiKey")] + public string? ApiKey { get; set; } - /// Whether tool descriptors should include authoring metadata. - [JsonPropertyName("includeAuthor")] - public bool? IncludeAuthor { get; set; } + /// Azure-specific provider options. + [JsonPropertyName("azure")] + public ProviderConfigAzure? Azure { get; set; } - /// Whether line numbers should be omitted from the view tool descriptor. - [JsonPropertyName("noViewLineNumbers")] - public bool? NoViewLineNumbers { get; set; } + /// API endpoint URL. + [JsonPropertyName("baseUrl")] + public string BaseUrl { get; set; } = string.Empty; - /// Whether descriptors should favor fewer user-intervention prompts. - [JsonPropertyName("reduceUserIntervention")] - public bool? ReduceUserIntervention { get; set; } + /// Bearer token for authentication. Sets the Authorization header directly. Takes precedence over apiKey when both are set. + [JsonPropertyName("bearerToken")] + public string? BearerToken { get; set; } - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// 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; } - /// Whether shell commands may only run asynchronously. - [JsonPropertyName("shellAsyncOnlyEnabled")] - public bool? ShellAsyncOnlyEnabled { get; set; } + /// Custom HTTP headers to include in all outbound requests to the provider. + [JsonPropertyName("headers")] + public IDictionary? Headers { get; set; } - /// Shell-specific names and description lines for shell tools. - [JsonPropertyName("shellConfig")] - public ToolsShellDescriptorConfig? ShellConfig { get; set; } + /// Maximum context window tokens for the model. + [JsonPropertyName("maxContextWindowTokens")] + public double? MaxContextWindowTokens { get; set; } - /// Whether the configured shell supports PowerShell 7 syntax. - [JsonPropertyName("shellSupportsPowerShell7Syntax")] - public bool? ShellSupportsPowerShell7Syntax { get; set; } + /// Maximum output tokens for the model. + [JsonPropertyName("maxOutputTokens")] + public double? MaxOutputTokens { get; set; } - /// Default shell timeout in milliseconds. - [JsonPropertyName("shellTimeoutMs")] - public double? ShellTimeoutMs { get; set; } + /// Maximum prompt/input tokens for the model. + [JsonPropertyName("maxPromptTokens")] + public double? MaxPromptTokens { get; set; } - /// Whether semantic skill lookup is available. - [JsonPropertyName("skillEmbeddingEnabled")] - public bool? SkillEmbeddingEnabled { get; set; } -} + /// Overrides for model capabilities when they cannot be inferred from modelId. + [JsonPropertyName("modelCapabilities")] + public ModelCapabilitiesOverride? ModelCapabilities { 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; } + /// 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; } - /// Semantic completion decision. Absent on legacy events and invalid tool calls. - [JsonPropertyName("outcome")] - public TaskCompletionOutcome? Outcome { get; set; } + /// Provider name used for model and telemetry attribution. + [JsonPropertyName("providerName")] + public string? ProviderName { 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; } + /// Provider transport. Defaults to "http". + [JsonPropertyName("transport")] + public ProviderConfigTransport? Transport { 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; } + /// Provider type. Defaults to "openai" for generic OpenAI-compatible APIs. + [JsonPropertyName("type")] + public ProviderConfigType? Type { get; set; } - /// Summary of the completed task, provided by the agent. - [JsonPropertyName("summary")] - public string? Summary { get; set; } -} + /// Wire API format (openai/azure only). Defaults to "completions". + [JsonPropertyName("wireApi")] + public ProviderConfigWireApi? WireApi { get; set; } -/// Binary result returned by a tool for the model. + /// 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 ExternalToolTextResultForLlmBinaryResultsForLlm +public sealed class SandboxConfigAuth { - /// 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; + /// 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; } - /// Binary result type discriminator. Use "image" for images and "resource" for other binary data. - [JsonPropertyName("type")] - public ExternalToolTextResultForLlmBinaryResultsForLlmType Type { 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; } } -/// A content block within a tool result, which may be text, terminal output, image, audio, or a resource. -/// Polymorphic base type discriminated by type. +/// macOS seatbelt experimental options. [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 +public sealed class SandboxConfigUserPolicyExperimentalSeatbelt { - /// The type discriminator. - [JsonPropertyName("type")] - public virtual string Type { get; set; } = string.Empty; + /// Whether the macOS seatbelt profile may access the keychain. + [JsonPropertyName("keychainAccess")] + public bool? KeychainAccess { get; set; } } - -/// Plain text content block. -/// The text variant of . +/// Platform-specific experimental policy fields. [Experimental(Diagnostics.Experimental)] -public partial class ExternalToolTextResultForLlmContentText : ExternalToolTextResultForLlmContent +public sealed class SandboxConfigUserPolicyExperimental { - /// - [JsonIgnore] - public override string Type => "text"; - - /// The text content. - [JsonPropertyName("text")] - public required string Text { get; set; } + /// macOS seatbelt experimental options. + [JsonPropertyName("seatbelt")] + public SandboxConfigUserPolicyExperimentalSeatbelt? Seatbelt { get; set; } } -/// Terminal/shell output content block with optional exit code and working directory. -/// The terminal variant of . +/// Filesystem rules to merge into the base policy. [Experimental(Diagnostics.Experimental)] -public partial class ExternalToolTextResultForLlmContentTerminal : ExternalToolTextResultForLlmContent +public sealed class SandboxConfigUserPolicyFilesystem { - /// - [JsonIgnore] - public override string Type => "terminal"; + /// Whether to clear the policy when the session exits. + [JsonPropertyName("clearPolicyOnExit")] + public bool? ClearPolicyOnExit { get; set; } - /// Working directory where the command was executed. - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("cwd")] - public string? Cwd { get; set; } + /// Paths explicitly denied. + [JsonPropertyName("deniedPaths")] + public IList? DeniedPaths { get; set; } - /// Process exit code, if the command has completed. - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("exitCode")] - public long? ExitCode { get; set; } + /// Paths granted read-only access. + [JsonPropertyName("readonlyPaths")] + public IList? ReadonlyPaths { get; set; } - /// Terminal/shell output text. - [JsonPropertyName("text")] - public required string Text { get; set; } + /// Paths granted read/write access. + [JsonPropertyName("readwritePaths")] + public IList? ReadwritePaths { get; set; } } -/// Shell command exit metadata with optional output preview. -/// The shell_exit variant of . +/// HTTP proxy configuration for sandboxed traffic. [Experimental(Diagnostics.Experimental)] -public partial class ExternalToolTextResultForLlmContentShellExit : ExternalToolTextResultForLlmContent +public sealed class SandboxConfigUserPolicyNetworkProxy { - /// - [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; } - - /// 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; } + /// 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; } - /// Whether outputPreview is known to be incomplete or truncated. - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("outputTruncated")] - public bool? OutputTruncated { 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. 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 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; - /// Shell id, as assigned by Copilot runtime. - [JsonPropertyName("shellId")] - public required string ShellId { get; set; } + /// 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; } } -/// Image content block with base64-encoded data. -/// The image variant of . +/// Network rules to merge into the base policy. [Experimental(Diagnostics.Experimental)] -public partial class ExternalToolTextResultForLlmContentImage : ExternalToolTextResultForLlmContent +public sealed class SandboxConfigUserPolicyNetwork { - /// - [JsonIgnore] - public override string Type => "image"; + /// Whether traffic to local/loopback addresses is allowed. + [JsonPropertyName("allowLocalNetwork")] + public bool? AllowLocalNetwork { get; set; } - /// Base64-encoded image data. - [Base64String] - [JsonPropertyName("data")] - public required string Data { get; set; } + /// Whether outbound network traffic is allowed at all. + [JsonPropertyName("allowOutbound")] + public bool? AllowOutbound { get; set; } - /// MIME type of the image (e.g., image/png, image/jpeg). - [JsonPropertyName("mimeType")] - public required string MimeType { get; set; } + /// HTTP proxy the sandboxed process routes traffic through. Enforced on Windows and cooperative (honored by well-behaved tools, not strictly enforced) on Linux and macOS. Credentials go in the separate `username`/`password` fields. A credential-free http:// loopback proxy URL is routed through the localhost proxy automatically; an https:// or authenticated loopback URL is used as-is. + [JsonPropertyName("proxy")] + public SandboxConfigUserPolicyNetworkProxy? Proxy { get; set; } } -/// Audio content block with base64-encoded data. -/// The audio variant of . +/// macOS seatbelt-specific options. [Experimental(Diagnostics.Experimental)] -public partial class ExternalToolTextResultForLlmContentAudio : ExternalToolTextResultForLlmContent +public sealed class SandboxConfigUserPolicySeatbelt { - /// - [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; } + /// Whether the macOS seatbelt profile may access the keychain. + [JsonPropertyName("keychainAccess")] + public bool? KeychainAccess { get; set; } } -/// Icon image for a resource. +/// User-managed sandbox policy fragment merged into the auto-discovered base policy. [Experimental(Diagnostics.Experimental)] -public sealed class ExternalToolTextResultForLlmContentResourceLinkIcon +public sealed class SandboxConfigUserPolicy { - /// MIME type of the icon image. - [JsonPropertyName("mimeType")] - public string? MimeType { get; set; } + /// Deprecated legacy location for `seatbelt`; read only when the top-level `seatbelt` is absent. + [JsonPropertyName("experimental")] + public SandboxConfigUserPolicyExperimental? Experimental { get; set; } - /// Available icon sizes (e.g., ['16x16', '32x32']). - [JsonPropertyName("sizes")] - public IList? Sizes { get; set; } + /// Filesystem rules to merge into the base policy. + [JsonPropertyName("filesystem")] + public SandboxConfigUserPolicyFilesystem? Filesystem { get; set; } - /// URL or path to the icon image. - [JsonPropertyName("src")] - public string Src { get; set; } = string.Empty; + /// Network rules to merge into the base policy. + [JsonPropertyName("network")] + public SandboxConfigUserPolicyNetwork? Network { get; set; } - /// Theme variant this icon is intended for. - [JsonPropertyName("theme")] - public ExternalToolTextResultForLlmContentResourceLinkIconTheme? Theme { get; set; } + /// macOS seatbelt options to merge into the base policy. + [JsonPropertyName("seatbelt")] + public SandboxConfigUserPolicySeatbelt? Seatbelt { get; set; } } -/// Resource link content block referencing an external resource. -/// The resource_link variant of . +/// Resolved sandbox configuration. [Experimental(Diagnostics.Experimental)] -public partial class ExternalToolTextResultForLlmContentResourceLink : ExternalToolTextResultForLlmContent +public sealed class SandboxConfig { - /// - [JsonIgnore] - public override string Type => "resource_link"; - - /// Human-readable description of the resource. - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("description")] - public string? Description { get; set; } + /// Whether to auto-add the current working directory to readwritePaths. Default: true. + [JsonPropertyName("addCurrentWorkingDirectory")] + public bool? AddCurrentWorkingDirectory { get; set; } - /// Icons associated with this resource. - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("icons")] - public IList? Icons { get; set; } + /// Whether to auto-grant read access to the tool directories discovered on PATH and in toolchain environment variables (GOROOT, CARGO_HOME, JAVA_HOME, VIRTUAL_ENV, and similar), and to common developer-tool caches, registries, and toolchains in their default home locations (cargo, go, npm, Maven, and more), plus read-write access to (and, on Unix, up-front creation of) the scratch caches builds write on every run (go-build, ccache, sccache, Gradle caches, Cargo lock/tracker files), so builds work without extra configuration; a relocated CARGO_HOME additionally gets its Cargo lock files granted read-write. Set to false to disable every grant listed above: user-installed toolchains (rustup, nvm, pyenv, conda, pipx) then need explicit userPolicy.filesystem entries — readonlyPaths to read them, plus readwriteFiles for a relocated CARGO_HOME's .package-cache and .global-cache, which Cargo locks on every build. Only these developer-tool grants are affected: the working directory (see addCurrentWorkingDirectory), temporary storage, session log paths, and system locations follow their own rules and stay granted, so commands still run. Default: true (enabled by default; set to false to opt out). + [JsonPropertyName("allowDevToolAccess")] + public bool? AllowDevToolAccess { get; set; } - /// MIME type of the resource content. - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("mimeType")] - public string? MimeType { get; set; } + /// Credential-injection capability flags. + [JsonPropertyName("auth")] + public SandboxConfigAuth? Auth { get; set; } - /// Resource name identifier. - [JsonPropertyName("name")] - public required string Name { get; set; } + /// Whether sandboxing is enabled for the session. + [JsonPropertyName("enabled")] + public bool Enabled { get; set; } - /// Size of the resource in bytes. - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("size")] - public long? Size { get; set; } + /// User-managed sandbox policy fragment merged into the auto-discovered base policy. + [JsonPropertyName("userPolicy")] + public SandboxConfigUserPolicy? UserPolicy { 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 . +/// +/// 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 partial class ExternalToolTextResultForLlmContentResource : ExternalToolTextResultForLlmContent +public sealed class ShellCredentials { - /// - [JsonIgnore] - public override string Type => "resource"; + /// + /// 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; } - /// The embedded resource contents, either text or base64-encoded binary. - [JsonPropertyName("resource")] - public required JsonElement Resource { 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 message injected by a tool result. +/// 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 ToolResultNewMessage +public sealed class ShellInitScript { - /// Message content to inject after the tool result. - [JsonPropertyName("content")] - public string Content { get; set; } = string.Empty; + /// Path to the script to source. + [JsonPropertyName("path")] + public string Path { get; set; } = string.Empty; - /// Source attributed to the injected message. - [JsonPropertyName("source")] - public string Source { get; set; } = string.Empty; + /// Built-in shell that may source this script. + [JsonPropertyName("shell")] + public ShellInitScriptShell Shell { get; set; } } -/// RPC data type for TaskCompletionDecision operations. +/// Per-session settings for built-in shell tools. [Experimental(Diagnostics.Experimental)] -public sealed class TaskCompletionDecision +public sealed class ShellOptions { - /// 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; } + /// Command-scoped GitHub credential injection for shell commands. + [JsonPropertyName("credentials")] + public ShellCredentials? Credentials { get; set; } - /// Rationale for the completion decision, when one is available. - [JsonPropertyName("reason")] - public string? Reason { get; set; } + /// Controls automatic non-interactive profile loading where supported. Explicit initScripts are unaffected. + [JsonPropertyName("initProfile")] + public ShellInitProfile? InitProfile { get; set; } - /// Whether the rationale was derived from completion-reviewer output. - [JsonPropertyName("reviewerDerived")] - public bool? ReviewerDerived { 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; } - /// Information-flow metadata captured from the completion reviewer. - [JsonPropertyName("reviewerResultMeta")] - public JsonElement? ReviewerResultMeta { 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; } } -/// Expanded canonical result returned by a session tool. +/// Patch of mutable session options to apply to the running session. [Experimental(Diagnostics.Experimental)] -public sealed class ToolResultExpanded +internal sealed class SessionUpdateOptionsParams { - /// Base64-encoded binary results returned to the model. - [JsonPropertyName("binaryResultsForLlm")] - public IList? BinaryResultsForLlm { get; set; } + /// Additional content-exclusion policies to merge into the session's policy set. + [Experimental(Diagnostics.Experimental)] + [JsonPropertyName("additionalContentExclusionPolicies")] + public IList? AdditionalContentExclusionPolicies { get; set; } - /// Sources returned by the tool that the model may cite. - [JsonPropertyName("citableSources")] - public IList? CitableSources { get; set; } + /// Runtime context discriminator (e.g., `cli`, `actions`). + [JsonPropertyName("agentContext")] + public string? AgentContext { get; set; } - /// Structured content blocks returned to the model. - [JsonPropertyName("contents")] - public IList? Contents { 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; } - /// Error message for an unsuccessful execution. - [JsonPropertyName("error")] - public string? Error { get; set; } + /// Whether to disable the `ask_user` tool (encourages autonomous behavior). + [JsonPropertyName("askUserDisabled")] + public bool? AskUserDisabled { get; set; } - /// Metadata propagated with the tool result, including information-flow labels. - [JsonPropertyName("mcpMeta")] - public IDictionary? McpMeta { get; set; } + /// Allowlist of tool names available to this session. + [JsonPropertyName("availableTools")] + public IList? AvailableTools { get; set; } - /// Messages to inject after the tool result. - [JsonPropertyName("newMessages")] - public IList? NewMessages { get; set; } + /// Options scoped to the built-in CAPI (Copilot API) provider. + [JsonPropertyName("capi")] + public CapiSessionOptions? Capi { get; set; } - /// Whether post-tool-use failure hooks have already processed this result. - [JsonPropertyName("postToolUseFailureHooksProcessed")] - public bool? PostToolUseFailureHooksProcessed { get; set; } + /// Identifier of the client driving the session. + [JsonPropertyName("clientName")] + public string? ClientName { get; set; } - /// Execution outcome classification. - [JsonPropertyName("resultType")] - public ToolResultType ResultType { get; set; } + /// Whether to include the `Co-authored-by` trailer in commit messages. + [JsonPropertyName("coauthorEnabled")] + public bool? CoauthorEnabled { get; set; } - /// Detailed log content available for session display. - [JsonPropertyName("sessionLog")] - public string? SessionLog { 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; } - /// Skill invocation metadata produced by the tool. - [JsonPropertyName("skillInvocation")] - public JsonElement? SkillInvocation { get; set; } + /// Whether to allow auto-mode continuation across turns. + [JsonPropertyName("continueOnAutoMode")] + public bool? ContinueOnAutoMode { get; set; } - /// Whether large-output post-processing should be skipped. - [JsonPropertyName("skipLargeOutputProcessing")] - public bool? SkipLargeOutputProcessing { get; set; } + /// Override URL for the Copilot API endpoint. + [JsonPropertyName("copilotUrl")] + public string? CopilotUrl { get; set; } - /// Structured result content in addition to the model-facing text. - [JsonPropertyName("structuredContent")] - public JsonElement? StructuredContent { get; set; } + /// Whether to default custom agents to local-only execution. + [JsonPropertyName("customAgentsLocalOnly")] + public bool? CustomAgentsLocalOnly { get; set; } - /// Completion-review decision produced by the task-completion tool. - [JsonPropertyName("taskCompletionDecision")] - public TaskCompletionDecision? TaskCompletionDecision { get; set; } + /// Instruction source IDs to exclude from the system prompt. + [JsonPropertyName("disabledInstructionSources")] + public IList? DisabledInstructionSources { get; set; } - /// Text result returned to the model. - [JsonPropertyName("textResultForLlm")] - public string TextResultForLlm { get; set; } = string.Empty; + /// Skill IDs that should be excluded from this session. + [JsonPropertyName("disabledSkills")] + public IList? DisabledSkills { get; set; } - /// Deferred tool names made available by this result. - [JsonPropertyName("toolReferences")] - public IList? ToolReferences { 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; } - /// Tool-specific telemetry payload. - [JsonPropertyName("toolTelemetry")] - public JsonElement? ToolTelemetry { 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; } - /// Optional UI resource produced by the tool. - [JsonPropertyName("uiResource")] - public JsonElement? UiResource { 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; } -/// 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; } + /// Whether to surface reasoning-summary events from the model. + [JsonPropertyName("enableReasoningSummaries")] + public bool? EnableReasoningSummaries { get; set; } - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// Whether shell-script safety heuristics are enabled. + [JsonPropertyName("enableScriptSafety")] + public bool? EnableScriptSafety { get; set; } - /// Arguments supplied to the completed task_complete tool call. - [JsonPropertyName("toolArgs")] - public JsonElement ToolArgs { get; set; } -} + /// Whether to enable cross-session store writes and reads. + [JsonPropertyName("enableSessionStore")] + public bool? EnableSessionStore { 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; } -} + /// Whether to enable skill directory scanning and loading. Falls back to enableConfigDiscovery when unset. + [JsonPropertyName("enableSkills")] + public bool? EnableSkills { 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; } + /// Whether to stream model responses. + [JsonPropertyName("enableStreaming")] + public bool? EnableStreaming { get; set; } - /// Request ID of the pending tool call. - [JsonPropertyName("requestId")] - public string RequestId { get; set; } = string.Empty; + /// How env values are passed to MCP servers (`direct` inlines literal values; `indirect` resolves at launch). + [JsonPropertyName("envValueMode")] + public OptionsUpdateEnvValueMode? EnvValueMode { get; set; } - /// Tool call result (string or expanded result object). - [JsonPropertyName("result")] - public JsonElement? Result { 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; } + + /// 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; } + + /// 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; -} -/// 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 -{ + /// 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; } } -/// Identifies the target session. +/// Parameters for (re)loading the merged LSP configuration set. [Experimental(Diagnostics.Experimental)] -internal sealed class SessionToolsInitializeAndValidateRequest +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; } } -/// Lightweight metadata for a currently initialized session tool. +/// Discovered extension metadata, including source-qualified ID, name, discovery source, status, and optional process ID. [Experimental(Diagnostics.Experimental)] -public sealed class CurrentToolMetadata +public sealed class Extension { - /// 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; } + /// 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; - /// Model-facing tool name. + /// Extension name (directory name). [JsonPropertyName("name")] public string Name { get; set; } = string.Empty; - /// Optional MCP/config namespaced tool name. - [JsonPropertyName("namespacedName")] - public string? NamespacedName { get; set; } + /// 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; } } -/// Current lightweight tool metadata snapshot for the session. +/// Extensions discovered for the session, with their current status. [Experimental(Diagnostics.Experimental)] -public sealed class ToolsGetCurrentMetadataResult +public sealed class ExtensionList { - /// Current tool metadata, or null when tools have not been initialized yet. - [JsonPropertyName("tools")] - public IList? Tools { get; set; } + /// Discovered extensions and their current status. + [JsonPropertyName("extensions")] + public IList Extensions { get => field ??= []; set; } } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] -internal sealed class SessionToolsGetCurrentMetadataRequest +internal sealed class SessionExtensionsListRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } -/// Empty result after replacing the calling connection's externally implemented tools. +/// Source-qualified extension identifier to enable for the session. [Experimental(Diagnostics.Experimental)] -public sealed class ToolsSetResult +internal sealed class ExtensionsEnableRequest { -} + /// Source-qualified extension ID to enable. + [JsonPropertyName("id")] + public string Id { get; set; } = string.Empty; -/// Serializable definition of a caller-implemented tool whose execution is handled over the SDK connection. + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// Source-qualified extension identifier to disable for the session. [Experimental(Diagnostics.Experimental)] -public sealed class ProtocolExternalToolDefinition +internal sealed class ExtensionsDisableRequest { - /// 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; } + /// Source-qualified extension ID to disable. + [JsonPropertyName("id")] + public string Id { get; set; } = string.Empty; - /// Optional human-readable display title. - [JsonPropertyName("title")] - public string? Title { get; set; } + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; } -/// Complete externally implemented tool list for the calling connection. An empty list removes every tool previously supplied by that connection. +/// Identifies the target session. [Experimental(Diagnostics.Experimental)] -internal sealed class ToolsSetRequest +internal sealed class SessionExtensionsReloadRequest { /// 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. +/// 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)] -public sealed class ToolsUpdateSubagentSettingsResult +[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; } -/// Subagent model, reasoning effort, and context tier settings. + +/// Optional line range to scope the attachment to a specific section of the file. [Experimental(Diagnostics.Experimental)] -public sealed class SubagentSettingsEntry +public sealed class PushAttachmentFileLineRange { - /// 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; } + /// End line number (1-based, inclusive). + [JsonPropertyName("end")] + public long End { get; set; } - /// Model override for matching subagents. - [JsonPropertyName("model")] - public string? Model { get; set; } + /// Start line number (1-based). + [JsonPropertyName("start")] + public long Start { get; set; } } -/// Configured per-agent subagent overrides. -public sealed class UpdateSubagentSettingsRequestSubagents +/// File attachment. +/// The file variant of . +[Experimental(Diagnostics.Experimental)] +public partial class PushAttachmentFile : PushAttachment { - /// Per-agent settings keyed by subagent agent_type. - [JsonPropertyName("agents")] - public IDictionary? Agents { get; set; } + /// + [JsonIgnore] + public override string Type => "file"; - /// Names of subagents the user has turned off; they cannot be dispatched. - [JsonPropertyName("disabledSubagents")] - public IList? DisabledSubagents { get; set; } + /// User-facing display name for the attachment. + [JsonPropertyName("displayName")] + public required string DisplayName { get; set; } - /// Maximum number of subagents that can run concurrently; applies to usage-based billing users only. - [JsonPropertyName("maxConcurrency")] - public int? MaxConcurrency { 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; } - /// Maximum subagent nesting depth; applies to usage-based billing users only. - [JsonPropertyName("maxDepth")] - public int? MaxDepth { get; set; } + /// Absolute file path. + [JsonPropertyName("path")] + public required string Path { get; set; } } -/// Subagent settings to apply to the current session. +/// Directory attachment. +/// The directory variant of . [Experimental(Diagnostics.Experimental)] -internal sealed class UpdateSubagentSettingsRequest +public partial class PushAttachmentDirectory : PushAttachment { - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// + [JsonIgnore] + public override string Type => "directory"; - /// Subagent settings to apply, or null to clear the live session override. - [JsonPropertyName("subagents")] - public UpdateSubagentSettingsRequestSubagents? Subagents { get; set; } + /// 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; } } -/// RPC data type for SessionCommandsList operations. +/// End position of the selection. [Experimental(Diagnostics.Experimental)] -public sealed class SessionCommandsListRequest +public sealed class PushAttachmentSelectionDetailsEnd { - /// 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; } + /// End character offset within the line (0-based). + [JsonPropertyName("character")] + public long Character { get; set; } - /// Include enabled user-invocable skills and commands. - [JsonPropertyName("includeSkills")] - public bool? IncludeSkills { get; set; } + /// End line number (0-based). + [JsonPropertyName("line")] + public long Line { get; set; } } -/// RPC data type for SessionCommandsListRequestWithSession operations. +/// Start position of the selection. [Experimental(Diagnostics.Experimental)] -internal sealed class SessionCommandsListRequestWithSession +public sealed class PushAttachmentSelectionDetailsStart { - /// 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; } + /// Start character offset within the line (0-based). + [JsonPropertyName("character")] + public long Character { get; set; } - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// Start line number (0-based). + [JsonPropertyName("line")] + public long Line { get; set; } } -/// Result of invoking the slash command (text output, prompt to send to the agent, completion, or subcommand selection). -/// Polymorphic base type discriminated by kind. +/// Position range of the selection within the file. [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 +public sealed class PushAttachmentSelectionDetails { - /// The type discriminator. - [JsonPropertyName("kind")] - public virtual string Kind { get; set; } = string.Empty; -} + /// 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; } +} -/// Slash-command invocation result containing text output plus Markdown/ANSI rendering flags. -/// The text variant of . +/// Code selection attachment from an editor. +/// The selection variant of . [Experimental(Diagnostics.Experimental)] -public partial class SlashCommandInvocationResultText : SlashCommandInvocationResult +public partial class PushAttachmentSelection : PushAttachment { /// [JsonIgnore] - public override string Kind => "text"; + public override string Type => "selection"; - /// Whether text contains Markdown. - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("markdown")] - public bool? Markdown { get; set; } + /// User-facing display name for the selection. + [JsonPropertyName("displayName")] + public required string DisplayName { get; set; } - /// Whether ANSI sequences should be preserved. - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("preserveAnsi")] - public bool? PreserveAnsi { get; set; } + /// Absolute path to the file containing the selection. + [JsonPropertyName("filePath")] + public required string FilePath { 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; } + /// Position range of the selection within the file. + [JsonPropertyName("selection")] + public required PushAttachmentSelectionDetails Selection { get; set; } - /// Text output for the client to render. + /// The selected text content. [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 . +/// GitHub issue, pull request, or discussion reference. +/// The github_reference variant of . [Experimental(Diagnostics.Experimental)] -public partial class SlashCommandInvocationResultAgentPrompt : SlashCommandInvocationResult +public partial class PushAttachmentGitHubReference : PushAttachment { /// [JsonIgnore] - public override string Kind => "agent-prompt"; + public override string Type => "github_reference"; - /// Prompt text to display to the user. - [JsonPropertyName("displayPrompt")] - public required string DisplayPrompt { get; set; } + /// Issue, pull request, or discussion number. + [JsonPropertyName("number")] + public required long Number { get; set; } - /// Optional target session mode for the agent prompt. - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("mode")] - public SessionMode? Mode { get; set; } + /// Type of GitHub reference. + [JsonPropertyName("referenceType")] + public required PushAttachmentGitHubReferenceType ReferenceType { get; set; } - /// Optional user-facing notice to show before the prompt is submitted. - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("notice")] - public string? Notice { get; set; } + /// Current state of the referenced item (e.g., open, closed, merged). + [JsonPropertyName("state")] + public required string State { get; set; } - /// Prompt to submit to the agent. - [JsonPropertyName("prompt")] - public required string Prompt { get; set; } + /// Title of the referenced item. + [JsonPropertyName("title")] + public required string Title { 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; } + /// URL to the referenced item on GitHub. + [JsonPropertyName("url")] + public required string Url { get; set; } } -/// Slash-command invocation result indicating completion, with optional message and settings-change flag. -/// The completed variant of . +/// Pointer to a GitHub repository. [Experimental(Diagnostics.Experimental)] -public partial class SlashCommandInvocationResultCompleted : SlashCommandInvocationResult +public sealed class PushGitHubRepoRef { - /// - [JsonIgnore] - public override string Kind => "completed"; + /// Numeric GitHub repository id. + [JsonPropertyName("id")] + public long? Id { get; set; } - /// Optional user-facing message describing the completed command. - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("message")] - public string? Message { get; set; } + /// Repository name (without owner). + [JsonPropertyName("name")] + public string Name { get; set; } = string.Empty; - /// True when the invocation mutated user runtime settings; consumers caching settings should refresh. - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("runtimeSettingsChanged")] - public bool? RuntimeSettingsChanged { get; set; } + /// Repository owner login (user or organization). + [JsonPropertyName("owner")] + public string Owner { get; set; } = string.Empty; } -/// Selectable slash-command subcommand option with name, description, and optional group label. +/// Pointer to a GitHub commit. +/// The github_commit variant of . [Experimental(Diagnostics.Experimental)] -public sealed class SlashCommandSelectSubcommandOption +public partial class PushAttachmentGitHubCommit : PushAttachment { - /// Human-readable description of the subcommand. - [JsonPropertyName("description")] - public string Description { get; set; } = string.Empty; + /// + [JsonIgnore] + public override string Type => "github_commit"; - /// Optional group label for organizing options. - [JsonPropertyName("group")] - public string? Group { get; set; } + /// First line of the commit message. + [JsonPropertyName("message")] + public required string Message { get; set; } - /// Subcommand name to invoke. - [JsonPropertyName("name")] - public string Name { get; set; } = string.Empty; + /// 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; } } -/// Slash-command invocation result asking the client to present subcommand options for a parent command. -/// The select-subcommand variant of . +/// Pointer to a GitHub release. +/// The github_release variant of . [Experimental(Diagnostics.Experimental)] -public partial class SlashCommandInvocationResultSelectSubcommand : SlashCommandInvocationResult +public partial class PushAttachmentGitHubRelease : PushAttachment { /// [JsonIgnore] - public override string Kind => "select-subcommand"; + public override string Type => "github_release"; - /// Parent command name that requires subcommand selection. - [JsonPropertyName("command")] - public required string Command { get; set; } + /// Human-readable release name. + [JsonPropertyName("name")] + public required string Name { get; set; } - /// Available subcommand options for the client to present. - [JsonPropertyName("options")] - public required IList Options { get; set; } + /// Repository the release belongs to. + [JsonPropertyName("repo")] + public required PushGitHubRepoRef Repo { 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; } + /// Git tag the release is anchored to. + [JsonPropertyName("tagName")] + public required string TagName { get; set; } - /// Human-readable title for the selection UI. - [JsonPropertyName("title")] - public required string Title { get; set; } + /// URL to the release on GitHub. + [JsonPropertyName("url")] + public required string Url { get; set; } } -/// RPC data type for SlashCommandTimelineEntry operations. +/// Pointer to a GitHub Actions job. +/// The github_actions_job variant of . [Experimental(Diagnostics.Experimental)] -public sealed class SlashCommandTimelineEntry +public partial class PushAttachmentGitHubActionsJob : PushAttachment { - /// Text displayed for the timeline entry. - [JsonPropertyName("text")] - public string Text { get; set; } = string.Empty; + /// + [JsonIgnore] + public override string Type => "github_actions_job"; - /// Timeline entry presentation type. - [JsonPropertyName("type")] - public string Type { get; set; } = string.Empty; + /// 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; } - /// Optional URL associated with the timeline entry. + /// 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 string? Url { get; set; } + public required string Url { get; set; } + + /// Display name of the workflow the job ran in. + [JsonPropertyName("workflowName")] + public required string WorkflowName { get; set; } } -/// The add-timeline-entry variant of . +/// Pointer to a GitHub repository. +/// The github_repository variant of . [Experimental(Diagnostics.Experimental)] -public partial class SlashCommandInvocationResultAddTimelineEntry : SlashCommandInvocationResult +public partial class PushAttachmentGitHubRepository : PushAttachment { /// [JsonIgnore] - public override string Kind => "add-timeline-entry"; - - /// Timeline entry the host should append. - [JsonPropertyName("entry")] - public required SlashCommandTimelineEntry Entry { get; set; } + public override string Type => "github_repository"; - /// Optional text the host should prefill into the input editor. + /// Short description of the repository. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("prefillInput")] - public string? PrefillInput { get; set; } + [JsonPropertyName("description")] + public string? Description { get; set; } - /// Whether command execution changed persisted runtime settings. + /// Git ref this attachment is anchored at (branch, tag, or commit). When absent the default branch is implied. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("runtimeSettingsChanged")] - public bool? RuntimeSettingsChanged { get; set; } + [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; } } -/// RPC data type for SlashCommandModelPickerDialog operations. +/// One side of a file diff (head or base). [Experimental(Diagnostics.Experimental)] -public sealed class SlashCommandModelPickerDialog +public sealed class PushAttachmentGitHubFileDiffSide { - /// 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; } + /// Repository-relative path to the file. + [JsonPropertyName("path")] + public string Path { get; set; } = string.Empty; - /// Settings scope the picker should modify. - [JsonPropertyName("scope")] - public string? Scope { get; set; } + /// Git ref (branch, tag, or commit SHA) the file is read at. + [JsonPropertyName("ref")] + public string Ref { get; set; } = string.Empty; - /// Model-selection target represented by the picker. - [JsonPropertyName("target")] - public string? Target { get; set; } + /// Repository the file lives in. + [JsonPropertyName("repo")] + public PushGitHubRepoRef Repo { get => field ??= new(); set; } } -/// The show-dialog variant of . +/// 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 SlashCommandInvocationResultShowDialog : SlashCommandInvocationResult +public partial class PushAttachmentGitHubFileDiff : PushAttachment { /// [JsonIgnore] - public override string Kind => "show-dialog"; + public override string Type => "github_file_diff"; - /// Dialog the host should display. - [JsonPropertyName("dialog")] - public required SlashCommandModelPickerDialog Dialog { get; set; } + /// File location on the base side of the diff. Absent for additions. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("base")] + public PushAttachmentGitHubFileDiffSide? Base { get; set; } - /// Whether command execution changed persisted runtime settings. + /// File location on the head side of the diff. Absent for deletions. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("runtimeSettingsChanged")] - public bool? RuntimeSettingsChanged { get; set; } -} + [JsonPropertyName("head")] + public PushAttachmentGitHubFileDiffSide? Head { get; set; } -/// User-settings snapshot to restore if the host cancels the model switch. -public sealed class SlashCommandInvocationResultSetModelRevertOnCancel -{ + /// URL to the diff on GitHub (e.g., a commit, compare, or PR-file URL). + [JsonPropertyName("url")] + public required string Url { get; set; } } -/// The set-model variant of . +/// One side of a tree comparison (head or base). [Experimental(Diagnostics.Experimental)] -public partial class SlashCommandInvocationResultSetModel : SlashCommandInvocationResult +public sealed class PushAttachmentGitHubTreeComparisonSide { - /// - [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 the revision belongs to. + [JsonPropertyName("repo")] + public PushGitHubRepoRef Repo { get => field ??= new(); set; } - /// Repository settings scope modified by the command. - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("repoScope")] - public string? RepoScope { get; set; } + /// Git revision (branch, tag, or commit SHA). + [JsonPropertyName("revision")] + public string Revision { get; set; } = string.Empty; +} - /// User-settings snapshot to restore if the host cancels the model switch. - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("revertOnCancel")] - public SlashCommandInvocationResultSetModelRevertOnCancel? RevertOnCancel { get; set; } +/// 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"; - /// Whether command execution changed persisted runtime settings. - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("runtimeSettingsChanged")] - public bool? RuntimeSettingsChanged { get; set; } + /// Base side of the comparison. + [JsonPropertyName("base")] + public required PushAttachmentGitHubTreeComparisonSide Base { get; set; } - /// Settings scope modified by the command. - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("scope")] - public string? Scope { get; set; } + /// Head side of the comparison. + [JsonPropertyName("head")] + public required PushAttachmentGitHubTreeComparisonSide Head { get; set; } - /// User-facing warning produced while selecting the model. - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("warning")] - public string? Warning { get; set; } + /// URL to the comparison on GitHub. + [JsonPropertyName("url")] + public required string Url { get; set; } } -/// The set-plan-model variant of . +/// Generic GitHub URL reference. +/// The github_url variant of . [Experimental(Diagnostics.Experimental)] -public partial class SlashCommandInvocationResultSetPlanModel : SlashCommandInvocationResult +public partial class PushAttachmentGitHubUrl : PushAttachment { /// [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; } + public override string Type => "github_url"; - /// Whether command execution changed persisted runtime settings. - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("runtimeSettingsChanged")] - public bool? RuntimeSettingsChanged { get; set; } + /// URL to the GitHub resource. + [JsonPropertyName("url")] + public required string Url { get; set; } } -/// Slash command name and optional raw input string to invoke. +/// Pointer to a file in a GitHub repository at a specific ref. +/// The github_file variant of . [Experimental(Diagnostics.Experimental)] -internal sealed class CommandsInvokeRequest +public partial class PushAttachmentGitHubFile : PushAttachment { - /// Raw input after the command name. - [JsonPropertyName("input")] - public string? Input { get; set; } + /// + [JsonIgnore] + public override string Type => "github_file"; - /// Command name. Leading slashes are stripped and the name is matched case-insensitively. - [JsonPropertyName("name")] - public string Name { get; set; } = string.Empty; + /// Repository-relative path to the file. + [JsonPropertyName("path")] + public required string Path { get; set; } - /// Optional client surface that initiated the invocation. - [JsonPropertyName("origin")] - public CommandsInvocationOrigin? Origin { get; set; } + /// Git ref the file is read at (branch, tag, or commit SHA). + [JsonPropertyName("ref")] + public required string Ref { get; set; } - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// 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; } } -/// Whether finalizing the invocation effect succeeded, and the failure reason when it did not. +/// Pointer to a line range inside a file in a GitHub repository. +/// The github_snippet variant of . [Experimental(Diagnostics.Experimental)] -internal sealed class CommandsFinalizeInvocationEffectResult +public partial class PushAttachmentGitHubSnippet : PushAttachment { - /// Failure reason when the invocation effect could not be finalized. - [JsonPropertyName("error")] - public string? Error { get; set; } + /// + [JsonIgnore] + public override string Type => "github_snippet"; - /// Whether the pending invocation effect was finalized successfully. - [JsonPropertyName("success")] - public bool Success { get; set; } -} + /// Line range the snippet covers. + [JsonPropertyName("lineRange")] + public required PushAttachmentFileLineRange LineRange { get; set; } -/// The slash-command result object that produced the pending effect, echoed back unchanged. -public sealed class CommandsFinalizeInvocationEffectRequestEffect -{ -} + /// Repository-relative path to the file. + [JsonPropertyName("path")] + public required string Path { get; set; } -/// 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; } + /// Git ref the file is read at (branch, tag, or commit SHA). + [JsonPropertyName("ref")] + public required string Ref { get; set; } - /// Whether the host applied or cancelled the pending invocation effect. - [JsonPropertyName("outcome")] - public CommandsInvocationEffectOutcome Outcome { get; set; } + /// Repository the file lives in. + [JsonPropertyName("repo")] + public required PushGitHubRepoRef Repo { get; set; } - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// URL to the snippet on GitHub (with line anchor). + [JsonPropertyName("url")] + public required string Url { get; set; } } -/// Indicates whether the pending client-handled command was completed successfully. +/// Blob attachment with inline base64-encoded data. +/// The blob variant of . [Experimental(Diagnostics.Experimental)] -public sealed class CommandsHandlePendingCommandResult +public partial class PushAttachmentBlob : PushAttachment { - /// Whether the command was handled successfully. - [JsonPropertyName("success")] - public bool Success { get; set; } -} + /// + [JsonIgnore] + public override string Type => "blob"; -/// 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; } + /// Base64-encoded content. + [Base64String] + [JsonPropertyName("data")] + public required string Data { get; set; } - /// Request ID from the command invocation event. - [JsonPropertyName("requestId")] - public string RequestId { get; set; } = string.Empty; + /// User-facing display name for the attachment. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("displayName")] + public string? DisplayName { get; set; } - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// MIME type of the inline data. + [JsonPropertyName("mimeType")] + public required string MimeType { get; set; } } -/// Error message produced while executing the command, if any. +/// Slim input shape for extension_context attachments; identity fields are runtime-derived. +/// The extension_context variant of . [Experimental(Diagnostics.Experimental)] -public sealed class ExecuteCommandResult +public partial class PushAttachmentExtensionContext : PushAttachment { - /// Error message produced while executing the command, if any. Omitted when the handler succeeded. - [JsonPropertyName("error")] - public string? Error { get; set; } + /// + [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; } } -/// Slash command name and argument string to execute synchronously. +/// Parameters for session.extensions.sendAttachmentsToMessage. [Experimental(Diagnostics.Experimental)] -internal sealed class ExecuteCommandParams +internal sealed class SendAttachmentsToMessageParams { - /// Argument string to pass to the command (empty string if none). - [JsonPropertyName("args")] - public string Args { get; set; } = string.Empty; + /// 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; } - /// Name of the slash command to invoke (without the leading '/'). - [JsonPropertyName("commandName")] - public string CommandName { get; set; } = string.Empty; + /// 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; } -/// Indicates whether the command was accepted into the local execution queue. +/// A tool name and arguments to execute through the session's native invocation pipeline. [Experimental(Diagnostics.Experimental)] -public sealed class EnqueueCommandResult +internal sealed class ToolsExecuteRequest { - /// 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; } -} + /// Arguments supplied to the tool. + [JsonPropertyName("arguments")] + public JsonElement Arguments { 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; + /// 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; -} -/// 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; } + /// Optional identifier used to correlate this invocation with its tool call. + [JsonPropertyName("toolCallId")] + public string? ToolCallId { get; set; } } -/// Queued-command request ID and the result indicating whether the host executed it (and whether to stop processing further queued commands). +/// Custom grammar input format accepted by a built-in tool. [Experimental(Diagnostics.Experimental)] -internal sealed class CommandsRespondToQueuedCommandRequest +public sealed class BuiltinToolFormat { - /// Request ID from the `command.queued` event the host is responding to. - [JsonPropertyName("requestId")] - public string RequestId { get; set; } = string.Empty; + /// Grammar definition accepted by the tool. + [JsonPropertyName("definition")] + public string Definition { get; set; } = string.Empty; - /// Result of the queued command execution. - [JsonPropertyName("result")] - public QueuedCommandResult Result { get => field ??= new(); set; } + /// Grammar syntax used by the format definition. + [JsonPropertyName("syntax")] + public string Syntax { get; set; } = string.Empty; - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// Custom input-format discriminator. + [JsonPropertyName("type")] + public BuiltinToolFormatType Type { get; set; } } -/// Telemetry engagement ID for the session, when available. +/// JSON Schema object accepted by a built-in tool. [Experimental(Diagnostics.Experimental)] -public sealed class SessionTelemetryEngagement +public sealed class BuiltinToolInputSchema { - /// Current telemetry engagement ID, when available. - [JsonPropertyName("engagementId")] - public string? EngagementId { get; set; } + /// Root type of the tool input schema. + [JsonPropertyName("type")] + public BuiltinToolInputSchemaType Type { get; set; } } -/// Identifies the target session. +/// Rust-owned metadata and input schema for a built-in tool. [Experimental(Diagnostics.Experimental)] -internal sealed class SessionTelemetryGetEngagementIdRequest +public sealed class BuiltinToolDescriptor { - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; -} + /// Model-facing description of the tool's behavior. + [JsonPropertyName("description")] + public string Description { 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; } + /// Optional custom input format used instead of a JSON Schema. + [JsonPropertyName("format")] + public BuiltinToolFormat? Format { get; set; } - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; -} + /// Whether the tool provides a specialized intention summary. + [JsonPropertyName("hasSummariseIntention")] + public bool HasSummariseIntention { get; set; } -/// 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; -} + /// JSON Schema for the tool input, or null when the tool uses a custom format. + [JsonPropertyName("inputSchema")] + public BuiltinToolInputSchema? InputSchema { get; set; } -/// 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; + /// Optional supplemental usage instructions for the tool. + [JsonPropertyName("instructions")] + public string? Instructions { get; set; } - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; -} + /// Whether the tool executes commands in a terminal. + [JsonPropertyName("isTerminal")] + public bool IsTerminal { get; set; } -/// MCP response metadata. -public sealed class UIElicitationResponseMeta -{ -} + /// Stable name used to invoke the built-in tool. + [JsonPropertyName("name")] + public string Name { get; set; } = string.Empty; -/// 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; } + /// Policy describing which tool metadata may be recorded without obfuscation. + [JsonPropertyName("safeForTelemetry")] + public JsonElement SafeForTelemetry { get; set; } - /// The user's response: accept (submitted), decline (rejected), or cancel (dismissed). - [JsonPropertyName("action")] - public UIElicitationResponseAction Action { get; set; } + /// Optional human-readable title for the tool. + [JsonPropertyName("title")] + public string? Title { get; set; } - /// The form values submitted by the user (present when action is 'accept'). - [JsonPropertyName("content")] - public IDictionary? Content { get; set; } + /// Optional tool category discriminator. + [JsonPropertyName("type")] + public string? Type { get; set; } } -/// MCP request metadata. -public sealed class UIElicitationRequestMeta +/// 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; } } -/// JSON Schema describing the form fields to present to the user. +/// Shell-specific names and description lines used to materialize built-in shell tool descriptors. [Experimental(Diagnostics.Experimental)] -public sealed class UIElicitationSchema +public sealed class ToolsShellDescriptorConfig { - /// Form field definitions, keyed by field name. - [JsonPropertyName("properties")] - public IDictionary Properties { get => field ??= new Dictionary(); set; } + /// Additional model-facing shell description lines. + [JsonPropertyName("descriptionLines")] + public IList DescriptionLines { get => field ??= []; set; } - /// List of required field names. - [JsonPropertyName("required")] - public IList? Required { get; set; } + /// Human-readable shell name. + [JsonPropertyName("displayName")] + public string DisplayName { get; set; } = string.Empty; - /// Schema type indicator (always 'object'). - [JsonPropertyName("type")] - public string Type { get; set; } = string.Empty; -} + /// Tool name used to list active shells. + [JsonPropertyName("listShellsToolName")] + public string ListShellsToolName { 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; } + /// 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; } -/// Prompt message and JSON schema describing the form fields to elicit from the user. +/// Options controlling how Rust-owned built-in tool descriptors are materialized. [Experimental(Diagnostics.Experimental)] -internal sealed class UIElicitationRequest +internal sealed class ToolsGetBuiltinDescriptorsRequest { - /// MCP request metadata. - [JsonPropertyName("_meta")] - public UIElicitationRequestMeta? Meta { get; set; } + /// Whether background task completion notifications are enabled. + [JsonPropertyName("backgroundTaskNotificationsEnabled")] + public bool? BackgroundTaskNotificationsEnabled { get; set; } - /// Message describing what information is needed from the user. - [JsonPropertyName("message")] - public string Message { get; set; } = string.Empty; + /// Whether tool descriptors should include authoring metadata. + [JsonPropertyName("includeAuthor")] + public bool? IncludeAuthor { get; set; } - /// Elicitation mode. Omitted and form are equivalent for structured elicitation. - [JsonPropertyName("mode")] - public McpElicitationFormMode? Mode { get; set; } + /// Whether line numbers should be omitted from the view tool descriptor. + [JsonPropertyName("noViewLineNumbers")] + public bool? NoViewLineNumbers { get; set; } - /// JSON Schema describing the form fields to present to the user. - [JsonPropertyName("requestedSchema")] - public UIElicitationSchema RequestedSchema { get => field ??= new(); 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; - /// MCP task metadata. - [JsonPropertyName("task")] - public McpTaskMetadata? Task { get; set; } -} + /// Whether shell commands may only run asynchronously. + [JsonPropertyName("shellAsyncOnlyEnabled")] + public bool? ShellAsyncOnlyEnabled { 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; } + /// 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; } } -/// Pending elicitation request ID and the user's response (accept/decline/cancel + form values). +/// Task completion notification with summary from the agent. [Experimental(Diagnostics.Experimental)] -internal sealed class UIHandlePendingElicitationRequest +public sealed class TaskCompleteData { - /// The unique request ID from the elicitation.requested event. - [JsonPropertyName("requestId")] - public string RequestId { get; set; } = string.Empty; + /// Active autopilot objective ID evaluated by the completion reviewer. + [JsonPropertyName("objectiveId")] + public long? ObjectiveId { get; set; } - /// The elicitation response (accept with form values, decline, or cancel). - [JsonPropertyName("result")] - public UIElicitationResponse Result { get => field ??= new(); set; } + /// Semantic completion decision. Absent on legacy events and invalid tool calls. + [JsonPropertyName("outcome")] + public TaskCompletionOutcome? Outcome { get; set; } - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; -} + /// 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; } -/// 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. + /// 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; } + public bool? Success { get; set; } + + /// Summary of the completed task, provided by the agent. + [JsonPropertyName("summary")] + public string? Summary { get; set; } } -/// User response for a pending user-input request, with answer text and whether it was typed freeform. +/// Binary result returned by a tool for the model. [Experimental(Diagnostics.Experimental)] -public sealed class UIUserInputResponse +public sealed class ExternalToolTextResultForLlmBinaryResultsForLlm { - /// The user's answer text. - [JsonPropertyName("answer")] - public string Answer { get; set; } = string.Empty; + /// Base64-encoded binary data. + [Base64String] + [JsonPropertyName("data")] + public string Data { 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; } -} + /// Human-readable description of the binary data. + [JsonPropertyName("description")] + public string? Description { 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; + /// Optional metadata from the producing tool. + [JsonPropertyName("metadata")] + public IDictionary? Metadata { get; set; } - /// 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; } + /// MIME type of the binary data. + [JsonPropertyName("mimeType")] + public string MimeType { get; set; } = string.Empty; - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { 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; } } -/// Optional sampling result payload. Omit to reject/cancel the sampling request without providing a result. +/// 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)] -public sealed class UIHandlePendingSamplingResponse +[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; } -/// Request ID of a pending `sampling.requested` event and an optional sampling result payload (omit to reject). + +/// Plain text content block. +/// The text variant of . [Experimental(Diagnostics.Experimental)] -internal sealed class UIHandlePendingSamplingRequest +public partial class ExternalToolTextResultForLlmContentText : ExternalToolTextResultForLlmContent { - /// 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; } + /// + [JsonIgnore] + public override string Type => "text"; - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// The text content. + [JsonPropertyName("text")] + public required string Text { get; set; } } -/// Request ID of a pending `auto_mode_switch.requested` event and the user's response. +/// Terminal/shell output content block with optional exit code and working directory. +/// The terminal variant of . [Experimental(Diagnostics.Experimental)] -internal sealed class UIHandlePendingAutoModeSwitchRequest +public partial class ExternalToolTextResultForLlmContentTerminal : ExternalToolTextResultForLlmContent { - /// The unique request ID from the auto_mode_switch.requested event. - [JsonPropertyName("requestId")] - public string RequestId { get; set; } = string.Empty; + /// + [JsonIgnore] + public override string Type => "terminal"; - /// 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; } + /// Working directory where the command was executed. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("cwd")] + public string? Cwd { get; set; } - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// 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; } } -/// The user's selected action for an exhausted session limit. +/// Shell command exit metadata with optional output preview. +/// The shell_exit variant of . [Experimental(Diagnostics.Experimental)] -public sealed class UISessionLimitsExhaustedResponse +public partial class ExternalToolTextResultForLlmContentShellExit : ExternalToolTextResultForLlmContent { - /// Action selected by the user. - [JsonPropertyName("action")] - public UISessionLimitsExhaustedResponseAction Action { get; set; } + /// + [JsonIgnore] + public override string Type => "shell_exit"; - /// AI Credits to add to the current max when action is 'add'. - [JsonPropertyName("additionalAiCredits")] - public double? AdditionalAiCredits { get; set; } + /// Working directory where the shell command was executed. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("cwd")] + public string? Cwd { get; set; } - /// New absolute max AI Credits when action is 'set'. - [JsonPropertyName("maxAiCredits")] - public double? MaxAiCredits { get; set; } -} + /// Exit code from the completed shell command. + [JsonPropertyName("exitCode")] + public required long ExitCode { 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; + /// 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; } - /// The selected session-limit action. - [JsonPropertyName("response")] - public UISessionLimitsExhaustedResponse Response { get => field ??= new(); set; } + /// Whether outputPreview is known to be incomplete or truncated. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("outputTruncated")] + public bool? OutputTruncated { get; set; } - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// Shell id, as assigned by Copilot runtime. + [JsonPropertyName("shellId")] + public required string ShellId { get; set; } } -/// User response for a pending exit-plan-mode request, with approval state, selected action, auto-approve flag, and feedback. +/// Image content block with base64-encoded data. +/// The image variant of . [Experimental(Diagnostics.Experimental)] -public sealed class UIExitPlanModeResponse +public partial class ExternalToolTextResultForLlmContentImage : ExternalToolTextResultForLlmContent { - /// 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; } + /// + [JsonIgnore] + public override string Type => "image"; - /// Feedback from the user when they declined the plan or requested changes. - [JsonPropertyName("feedback")] - public string? Feedback { get; set; } + /// Base64-encoded image data. + [Base64String] + [JsonPropertyName("data")] + public required string Data { get; set; } - /// The action the user selected. Defaults to 'autopilot' when autoApproveEdits is true, otherwise 'interactive'. - [JsonPropertyName("selectedAction")] - public UIExitPlanModeAction? SelectedAction { get; set; } + /// MIME type of the image (e.g., image/png, image/jpeg). + [JsonPropertyName("mimeType")] + public required string MimeType { get; set; } } -/// Request ID of a pending `exit_plan_mode.requested` event and the user's response. +/// Audio content block with base64-encoded data. +/// The audio variant of . [Experimental(Diagnostics.Experimental)] -internal sealed class UIHandlePendingExitPlanModeRequest +public partial class ExternalToolTextResultForLlmContentAudio : ExternalToolTextResultForLlmContent { - /// The unique request ID from the exit_plan_mode.requested event. - [JsonPropertyName("requestId")] - public string RequestId { get; set; } = string.Empty; + /// + [JsonIgnore] + public override string Type => "audio"; - /// 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; } + /// Base64-encoded audio data. + [Base64String] + [JsonPropertyName("data")] + public required string Data { get; set; } - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// MIME type of the audio (e.g., audio/wav, audio/mpeg). + [JsonPropertyName("mimeType")] + public required string MimeType { get; set; } } -/// 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). +/// Icon image for a resource. [Experimental(Diagnostics.Experimental)] -public sealed class UIRegisterDirectAutoModeSwitchHandlerResult +public sealed class ExternalToolTextResultForLlmContentResourceLinkIcon { - /// 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; -} + /// MIME type of the icon image. + [JsonPropertyName("mimeType")] + public string? MimeType { get; set; } -/// Identifies the target session. -[Experimental(Diagnostics.Experimental)] -internal sealed class SessionUiRegisterDirectAutoModeSwitchHandlerRequest -{ - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; -} + /// Available icon sizes (e.g., ['16x16', '32x32']). + [JsonPropertyName("sizes")] + public IList? Sizes { get; set; } -/// 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; } + /// 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; } } -/// Opaque handle previously returned by `registerDirectAutoModeSwitchHandler` to release. +/// Resource link content block referencing an external resource. +/// The resource_link variant of . [Experimental(Diagnostics.Experimental)] -internal sealed class UIUnregisterDirectAutoModeSwitchHandlerRequest +public partial class ExternalToolTextResultForLlmContentResourceLink : ExternalToolTextResultForLlmContent { - /// Handle previously returned by `registerDirectAutoModeSwitchHandler`. - [JsonPropertyName("handle")] - public string Handle { get; set; } = string.Empty; + /// + [JsonIgnore] + public override string Type => "resource_link"; - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; -} + /// Human-readable description of the resource. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("description")] + public string? Description { get; set; } -/// Indicates whether the operation succeeded. -[Experimental(Diagnostics.Experimental)] -public sealed class PermissionsConfigureResult -{ - /// Whether the operation succeeded. - [JsonPropertyName("success")] - public bool Success { get; set; } -} + /// Icons associated with this resource. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("icons")] + public IList? Icons { 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. + /// MIME type of the resource content. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("mimeType")] + public string? MimeType { get; set; } + + /// Resource name identifier. [JsonPropertyName("name")] - public string Name { get; set; } = string.Empty; + public required string Name { get; set; } - /// Type of the policy source. - [JsonPropertyName("type")] - public string Type { get; set; } = string.Empty; + /// 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; } } -/// Single content-exclusion rule supplied to `session.permissions.configure`, with paths, match conditions, and source. +/// Embedded resource content block with inline text or binary data. +/// The resource variant of . [Experimental(Diagnostics.Experimental)] -public sealed class PermissionsConfigureAdditionalContentExclusionPolicyRule +public partial class ExternalToolTextResultForLlmContentResource : ExternalToolTextResultForLlmContent { - /// 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; } + /// + [JsonIgnore] + public override string Type => "resource"; - /// Source descriptor for a `session.permissions.configure` content-exclusion rule, with source name and type. - [JsonPropertyName("source")] - public PermissionsConfigureAdditionalContentExclusionPolicyRuleSource Source { get => field ??= new(); set; } + /// The embedded resource contents, either text or base64-encoded binary. + [JsonPropertyName("resource")] + public required JsonElement Resource { get; set; } } -/// Content-exclusion policy supplied to `session.permissions.configure`, with rules, last-updated data, and scope. +/// A message injected by a tool result. [Experimental(Diagnostics.Experimental)] -public sealed class PermissionsConfigureAdditionalContentExclusionPolicy +public sealed class ToolResultNewMessage { - /// 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; } + /// Message content to inject after the tool result. + [JsonPropertyName("content")] + public string Content { get; set; } = string.Empty; - /// Allowed values for the `PermissionsConfigureAdditionalContentExclusionPolicyScope` enumeration. - [JsonPropertyName("scope")] - public PermissionsConfigureAdditionalContentExclusionPolicyScope Scope { get; set; } + /// Source attributed to the injected message. + [JsonPropertyName("source")] + public string Source { get; set; } = string.Empty; } -/// If specified, replaces the session's path-permission policy. The runtime constructs the appropriate PathManager based on these inputs (rooted at the session's working directory). Omit to leave the current path policy unchanged. +/// RPC data type for TaskCompletionDecision operations. [Experimental(Diagnostics.Experimental)] -public sealed class PermissionPathsConfig +public sealed class TaskCompletionDecision { - /// Additional directories to allow tool access to (in addition to the session's working directory). When `unrestricted` is true, these are still pre-populated on the UnrestrictedPathManager so they remain visible via getDirectories() (e.g. for @-mention completion). - [JsonPropertyName("additionalDirectories")] - public IList? AdditionalDirectories { get; set; } + /// Objective eligibility token captured when the decision was evaluated. + [JsonPropertyName("completionEligibilityToken")] + public long? CompletionEligibilityToken { get; set; } - /// Whether to include the system temp directory in the allowed list (defaults to true). Ignored when `unrestricted` is true. - [JsonPropertyName("includeTempDirectory")] - public bool? IncludeTempDirectory { get; set; } + /// Whether completion was accepted after the reviewer-rejection budget was exhausted. + [JsonPropertyName("completionRejectionBudgetExhausted")] + public bool? CompletionRejectionBudgetExhausted { get; set; } - /// If true, the runtime allows access to all paths without prompting. Equivalent to constructing an UnrestrictedPathManager. - [JsonPropertyName("unrestricted")] - public bool? Unrestricted { get; set; } + /// Active autopilot objective evaluated by the completion reviewer. + [JsonPropertyName("objectiveId")] + public long? ObjectiveId { get; set; } - /// Workspace root path (special-cased to be allowed even before the directory exists). Ignored when `unrestricted` is true. - [JsonPropertyName("workspacePath")] - public string? WorkspacePath { get; set; } -} + /// Semantic result of evaluating the task completion request. + [JsonPropertyName("outcome")] + public TaskCompletionOutcome Outcome { get; set; } -/// If specified, replaces the session's approved/denied permission rules. Omit to leave the current rules unchanged. -[Experimental(Diagnostics.Experimental)] -public sealed class PermissionRulesSet -{ - /// Rules that auto-approve matching requests. - [JsonPropertyName("approved")] - public IList Approved { get => field ??= []; set; } + /// Rationale for the completion decision, when one is available. + [JsonPropertyName("reason")] + public string? Reason { get; set; } - /// Rules that auto-deny matching requests. - [JsonPropertyName("denied")] - public IList Denied { get => field ??= []; 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; } } -/// If specified, replaces the session's URL-permission policy. The runtime constructs a fresh DefaultUrlManager based on these inputs. Omit to leave the current URL policy unchanged. +/// Expanded canonical result returned by a session tool. [Experimental(Diagnostics.Experimental)] -public sealed class PermissionUrlsConfig +public sealed class ToolResultExpanded { - /// Initial list of allowed URL/domain patterns. Patterns may include path components. Ignored when `unrestricted` is true. - [JsonPropertyName("initialAllowed")] - public IList? InitialAllowed { get; set; } + /// Base64-encoded binary results returned to the model. + [JsonPropertyName("binaryResultsForLlm")] + public IList? BinaryResultsForLlm { get; set; } - /// If true, the runtime allows access to all URLs without prompting. Initial allow-list is ignored when this is true. - [JsonPropertyName("unrestricted")] - public bool? Unrestricted { get; set; } -} + /// Sources returned by the tool that the model may cite. + [JsonPropertyName("citableSources")] + public IList? CitableSources { get; set; } -/// Patch of permission policy fields to apply (omit a field to leave it unchanged). -[Experimental(Diagnostics.Experimental)] -internal sealed class PermissionsConfigureParams -{ - /// If specified, replaces the host-supplied GitHub Content Exclusion policies on the session (combined with natively-discovered policies when evaluating tool/file access). Omit to leave the current policies unchanged. - [JsonPropertyName("additionalContentExclusionPolicies")] - public IList? AdditionalContentExclusionPolicies { get; set; } + /// Structured content blocks returned to the model. + [JsonPropertyName("contents")] + public IList? Contents { get; set; } - /// If specified, sets whether path/URL read permission requests are auto-approved. Omit to leave the current value unchanged. - [JsonPropertyName("approveAllReadPermissionRequests")] - public bool? ApproveAllReadPermissionRequests { get; set; } + /// Error message for an unsuccessful execution. + [JsonPropertyName("error")] + public string? Error { get; set; } - /// If specified, sets whether tool permission requests are auto-approved without prompting. Omit to leave the current value unchanged. - [JsonPropertyName("approveAllToolPermissionRequests")] - public bool? ApproveAllToolPermissionRequests { get; set; } + /// Metadata propagated with the tool result, including information-flow labels. + [JsonPropertyName("mcpMeta")] + public IDictionary? McpMeta { get; set; } - /// If specified, replaces the session's path-permission policy. The runtime constructs the appropriate PathManager based on these inputs (rooted at the session's working directory). Omit to leave the current path policy unchanged. - [JsonPropertyName("paths")] - public PermissionPathsConfig? Paths { get; set; } + /// Messages to inject after the tool result. + [JsonPropertyName("newMessages")] + public IList? NewMessages { get; set; } - /// If specified, replaces the session's approved/denied permission rules. Omit to leave the current rules unchanged. - [JsonPropertyName("rules")] - public PermissionRulesSet? Rules { get; set; } + /// Whether post-tool-use failure hooks have already processed this result. + [JsonPropertyName("postToolUseFailureHooksProcessed")] + public bool? PostToolUseFailureHooksProcessed { get; set; } - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// Execution outcome classification. + [JsonPropertyName("resultType")] + public ToolResultType ResultType { get; set; } - /// If specified, replaces the session's URL-permission policy. The runtime constructs a fresh DefaultUrlManager based on these inputs. Omit to leave the current URL policy unchanged. - [JsonPropertyName("urls")] - public PermissionUrlsConfig? Urls { get; set; } -} + /// Detailed log content available for session display. + [JsonPropertyName("sessionLog")] + public string? SessionLog { get; set; } -/// Indicates whether the permission decision was applied; false when the request was already resolved. -[Experimental(Diagnostics.Experimental)] -public sealed class PermissionRequestResult -{ - /// Whether the permission request was handled successfully. - [JsonPropertyName("success")] - public bool Success { get; set; } -} + /// Skill invocation metadata produced by the tool. + [JsonPropertyName("skillInvocation")] + public JsonElement? SkillInvocation { 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 large-output post-processing should be skipped. + [JsonPropertyName("skipLargeOutputProcessing")] + public bool? SkipLargeOutputProcessing { get; set; } - /// Controlled reason or actor responsible for the response. - [JsonPropertyName("source")] - public PermissionDecisionSource Source { get; set; } + /// Structured result content in addition to the model-facing text. + [JsonPropertyName("structuredContent")] + public JsonElement? StructuredContent { get; set; } - /// Client surface that submitted the response. - [JsonPropertyName("surface")] - public PermissionDecisionSurface Surface { get; set; } -} + /// Completion-review decision produced by the task-completion tool. + [JsonPropertyName("taskCompletionDecision")] + public TaskCompletionDecision? TaskCompletionDecision { get; set; } -/// The client's response to the pending permission prompt. -/// Polymorphic base type discriminated by kind. -[Experimental(Diagnostics.Experimental)] -[JsonPolymorphic( - TypeDiscriminatorPropertyName = "kind", - UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToBaseType)] -[JsonDerivedType(typeof(PermissionDecisionApproveOnce), "approve-once")] -[JsonDerivedType(typeof(PermissionDecisionApproveForSession), "approve-for-session")] -[JsonDerivedType(typeof(PermissionDecisionApproveForLocation), "approve-for-location")] -[JsonDerivedType(typeof(PermissionDecisionApprovePermanently), "approve-permanently")] -[JsonDerivedType(typeof(PermissionDecisionReject), "reject")] -[JsonDerivedType(typeof(PermissionDecisionUserNotAvailable), "user-not-available")] -[JsonDerivedType(typeof(PermissionDecisionApproved), "approved")] -[JsonDerivedType(typeof(PermissionDecisionApprovedForSession), "approved-for-session")] -[JsonDerivedType(typeof(PermissionDecisionApprovedForLocation), "approved-for-location")] -[JsonDerivedType(typeof(PermissionDecisionCancelled), "cancelled")] -[JsonDerivedType(typeof(PermissionDecisionDeniedByRules), "denied-by-rules")] -[JsonDerivedType(typeof(PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUser), "denied-no-approval-rule-and-could-not-request-from-user")] -[JsonDerivedType(typeof(PermissionDecisionDeniedInteractivelyByUser), "denied-interactively-by-user")] -[JsonDerivedType(typeof(PermissionDecisionDeniedByContentExclusionPolicy), "denied-by-content-exclusion-policy")] -[JsonDerivedType(typeof(PermissionDecisionDeniedByPermissionRequestHook), "denied-by-permission-request-hook")] -public partial class PermissionDecision -{ - /// The type discriminator. - [JsonPropertyName("kind")] - public virtual string Kind { get; set; } = string.Empty; -} + /// 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; } -/// Permission-decision request variant to approve only the current permission request. -/// The approve-once variant of . + /// 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)] -public partial class PermissionDecisionApproveOnce : PermissionDecision +internal sealed class ToolsTaskCompleteEventDataRequest { - /// - [JsonIgnore] - public override string Kind => "approve-once"; + /// Final expanded result returned by the task_complete tool. + [JsonPropertyName("finalResult")] + public ToolResultExpanded FinalResult { get => field ??= new(); set; } - /// True only when a host surfaced this request to a user who approved it. - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("approvedInteractively")] - public bool? ApprovedInteractively { get; set; } + /// 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; } } -/// Session-scoped approval to remember (tool prompts only; omitted for path/url prompts). -/// Polymorphic base type discriminated by kind. +/// Indicates whether the external tool call result was handled successfully. [Experimental(Diagnostics.Experimental)] -[JsonPolymorphic( - TypeDiscriminatorPropertyName = "kind", - UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToBaseType)] -[JsonDerivedType(typeof(PermissionDecisionApproveForSessionApprovalCommands), "commands")] -[JsonDerivedType(typeof(PermissionDecisionApproveForSessionApprovalRead), "read")] -[JsonDerivedType(typeof(PermissionDecisionApproveForSessionApprovalWrite), "write")] -[JsonDerivedType(typeof(PermissionDecisionApproveForSessionApprovalMcp), "mcp")] -[JsonDerivedType(typeof(PermissionDecisionApproveForSessionApprovalMcpSampling), "mcp-sampling")] -[JsonDerivedType(typeof(PermissionDecisionApproveForSessionApprovalMemory), "memory")] -[JsonDerivedType(typeof(PermissionDecisionApproveForSessionApprovalCustomTool), "custom-tool")] -[JsonDerivedType(typeof(PermissionDecisionApproveForSessionApprovalExtensionManagement), "extension-management")] -[JsonDerivedType(typeof(PermissionDecisionApproveForSessionApprovalFactory), "factory")] -[JsonDerivedType(typeof(PermissionDecisionApproveForSessionApprovalExtensionPermissionAccess), "extension-permission-access")] -[JsonDerivedType(typeof(PermissionDecisionApproveForSessionApprovalExtensionEnvAccess), "extension-env-access")] -public partial class PermissionDecisionApproveForSessionApproval +public sealed class HandlePendingToolCallResult { - /// The type discriminator. - [JsonPropertyName("kind")] - public virtual string Kind { get; set; } = string.Empty; + /// Whether the tool call result was handled successfully. + [JsonPropertyName("success")] + public bool Success { get; set; } } - -/// Session-scoped approval details for specific command identifiers. -/// The commands variant of . +/// Pending external tool call request ID, with the tool result or an error describing why it failed. [Experimental(Diagnostics.Experimental)] -public partial class PermissionDecisionApproveForSessionApprovalCommands : PermissionDecisionApproveForSessionApproval +internal sealed class HandlePendingToolCallRequest { - /// - [JsonIgnore] - public override string Kind => "commands"; + /// Error message if the tool call failed. + [JsonPropertyName("error")] + public string? Error { get; set; } - /// Command identifiers covered by this approval. - [JsonPropertyName("commandIdentifiers")] - public required IList CommandIdentifiers { 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; } -/// Session-scoped approval details for read-only filesystem operations. -/// The read variant of . +/// 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 partial class PermissionDecisionApproveForSessionApprovalRead : PermissionDecisionApproveForSessionApproval +public sealed class ToolsInitializeAndValidateResult { - /// - [JsonIgnore] - public override string Kind => "read"; } -/// Session-scoped approval details for filesystem write operations. -/// The write variant of . +/// Identifies the target session. [Experimental(Diagnostics.Experimental)] -public partial class PermissionDecisionApproveForSessionApprovalWrite : PermissionDecisionApproveForSessionApproval +internal sealed class SessionToolsInitializeAndValidateRequest { - /// - [JsonIgnore] - public override string Kind => "write"; + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; } -/// Session-scoped approval details for an MCP server tool, or all tools on the server when `toolName` is null. -/// The mcp variant of . +/// Lightweight metadata for a currently initialized session tool. [Experimental(Diagnostics.Experimental)] -public partial class PermissionDecisionApproveForSessionApprovalMcp : PermissionDecisionApproveForSessionApproval +public sealed class CurrentToolMetadata { - /// - [JsonIgnore] - public override string Kind => "mcp"; + /// Whether the tool is loaded on demand via tool search. + [JsonPropertyName("deferLoading")] + public bool? DeferLoading { get; set; } - /// MCP server name. - [JsonPropertyName("serverName")] - public required string ServerName { get; set; } + /// Tool description. + [JsonPropertyName("description")] + public string Description { get; set; } = string.Empty; - /// MCP tool name, or null to cover every tool on the server. - [JsonPropertyName("toolName")] - public string? ToolName { get; set; } -} + /// JSON Schema for tool input. + [JsonPropertyName("input_schema")] + public IDictionary? InputSchema { get; set; } -/// Session-scoped approval details for MCP sampling requests from a server. -/// The mcp-sampling variant of . -[Experimental(Diagnostics.Experimental)] -public partial class PermissionDecisionApproveForSessionApprovalMcpSampling : PermissionDecisionApproveForSessionApproval -{ - /// - [JsonIgnore] - public override string Kind => "mcp-sampling"; + /// MCP server name for MCP-backed tools. + [JsonPropertyName("mcpServerName")] + public string? McpServerName { get; set; } - /// MCP server name. - [JsonPropertyName("serverName")] - public required string ServerName { 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; } } -/// Session-scoped approval details for writes to long-term memory. -/// The memory variant of . +/// Current lightweight tool metadata snapshot for the session. [Experimental(Diagnostics.Experimental)] -public partial class PermissionDecisionApproveForSessionApprovalMemory : PermissionDecisionApproveForSessionApproval +public sealed class ToolsGetCurrentMetadataResult { - /// - [JsonIgnore] - public override string Kind => "memory"; + /// Current tool metadata, or null when tools have not been initialized yet. + [JsonPropertyName("tools")] + public IList? Tools { get; set; } } -/// Session-scoped approval details for a custom tool, keyed by tool name. -/// The custom-tool variant of . +/// Identifies the target session. [Experimental(Diagnostics.Experimental)] -public partial class PermissionDecisionApproveForSessionApprovalCustomTool : PermissionDecisionApproveForSessionApproval +internal sealed class SessionToolsGetCurrentMetadataRequest { - /// - [JsonIgnore] - public override string Kind => "custom-tool"; - - /// Custom tool name. - [JsonPropertyName("toolName")] - public required string ToolName { get; set; } + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; } -/// Session-scoped approval details for extension-management operations, optionally narrowed by operation. -/// The extension-management variant of . +/// Empty result after replacing the calling connection's externally implemented tools. [Experimental(Diagnostics.Experimental)] -public partial class PermissionDecisionApproveForSessionApprovalExtensionManagement : PermissionDecisionApproveForSessionApproval +public sealed class ToolsSetResult { - /// - [JsonIgnore] - public override string Kind => "extension-management"; - - /// Optional operation identifier; when omitted, the approval covers all extension management operations. - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("operation")] - public string? Operation { get; set; } } -/// Session-scoped factory approval, optionally narrowed by approval key. -/// The factory variant of . +/// Serializable definition of a caller-implemented tool whose execution is handled over the SDK connection. [Experimental(Diagnostics.Experimental)] -public partial class PermissionDecisionApproveForSessionApprovalFactory : PermissionDecisionApproveForSessionApproval +public sealed class ProtocolExternalToolDefinition { - /// - [JsonIgnore] - public override string Kind => "factory"; + /// Tool-loading deferral policy. + [JsonPropertyName("defer")] + public ProtocolExternalToolDefer? Defer { get; set; } - /// Optional factory operation name or canonical approval key; when omitted, the approval covers all factory operations. - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("approvalKey")] - public string? ApprovalKey { get; set; } -} + /// Model-visible explanation of what the tool does. + [JsonPropertyName("description")] + public string Description { get; set; } = string.Empty; -/// Session-scoped approval details for an extension's permission-gated capability access, keyed by extension name. -/// The extension-permission-access variant of . -[Experimental(Diagnostics.Experimental)] -public partial class PermissionDecisionApproveForSessionApprovalExtensionPermissionAccess : PermissionDecisionApproveForSessionApproval -{ - /// - [JsonIgnore] - public override string Kind => "extension-permission-access"; + /// Whether the tool executes commands in a terminal. + [JsonPropertyName("isTerminal")] + public bool? IsTerminal { get; set; } - /// Extension name. - [JsonPropertyName("extensionName")] - public required string ExtensionName { get; set; } -} + /// Optional caller-defined metadata associated with the tool. + [JsonPropertyName("metadata")] + public IDictionary? Metadata { get; set; } -/// Session-scoped approval details for an extension's access to sensitive environment variables, keyed by extension name and the exact set of variable names. -/// The extension-env-access variant of . -[Experimental(Diagnostics.Experimental)] -public partial class PermissionDecisionApproveForSessionApprovalExtensionEnvAccess : PermissionDecisionApproveForSessionApproval -{ - /// - [JsonIgnore] - public override string Kind => "extension-env-access"; + /// Unique model-visible tool name. + [JsonPropertyName("name")] + public string Name { get; set; } = string.Empty; - /// Names of the sensitive environment variables this approval covers. Values are never persisted. - [JsonPropertyName("environmentVariables")] - public required IList EnvironmentVariables { get; set; } + /// Whether this definition replaces a built-in tool with the same name. + [JsonPropertyName("overridesBuiltInTool")] + public bool? OverridesBuiltInTool { get; set; } - /// Extension name. - [JsonPropertyName("extensionName")] - public required string ExtensionName { 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; } } -/// Permission-decision request variant to approve for the rest of the session, with optional tool approval or URL domain. -/// The approve-for-session variant of . +/// Complete externally implemented tool list for the calling connection. An empty list removes every tool previously supplied by that connection. [Experimental(Diagnostics.Experimental)] -public partial class PermissionDecisionApproveForSession : PermissionDecision +internal sealed class ToolsSetRequest { - /// - [JsonIgnore] - public override string Kind => "approve-for-session"; - - /// Session-scoped approval to remember (tool prompts only; omitted for path/url prompts). - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("approval")] - public PermissionDecisionApproveForSessionApproval? Approval { get; set; } + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; - /// URL domain to approve for the rest of the session (URL prompts only). - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("domain")] - public string? Domain { get; set; } + /// Complete replacement list for the calling connection. + [JsonPropertyName("tools")] + public IList Tools { get => field ??= []; set; } } -/// Approval to persist for this location. -/// Polymorphic base type discriminated by kind. +/// Empty result after applying subagent settings. [Experimental(Diagnostics.Experimental)] -[JsonPolymorphic( - TypeDiscriminatorPropertyName = "kind", - UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToBaseType)] -[JsonDerivedType(typeof(PermissionDecisionApproveForLocationApprovalCommands), "commands")] -[JsonDerivedType(typeof(PermissionDecisionApproveForLocationApprovalRead), "read")] -[JsonDerivedType(typeof(PermissionDecisionApproveForLocationApprovalWrite), "write")] -[JsonDerivedType(typeof(PermissionDecisionApproveForLocationApprovalMcp), "mcp")] -[JsonDerivedType(typeof(PermissionDecisionApproveForLocationApprovalMcpSampling), "mcp-sampling")] -[JsonDerivedType(typeof(PermissionDecisionApproveForLocationApprovalMemory), "memory")] -[JsonDerivedType(typeof(PermissionDecisionApproveForLocationApprovalCustomTool), "custom-tool")] -[JsonDerivedType(typeof(PermissionDecisionApproveForLocationApprovalExtensionManagement), "extension-management")] -[JsonDerivedType(typeof(PermissionDecisionApproveForLocationApprovalFactory), "factory")] -[JsonDerivedType(typeof(PermissionDecisionApproveForLocationApprovalExtensionPermissionAccess), "extension-permission-access")] -[JsonDerivedType(typeof(PermissionDecisionApproveForLocationApprovalExtensionEnvAccess), "extension-env-access")] -public partial class PermissionDecisionApproveForLocationApproval +public sealed class ToolsUpdateSubagentSettingsResult { - /// The type discriminator. - [JsonPropertyName("kind")] - public virtual string Kind { get; set; } = string.Empty; } - -/// Location-scoped approval details for specific command identifiers. -/// The commands variant of . +/// Subagent model, reasoning effort, and context tier settings. [Experimental(Diagnostics.Experimental)] -public partial class PermissionDecisionApproveForLocationApprovalCommands : PermissionDecisionApproveForLocationApproval +public sealed class SubagentSettingsEntry { - /// - [JsonIgnore] - public override string Kind => "commands"; + /// Context tier override for matching subagents. + [JsonPropertyName("contextTier")] + public SubagentSettingsEntryContextTier? ContextTier { get; set; } - /// Command identifiers covered by this approval. - [JsonPropertyName("commandIdentifiers")] - public required IList CommandIdentifiers { 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; } } -/// Location-scoped approval details for read-only filesystem operations. -/// The read variant of . -[Experimental(Diagnostics.Experimental)] -public partial class PermissionDecisionApproveForLocationApprovalRead : PermissionDecisionApproveForLocationApproval +/// Configured per-agent subagent overrides. +public sealed class UpdateSubagentSettingsRequestSubagents { - /// - [JsonIgnore] - public override string Kind => "read"; + /// 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; } } -/// Location-scoped approval details for filesystem write operations. -/// The write variant of . +/// Subagent settings to apply to the current session. [Experimental(Diagnostics.Experimental)] -public partial class PermissionDecisionApproveForLocationApprovalWrite : PermissionDecisionApproveForLocationApproval +internal sealed class UpdateSubagentSettingsRequest { - /// - [JsonIgnore] - public override string Kind => "write"; + /// 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; } } -/// Location-scoped approval details for an MCP server tool, or all tools on the server when `toolName` is null. -/// The mcp variant of . +/// RPC data type for SessionCommandsList operations. [Experimental(Diagnostics.Experimental)] -public partial class PermissionDecisionApproveForLocationApprovalMcp : PermissionDecisionApproveForLocationApproval +public sealed class SessionCommandsListRequest { - /// - [JsonIgnore] - public override string Kind => "mcp"; + /// Include runtime built-in commands. + [JsonPropertyName("includeBuiltins")] + public bool? IncludeBuiltins { get; set; } - /// MCP server name. - [JsonPropertyName("serverName")] - public required string ServerName { get; set; } + /// Include commands registered by protocol clients, including SDK clients and extensions. + [JsonPropertyName("includeClientCommands")] + public bool? IncludeClientCommands { get; set; } - /// MCP tool name, or null to cover every tool on the server. - [JsonPropertyName("toolName")] - public string? ToolName { get; set; } + /// Include enabled user-invocable skills and commands. + [JsonPropertyName("includeSkills")] + public bool? IncludeSkills { get; set; } } -/// Location-scoped approval details for MCP sampling requests from a server. -/// The mcp-sampling variant of . +/// RPC data type for SessionCommandsListRequestWithSession operations. [Experimental(Diagnostics.Experimental)] -public partial class PermissionDecisionApproveForLocationApprovalMcpSampling : PermissionDecisionApproveForLocationApproval +internal sealed class SessionCommandsListRequestWithSession { - /// - [JsonIgnore] - public override string Kind => "mcp-sampling"; + /// Include runtime built-in commands. + [JsonPropertyName("includeBuiltins")] + public bool? IncludeBuiltins { get; set; } - /// MCP server name. - [JsonPropertyName("serverName")] - public required string ServerName { get; set; } -} + /// Include commands registered by protocol clients, including SDK clients and extensions. + [JsonPropertyName("includeClientCommands")] + public bool? IncludeClientCommands { get; set; } -/// Location-scoped approval details for writes to long-term memory. -/// The memory variant of . -[Experimental(Diagnostics.Experimental)] -public partial class PermissionDecisionApproveForLocationApprovalMemory : PermissionDecisionApproveForLocationApproval -{ - /// - [JsonIgnore] - public override string Kind => "memory"; + /// 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; } -/// Location-scoped approval details for a custom tool, keyed by tool name. -/// The custom-tool variant of . +/// 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)] -public partial class PermissionDecisionApproveForLocationApprovalCustomTool : PermissionDecisionApproveForLocationApproval +[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 { - /// - [JsonIgnore] - public override string Kind => "custom-tool"; - - /// Custom tool name. - [JsonPropertyName("toolName")] - public required string ToolName { get; set; } + /// The type discriminator. + [JsonPropertyName("kind")] + public virtual string Kind { get; set; } = string.Empty; } -/// Location-scoped approval details for extension-management operations, optionally narrowed by operation. -/// The extension-management variant of . + +/// Slash-command invocation result containing text output plus Markdown/ANSI rendering flags. +/// The text variant of . [Experimental(Diagnostics.Experimental)] -public partial class PermissionDecisionApproveForLocationApprovalExtensionManagement : PermissionDecisionApproveForLocationApproval +public partial class SlashCommandInvocationResultText : SlashCommandInvocationResult { /// [JsonIgnore] - public override string Kind => "extension-management"; + public override string Kind => "text"; - /// Optional operation identifier; when omitted, the approval covers all extension management operations. + /// Whether text contains Markdown. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("operation")] - public string? Operation { get; set; } -} + [JsonPropertyName("markdown")] + public bool? Markdown { get; set; } -/// Location-scoped factory approval, optionally narrowed by approval key. -/// The factory variant of . -[Experimental(Diagnostics.Experimental)] -public partial class PermissionDecisionApproveForLocationApprovalFactory : PermissionDecisionApproveForLocationApproval -{ - /// - [JsonIgnore] - public override string Kind => "factory"; + /// Whether ANSI sequences should be preserved. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("preserveAnsi")] + public bool? PreserveAnsi { get; set; } - /// Optional factory operation name or canonical approval key; when omitted, the approval covers all factory operations. + /// True when the invocation mutated user runtime settings; consumers caching settings should refresh. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("approvalKey")] - public string? ApprovalKey { get; set; } + [JsonPropertyName("runtimeSettingsChanged")] + public bool? RuntimeSettingsChanged { get; set; } + + /// Text output for the client to render. + [JsonPropertyName("text")] + public required string Text { get; set; } } -/// Location-scoped approval details for an extension's permission-gated capability access, keyed by extension name. -/// The extension-permission-access variant of . +/// 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 PermissionDecisionApproveForLocationApprovalExtensionPermissionAccess : PermissionDecisionApproveForLocationApproval +public partial class SlashCommandInvocationResultAgentPrompt : SlashCommandInvocationResult { /// [JsonIgnore] - public override string Kind => "extension-permission-access"; + public override string Kind => "agent-prompt"; - /// Extension name. - [JsonPropertyName("extensionName")] - public required string ExtensionName { get; set; } -} + /// Prompt text to display to the user. + [JsonPropertyName("displayPrompt")] + public required string DisplayPrompt { get; set; } -/// Location-scoped approval details for an extension's access to sensitive environment variables, keyed by extension name and the exact set of variable names. -/// The extension-env-access variant of . -[Experimental(Diagnostics.Experimental)] -public partial class PermissionDecisionApproveForLocationApprovalExtensionEnvAccess : PermissionDecisionApproveForLocationApproval -{ - /// - [JsonIgnore] - public override string Kind => "extension-env-access"; + /// Optional target session mode for the agent prompt. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("mode")] + public SessionMode? Mode { get; set; } - /// Names of the sensitive environment variables this approval covers. Values are never persisted. - [JsonPropertyName("environmentVariables")] - public required IList EnvironmentVariables { get; set; } + /// Optional user-facing notice to show before the prompt is submitted. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("notice")] + public string? Notice { get; set; } - /// Extension name. - [JsonPropertyName("extensionName")] - public required string ExtensionName { 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; } } -/// Permission-decision request variant to approve and persist a permission for a project location, with approval details and location key. -/// The approve-for-location variant of . +/// Slash-command invocation result indicating completion, with optional message and settings-change flag. +/// The completed variant of . [Experimental(Diagnostics.Experimental)] -public partial class PermissionDecisionApproveForLocation : PermissionDecision +public partial class SlashCommandInvocationResultCompleted : SlashCommandInvocationResult { /// [JsonIgnore] - public override string Kind => "approve-for-location"; + public override string Kind => "completed"; - /// Approval to persist for this location. - [JsonPropertyName("approval")] - public required PermissionDecisionApproveForLocationApproval Approval { get; set; } + /// Optional user-facing message describing the completed command. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("message")] + public string? Message { get; set; } - /// Location key (git root or cwd) to persist the approval to. - [JsonPropertyName("locationKey")] - public required string LocationKey { 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; } } -/// Permission-decision request variant to permanently approve a URL domain across sessions. -/// The approve-permanently variant of . +/// Selectable slash-command subcommand option with name, description, and optional group label. [Experimental(Diagnostics.Experimental)] -public partial class PermissionDecisionApprovePermanently : PermissionDecision +public sealed class SlashCommandSelectSubcommandOption { - /// - [JsonIgnore] - public override string Kind => "approve-permanently"; + /// Human-readable description of the subcommand. + [JsonPropertyName("description")] + public string Description { get; set; } = string.Empty; - /// URL domain to approve permanently. - [JsonPropertyName("domain")] - public required string Domain { get; set; } + /// 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; } -/// Permission-decision request variant to reject a pending permission request, with optional feedback. -/// The reject variant of . +/// 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 PermissionDecisionReject : PermissionDecision +public partial class SlashCommandInvocationResultSelectSubcommand : SlashCommandInvocationResult { /// [JsonIgnore] - public override string Kind => "reject"; + public override string Kind => "select-subcommand"; - /// Optional feedback explaining the rejection. + /// 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("feedback")] - public string? Feedback { get; set; } -} + [JsonPropertyName("runtimeSettingsChanged")] + public bool? RuntimeSettingsChanged { get; set; } -/// Permission-decision variant indicating no user was available to confirm the request. -/// The user-not-available variant of . -[Experimental(Diagnostics.Experimental)] -public partial class PermissionDecisionUserNotAvailable : PermissionDecision -{ - /// - [JsonIgnore] - public override string Kind => "user-not-available"; + /// Human-readable title for the selection UI. + [JsonPropertyName("title")] + public required string Title { get; set; } } -/// Permission-decision variant indicating the request was approved. -/// The approved variant of . +/// RPC data type for SlashCommandTimelineEntry operations. [Experimental(Diagnostics.Experimental)] -public partial class PermissionDecisionApproved : PermissionDecision +public sealed class SlashCommandTimelineEntry { - /// - [JsonIgnore] - public override string Kind => "approved"; + /// 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; } } -/// Permission-decision variant indicating approval was remembered for the session, with approval details. -/// The approved-for-session variant of . +/// The add-timeline-entry variant of . [Experimental(Diagnostics.Experimental)] -public partial class PermissionDecisionApprovedForSession : PermissionDecision +public partial class SlashCommandInvocationResultAddTimelineEntry : SlashCommandInvocationResult { /// [JsonIgnore] - public override string Kind => "approved-for-session"; + public override string Kind => "add-timeline-entry"; - /// The approval to add as a session-scoped rule. - [JsonPropertyName("approval")] - public required UserToolSessionApproval Approval { get; set; } + /// 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; } } -/// Permission-decision variant indicating approval was persisted for a project location, with approval details and location key. -/// The approved-for-location variant of . +/// RPC data type for SlashCommandModelPickerDialog operations. [Experimental(Diagnostics.Experimental)] -public partial class PermissionDecisionApprovedForLocation : PermissionDecision +public sealed class SlashCommandModelPickerDialog { - /// - [JsonIgnore] - public override string Kind => "approved-for-location"; + /// Discriminator for a model-picker dialog. + [JsonPropertyName("kind")] + public string Kind { get; set; } = string.Empty; - /// The approval to persist for this location. - [JsonPropertyName("approval")] - public required UserToolSessionApproval Approval { get; set; } + /// Model that should be enabled before it can be selected. + [JsonPropertyName("modelToEnable")] + public string? ModelToEnable { get; set; } - /// The location key (git root or cwd) to persist the approval to. - [JsonPropertyName("locationKey")] - public required string LocationKey { 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; } } -/// Permission-decision variant indicating the request was cancelled before use, with an optional reason. -/// The cancelled variant of . +/// The show-dialog variant of . [Experimental(Diagnostics.Experimental)] -public partial class PermissionDecisionCancelled : PermissionDecision +public partial class SlashCommandInvocationResultShowDialog : SlashCommandInvocationResult { /// [JsonIgnore] - public override string Kind => "cancelled"; + public override string Kind => "show-dialog"; - /// Optional explanation of why the request was cancelled. + /// 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("reason")] - public string? Reason { get; set; } + [JsonPropertyName("runtimeSettingsChanged")] + public bool? RuntimeSettingsChanged { get; set; } } -/// Permission-decision variant indicating explicit denial by permission rules, with the matching rules. -/// The denied-by-rules variant of . -[Experimental(Diagnostics.Experimental)] -public partial class PermissionDecisionDeniedByRules : PermissionDecision +/// User-settings snapshot to restore if the host cancels the model switch. +public sealed class SlashCommandInvocationResultSetModelRevertOnCancel { - /// - [JsonIgnore] - public override string Kind => "denied-by-rules"; - - /// Rules that denied the request. - [JsonPropertyName("rules")] - public required IList Rules { get; set; } } -/// Permission-decision variant indicating no approval rule matched and user confirmation was unavailable. -/// The denied-no-approval-rule-and-could-not-request-from-user variant of . +/// The set-model variant of . [Experimental(Diagnostics.Experimental)] -public partial class PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUser : PermissionDecision +public partial class SlashCommandInvocationResultSetModel : SlashCommandInvocationResult { /// [JsonIgnore] - public override string Kind => "denied-no-approval-rule-and-could-not-request-from-user"; -} + public override string Kind => "set-model"; -/// Permission-decision variant indicating the user denied an interactive prompt, with optional feedback and force-reject flag. -/// The denied-interactively-by-user variant of . -[Experimental(Diagnostics.Experimental)] -public partial class PermissionDecisionDeniedInteractivelyByUser : PermissionDecision -{ - /// - [JsonIgnore] - public override string Kind => "denied-interactively-by-user"; + /// Model selected by the command. + [JsonPropertyName("model")] + public required string Model { get; set; } - /// Optional feedback from the user explaining the denial. + /// Reasoning effort selected for the model. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("feedback")] - public string? Feedback { get; set; } + [JsonPropertyName("reasoningEffort")] + public string? ReasoningEffort { get; set; } - /// Whether to force-reject the current agent turn. + /// Repository settings scope modified by the command. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("forceReject")] - public bool? ForceReject { get; set; } -} + [JsonPropertyName("repoScope")] + public string? RepoScope { get; set; } -/// Permission-decision variant indicating denial by content-exclusion policy, with path and message. -/// The denied-by-content-exclusion-policy variant of . -[Experimental(Diagnostics.Experimental)] -public partial class PermissionDecisionDeniedByContentExclusionPolicy : PermissionDecision -{ - /// - [JsonIgnore] - public override string Kind => "denied-by-content-exclusion-policy"; + /// User-settings snapshot to restore if the host cancels the model switch. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("revertOnCancel")] + public SlashCommandInvocationResultSetModelRevertOnCancel? RevertOnCancel { get; set; } - /// Human-readable explanation of why the path was excluded. - [JsonPropertyName("message")] - public required string Message { get; set; } + /// Whether command execution changed persisted runtime settings. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("runtimeSettingsChanged")] + public bool? RuntimeSettingsChanged { get; set; } - /// File path that triggered the exclusion. - [JsonPropertyName("path")] - public required string Path { 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; } } -/// Permission-decision variant indicating denial by a permission request hook, with optional message and interrupt flag. -/// The denied-by-permission-request-hook variant of . +/// The set-plan-model variant of . [Experimental(Diagnostics.Experimental)] -public partial class PermissionDecisionDeniedByPermissionRequestHook : PermissionDecision +public partial class SlashCommandInvocationResultSetPlanModel : SlashCommandInvocationResult { /// [JsonIgnore] - public override string Kind => "denied-by-permission-request-hook"; + public override string Kind => "set-plan-model"; - /// Whether to interrupt the current agent turn. + /// 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("interrupt")] - public bool? Interrupt { get; set; } + [JsonPropertyName("planModel")] + public string? PlanModel { get; set; } - /// Optional message from the hook explaining the denial. + /// Whether command execution changed persisted runtime settings. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("message")] - public string? Message { get; set; } + [JsonPropertyName("runtimeSettingsChanged")] + public bool? RuntimeSettingsChanged { get; set; } } -/// Pending permission request ID and the decision to apply (approve/reject and scope). +/// Slash command name and optional raw input string to invoke. [Experimental(Diagnostics.Experimental)] -internal sealed class PermissionDecisionRequest +internal sealed class CommandsInvokeRequest { - /// Optional informational context describing how and where this response was made. Omit it to preserve legacy behavior without attributing an origin. - [JsonPropertyName("decisionContext")] - public PermissionDecisionContext? DecisionContext { get; set; } + /// Raw input after the command name. + [JsonPropertyName("input")] + public string? Input { get; set; } - /// Request ID of the pending permission request. - [JsonPropertyName("requestId")] - public string RequestId { get; set; } = string.Empty; + /// Command name. Leading slashes are stripped and the name is matched case-insensitively. + [JsonPropertyName("name")] + public string Name { get; set; } = string.Empty; - /// The client's response to the pending permission prompt. - [JsonPropertyName("result")] - public PermissionDecision Result { get => field ??= new(); set; } + /// 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; } -/// Pending permission prompt reconstructed from event history, with request ID and user-facing prompt details. +/// Whether finalizing the invocation effect succeeded, and the failure reason when it did not. [Experimental(Diagnostics.Experimental)] -public sealed class PendingPermissionRequest +internal sealed class CommandsFinalizeInvocationEffectResult { - /// The user-facing permission prompt details (commands, write, read, mcp, url, memory, custom-tool, path, hook). - [JsonPropertyName("request")] - public PermissionPromptRequest Request { get; set; } = null!; + /// Failure reason when the invocation effect could not be finalized. + [JsonPropertyName("error")] + public string? Error { get; set; } - /// Unique identifier for the pending permission request. - [JsonPropertyName("requestId")] - public string RequestId { get; set; } = string.Empty; + /// Whether the pending invocation effect was finalized successfully. + [JsonPropertyName("success")] + public bool Success { get; set; } } -/// List of pending permission requests reconstructed from event history. -[Experimental(Diagnostics.Experimental)] -public sealed class PendingPermissionRequestList +/// The slash-command result object that produced the pending effect, echoed back unchanged. +public sealed class CommandsFinalizeInvocationEffectRequestEffect { - /// Pending permission prompts reconstructed from the session's event history. Equivalent to the set of `permission.requested` events that have not yet been followed by a matching `permission.completed` event. Used by clients (e.g. the CLI) to hydrate UI for prompts that were emitted before the client attached to the session. - [JsonPropertyName("items")] - public IList Items { get => field ??= []; set; } } -/// No parameters; returns currently-pending permission requests for the session. +/// The pending slash-command invocation effect to finalize, plus whether the host applied or cancelled it. [Experimental(Diagnostics.Experimental)] -internal sealed class PermissionsPendingRequestsRequest +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 operation succeeded. +/// Indicates whether the pending client-handled command was completed successfully. [Experimental(Diagnostics.Experimental)] -public sealed class PermissionsSetApproveAllResult +public sealed class CommandsHandlePendingCommandResult { - /// Whether the operation succeeded. + /// Whether the command was handled successfully. [JsonPropertyName("success")] public bool Success { get; set; } } -/// Allow-all toggle for tool permission requests, with an optional telemetry source. +/// Pending command request ID and an optional error if the client handler failed. [Experimental(Diagnostics.Experimental)] -internal sealed class PermissionsSetApproveAllRequest +internal sealed class CommandsHandlePendingCommandRequest { - /// Whether to auto-approve all tool permission requests. - [JsonPropertyName("enabled")] - public bool Enabled { get; set; } + /// 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; - - /// Optional source for allow-all telemetry. Defaults to `rpc` when omitted for SDK callers. - [JsonPropertyName("source")] - public PermissionsSetApproveAllSource? Source { get; set; } } -/// Indicates whether the operation succeeded and reports the post-mutation state. +/// Error message produced while executing the command, if any. [Experimental(Diagnostics.Experimental)] -public sealed class AllowAllPermissionSetResult +public sealed class ExecuteCommandResult { - /// Authoritative full allow-all state after the mutation. - [JsonPropertyName("enabled")] - public bool Enabled { get; set; } - - /// Authoritative allow-all mode after the mutation. - [JsonPropertyName("mode")] - public PermissionsAllowAllMode? Mode { get; set; } - - /// Whether the operation succeeded. - [JsonPropertyName("success")] - public bool Success { get; set; } + /// Error message produced while executing the command, if any. Omitted when the handler succeeded. + [JsonPropertyName("error")] + public string? Error { get; set; } } -/// Allow-all mode to apply for the session. +/// Slash command name and argument string to execute synchronously. [Experimental(Diagnostics.Experimental)] -internal sealed class PermissionsSetAllowAllRequest +internal sealed class ExecuteCommandParams { - /// Legacy full allow-all toggle. Prefer `mode`; when `mode` is omitted, `enabled: true` is treated as `mode: "on"` and any other value is treated as `mode: "off"`. - [JsonPropertyName("enabled")] - public bool? Enabled { get; set; } - - /// Allow-all mode to apply. `on` enables full allow-all; `auto` enables advisory LLM auto-approval; `off` disables both. - [JsonPropertyName("mode")] - public PermissionsAllowAllMode? Mode { get; set; } + /// Argument string to pass to the command (empty string if none). + [JsonPropertyName("args")] + public string Args { get; set; } = string.Empty; - /// Optional model id for the `auto` mode auto-approval LLM judging. Only meaningful when `mode` is `auto`; ignored otherwise. When omitted, the session resolves a default judge model: `gpt-5.5` for CAPI sessions and the session's active model for BYOK sessions. - [JsonPropertyName("model")] - public string? Model { get; set; } + /// 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; - - /// Optional source for allow-all telemetry. Defaults to `rpc` when omitted for SDK callers. - [JsonPropertyName("source")] - public PermissionsSetAllowAllSource? Source { get; set; } } -/// Current allow-all permission mode. +/// Indicates whether the command was accepted into the local execution queue. [Experimental(Diagnostics.Experimental)] -public sealed class AllowAllPermissionState +public sealed class EnqueueCommandResult { - /// Whether full allow-all permissions are currently active. - [JsonPropertyName("enabled")] - public bool Enabled { get; set; } - - /// Current allow-all mode. - [JsonPropertyName("mode")] - public PermissionsAllowAllMode? Mode { get; set; } + /// 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; } } -/// No parameters. +/// Slash-prefixed command string to enqueue for FIFO processing. [Experimental(Diagnostics.Experimental)] -internal sealed class PermissionsGetAllowAllRequest +internal sealed class EnqueueCommandParams { + /// Slash-prefixed command string to enqueue, e.g. '/compact' or '/model gpt-4'. Queued FIFO with any in-flight items; if the session is idle, processing kicks off immediately. + [JsonPropertyName("command")] + public string Command { get; set; } = string.Empty; + /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } -/// Indicates whether the operation succeeded. +/// Indicates whether the queued-command response was matched to a pending request. [Experimental(Diagnostics.Experimental)] -public sealed class PermissionsModifyRulesResult +public sealed class CommandsRespondToQueuedCommandResult { - /// Whether the operation succeeded. + /// 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; } } -/// Scope and add/remove instructions for modifying session- or location-scoped permission rules. +/// Result of the queued command execution. +/// Data type discriminated by handled. [Experimental(Diagnostics.Experimental)] -internal sealed class PermissionsModifyRulesParams +public partial class QueuedCommandResult { - /// Rules to add to the scope. Applied before `remove`/`removeAll`. - [JsonPropertyName("add")] - public IList? Add { get; set; } + /// The boolean discriminator. + [JsonPropertyName("handled")] + public bool Handled { get; set; } - /// Specific rules to remove from the scope. Ignored when `removeAll` is true. - [JsonPropertyName("remove")] - public IList? Remove { 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; } +} - /// When true, removes every rule currently in the scope (after any `add` is applied). Useful for clearing the location scope wholesale. - [JsonPropertyName("removeAll")] - public bool? RemoveAll { get; set; } +/// 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; - /// Whether the change applies to ephemeral session-scoped rules (cleared at session end) or to location-scoped rules persisted via the location-permissions config file. - [JsonPropertyName("scope")] - public PermissionsModifyRulesScope Scope { get; set; } + /// 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; } -/// Indicates whether the operation succeeded. +/// Telemetry engagement ID for the session, when available. [Experimental(Diagnostics.Experimental)] -public sealed class PermissionsSetRequiredResult +public sealed class SessionTelemetryEngagement { - /// Whether the operation succeeded. - [JsonPropertyName("success")] - public bool Success { get; set; } + /// Current telemetry engagement ID, when available. + [JsonPropertyName("engagementId")] + public string? EngagementId { get; set; } } -/// Toggles whether permission prompts should be bridged into session events for this client. +/// Identifies the target session. [Experimental(Diagnostics.Experimental)] -internal sealed class PermissionsSetRequiredRequest +internal sealed class SessionTelemetryGetEngagementIdRequest { - /// Whether the client wants `permission.requested` events bridged from the session-owned permission service. CLI clients that render prompt UI set this to `true` for as long as their listener is mounted; headless callers leave it unset (the default is `false`). - [JsonPropertyName("required")] - public bool Required { get; set; } + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// 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; } -/// Indicates whether the operation succeeded. +/// 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 PermissionsResetSessionApprovalsResult +public sealed class UIEphemeralQueryResult { - /// Whether the operation succeeded. - [JsonPropertyName("success")] - public bool Success { get; set; } + /// Answer returned by the model. + [JsonPropertyName("answer")] + public string Answer { get; set; } = string.Empty; } -/// Clears session-scoped tool permission approvals, and optionally the location-scoped ones. +/// Transient question to answer without adding it to conversation history. [Experimental(Diagnostics.Experimental)] -internal sealed class PermissionsResetSessionApprovalsRequest +internal sealed class UIEphemeralQueryRequest { - /// Whether location-scoped approvals are cleared too. Defaults to `true`. - [JsonPropertyName("includeLocation")] - public bool? IncludeLocation { get; set; } + /// 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; } -/// Indicates whether the operation succeeded. -[Experimental(Diagnostics.Experimental)] -public sealed class PermissionsNotifyPromptShownResult +/// MCP response metadata. +public sealed class UIElicitationResponseMeta { - /// Whether the operation succeeded. - [JsonPropertyName("success")] - public bool Success { get; set; } } -/// Notification payload describing the permission prompt that the client just rendered. +/// The elicitation response (accept with form values, decline, or cancel). [Experimental(Diagnostics.Experimental)] -internal sealed class PermissionPromptShownNotification +public sealed class UIElicitationResponse { - /// Human-readable description of the prompt the user is being asked to approve. Used by the runtime to fire the registered `permission_prompt` notification hook (e.g. terminal bell, desktop notification). - [JsonPropertyName("message")] - public string Message { get; set; } = string.Empty; + /// MCP response metadata. + [JsonPropertyName("_meta")] + public UIElicitationResponseMeta? Meta { get; set; } - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// 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; } } -/// Snapshot of the session's allow-listed directories and primary working directory. +/// MCP request metadata. +public sealed class UIElicitationRequestMeta +{ +} + +/// JSON Schema describing the form fields to present to the user. [Experimental(Diagnostics.Experimental)] -public sealed class PermissionPathsList +public sealed class UIElicitationSchema { - /// All directories currently allowed for tool access on this session. - [JsonPropertyName("directories")] - public IList Directories { get => field ??= []; set; } + /// Form field definitions, keyed by field name. + [JsonPropertyName("properties")] + public IDictionary Properties { get => field ??= new Dictionary(); set; } - /// The primary working directory for this session. - [JsonPropertyName("primary")] - public string Primary { get; set; } = string.Empty; + /// 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; } -/// No parameters; returns the session's allow-listed directories. +/// Metadata controlling an MCP task's lifetime. [Experimental(Diagnostics.Experimental)] -internal sealed class PermissionsPathsListRequest +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 operation succeeded. +/// Indicates whether the elicitation response was accepted; false if it was already resolved by another client. [Experimental(Diagnostics.Experimental)] -public sealed class PermissionsPathsAddResult +public sealed class UIElicitationResult { - /// Whether the operation succeeded. + /// Whether the response was accepted. False if the request was already resolved by another client. [JsonPropertyName("success")] public bool Success { get; set; } } -/// Directory path to add to the session's allowed directories. +/// Pending elicitation request ID and the user's response (accept/decline/cancel + form values). [Experimental(Diagnostics.Experimental)] -internal sealed class PermissionPathsAddParams +internal sealed class UIHandlePendingElicitationRequest { - /// Directory to add to the allow-list. The runtime resolves and validates the path before adding. - [JsonPropertyName("path")] - public string Path { get; set; } = string.Empty; + /// 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 operation succeeded. +/// Indicates whether the pending UI request was resolved by this call. [Experimental(Diagnostics.Experimental)] -public sealed class PermissionsPathsUpdatePrimaryResult +public sealed class UIHandlePendingResult { - /// Whether the operation succeeded. + /// 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; } } -/// Directory path to set as the session's new primary working directory. +/// User response for a pending user-input request, with answer text and whether it was typed freeform. [Experimental(Diagnostics.Experimental)] -internal sealed class PermissionPathsUpdatePrimaryParams +public sealed class UIUserInputResponse { - /// Directory to set as the new primary working directory for the session's permission policy. - [JsonPropertyName("path")] - public string Path { get; set; } = string.Empty; + /// 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; } -/// Indicates whether the supplied path is within the session's allowed directories. +/// Optional sampling result payload. Omit to reject/cancel the sampling request without providing a result. [Experimental(Diagnostics.Experimental)] -public sealed class PermissionPathsAllowedCheckResult +public sealed class UIHandlePendingSamplingResponse { - /// Whether the path is within the session's allowed directories. - [JsonPropertyName("allowed")] - public bool Allowed { get; set; } } -/// Path to evaluate against the session's allowed directories. +/// Request ID of a pending `sampling.requested` event and an optional sampling result payload (omit to reject). [Experimental(Diagnostics.Experimental)] -internal sealed class PermissionPathsAllowedCheckParams +internal sealed class UIHandlePendingSamplingRequest { - /// Path to check against the session's allowed directories. - [JsonPropertyName("path")] - public string Path { get; set; } = string.Empty; + /// 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; } -/// Indicates whether the supplied path is within the session's workspace directory. +/// Request ID of a pending `auto_mode_switch.requested` event and the user's response. [Experimental(Diagnostics.Experimental)] -public sealed class PermissionPathsWorkspaceCheckResult +internal sealed class UIHandlePendingAutoModeSwitchRequest { - /// Whether the path is within the session workspace directory. - [JsonPropertyName("allowed")] - public bool Allowed { get; set; } -} + /// The unique request ID from the auto_mode_switch.requested event. + [JsonPropertyName("requestId")] + public string RequestId { get; set; } = string.Empty; -/// Path to evaluate against the session's workspace (primary) directory. -[Experimental(Diagnostics.Experimental)] -internal sealed class PermissionPathsWorkspaceCheckParams -{ - /// Path to check against the session workspace directory. - [JsonPropertyName("path")] - public string Path { get; set; } = string.Empty; + /// 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; } -/// Resolved location-permissions key and type. +/// The user's selected action for an exhausted session limit. [Experimental(Diagnostics.Experimental)] -public sealed class PermissionLocationResolveResult +public sealed class UISessionLimitsExhaustedResponse { - /// Location key used in the location-permissions store. - [JsonPropertyName("locationKey")] - public string LocationKey { get; set; } = string.Empty; + /// Action selected by the user. + [JsonPropertyName("action")] + public UISessionLimitsExhaustedResponseAction Action { get; set; } - /// Whether the location is a git repo or directory. - [JsonPropertyName("locationType")] - public PermissionLocationType LocationType { 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; } } -/// Working directory to resolve into a location-permissions key. +/// Request ID of a pending `session_limits_exhausted.requested` event and the user's selected limit action. [Experimental(Diagnostics.Experimental)] -internal sealed class PermissionLocationResolveParams +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; - - /// Working directory whose permission location should be resolved. - [JsonPropertyName("workingDirectory")] - public string WorkingDirectory { get; set; } = string.Empty; } -/// Summary of persisted location permissions applied to the session. +/// 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 PermissionLocationApplyResult +public sealed class UIExitPlanModeResponse { - /// Number of persisted allowed directories added to the live path manager. - [JsonPropertyName("appliedDirectoryCount")] - public long AppliedDirectoryCount { get; set; } - - /// Number of location-scoped rules added to the live permission service. - [JsonPropertyName("appliedRuleCount")] - public long AppliedRuleCount { get; set; } + /// Whether the plan was approved. + [JsonPropertyName("approved")] + public bool Approved { get; set; } - /// Location-scoped rules applied to the live permission service. - [JsonPropertyName("appliedRules")] - public IList AppliedRules { get => field ??= []; set; } + /// Whether subsequent edits should be auto-approved without confirmation. + [JsonPropertyName("autoApproveEdits")] + public bool? AutoApproveEdits { get; set; } - /// Whether a different location was applied since the previous apply call. - [JsonPropertyName("changed")] - public bool Changed { 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; } - /// Location key used in the location-permissions store. - [JsonPropertyName("locationKey")] - public string LocationKey { get; set; } = string.Empty; + /// Feedback from the user when they declined the plan or requested changes. + [JsonPropertyName("feedback")] + public string? Feedback { get; set; } - /// Whether the location is a git repo or directory. - [JsonPropertyName("locationType")] - public PermissionLocationType LocationType { get; set; } + /// The action the user selected. Defaults to 'autopilot' when autoApproveEdits is true, otherwise 'interactive'. + [JsonPropertyName("selectedAction")] + public UIExitPlanModeAction? SelectedAction { get; set; } } -/// Working directory to load persisted location permissions for. +/// Request ID of a pending `exit_plan_mode.requested` event and the user's response. [Experimental(Diagnostics.Experimental)] -internal sealed class PermissionLocationApplyParams +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; - - /// Working directory whose persisted location permissions should be applied. - [JsonPropertyName("workingDirectory")] - public string WorkingDirectory { get; set; } = string.Empty; } -/// Indicates whether the operation succeeded. +/// 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 PermissionsLocationsAddToolApprovalResult +public sealed class UIRegisterDirectAutoModeSwitchHandlerResult { - /// Whether the operation succeeded. - [JsonPropertyName("success")] - public bool Success { get; set; } + /// 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; } -/// Tool approval to persist and apply. -/// Polymorphic base type discriminated by kind. +/// Identifies the target session. [Experimental(Diagnostics.Experimental)] -[JsonPolymorphic( - TypeDiscriminatorPropertyName = "kind", - UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToBaseType)] -[JsonDerivedType(typeof(PermissionsLocationsAddToolApprovalDetailsCommands), "commands")] -[JsonDerivedType(typeof(PermissionsLocationsAddToolApprovalDetailsRead), "read")] -[JsonDerivedType(typeof(PermissionsLocationsAddToolApprovalDetailsWrite), "write")] -[JsonDerivedType(typeof(PermissionsLocationsAddToolApprovalDetailsMcp), "mcp")] -[JsonDerivedType(typeof(PermissionsLocationsAddToolApprovalDetailsMcpSampling), "mcp-sampling")] -[JsonDerivedType(typeof(PermissionsLocationsAddToolApprovalDetailsMemory), "memory")] -[JsonDerivedType(typeof(PermissionsLocationsAddToolApprovalDetailsCustomTool), "custom-tool")] -[JsonDerivedType(typeof(PermissionsLocationsAddToolApprovalDetailsExtensionManagement), "extension-management")] -[JsonDerivedType(typeof(PermissionsLocationsAddToolApprovalDetailsFactory), "factory")] -[JsonDerivedType(typeof(PermissionsLocationsAddToolApprovalDetailsExtensionPermissionAccess), "extension-permission-access")] -[JsonDerivedType(typeof(PermissionsLocationsAddToolApprovalDetailsExtensionEnvAccess), "extension-env-access")] -public partial class PermissionsLocationsAddToolApprovalDetails +internal sealed class SessionUiRegisterDirectAutoModeSwitchHandlerRequest { - /// The type discriminator. - [JsonPropertyName("kind")] - public virtual string Kind { get; set; } = string.Empty; + /// 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; } +} -/// Location-persisted tool approval details for specific command identifiers. -/// The commands variant of . +/// Opaque handle previously returned by `registerDirectAutoModeSwitchHandler` to release. [Experimental(Diagnostics.Experimental)] -public partial class PermissionsLocationsAddToolApprovalDetailsCommands : PermissionsLocationsAddToolApprovalDetails +internal sealed class UIUnregisterDirectAutoModeSwitchHandlerRequest { - /// - [JsonIgnore] - public override string Kind => "commands"; + /// Handle previously returned by `registerDirectAutoModeSwitchHandler`. + [JsonPropertyName("handle")] + public string Handle { get; set; } = string.Empty; - /// Command identifiers covered by this approval. - [JsonPropertyName("commandIdentifiers")] - public required IList CommandIdentifiers { get; set; } + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; } -/// Location-persisted tool approval details for read-only filesystem operations. -/// The read variant of . +/// Indicates whether the operation succeeded. [Experimental(Diagnostics.Experimental)] -public partial class PermissionsLocationsAddToolApprovalDetailsRead : PermissionsLocationsAddToolApprovalDetails +public sealed class PermissionsConfigureResult { - /// - [JsonIgnore] - public override string Kind => "read"; + /// Whether the operation succeeded. + [JsonPropertyName("success")] + public bool Success { get; set; } } -/// Location-persisted tool approval details for filesystem write operations. -/// The write variant of . +/// Source descriptor for a `session.permissions.configure` content-exclusion rule, with source name and type. [Experimental(Diagnostics.Experimental)] -public partial class PermissionsLocationsAddToolApprovalDetailsWrite : PermissionsLocationsAddToolApprovalDetails +public sealed class PermissionsConfigureAdditionalContentExclusionPolicyRuleSource { - /// - [JsonIgnore] - public override string Kind => "write"; + /// 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; } -/// Location-persisted tool approval details for an MCP server tool, or all tools when `toolName` is null. -/// The mcp variant of . +/// Single content-exclusion rule supplied to `session.permissions.configure`, with paths, match conditions, and source. [Experimental(Diagnostics.Experimental)] -public partial class PermissionsLocationsAddToolApprovalDetailsMcp : PermissionsLocationsAddToolApprovalDetails +public sealed class PermissionsConfigureAdditionalContentExclusionPolicyRule { - /// - [JsonIgnore] - public override string Kind => "mcp"; + /// Conditions of which at least one must match. + [JsonPropertyName("ifAnyMatch")] + public IList? IfAnyMatch { get; set; } - /// MCP server name. - [JsonPropertyName("serverName")] - public required string ServerName { get; set; } + /// Conditions none of which may match. + [JsonPropertyName("ifNoneMatch")] + public IList? IfNoneMatch { get; set; } - /// MCP tool name, or null to cover every tool on the server. - [JsonPropertyName("toolName")] - public string? ToolName { get; set; } + /// Path patterns covered by this rule. + [JsonPropertyName("paths")] + public IList Paths { get => field ??= []; set; } + + /// Source descriptor for a `session.permissions.configure` content-exclusion rule, with source name and type. + [JsonPropertyName("source")] + public PermissionsConfigureAdditionalContentExclusionPolicyRuleSource Source { get => field ??= new(); set; } } -/// Location-persisted tool approval details for MCP sampling requests from a server. -/// The mcp-sampling variant of . +/// Content-exclusion policy supplied to `session.permissions.configure`, with rules, last-updated data, and scope. [Experimental(Diagnostics.Experimental)] -public partial class PermissionsLocationsAddToolApprovalDetailsMcpSampling : PermissionsLocationsAddToolApprovalDetails +public sealed class PermissionsConfigureAdditionalContentExclusionPolicy { - /// - [JsonIgnore] - public override string Kind => "mcp-sampling"; + /// Opaque policy update timestamp supplied by the host. + [JsonPropertyName("last_updated_at")] + public JsonElement LastUpdatedAt { get; set; } - /// MCP server name. - [JsonPropertyName("serverName")] - public required string ServerName { get; set; } + /// Content-exclusion rules to apply. + [JsonPropertyName("rules")] + public IList Rules { get => field ??= []; set; } + + /// Allowed values for the `PermissionsConfigureAdditionalContentExclusionPolicyScope` enumeration. + [JsonPropertyName("scope")] + public PermissionsConfigureAdditionalContentExclusionPolicyScope Scope { get; set; } } -/// Location-persisted tool approval details for writes to long-term memory. -/// The memory variant of . +/// If specified, replaces the session's path-permission policy. The runtime constructs the appropriate PathManager based on these inputs (rooted at the session's working directory). Omit to leave the current path policy unchanged. [Experimental(Diagnostics.Experimental)] -public partial class PermissionsLocationsAddToolApprovalDetailsMemory : PermissionsLocationsAddToolApprovalDetails +public sealed class PermissionPathsConfig { - /// - [JsonIgnore] - public override string Kind => "memory"; + /// Additional directories to allow tool access to (in addition to the session's working directory). When `unrestricted` is true, these are still pre-populated on the UnrestrictedPathManager so they remain visible via getDirectories() (e.g. for @-mention completion). + [JsonPropertyName("additionalDirectories")] + public IList? AdditionalDirectories { get; set; } + + /// Whether to include the system temp directory in the allowed list (defaults to true). Ignored when `unrestricted` is true. + [JsonPropertyName("includeTempDirectory")] + public bool? IncludeTempDirectory { get; set; } + + /// If true, the runtime allows access to all paths without prompting. Equivalent to constructing an UnrestrictedPathManager. + [JsonPropertyName("unrestricted")] + public bool? Unrestricted { get; set; } + + /// Workspace root path (special-cased to be allowed even before the directory exists). Ignored when `unrestricted` is true. + [JsonPropertyName("workspacePath")] + public string? WorkspacePath { get; set; } } -/// Location-persisted tool approval details for a custom tool, keyed by tool name. -/// The custom-tool variant of . +/// If specified, replaces the session's approved/denied permission rules. Omit to leave the current rules unchanged. [Experimental(Diagnostics.Experimental)] -public partial class PermissionsLocationsAddToolApprovalDetailsCustomTool : PermissionsLocationsAddToolApprovalDetails +public sealed class PermissionRulesSet { - /// - [JsonIgnore] - public override string Kind => "custom-tool"; + /// Rules that auto-approve matching requests. + [JsonPropertyName("approved")] + public IList Approved { get => field ??= []; set; } - /// Custom tool name. - [JsonPropertyName("toolName")] - public required string ToolName { get; set; } + /// Rules that auto-deny matching requests. + [JsonPropertyName("denied")] + public IList Denied { get => field ??= []; set; } } -/// Location-persisted tool approval details for extension-management operations, optionally narrowed by operation. -/// The extension-management variant of . +/// If specified, replaces the session's URL-permission policy. The runtime constructs a fresh DefaultUrlManager based on these inputs. Omit to leave the current URL policy unchanged. [Experimental(Diagnostics.Experimental)] -public partial class PermissionsLocationsAddToolApprovalDetailsExtensionManagement : PermissionsLocationsAddToolApprovalDetails +public sealed class PermissionUrlsConfig { - /// - [JsonIgnore] - public override string Kind => "extension-management"; + /// Initial list of allowed URL/domain patterns. Patterns may include path components. Ignored when `unrestricted` is true. + [JsonPropertyName("initialAllowed")] + public IList? InitialAllowed { get; set; } - /// Optional operation identifier; when omitted, the approval covers all extension management operations. - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("operation")] - public string? Operation { get; set; } + /// If true, the runtime allows access to all URLs without prompting. Initial allow-list is ignored when this is true. + [JsonPropertyName("unrestricted")] + public bool? Unrestricted { get; set; } } -/// Location-persisted factory approval, optionally narrowed by approval key. -/// The factory variant of . +/// Patch of permission policy fields to apply (omit a field to leave it unchanged). [Experimental(Diagnostics.Experimental)] -public partial class PermissionsLocationsAddToolApprovalDetailsFactory : PermissionsLocationsAddToolApprovalDetails +internal sealed class PermissionsConfigureParams { - /// - [JsonIgnore] - public override string Kind => "factory"; + /// If specified, replaces the host-supplied GitHub Content Exclusion policies on the session (combined with natively-discovered policies when evaluating tool/file access). Omit to leave the current policies unchanged. + [JsonPropertyName("additionalContentExclusionPolicies")] + public IList? AdditionalContentExclusionPolicies { get; set; } - /// Optional factory operation name or canonical approval key; when omitted, the approval covers all factory operations. - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("approvalKey")] - public string? ApprovalKey { get; set; } -} + /// If specified, sets whether path/URL read permission requests are auto-approved. Omit to leave the current value unchanged. + [JsonPropertyName("approveAllReadPermissionRequests")] + public bool? ApproveAllReadPermissionRequests { get; set; } -/// Location-persisted tool approval details for an extension's permission-gated capability access, keyed by extension name. -/// The extension-permission-access variant of . -[Experimental(Diagnostics.Experimental)] -public partial class PermissionsLocationsAddToolApprovalDetailsExtensionPermissionAccess : PermissionsLocationsAddToolApprovalDetails -{ - /// - [JsonIgnore] - public override string Kind => "extension-permission-access"; + /// If specified, sets whether tool permission requests are auto-approved without prompting. Omit to leave the current value unchanged. + [JsonPropertyName("approveAllToolPermissionRequests")] + public bool? ApproveAllToolPermissionRequests { get; set; } - /// Extension name. - [JsonPropertyName("extensionName")] - public required string ExtensionName { get; set; } + /// If specified, replaces the session's path-permission policy. The runtime constructs the appropriate PathManager based on these inputs (rooted at the session's working directory). Omit to leave the current path policy unchanged. + [JsonPropertyName("paths")] + public PermissionPathsConfig? Paths { get; set; } + + /// If specified, replaces the session's approved/denied permission rules. Omit to leave the current rules unchanged. + [JsonPropertyName("rules")] + public PermissionRulesSet? Rules { get; set; } + + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; + + /// If specified, replaces the session's URL-permission policy. The runtime constructs a fresh DefaultUrlManager based on these inputs. Omit to leave the current URL policy unchanged. + [JsonPropertyName("urls")] + public PermissionUrlsConfig? Urls { get; set; } } -/// Location-persisted tool approval details for an extension's access to sensitive environment variables, keyed by extension name and the exact set of variable names. -/// The extension-env-access variant of . +/// Indicates whether the permission decision was applied; false when the request was already resolved. [Experimental(Diagnostics.Experimental)] -public partial class PermissionsLocationsAddToolApprovalDetailsExtensionEnvAccess : PermissionsLocationsAddToolApprovalDetails +public sealed class PermissionRequestResult { - /// - [JsonIgnore] - public override string Kind => "extension-env-access"; - - /// Names of the sensitive environment variables this approval covers. Values are never persisted. - [JsonPropertyName("environmentVariables")] - public required IList EnvironmentVariables { get; set; } - - /// Extension name. - [JsonPropertyName("extensionName")] - public required string ExtensionName { get; set; } + /// Whether the permission request was handled successfully. + [JsonPropertyName("success")] + public bool Success { get; set; } } -/// Location-scoped tool approval to persist. +/// Optional informational context describing how and where the permission decision was made. This does not affect permission behavior. [Experimental(Diagnostics.Experimental)] -internal sealed class PermissionLocationAddToolApprovalParams +public sealed class PermissionDecisionContext { - /// Tool approval to persist and apply. - [JsonPropertyName("approval")] - public PermissionsLocationsAddToolApprovalDetails Approval { get => field ??= new(); set; } + /// Disposition of the permission request as observed by the responding client. + [JsonPropertyName("outcome")] + public PermissionDecisionOutcome Outcome { get; set; } - /// Location key (git root or cwd) to persist the approval to. - [JsonPropertyName("locationKey")] - public string LocationKey { get; set; } = string.Empty; + /// Controlled reason or actor responsible for the response. + [JsonPropertyName("source")] + public PermissionDecisionSource Source { get; set; } - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// Client surface that submitted the response. + [JsonPropertyName("surface")] + public PermissionDecisionSurface Surface { get; set; } } -/// Folder trust check result. +/// The client's response to the pending permission prompt. +/// Polymorphic base type discriminated by kind. [Experimental(Diagnostics.Experimental)] -public sealed class FolderTrustCheckResult +[JsonPolymorphic( + TypeDiscriminatorPropertyName = "kind", + UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToBaseType)] +[JsonDerivedType(typeof(PermissionDecisionApproveOnce), "approve-once")] +[JsonDerivedType(typeof(PermissionDecisionApproveForSession), "approve-for-session")] +[JsonDerivedType(typeof(PermissionDecisionApproveForLocation), "approve-for-location")] +[JsonDerivedType(typeof(PermissionDecisionApprovePermanently), "approve-permanently")] +[JsonDerivedType(typeof(PermissionDecisionReject), "reject")] +[JsonDerivedType(typeof(PermissionDecisionUserNotAvailable), "user-not-available")] +[JsonDerivedType(typeof(PermissionDecisionApproved), "approved")] +[JsonDerivedType(typeof(PermissionDecisionApprovedForSession), "approved-for-session")] +[JsonDerivedType(typeof(PermissionDecisionApprovedForLocation), "approved-for-location")] +[JsonDerivedType(typeof(PermissionDecisionCancelled), "cancelled")] +[JsonDerivedType(typeof(PermissionDecisionDeniedByRules), "denied-by-rules")] +[JsonDerivedType(typeof(PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUser), "denied-no-approval-rule-and-could-not-request-from-user")] +[JsonDerivedType(typeof(PermissionDecisionDeniedInteractivelyByUser), "denied-interactively-by-user")] +[JsonDerivedType(typeof(PermissionDecisionDeniedByContentExclusionPolicy), "denied-by-content-exclusion-policy")] +[JsonDerivedType(typeof(PermissionDecisionDeniedByPermissionRequestHook), "denied-by-permission-request-hook")] +public partial class PermissionDecision { - /// Whether the folder is trusted. - [JsonPropertyName("trusted")] - public bool Trusted { get; set; } + /// The type discriminator. + [JsonPropertyName("kind")] + public virtual string Kind { get; set; } = string.Empty; } -/// Folder path to check for trust. + +/// Permission-decision request variant to approve only the current permission request. +/// The approve-once variant of . [Experimental(Diagnostics.Experimental)] -internal sealed class FolderTrustCheckParams +public partial class PermissionDecisionApproveOnce : PermissionDecision { - /// Folder path to check. - [JsonPropertyName("path")] - public string Path { get; set; } = string.Empty; + /// + [JsonIgnore] + public override string Kind => "approve-once"; - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// True only when a host surfaced this request to a user who approved it. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("approvedInteractively")] + public bool? ApprovedInteractively { get; set; } } -/// Indicates whether the operation succeeded. +/// Session-scoped approval to remember (tool prompts only; omitted for path/url prompts). +/// Polymorphic base type discriminated by kind. [Experimental(Diagnostics.Experimental)] -public sealed class PermissionsFolderTrustAddTrustedResult +[JsonPolymorphic( + TypeDiscriminatorPropertyName = "kind", + UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToBaseType)] +[JsonDerivedType(typeof(PermissionDecisionApproveForSessionApprovalCommands), "commands")] +[JsonDerivedType(typeof(PermissionDecisionApproveForSessionApprovalRead), "read")] +[JsonDerivedType(typeof(PermissionDecisionApproveForSessionApprovalWrite), "write")] +[JsonDerivedType(typeof(PermissionDecisionApproveForSessionApprovalMcp), "mcp")] +[JsonDerivedType(typeof(PermissionDecisionApproveForSessionApprovalMcpSampling), "mcp-sampling")] +[JsonDerivedType(typeof(PermissionDecisionApproveForSessionApprovalMemory), "memory")] +[JsonDerivedType(typeof(PermissionDecisionApproveForSessionApprovalCustomTool), "custom-tool")] +[JsonDerivedType(typeof(PermissionDecisionApproveForSessionApprovalExtensionManagement), "extension-management")] +[JsonDerivedType(typeof(PermissionDecisionApproveForSessionApprovalFactory), "factory")] +[JsonDerivedType(typeof(PermissionDecisionApproveForSessionApprovalExtensionPermissionAccess), "extension-permission-access")] +[JsonDerivedType(typeof(PermissionDecisionApproveForSessionApprovalExtensionEnvAccess), "extension-env-access")] +public partial class PermissionDecisionApproveForSessionApproval { - /// Whether the operation succeeded. - [JsonPropertyName("success")] - public bool Success { get; set; } + /// The type discriminator. + [JsonPropertyName("kind")] + public virtual string Kind { get; set; } = string.Empty; } -/// Folder path to add to trusted folders. + +/// Session-scoped approval details for specific command identifiers. +/// The commands variant of . [Experimental(Diagnostics.Experimental)] -internal sealed class FolderTrustAddParams +public partial class PermissionDecisionApproveForSessionApprovalCommands : PermissionDecisionApproveForSessionApproval { - /// Folder path to mark as trusted. - [JsonPropertyName("path")] - public string Path { get; set; } = string.Empty; + /// + [JsonIgnore] + public override string Kind => "commands"; - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// Command identifiers covered by this approval. + [JsonPropertyName("commandIdentifiers")] + public required IList CommandIdentifiers { get; set; } } -/// Indicates whether the operation succeeded. +/// Session-scoped approval details for read-only filesystem operations. +/// The read variant of . [Experimental(Diagnostics.Experimental)] -public sealed class PermissionsUrlsSetUnrestrictedModeResult +public partial class PermissionDecisionApproveForSessionApprovalRead : PermissionDecisionApproveForSessionApproval { - /// Whether the operation succeeded. - [JsonPropertyName("success")] - public bool Success { get; set; } + /// + [JsonIgnore] + public override string Kind => "read"; } -/// Whether the URL-permission policy should run in unrestricted mode. +/// Session-scoped approval details for filesystem write operations. +/// The write variant of . [Experimental(Diagnostics.Experimental)] -internal sealed class PermissionUrlsSetUnrestrictedModeParams +public partial class PermissionDecisionApproveForSessionApprovalWrite : PermissionDecisionApproveForSessionApproval { - /// Whether to allow access to all URLs without prompting. Toggles the runtime's URL-permission policy in place. - [JsonPropertyName("enabled")] - public bool Enabled { get; set; } - - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// + [JsonIgnore] + public override string Kind => "write"; } -/// The repository the remote session targets. +/// Session-scoped approval details for an MCP server tool, or all tools on the server when `toolName` is null. +/// The mcp variant of . [Experimental(Diagnostics.Experimental)] -public sealed class MetadataSnapshotRemoteMetadataRepository +public partial class PermissionDecisionApproveForSessionApprovalMcp : PermissionDecisionApproveForSessionApproval { - /// The branch the remote session is operating on. - [JsonPropertyName("branch")] - public string Branch { get; set; } = string.Empty; + /// + [JsonIgnore] + public override string Kind => "mcp"; - /// The GitHub repository name (without owner). - [JsonPropertyName("name")] - public string Name { get; set; } = string.Empty; + /// MCP server name. + [JsonPropertyName("serverName")] + public required string ServerName { get; set; } - /// The GitHub owner (user or organization) of the target repository. - [JsonPropertyName("owner")] - public string Owner { get; set; } = string.Empty; + /// MCP tool name, or null to cover every tool on the server. + [JsonPropertyName("toolName")] + public string? ToolName { get; set; } } -/// Remote-session-specific metadata. Populated only when `isRemote` is true. Fields are immutable for the lifetime of the session. +/// Session-scoped approval details for MCP sampling requests from a server. +/// The mcp-sampling variant of . [Experimental(Diagnostics.Experimental)] -public sealed class MetadataSnapshotRemoteMetadata +public partial class PermissionDecisionApproveForSessionApprovalMcpSampling : PermissionDecisionApproveForSessionApproval { - /// The pull request number the remote session is associated with, if any. - [JsonPropertyName("pullRequestNumber")] - public long? PullRequestNumber { get; set; } - - /// The repository the remote session targets. - [JsonPropertyName("repository")] - public MetadataSnapshotRemoteMetadataRepository Repository { get => field ??= new(); set; } - - /// The original resource identifier (task ID or PR node ID), preserved across event-replay reconstructions. Falls back to `sessionId` when absent. - [JsonPropertyName("resourceId")] - public string? ResourceId { get; set; } + /// + [JsonIgnore] + public override string Kind => "mcp-sampling"; - /// Whether the remote task originated from Copilot Coding Agent (cca) or a CLI `--remote` invocation. - [JsonPropertyName("taskType")] - public MetadataSnapshotRemoteMetadataTaskType? TaskType { get; set; } + /// MCP server name. + [JsonPropertyName("serverName")] + public required string ServerName { get; set; } } -/// Public-facing projection of workspace metadata for SDK / TUI consumers. -public sealed class SessionMetadataSnapshotWorkspace +/// Session-scoped approval details for writes to long-term memory. +/// The memory variant of . +[Experimental(Diagnostics.Experimental)] +public partial class PermissionDecisionApproveForSessionApprovalMemory : PermissionDecisionApproveForSessionApproval { - /// Branch checked out at session start, if any. - [JsonPropertyName("branch")] - public string? Branch { get; set; } + /// + [JsonIgnore] + public override string Kind => "memory"; +} - /// ISO 8601 timestamp when the workspace was created. - [JsonPropertyName("created_at")] - public DateTimeOffset? CreatedAt { get; set; } - - /// Current working directory at session start. - [JsonPropertyName("cwd")] - public string? Cwd { get; set; } - - /// Resolved git root for cwd, if any. - [JsonPropertyName("git_root")] - public string? GitRoot { get; set; } - - /// Repository host type, if known. - [JsonPropertyName("host_type")] - public WorkspaceSummaryHostType? HostType { get; set; } - - /// Workspace identifier (1:1 with sessionId). - [UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "Safe for generated string properties: JSON Schema minLength/maxLength map to string length validation, not reflection over trimmed Count members")] - [MinLength(1)] - [JsonPropertyName("id")] - public string Id { get; set; } = string.Empty; - - /// Display name for the session, if set. - [JsonPropertyName("name")] - public string? Name { get; set; } +/// Session-scoped approval details for a custom tool, keyed by tool name. +/// The custom-tool variant of . +[Experimental(Diagnostics.Experimental)] +public partial class PermissionDecisionApproveForSessionApprovalCustomTool : PermissionDecisionApproveForSessionApproval +{ + /// + [JsonIgnore] + public override string Kind => "custom-tool"; - /// Repository identifier in 'owner/repo' or 'org/project/repo' format, if any. - [JsonPropertyName("repository")] - public string? Repository { get; set; } + /// Custom tool name. + [JsonPropertyName("toolName")] + public required string ToolName { get; set; } +} - /// ISO 8601 timestamp when the workspace was last updated. - [JsonPropertyName("updated_at")] - public DateTimeOffset? UpdatedAt { get; set; } +/// Session-scoped approval details for extension-management operations, optionally narrowed by operation. +/// The extension-management variant of . +[Experimental(Diagnostics.Experimental)] +public partial class PermissionDecisionApproveForSessionApprovalExtensionManagement : PermissionDecisionApproveForSessionApproval +{ + /// + [JsonIgnore] + public override string Kind => "extension-management"; - /// Whether the display name was explicitly set by the user. - [JsonPropertyName("user_named")] - public bool? UserNamed { get; set; } + /// Optional operation identifier; when omitted, the approval covers all extension management operations. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("operation")] + public string? Operation { get; set; } } -/// Point-in-time snapshot of slow-changing session identifier and state fields. +/// Session-scoped factory approval, optionally narrowed by approval key. +/// The factory variant of . [Experimental(Diagnostics.Experimental)] -public sealed class SessionMetadataSnapshot +public partial class PermissionDecisionApproveForSessionApprovalFactory : PermissionDecisionApproveForSessionApproval { - /// True when the session was detected to be in use by another process at construction time. Local consumers may surface a confirmation prompt before fully attaching. Always false for new sessions. - [JsonPropertyName("alreadyInUse")] - public bool AlreadyInUse { get; set; } - - /// Runtime client name associated with the session (telemetry identifier). - [JsonPropertyName("clientName")] - public string? ClientName { get; set; } + /// + [JsonIgnore] + public override string Kind => "factory"; - /// The current agent mode for this session (e.g., 'interactive', 'plan', 'autopilot'). - [JsonPropertyName("currentMode")] - public MetadataSnapshotCurrentMode CurrentMode { get; set; } + /// Optional factory operation name or canonical approval key; when omitted, the approval covers all factory operations. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("approvalKey")] + public string? ApprovalKey { get; set; } +} - /// User-provided name supplied at session construction (via `--name`), if any. Immutable after construction. - [JsonPropertyName("initialName")] - public string? InitialName { get; set; } +/// Session-scoped approval details for an extension's permission-gated capability access, keyed by extension name. +/// The extension-permission-access variant of . +[Experimental(Diagnostics.Experimental)] +public partial class PermissionDecisionApproveForSessionApprovalExtensionPermissionAccess : PermissionDecisionApproveForSessionApproval +{ + /// + [JsonIgnore] + public override string Kind => "extension-permission-access"; - /// Whether this is a remote session (i.e., one whose runtime executes elsewhere and is steered through this process). - [JsonPropertyName("isRemote")] - public bool IsRemote { get; set; } + /// Extension name. + [JsonPropertyName("extensionName")] + public required string ExtensionName { get; set; } +} - /// ISO 8601 timestamp of when the session's persisted state was last modified on disk. For new sessions, equals startTime. For resumed sessions, reflects the previous modification time at construction. - [JsonPropertyName("modifiedTime")] - public DateTimeOffset ModifiedTime { get; set; } +/// Session-scoped approval details for an extension's access to sensitive environment variables, keyed by extension name and the exact set of variable names. +/// The extension-env-access variant of . +[Experimental(Diagnostics.Experimental)] +public partial class PermissionDecisionApproveForSessionApprovalExtensionEnvAccess : PermissionDecisionApproveForSessionApproval +{ + /// + [JsonIgnore] + public override string Kind => "extension-env-access"; - /// Remote-session-specific metadata. Populated only when `isRemote` is true. Fields are immutable for the lifetime of the session. - [JsonPropertyName("remoteMetadata")] - public MetadataSnapshotRemoteMetadata? RemoteMetadata { get; set; } + /// Names of the sensitive environment variables this approval covers. Values are never persisted. + [JsonPropertyName("environmentVariables")] + public required IList EnvironmentVariables { get; set; } - /// Currently selected model identifier, if any. - [JsonPropertyName("selectedModel")] - public string? SelectedModel { get; set; } + /// Extension name. + [JsonPropertyName("extensionName")] + public required string ExtensionName { get; set; } +} - /// The unique identifier of the session. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; +/// Permission-decision request variant to approve for the rest of the session, with optional tool approval or URL domain. +/// The approve-for-session variant of . +[Experimental(Diagnostics.Experimental)] +public partial class PermissionDecisionApproveForSession : PermissionDecision +{ + /// + [JsonIgnore] + public override string Kind => "approve-for-session"; - /// Current session limits, or null when no limits are active. - [JsonPropertyName("sessionLimits")] - public SessionLimitsConfig? SessionLimits { get; set; } + /// Session-scoped approval to remember (tool prompts only; omitted for path/url prompts). + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("approval")] + public PermissionDecisionApproveForSessionApproval? Approval { get; set; } - /// ISO 8601 timestamp of when the session started. - [JsonPropertyName("startTime")] - public DateTimeOffset StartTime { get; set; } + /// URL domain to approve for the rest of the session (URL prompts only). + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("domain")] + public string? Domain { get; set; } +} - /// Short human-readable summary of the session, if known. Omitted when no summary has been generated. - [JsonPropertyName("summary")] - public string? Summary { get; set; } +/// Approval to persist for this location. +/// Polymorphic base type discriminated by kind. +[Experimental(Diagnostics.Experimental)] +[JsonPolymorphic( + TypeDiscriminatorPropertyName = "kind", + UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToBaseType)] +[JsonDerivedType(typeof(PermissionDecisionApproveForLocationApprovalCommands), "commands")] +[JsonDerivedType(typeof(PermissionDecisionApproveForLocationApprovalRead), "read")] +[JsonDerivedType(typeof(PermissionDecisionApproveForLocationApprovalWrite), "write")] +[JsonDerivedType(typeof(PermissionDecisionApproveForLocationApprovalMcp), "mcp")] +[JsonDerivedType(typeof(PermissionDecisionApproveForLocationApprovalMcpSampling), "mcp-sampling")] +[JsonDerivedType(typeof(PermissionDecisionApproveForLocationApprovalMemory), "memory")] +[JsonDerivedType(typeof(PermissionDecisionApproveForLocationApprovalCustomTool), "custom-tool")] +[JsonDerivedType(typeof(PermissionDecisionApproveForLocationApprovalExtensionManagement), "extension-management")] +[JsonDerivedType(typeof(PermissionDecisionApproveForLocationApprovalFactory), "factory")] +[JsonDerivedType(typeof(PermissionDecisionApproveForLocationApprovalExtensionPermissionAccess), "extension-permission-access")] +[JsonDerivedType(typeof(PermissionDecisionApproveForLocationApprovalExtensionEnvAccess), "extension-env-access")] +public partial class PermissionDecisionApproveForLocationApproval +{ + /// The type discriminator. + [JsonPropertyName("kind")] + public virtual string Kind { get; set; } = string.Empty; +} - /// Absolute path to the session's current working directory. - [JsonPropertyName("workingDirectory")] - public string WorkingDirectory { get; set; } = string.Empty; - /// Public-facing workspace metadata for this session, or null if the session has no associated workspace. Excludes runtime-internal fields (GitHub IDs, summary count, internal flags). - [JsonPropertyName("workspace")] - public SessionMetadataSnapshotWorkspace? Workspace { get; set; } +/// Location-scoped approval details for specific command identifiers. +/// The commands variant of . +[Experimental(Diagnostics.Experimental)] +public partial class PermissionDecisionApproveForLocationApprovalCommands : PermissionDecisionApproveForLocationApproval +{ + /// + [JsonIgnore] + public override string Kind => "commands"; - /// Absolute path to the session's workspace directory on disk, or null if the session has no associated workspace. - [JsonPropertyName("workspacePath")] - public string? WorkspacePath { get; set; } + /// Command identifiers covered by this approval. + [JsonPropertyName("commandIdentifiers")] + public required IList CommandIdentifiers { get; set; } } -/// Identifies the target session. +/// Location-scoped approval details for read-only filesystem operations. +/// The read variant of . [Experimental(Diagnostics.Experimental)] -internal sealed class SessionMetadataSnapshotRequest +public partial class PermissionDecisionApproveForLocationApprovalRead : PermissionDecisionApproveForLocationApproval { - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// + [JsonIgnore] + public override string Kind => "read"; } -/// Indicates whether the local session is currently processing a turn or background continuation. +/// Location-scoped approval details for filesystem write operations. +/// The write variant of . [Experimental(Diagnostics.Experimental)] -public sealed class MetadataIsProcessingResult +public partial class PermissionDecisionApproveForLocationApprovalWrite : PermissionDecisionApproveForLocationApproval { - /// Whether the session is currently processing user/agent messages. False for non-local sessions (which don't run a local agentic loop). Reflects an in-flight turn or background continuation. - [JsonPropertyName("processing")] - public bool Processing { get; set; } + /// + [JsonIgnore] + public override string Kind => "write"; } -/// Identifies the target session. +/// Location-scoped approval details for an MCP server tool, or all tools on the server when `toolName` is null. +/// The mcp variant of . [Experimental(Diagnostics.Experimental)] -internal sealed class SessionMetadataIsProcessingRequest +public partial class PermissionDecisionApproveForLocationApprovalMcp : PermissionDecisionApproveForLocationApproval { - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// + [JsonIgnore] + public override string Kind => "mcp"; + + /// MCP server name. + [JsonPropertyName("serverName")] + public required string ServerName { get; set; } + + /// MCP tool name, or null to cover every tool on the server. + [JsonPropertyName("toolName")] + public string? ToolName { get; set; } } -/// Current activity flags for the session. +/// Location-scoped approval details for MCP sampling requests from a server. +/// The mcp-sampling variant of . [Experimental(Diagnostics.Experimental)] -public sealed class SessionActivity +public partial class PermissionDecisionApproveForLocationApprovalMcpSampling : PermissionDecisionApproveForLocationApproval { - /// Whether an in-flight operation can currently be aborted. - [JsonPropertyName("abortable")] - public bool Abortable { get; set; } + /// + [JsonIgnore] + public override string Kind => "mcp-sampling"; - /// Whether the session currently has active work, including running turns or tasks. - [JsonPropertyName("hasActiveWork")] - public bool HasActiveWork { get; set; } + /// MCP server name. + [JsonPropertyName("serverName")] + public required string ServerName { get; set; } } -/// Identifies the target session. +/// Location-scoped approval details for writes to long-term memory. +/// The memory variant of . [Experimental(Diagnostics.Experimental)] -internal sealed class SessionMetadataActivityRequest +public partial class PermissionDecisionApproveForLocationApprovalMemory : PermissionDecisionApproveForLocationApproval { - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// + [JsonIgnore] + public override string Kind => "memory"; } -/// Token-usage breakdown for the session's current context window. -public sealed class MetadataContextInfoResultContextInfo +/// Location-scoped approval details for a custom tool, keyed by tool name. +/// The custom-tool variant of . +[Experimental(Diagnostics.Experimental)] +public partial class PermissionDecisionApproveForLocationApprovalCustomTool : PermissionDecisionApproveForLocationApproval { - /// Output reserve plus tokens after the buffer-exhaustion blocking threshold (default 95%). - [JsonPropertyName("bufferTokens")] - public long BufferTokens { get; set; } - - /// Token count at which background compaction starts (configurable percentage of promptTokenLimit). - [JsonPropertyName("compactionThreshold")] - public long CompactionThreshold { get; set; } - - /// Tokens consumed by user/assistant/tool messages. - [JsonPropertyName("conversationTokens")] - public long ConversationTokens { get; set; } - - /// Prompt token limit plus the model's full output token limit. - [JsonPropertyName("limit")] - public long Limit { get; set; } - - /// Tokens consumed by MCP tool definitions (subset of toolDefinitionsTokens, excludes deferred tools). - [JsonPropertyName("mcpToolsTokens")] - public long McpToolsTokens { get; set; } + /// + [JsonIgnore] + public override string Kind => "custom-tool"; - /// The model used for token counting. - [JsonPropertyName("modelName")] - public string ModelName { get; set; } = string.Empty; + /// Custom tool name. + [JsonPropertyName("toolName")] + public required string ToolName { get; set; } +} - /// Maximum prompt tokens allowed by the model (or DEFAULT_TOKEN_LIMIT if unspecified). - [JsonPropertyName("promptTokenLimit")] - public long PromptTokenLimit { get; set; } +/// Location-scoped approval details for extension-management operations, optionally narrowed by operation. +/// The extension-management variant of . +[Experimental(Diagnostics.Experimental)] +public partial class PermissionDecisionApproveForLocationApprovalExtensionManagement : PermissionDecisionApproveForLocationApproval +{ + /// + [JsonIgnore] + public override string Kind => "extension-management"; - /// Tokens consumed by the system prompt. - [JsonPropertyName("systemTokens")] - public long SystemTokens { get; set; } + /// Optional operation identifier; when omitted, the approval covers all extension management operations. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("operation")] + public string? Operation { get; set; } +} - /// Tokens consumed by tool definitions sent to the model (excludes deferred tools). - [JsonPropertyName("toolDefinitionsTokens")] - public long ToolDefinitionsTokens { get; set; } +/// Location-scoped factory approval, optionally narrowed by approval key. +/// The factory variant of . +[Experimental(Diagnostics.Experimental)] +public partial class PermissionDecisionApproveForLocationApprovalFactory : PermissionDecisionApproveForLocationApproval +{ + /// + [JsonIgnore] + public override string Kind => "factory"; - /// Sum of system, conversation and tool-definition tokens. - [JsonPropertyName("totalTokens")] - public long TotalTokens { get; set; } + /// Optional factory operation name or canonical approval key; when omitted, the approval covers all factory operations. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("approvalKey")] + public string? ApprovalKey { get; set; } } -/// Token breakdown for the session's current context window, or null if uninitialized. +/// Location-scoped approval details for an extension's permission-gated capability access, keyed by extension name. +/// The extension-permission-access variant of . [Experimental(Diagnostics.Experimental)] -public sealed class MetadataContextInfoResult +public partial class PermissionDecisionApproveForLocationApprovalExtensionPermissionAccess : PermissionDecisionApproveForLocationApproval { - /// Token breakdown for the current context window, or null if the session has not yet been initialized (no system prompt or tool metadata cached). - [JsonPropertyName("contextInfo")] - public MetadataContextInfoResultContextInfo? ContextInfo { get; set; } + /// + [JsonIgnore] + public override string Kind => "extension-permission-access"; + + /// Extension name. + [JsonPropertyName("extensionName")] + public required string ExtensionName { get; set; } } -/// Model identifier and token limits used to compute the context-info breakdown. +/// Location-scoped approval details for an extension's access to sensitive environment variables, keyed by extension name and the exact set of variable names. +/// The extension-env-access variant of . [Experimental(Diagnostics.Experimental)] -internal sealed class MetadataContextInfoRequest +public partial class PermissionDecisionApproveForLocationApprovalExtensionEnvAccess : PermissionDecisionApproveForLocationApproval { - /// Maximum output tokens allowed by the target model. Pass 0 if unknown. - [JsonPropertyName("outputTokenLimit")] - public long OutputTokenLimit { get; set; } - - /// Maximum prompt tokens allowed by the target model. Pass 0 to use the runtime default. - [JsonPropertyName("promptTokenLimit")] - public long PromptTokenLimit { get; set; } + /// + [JsonIgnore] + public override string Kind => "extension-env-access"; - /// Model identifier used for tokenization. Omit to use the session default. Used both for token counting and to compute display values. - [JsonPropertyName("selectedModel")] - public string? SelectedModel { get; set; } + /// Names of the sensitive environment variables this approval covers. Values are never persisted. + [JsonPropertyName("environmentVariables")] + public required IList EnvironmentVariables { get; set; } - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// Extension name. + [JsonPropertyName("extensionName")] + public required string ExtensionName { get; set; } } -/// The six normalized `/context` header buckets, computed from the same tokenization as `entries` so the two never disagree. Convenience rollups: `freeSpace` and `buffer` describe window capacity rather than occupied context, so the values do not sum to `totalTokens`. -public sealed class MetadataContextAttributionResultContextAttributionCategories +/// Permission-decision request variant to approve and persist a permission for a project location, with approval details and location key. +/// The approve-for-location variant of . +[Experimental(Diagnostics.Experimental)] +public partial class PermissionDecisionApproveForLocation : PermissionDecision { - /// Output reserve plus post-blocking-threshold buffer. - [JsonPropertyName("buffer")] - public long Buffer { get; set; } + /// + [JsonIgnore] + public override string Kind => "approve-for-location"; - /// Custom-instructions tokens (0 when none are configured). - [JsonPropertyName("customInstructions")] - public long CustomInstructions { get; set; } + /// Approval to persist for this location. + [JsonPropertyName("approval")] + public required PermissionDecisionApproveForLocationApproval Approval { get; set; } - /// Remaining unused window capacity (clamped at 0). - [JsonPropertyName("freeSpace")] - public long FreeSpace { get; set; } + /// Location key (git root or cwd) to persist the approval to. + [JsonPropertyName("locationKey")] + public required string LocationKey { get; set; } +} - /// MCP tool-definition tokens. - [JsonPropertyName("mcpTools")] - public long McpTools { get; set; } +/// Permission-decision request variant to permanently approve a URL domain across sessions. +/// The approve-permanently variant of . +[Experimental(Diagnostics.Experimental)] +public partial class PermissionDecisionApprovePermanently : PermissionDecision +{ + /// + [JsonIgnore] + public override string Kind => "approve-permanently"; - /// Conversation (user/assistant/tool) message tokens. - [JsonPropertyName("messages")] - public long Messages { get; set; } + /// URL domain to approve permanently. + [JsonPropertyName("domain")] + public required string Domain { get; set; } +} - /// System prompt tokens, excluding custom instructions. - [JsonPropertyName("systemPrompt")] - public long SystemPrompt { get; set; } +/// Permission-decision request variant to reject a pending permission request, with optional feedback. +/// The reject variant of . +[Experimental(Diagnostics.Experimental)] +public partial class PermissionDecisionReject : PermissionDecision +{ + /// + [JsonIgnore] + public override string Kind => "reject"; - /// Non-MCP tool-definition tokens. - [JsonPropertyName("systemTools")] - public long SystemTools { get; set; } + /// Optional feedback explaining the rejection. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("feedback")] + public string? Feedback { get; set; } } -/// Successful compaction history for the session. -public sealed class MetadataContextAttributionResultContextAttributionCompactions +/// Permission-decision variant indicating no user was available to confirm the request. +/// The user-not-available variant of . +[Experimental(Diagnostics.Experimental)] +public partial class PermissionDecisionUserNotAvailable : PermissionDecision { - /// Number of successful compactions in this session. - [JsonPropertyName("count")] - public long Count { get; set; } + /// + [JsonIgnore] + public override string Kind => "user-not-available"; } -/// RPC data type for MetadataContextAttributionResultContextAttributionEntry operations. -public sealed class MetadataContextAttributionResultContextAttributionEntry +/// Permission-decision variant indicating the request was approved. +/// The approved variant of . +[Experimental(Diagnostics.Experimental)] +public partial class PermissionDecisionApproved : PermissionDecision { - /// Supplementary per-entry metadata (e.g. `messageCount`, `role`, `evictable`, `pluginSource`). Values are stringified; parse as needed and ignore unrecognized keys. - [JsonPropertyName("attributes")] - public IDictionary? Attributes { get; set; } + /// + [JsonIgnore] + public override string Kind => "approved"; +} - /// Identifier for this entry, formed by joining its `kind` and source name (e.g. `tool:bash`, `skill:tmux`, `toolDefinition:bash`); unique within the snapshot. Use it to match the same entry across snapshots, to correlate with other APIs (skill/agent/MCP registries), and as the `parentId` target for nesting. Distinct from the human-facing `label`. - [JsonPropertyName("id")] - public string Id { get; set; } = string.Empty; +/// Permission-decision variant indicating approval was remembered for the session, with approval details. +/// The approved-for-session variant of . +[Experimental(Diagnostics.Experimental)] +public partial class PermissionDecisionApprovedForSession : PermissionDecision +{ + /// + [JsonIgnore] + public override string Kind => "approved-for-session"; - /// Source category for this entry. Not a closed set — tolerate unknown values. Known values today: `skill`, `subagent`, `mcpServer`, `tool`, `system`, `toolDefinition`, `plugin`. - [JsonPropertyName("kind")] - public string Kind { get; set; } = string.Empty; + /// The approval to add as a session-scoped rule. + [JsonPropertyName("approval")] + public required UserToolSessionApproval Approval { get; set; } +} - /// Human-readable display label, e.g. `bash` or `skill: tmux`. Presentation-only; may be localized/reformatted without notice — do not key off it. - [JsonPropertyName("label")] - public string Label { get; set; } = string.Empty; +/// Permission-decision variant indicating approval was persisted for a project location, with approval details and location key. +/// The approved-for-location variant of . +[Experimental(Diagnostics.Experimental)] +public partial class PermissionDecisionApprovedForLocation : PermissionDecision +{ + /// + [JsonIgnore] + public override string Kind => "approved-for-location"; - /// Optional `id` of the parent entry: e.g. a `plugin` entry parenting its `skill`/`mcpServer` entries, or the `system` entry parenting `toolDefinition` entries. Omitted for top-level entries. - [JsonPropertyName("parentId")] - public string? ParentId { get; set; } + /// The approval to persist for this location. + [JsonPropertyName("approval")] + public required UserToolSessionApproval Approval { get; set; } - /// Token count currently in context attributable to this entry. - [JsonPropertyName("tokens")] - public long Tokens { get; set; } + /// The location key (git root or cwd) to persist the approval to. + [JsonPropertyName("locationKey")] + public required string LocationKey { get; set; } } -/// Per-source token attribution snapshot for the current context window. The heaviest individual messages are available separately via `metadata.getContextHeaviestMessages`. -public sealed class MetadataContextAttributionResultContextAttribution +/// Permission-decision variant indicating the request was cancelled before use, with an optional reason. +/// The cancelled variant of . +[Experimental(Diagnostics.Experimental)] +public partial class PermissionDecisionCancelled : PermissionDecision { - /// Output reserve plus the tokens past the buffer-exhaustion blocking threshold. Mirrors `SessionContextInfo.bufferTokens`. - [JsonPropertyName("bufferTokens")] - public long BufferTokens { get; set; } + /// + [JsonIgnore] + public override string Kind => "cancelled"; - /// The six normalized `/context` header buckets, computed from the same tokenization as `entries` so the two never disagree. Convenience rollups: `freeSpace` and `buffer` describe window capacity rather than occupied context, so the values do not sum to `totalTokens`. - [JsonPropertyName("categories")] - public MetadataContextAttributionResultContextAttributionCategories Categories { get => field ??= new(); set; } + /// Optional explanation of why the request was cancelled. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("reason")] + public string? Reason { get; set; } +} - /// Successful compaction history for the session. - [JsonPropertyName("compactions")] - public MetadataContextAttributionResultContextAttributionCompactions Compactions { get => field ??= new(); set; } +/// Permission-decision variant indicating explicit denial by permission rules, with the matching rules. +/// The denied-by-rules variant of . +[Experimental(Diagnostics.Experimental)] +public partial class PermissionDecisionDeniedByRules : PermissionDecision +{ + /// + [JsonIgnore] + public override string Kind => "denied-by-rules"; - /// Token count at which background compaction starts. Mirrors `SessionContextInfo.compactionThreshold`. - [JsonPropertyName("compactionThreshold")] - public long CompactionThreshold { get; set; } + /// Rules that denied the request. + [JsonPropertyName("rules")] + public required IList Rules { get; set; } +} - /// Flat list of per-source attribution entries. Group by `kind` and render unrecognized kinds generically. Nesting and rollups are expressed via `parentId`. - [JsonPropertyName("entries")] - public IList Entries { get => field ??= []; set; } +/// Permission-decision variant indicating no approval rule matched and user confirmation was unavailable. +/// The denied-no-approval-rule-and-could-not-request-from-user variant of . +[Experimental(Diagnostics.Experimental)] +public partial class PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUser : PermissionDecision +{ + /// + [JsonIgnore] + public override string Kind => "denied-no-approval-rule-and-could-not-request-from-user"; +} - /// Prompt limit plus the model's output reserve: the full context window `categories.freeSpace` and `categories.buffer` are measured against. Mirrors `SessionContextInfo.limit`. - [JsonPropertyName("limit")] - public long Limit { get; set; } +/// Permission-decision variant indicating the user denied an interactive prompt, with optional feedback and force-reject flag. +/// The denied-interactively-by-user variant of . +[Experimental(Diagnostics.Experimental)] +public partial class PermissionDecisionDeniedInteractivelyByUser : PermissionDecision +{ + /// + [JsonIgnore] + public override string Kind => "denied-interactively-by-user"; - /// The concrete model id the entire breakdown was tokenized against (feeds the per-model token multiplier). Under `Auto` (Free/Student) this is the resolved model, not the literal `auto` sentinel, so totals are not undercounted. A single-model approximation of a potentially multi-model Auto session. - [JsonPropertyName("modelId")] - public string ModelId { get; set; } = string.Empty; + /// Optional feedback from the user explaining the denial. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("feedback")] + public string? Feedback { get; set; } - /// How `modelId` was chosen. Not a closed set — tolerate unknown values. Known values today: `autoResolved` (the model Auto resolved to), `selected` (the user's explicitly selected model), `default` (a fallback before any model is known). - [JsonPropertyName("modelSource")] - public string ModelSource { get; set; } = string.Empty; + /// Whether to force-reject the current agent turn. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("forceReject")] + public bool? ForceReject { get; set; } +} - /// Maximum prompt tokens the resolved model accepts — the denominator for a `##k/###k` context-usage display. Mirrors `SessionContextInfo.promptTokenLimit`. - [JsonPropertyName("promptTokenLimit")] - public long PromptTokenLimit { get; set; } +/// Permission-decision variant indicating denial by content-exclusion policy, with path and message. +/// The denied-by-content-exclusion-policy variant of . +[Experimental(Diagnostics.Experimental)] +public partial class PermissionDecisionDeniedByContentExclusionPolicy : PermissionDecision +{ + /// + [JsonIgnore] + public override string Kind => "denied-by-content-exclusion-policy"; - /// Total token count of the current context window the entries are measured against (system message + conversation messages + tool definitions — the same total reported by /context). Divide an entry's `tokens` by this to derive its share. - [JsonPropertyName("totalTokens")] - public long TotalTokens { get; set; } + /// Human-readable explanation of why the path was excluded. + [JsonPropertyName("message")] + public required string Message { get; set; } + + /// File path that triggered the exclusion. + [JsonPropertyName("path")] + public required string Path { get; set; } } -/// Per-source attribution breakdown for the session's current context window, or null if uninitialized. +/// Permission-decision variant indicating denial by a permission request hook, with optional message and interrupt flag. +/// The denied-by-permission-request-hook variant of . [Experimental(Diagnostics.Experimental)] -public sealed class MetadataContextAttributionResult +public partial class PermissionDecisionDeniedByPermissionRequestHook : PermissionDecision { - /// Per-source context-window attribution, or null if the session has not yet been initialized (no system prompt or tool metadata cached). - [JsonPropertyName("contextAttribution")] - public MetadataContextAttributionResultContextAttribution? ContextAttribution { get; set; } + /// + [JsonIgnore] + public override string Kind => "denied-by-permission-request-hook"; + + /// Whether to interrupt the current agent turn. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("interrupt")] + public bool? Interrupt { get; set; } + + /// Optional message from the hook explaining the denial. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("message")] + public string? Message { get; set; } } -/// Identifies the target session. +/// Pending permission request ID and the decision to apply (approve/reject and scope). [Experimental(Diagnostics.Experimental)] -internal sealed class SessionMetadataGetContextAttributionRequest +internal sealed class PermissionDecisionRequest { + /// Optional informational context describing how and where this response was made. Omit it to preserve legacy behavior without attributing an origin. + [JsonPropertyName("decisionContext")] + public PermissionDecisionContext? DecisionContext { get; set; } + + /// Request ID of the pending permission request. + [JsonPropertyName("requestId")] + public string RequestId { get; set; } = string.Empty; + + /// The client's response to the pending permission prompt. + [JsonPropertyName("result")] + public PermissionDecision Result { get => field ??= new(); set; } + /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } -/// A single large message currently in context. +/// Pending permission prompt reconstructed from event history, with request ID and user-facing prompt details. [Experimental(Diagnostics.Experimental)] -public sealed class ContextHeaviestMessage +public sealed class PendingPermissionRequest { - /// Stable identifier for this message within the snapshot. - [JsonPropertyName("id")] - public string Id { get; set; } = string.Empty; - - /// Human-readable source label, e.g. `tool: bash` or `skill: tmux`. Presentation-only. - [JsonPropertyName("label")] - public string Label { get; set; } = string.Empty; - - /// Role of the chat message (`user`, `assistant`, or `tool`). - [JsonPropertyName("role")] - public string Role { get; set; } = string.Empty; + /// The user-facing permission prompt details (commands, write, read, mcp, url, memory, custom-tool, path, hook). + [JsonPropertyName("request")] + public PermissionPromptRequest Request { get; set; } = null!; - /// Token count currently in context for this individual message. - [JsonPropertyName("tokens")] - public long Tokens { get; set; } + /// Unique identifier for the pending permission request. + [JsonPropertyName("requestId")] + public string RequestId { get; set; } = string.Empty; } -/// The heaviest individual messages in the session's context window, most-expensive first. +/// List of pending permission requests reconstructed from event history. [Experimental(Diagnostics.Experimental)] -public sealed class MetadataContextHeaviestMessagesResult +public sealed class PendingPermissionRequestList { - /// Heaviest messages, most-expensive first. - [JsonPropertyName("messages")] - public IList Messages { get => field ??= []; set; } - - /// Total token count of the current context window, so callers can compute each message's share without a second call. - [JsonPropertyName("totalTokens")] - public long TotalTokens { get; set; } + /// Pending permission prompts reconstructed from the session's event history. Equivalent to the set of `permission.requested` events that have not yet been followed by a matching `permission.completed` event. Used by clients (e.g. the CLI) to hydrate UI for prompts that were emitted before the client attached to the session. + [JsonPropertyName("items")] + public IList Items { get => field ??= []; set; } } -/// Parameters for the heaviest-messages query. +/// No parameters; returns currently-pending permission requests for the session. [Experimental(Diagnostics.Experimental)] -internal sealed class MetadataContextHeaviestMessagesRequest +internal sealed class PermissionsPendingRequestsRequest { - /// Maximum number of messages to return, most-expensive first. Omit for the server default. - [JsonPropertyName("limit")] - public long? Limit { get; set; } - /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } -/// Notify the session that its working directory context has changed. Emits a `session.context_changed` event so consumers (telemetry, OTel tracker, ACP, the timeline UI) can react. Use this when the host has detected a cwd/branch/repo change outside the session's normal lifecycle (e.g., after a shell command in interactive mode). For a local session, a report whose `cwd` diverges from the session's current working directory is ignored (the call still succeeds but records nothing and emits no event); move a local session's working directory via `metadata.setWorkingDirectory` instead. +/// Indicates whether the operation succeeded. [Experimental(Diagnostics.Experimental)] -public sealed class MetadataRecordContextChangeResult +public sealed class PermissionsSetApproveAllResult { + /// Whether the operation succeeded. + [JsonPropertyName("success")] + public bool Success { get; set; } } -/// Updated working directory and git context. Emitted as the new payload of `session.context_changed`. +/// Allow-all toggle for tool permission requests, with an optional telemetry source. [Experimental(Diagnostics.Experimental)] -public sealed class SessionWorkingDirectoryContext +internal sealed class PermissionsSetApproveAllRequest { - /// Merge-base commit SHA (fork point from the remote default branch). - [JsonPropertyName("baseCommit")] - public string? BaseCommit { get; set; } - - /// Current git branch name. - [JsonPropertyName("branch")] - public string? Branch { get; set; } - - /// Current working directory path. - [JsonPropertyName("cwd")] - public string Cwd { get; set; } = string.Empty; - - /// Root directory of the git repository, resolved via git rev-parse. - [JsonPropertyName("gitRoot")] - public string? GitRoot { get; set; } + /// Whether to auto-approve all tool permission requests. + [JsonPropertyName("enabled")] + public bool Enabled { get; set; } - /// Head commit of the current git branch. - [JsonPropertyName("headCommit")] - public string? HeadCommit { get; set; } + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; - /// Hosting platform type of the repository. - [JsonPropertyName("hostType")] - public SessionWorkingDirectoryContextHostType? HostType { get; set; } + /// Optional source for allow-all telemetry. Defaults to `rpc` when omitted for SDK callers. + [JsonPropertyName("source")] + public PermissionsSetApproveAllSource? Source { get; set; } +} - /// Repository identifier derived from the git remote URL ("owner/name" for GitHub, "org/project/repo" for Azure DevOps). - [JsonPropertyName("repository")] - public string? Repository { get; set; } +/// Indicates whether the requested permission mode was applied and reports the authoritative post-mutation mode. +[Experimental(Diagnostics.Experimental)] +public sealed class PermissionsSetModeResult +{ + /// Authoritative permission mode after the mutation. + [JsonPropertyName("mode")] + public PermissionMode Mode { get; set; } - /// Raw host string from the git remote URL (e.g. "github.com", "dev.azure.com"). - [JsonPropertyName("repositoryHost")] - public string? RepositoryHost { get; set; } + /// Whether the operation succeeded. + [JsonPropertyName("success")] + public bool Success { get; set; } } -/// Updated working-directory/git context to record on the session. +/// Permission mode to apply for the session. [Experimental(Diagnostics.Experimental)] -internal sealed class MetadataRecordContextChangeRequest +internal sealed class PermissionsSetModeRequest { - /// Updated working directory and git context. Emitted as the new payload of `session.context_changed`. - [JsonPropertyName("context")] - public SessionWorkingDirectoryContext Context { get => field ??= new(); set; } + /// Optional judge model id for assisted mode. When omitted, the session resolves the provider default: `gpt-5.5` for CAPI sessions and the active session model for BYOK sessions. + [JsonPropertyName("assistedApprovalModel")] + public string? AssistedApprovalModel { get; set; } + + /// Permission mode to apply. + [JsonPropertyName("mode")] + public PermissionMode Mode { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; + + /// Optional source for permission-mode telemetry. Defaults to `rpc` when omitted for SDK callers. + [JsonPropertyName("source")] + public PermissionModeSource? Source { get; set; } } -/// Update the session's working directory. Used by the host when the user explicitly changes cwd (e.g., the `/cd` slash command). The host is responsible for any related side-effects (file index, etc.); it does NOT change the process working directory (a session's cwd is per-session, not process-global). For local sessions the runtime validates the target first (an absolute path that exists on disk) and re-bases the permission primary directory; a rejected validation fails the call before anything is mutated, persisted, or emitted. Location-scoped permission rules are then re-keyed to the new directory (best-effort). Remote sessions only record the path. +/// Current permission mode. [Experimental(Diagnostics.Experimental)] -public sealed class MetadataSetWorkingDirectoryResult +public sealed class PermissionsGetModeResult { - /// Working directory after the update. - [JsonPropertyName("workingDirectory")] - public string WorkingDirectory { get; set; } = string.Empty; + /// Current permission mode. + [JsonPropertyName("mode")] + public PermissionMode Mode { get; set; } } -/// Absolute path to set as the session's new working directory. For local sessions the path must be absolute and exist on disk: it is validated before any session state changes, and a failing validation rejects the call with nothing mutated, persisted, or emitted. Remote sessions record the path as-is. +/// No parameters. [Experimental(Diagnostics.Experimental)] -internal sealed class MetadataSetWorkingDirectoryRequest +internal sealed class PermissionsGetModeRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; - - /// Absolute path to set as the session's working directory. The runtime updates the session's recorded cwd so subsequent operations (shell tools, file lookups, telemetry) anchor to it. - [JsonPropertyName("workingDirectory")] - public string WorkingDirectory { get; set; } = string.Empty; } -/// Re-tokenize the session's existing messages against `modelId` and return the token totals. Useful for hosts that want an initial estimate of context usage on session resume, before the next agent turn fires `session.context_info_changed` events. Returns zeros for an empty session. +/// Indicates whether the operation succeeded. [Experimental(Diagnostics.Experimental)] -public sealed class MetadataRecomputeContextTokensResult +public sealed class PermissionsModifyRulesResult { - /// Tokens contributed by user/assistant/tool messages (excludes system/developer prompts). - [JsonPropertyName("messagesTokenCount")] - public long MessagesTokenCount { get; set; } - - /// Tokens contributed by system/developer prompt snapshots. - [JsonPropertyName("systemTokenCount")] - public long SystemTokenCount { get; set; } - - /// Sum of tokens across chat-context and system-context messages currently held by the session. - [JsonPropertyName("totalTokens")] - public long TotalTokens { get; set; } + /// Whether the operation succeeded. + [JsonPropertyName("success")] + public bool Success { get; set; } } -/// Model identifier to use when re-tokenizing the session's existing messages. +/// Scope and add/remove instructions for modifying session- or location-scoped permission rules. [Experimental(Diagnostics.Experimental)] -internal sealed class MetadataRecomputeContextTokensRequest +internal sealed class PermissionsModifyRulesParams { - /// Model identifier used for tokenization. The runtime token-counts both chat-context and system-context messages against this model. - [JsonPropertyName("modelId")] - public string ModelId { get; set; } = string.Empty; + /// Rules to add to the scope. Applied before `remove`/`removeAll`. + [JsonPropertyName("add")] + public IList? Add { get; set; } + + /// Specific rules to remove from the scope. Ignored when `removeAll` is true. + [JsonPropertyName("remove")] + public IList? Remove { get; set; } + + /// When true, removes every rule currently in the scope (after any `add` is applied). Useful for clearing the location scope wholesale. + [JsonPropertyName("removeAll")] + public bool? RemoveAll { get; set; } + + /// Whether the change applies to ephemeral session-scoped rules (cleared at session end) or to location-scoped rules persisted via the location-permissions config file. + [JsonPropertyName("scope")] + public PermissionsModifyRulesScope Scope { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } -/// Availability of built-in job tools surfaced to boundary consumers. +/// Indicates whether the operation succeeded. [Experimental(Diagnostics.Experimental)] -public sealed class SessionSettingsBuiltInToolAvailabilitySnapshot +public sealed class PermissionsSetRequiredResult { - /// Whether the create-pull-request tool is available. - [JsonPropertyName("createPullRequest")] - public bool? CreatePullRequest { get; set; } - - /// Whether the report-progress tool is available. - [JsonPropertyName("reportProgress")] - public bool? ReportProgress { get; set; } + /// Whether the operation succeeded. + [JsonPropertyName("success")] + public bool Success { get; set; } } -/// Redacted job settings for a session. The job nonce is excluded. +/// Toggles whether permission prompts should be bridged into session events for this client. [Experimental(Diagnostics.Experimental)] -public sealed class SessionSettingsJobSnapshot +internal sealed class PermissionsSetRequiredRequest { - /// Availability of job-specific built-in tools. - [JsonPropertyName("builtInToolAvailability")] - public SessionSettingsBuiltInToolAvailabilitySnapshot? BuiltInToolAvailability { get; set; } - - /// GitHub Actions event type for the job. - [JsonPropertyName("eventType")] - public string? EventType { get; set; } + /// Whether the client wants `permission.requested` events bridged from the session-owned permission service. CLI clients that render prompt UI set this to `true` for as long as their listener is mounted; headless callers leave it unset (the default is `false`). + [JsonPropertyName("required")] + public bool Required { get; set; } - /// Whether this is the workflow's trigger job. - [JsonPropertyName("isTriggerJob")] - public bool? IsTriggerJob { get; set; } + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; } -/// Redacted model routing settings for a session. +/// Indicates whether the operation succeeded. [Experimental(Diagnostics.Experimental)] -public sealed class SessionSettingsModelSnapshot +public sealed class PermissionsResetSessionApprovalsResult { - /// Agent service callback URL for job and progress updates. - [JsonPropertyName("callbackUrl")] - public string? CallbackUrl { get; set; } - - /// Default reasoning effort for the selected model. - [JsonPropertyName("defaultReasoningEffort")] - public string? DefaultReasoningEffort { get; set; } - - /// Agent job identifier for the session. - [JsonPropertyName("instanceId")] - public string? InstanceId { get; set; } - - /// Selected model identifier. - [JsonPropertyName("model")] - public string? Model { get; set; } + /// Whether the operation succeeded. + [JsonPropertyName("success")] + public bool Success { get; set; } } -/// Online-evaluation settings safe to expose across the SDK boundary. +/// Clears session-scoped tool permission approvals, and optionally the location-scoped ones. [Experimental(Diagnostics.Experimental)] -public sealed class SessionSettingsOnlineEvaluationSnapshot +internal sealed class PermissionsResetSessionApprovalsRequest { - /// Whether online evaluation is disabled. - [JsonPropertyName("disableOnlineEvaluation")] - public bool? DisableOnlineEvaluation { get; set; } + /// Whether location-scoped approvals are cleared too. Defaults to `true`. + [JsonPropertyName("includeLocation")] + public bool? IncludeLocation { get; set; } - /// Whether online-evaluation output-file generation is enabled. - [JsonPropertyName("enableOnlineEvaluationOutputFile")] - public bool? EnableOnlineEvaluationOutputFile { get; set; } + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; } -/// Redacted repository and GitHub host settings for a session. +/// Indicates whether the operation succeeded. [Experimental(Diagnostics.Experimental)] -public sealed class SessionSettingsRepoSnapshot +public sealed class PermissionsNotifyPromptShownResult { - /// Checked-out repository branch. - [JsonPropertyName("branch")] - public string? Branch { get; set; } - - /// Checked-out commit SHA. - [JsonPropertyName("commit")] - public string? Commit { get; set; } - - /// GitHub server host name. - [JsonPropertyName("host")] - public string? Host { get; set; } - - /// Protocol used to access the GitHub host. - [JsonPropertyName("hostProtocol")] - public string? HostProtocol { get; set; } - - /// GitHub repository database ID. - [JsonPropertyName("id")] - public double? Id { get; set; } - - /// Repository name. - [JsonPropertyName("name")] - public string? Name { get; set; } - - /// GitHub repository owner database ID. - [JsonPropertyName("ownerId")] - public double? OwnerId { get; set; } - - /// Repository owner login. - [JsonPropertyName("ownerName")] - public string? OwnerName { get; set; } - - /// Number of commits in the pull request. - [JsonPropertyName("prCommitCount")] - public double? PrCommitCount { get; set; } - - /// Whether the repository is writable. - [JsonPropertyName("readWrite")] - public bool? ReadWrite { get; set; } - - /// GitHub secret-scanning service URL. - [JsonPropertyName("secretScanningUrl")] - public string? SecretScanningUrl { get; set; } - - /// GitHub server base URL. - [JsonPropertyName("serverUrl")] - public string? ServerUrl { get; set; } + /// Whether the operation succeeded. + [JsonPropertyName("success")] + public bool Success { get; set; } } -/// Redacted validation and memory-tool settings for a session. +/// Notification payload describing the permission prompt that the client just rendered. [Experimental(Diagnostics.Experimental)] -public sealed class SessionSettingsValidationSnapshot +internal sealed class PermissionPromptShownNotification { - /// Whether advisory validation is enabled. - [JsonPropertyName("advisoryEnabled")] - public bool? AdvisoryEnabled { get; set; } - - /// Whether CodeQL validation is enabled. - [JsonPropertyName("codeqlEnabled")] - public bool? CodeqlEnabled { get; set; } - - /// Whether code-review validation is enabled. - [JsonPropertyName("codeReviewEnabled")] - public bool? CodeReviewEnabled { get; set; } - - /// Model used for code-review validation. - [JsonPropertyName("codeReviewModel")] - public string? CodeReviewModel { get; set; } - - /// Dependabot validation timeout budget in seconds. - [JsonPropertyName("dependabotTimeout")] - public double? DependabotTimeout { get; set; } - - /// Whether the memory-store tool is enabled. - [JsonPropertyName("memoryStoreEnabled")] - public bool? MemoryStoreEnabled { get; set; } - - /// Whether the memory-vote tool is enabled. - [JsonPropertyName("memoryVoteEnabled")] - public bool? MemoryVoteEnabled { get; set; } - - /// Whether secret-scanning validation is enabled. - [JsonPropertyName("secretScanningEnabled")] - public bool? SecretScanningEnabled { get; set; } + /// Human-readable description of the prompt the user is being asked to approve. Used by the runtime to fire the registered `permission_prompt` notification hook (e.g. terminal bell, desktop notification). + [JsonPropertyName("message")] + public string Message { get; set; } = string.Empty; - /// General validation timeout budget in seconds. - [JsonPropertyName("timeout")] - public double? Timeout { get; set; } + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; } -/// Redacted, serializable view of session runtime settings for SDK boundary consumers. Secrets and raw feature flags are intentionally excluded. +/// Snapshot of the session's allow-listed directories and primary working directory. [Experimental(Diagnostics.Experimental)] -internal sealed class SessionSettingsSnapshot +public sealed class PermissionPathsList { - /// Name of the SDK client that created the session. - [JsonPropertyName("clientName")] - public string? ClientName { get; set; } - - /// Redacted job settings. - [JsonPropertyName("job")] - public SessionSettingsJobSnapshot Job { get => field ??= new(); set; } - - /// Redacted model routing settings. - [JsonPropertyName("model")] - public SessionSettingsModelSnapshot Model { get => field ??= new(); set; } - - /// Online-evaluation settings safe for SDK consumers. - [JsonPropertyName("onlineEvaluation")] - public SessionSettingsOnlineEvaluationSnapshot OnlineEvaluation { get => field ??= new(); set; } - - /// Redacted repository and host settings. - [JsonPropertyName("repo")] - public SessionSettingsRepoSnapshot Repo { get => field ??= new(); set; } - - /// Session start time as Unix epoch milliseconds. - [JsonPropertyName("startTimeMs")] - public double? StartTimeMs { get; set; } - - /// Session timeout in milliseconds. - [JsonPropertyName("timeoutMs")] - public double? TimeoutMs { get; set; } - - /// Redacted validation and memory-tool settings. - [JsonPropertyName("validation")] - public SessionSettingsValidationSnapshot Validation { get => field ??= new(); set; } + /// All directories currently allowed for tool access on this session. + [JsonPropertyName("directories")] + public IList Directories { get => field ??= []; set; } - /// Agent runtime version selector copied from the session settings, such as `latest` or a runtime release identifier. - [JsonPropertyName("version")] - public string? Version { get; set; } + /// The primary working directory for this session. + [JsonPropertyName("primary")] + public string Primary { get; set; } = string.Empty; } -/// Identifies the target session. +/// No parameters; returns the session's allow-listed directories. [Experimental(Diagnostics.Experimental)] -internal sealed class SessionSettingsSnapshotRequest +internal sealed class PermissionsPathsListRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } -/// Result of evaluating a Rust-owned settings predicate. +/// Indicates whether the operation succeeded. [Experimental(Diagnostics.Experimental)] -internal sealed class SessionSettingsEvaluatePredicateResult +public sealed class PermissionsPathsAddResult { - /// Whether the named settings predicate evaluated to enabled. - [JsonPropertyName("enabled")] - public bool Enabled { get; set; } + /// Whether the operation succeeded. + [JsonPropertyName("success")] + public bool Success { get; set; } } -/// Named Rust-owned settings predicate to evaluate for this session. +/// Directory path to add to the session's allowed directories. [Experimental(Diagnostics.Experimental)] -internal sealed class SessionSettingsEvaluatePredicateRequest +internal sealed class PermissionPathsAddParams { - /// Predicate name. The runtime owns the raw feature-flag names and composition logic. - [JsonPropertyName("name")] - public SessionSettingsPredicateName Name { get; set; } + /// Directory to add to the allow-list. The runtime resolves and validates the path before adding. + [JsonPropertyName("path")] + public string Path { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; - - /// Tool name for tool-scoped predicates such as trivial-change handling. - [JsonPropertyName("toolName")] - public string? ToolName { get; set; } } -/// Content-exclusion decision for one requested path. +/// Indicates whether the operation succeeded. [Experimental(Diagnostics.Experimental)] -public sealed class ContentExclusionPathCheck +public sealed class PermissionsPathsUpdatePrimaryResult { - /// Whether the session's complete content-exclusion policy excludes the path. - [JsonPropertyName("excluded")] - public bool Excluded { get; set; } + /// Whether the operation succeeded. + [JsonPropertyName("success")] + public bool Success { get; set; } +} - /// The path supplied by the caller. +/// Directory path to set as the session's new primary working directory. +[Experimental(Diagnostics.Experimental)] +internal sealed class PermissionPathsUpdatePrimaryParams +{ + /// Directory to set as the new primary working directory for the session's permission policy. [JsonPropertyName("path")] public string Path { get; set; } = string.Empty; + + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; } -/// Batch content-exclusion result. Callers must fail closed when policy evaluation is unavailable. +/// Indicates whether the supplied path is within the session's allowed directories. [Experimental(Diagnostics.Experimental)] -public sealed class ContentExclusionCheckPathsResult +public sealed class PermissionPathsAllowedCheckResult { - /// Whether the session's policy service was available for the complete batch. When false, checks is empty and callers must treat every requested path as excluded. - [JsonPropertyName("available")] - public bool Available { get; set; } - - /// Per-path decisions in request order. Empty when available is false. - [JsonPropertyName("checks")] - public IList Checks { get => field ??= []; set; } + /// Whether the path is within the session's allowed directories. + [JsonPropertyName("allowed")] + public bool Allowed { get; set; } } -/// Local file system absolute paths within the session working directory to check against its content-exclusion policy. +/// Path to evaluate against the session's allowed directories. [Experimental(Diagnostics.Experimental)] -internal sealed class ContentExclusionCheckPathsRequest +internal sealed class PermissionPathsAllowedCheckParams { - /// Local file system absolute paths within the session working directory to check. Results are returned in the same order, including duplicates. - [JsonPropertyName("paths")] - public IList Paths { get => field ??= []; set; } + /// Path to check against the session's allowed directories. + [JsonPropertyName("path")] + public string Path { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } -/// Identifier of the spawned process, used to correlate streamed output and exit notifications. +/// Indicates whether the supplied path is within the session's workspace directory. [Experimental(Diagnostics.Experimental)] -public sealed class ShellExecResult +public sealed class PermissionPathsWorkspaceCheckResult { - /// Unique identifier for tracking streamed output. - [JsonPropertyName("processId")] - public string ProcessId { get; set; } = string.Empty; + /// Whether the path is within the session workspace directory. + [JsonPropertyName("allowed")] + public bool Allowed { get; set; } } -/// Shell command to run, with optional working directory and timeout in milliseconds. +/// Path to evaluate against the session's workspace (primary) directory. [Experimental(Diagnostics.Experimental)] -internal sealed class ShellExecRequest +internal sealed class PermissionPathsWorkspaceCheckParams { - /// Shell command to execute. - [JsonPropertyName("command")] - public string Command { get; set; } = string.Empty; - - /// Working directory (defaults to session working directory). - [JsonPropertyName("cwd")] - public string? Cwd { get; set; } + /// Path to check against the session workspace directory. + [JsonPropertyName("path")] + public string Path { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; - - /// Timeout in milliseconds (default: 30000). - [JsonConverter(typeof(MillisecondsTimeSpanConverter))] - [JsonPropertyName("timeout")] - public TimeSpan? Timeout { get; set; } } -/// Indicates whether the signal was delivered; false if the process was unknown or already exited. +/// Resolved location-permissions key and type. [Experimental(Diagnostics.Experimental)] -public sealed class ShellKillResult +public sealed class PermissionLocationResolveResult { - /// Whether the signal was sent successfully. - [JsonPropertyName("killed")] - public bool Killed { get; set; } + /// Location key used in the location-permissions store. + [JsonPropertyName("locationKey")] + public string LocationKey { get; set; } = string.Empty; + + /// Whether the location is a git repo or directory. + [JsonPropertyName("locationType")] + public PermissionLocationType LocationType { get; set; } } -/// Identifier of a process previously returned by "shell.exec" and the signal to send. +/// Working directory to resolve into a location-permissions key. [Experimental(Diagnostics.Experimental)] -internal sealed class ShellKillRequest +internal sealed class PermissionLocationResolveParams { - /// Process identifier returned by shell.exec. - [JsonPropertyName("processId")] - public string ProcessId { get; set; } = string.Empty; - /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; - /// Signal to send (default: SIGTERM). - [JsonPropertyName("signal")] - public ShellKillSignal? Signal { get; set; } + /// Working directory whose permission location should be resolved. + [JsonPropertyName("workingDirectory")] + public string WorkingDirectory { get; set; } = string.Empty; } -/// Result of a user-requested shell command. +/// Summary of persisted location permissions applied to the session. [Experimental(Diagnostics.Experimental)] -public sealed class UserRequestedShellCommandResult +public sealed class PermissionLocationApplyResult { - /// Error output when the execution failed. - [JsonPropertyName("error")] - public string? Error { get; set; } + /// Number of persisted allowed directories added to the live path manager. + [JsonPropertyName("appliedDirectoryCount")] + public long AppliedDirectoryCount { get; set; } - /// Process exit code, when available. - [JsonPropertyName("exitCode")] - public long? ExitCode { get; set; } + /// Number of location-scoped rules added to the live permission service. + [JsonPropertyName("appliedRuleCount")] + public long AppliedRuleCount { get; set; } - /// Captured command output. - [JsonPropertyName("output")] - public string Output { get; set; } = string.Empty; + /// Location-scoped rules applied to the live permission service. + [JsonPropertyName("appliedRules")] + public IList AppliedRules { get => field ??= []; set; } - /// Whether the command completed successfully. - [JsonPropertyName("success")] - public bool Success { get; set; } + /// Whether a different location was applied since the previous apply call. + [JsonPropertyName("changed")] + public bool Changed { get; set; } - /// Tool call id emitted for the shell execution. - [JsonPropertyName("toolCallId")] - public string ToolCallId { get; set; } = string.Empty; + /// Location key used in the location-permissions store. + [JsonPropertyName("locationKey")] + public string LocationKey { get; set; } = string.Empty; + + /// Whether the location is a git repo or directory. + [JsonPropertyName("locationType")] + public PermissionLocationType LocationType { get; set; } } -/// User-requested shell command and cancellation handle. +/// Working directory to load persisted location permissions for. [Experimental(Diagnostics.Experimental)] -internal sealed class ShellExecuteUserRequestedRequest +internal sealed class PermissionLocationApplyParams { - /// Shell command to execute. - [JsonPropertyName("command")] - public string Command { get; set; } = string.Empty; - - /// Caller-provided cancellation handle for this execution. - [JsonPropertyName("requestId")] - public string RequestId { get; set; } = string.Empty; - /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; + + /// Working directory whose persisted location permissions should be applied. + [JsonPropertyName("workingDirectory")] + public string WorkingDirectory { get; set; } = string.Empty; } -/// Cancellation result for a user-requested shell command. +/// Indicates whether the operation succeeded. [Experimental(Diagnostics.Experimental)] -public sealed class CancelUserRequestedShellCommandResult +public sealed class PermissionsLocationsAddToolApprovalResult { - /// Whether an in-flight execution was found and signalled to cancel. - [JsonPropertyName("cancelled")] - public bool Cancelled { get; set; } + /// Whether the operation succeeded. + [JsonPropertyName("success")] + public bool Success { get; set; } } -/// User-requested shell execution cancellation handle. +/// Tool approval to persist and apply. +/// Polymorphic base type discriminated by kind. [Experimental(Diagnostics.Experimental)] -internal sealed class ShellCancelUserRequestedRequest +[JsonPolymorphic( + TypeDiscriminatorPropertyName = "kind", + UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToBaseType)] +[JsonDerivedType(typeof(PermissionsLocationsAddToolApprovalDetailsCommands), "commands")] +[JsonDerivedType(typeof(PermissionsLocationsAddToolApprovalDetailsRead), "read")] +[JsonDerivedType(typeof(PermissionsLocationsAddToolApprovalDetailsWrite), "write")] +[JsonDerivedType(typeof(PermissionsLocationsAddToolApprovalDetailsMcp), "mcp")] +[JsonDerivedType(typeof(PermissionsLocationsAddToolApprovalDetailsMcpSampling), "mcp-sampling")] +[JsonDerivedType(typeof(PermissionsLocationsAddToolApprovalDetailsMemory), "memory")] +[JsonDerivedType(typeof(PermissionsLocationsAddToolApprovalDetailsCustomTool), "custom-tool")] +[JsonDerivedType(typeof(PermissionsLocationsAddToolApprovalDetailsExtensionManagement), "extension-management")] +[JsonDerivedType(typeof(PermissionsLocationsAddToolApprovalDetailsFactory), "factory")] +[JsonDerivedType(typeof(PermissionsLocationsAddToolApprovalDetailsExtensionPermissionAccess), "extension-permission-access")] +[JsonDerivedType(typeof(PermissionsLocationsAddToolApprovalDetailsExtensionEnvAccess), "extension-env-access")] +public partial class PermissionsLocationsAddToolApprovalDetails { - /// Request ID previously passed to executeUserRequested. - [JsonPropertyName("requestId")] - public string RequestId { get; set; } = string.Empty; - - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// The type discriminator. + [JsonPropertyName("kind")] + public virtual string Kind { get; set; } = string.Empty; } -/// Post-compaction context window usage breakdown. + +/// Location-persisted tool approval details for specific command identifiers. +/// The commands variant of . [Experimental(Diagnostics.Experimental)] -public sealed class HistoryCompactContextWindow +public partial class PermissionsLocationsAddToolApprovalDetailsCommands : PermissionsLocationsAddToolApprovalDetails { - /// Token count from non-system messages (user, assistant, tool). - [JsonPropertyName("conversationTokens")] - public long? ConversationTokens { get; set; } - - /// Current total tokens in the context window (system + conversation + tool definitions). - [JsonPropertyName("currentTokens")] - public long CurrentTokens { get; set; } - - /// Current number of messages in the conversation. - [JsonPropertyName("messagesLength")] - public long MessagesLength { get; set; } - - /// Token count from system message(s). - [JsonPropertyName("systemTokens")] - public long? SystemTokens { get; set; } - - /// Maximum token count for the model's context window. - [JsonPropertyName("tokenLimit")] - public long TokenLimit { get; set; } + /// + [JsonIgnore] + public override string Kind => "commands"; - /// Token count from tool definitions. - [JsonPropertyName("toolDefinitionsTokens")] - public long? ToolDefinitionsTokens { get; set; } + /// Command identifiers covered by this approval. + [JsonPropertyName("commandIdentifiers")] + public required IList CommandIdentifiers { get; set; } } -/// Compaction outcome with the number of tokens and messages removed, summary text, and the resulting context window breakdown. +/// Location-persisted tool approval details for read-only filesystem operations. +/// The read variant of . [Experimental(Diagnostics.Experimental)] -public sealed class HistoryCompactResult +public partial class PermissionsLocationsAddToolApprovalDetailsRead : PermissionsLocationsAddToolApprovalDetails { - /// Post-compaction context window usage breakdown. - [JsonPropertyName("contextWindow")] - public HistoryCompactContextWindow? ContextWindow { get; set; } - - /// Number of messages removed during compaction. - [JsonPropertyName("messagesRemoved")] - public long MessagesRemoved { get; set; } - - /// Whether compaction completed successfully. - [JsonPropertyName("success")] - public bool Success { get; set; } - - /// Summary text produced by compaction. Omitted when compaction did not produce a summary (e.g. failure path). - [JsonPropertyName("summaryContent")] - public string? SummaryContent { get; set; } - - /// Number of tokens freed by compaction. - [JsonPropertyName("tokensRemoved")] - public long TokensRemoved { get; set; } + /// + [JsonIgnore] + public override string Kind => "read"; } -/// RPC data type for SessionHistoryCompact operations. +/// Location-persisted tool approval details for filesystem write operations. +/// The write variant of . [Experimental(Diagnostics.Experimental)] -public sealed class SessionHistoryCompactRequest +public partial class PermissionsLocationsAddToolApprovalDetailsWrite : PermissionsLocationsAddToolApprovalDetails { - /// Optional user-provided instructions to focus the compaction summary. - [UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "Safe for generated string properties: JSON Schema minLength/maxLength map to string length validation, not reflection over trimmed Count members")] - [MaxLength(4000)] - [JsonPropertyName("customInstructions")] - public string? CustomInstructions { get; set; } - - /// Context window token limit this compaction is targeting, recorded as the `tokenLimit` on the persisted `session.compaction_start` / `session.compaction_complete` events. Set it when the compaction targets a window other than the compacting model's own, e.g. switching to a model with a smaller context window: the compaction still runs on the current model, so the limit that motivated it would otherwise be lost. When absent, the events record the compacting model's own resolved limit. Attribution metadata only - it does not change how much the compaction removes. - [JsonPropertyName("tokenLimit")] - public long? TokenLimit { get; set; } - - /// What initiated this compaction request, recorded as the `trigger` on the persisted `session.compaction_start` / `session.compaction_complete` events. When absent, the compaction is persisted without trigger attribution (initiator unknown). - [JsonPropertyName("trigger")] - public SessionHistoryCompactRequestTrigger? Trigger { get; set; } + /// + [JsonIgnore] + public override string Kind => "write"; } -/// RPC data type for SessionHistoryCompactRequestWithSession operations. +/// Location-persisted tool approval details for an MCP server tool, or all tools when `toolName` is null. +/// The mcp variant of . [Experimental(Diagnostics.Experimental)] -internal sealed class SessionHistoryCompactRequestWithSession +public partial class PermissionsLocationsAddToolApprovalDetailsMcp : PermissionsLocationsAddToolApprovalDetails { - /// Optional user-provided instructions to focus the compaction summary. - [UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "Safe for generated string properties: JSON Schema minLength/maxLength map to string length validation, not reflection over trimmed Count members")] - [MaxLength(4000)] - [JsonPropertyName("customInstructions")] - public string? CustomInstructions { get; set; } - - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// + [JsonIgnore] + public override string Kind => "mcp"; - /// Context window token limit this compaction is targeting, recorded as the `tokenLimit` on the persisted `session.compaction_start` / `session.compaction_complete` events. Set it when the compaction targets a window other than the compacting model's own, e.g. switching to a model with a smaller context window: the compaction still runs on the current model, so the limit that motivated it would otherwise be lost. When absent, the events record the compacting model's own resolved limit. Attribution metadata only - it does not change how much the compaction removes. - [JsonPropertyName("tokenLimit")] - public long? TokenLimit { get; set; } + /// MCP server name. + [JsonPropertyName("serverName")] + public required string ServerName { get; set; } - /// What initiated this compaction request, recorded as the `trigger` on the persisted `session.compaction_start` / `session.compaction_complete` events. When absent, the compaction is persisted without trigger attribution (initiator unknown). - [JsonPropertyName("trigger")] - public SessionHistoryCompactRequestTrigger? Trigger { get; set; } + /// MCP tool name, or null to cover every tool on the server. + [JsonPropertyName("toolName")] + public string? ToolName { get; set; } } -/// Number of events that were removed by the truncation. +/// Location-persisted tool approval details for MCP sampling requests from a server. +/// The mcp-sampling variant of . [Experimental(Diagnostics.Experimental)] -public sealed class HistoryTruncateResult +public partial class PermissionsLocationsAddToolApprovalDetailsMcpSampling : PermissionsLocationsAddToolApprovalDetails { - /// Failure detail when checkpointCleanupFailed is true. - [JsonPropertyName("checkpointCleanupError")] - public string? CheckpointCleanupError { get; set; } - - /// True when conversation truncation succeeded but post-truncation workspace checkpoint cleanup failed. History is already truncated; callers may still prune snapshots but should report a checkpoint-cleanup rather than a truncation failure. - [JsonPropertyName("checkpointCleanupFailed")] - public bool? CheckpointCleanupFailed { get; set; } + /// + [JsonIgnore] + public override string Kind => "mcp-sampling"; - /// Number of events that were removed. - [JsonPropertyName("eventsRemoved")] - public long EventsRemoved { get; set; } + /// MCP server name. + [JsonPropertyName("serverName")] + public required string ServerName { get; set; } } -/// Identifier of the event to truncate to; this event and all later events are removed. +/// Location-persisted tool approval details for writes to long-term memory. +/// The memory variant of . [Experimental(Diagnostics.Experimental)] -internal sealed class HistoryTruncateRequest +public partial class PermissionsLocationsAddToolApprovalDetailsMemory : PermissionsLocationsAddToolApprovalDetails { - /// Event ID to truncate to. This event and all events after it are removed from the session. - [JsonPropertyName("eventId")] - public string EventId { get; set; } = string.Empty; - - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// + [JsonIgnore] + public override string Kind => "memory"; } -/// A root user turn that the session can rewind to. +/// Location-persisted tool approval details for a custom tool, keyed by tool name. +/// The custom-tool variant of . [Experimental(Diagnostics.Experimental)] -public sealed class HistoryRewindPoint +public partial class PermissionsLocationsAddToolApprovalDetailsCustomTool : PermissionsLocationsAddToolApprovalDetails { - /// Whether at least one file in this turn or a later turn can be restored. - [JsonPropertyName("canRestoreFiles")] - public bool CanRestoreFiles { get; set; } - - /// ID of the user.message event that begins the discarded suffix. - [JsonPropertyName("eventId")] - public string EventId { get; set; } = string.Empty; - - /// Number of unique files in this turn and all later turns that have captured changes. - [JsonPropertyName("fileCount")] - public long FileCount { get; set; } - - /// Whether this turn was an automatically injected autopilot continuation. - [JsonPropertyName("isAutopilotContinuation")] - public bool IsAutopilotContinuation { get; set; } - - /// Lines added by this turn's captured file changes. - [JsonPropertyName("linesAdded")] - public long LinesAdded { get; set; } - - /// Lines removed by this turn's captured file changes. - [JsonPropertyName("linesRemoved")] - public long LinesRemoved { get; set; } - - /// ISO timestamp of the user turn. - [JsonPropertyName("timestamp")] - public string Timestamp { get; set; } = string.Empty; - - /// Whether this turn itself captured any file changes. - [JsonPropertyName("turnChangedFiles")] - public bool TurnChangedFiles { get; set; } + /// + [JsonIgnore] + public override string Kind => "custom-tool"; - /// User-visible message text for the turn. - [JsonPropertyName("userMessage")] - public string UserMessage { get; set; } = string.Empty; + /// Custom tool name. + [JsonPropertyName("toolName")] + public required string ToolName { get; set; } } -/// Rewind points and file-change-tracking availability for the session. +/// Location-persisted tool approval details for extension-management operations, optionally narrowed by operation. +/// The extension-management variant of . [Experimental(Diagnostics.Experimental)] -public sealed class HistoryListRewindPointsResult +public partial class PermissionsLocationsAddToolApprovalDetailsExtensionManagement : PermissionsLocationsAddToolApprovalDetails { - /// Whether this session captured file changes from its first turn. - [JsonPropertyName("fileChangeTrackingEnabled")] - public bool FileChangeTrackingEnabled { get; set; } - - /// Root user turns in chronological order. Empty when `unavailableReason` is set. - [JsonPropertyName("points")] - public IList Points { get => field ??= []; set; } + /// + [JsonIgnore] + public override string Kind => "extension-management"; - /// Why the listed points could not be produced, when applicable; the points list is empty whenever it is set. `unsupported-remote-session` is permanent for the session and comes with `fileChangeTrackingEnabled: false`. `session-busy` is transient and only ever reported by a session that *is* tracking (`fileChangeTrackingEnabled: true`), because the file-change captures cannot be read while work that may still mutate them is in flight; the same request succeeds once the session settles, so a client that wants points should retry rather than treat it as a failure. It is never `file-change-tracking-disabled`: an untracked local session still lists conversation-only points and reports that through `fileChangeTrackingEnabled: false`. - [JsonPropertyName("unavailableReason")] - public HistoryRewindUnavailableReason? UnavailableReason { get; set; } + /// Optional operation identifier; when omitted, the approval covers all extension management operations. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("operation")] + public string? Operation { get; set; } } -/// Identifies the target session. +/// Location-persisted factory approval, optionally narrowed by approval key. +/// The factory variant of . [Experimental(Diagnostics.Experimental)] -internal sealed class SessionHistoryListRewindPointsRequest +public partial class PermissionsLocationsAddToolApprovalDetailsFactory : PermissionsLocationsAddToolApprovalDetails { - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// + [JsonIgnore] + public override string Kind => "factory"; + + /// Optional factory operation name or canonical approval key; when omitted, the approval covers all factory operations. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("approvalKey")] + public string? ApprovalKey { get; set; } } -/// A file that a conversation-and-files rewind would restore. +/// Location-persisted tool approval details for an extension's permission-gated capability access, keyed by extension name. +/// The extension-permission-access variant of . [Experimental(Diagnostics.Experimental)] -public sealed class HistoryRewindFilePreview +public partial class PermissionsLocationsAddToolApprovalDetailsExtensionPermissionAccess : PermissionsLocationsAddToolApprovalDetails { - /// Aggregate change made across the discarded turns. - [JsonPropertyName("changeType")] - public HistoryRewindChangeType ChangeType { get; set; } - - /// Lines added across the discarded turns. - [JsonPropertyName("linesAdded")] - public long LinesAdded { get; set; } - - /// Lines removed across the discarded turns. - [JsonPropertyName("linesRemoved")] - public long LinesRemoved { get; set; } + /// + [JsonIgnore] + public override string Kind => "extension-permission-access"; - /// Absolute path of the captured file. - [JsonPropertyName("path")] - public string Path { get; set; } = string.Empty; + /// Extension name. + [JsonPropertyName("extensionName")] + public required string ExtensionName { get; set; } } -/// Files and aggregate changes for a prospective rewind. +/// Location-persisted tool approval details for an extension's access to sensitive environment variables, keyed by extension name and the exact set of variable names. +/// The extension-env-access variant of . [Experimental(Diagnostics.Experimental)] -public sealed class HistoryPreviewRewindResult +public partial class PermissionsLocationsAddToolApprovalDetailsExtensionEnvAccess : PermissionsLocationsAddToolApprovalDetails { - /// Whether file restore is available for this session. This is authoritative: switch on it and read `reason` only when it is false. - [JsonPropertyName("available")] - public bool Available { get; set; } - - /// Number of unique files in the preview. - [JsonPropertyName("fileCount")] - public long FileCount { get; set; } + /// + [JsonIgnore] + public override string Kind => "extension-env-access"; - /// Files ordered by path. - [JsonPropertyName("files")] - public IList Files { get => field ??= []; set; } + /// Names of the sensitive environment variables this approval covers. Values are never persisted. + [JsonPropertyName("environmentVariables")] + public required IList EnvironmentVariables { get; set; } - /// Why file restore is unavailable, when applicable. Populated only when `available` is false and never set when `available` is true. - [JsonPropertyName("reason")] - public HistoryRewindUnavailableReason? Reason { get; set; } + /// Extension name. + [JsonPropertyName("extensionName")] + public required string ExtensionName { get; set; } } -/// Event boundary to preview for conversation-and-files rewind. +/// Location-scoped tool approval to persist. [Experimental(Diagnostics.Experimental)] -internal sealed class HistoryPreviewRewindRequest +internal sealed class PermissionLocationAddToolApprovalParams { - /// ID of the user.message event that begins the discarded suffix. - [JsonPropertyName("eventId")] - public string EventId { get; set; } = string.Empty; + /// Tool approval to persist and apply. + [JsonPropertyName("approval")] + public PermissionsLocationsAddToolApprovalDetails Approval { get => field ??= new(); set; } + + /// Location key (git root or cwd) to persist the approval to. + [JsonPropertyName("locationKey")] + public string LocationKey { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } -/// A captured file that rewind intentionally left unchanged. +/// Folder trust check result. [Experimental(Diagnostics.Experimental)] -public sealed class HistorySkippedFileRestore +public sealed class FolderTrustCheckResult { - /// Absolute path of the skipped file. + /// Whether the folder is trusted. + [JsonPropertyName("trusted")] + public bool Trusted { get; set; } +} + +/// Folder path to check for trust. +[Experimental(Diagnostics.Experimental)] +internal sealed class FolderTrustCheckParams +{ + /// Folder path to check. [JsonPropertyName("path")] public string Path { get; set; } = string.Empty; - /// Reason the file was not restored. - [JsonPropertyName("reason")] - public HistoryFileRestoreSkipReason Reason { get; set; } + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; } -/// Structured outcome of a rewind request. +/// Indicates whether the operation succeeded. [Experimental(Diagnostics.Experimental)] -public sealed class HistoryRewindResult +public sealed class PermissionsFolderTrustAddTrustedResult { - /// Failure detail. Set only for the failure and partial-failure outcomes (`files-rolled-back`, `rollback-incomplete`, `truncation-failed`, `checkpoint-cleanup-failed`, `snapshot-prune-failed`); omitted for `success` and for the unavailable outcomes (`session-busy`, `file-change-tracking-disabled`, `unsupported-remote-session`). - [JsonPropertyName("error")] - public string? Error { get; set; } - - /// Number of persisted events removed by conversation truncation. Present only when truncation succeeded (outcomes `success`, `checkpoint-cleanup-failed`, and `snapshot-prune-failed`); omitted for every unavailable outcome (`session-busy`, `file-change-tracking-disabled`, `unsupported-remote-session`) and for `truncation-failed`, `files-rolled-back`, and `rollback-incomplete`. - [JsonPropertyName("eventsRemoved")] - public long? EventsRemoved { get; set; } - - /// Overall rewind outcome. This discriminates the result: it governs which of the remaining fields are populated, so consumers must switch on it before reading `eventsRemoved`, `restoredFiles`, `skippedFiles`, or `error`. See each field for the outcomes that populate it. - [JsonPropertyName("outcome")] - public HistoryRewindOutcome Outcome { get; set; } - - /// Absolute paths restored to their captured preimages. Always empty for conversation-only rewinds and for the unavailable outcomes (`session-busy`, `file-change-tracking-disabled`, `unsupported-remote-session`); only conversation-and-files outcomes that reached the file-restore stage populate it. - [JsonPropertyName("restoredFiles")] - public IList RestoredFiles { get => field ??= []; set; } - - /// Captured files intentionally left unchanged. Always empty for conversation-only rewinds and for the unavailable outcomes (`session-busy`, `file-change-tracking-disabled`, `unsupported-remote-session`); only conversation-and-files outcomes that reached the file-restore stage populate it. - [JsonPropertyName("skippedFiles")] - public IList SkippedFiles { get => field ??= []; set; } + /// Whether the operation succeeded. + [JsonPropertyName("success")] + public bool Success { get; set; } } -/// Boundary and mode for rewinding session history. +/// Folder path to add to trusted folders. [Experimental(Diagnostics.Experimental)] -internal sealed class HistoryRewindRequest +internal sealed class FolderTrustAddParams { - /// ID of the user.message event that begins the discarded suffix. - [JsonPropertyName("eventId")] - public string EventId { get; set; } = string.Empty; - - /// Whether to rewind only conversation history or also restore captured files. - [JsonPropertyName("mode")] - public HistoryRewindMode Mode { get; set; } + /// Folder path to mark as trusted. + [JsonPropertyName("path")] + public string Path { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } -/// Indicates whether an in-progress background compaction was cancelled. +/// Indicates whether the operation succeeded. [Experimental(Diagnostics.Experimental)] -public sealed class HistoryCancelBackgroundCompactionResult +public sealed class PermissionsUrlsSetUnrestrictedModeResult { - /// Whether an in-progress background compaction was cancelled. False when no compaction was running, when the session is remote, or when the underlying processor was unavailable. - [JsonPropertyName("cancelled")] - public bool Cancelled { get; set; } + /// Whether the operation succeeded. + [JsonPropertyName("success")] + public bool Success { get; set; } } -/// Identifies the target session. +/// Whether the URL-permission policy should run in unrestricted mode. [Experimental(Diagnostics.Experimental)] -internal sealed class SessionHistoryCancelBackgroundCompactionRequest +internal sealed class PermissionUrlsSetUnrestrictedModeParams { + /// Whether to allow access to all URLs without prompting. Toggles the runtime's URL-permission policy in place. + [JsonPropertyName("enabled")] + public bool Enabled { get; set; } + /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } -/// Indicates whether an in-progress manual compaction was aborted. +/// The repository the remote session targets. [Experimental(Diagnostics.Experimental)] -public sealed class HistoryAbortManualCompactionResult +public sealed class MetadataSnapshotRemoteMetadataRepository { - /// Whether an in-progress manual compaction was aborted. False when no manual compaction was running, when its abort controller was already aborted, or when the session is remote. - [JsonPropertyName("aborted")] - public bool Aborted { get; set; } + /// The branch the remote session is operating on. + [JsonPropertyName("branch")] + public string Branch { get; set; } = string.Empty; + + /// The GitHub repository name (without owner). + [JsonPropertyName("name")] + public string Name { get; set; } = string.Empty; + + /// The GitHub owner (user or organization) of the target repository. + [JsonPropertyName("owner")] + public string Owner { get; set; } = string.Empty; } -/// Identifies the target session. +/// Remote-session-specific metadata. Populated only when `isRemote` is true. Fields are immutable for the lifetime of the session. [Experimental(Diagnostics.Experimental)] -internal sealed class SessionHistoryAbortManualCompactionRequest +public sealed class MetadataSnapshotRemoteMetadata { - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// The pull request number the remote session is associated with, if any. + [JsonPropertyName("pullRequestNumber")] + public long? PullRequestNumber { get; set; } + + /// The repository the remote session targets. + [JsonPropertyName("repository")] + public MetadataSnapshotRemoteMetadataRepository Repository { get => field ??= new(); set; } + + /// The original resource identifier (task ID or PR node ID), preserved across event-replay reconstructions. Falls back to `sessionId` when absent. + [JsonPropertyName("resourceId")] + public string? ResourceId { get; set; } + + /// Whether the remote task originated from Copilot Coding Agent (cca) or a CLI `--remote` invocation. + [JsonPropertyName("taskType")] + public MetadataSnapshotRemoteMetadataTaskType? TaskType { get; set; } } -/// Markdown summary of the conversation context (empty when not available). +/// Public-facing projection of workspace metadata for SDK / TUI consumers. +public sealed class SessionMetadataSnapshotWorkspace +{ + /// Branch checked out at session start, if any. + [JsonPropertyName("branch")] + public string? Branch { get; set; } + + /// ISO 8601 timestamp when the workspace was created. + [JsonPropertyName("created_at")] + public DateTimeOffset? CreatedAt { get; set; } + + /// Current working directory at session start. + [JsonPropertyName("cwd")] + public string? Cwd { get; set; } + + /// Resolved git root for cwd, if any. + [JsonPropertyName("git_root")] + public string? GitRoot { get; set; } + + /// Repository host type, if known. + [JsonPropertyName("host_type")] + public WorkspaceSummaryHostType? HostType { get; set; } + + /// Workspace identifier (1:1 with sessionId). + [UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "Safe for generated string properties: JSON Schema minLength/maxLength map to string length validation, not reflection over trimmed Count members")] + [MinLength(1)] + [JsonPropertyName("id")] + public string Id { get; set; } = string.Empty; + + /// Display name for the session, if set. + [JsonPropertyName("name")] + public string? Name { get; set; } + + /// Repository identifier in 'owner/repo' or 'org/project/repo' format, if any. + [JsonPropertyName("repository")] + public string? Repository { get; set; } + + /// ISO 8601 timestamp when the workspace was last updated. + [JsonPropertyName("updated_at")] + public DateTimeOffset? UpdatedAt { get; set; } + + /// Whether the display name was explicitly set by the user. + [JsonPropertyName("user_named")] + public bool? UserNamed { get; set; } +} + +/// Point-in-time snapshot of slow-changing session identifier and state fields. [Experimental(Diagnostics.Experimental)] -public sealed class HistorySummarizeForHandoffResult +public sealed class SessionMetadataSnapshot { - /// Markdown summary of the conversation context produced by an LLM. Empty string when there are no messages or when the session does not support local summarization. + /// True when the session was detected to be in use by another process at construction time. Local consumers may surface a confirmation prompt before fully attaching. Always false for new sessions. + [JsonPropertyName("alreadyInUse")] + public bool AlreadyInUse { get; set; } + + /// Runtime client name associated with the session (telemetry identifier). + [JsonPropertyName("clientName")] + public string? ClientName { get; set; } + + /// The current agent mode for this session (e.g., 'interactive', 'plan', 'autopilot'). + [JsonPropertyName("currentMode")] + public MetadataSnapshotCurrentMode CurrentMode { get; set; } + + /// User-provided name supplied at session construction (via `--name`), if any. Immutable after construction. + [JsonPropertyName("initialName")] + public string? InitialName { get; set; } + + /// Whether this is a remote session (i.e., one whose runtime executes elsewhere and is steered through this process). + [JsonPropertyName("isRemote")] + public bool IsRemote { get; set; } + + /// ISO 8601 timestamp of when the session's persisted state was last modified on disk. For new sessions, equals startTime. For resumed sessions, reflects the previous modification time at construction. + [JsonPropertyName("modifiedTime")] + public DateTimeOffset ModifiedTime { get; set; } + + /// Remote-session-specific metadata. Populated only when `isRemote` is true. Fields are immutable for the lifetime of the session. + [JsonPropertyName("remoteMetadata")] + public MetadataSnapshotRemoteMetadata? RemoteMetadata { get; set; } + + /// Currently selected model identifier, if any. + [JsonPropertyName("selectedModel")] + public string? SelectedModel { get; set; } + + /// The unique identifier of the session. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; + + /// Current session limits, or null when no limits are active. + [JsonPropertyName("sessionLimits")] + public SessionLimitsConfig? SessionLimits { get; set; } + + /// ISO 8601 timestamp of when the session started. + [JsonPropertyName("startTime")] + public DateTimeOffset StartTime { get; set; } + + /// Short human-readable summary of the session, if known. Omitted when no summary has been generated. [JsonPropertyName("summary")] - public string Summary { get; set; } = string.Empty; + public string? Summary { get; set; } + + /// Absolute path to the session's current working directory. + [JsonPropertyName("workingDirectory")] + public string WorkingDirectory { get; set; } = string.Empty; + + /// Public-facing workspace metadata for this session, or null if the session has no associated workspace. Excludes runtime-internal fields (GitHub IDs, summary count, internal flags). + [JsonPropertyName("workspace")] + public SessionMetadataSnapshotWorkspace? Workspace { get; set; } + + /// Absolute path to the session's workspace directory on disk, or null if the session has no associated workspace. + [JsonPropertyName("workspacePath")] + public string? WorkspacePath { get; set; } } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] -internal sealed class SessionHistorySummarizeForHandoffRequest +internal sealed class SessionMetadataSnapshotRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } -/// What a successful clear removed. A clear that could not be applied rejects instead of reporting a count. +/// Indicates whether the local session is currently processing a turn or background continuation. [Experimental(Diagnostics.Experimental)] -public sealed class HistoryClearContextResult +public sealed class MetadataIsProcessingResult { - /// Number of non-system, non-developer messages that were removed from the conversation. Zero only when the window already held no conversation. - [JsonPropertyName("messagesCleared")] - public long MessagesCleared { get; set; } + /// Whether the session is currently processing user/agent messages. False for non-local sessions (which don't run a local agentic loop). Reflects an in-flight turn or background continuation. + [JsonPropertyName("processing")] + public bool Processing { get; set; } } -/// Parameters for clearing the conversation and seeding the window that replaces it. +/// Identifies the target session. [Experimental(Diagnostics.Experimental)] -internal sealed class HistoryClearContextRequest +internal sealed class SessionMetadataIsProcessingRequest { - /// First user message of the fresh context window. Required: a cleared window holding only system and developer messages is not a conversation a model can answer, so every clear seeds the window it creates. Delivered by the enclosing turn driver once the agentic loop exits, which is why the call must be made from inside a tool handler. - [JsonPropertyName("prompt")] - public string Prompt { get; set; } = string.Empty; - /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } -/// User-facing pending queue entry, with kind and display text for a queued message, slash command, or model change. +/// Current activity flags for the session. [Experimental(Diagnostics.Experimental)] -public sealed class QueuePendingItems +public sealed class SessionActivity { - /// Agent mode stored on this queued entry, as stamped when it was enqueued. Items without an explicit mode report interactive. This is not necessarily the mode that will constrain the turn: a plan or autopilot session applies its own write gate, continuation loop and permission posture to every drained item regardless of the mode stored here. - [JsonPropertyName("agentMode")] - public SendAgentMode AgentMode { get; set; } - - /// Human-readable text to display for this queue entry in the UI. - [JsonPropertyName("displayText")] - public string DisplayText { get; set; } = string.Empty; - - /// Stable opaque id for the canonical queued item. Batch rows share one id. - [JsonPropertyName("id")] - public string Id { get; set; } = string.Empty; - - /// Whether this item is a queued user message or a queued slash command / model change. - [JsonPropertyName("kind")] - public QueuePendingItemsKind Kind { get; set; } -} - -/// Snapshot of the session's pending queued items and immediate-steering messages. -[Experimental(Diagnostics.Experimental)] -public sealed class QueuePendingItemsResult -{ - /// Pending queued items in submission order. Includes user messages, queued slash commands, and queued model changes; omits internal system items. - [JsonPropertyName("items")] - public IList Items { get => field ??= []; set; } + /// Whether an in-flight operation can currently be aborted. + [JsonPropertyName("abortable")] + public bool Abortable { get; set; } - /// Display text for messages currently in the immediate steering queue (interjections sent during a running turn). - [JsonPropertyName("steeringMessages")] - public IList SteeringMessages { get => field ??= []; set; } + /// Whether the session currently has active work, including running turns or tasks. + [JsonPropertyName("hasActiveWork")] + public bool HasActiveWork { get; set; } } /// Identifies the target session. [Experimental(Diagnostics.Experimental)] -internal sealed class SessionQueuePendingItemsRequest +internal sealed class SessionMetadataActivityRequest { /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } -/// Internal snapshot of native queue state for local session orchestration. -[Experimental(Diagnostics.Experimental)] -internal sealed class QueueSnapshotResult +/// Token-usage breakdown for the session's current context window. +public sealed class MetadataContextInfoResultContextInfo { - /// Insertion orders for queued items, aligned with `items`. - [JsonPropertyName("itemOrders")] - public IList? ItemOrders { get; set; } + /// Output reserve plus tokens after the buffer-exhaustion blocking threshold (default 95%). + [JsonPropertyName("bufferTokens")] + public long BufferTokens { get; set; } - /// User-facing pending items in FIFO order. - [JsonPropertyName("items")] - public IList Items { get => field ??= []; set; } + /// Token count at which background compaction starts (configurable percentage of promptTokenLimit). + [JsonPropertyName("compactionThreshold")] + public long CompactionThreshold { get; set; } - /// Insertion orders for immediate steering messages, aligned with `steeringMessages`. - [JsonPropertyName("steeringMessageOrders")] - public IList? SteeringMessageOrders { get; set; } + /// Tokens consumed by user/assistant/tool messages. + [JsonPropertyName("conversationTokens")] + public long ConversationTokens { get; set; } - /// Immediate steering messages waiting for an active turn. - [JsonPropertyName("steeringMessages")] - public IList SteeringMessages { get => field ??= []; set; } -} + /// Prompt token limit plus the model's full output token limit. + [JsonPropertyName("limit")] + public long Limit { get; set; } -/// Identifies the target session. -[Experimental(Diagnostics.Experimental)] -internal sealed class SessionQueueSnapshotRequest -{ - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; -} + /// Tokens consumed by MCP tool definitions (subset of toolDefinitionsTokens, excludes deferred tools). + [JsonPropertyName("mcpToolsTokens")] + public long McpToolsTokens { get; set; } -/// Result of moving a queued item. -[Experimental(Diagnostics.Experimental)] -public sealed class QueueMoveItemResult -{ - /// True when the item changed position; false when it was already at the requested position. - [JsonPropertyName("changed")] - public bool Changed { get; set; } -} + /// The model used for token counting. + [JsonPropertyName("modelName")] + public string ModelName { get; set; } = string.Empty; -/// Parameters for moving a queued item by stable id. -[Experimental(Diagnostics.Experimental)] -internal sealed class QueueMoveItemRequest -{ - /// Stable opaque queued-item id. - [JsonPropertyName("id")] - public string Id { get; set; } = string.Empty; + /// Maximum prompt tokens allowed by the model (or DEFAULT_TOKEN_LIMIT if unspecified). + [JsonPropertyName("promptTokenLimit")] + public long PromptTokenLimit { get; set; } - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// Tokens consumed by the system prompt. + [JsonPropertyName("systemTokens")] + public long SystemTokens { get; set; } - /// Zero-based target position in the public visible queue. Values outside the queue clamp to an end. - [JsonPropertyName("toPosition")] - public long ToPosition { get; set; } + /// Tokens consumed by tool definitions sent to the model (excludes deferred tools). + [JsonPropertyName("toolDefinitionsTokens")] + public long ToolDefinitionsTokens { get; set; } + + /// Sum of system, conversation and tool-definition tokens. + [JsonPropertyName("totalTokens")] + public long TotalTokens { get; set; } } -/// Result of inserting a queued message. +/// Token breakdown for the session's current context window, or null if uninitialized. [Experimental(Diagnostics.Experimental)] -public sealed class QueueInsertAtResult +public sealed class MetadataContextInfoResult { - /// Fresh stable opaque id assigned to the inserted item. - [JsonPropertyName("id")] - public string Id { get; set; } = string.Empty; + /// Token breakdown for the current context window, or null if the session has not yet been initialized (no system prompt or tool metadata cached). + [JsonPropertyName("contextInfo")] + public MetadataContextInfoResultContextInfo? ContextInfo { get; set; } } -/// Serializable message fields accepted by queue.insertAt. +/// Model identifier and token limits used to compute the context-info breakdown. [Experimental(Diagnostics.Experimental)] -public sealed class QueueInsertMessage +internal sealed class MetadataContextInfoRequest { - /// Optional explicit agent mode. When omitted, the session's current mode is assigned. - [JsonPropertyName("agentMode")] - public SendAgentMode? AgentMode { get; set; } - - /// Optional attachments for the message. - [JsonPropertyName("attachments")] - public IList? Attachments { get; set; } + /// Maximum output tokens allowed by the target model. Pass 0 if unknown. + [JsonPropertyName("outputTokenLimit")] + public long OutputTokenLimit { get; set; } - /// Whether the message is billable. - [JsonPropertyName("billable")] - public bool? Billable { get; set; } + /// Maximum prompt tokens allowed by the target model. Pass 0 to use the runtime default. + [JsonPropertyName("promptTokenLimit")] + public long PromptTokenLimit { get; set; } - /// Accepted for internal SendOptions compatibility but ignored; delivery is derived from current session activity. - [JsonPropertyName("delivery")] - public string? Delivery { get; set; } + /// Model identifier used for tokenization. Omit to use the session default. Used both for token counting and to compute display values. + [JsonPropertyName("selectedModel")] + public string? SelectedModel { get; set; } - /// Optional user-facing display text. - [JsonPropertyName("displayPrompt")] - public string? DisplayPrompt { get; set; } + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} - /// Accepted for SendOptions compatibility but ignored; inserted items always use queued delivery semantics. - [JsonPropertyName("mode")] - public SendMode? Mode { get; set; } +/// The six normalized `/context` header buckets, computed from the same tokenization as `entries` so the two never disagree. Convenience rollups: `freeSpace` and `buffer` describe window capacity rather than occupied context, so the values do not sum to `totalTokens`. +public sealed class MetadataContextAttributionResultContextAttributionCategories +{ + /// Output reserve plus post-blocking-threshold buffer. + [JsonPropertyName("buffer")] + public long Buffer { get; set; } - /// Accepted for SendOptions compatibility but ignored; the requested public position controls placement. - [JsonPropertyName("prepend")] - public bool? Prepend { get; set; } + /// Custom-instructions tokens (0 when none are configured). + [JsonPropertyName("customInstructions")] + public long CustomInstructions { get; set; } - /// The user message text. - [JsonPropertyName("prompt")] - public string Prompt { get; set; } = string.Empty; + /// Remaining unused window capacity (clamped at 0). + [JsonPropertyName("freeSpace")] + public long FreeSpace { get; set; } - /// Per-turn request headers. - [JsonPropertyName("requestHeaders")] - public IDictionary? RequestHeaders { get; set; } + /// MCP tool-definition tokens. + [JsonPropertyName("mcpTools")] + public long McpTools { get; set; } - /// Required tool name for the turn, when any. - [JsonPropertyName("requiredTool")] - public string? RequiredTool { get; set; } + /// Conversation (user/assistant/tool) message tokens. + [JsonPropertyName("messages")] + public long Messages { get; set; } - /// Optional provenance source. `system` is rejected: it would hide the inserted row from `pendingItems` and make it unaddressable while still executing, so inserted items must stay visible. - [JsonPropertyName("source")] - public string? Source { get; set; } + /// System prompt tokens, excluding custom instructions. + [JsonPropertyName("systemPrompt")] + public long SystemPrompt { get; set; } - /// Accepted for SendOptions compatibility but ignored; insertion scheduling is controlled by the queue drain state. - [JsonPropertyName("wait")] - public bool? Wait { get; set; } + /// Non-MCP tool-definition tokens. + [JsonPropertyName("systemTools")] + public long SystemTools { get; set; } } -/// Parameters for inserting a queued message at a public visible position. -[Experimental(Diagnostics.Experimental)] -internal sealed class QueueInsertAtRequest +/// Successful compaction history for the session. +public sealed class MetadataContextAttributionResultContextAttributionCompactions { - /// Queued message contents and delivery metadata. - [JsonPropertyName("message")] - public QueueInsertMessage Message { get => field ??= new(); set; } - - /// Zero-based position in the public visible queue. Values outside the queue clamp to an end. - [JsonPropertyName("position")] - public long Position { get; set; } - - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// Number of successful compactions in this session. + [JsonPropertyName("count")] + public long Count { get; set; } } -/// Result of removing a queued item. -[Experimental(Diagnostics.Experimental)] -public sealed class QueueRemoveAtResult +/// RPC data type for MetadataContextAttributionResultContextAttributionEntry operations. +public sealed class MetadataContextAttributionResultContextAttributionEntry { - /// True when the addressed item was removed. - [JsonPropertyName("removed")] - public bool Removed { get; set; } -} + /// Supplementary per-entry metadata (e.g. `messageCount`, `role`, `evictable`, `pluginSource`). Values are stringified; parse as needed and ignore unrecognized keys. + [JsonPropertyName("attributes")] + public IDictionary? Attributes { get; set; } -/// Parameters for removing a queued item by stable id. -[Experimental(Diagnostics.Experimental)] -internal sealed class QueueRemoveAtRequest -{ - /// Stable opaque ID of the queued item to remove. + /// Identifier for this entry, formed by joining its `kind` and source name (e.g. `tool:bash`, `skill:tmux`, `toolDefinition:bash`); unique within the snapshot. Use it to match the same entry across snapshots, to correlate with other APIs (skill/agent/MCP registries), and as the `parentId` target for nesting. Distinct from the human-facing `label`. [JsonPropertyName("id")] public string Id { get; set; } = string.Empty; - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// Source category for this entry. Not a closed set — tolerate unknown values. Known values today: `skill`, `subagent`, `mcpServer`, `tool`, `system`, `toolDefinition`, `plugin`. + [JsonPropertyName("kind")] + public string Kind { get; set; } = string.Empty; + + /// Human-readable display label, e.g. `bash` or `skill: tmux`. Presentation-only; may be localized/reformatted without notice — do not key off it. + [JsonPropertyName("label")] + public string Label { get; set; } = string.Empty; + + /// Optional `id` of the parent entry: e.g. a `plugin` entry parenting its `skill`/`mcpServer` entries, or the `system` entry parenting `toolDefinition` entries. Omitted for top-level entries. + [JsonPropertyName("parentId")] + public string? ParentId { get; set; } + + /// Token count currently in context attributable to this entry. + [JsonPropertyName("tokens")] + public long Tokens { get; set; } } -/// Result of editing a queued message. -[Experimental(Diagnostics.Experimental)] -public sealed class QueueUpdateTextResult +/// Per-source token attribution snapshot for the current context window. The heaviest individual messages are available separately via `metadata.getContextHeaviestMessages`. +public sealed class MetadataContextAttributionResultContextAttribution { - /// True when the stored text changed. - [JsonPropertyName("updated")] - public bool Updated { get; set; } + /// Output reserve plus the tokens past the buffer-exhaustion blocking threshold. Mirrors `SessionContextInfo.bufferTokens`. + [JsonPropertyName("bufferTokens")] + public long BufferTokens { get; set; } + + /// The six normalized `/context` header buckets, computed from the same tokenization as `entries` so the two never disagree. Convenience rollups: `freeSpace` and `buffer` describe window capacity rather than occupied context, so the values do not sum to `totalTokens`. + [JsonPropertyName("categories")] + public MetadataContextAttributionResultContextAttributionCategories Categories { get => field ??= new(); set; } + + /// Successful compaction history for the session. + [JsonPropertyName("compactions")] + public MetadataContextAttributionResultContextAttributionCompactions Compactions { get => field ??= new(); set; } + + /// Token count at which background compaction starts. Mirrors `SessionContextInfo.compactionThreshold`. + [JsonPropertyName("compactionThreshold")] + public long CompactionThreshold { get; set; } + + /// Flat list of per-source attribution entries. Group by `kind` and render unrecognized kinds generically. Nesting and rollups are expressed via `parentId`. + [JsonPropertyName("entries")] + public IList Entries { get => field ??= []; set; } + + /// Prompt limit plus the model's output reserve: the full context window `categories.freeSpace` and `categories.buffer` are measured against. Mirrors `SessionContextInfo.limit`. + [JsonPropertyName("limit")] + public long Limit { get; set; } + + /// The concrete model id the entire breakdown was tokenized against (feeds the per-model token multiplier). Under `Auto` (Free/Student) this is the resolved model, not the literal `auto` sentinel, so totals are not undercounted. A single-model approximation of a potentially multi-model Auto session. + [JsonPropertyName("modelId")] + public string ModelId { get; set; } = string.Empty; + + /// How `modelId` was chosen. Not a closed set — tolerate unknown values. Known values today: `autoResolved` (the model Auto resolved to), `selected` (the user's explicitly selected model), `default` (a fallback before any model is known). + [JsonPropertyName("modelSource")] + public string ModelSource { get; set; } = string.Empty; + + /// Maximum prompt tokens the resolved model accepts — the denominator for a `##k/###k` context-usage display. Mirrors `SessionContextInfo.promptTokenLimit`. + [JsonPropertyName("promptTokenLimit")] + public long PromptTokenLimit { get; set; } + + /// Total token count of the current context window the entries are measured against (system message + conversation messages + tool definitions — the same total reported by /context). Divide an entry's `tokens` by this to derive its share. + [JsonPropertyName("totalTokens")] + public long TotalTokens { get; set; } } -/// Parameters for editing a single queued message. +/// Per-source attribution breakdown for the session's current context window, or null if uninitialized. [Experimental(Diagnostics.Experimental)] -internal sealed class QueueUpdateTextRequest +public sealed class MetadataContextAttributionResult { - /// Optional replacement prompt displayed to the user. - [JsonPropertyName("displayPrompt")] - public string? DisplayPrompt { get; set; } - - /// Stable opaque ID of the queued item to edit. - [JsonPropertyName("id")] - public string Id { get; set; } = string.Empty; - - /// Replacement prompt sent to the model. - [JsonPropertyName("prompt")] - public string Prompt { get; set; } = string.Empty; + /// Per-source context-window attribution, or null if the session has not yet been initialized (no system prompt or tool metadata cached). + [JsonPropertyName("contextAttribution")] + public MetadataContextAttributionResultContextAttribution? ContextAttribution { get; set; } +} +/// Identifies the target session. +[Experimental(Diagnostics.Experimental)] +internal sealed class SessionMetadataGetContextAttributionRequest +{ /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } -/// Result of duplicating a queued item. +/// A single large message currently in context. [Experimental(Diagnostics.Experimental)] -public sealed class QueueDuplicateAtResult +public sealed class ContextHeaviestMessage { - /// Fresh stable opaque id assigned to the duplicate. + /// Stable identifier for this message within the snapshot. [JsonPropertyName("id")] public string Id { get; set; } = string.Empty; + + /// Human-readable source label, e.g. `tool: bash` or `skill: tmux`. Presentation-only. + [JsonPropertyName("label")] + public string Label { get; set; } = string.Empty; + + /// Role of the chat message (`user`, `assistant`, or `tool`). + [JsonPropertyName("role")] + public string Role { get; set; } = string.Empty; + + /// Token count currently in context for this individual message. + [JsonPropertyName("tokens")] + public long Tokens { get; set; } } -/// Parameters for duplicating a queued item. +/// The heaviest individual messages in the session's context window, most-expensive first. [Experimental(Diagnostics.Experimental)] -internal sealed class QueueDuplicateAtRequest +public sealed class MetadataContextHeaviestMessagesResult { - /// Stable opaque ID of the queued item to duplicate. - [JsonPropertyName("id")] - public string Id { get; set; } = string.Empty; + /// Heaviest messages, most-expensive first. + [JsonPropertyName("messages")] + public IList Messages { get => field ??= []; set; } - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// Total token count of the current context window, so callers can compute each message's share without a second call. + [JsonPropertyName("totalTokens")] + public long TotalTokens { get; set; } } -/// Parameters for acquiring or releasing the queued-lane drain pause. Acquisition is exclusive and non-idempotent: `paused: true` against an already-paused session fails with `queue_already_paused`. The pause is never released automatically — it is not tied to the caller's lifetime, so a client that exits without sending `paused: false` leaves the lane frozen. Release is unowned: `paused: false` clears the pause for any caller, including one that never acquired it. +/// Parameters for the heaviest-messages query. [Experimental(Diagnostics.Experimental)] -internal sealed class QueueSetDrainPausedRequest +internal sealed class MetadataContextHeaviestMessagesRequest { - /// Whether queued-lane draining should be paused. - [JsonPropertyName("paused")] - public bool Paused { get; set; } + /// Maximum number of messages to return, most-expensive first. Omit for the server default. + [JsonPropertyName("limit")] + public long? Limit { get; set; } /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } -/// Result of trying to steer a queued message into a live turn. +/// Notify the session that its working directory context has changed. Emits a `session.context_changed` event so consumers (telemetry, OTel tracker, ACP, the timeline UI) can react. Use this when the host has detected a cwd/branch/repo change outside the session's normal lifecycle (e.g., after a shell command in interactive mode). For a local session, a report whose `cwd` diverges from the session's current working directory is ignored (the call still succeeds but records nothing and emits no event); move a local session's working directory via `metadata.setWorkingDirectory` instead. [Experimental(Diagnostics.Experimental)] -public sealed class QueueSendNowResult +public sealed class MetadataRecordContextChangeResult { - /// True when the item was accepted into the steering lane; false when no main turn was live. - [JsonPropertyName("steered")] - public bool Steered { get; set; } } -/// Parameters for steering a queued message into a live turn. +/// Updated working directory and git context. Emitted as the new payload of `session.context_changed`. [Experimental(Diagnostics.Experimental)] -internal sealed class QueueSendNowRequest +public sealed class SessionWorkingDirectoryContext { - /// Stable opaque ID of the queued item to steer into the live turn. - [JsonPropertyName("id")] - public string Id { get; set; } = string.Empty; + /// Merge-base commit SHA (fork point from the remote default branch). + [JsonPropertyName("baseCommit")] + public string? BaseCommit { get; set; } - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; -} + /// Current git branch name. + [JsonPropertyName("branch")] + public string? Branch { get; set; } -/// Whether the native queue has pending work. -[Experimental(Diagnostics.Experimental)] -internal sealed class QueueHasPendingResult -{ - /// True when queued or immediate native work is pending. - [JsonPropertyName("hasPending")] - public bool HasPending { get; set; } + /// Current working directory path. + [JsonPropertyName("cwd")] + public string Cwd { get; set; } = string.Empty; + + /// Root directory of the git repository, resolved via git rev-parse. + [JsonPropertyName("gitRoot")] + public string? GitRoot { get; set; } + + /// Head commit of the current git branch. + [JsonPropertyName("headCommit")] + public string? HeadCommit { get; set; } + + /// Hosting platform type of the repository. + [JsonPropertyName("hostType")] + public SessionWorkingDirectoryContextHostType? HostType { get; set; } + + /// Repository identifier derived from the git remote URL ("owner/name" for GitHub, "org/project/repo" for Azure DevOps). + [JsonPropertyName("repository")] + public string? Repository { get; set; } + + /// Raw host string from the git remote URL (e.g. "github.com", "dev.azure.com"). + [JsonPropertyName("repositoryHost")] + public string? RepositoryHost { get; set; } } -/// Identifies the target session. +/// Updated working-directory/git context to record on the session. [Experimental(Diagnostics.Experimental)] -internal sealed class SessionQueueHasPendingRequest +internal sealed class MetadataRecordContextChangeRequest { + /// Updated working directory and git context. Emitted as the new payload of `session.context_changed`. + [JsonPropertyName("context")] + public SessionWorkingDirectoryContext Context { get => field ??= new(); set; } + /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } -/// Whether a deferred-idle drain should run. +/// Update the session's working directory. Used by the host when the user explicitly changes cwd (e.g., the `/cd` slash command). The host is responsible for any related side-effects (file index, etc.); it does NOT change the process working directory (a session's cwd is per-session, not process-global). For local sessions the runtime validates the target first (an absolute path that exists on disk) and re-bases the permission primary directory; a rejected validation fails the call before anything is mutated, persisted, or emitted. Location-scoped permission rules are then re-keyed to the new directory (best-effort). Remote sessions only record the path. [Experimental(Diagnostics.Experimental)] -internal sealed class QueueBeginDeferredIdleDrainResult +public sealed class MetadataSetWorkingDirectoryResult { - /// True when the host should run finishDeferredIdleDrain asynchronously. - [JsonPropertyName("shouldDrain")] - public bool ShouldDrain { get; set; } + /// Working directory after the update. + [JsonPropertyName("workingDirectory")] + public string WorkingDirectory { get; set; } = string.Empty; } -/// Inputs for starting a deferred-idle drain. +/// Absolute path to set as the session's new working directory. For local sessions the path must be absolute and exist on disk: it is validated before any session state changes, and a failing validation rejects the call with nothing mutated, persisted, or emitted. Remote sessions record the path as-is. [Experimental(Diagnostics.Experimental)] -internal sealed class QueueBeginDeferredIdleDrainRequest +internal sealed class MetadataSetWorkingDirectoryRequest { - /// Whether the host still has active background work. - [JsonPropertyName("activeBackgroundWork")] - public bool ActiveBackgroundWork { get; set; } - /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; -} - -/// Action selected by the native deferred-idle drain. -[Experimental(Diagnostics.Experimental)] -internal sealed class QueueFinishDeferredIdleDrainResult -{ - /// Whether the deferred idle was caused by an aborted foreground turn. - [JsonPropertyName("aborted")] - public bool Aborted { get; set; } - /// One of none, processQueue, or emitSessionIdle. - [JsonPropertyName("action")] - public string Action { get; set; } = string.Empty; + /// Absolute path to set as the session's working directory. The runtime updates the session's recorded cwd so subsequent operations (shell tools, file lookups, telemetry) anchor to it. + [JsonPropertyName("workingDirectory")] + public string WorkingDirectory { get; set; } = string.Empty; } -/// Inputs for completing a deferred-idle drain. +/// Re-tokenize the session's existing messages against `modelId` and return the token totals. Useful for hosts that want an initial estimate of context usage on session resume, before the next agent turn fires `session.context_info_changed` events. Returns zeros for an empty session. [Experimental(Diagnostics.Experimental)] -internal sealed class QueueFinishDeferredIdleDrainRequest +public sealed class MetadataRecomputeContextTokensResult { - /// Whether the host still has active background work. - [JsonPropertyName("activeBackgroundWork")] - public bool ActiveBackgroundWork { get; set; } + /// Tokens contributed by user/assistant/tool messages (excludes system/developer prompts). + [JsonPropertyName("messagesTokenCount")] + public long MessagesTokenCount { get; set; } - /// Whether native queued work remains. - [JsonPropertyName("hasPending")] - public bool HasPending { get; set; } + /// Tokens contributed by system/developer prompt snapshots. + [JsonPropertyName("systemTokenCount")] + public long SystemTokenCount { get; set; } - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// Sum of tokens across chat-context and system-context messages currently held by the session. + [JsonPropertyName("totalTokens")] + public long TotalTokens { get; set; } } -/// Inputs for marking session.idle deferred in native state. +/// Model identifier to use when re-tokenizing the session's existing messages. [Experimental(Diagnostics.Experimental)] -internal sealed class QueueDeferSessionIdleRequest +internal sealed class MetadataRecomputeContextTokensRequest { - /// Whether the deferred idle was caused by an aborted foreground turn. - [JsonPropertyName("aborted")] - public bool Aborted { get; set; } + /// Model identifier used for tokenization. The runtime token-counts both chat-context and system-context messages against this model. + [JsonPropertyName("modelId")] + public string ModelId { get; set; } = string.Empty; /// Target session identifier. [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } -/// Indicates whether a user-facing pending item was removed. +/// Availability of built-in job tools surfaced to boundary consumers. [Experimental(Diagnostics.Experimental)] -public sealed class QueueRemoveMostRecentResult +public sealed class SessionSettingsBuiltInToolAvailabilitySnapshot { - /// True if a user-facing pending item was removed (LIFO across both queues); false when no removable items remained. - [JsonPropertyName("removed")] - public bool Removed { get; set; } + /// Whether the create-pull-request tool is available. + [JsonPropertyName("createPullRequest")] + public bool? CreatePullRequest { get; set; } + + /// Whether the report-progress tool is available. + [JsonPropertyName("reportProgress")] + public bool? ReportProgress { get; set; } } -/// Identifies the target session. +/// Redacted job settings for a session. The job nonce is excluded. [Experimental(Diagnostics.Experimental)] -internal sealed class SessionQueueRemoveMostRecentRequest +public sealed class SessionSettingsJobSnapshot { - /// Target session identifier. - [JsonPropertyName("sessionId")] + /// Availability of job-specific built-in tools. + [JsonPropertyName("builtInToolAvailability")] + public SessionSettingsBuiltInToolAvailabilitySnapshot? BuiltInToolAvailability { get; set; } + + /// GitHub Actions event type for the job. + [JsonPropertyName("eventType")] + public string? EventType { get; set; } + + /// Whether this is the workflow's trigger job. + [JsonPropertyName("isTriggerJob")] + public bool? IsTriggerJob { get; set; } +} + +/// Redacted model routing settings for a session. +[Experimental(Diagnostics.Experimental)] +public sealed class SessionSettingsModelSnapshot +{ + /// Agent service callback URL for job and progress updates. + [JsonPropertyName("callbackUrl")] + public string? CallbackUrl { get; set; } + + /// Default reasoning effort for the selected model. + [JsonPropertyName("defaultReasoningEffort")] + public string? DefaultReasoningEffort { get; set; } + + /// Agent job identifier for the session. + [JsonPropertyName("instanceId")] + public string? InstanceId { get; set; } + + /// Selected model identifier. + [JsonPropertyName("model")] + public string? Model { get; set; } +} + +/// Online-evaluation settings safe to expose across the SDK boundary. +[Experimental(Diagnostics.Experimental)] +public sealed class SessionSettingsOnlineEvaluationSnapshot +{ + /// Whether online evaluation is disabled. + [JsonPropertyName("disableOnlineEvaluation")] + public bool? DisableOnlineEvaluation { get; set; } + + /// Whether online-evaluation output-file generation is enabled. + [JsonPropertyName("enableOnlineEvaluationOutputFile")] + public bool? EnableOnlineEvaluationOutputFile { get; set; } +} + +/// Redacted repository and GitHub host settings for a session. +[Experimental(Diagnostics.Experimental)] +public sealed class SessionSettingsRepoSnapshot +{ + /// Checked-out repository branch. + [JsonPropertyName("branch")] + public string? Branch { get; set; } + + /// Checked-out commit SHA. + [JsonPropertyName("commit")] + public string? Commit { get; set; } + + /// GitHub server host name. + [JsonPropertyName("host")] + public string? Host { get; set; } + + /// Protocol used to access the GitHub host. + [JsonPropertyName("hostProtocol")] + public string? HostProtocol { get; set; } + + /// GitHub repository database ID. + [JsonPropertyName("id")] + public double? Id { get; set; } + + /// Repository name. + [JsonPropertyName("name")] + public string? Name { get; set; } + + /// GitHub repository owner database ID. + [JsonPropertyName("ownerId")] + public double? OwnerId { get; set; } + + /// Repository owner login. + [JsonPropertyName("ownerName")] + public string? OwnerName { get; set; } + + /// Number of commits in the pull request. + [JsonPropertyName("prCommitCount")] + public double? PrCommitCount { get; set; } + + /// Whether the repository is writable. + [JsonPropertyName("readWrite")] + public bool? ReadWrite { get; set; } + + /// GitHub secret-scanning service URL. + [JsonPropertyName("secretScanningUrl")] + public string? SecretScanningUrl { get; set; } + + /// GitHub server base URL. + [JsonPropertyName("serverUrl")] + public string? ServerUrl { get; set; } +} + +/// Redacted validation and memory-tool settings for a session. +[Experimental(Diagnostics.Experimental)] +public sealed class SessionSettingsValidationSnapshot +{ + /// Whether advisory validation is enabled. + [JsonPropertyName("advisoryEnabled")] + public bool? AdvisoryEnabled { get; set; } + + /// Whether CodeQL validation is enabled. + [JsonPropertyName("codeqlEnabled")] + public bool? CodeqlEnabled { get; set; } + + /// Whether code-review validation is enabled. + [JsonPropertyName("codeReviewEnabled")] + public bool? CodeReviewEnabled { get; set; } + + /// Model used for code-review validation. + [JsonPropertyName("codeReviewModel")] + public string? CodeReviewModel { get; set; } + + /// Dependabot validation timeout budget in seconds. + [JsonPropertyName("dependabotTimeout")] + public double? DependabotTimeout { get; set; } + + /// Whether the memory-store tool is enabled. + [JsonPropertyName("memoryStoreEnabled")] + public bool? MemoryStoreEnabled { get; set; } + + /// Whether the memory-vote tool is enabled. + [JsonPropertyName("memoryVoteEnabled")] + public bool? MemoryVoteEnabled { get; set; } + + /// Whether secret-scanning validation is enabled. + [JsonPropertyName("secretScanningEnabled")] + public bool? SecretScanningEnabled { get; set; } + + /// General validation timeout budget in seconds. + [JsonPropertyName("timeout")] + public double? Timeout { get; set; } +} + +/// Redacted, serializable view of session runtime settings for SDK boundary consumers. Secrets and raw feature flags are intentionally excluded. +[Experimental(Diagnostics.Experimental)] +internal sealed class SessionSettingsSnapshot +{ + /// Name of the SDK client that created the session. + [JsonPropertyName("clientName")] + public string? ClientName { get; set; } + + /// Redacted job settings. + [JsonPropertyName("job")] + public SessionSettingsJobSnapshot Job { get => field ??= new(); set; } + + /// Redacted model routing settings. + [JsonPropertyName("model")] + public SessionSettingsModelSnapshot Model { get => field ??= new(); set; } + + /// Online-evaluation settings safe for SDK consumers. + [JsonPropertyName("onlineEvaluation")] + public SessionSettingsOnlineEvaluationSnapshot OnlineEvaluation { get => field ??= new(); set; } + + /// Redacted repository and host settings. + [JsonPropertyName("repo")] + public SessionSettingsRepoSnapshot Repo { get => field ??= new(); set; } + + /// Session start time as Unix epoch milliseconds. + [JsonPropertyName("startTimeMs")] + public double? StartTimeMs { get; set; } + + /// Session timeout in milliseconds. + [JsonPropertyName("timeoutMs")] + public double? TimeoutMs { get; set; } + + /// Redacted validation and memory-tool settings. + [JsonPropertyName("validation")] + public SessionSettingsValidationSnapshot Validation { get => field ??= new(); set; } + + /// Agent runtime version selector copied from the session settings, such as `latest` or a runtime release identifier. + [JsonPropertyName("version")] + public string? Version { get; set; } +} + +/// Identifies the target session. +[Experimental(Diagnostics.Experimental)] +internal sealed class SessionSettingsSnapshotRequest +{ + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// Result of evaluating a Rust-owned settings predicate. +[Experimental(Diagnostics.Experimental)] +internal sealed class SessionSettingsEvaluatePredicateResult +{ + /// Whether the named settings predicate evaluated to enabled. + [JsonPropertyName("enabled")] + public bool Enabled { get; set; } +} + +/// Named Rust-owned settings predicate to evaluate for this session. +[Experimental(Diagnostics.Experimental)] +internal sealed class SessionSettingsEvaluatePredicateRequest +{ + /// Predicate name. The runtime owns the raw feature-flag names and composition logic. + [JsonPropertyName("name")] + public SessionSettingsPredicateName Name { get; set; } + + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; + + /// Tool name for tool-scoped predicates such as trivial-change handling. + [JsonPropertyName("toolName")] + public string? ToolName { get; set; } +} + +/// Content-exclusion decision for one requested path. +[Experimental(Diagnostics.Experimental)] +public sealed class ContentExclusionPathCheck +{ + /// Whether the session's complete content-exclusion policy excludes the path. + [JsonPropertyName("excluded")] + public bool Excluded { get; set; } + + /// The path supplied by the caller. + [JsonPropertyName("path")] + public string Path { get; set; } = string.Empty; +} + +/// Batch content-exclusion result. Callers must fail closed when policy evaluation is unavailable. +[Experimental(Diagnostics.Experimental)] +public sealed class ContentExclusionCheckPathsResult +{ + /// Whether the session's policy service was available for the complete batch. When false, checks is empty and callers must treat every requested path as excluded. + [JsonPropertyName("available")] + public bool Available { get; set; } + + /// Per-path decisions in request order. Empty when available is false. + [JsonPropertyName("checks")] + public IList Checks { get => field ??= []; set; } +} + +/// Local file system absolute paths within the session working directory to check against its content-exclusion policy. +[Experimental(Diagnostics.Experimental)] +internal sealed class ContentExclusionCheckPathsRequest +{ + /// Local file system absolute paths within the session working directory to check. Results are returned in the same order, including duplicates. + [JsonPropertyName("paths")] + public IList Paths { get => field ??= []; set; } + + /// Target session identifier. + [JsonPropertyName("sessionId")] public string SessionId { get; set; } = string.Empty; } -/// Identifies the target session. -[Experimental(Diagnostics.Experimental)] -internal sealed class SessionQueueClearRequest -{ - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; -} +/// Identifier of the spawned process, used to correlate streamed output and exit notifications. +[Experimental(Diagnostics.Experimental)] +public sealed class ShellExecResult +{ + /// Unique identifier for tracking streamed output. + [JsonPropertyName("processId")] + public string ProcessId { get; set; } = string.Empty; +} + +/// Shell command to run, with optional working directory and timeout in milliseconds. +[Experimental(Diagnostics.Experimental)] +internal sealed class ShellExecRequest +{ + /// Shell command to execute. + [JsonPropertyName("command")] + public string Command { get; set; } = string.Empty; + + /// Working directory (defaults to session working directory). + [JsonPropertyName("cwd")] + public string? Cwd { get; set; } + + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; + + /// Timeout in milliseconds (default: 30000). + [JsonConverter(typeof(MillisecondsTimeSpanConverter))] + [JsonPropertyName("timeout")] + public TimeSpan? Timeout { get; set; } +} + +/// Indicates whether the signal was delivered; false if the process was unknown or already exited. +[Experimental(Diagnostics.Experimental)] +public sealed class ShellKillResult +{ + /// Whether the signal was sent successfully. + [JsonPropertyName("killed")] + public bool Killed { get; set; } +} + +/// Identifier of a process previously returned by "shell.exec" and the signal to send. +[Experimental(Diagnostics.Experimental)] +internal sealed class ShellKillRequest +{ + /// Process identifier returned by shell.exec. + [JsonPropertyName("processId")] + public string ProcessId { get; set; } = string.Empty; + + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; + + /// Signal to send (default: SIGTERM). + [JsonPropertyName("signal")] + public ShellKillSignal? Signal { get; set; } +} + +/// Result of a user-requested shell command. +[Experimental(Diagnostics.Experimental)] +public sealed class UserRequestedShellCommandResult +{ + /// Error output when the execution failed. + [JsonPropertyName("error")] + public string? Error { get; set; } + + /// Process exit code, when available. + [JsonPropertyName("exitCode")] + public long? ExitCode { get; set; } + + /// Captured command output. + [JsonPropertyName("output")] + public string Output { get; set; } = string.Empty; + + /// Whether the command completed successfully. + [JsonPropertyName("success")] + public bool Success { get; set; } + + /// Tool call id emitted for the shell execution. + [JsonPropertyName("toolCallId")] + public string ToolCallId { get; set; } = string.Empty; +} + +/// User-requested shell command and cancellation handle. +[Experimental(Diagnostics.Experimental)] +internal sealed class ShellExecuteUserRequestedRequest +{ + /// Shell command to execute. + [JsonPropertyName("command")] + public string Command { get; set; } = string.Empty; + + /// Caller-provided cancellation handle for this execution. + [JsonPropertyName("requestId")] + public string RequestId { get; set; } = string.Empty; + + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// Cancellation result for a user-requested shell command. +[Experimental(Diagnostics.Experimental)] +public sealed class CancelUserRequestedShellCommandResult +{ + /// Whether an in-flight execution was found and signalled to cancel. + [JsonPropertyName("cancelled")] + public bool Cancelled { get; set; } +} + +/// User-requested shell execution cancellation handle. +[Experimental(Diagnostics.Experimental)] +internal sealed class ShellCancelUserRequestedRequest +{ + /// Request ID previously passed to executeUserRequested. + [JsonPropertyName("requestId")] + public string RequestId { get; set; } = string.Empty; + + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// Post-compaction context window usage breakdown. +[Experimental(Diagnostics.Experimental)] +public sealed class HistoryCompactContextWindow +{ + /// Token count from non-system messages (user, assistant, tool). + [JsonPropertyName("conversationTokens")] + public long? ConversationTokens { get; set; } + + /// Current total tokens in the context window (system + conversation + tool definitions). + [JsonPropertyName("currentTokens")] + public long CurrentTokens { get; set; } + + /// Current number of messages in the conversation. + [JsonPropertyName("messagesLength")] + public long MessagesLength { get; set; } + + /// Token count from system message(s). + [JsonPropertyName("systemTokens")] + public long? SystemTokens { get; set; } + + /// Maximum token count for the model's context window. + [JsonPropertyName("tokenLimit")] + public long TokenLimit { get; set; } + + /// Token count from tool definitions. + [JsonPropertyName("toolDefinitionsTokens")] + public long? ToolDefinitionsTokens { get; set; } +} + +/// Compaction outcome with the number of tokens and messages removed, summary text, and the resulting context window breakdown. +[Experimental(Diagnostics.Experimental)] +public sealed class HistoryCompactResult +{ + /// Post-compaction context window usage breakdown. + [JsonPropertyName("contextWindow")] + public HistoryCompactContextWindow? ContextWindow { get; set; } + + /// Number of messages removed during compaction. + [JsonPropertyName("messagesRemoved")] + public long MessagesRemoved { get; set; } + + /// Whether compaction completed successfully. + [JsonPropertyName("success")] + public bool Success { get; set; } + + /// Summary text produced by compaction. Omitted when compaction did not produce a summary (e.g. failure path). + [JsonPropertyName("summaryContent")] + public string? SummaryContent { get; set; } + + /// Number of tokens freed by compaction. + [JsonPropertyName("tokensRemoved")] + public long TokensRemoved { get; set; } +} + +/// RPC data type for SessionHistoryCompact operations. +[Experimental(Diagnostics.Experimental)] +public sealed class SessionHistoryCompactRequest +{ + /// Optional user-provided instructions to focus the compaction summary. + [UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "Safe for generated string properties: JSON Schema minLength/maxLength map to string length validation, not reflection over trimmed Count members")] + [MaxLength(4000)] + [JsonPropertyName("customInstructions")] + public string? CustomInstructions { get; set; } + + /// Context window token limit this compaction is targeting, recorded as the `tokenLimit` on the persisted `session.compaction_start` / `session.compaction_complete` events. Set it when the compaction targets a window other than the compacting model's own, e.g. switching to a model with a smaller context window: the compaction still runs on the current model, so the limit that motivated it would otherwise be lost. When absent, the events record the compacting model's own resolved limit. Attribution metadata only - it does not change how much the compaction removes. + [JsonPropertyName("tokenLimit")] + public long? TokenLimit { get; set; } + + /// What initiated this compaction request, recorded as the `trigger` on the persisted `session.compaction_start` / `session.compaction_complete` events. When absent, the compaction is persisted without trigger attribution (initiator unknown). + [JsonPropertyName("trigger")] + public SessionHistoryCompactRequestTrigger? Trigger { get; set; } +} + +/// RPC data type for SessionHistoryCompactRequestWithSession operations. +[Experimental(Diagnostics.Experimental)] +internal sealed class SessionHistoryCompactRequestWithSession +{ + /// Optional user-provided instructions to focus the compaction summary. + [UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "Safe for generated string properties: JSON Schema minLength/maxLength map to string length validation, not reflection over trimmed Count members")] + [MaxLength(4000)] + [JsonPropertyName("customInstructions")] + public string? CustomInstructions { get; set; } + + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; + + /// Context window token limit this compaction is targeting, recorded as the `tokenLimit` on the persisted `session.compaction_start` / `session.compaction_complete` events. Set it when the compaction targets a window other than the compacting model's own, e.g. switching to a model with a smaller context window: the compaction still runs on the current model, so the limit that motivated it would otherwise be lost. When absent, the events record the compacting model's own resolved limit. Attribution metadata only - it does not change how much the compaction removes. + [JsonPropertyName("tokenLimit")] + public long? TokenLimit { get; set; } + + /// What initiated this compaction request, recorded as the `trigger` on the persisted `session.compaction_start` / `session.compaction_complete` events. When absent, the compaction is persisted without trigger attribution (initiator unknown). + [JsonPropertyName("trigger")] + public SessionHistoryCompactRequestTrigger? Trigger { get; set; } +} + +/// Number of events that were removed by the truncation. +[Experimental(Diagnostics.Experimental)] +public sealed class HistoryTruncateResult +{ + /// Failure detail when checkpointCleanupFailed is true. + [JsonPropertyName("checkpointCleanupError")] + public string? CheckpointCleanupError { get; set; } + + /// True when conversation truncation succeeded but post-truncation workspace checkpoint cleanup failed. History is already truncated; callers may still prune snapshots but should report a checkpoint-cleanup rather than a truncation failure. + [JsonPropertyName("checkpointCleanupFailed")] + public bool? CheckpointCleanupFailed { get; set; } + + /// Number of events that were removed. + [JsonPropertyName("eventsRemoved")] + public long EventsRemoved { get; set; } +} + +/// Identifier of the event to truncate to; this event and all later events are removed. +[Experimental(Diagnostics.Experimental)] +internal sealed class HistoryTruncateRequest +{ + /// Event ID to truncate to. This event and all events after it are removed from the session. + [JsonPropertyName("eventId")] + public string EventId { get; set; } = string.Empty; + + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// A root user turn that the session can rewind to. +[Experimental(Diagnostics.Experimental)] +public sealed class HistoryRewindPoint +{ + /// Whether at least one file in this turn or a later turn can be restored. + [JsonPropertyName("canRestoreFiles")] + public bool CanRestoreFiles { get; set; } + + /// ID of the user.message event that begins the discarded suffix. + [JsonPropertyName("eventId")] + public string EventId { get; set; } = string.Empty; + + /// Number of unique files in this turn and all later turns that have captured changes. + [JsonPropertyName("fileCount")] + public long FileCount { get; set; } + + /// Whether this turn was an automatically injected autopilot continuation. + [JsonPropertyName("isAutopilotContinuation")] + public bool IsAutopilotContinuation { get; set; } + + /// Lines added by this turn's captured file changes. + [JsonPropertyName("linesAdded")] + public long LinesAdded { get; set; } + + /// Lines removed by this turn's captured file changes. + [JsonPropertyName("linesRemoved")] + public long LinesRemoved { get; set; } + + /// ISO timestamp of the user turn. + [JsonPropertyName("timestamp")] + public string Timestamp { get; set; } = string.Empty; + + /// Whether this turn itself captured any file changes. + [JsonPropertyName("turnChangedFiles")] + public bool TurnChangedFiles { get; set; } + + /// User-visible message text for the turn. + [JsonPropertyName("userMessage")] + public string UserMessage { get; set; } = string.Empty; +} + +/// Rewind points and file-change-tracking availability for the session. +[Experimental(Diagnostics.Experimental)] +public sealed class HistoryListRewindPointsResult +{ + /// Whether this session captured file changes from its first turn. + [JsonPropertyName("fileChangeTrackingEnabled")] + public bool FileChangeTrackingEnabled { get; set; } + + /// Root user turns in chronological order. Empty when `unavailableReason` is set. + [JsonPropertyName("points")] + public IList Points { get => field ??= []; set; } + + /// Why the listed points could not be produced, when applicable; the points list is empty whenever it is set. `unsupported-remote-session` is permanent for the session and comes with `fileChangeTrackingEnabled: false`. `session-busy` is transient and only ever reported by a session that *is* tracking (`fileChangeTrackingEnabled: true`), because the file-change captures cannot be read while work that may still mutate them is in flight; the same request succeeds once the session settles, so a client that wants points should retry rather than treat it as a failure. It is never `file-change-tracking-disabled`: an untracked local session still lists conversation-only points and reports that through `fileChangeTrackingEnabled: false`. + [JsonPropertyName("unavailableReason")] + public HistoryRewindUnavailableReason? UnavailableReason { get; set; } +} + +/// Identifies the target session. +[Experimental(Diagnostics.Experimental)] +internal sealed class SessionHistoryListRewindPointsRequest +{ + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// A file that a conversation-and-files rewind would restore. +[Experimental(Diagnostics.Experimental)] +public sealed class HistoryRewindFilePreview +{ + /// Aggregate change made across the discarded turns. + [JsonPropertyName("changeType")] + public HistoryRewindChangeType ChangeType { get; set; } + + /// Lines added across the discarded turns. + [JsonPropertyName("linesAdded")] + public long LinesAdded { get; set; } + + /// Lines removed across the discarded turns. + [JsonPropertyName("linesRemoved")] + public long LinesRemoved { get; set; } + + /// Absolute path of the captured file. + [JsonPropertyName("path")] + public string Path { get; set; } = string.Empty; +} + +/// Files and aggregate changes for a prospective rewind. +[Experimental(Diagnostics.Experimental)] +public sealed class HistoryPreviewRewindResult +{ + /// Whether file restore is available for this session. This is authoritative: switch on it and read `reason` only when it is false. + [JsonPropertyName("available")] + public bool Available { get; set; } + + /// Number of unique files in the preview. + [JsonPropertyName("fileCount")] + public long FileCount { get; set; } + + /// Files ordered by path. + [JsonPropertyName("files")] + public IList Files { get => field ??= []; set; } + + /// Why file restore is unavailable, when applicable. Populated only when `available` is false and never set when `available` is true. + [JsonPropertyName("reason")] + public HistoryRewindUnavailableReason? Reason { get; set; } +} + +/// Event boundary to preview for conversation-and-files rewind. +[Experimental(Diagnostics.Experimental)] +internal sealed class HistoryPreviewRewindRequest +{ + /// ID of the user.message event that begins the discarded suffix. + [JsonPropertyName("eventId")] + public string EventId { get; set; } = string.Empty; + + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// A captured file that rewind intentionally left unchanged. +[Experimental(Diagnostics.Experimental)] +public sealed class HistorySkippedFileRestore +{ + /// Absolute path of the skipped file. + [JsonPropertyName("path")] + public string Path { get; set; } = string.Empty; + + /// Reason the file was not restored. + [JsonPropertyName("reason")] + public HistoryFileRestoreSkipReason Reason { get; set; } +} + +/// Structured outcome of a rewind request. +[Experimental(Diagnostics.Experimental)] +public sealed class HistoryRewindResult +{ + /// Failure detail. Set only for the failure and partial-failure outcomes (`files-rolled-back`, `rollback-incomplete`, `truncation-failed`, `checkpoint-cleanup-failed`, `snapshot-prune-failed`); omitted for `success` and for the unavailable outcomes (`session-busy`, `file-change-tracking-disabled`, `unsupported-remote-session`). + [JsonPropertyName("error")] + public string? Error { get; set; } + + /// Number of persisted events removed by conversation truncation. Present only when truncation succeeded (outcomes `success`, `checkpoint-cleanup-failed`, and `snapshot-prune-failed`); omitted for every unavailable outcome (`session-busy`, `file-change-tracking-disabled`, `unsupported-remote-session`) and for `truncation-failed`, `files-rolled-back`, and `rollback-incomplete`. + [JsonPropertyName("eventsRemoved")] + public long? EventsRemoved { get; set; } + + /// Overall rewind outcome. This discriminates the result: it governs which of the remaining fields are populated, so consumers must switch on it before reading `eventsRemoved`, `restoredFiles`, `skippedFiles`, or `error`. See each field for the outcomes that populate it. + [JsonPropertyName("outcome")] + public HistoryRewindOutcome Outcome { get; set; } + + /// Absolute paths restored to their captured preimages. Always empty for conversation-only rewinds and for the unavailable outcomes (`session-busy`, `file-change-tracking-disabled`, `unsupported-remote-session`); only conversation-and-files outcomes that reached the file-restore stage populate it. + [JsonPropertyName("restoredFiles")] + public IList RestoredFiles { get => field ??= []; set; } + + /// Captured files intentionally left unchanged. Always empty for conversation-only rewinds and for the unavailable outcomes (`session-busy`, `file-change-tracking-disabled`, `unsupported-remote-session`); only conversation-and-files outcomes that reached the file-restore stage populate it. + [JsonPropertyName("skippedFiles")] + public IList SkippedFiles { get => field ??= []; set; } +} + +/// Boundary and mode for rewinding session history. +[Experimental(Diagnostics.Experimental)] +internal sealed class HistoryRewindRequest +{ + /// ID of the user.message event that begins the discarded suffix. + [JsonPropertyName("eventId")] + public string EventId { get; set; } = string.Empty; + + /// Whether to rewind only conversation history or also restore captured files. + [JsonPropertyName("mode")] + public HistoryRewindMode Mode { get; set; } + + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// Indicates whether an in-progress background compaction was cancelled. +[Experimental(Diagnostics.Experimental)] +public sealed class HistoryCancelBackgroundCompactionResult +{ + /// Whether an in-progress background compaction was cancelled. False when no compaction was running, when the session is remote, or when the underlying processor was unavailable. + [JsonPropertyName("cancelled")] + public bool Cancelled { get; set; } +} + +/// Identifies the target session. +[Experimental(Diagnostics.Experimental)] +internal sealed class SessionHistoryCancelBackgroundCompactionRequest +{ + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// Indicates whether an in-progress manual compaction was aborted. +[Experimental(Diagnostics.Experimental)] +public sealed class HistoryAbortManualCompactionResult +{ + /// Whether an in-progress manual compaction was aborted. False when no manual compaction was running, when its abort controller was already aborted, or when the session is remote. + [JsonPropertyName("aborted")] + public bool Aborted { get; set; } +} + +/// Identifies the target session. +[Experimental(Diagnostics.Experimental)] +internal sealed class SessionHistoryAbortManualCompactionRequest +{ + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// Markdown summary of the conversation context (empty when not available). +[Experimental(Diagnostics.Experimental)] +public sealed class HistorySummarizeForHandoffResult +{ + /// Markdown summary of the conversation context produced by an LLM. Empty string when there are no messages or when the session does not support local summarization. + [JsonPropertyName("summary")] + public string Summary { get; set; } = string.Empty; +} + +/// Identifies the target session. +[Experimental(Diagnostics.Experimental)] +internal sealed class SessionHistorySummarizeForHandoffRequest +{ + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// What a successful clear removed. A clear that could not be applied rejects instead of reporting a count. +[Experimental(Diagnostics.Experimental)] +public sealed class HistoryClearContextResult +{ + /// Number of non-system, non-developer messages that were removed from the conversation. Zero only when the window already held no conversation. + [JsonPropertyName("messagesCleared")] + public long MessagesCleared { get; set; } +} + +/// Parameters for clearing the conversation and seeding the window that replaces it. +[Experimental(Diagnostics.Experimental)] +internal sealed class HistoryClearContextRequest +{ + /// First user message of the fresh context window. Required: a cleared window holding only system and developer messages is not a conversation a model can answer, so every clear seeds the window it creates. Delivered by the enclosing turn driver once the agentic loop exits, which is why the call must be made from inside a tool handler. + [JsonPropertyName("prompt")] + public string Prompt { get; set; } = string.Empty; + + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// User-facing pending queue entry, with kind and display text for a queued message, slash command, or model change. +[Experimental(Diagnostics.Experimental)] +public sealed class QueuePendingItems +{ + /// Agent mode stored on this queued entry, as stamped when it was enqueued. Items without an explicit mode report interactive. This is not necessarily the mode that will constrain the turn: a plan or autopilot session applies its own write gate, continuation loop and permission posture to every drained item regardless of the mode stored here. + [JsonPropertyName("agentMode")] + public SendAgentMode AgentMode { get; set; } + + /// Human-readable text to display for this queue entry in the UI. + [JsonPropertyName("displayText")] + public string DisplayText { get; set; } = string.Empty; + + /// Stable opaque id for the canonical queued item. Batch rows share one id. + [JsonPropertyName("id")] + public string Id { get; set; } = string.Empty; + + /// Whether this item is a queued user message or a queued slash command / model change. + [JsonPropertyName("kind")] + public QueuePendingItemsKind Kind { get; set; } +} + +/// Snapshot of the session's pending queued items and immediate-steering messages. +[Experimental(Diagnostics.Experimental)] +public sealed class QueuePendingItemsResult +{ + /// Pending queued items in submission order. Includes user messages, queued slash commands, and queued model changes; omits internal system items. + [JsonPropertyName("items")] + public IList Items { get => field ??= []; set; } + + /// Display text for messages currently in the immediate steering queue (interjections sent during a running turn). + [JsonPropertyName("steeringMessages")] + public IList SteeringMessages { get => field ??= []; set; } +} + +/// Identifies the target session. +[Experimental(Diagnostics.Experimental)] +internal sealed class SessionQueuePendingItemsRequest +{ + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// Internal snapshot of native queue state for local session orchestration. +[Experimental(Diagnostics.Experimental)] +internal sealed class QueueSnapshotResult +{ + /// Insertion orders for queued items, aligned with `items`. + [JsonPropertyName("itemOrders")] + public IList? ItemOrders { get; set; } + + /// User-facing pending items in FIFO order. + [JsonPropertyName("items")] + public IList Items { get => field ??= []; set; } + + /// Insertion orders for immediate steering messages, aligned with `steeringMessages`. + [JsonPropertyName("steeringMessageOrders")] + public IList? SteeringMessageOrders { get; set; } + + /// Immediate steering messages waiting for an active turn. + [JsonPropertyName("steeringMessages")] + public IList SteeringMessages { get => field ??= []; set; } +} + +/// Identifies the target session. +[Experimental(Diagnostics.Experimental)] +internal sealed class SessionQueueSnapshotRequest +{ + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// Result of moving a queued item. +[Experimental(Diagnostics.Experimental)] +public sealed class QueueMoveItemResult +{ + /// True when the item changed position; false when it was already at the requested position. + [JsonPropertyName("changed")] + public bool Changed { get; set; } +} + +/// Parameters for moving a queued item by stable id. +[Experimental(Diagnostics.Experimental)] +internal sealed class QueueMoveItemRequest +{ + /// Stable opaque queued-item id. + [JsonPropertyName("id")] + public string Id { get; set; } = string.Empty; + + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; + + /// Zero-based target position in the public visible queue. Values outside the queue clamp to an end. + [JsonPropertyName("toPosition")] + public long ToPosition { get; set; } +} + +/// Result of inserting a queued message. +[Experimental(Diagnostics.Experimental)] +public sealed class QueueInsertAtResult +{ + /// Fresh stable opaque id assigned to the inserted item. + [JsonPropertyName("id")] + public string Id { get; set; } = string.Empty; +} + +/// Serializable message fields accepted by queue.insertAt. +[Experimental(Diagnostics.Experimental)] +public sealed class QueueInsertMessage +{ + /// Optional explicit agent mode. When omitted, the session's current mode is assigned. + [JsonPropertyName("agentMode")] + public SendAgentMode? AgentMode { get; set; } + + /// Optional attachments for the message. + [JsonPropertyName("attachments")] + public IList? Attachments { get; set; } + + /// Whether the message is billable. + [JsonPropertyName("billable")] + public bool? Billable { get; set; } + + /// Accepted for internal SendOptions compatibility but ignored; delivery is derived from current session activity. + [JsonPropertyName("delivery")] + public string? Delivery { get; set; } + + /// Optional user-facing display text. + [JsonPropertyName("displayPrompt")] + public string? DisplayPrompt { get; set; } + + /// Accepted for SendOptions compatibility but ignored; inserted items always use queued delivery semantics. + [JsonPropertyName("mode")] + public SendMode? Mode { get; set; } + + /// Accepted for SendOptions compatibility but ignored; the requested public position controls placement. + [JsonPropertyName("prepend")] + public bool? Prepend { get; set; } + + /// The user message text. + [JsonPropertyName("prompt")] + public string Prompt { get; set; } = string.Empty; + + /// Per-turn request headers. + [JsonPropertyName("requestHeaders")] + public IDictionary? RequestHeaders { get; set; } + + /// Required tool name for the turn, when any. + [JsonPropertyName("requiredTool")] + public string? RequiredTool { get; set; } + + /// Optional provenance source. `system` is rejected: it would hide the inserted row from `pendingItems` and make it unaddressable while still executing, so inserted items must stay visible. + [JsonPropertyName("source")] + public string? Source { get; set; } + + /// Accepted for SendOptions compatibility but ignored; insertion scheduling is controlled by the queue drain state. + [JsonPropertyName("wait")] + public bool? Wait { get; set; } +} + +/// Parameters for inserting a queued message at a public visible position. +[Experimental(Diagnostics.Experimental)] +internal sealed class QueueInsertAtRequest +{ + /// Queued message contents and delivery metadata. + [JsonPropertyName("message")] + public QueueInsertMessage Message { get => field ??= new(); set; } + + /// Zero-based position in the public visible queue. Values outside the queue clamp to an end. + [JsonPropertyName("position")] + public long Position { get; set; } + + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// Result of removing a queued item. +[Experimental(Diagnostics.Experimental)] +public sealed class QueueRemoveAtResult +{ + /// True when the addressed item was removed. + [JsonPropertyName("removed")] + public bool Removed { get; set; } +} + +/// Parameters for removing a queued item by stable id. +[Experimental(Diagnostics.Experimental)] +internal sealed class QueueRemoveAtRequest +{ + /// Stable opaque ID of the queued item to remove. + [JsonPropertyName("id")] + public string Id { get; set; } = string.Empty; + + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// Result of editing a queued message. +[Experimental(Diagnostics.Experimental)] +public sealed class QueueUpdateTextResult +{ + /// True when the stored text changed. + [JsonPropertyName("updated")] + public bool Updated { get; set; } +} + +/// Parameters for editing a single queued message. +[Experimental(Diagnostics.Experimental)] +internal sealed class QueueUpdateTextRequest +{ + /// Optional replacement prompt displayed to the user. + [JsonPropertyName("displayPrompt")] + public string? DisplayPrompt { get; set; } + + /// Stable opaque ID of the queued item to edit. + [JsonPropertyName("id")] + public string Id { get; set; } = string.Empty; + + /// Replacement prompt sent to the model. + [JsonPropertyName("prompt")] + public string Prompt { get; set; } = string.Empty; + + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// Result of duplicating a queued item. +[Experimental(Diagnostics.Experimental)] +public sealed class QueueDuplicateAtResult +{ + /// Fresh stable opaque id assigned to the duplicate. + [JsonPropertyName("id")] + public string Id { get; set; } = string.Empty; +} + +/// Parameters for duplicating a queued item. +[Experimental(Diagnostics.Experimental)] +internal sealed class QueueDuplicateAtRequest +{ + /// Stable opaque ID of the queued item to duplicate. + [JsonPropertyName("id")] + public string Id { get; set; } = string.Empty; + + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// Parameters for acquiring or releasing the queued-lane drain pause. Acquisition is exclusive and non-idempotent: `paused: true` against an already-paused session fails with `queue_already_paused`. The pause is never released automatically — it is not tied to the caller's lifetime, so a client that exits without sending `paused: false` leaves the lane frozen. Release is unowned: `paused: false` clears the pause for any caller, including one that never acquired it. +[Experimental(Diagnostics.Experimental)] +internal sealed class QueueSetDrainPausedRequest +{ + /// Whether queued-lane draining should be paused. + [JsonPropertyName("paused")] + public bool Paused { get; set; } + + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// Result of trying to steer a queued message into a live turn. +[Experimental(Diagnostics.Experimental)] +public sealed class QueueSendNowResult +{ + /// True when the item was accepted into the steering lane; false when no main turn was live. + [JsonPropertyName("steered")] + public bool Steered { get; set; } +} + +/// Parameters for steering a queued message into a live turn. +[Experimental(Diagnostics.Experimental)] +internal sealed class QueueSendNowRequest +{ + /// Stable opaque ID of the queued item to steer into the live turn. + [JsonPropertyName("id")] + public string Id { get; set; } = string.Empty; + + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// Whether the native queue has pending work. +[Experimental(Diagnostics.Experimental)] +internal sealed class QueueHasPendingResult +{ + /// True when queued or immediate native work is pending. + [JsonPropertyName("hasPending")] + public bool HasPending { get; set; } +} + +/// Identifies the target session. +[Experimental(Diagnostics.Experimental)] +internal sealed class SessionQueueHasPendingRequest +{ + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// Whether a deferred-idle drain should run. +[Experimental(Diagnostics.Experimental)] +internal sealed class QueueBeginDeferredIdleDrainResult +{ + /// True when the host should run finishDeferredIdleDrain asynchronously. + [JsonPropertyName("shouldDrain")] + public bool ShouldDrain { get; set; } +} + +/// Inputs for starting a deferred-idle drain. +[Experimental(Diagnostics.Experimental)] +internal sealed class QueueBeginDeferredIdleDrainRequest +{ + /// Whether the host still has active background work. + [JsonPropertyName("activeBackgroundWork")] + public bool ActiveBackgroundWork { get; set; } + + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// Action selected by the native deferred-idle drain. +[Experimental(Diagnostics.Experimental)] +internal sealed class QueueFinishDeferredIdleDrainResult +{ + /// Whether the deferred idle was caused by an aborted foreground turn. + [JsonPropertyName("aborted")] + public bool Aborted { get; set; } + + /// One of none, processQueue, or emitSessionIdle. + [JsonPropertyName("action")] + public string Action { get; set; } = string.Empty; +} + +/// Inputs for completing a deferred-idle drain. +[Experimental(Diagnostics.Experimental)] +internal sealed class QueueFinishDeferredIdleDrainRequest +{ + /// Whether the host still has active background work. + [JsonPropertyName("activeBackgroundWork")] + public bool ActiveBackgroundWork { get; set; } + + /// Whether native queued work remains. + [JsonPropertyName("hasPending")] + public bool HasPending { get; set; } + + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// Inputs for marking session.idle deferred in native state. +[Experimental(Diagnostics.Experimental)] +internal sealed class QueueDeferSessionIdleRequest +{ + /// Whether the deferred idle was caused by an aborted foreground turn. + [JsonPropertyName("aborted")] + public bool Aborted { get; set; } + + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// Indicates whether a user-facing pending item was removed. +[Experimental(Diagnostics.Experimental)] +public sealed class QueueRemoveMostRecentResult +{ + /// True if a user-facing pending item was removed (LIFO across both queues); false when no removable items remained. + [JsonPropertyName("removed")] + public bool Removed { get; set; } +} + +/// Identifies the target session. +[Experimental(Diagnostics.Experimental)] +internal sealed class SessionQueueRemoveMostRecentRequest +{ + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// Identifies the target session. +[Experimental(Diagnostics.Experimental)] +internal sealed class SessionQueueClearRequest +{ + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// Internal filter for consuming queued system notifications. +[Experimental(Diagnostics.Experimental)] +internal sealed class QueueConsumeSystemNotificationsRequest +{ + /// Opaque runtime-owned filter object. + [JsonPropertyName("filter")] + public JsonElement Filter { get; set; } + + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// Result of enqueueing the resume-pending wake item. +[Experimental(Diagnostics.Experimental)] +internal sealed class QueueEnqueueResumePendingResult +{ + /// True when a wake item was newly queued. + [JsonPropertyName("queued")] + public bool Queued { get; set; } +} + +/// Identifies the target session. +[Experimental(Diagnostics.Experimental)] +internal sealed class SessionQueueEnqueueResumePendingRequest +{ + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// Identifies the target session. +[Experimental(Diagnostics.Experimental)] +internal sealed class SessionQueueProcessRequest +{ + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// 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; } +} + +/// Cursor, batch size, and optional long-poll/filter parameters for reading session events. +[Experimental(Diagnostics.Experimental)] +internal sealed class EventLogReadRequest +{ + /// Optional non-empty list of subagent identifiers. When provided, only events owned by one of these agents are returned; ownership recognizes the event envelope's agentId plus legacy data.agentId and data.parentToolCallId markers. This filter takes precedence over agentScope. + [JsonPropertyName("agentIds")] + public IList? AgentIds { get; set; } + + /// Agent-scope filter: 'primary' returns only main-agent events plus events whose type starts with 'subagent.' (matching the typed-subscription default behavior); 'all' returns events from all agents (matching wildcard-subscription behavior). Default is 'all' to preserve wildcard semantics for catch-up callers. + [JsonPropertyName("agentScope")] + public EventsAgentScope? AgentScope { get; set; } + + /// Opaque cursor returned by a previous read. Omit on the first call to start from the beginning of the session's persisted history. + [JsonPropertyName("cursor")] + public string? Cursor { get; set; } + + /// Direction to page through the session's persisted event history. 'forward' (default) pages from the cursor toward newer events (or from the start of history when no cursor is given). 'backward' enables tail-first reads: with no cursor it returns the NEWEST `max` events, and the returned cursor pages toward OLDER events on subsequent backward reads. Events within a returned batch are always in chronological (oldest-to-newest) order, even for a backward read. Backward reads cover PERSISTED history only; ephemeral events are never returned by a backward read. `direction` selects the INITIAL read only: the returned cursor is self-describing, so a continuation read pages in the cursor's own direction regardless of the `direction` passed alongside it — a forward cursor always pages forward and a backward cursor always pages backward. Pass the direction that matches the cursor to avoid confusion. + [JsonPropertyName("direction")] + public EventsReadDirection? Direction { get; set; } + + /// When false, skip ephemeral events entirely and return only durable (persisted) events. History-backfill callers that discard ephemerals anyway should set this so the read is bounded by the durable log length instead of racing the ephemeral ring on a busy session. Defaults to true (ephemerals are interleaved with durable events in creation order). Ignored by backward reads, which always cover persisted history only. + [JsonPropertyName("includeEphemeral")] + public bool? IncludeEphemeral { get; set; } + + /// Maximum number of events to return in this batch (1–1000, default 200). + [JsonPropertyName("max")] + public long? Max { get; set; } + + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; + + /// Either '*' to receive all event types, or a non-empty list of event types to receive. + [JsonPropertyName("types")] + public JsonElement? Types { get; set; } + + /// Milliseconds to wait for new events when the cursor is at the tail of history. 0 (default) returns immediately even if no events are available. Capped at 30000ms. Ephemeral events that arrive during the wait are delivered in this batch but are NOT replayable on a subsequent read (use a non-zero waitMs in your next call to capture future ephemerals as they happen). This applies to forward reads only: a backward read always returns immediately and ignores `waitMs`, because backward paging covers persisted history only while new events append at the tail (the opposite end from a backward page), so no blocking or ephemeral delivery can occur. + [JsonConverter(typeof(MillisecondsTimeSpanConverter))] + [JsonPropertyName("waitMs")] + public TimeSpan? Wait { get; set; } +} + +/// Snapshot of the current tail cursor without returning any events. Use this when a consumer wants to subscribe to live events going forward without first paginating through the entire persisted history (which would happen if `read` were called without a cursor on a long-lived session). +[Experimental(Diagnostics.Experimental)] +public sealed class EventLogTailResult +{ + /// Opaque cursor pointing at the current tail of the session's persisted-events history. Pass back to `read` to receive only events that arrive AFTER this snapshot. When the session has no events, this returns the same sentinel as an unset cursor (i.e. equivalent to omitting the cursor on a first read). + [JsonPropertyName("cursor")] + public string Cursor { get; set; } = string.Empty; +} + +/// Identifies the target session. +[Experimental(Diagnostics.Experimental)] +internal sealed class SessionEventLogTailRequest +{ + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// Opaque handle representing an event-type interest registration. +[Experimental(Diagnostics.Experimental)] +public sealed class RegisterEventInterestResult +{ + /// Opaque handle for this registration. Pass to releaseInterest to release. Each call to registerInterest produces a fresh handle, even when the same eventType is registered multiple times. + [JsonPropertyName("handle")] + public string Handle { get; set; } = string.Empty; +} + +/// Event type to register consumer interest for, used by runtime gating logic. +[Experimental(Diagnostics.Experimental)] +internal sealed class RegisterEventInterestParams +{ + /// The event type the consumer wants the runtime to treat as 'observed' for behavior-switching gating. Some runtime code paths inspect whether any consumer is interested in a specific event type and choose a different implementation accordingly (e.g. `mcp.oauth_required`: when interest is registered the runtime delegates interactive OAuth token acquisition to the consumer via `mcp.oauth_required` events; when no interest is registered the runtime still attempts non-interactive reconnect from cached or refreshable tokens, and only marks the server `needs-auth` if usable credentials are unavailable — it does not open a browser or start interactive OAuth without a consumer). SDK clients that long-poll events do NOT automatically appear as listeners to these gating checks — they must explicitly call `registerInterest` for each event type they want the runtime to count as having a consumer. Multiple registrations for the same event type from the same or different consumers are tracked independently and must each be released. See: `mcp.oauth_required`, `sampling.requested`, `auto_mode_switch.requested`, `session_limits_exhausted.requested`, `user_input.requested`, `elicitation.requested`, `command.queued`, `exit_plan_mode.requested`. + [JsonPropertyName("eventType")] + public string EventType { get; set; } = string.Empty; + + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// Indicates whether the operation succeeded. +[Experimental(Diagnostics.Experimental)] +public sealed class EventLogReleaseInterestResult +{ + /// Whether the operation succeeded. + [JsonPropertyName("success")] + public bool Success { get; set; } +} + +/// Opaque handle previously returned by `registerInterest` to release. +[Experimental(Diagnostics.Experimental)] +internal sealed class ReleaseEventInterestParams +{ + /// Handle returned by a previous `registerInterest` call. Idempotent: releasing an unknown or already-released handle is a no-op (returns success). When the last outstanding handle for an event type is released, the runtime reverts to its 'no consumer' code path for that event type. + [JsonPropertyName("handle")] + public string Handle { get; set; } = string.Empty; + + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// Request count and cost metrics for this model. +[Experimental(Diagnostics.Experimental)] +public sealed class UsageMetricsModelMetricRequests +{ + /// User-initiated premium request cost (with multiplier applied). + [JsonPropertyName("cost")] + public double Cost { get; set; } + + /// Number of API requests made with this model. + [JsonPropertyName("count")] + public long Count { get; set; } +} + +/// Per-model token-detail entry containing the accumulated token count for one token type. +[Experimental(Diagnostics.Experimental)] +public sealed class UsageMetricsModelMetricTokenDetail +{ + /// Accumulated token count for this token type. + [JsonPropertyName("tokenCount")] + public long TokenCount { get; set; } +} + +/// Token usage metrics for this model. +[Experimental(Diagnostics.Experimental)] +public sealed class UsageMetricsModelMetricUsage +{ + /// Total tokens read from prompt cache. + [JsonPropertyName("cacheReadTokens")] + public long CacheReadTokens { get; set; } + + /// Total tokens written to prompt cache. + [JsonPropertyName("cacheWriteTokens")] + public long CacheWriteTokens { get; set; } + + /// Total input tokens consumed. + [JsonPropertyName("inputTokens")] + public long InputTokens { get; set; } + + /// Total output tokens produced. + [JsonPropertyName("outputTokens")] + public long OutputTokens { get; set; } + + /// Total output tokens used for reasoning. + [JsonPropertyName("reasoningTokens")] + public long? ReasoningTokens { get; set; } +} + +/// Per-model usage metrics, including request counts/costs, token usage, nano-AI units, and per-token-type details. +[Experimental(Diagnostics.Experimental)] +public sealed class UsageMetricsModelMetric +{ + /// Latest known prompt-cache expiration for this model. A timestamp in the past indicates that the observed cache has expired. + [JsonPropertyName("cacheExpiresAt")] + public DateTimeOffset? CacheExpiresAt { get; set; } + + /// Request count and cost metrics for this model. + [JsonPropertyName("requests")] + public UsageMetricsModelMetricRequests Requests { get => field ??= new(); set; } + + /// Token count details per type. + [JsonPropertyName("tokenDetails")] + public IDictionary? TokenDetails { get; set; } + + /// Accumulated nano-AI units cost for this model. + [JsonPropertyName("totalNanoAiu")] + public double? TotalNanoAiu { get; set; } + + /// Token usage metrics for this model. + [JsonPropertyName("usage")] + public UsageMetricsModelMetricUsage Usage { get => field ??= new(); set; } +} + +/// Usage attributed to one agent instance, including its identity, API duration, AI units, and per-model breakdown. +[Experimental(Diagnostics.Experimental)] +public sealed class UsageMetricsAgentMetric +{ + /// Human-readable label for this subagent invocation, copied from the originating `subagent.started` event. For task-tool subagents this is the invocation's task description rather than the agent's configured display name, so group by `agentName` for stable per-agent labels. + [JsonPropertyName("agentDisplayName")] + public string? AgentDisplayName { get; set; } + + /// Configured agent name, when this is a subagent. + [JsonPropertyName("agentName")] + public string? AgentName { get; set; } + + /// Per-model usage for this agent, keyed by model identifier. + [JsonPropertyName("modelMetrics")] + public IDictionary ModelMetrics { get => field ??= new Dictionary(); set; } + + /// Time spent in model API calls by this agent, in milliseconds. + [JsonConverter(typeof(MillisecondsTimeSpanConverter))] + [JsonPropertyName("totalApiDurationMs")] + public TimeSpan TotalApiDuration { get; set; } + + /// Accumulated nano-AI units cost for this agent. + [JsonPropertyName("totalNanoAiu")] + public double TotalNanoAiu { get; set; } +} + +/// Aggregated code change metrics. +[Experimental(Diagnostics.Experimental)] +public sealed class UsageMetricsCodeChanges +{ + /// Distinct file paths modified during the session. + [JsonPropertyName("filesModified")] + public IList FilesModified { get => field ??= []; set; } + + /// Number of distinct files modified. + [JsonPropertyName("filesModifiedCount")] + public long FilesModifiedCount { get; set; } + + /// Total lines of code added. + [JsonPropertyName("linesAdded")] + public long LinesAdded { get; set; } + + /// Total lines of code removed. + [JsonPropertyName("linesRemoved")] + public long LinesRemoved { get; set; } +} + +/// Session-wide token-detail entry containing the accumulated token count for one token type. +[Experimental(Diagnostics.Experimental)] +public sealed class UsageMetricsTokenDetail +{ + /// Accumulated token count for this token type. + [JsonPropertyName("tokenCount")] + public long TokenCount { get; set; } +} + +/// Accumulated session usage metrics, including premium request cost, token counts, model breakdown, and code-change totals. +[Experimental(Diagnostics.Experimental)] +public sealed class UsageGetMetricsResult +{ + /// Per-agent usage metrics, keyed by agent instance identifier. The main conversation uses the stable key `main`. + [JsonPropertyName("agentMetrics")] + public IDictionary? AgentMetrics { get; set; } + + /// Aggregated code change metrics. + [JsonPropertyName("codeChanges")] + public UsageMetricsCodeChanges CodeChanges { get => field ??= new(); set; } + + /// Currently active model identifier. + [JsonPropertyName("currentModel")] + public string? CurrentModel { get; set; } + + /// Input tokens from the most recent main-agent API call. + [JsonPropertyName("lastCallInputTokens")] + public long LastCallInputTokens { get; set; } + + /// Output tokens from the most recent main-agent API call. + [JsonPropertyName("lastCallOutputTokens")] + public long LastCallOutputTokens { get; set; } + + /// Per-model token and request metrics, keyed by model identifier. + [JsonPropertyName("modelMetrics")] + public IDictionary ModelMetrics { get => field ??= new Dictionary(); set; } + + /// ISO 8601 timestamp when the session started. + [JsonPropertyName("sessionStartTime")] + public DateTimeOffset SessionStartTime { get; set; } + + /// Session-wide per-token-type accumulated token counts. + [JsonPropertyName("tokenDetails")] + public IDictionary? TokenDetails { get; set; } + + /// Total time spent in model API calls (milliseconds). + [JsonConverter(typeof(MillisecondsTimeSpanConverter))] + [JsonPropertyName("totalApiDurationMs")] + public TimeSpan TotalApiDuration { get; set; } + + /// Session-wide accumulated nano-AI units cost. + [JsonPropertyName("totalNanoAiu")] + public double? TotalNanoAiu { get; set; } + + /// Total user-initiated premium request cost across all models (may be fractional due to multipliers). + [JsonPropertyName("totalPremiumRequestCost")] + public double TotalPremiumRequestCost { get; set; } + + /// Raw count of user-initiated API requests. + [JsonPropertyName("totalUserRequests")] + public long TotalUserRequests { get; set; } +} + +/// Identifies the target session. +[Experimental(Diagnostics.Experimental)] +internal sealed class SessionUsageGetMetricsRequest +{ + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// Prediction result. Available results include prediction details; unavailable results include an explicit reason. +/// Polymorphic base type discriminated by kind. +[Experimental(Diagnostics.Experimental)] +[JsonPolymorphic( + TypeDiscriminatorPropertyName = "kind", + UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToBaseType)] +[JsonDerivedType(typeof(SessionLimitPredictionResultAvailable), "available")] +[JsonDerivedType(typeof(SessionLimitPredictionResultUnavailable), "unavailable")] +public partial class SessionLimitPredictionResult +{ + /// The type discriminator. + [JsonPropertyName("kind")] + public virtual string Kind { get; set; } = string.Empty; +} + + +/// Baseline data provenance for a prediction. +[Experimental(Diagnostics.Experimental)] +public sealed class SessionLimitPredictionBaselineData +{ + /// End of the baseline data slice. + [JsonPropertyName("windowEnd")] + public string WindowEnd { get; set; } = string.Empty; + + /// Start of the baseline data slice. + [JsonPropertyName("windowStart")] + public string WindowStart { get; set; } = string.Empty; +} + +/// Semantic usage tier and its AI-credit cap. +[Experimental(Diagnostics.Experimental)] +public sealed class SessionLimitPredictionTierOption +{ + /// AI-credit cap for this tier. + [JsonPropertyName("cap")] + public double Cap { get; set; } + + /// Semantic usage tier. + [JsonPropertyName("tier")] + public SessionLimitPredictionTier Tier { get; set; } +} + +/// Explainable AI-credit session-limit prediction. +[Experimental(Diagnostics.Experimental)] +public sealed class SessionLimitPredictionDetails +{ + /// Baseline data provenance. + [JsonPropertyName("baselineData")] + public SessionLimitPredictionBaselineData BaselineData { get => field ??= new(); set; } + + /// Client population used for the prediction. + [JsonPropertyName("clientType")] + public SessionLimitPredictionClientType ClientType { get; set; } + + /// Resolved model family when known. + [JsonPropertyName("family")] + public string? Family { get; set; } + + /// Model identifier used for lookup. + [JsonPropertyName("modelId")] + public string ModelId { get; set; } = string.Empty; + + /// Recommended maximum AI credits for this session. + [JsonPropertyName("recommendedCap")] + public double RecommendedCap { get; set; } + + /// Tier chosen as the recommended cap. + [JsonPropertyName("recommendedTier")] + public SessionLimitPredictionTier RecommendedTier { get; set; } + + /// Baseline fallback level used to create the prediction. + [JsonPropertyName("source")] + public SessionLimitPredictionSource Source { get; set; } + + /// Key matched at the source level, such as a model id, family id, or `global`. + [JsonPropertyName("sourceKey")] + public string SourceKey { get; set; } = string.Empty; + + /// Ordered usage tiers and their AI-credit caps. + [JsonPropertyName("tiers")] + public IList Tiers { get => field ??= []; set; } +} + +/// The available variant of . +[Experimental(Diagnostics.Experimental)] +public partial class SessionLimitPredictionResultAvailable : SessionLimitPredictionResult +{ + /// + [JsonIgnore] + public override string Kind => "available"; + + /// Predicted session limit details. + [JsonPropertyName("prediction")] + public required SessionLimitPredictionDetails Prediction { get; set; } +} + +/// The unavailable variant of . +[Experimental(Diagnostics.Experimental)] +public partial class SessionLimitPredictionResultUnavailable : SessionLimitPredictionResult +{ + /// + [JsonIgnore] + public override string Kind => "unavailable"; + + /// Reason no prediction is available. + [JsonPropertyName("reason")] + public required SessionLimitPredictionUnavailableReason Reason { get; set; } +} + +/// RPC data type for SessionLimitPredictionPredict operations. +[Experimental(Diagnostics.Experimental)] +public sealed class SessionLimitPredictionPredictRequest +{ + /// Client type to size for. Defaults to `cli-interactive`. + [JsonPropertyName("clientType")] + public SessionLimitPredictionClientType? ClientType { get; set; } + + /// Optional model identifier override. If omitted, the session's current model is used. + [JsonPropertyName("modelId")] + public string? ModelId { get; set; } +} + +/// RPC data type for SessionLimitPredictionPredictRequestWithSession operations. +[Experimental(Diagnostics.Experimental)] +internal sealed class SessionLimitPredictionPredictRequestWithSession +{ + /// Client type to size for. Defaults to `cli-interactive`. + [JsonPropertyName("clientType")] + public SessionLimitPredictionClientType? ClientType { get; set; } + + /// Optional model identifier override. If omitted, the session's current model is used. + [JsonPropertyName("modelId")] + public string? ModelId { get; set; } + + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// GitHub URL for the session and a flag indicating whether remote steering is enabled. +[Experimental(Diagnostics.Experimental)] +public sealed class RemoteEnableResult +{ + /// Whether remote steering is enabled. + [JsonPropertyName("remoteSteerable")] + public bool RemoteSteerable { get; set; } + + /// GitHub frontend URL for this session. + [Url] + [StringSyntax(StringSyntaxAttribute.Uri)] + [JsonPropertyName("url")] + public string? Url { get; set; } +} + +/// Optional remote session mode ("off", "export", or "on"); defaults to enabling both export and remote steering. +[Experimental(Diagnostics.Experimental)] +internal sealed class RemoteEnableRequest +{ + /// Per-session remote mode. "off" disables remote, "export" exports session events to GitHub without enabling remote steering, "on" enables both export and remote steering. + [JsonPropertyName("mode")] + public RemoteSessionMode? Mode { get; set; } + + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// Identifies the target session. +[Experimental(Diagnostics.Experimental)] +internal sealed class SessionRemoteDisableRequest +{ + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// Persist a steerability change as a `session.remote_steerable_changed` event. Used by the host (CLI / SDK consumer) when it has just finished enabling or disabling steering on a remote exporter that the runtime does not directly own. +[Experimental(Diagnostics.Experimental)] +public sealed class RemoteNotifySteerableChangedResult +{ +} + +/// New remote-steerability state to persist as a `session.remote_steerable_changed` event. +[Experimental(Diagnostics.Experimental)] +internal sealed class RemoteNotifySteerableChangedRequest +{ + /// Whether the session now supports remote steering via GitHub. The runtime persists this as a `session.remote_steerable_changed` event so resume/replay sees the up-to-date capability. + [JsonPropertyName("remoteSteerable")] + public bool RemoteSteerable { get; set; } + + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// Current sharing status and shareable GitHub URL for a session. +[Experimental(Diagnostics.Experimental)] +public sealed class VisibilityGetResult +{ + /// Shareable GitHub URL for the session. Present when the session is synced and the URL can be resolved. + [Url] + [StringSyntax(StringSyntaxAttribute.Uri)] + [JsonPropertyName("shareUrl")] + public string? ShareUrl { get; set; } + + /// Current sharing status. Absent when the session is not synced or the status could not be retrieved (e.g. the user is not authenticated). + [JsonPropertyName("status")] + public SessionVisibilityStatus? Status { get; set; } + + /// Whether the session has been synced to Mission Control (i.e. has a GitHub task). When false, the session cannot be shared and `status`/`shareUrl` are absent. + [JsonPropertyName("synced")] + public bool Synced { get; set; } +} + +/// Identifies the target session. +[Experimental(Diagnostics.Experimental)] +internal sealed class SessionVisibilityGetRequest +{ + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// Effective sharing status and shareable GitHub URL after updating session visibility. +[Experimental(Diagnostics.Experimental)] +public sealed class VisibilitySetResult +{ + /// Shareable GitHub URL for the session. Present when the session is synced and the URL can be resolved. + [Url] + [StringSyntax(StringSyntaxAttribute.Uri)] + [JsonPropertyName("shareUrl")] + public string? ShareUrl { get; set; } + + /// Effective sharing status after the update. May differ from the requested status for task types that are already visible to repository readers by default. Absent when the update could not be applied (e.g. the session is not synced or the user is not authenticated). + [JsonPropertyName("status")] + public SessionVisibilityStatus? Status { get; set; } + + /// Whether the session has been synced to Mission Control (i.e. has a GitHub task). When false, the visibility change could not be applied and `status`/`shareUrl` are absent. + [JsonPropertyName("synced")] + public bool Synced { get; set; } +} + +/// Desired sharing status for the session. +[Experimental(Diagnostics.Experimental)] +internal sealed class VisibilitySetRequest +{ + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; + + /// Sharing status to apply. "repo" makes the session visible to repository readers; "unshared" restricts it to the creator and collaborators. + [JsonPropertyName("status")] + public SessionVisibilityStatus Status { get; set; } +} + +/// Scheduled prompt entry with ID, timing (`intervalMs`, `cron`, or `at`), prompt text, recurrence, and next run time. +[Experimental(Diagnostics.Experimental)] +public sealed class ScheduleEntry +{ + /// Absolute fire time (epoch milliseconds) for a one-shot calendar schedule. + [JsonPropertyName("at")] + public long? At { get; set; } + + /// 5-field cron expression for a recurring calendar schedule, evaluated in `tz`. + [JsonPropertyName("cron")] + public string? Cron { get; set; } + + /// Display-only label for the prompt as shown in the UI (e.g. `/skill-name` for a skill-invocation schedule). The actual enqueued prompt is `prompt`. + [JsonPropertyName("displayPrompt")] + public string? DisplayPrompt { get; set; } + + /// Sequential id assigned by the runtime within the session. Stable across resumes (rebuilt from the event log). + [JsonPropertyName("id")] + public long Id { get; set; } + + /// Interval between scheduled ticks, in milliseconds (relative-interval schedules). + [JsonConverter(typeof(MillisecondsTimeSpanConverter))] + [JsonPropertyName("intervalMs")] + public TimeSpan? Interval { get; set; } + + /// ISO 8601 timestamp when the next tick is scheduled to fire. + [JsonPropertyName("nextRunAt")] + public DateTimeOffset NextRunAt { get; set; } + + /// Prompt text that gets enqueued on every tick. + [JsonPropertyName("prompt")] + public string Prompt { get; set; } = string.Empty; + + /// Whether the schedule re-arms after each tick (`/every`) or fires once (`/after`). + [JsonPropertyName("recurring")] + public bool Recurring { get; set; } + + /// True for a self-paced (`dynamic`) schedule: no fixed cadence; the model arms each next run via the `manage_schedule` `wakeup` action. `nextRunAt` is model-controlled. + [JsonPropertyName("selfPaced")] + public bool? SelfPaced { get; set; } + + /// IANA timezone the `cron` expression is evaluated in. + [JsonPropertyName("tz")] + public string? Tz { get; set; } +} + +/// Snapshot of the currently active recurring prompts for this session. +[Experimental(Diagnostics.Experimental)] +public sealed class ScheduleList +{ + /// Active scheduled prompts, ordered by id. + [JsonPropertyName("entries")] + public IList Entries { get => field ??= []; set; } +} + +/// Identifies the target session. +[Experimental(Diagnostics.Experimental)] +internal sealed class SessionScheduleListRequest +{ + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// Identifies the target session. +[Experimental(Diagnostics.Experimental)] +internal sealed class SessionScheduleHydrateRequest +{ + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// Whether the session currently has an active self-paced schedule. +[Experimental(Diagnostics.Experimental)] +internal sealed class ScheduleHasSelfPacedResult +{ + /// True when at least one active schedule is self-paced. + [JsonPropertyName("hasSelfPaced")] + public bool HasSelfPaced { get; set; } +} + +/// Identifies the target session. +[Experimental(Diagnostics.Experimental)] +internal sealed class SessionScheduleHasSelfPacedRequest +{ + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// Result of registering or re-arming a scheduled prompt. +[Experimental(Diagnostics.Experimental)] +internal sealed class ScheduleAddResult +{ + /// The registered or updated schedule entry. + [JsonPropertyName("entry")] + public ScheduleEntry? Entry { get; set; } + + /// User-facing validation error, when registration failed. + [JsonPropertyName("error")] + public string? Error { get; set; } +} + +/// Register a relative-interval scheduled prompt. +[Experimental(Diagnostics.Experimental)] +internal sealed class ScheduleAddRequest +{ + /// Optional display-only prompt label. + [JsonPropertyName("displayPrompt")] + public string? DisplayPrompt { get; set; } + + /// Human-readable interval such as `30s`, `5m`, or `2h`. + [JsonPropertyName("interval")] + public string Interval { get; set; } = string.Empty; + + /// Prompt text to enqueue when the schedule fires. + [JsonPropertyName("prompt")] + public string Prompt { get; set; } = string.Empty; + + /// Whether the schedule should re-arm after each tick. Defaults to true. + [JsonPropertyName("recurring")] + public bool? Recurring { get; set; } + + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// Register a cron scheduled prompt. +[Experimental(Diagnostics.Experimental)] +internal sealed class ScheduleAddCronRequest +{ + /// 5-field cron expression. + [JsonPropertyName("cron")] + public string Cron { get; set; } = string.Empty; + + /// Optional display-only prompt label. + [JsonPropertyName("displayPrompt")] + public string? DisplayPrompt { get; set; } + + /// Prompt text to enqueue when the schedule fires. + [JsonPropertyName("prompt")] + public string Prompt { get; set; } = string.Empty; + + /// Whether the schedule should re-arm after each tick. Defaults to true. + [JsonPropertyName("recurring")] + public bool? Recurring { get; set; } + + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; + + /// IANA timezone for evaluating the cron expression. + [JsonPropertyName("tz")] + public string? Tz { get; set; } +} + +/// Register an absolute-time scheduled prompt. +[Experimental(Diagnostics.Experimental)] +internal sealed class ScheduleAddAtRequest +{ + /// Epoch milliseconds when the prompt should fire. + [JsonPropertyName("at")] + public long At { get; set; } + + /// Optional display-only prompt label. + [JsonPropertyName("displayPrompt")] + public string? DisplayPrompt { get; set; } + + /// Prompt text to enqueue when the schedule fires. + [JsonPropertyName("prompt")] + public string Prompt { get; set; } = string.Empty; + + /// Whether the schedule should re-arm after each tick. Defaults to false. + [JsonPropertyName("recurring")] + public bool? Recurring { get; set; } + + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// Register a self-paced scheduled prompt. +[Experimental(Diagnostics.Experimental)] +internal sealed class ScheduleAddSelfPacedRequest +{ + /// Optional display-only prompt label. + [JsonPropertyName("displayPrompt")] + public string? DisplayPrompt { get; set; } + + /// Prompt text to enqueue when the schedule fires. + [JsonPropertyName("prompt")] + public string Prompt { get; set; } = string.Empty; + + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// Re-arm a self-paced scheduled prompt. +[Experimental(Diagnostics.Experimental)] +internal sealed class ScheduleRearmSelfPacedRequest +{ + /// Epoch milliseconds when the prompt should next fire. + [JsonPropertyName("at")] + public long At { get; set; } + + /// Id of the self-paced scheduled prompt. + [JsonPropertyName("id")] + public long Id { get; set; } + + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// Remove a scheduled prompt by id. The result entry is omitted if the id was unknown. +[Experimental(Diagnostics.Experimental)] +public sealed class ScheduleStopResult +{ + /// The removed entry, or omitted if no entry matched. + [JsonPropertyName("entry")] + public ScheduleEntry? Entry { get; set; } +} + +/// Identifier of the scheduled prompt to remove. +[Experimental(Diagnostics.Experimental)] +internal sealed class ScheduleStopRequest +{ + /// Id of the scheduled prompt to remove. + [JsonPropertyName("id")] + public long Id { get; set; } + + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// A bearer token supplied by the SDK client for a BYOK provider. The runtime sets it as `Authorization: Bearer <token>` on the outbound request and does no caching; the SDK consumer owns token caching and refresh. +[Experimental(Diagnostics.Experimental)] +public sealed class ProviderTokenAcquireResult +{ + /// The bearer token value (without the `Bearer ` prefix). + [JsonPropertyName("token")] + public string Token { get; set; } = string.Empty; +} + +/// Asks the SDK client to acquire a bearer token for a BYOK provider whose config set `hasBearerTokenProvider: true`. Issued by the runtime before each outbound model request; the runtime does no caching, so this is sent once per request. +[Experimental(Diagnostics.Experimental)] +public sealed class ProviderTokenAcquireRequest +{ + /// Name of the BYOK provider needing a token. For the legacy whole-session provider this is the implicit provider name; for named providers it is the configured provider name. + [JsonPropertyName("providerName")] + public string ProviderName { get; set; } = string.Empty; + + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// Result returned by an extension factory closure. +[Experimental(Diagnostics.Experimental)] +public sealed class FactoryExecuteResult +{ + /// Factory result value. + [JsonPropertyName("result")] + public JsonElement? Result { get; set; } +} + +/// Parameters sent to the owning extension to execute a factory closure. +[Experimental(Diagnostics.Experimental)] +public sealed class FactoryExecuteRequest +{ + /// Factory input value. + [JsonPropertyName("args")] + public JsonElement Args { get; set; } + + /// Opaque token identifying this factory execution attempt. + [JsonPropertyName("executionToken")] + public string ExecutionToken { get; set; } = string.Empty; + + /// Registered factory name. + [JsonPropertyName("name")] + public string Name { get; set; } = string.Empty; + + /// Factory run identifier. + [JsonPropertyName("runId")] + public string RunId { get; set; } = string.Empty; + + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// Parameters for cooperatively aborting a factory body. +[Experimental(Diagnostics.Experimental)] +public sealed class FactoryAbortRequest +{ + /// Factory run identifier. + [JsonPropertyName("runId")] + public string RunId { get; set; } = string.Empty; + + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// Describes a filesystem error. +[Experimental(Diagnostics.Experimental)] +public sealed class SessionFsError +{ + /// Error classification. + [JsonPropertyName("code")] + public SessionFsErrorCode Code { get; set; } + + /// Free-form detail about the error, for logging/diagnostics. + [JsonPropertyName("message")] + public string? Message { get; set; } +} + +/// File content as a UTF-8 string, or a filesystem error if the read failed. +[Experimental(Diagnostics.Experimental)] +public sealed class SessionFsReadFileResult +{ + /// File content as UTF-8 string. + [JsonPropertyName("content")] + public string Content { get; set; } = string.Empty; + + /// Describes a filesystem error. + [JsonPropertyName("error")] + public SessionFsError? Error { get; set; } +} + +/// Path of the file to read from the client-provided session filesystem. +[Experimental(Diagnostics.Experimental)] +public sealed class SessionFsReadFileRequest +{ + /// Path using SessionFs conventions. + [JsonPropertyName("path")] + public string Path { get; set; } = string.Empty; + + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// File path, content to write, and optional mode for the client-provided session filesystem. +[Experimental(Diagnostics.Experimental)] +public sealed class SessionFsWriteFileRequest +{ + /// Content to write. + [JsonPropertyName("content")] + public string Content { get; set; } = string.Empty; + + /// Optional POSIX-style mode for newly created files. + [JsonPropertyName("mode")] + public long? Mode { get; set; } + + /// Path using SessionFs conventions. + [JsonPropertyName("path")] + public string Path { get; set; } = string.Empty; + + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// File path, content to append, and optional mode for the client-provided session filesystem. +[Experimental(Diagnostics.Experimental)] +public sealed class SessionFsAppendFileRequest +{ + /// Content to append. + [JsonPropertyName("content")] + public string Content { get; set; } = string.Empty; + + /// Optional POSIX-style mode for newly created files. + [JsonPropertyName("mode")] + public long? Mode { get; set; } + + /// Path using SessionFs conventions. + [JsonPropertyName("path")] + public string Path { get; set; } = string.Empty; + + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// Indicates whether the requested path exists in the client-provided session filesystem. +[Experimental(Diagnostics.Experimental)] +public sealed class SessionFsExistsResult +{ + /// Whether the path exists. + [JsonPropertyName("exists")] + public bool Exists { get; set; } +} + +/// Path to test for existence in the client-provided session filesystem. +[Experimental(Diagnostics.Experimental)] +public sealed class SessionFsExistsRequest +{ + /// Path using SessionFs conventions. + [JsonPropertyName("path")] + public string Path { get; set; } = string.Empty; + + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// Filesystem metadata for the requested path, or a filesystem error if the stat failed. +[Experimental(Diagnostics.Experimental)] +public sealed class SessionFsStatResult +{ + /// ISO 8601 timestamp of creation. + [JsonPropertyName("birthtime")] + public DateTimeOffset Birthtime { get; set; } + + /// Describes a filesystem error. + [JsonPropertyName("error")] + public SessionFsError? Error { get; set; } + + /// Whether the path is a directory. + [JsonPropertyName("isDirectory")] + public bool IsDirectory { get; set; } + + /// Whether the path is a file. + [JsonPropertyName("isFile")] + public bool IsFile { get; set; } + + /// ISO 8601 timestamp of last modification. + [JsonPropertyName("mtime")] + public DateTimeOffset Mtime { get; set; } + + /// File size in bytes. + [JsonPropertyName("size")] + public long Size { get; set; } +} + +/// Path whose metadata should be returned from the client-provided session filesystem. +[Experimental(Diagnostics.Experimental)] +public sealed class SessionFsStatRequest +{ + /// Path using SessionFs conventions. + [JsonPropertyName("path")] + public string Path { get; set; } = string.Empty; + + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// Directory path to create in the client-provided session filesystem, with options for recursive creation and POSIX mode. +[Experimental(Diagnostics.Experimental)] +public sealed class SessionFsMkdirRequest +{ + /// Optional POSIX-style mode for newly created directories. + [JsonPropertyName("mode")] + public long? Mode { get; set; } + + /// Path using SessionFs conventions. + [JsonPropertyName("path")] + public string Path { get; set; } = string.Empty; + + /// Create parent directories as needed. + [JsonPropertyName("recursive")] + public bool? Recursive { get; set; } + + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// Names of entries in the requested directory, or a filesystem error if the read failed. +[Experimental(Diagnostics.Experimental)] +public sealed class SessionFsReaddirResult +{ + /// Entry names in the directory. + [JsonPropertyName("entries")] + public IList Entries { get => field ??= []; set; } + + /// Describes a filesystem error. + [JsonPropertyName("error")] + public SessionFsError? Error { get; set; } +} + +/// Directory path whose entries should be listed from the client-provided session filesystem. +[Experimental(Diagnostics.Experimental)] +public sealed class SessionFsReaddirRequest +{ + /// Path using SessionFs conventions. + [JsonPropertyName("path")] + public string Path { get; set; } = string.Empty; + + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// Directory entry returned by session filesystem `readdirWithTypes`, with name and entry type. +[Experimental(Diagnostics.Experimental)] +public sealed class SessionFsReaddirWithTypesEntry +{ + /// Entry name. + [JsonPropertyName("name")] + public string Name { get; set; } = string.Empty; + + /// Entry type. + [JsonPropertyName("type")] + public SessionFsReaddirWithTypesEntryType Type { get; set; } +} + +/// Entries in the requested directory paired with file/directory type information, or a filesystem error if the read failed. +[Experimental(Diagnostics.Experimental)] +public sealed class SessionFsReaddirWithTypesResult +{ + /// Directory entries with type information. + [JsonPropertyName("entries")] + public IList Entries { get => field ??= []; set; } + + /// Describes a filesystem error. + [JsonPropertyName("error")] + public SessionFsError? Error { get; set; } +} + +/// Directory path whose entries (with type information) should be listed from the client-provided session filesystem. +[Experimental(Diagnostics.Experimental)] +public sealed class SessionFsReaddirWithTypesRequest +{ + /// Path using SessionFs conventions. + [JsonPropertyName("path")] + public string Path { get; set; } = string.Empty; + + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// Path to remove from the client-provided session filesystem, with options for recursive removal and force. +[Experimental(Diagnostics.Experimental)] +public sealed class SessionFsRmRequest +{ + /// Ignore errors if the path does not exist. + [JsonPropertyName("force")] + public bool? Force { get; set; } + + /// Path using SessionFs conventions. + [JsonPropertyName("path")] + public string Path { get; set; } = string.Empty; + + /// Remove directories and their contents recursively. + [JsonPropertyName("recursive")] + public bool? Recursive { get; set; } + + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// Source and destination paths for renaming or moving an entry in the client-provided session filesystem. +[Experimental(Diagnostics.Experimental)] +public sealed class SessionFsRenameRequest +{ + /// Destination path using SessionFs conventions. + [JsonPropertyName("dest")] + public string Dest { get; set; } = string.Empty; + + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; + + /// Source path using SessionFs conventions. + [JsonPropertyName("src")] + public string Src { get; set; } = string.Empty; +} + +/// Query results including rows, columns, and rows affected, or a filesystem error if execution failed. +[Experimental(Diagnostics.Experimental)] +public sealed class SessionFsSqliteQueryResult +{ + /// Column names from the result set. + [JsonPropertyName("columns")] + public IList Columns { get => field ??= []; set; } + + /// Describes a filesystem error. + [JsonPropertyName("error")] + public SessionFsError? Error { get; set; } + + /// SQLite last_insert_rowid() value for INSERT. + [JsonPropertyName("lastInsertRowid")] + public long? LastInsertRowid { get; set; } + + /// For SELECT: array of row objects. For others: empty array. + [JsonPropertyName("rows")] + public IList> Rows { get => field ??= []; set; } + + /// Number of rows affected (for INSERT/UPDATE/DELETE). + [JsonPropertyName("rowsAffected")] + public long RowsAffected { get; set; } +} + +/// SQL query, query type, and optional bind parameters for executing a SQLite query against the per-session database. The provider applies its SQLite busy timeout for every call. +[Experimental(Diagnostics.Experimental)] +public sealed class SessionFsSqliteQueryRequest +{ + /// Optional named bind parameters. + [JsonPropertyName("params")] + public IDictionary? Params { get; set; } + + /// SQL query to execute. + [JsonPropertyName("query")] + public string Query { get; set; } = string.Empty; + + /// How to execute the query: 'exec' for DDL/multi-statement (no results), 'query' for SELECT (returns rows), 'run' for INSERT/UPDATE/DELETE (returns rowsAffected). + [JsonPropertyName("queryType")] + public SessionFsSqliteQueryType QueryType { get; set; } + + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// Classified SQLite transaction failure. busyOrLocked guarantees rollback; postCommitAmbiguous must never be retried. +[Experimental(Diagnostics.Experimental)] +public sealed class SessionFsSqliteTransactionError +{ + /// Machine-readable classification of the transaction failure. + [JsonPropertyName("errorClass")] + public SessionFsSqliteTransactionErrorClass ErrorClass { get; set; } + + /// Human-readable transaction failure message. + [JsonPropertyName("message")] + public string Message { get; set; } = string.Empty; +} + +/// Per-statement results, or a classified transaction error. +[Experimental(Diagnostics.Experimental)] +public sealed class SessionFsSqliteTransactionResult +{ + /// Classified transaction failure, when execution did not succeed. + [JsonPropertyName("error")] + public SessionFsSqliteTransactionError? Error { get; set; } + + /// Per-statement query results in input order. + [JsonPropertyName("results")] + public IList Results { get => field ??= []; set; } +} + +/// One statement in an atomic SQLite transaction. +[Experimental(Diagnostics.Experimental)] +public sealed class SessionFsSqliteTransactionStatement +{ + /// Optional named bind parameters. + [JsonPropertyName("params")] + public IDictionary? Params { get; set; } + + /// SQL statement to execute. + [JsonPropertyName("query")] + public string Query { get; set; } = string.Empty; + + /// How to execute the statement. + [JsonPropertyName("queryType")] + public SessionFsSqliteQueryType QueryType { get; set; } +} + +/// Statements to execute atomically. Providers apply busy handling for every call. +[Experimental(Diagnostics.Experimental)] +public sealed class SessionFsSqliteTransactionRequest +{ + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; + + /// Ordered SQL statements to execute in one transaction. + [JsonPropertyName("statements")] + public IList Statements { get => field ??= []; set; } +} + +/// Indicates whether the per-session SQLite database already exists. +[Experimental(Diagnostics.Experimental)] +public sealed class SessionFsSqliteExistsResult +{ + /// Whether the session database already exists. + [JsonPropertyName("exists")] + public bool Exists { get; set; } +} + +/// Identifies the target session. +public sealed class SessionFsSqliteExistsRequest +{ + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// Canvas open result returned by the provider. +[Experimental(Diagnostics.Experimental)] +public sealed class CanvasProviderOpenResult +{ + /// Provider-supplied status text. + [JsonPropertyName("status")] + public string? Status { get; set; } + + /// Provider-supplied title. + [JsonPropertyName("title")] + public string? Title { get; set; } + + /// URL for web-rendered canvases. + [JsonPropertyName("url")] + public string? Url { get; set; } +} + +/// Host capabilities. +[Experimental(Diagnostics.Experimental)] +public sealed class CanvasHostContextCapabilities +{ + /// Whether canvas rendering is supported. + [JsonPropertyName("canvases")] + public bool? Canvases { get; set; } +} + +/// Host context supplied by the runtime. +[Experimental(Diagnostics.Experimental)] +public sealed class CanvasHostContext +{ + /// Host capabilities. + [JsonPropertyName("capabilities")] + public CanvasHostContextCapabilities? Capabilities { get; set; } +} + +/// Session context supplied by the runtime. +[Experimental(Diagnostics.Experimental)] +public sealed class CanvasSessionContext +{ + /// Active session working directory, when known. + [JsonPropertyName("workingDirectory")] + public string? WorkingDirectory { get; set; } +} + +/// Canvas open parameters sent to the provider. +[Experimental(Diagnostics.Experimental)] +public sealed class CanvasProviderOpenRequest +{ + /// Provider-local canvas identifier. + [JsonPropertyName("canvasId")] + public string CanvasId { get; set; } = string.Empty; + + /// Owning provider identifier. + [JsonPropertyName("extensionId")] + public string ExtensionId { get; set; } = string.Empty; + + /// Host context supplied by the runtime. + [JsonPropertyName("host")] + public CanvasHostContext? Host { get; set; } + + /// Canvas open input. + [JsonPropertyName("input")] + public JsonElement? Input { get; set; } + + /// Stable caller-supplied canvas instance identifier. + [JsonPropertyName("instanceId")] + public string InstanceId { get; set; } = string.Empty; + + /// Session context supplied by the runtime. + [JsonPropertyName("session")] + public CanvasSessionContext? Session { get; set; } + + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// Canvas close parameters sent to the provider. +[Experimental(Diagnostics.Experimental)] +public sealed class CanvasProviderCloseRequest +{ + /// Provider-local canvas identifier. + [JsonPropertyName("canvasId")] + public string CanvasId { get; set; } = string.Empty; + + /// Owning provider identifier. + [JsonPropertyName("extensionId")] + public string ExtensionId { get; set; } = string.Empty; + + /// Host context supplied by the runtime. + [JsonPropertyName("host")] + public CanvasHostContext? Host { get; set; } + + /// Canvas instance identifier. + [JsonPropertyName("instanceId")] + public string InstanceId { get; set; } = string.Empty; + + /// Session context supplied by the runtime. + [JsonPropertyName("session")] + public CanvasSessionContext? Session { get; set; } + + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// Canvas action invocation parameters sent to the provider. +[Experimental(Diagnostics.Experimental)] +public sealed class CanvasProviderInvokeActionRequest +{ + /// Action name to invoke. + [JsonPropertyName("actionName")] + public string ActionName { get; set; } = string.Empty; + + /// Provider-local canvas identifier. + [JsonPropertyName("canvasId")] + public string CanvasId { get; set; } = string.Empty; + + /// Owning provider identifier. + [JsonPropertyName("extensionId")] + public string ExtensionId { get; set; } = string.Empty; + + /// Host context supplied by the runtime. + [JsonPropertyName("host")] + public CanvasHostContext? Host { get; set; } + + /// Action input. + [JsonPropertyName("input")] + public JsonElement? Input { get; set; } + + /// Canvas instance identifier. + [JsonPropertyName("instanceId")] + public string InstanceId { get; set; } = string.Empty; + + /// Session context supplied by the runtime. + [JsonPropertyName("session")] + public CanvasSessionContext? Session { get; set; } + + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// Opaque integrator-owned process launch profile for one extension entrypoint. +[Experimental(Diagnostics.Experimental)] +public sealed class ExtensionLaunchProfile +{ + /// Opaque integrator-defined arguments passed to the executable. The runtime does not append the extension entrypoint. + [JsonPropertyName("args")] + public IList Args { get => field ??= []; set; } + + /// Opaque integrator-defined environment variables. Runtime-owned COPILOT_SDK_PATH, SESSION_ID, and COPILOT_EXTENSION_PARENT_PID values take precedence. + [JsonPropertyName("env")] + public IDictionary Env { get => field ??= new Dictionary(); set; } + + /// Executable used to launch the extension entrypoint. + [UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "Safe for generated string properties: JSON Schema minLength/maxLength map to string length validation, not reflection over trimmed Count members")] + [MinLength(1)] + [JsonPropertyName("executable")] + public string Executable { get; set; } = string.Empty; +} + +/// The launch profile for a supported entrypoint. Omit launch when the provider does not support the entrypoint. +[Experimental(Diagnostics.Experimental)] +public sealed class ExtensionLaunchProviderResolveResult +{ + /// Opaque launch profile, omitted when this provider does not support the entrypoint. + [JsonPropertyName("launch")] + public ExtensionLaunchProfile? Launch { get; set; } +} + +/// A discovered extension entrypoint that the registered integrator may classify and resolve to an opaque launch profile. +[Experimental(Diagnostics.Experimental)] +public sealed class ExtensionLaunchProviderResolveRequest +{ + /// Source-qualified extension identifier. + [JsonPropertyName("id")] + public string Id { get; set; } = string.Empty; + + /// Absolute path to the discovered extension entrypoint. + [JsonPropertyName("modulePath")] + public string ModulePath { get; set; } = string.Empty; + + /// Human-readable extension name. + [JsonPropertyName("name")] + public string Name { get; set; } = string.Empty; + + /// Discovery source for the extension entrypoint. + [JsonPropertyName("source")] + public ExtensionSource Source { get; set; } +} + +/// Acknowledgement. Returning successfully simply means the SDK accepted the start frame; it does not imply the request will succeed. +[Experimental(Diagnostics.Experimental)] +public sealed class LlmInferenceHttpRequestStartResult +{ +} + +/// The head of an outbound model-layer HTTP request. +[Experimental(Diagnostics.Experimental)] +public sealed class LlmInferenceHttpRequestStartRequest +{ + /// Stable identity of the agent trajectory that issued this request. Present when the request originates from an agent turn; absent for requests outside any agent context. This is the same identity used by lifecycle and bridged session events and remains constant across turns and retries. + [JsonPropertyName("agentId")] + public string? AgentId { get; set; } + + /// Identity of the agent invocation (one agentic loop) that issued this request. It remains fixed across physical retries within the invocation and is distinct from the stable trajectory `agentId`. A caller-supplied invocation id always takes precedence (this covers auxiliary calls that have no model call id). Otherwise, first-party CAPI requests fall back to the runtime's agent task id — the same value the runtime emits as the `X-Agent-Task-Id` header — while custom-provider requests fall back to the model call id. + [JsonPropertyName("agentInvocationId")] + public string? AgentInvocationId { get; set; } + + /// HTTP request headers, preserving multiple values per name. + [JsonPropertyName("headers")] + public IDictionary> Headers { get => field ??= new Dictionary>(); set; } + + /// Coarse classification of the interaction that produced this request. Open string for forward-compatibility; known values include `conversation-agent`, `conversation-subagent`, `conversation-sampling`, `conversation-background`, `conversation-compaction`, and `conversation-user`. Absent when the runtime did not classify the request. Comes from the runtime's per-request agent context independently of transport; on the CAPI transport the runtime derives the upstream `X-Interaction-Type` header from this same context. + [JsonPropertyName("interactionType")] + public string? InteractionType { get; set; } + + /// HTTP method, e.g. GET, POST. + [JsonPropertyName("method")] + public string Method { get; set; } = string.Empty; + + /// Stable identity of the immediate parent trajectory. Present for child trajectories such as subagents and conversation-sampling requests; absent for root-agent and non-agent requests. + [JsonPropertyName("parentAgentId")] + public string? ParentAgentId { get; set; } + + /// Opaque runtime-minted id, unique per in-flight request. The SDK uses this to correlate httpRequestChunk frames and to address its httpResponseStart / httpResponseChunk replies back to the runtime. + [JsonPropertyName("requestId")] + public string RequestId { get; set; } = string.Empty; + + /// Id of the runtime session that triggered this request, when one is in scope. Absent for requests issued outside any session (e.g. startup model-catalog or capability resolution). This is a payload field — not a dispatch key — because the client-global API is registered process-wide rather than per session. + [JsonPropertyName("sessionId")] + public string? SessionId { get; set; } + + /// Transport the runtime would otherwise use for this request. `http` (the default when absent) covers plain HTTP and SSE responses; `websocket` indicates a full-duplex message channel where each body chunk maps to one WebSocket message and the `binary` flag distinguishes text from binary frames. The SDK consumer uses this to decide whether to service the request with an HTTP client or a WebSocket client. It is the one piece of request metadata the consumer cannot reliably infer from the URL or headers alone. + [JsonPropertyName("transport")] + public LlmInferenceHttpRequestStartTransport? Transport { get; set; } + + /// Absolute request URL. + [JsonPropertyName("url")] + public string Url { get; set; } = string.Empty; +} + +/// Acknowledgement. The SDK is free to ignore the ack and treat chunk delivery as fire-and-forget. +[Experimental(Diagnostics.Experimental)] +public sealed class LlmInferenceHttpRequestChunkResult +{ +} + +/// A request body chunk or cancellation signal. +[Experimental(Diagnostics.Experimental)] +public sealed class LlmInferenceHttpRequestChunkRequest +{ + /// Identity of the agent invocation (one agentic loop) this body chunk belongs to, matching the `agentInvocationId` semantics on httpRequestStart. Carried per chunk so a persistent transport can attribute successive turns correctly: when a WebSocket connection is reused across turns, the httpRequestStart identity reflects only the turn that opened the connection, so each later turn stamps its own invocation id here. Absent when the runtime has no invocation context for the request, or on the plain-HTTP transport where every request has its own httpRequestStart. + [JsonPropertyName("agentInvocationId")] + public string? AgentInvocationId { get; set; } + + /// When true, `data` is base64-encoded bytes. When absent or false, `data` is UTF-8 text. + [JsonPropertyName("binary")] + public bool? Binary { get; set; } + + /// When true, the runtime is cancelling the in-flight request (e.g. upstream consumer aborted). `data` is ignored. Implies end-of-request. + [JsonPropertyName("cancel")] + public bool? Cancel { get; set; } + + /// Optional human-readable reason for the cancellation, propagated for logging. + [JsonPropertyName("cancelReason")] + public string? CancelReason { get; set; } + + /// Body byte range. UTF-8 text when `binary` is absent or false; base64-encoded bytes when `binary` is true. May be empty. + [JsonPropertyName("data")] + public string Data { get; set; } = string.Empty; + + /// When true, this is the final body chunk for the request. The SDK may rely on having received an end-marked chunk before treating the request body as complete. + [JsonPropertyName("end")] + public bool? End { get; set; } + + /// Matches the requestId from the originating httpRequestStart frame. + [JsonPropertyName("requestId")] + public string RequestId { get; set; } = string.Empty; +} + +/// Client environment metadata describing the process that produced a telemetry event. +[Experimental(Diagnostics.Experimental)] +public sealed class GitHubTelemetryClientInfo +{ + /// Copilot CLI version string. + [JsonPropertyName("cli_version")] + public string CliVersion { get; set; } = string.Empty; + + /// Name of the client application. + [JsonPropertyName("client_name")] + public string? ClientName { get; set; } + + /// Type of client. + [JsonPropertyName("client_type")] + public string? ClientType { get; set; } + + /// Copilot subscription plan, when known. + [JsonPropertyName("copilot_plan")] + public string? CopilotPlan { get; set; } + + /// Stable machine identifier for the device. + [JsonPropertyName("dev_device_id")] + public string? DevDeviceId { get; set; } + + /// Whether the user is a GitHub/Microsoft staff member. + [JsonPropertyName("is_staff")] + public bool? IsStaff { get; set; } + + /// Node.js runtime version string. + [JsonPropertyName("node_version")] + public string NodeVersion { get; set; } = string.Empty; + + /// Operating system architecture (e.g. arm64, x64). + [JsonPropertyName("os_arch")] + public string OsArch { get; set; } = string.Empty; + + /// Operating system platform (e.g. darwin, linux, win32). + [JsonPropertyName("os_platform")] + public string OsPlatform { get; set; } = string.Empty; + + /// Operating system version string. + [JsonPropertyName("os_version")] + public string OsVersion { get; set; } = string.Empty; +} + +/// A single telemetry event in the runtime's native GitHub-shaped telemetry format, forwarded verbatim to opted-in hosts. The `restricted` flag on the enclosing GitHubTelemetryNotification distinguishes standard from restricted events; the payload shape is identical for both. +[Experimental(Diagnostics.Experimental)] +public sealed class GitHubTelemetryEvent +{ + /// Client environment metadata. + [JsonPropertyName("client")] + public GitHubTelemetryClientInfo? Client { get; set; } + + /// Copilot tracking ID for user-level attribution. + [JsonPropertyName("copilot_tracking_id")] + public string? CopilotTrackingId { get; set; } + + /// Timestamp when the event was created (ISO 8601 format). + [JsonPropertyName("created_at")] + public string? CreatedAt { get; set; } + + /// Experiment assignment context. + [JsonPropertyName("exp_assignment_context")] + public string? ExpAssignmentContext { get; set; } + + /// Feature flags enabled for this session, as a map from flag to value. + [JsonPropertyName("features")] + public IDictionary? Features { get; set; } + + /// Event type/kind (e.g. get_completion_with_tools_turn, tool_call_executed). + [JsonPropertyName("kind")] + public string Kind { get; set; } = string.Empty; + + /// Numeric metrics as a map from key to value. + [JsonPropertyName("metrics")] + public IDictionary Metrics { get => field ??= new Dictionary(); set; } + + /// Reference to the model call that produced this event. + [JsonPropertyName("model_call_id")] + public string? ModelCallId { get; set; } + + /// String-valued properties as a map from key to value. + [JsonPropertyName("properties")] + public IDictionary Properties { get => field ??= new Dictionary(); set; } + + /// Session identifier the event belongs to. + [JsonPropertyName("session_id")] + public string? SessionId { get; set; } +} + +/// Payload for a `gitHubTelemetry.event` notification: a single GitHub telemetry event the runtime forwards to a host connection that opted into telemetry forwarding during the `server.connect` handshake. +[Experimental(Diagnostics.Experimental)] +public sealed class GitHubTelemetryNotification +{ + /// The telemetry event, in the runtime's native GitHub-shaped telemetry format. + [JsonPropertyName("event")] + public GitHubTelemetryEvent Event { get => field ??= new(); set; } + + /// Whether this is a restricted telemetry event (cli.restricted_telemetry). Hosts must route restricted events to first-party Microsoft stores only. + [JsonPropertyName("restricted")] + public bool Restricted { get; set; } + + /// Session the telemetry event belongs to, when it is session-scoped. Omitted for sessionless events (for example, `server.sendTelemetry` calls with no session id), which are still forwarded to opted-in connections. + [JsonPropertyName("sessionId")] + public string? SessionId { get; set; } +} + +/// Resolved Anthropic adaptive-thinking capability for a model. +[Experimental(Diagnostics.Experimental)] +[JsonConverter(typeof(Converter))] +[DebuggerDisplay("{Value,nq}")] +public readonly struct AdaptiveThinkingSupport : IEquatable +{ + private readonly string? _value; + + /// Initializes a new instance of the struct. + /// The value to associate with this . + [JsonConstructor] + public AdaptiveThinkingSupport(string value) + { + ArgumentException.ThrowIfNullOrWhiteSpace(value); + _value = value; + } + + /// Gets the value associated with this . + public string Value => _value ?? string.Empty; + + /// The model does not accept thinking.type='adaptive'. + public static AdaptiveThinkingSupport Unsupported { get; } = new("unsupported"); + + /// The model accepts adaptive thinking but also accepts thinking.type='enabled'. + public static AdaptiveThinkingSupport Optional { get; } = new("optional"); + + /// The model only accepts adaptive thinking and rejects thinking.type='enabled' with HTTP 400 (e.g. opus-4.7/4.8). + public static AdaptiveThinkingSupport Required { get; } = new("required"); + + /// Returns a value indicating whether two instances are equivalent. + public static bool operator ==(AdaptiveThinkingSupport left, AdaptiveThinkingSupport right) => left.Equals(right); + + /// Returns a value indicating whether two instances are not equivalent. + public static bool operator !=(AdaptiveThinkingSupport left, AdaptiveThinkingSupport right) => !(left == right); + + /// + public override bool Equals(object? obj) => obj is AdaptiveThinkingSupport other && Equals(other); + + /// + public bool Equals(AdaptiveThinkingSupport other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); + + /// + public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); + + /// + public override string ToString() => Value; + + /// Provides a for serializing instances. + [EditorBrowsable(EditorBrowsableState.Never)] + public sealed class Converter : JsonConverter + { + /// + public override AdaptiveThinkingSupport Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); + } + + /// + public override void Write(Utf8JsonWriter writer, AdaptiveThinkingSupport value, JsonSerializerOptions options) + { + GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(AdaptiveThinkingSupport)); + } + } +} + + +/// Model capability category for grouping in the model picker. +[Experimental(Diagnostics.Experimental)] +[JsonConverter(typeof(Converter))] +[DebuggerDisplay("{Value,nq}")] +public readonly struct ModelPickerCategory : IEquatable +{ + private readonly string? _value; + + /// Initializes a new instance of the struct. + /// The value to associate with this . + [JsonConstructor] + public ModelPickerCategory(string value) + { + ArgumentException.ThrowIfNullOrWhiteSpace(value); + _value = value; + } + + /// Gets the value associated with this . + public string Value => _value ?? string.Empty; + + /// Lightweight model category optimized for faster, lower-cost interactions. + public static ModelPickerCategory Lightweight { get; } = new("lightweight"); + + /// Versatile model category suitable for a broad range of tasks. + public static ModelPickerCategory Versatile { get; } = new("versatile"); + + /// Powerful model category optimized for complex tasks. + public static ModelPickerCategory Powerful { get; } = new("powerful"); + + /// Returns a value indicating whether two instances are equivalent. + public static bool operator ==(ModelPickerCategory left, ModelPickerCategory right) => left.Equals(right); + + /// Returns a value indicating whether two instances are not equivalent. + public static bool operator !=(ModelPickerCategory left, ModelPickerCategory right) => !(left == right); + + /// + public override bool Equals(object? obj) => obj is ModelPickerCategory other && Equals(other); + + /// + public bool Equals(ModelPickerCategory other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); + + /// + public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); + + /// + public override string ToString() => Value; + + /// Provides a for serializing instances. + [EditorBrowsable(EditorBrowsableState.Never)] + public sealed class Converter : JsonConverter + { + /// + public override ModelPickerCategory Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); + } + + /// + public override void Write(Utf8JsonWriter writer, ModelPickerCategory value, JsonSerializerOptions options) + { + GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(ModelPickerCategory)); + } + } +} + + +/// Relative cost tier for token-based billing users. +[Experimental(Diagnostics.Experimental)] +[JsonConverter(typeof(Converter))] +[DebuggerDisplay("{Value,nq}")] +public readonly struct ModelPickerPriceCategory : IEquatable +{ + private readonly string? _value; + + /// Initializes a new instance of the struct. + /// The value to associate with this . + [JsonConstructor] + public ModelPickerPriceCategory(string value) + { + ArgumentException.ThrowIfNullOrWhiteSpace(value); + _value = value; + } + + /// Gets the value associated with this . + public string Value => _value ?? string.Empty; + + /// Lowest relative token cost tier. + public static ModelPickerPriceCategory Low { get; } = new("low"); + + /// Medium relative token cost tier. + public static ModelPickerPriceCategory Medium { get; } = new("medium"); + + /// High relative token cost tier. + public static ModelPickerPriceCategory High { get; } = new("high"); + + /// Highest relative token cost tier. + public static ModelPickerPriceCategory VeryHigh { get; } = new("very_high"); + + /// Returns a value indicating whether two instances are equivalent. + public static bool operator ==(ModelPickerPriceCategory left, ModelPickerPriceCategory right) => left.Equals(right); + + /// Returns a value indicating whether two instances are not equivalent. + public static bool operator !=(ModelPickerPriceCategory left, ModelPickerPriceCategory right) => !(left == right); + + /// + public override bool Equals(object? obj) => obj is ModelPickerPriceCategory other && Equals(other); + + /// + public bool Equals(ModelPickerPriceCategory other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); -/// Internal filter for consuming queued system notifications. -[Experimental(Diagnostics.Experimental)] -internal sealed class QueueConsumeSystemNotificationsRequest -{ - /// Opaque runtime-owned filter object. - [JsonPropertyName("filter")] - public JsonElement Filter { get; set; } + /// + public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; -} + /// + public override string ToString() => Value; -/// Result of enqueueing the resume-pending wake item. -[Experimental(Diagnostics.Experimental)] -internal sealed class QueueEnqueueResumePendingResult -{ - /// True when a wake item was newly queued. - [JsonPropertyName("queued")] - public bool Queued { get; set; } -} + /// Provides a for serializing instances. + [EditorBrowsable(EditorBrowsableState.Never)] + public sealed class Converter : JsonConverter + { + /// + public override ModelPickerPriceCategory Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); + } -/// Identifies the target session. -[Experimental(Diagnostics.Experimental)] -internal sealed class SessionQueueEnqueueResumePendingRequest -{ - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// + public override void Write(Utf8JsonWriter writer, ModelPickerPriceCategory value, JsonSerializerOptions options) + { + GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(ModelPickerPriceCategory)); + } + } } -/// Identifies the target session. -[Experimental(Diagnostics.Experimental)] -internal sealed class SessionQueueProcessRequest -{ - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; -} -/// Batch of session events returned by a read, with cursor and continuation metadata. +/// Current policy state for this model. [Experimental(Diagnostics.Experimental)] -public sealed class EventsReadResult +[JsonConverter(typeof(Converter))] +[DebuggerDisplay("{Value,nq}")] +public readonly struct ModelPolicyState : IEquatable { - /// 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; + private readonly string? _value; - /// 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; } + /// Initializes a new instance of the struct. + /// The value to associate with this . + [JsonConstructor] + public ModelPolicyState(string value) + { + ArgumentException.ThrowIfNullOrWhiteSpace(value); + _value = value; + } - /// 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; } + /// Gets the value associated with this . + public string Value => _value ?? string.Empty; - /// 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; } -} + /// The model is enabled by policy. + public static ModelPolicyState Enabled { get; } = new("enabled"); -/// Cursor, batch size, and optional long-poll/filter parameters for reading session events. -[Experimental(Diagnostics.Experimental)] -internal sealed class EventLogReadRequest -{ - /// Optional non-empty list of subagent identifiers. When provided, only events owned by one of these agents are returned; ownership recognizes the event envelope's agentId plus legacy data.agentId and data.parentToolCallId markers. This filter takes precedence over agentScope. - [JsonPropertyName("agentIds")] - public IList? AgentIds { get; set; } + /// The model is disabled by policy. + public static ModelPolicyState Disabled { get; } = new("disabled"); - /// Agent-scope filter: 'primary' returns only main-agent events plus events whose type starts with 'subagent.' (matching the typed-subscription default behavior); 'all' returns events from all agents (matching wildcard-subscription behavior). Default is 'all' to preserve wildcard semantics for catch-up callers. - [JsonPropertyName("agentScope")] - public EventsAgentScope? AgentScope { get; set; } + /// No explicit policy is configured for the model. + public static ModelPolicyState Unconfigured { get; } = new("unconfigured"); - /// Opaque cursor returned by a previous read. Omit on the first call to start from the beginning of the session's persisted history. - [JsonPropertyName("cursor")] - public string? Cursor { get; set; } + /// Returns a value indicating whether two instances are equivalent. + public static bool operator ==(ModelPolicyState left, ModelPolicyState right) => left.Equals(right); - /// Direction to page through the session's persisted event history. 'forward' (default) pages from the cursor toward newer events (or from the start of history when no cursor is given). 'backward' enables tail-first reads: with no cursor it returns the NEWEST `max` events, and the returned cursor pages toward OLDER events on subsequent backward reads. Events within a returned batch are always in chronological (oldest-to-newest) order, even for a backward read. Backward reads cover PERSISTED history only; ephemeral events are never returned by a backward read. `direction` selects the INITIAL read only: the returned cursor is self-describing, so a continuation read pages in the cursor's own direction regardless of the `direction` passed alongside it — a forward cursor always pages forward and a backward cursor always pages backward. Pass the direction that matches the cursor to avoid confusion. - [JsonPropertyName("direction")] - public EventsReadDirection? Direction { get; set; } + /// Returns a value indicating whether two instances are not equivalent. + public static bool operator !=(ModelPolicyState left, ModelPolicyState right) => !(left == right); - /// When false, skip ephemeral events entirely and return only durable (persisted) events. History-backfill callers that discard ephemerals anyway should set this so the read is bounded by the durable log length instead of racing the ephemeral ring on a busy session. Defaults to true (ephemerals are interleaved with durable events in creation order). Ignored by backward reads, which always cover persisted history only. - [JsonPropertyName("includeEphemeral")] - public bool? IncludeEphemeral { get; set; } + /// + public override bool Equals(object? obj) => obj is ModelPolicyState other && Equals(other); - /// Maximum number of events to return in this batch (1–1000, default 200). - [JsonPropertyName("max")] - public long? Max { get; set; } + /// + public bool Equals(ModelPolicyState other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// + public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); - /// Either '*' to receive all event types, or a non-empty list of event types to receive. - [JsonPropertyName("types")] - public JsonElement? Types { get; set; } + /// + public override string ToString() => Value; - /// Milliseconds to wait for new events when the cursor is at the tail of history. 0 (default) returns immediately even if no events are available. Capped at 30000ms. Ephemeral events that arrive during the wait are delivered in this batch but are NOT replayable on a subsequent read (use a non-zero waitMs in your next call to capture future ephemerals as they happen). This applies to forward reads only: a backward read always returns immediately and ignores `waitMs`, because backward paging covers persisted history only while new events append at the tail (the opposite end from a backward page), so no blocking or ephemeral delivery can occur. - [JsonConverter(typeof(MillisecondsTimeSpanConverter))] - [JsonPropertyName("waitMs")] - public TimeSpan? Wait { get; set; } -} + /// Provides a for serializing instances. + [EditorBrowsable(EditorBrowsableState.Never)] + public sealed class Converter : JsonConverter + { + /// + public override ModelPolicyState Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); + } -/// Snapshot of the current tail cursor without returning any events. Use this when a consumer wants to subscribe to live events going forward without first paginating through the entire persisted history (which would happen if `read` were called without a cursor on a long-lived session). -[Experimental(Diagnostics.Experimental)] -public sealed class EventLogTailResult -{ - /// Opaque cursor pointing at the current tail of the session's persisted-events history. Pass back to `read` to receive only events that arrive AFTER this snapshot. When the session has no events, this returns the same sentinel as an unset cursor (i.e. equivalent to omitting the cursor on a first read). - [JsonPropertyName("cursor")] - public string Cursor { get; set; } = string.Empty; + /// + public override void Write(Utf8JsonWriter writer, ModelPolicyState value, JsonSerializerOptions options) + { + GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(ModelPolicyState)); + } + } } -/// Identifies the target session. -[Experimental(Diagnostics.Experimental)] -internal sealed class SessionEventLogTailRequest -{ - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; -} -/// Opaque handle representing an event-type interest registration. +/// Server transport type: stdio, http, sse (deprecated), or memory. [Experimental(Diagnostics.Experimental)] -public sealed class RegisterEventInterestResult +[JsonConverter(typeof(Converter))] +[DebuggerDisplay("{Value,nq}")] +public readonly struct DiscoveredMcpServerType : IEquatable { - /// Opaque handle for this registration. Pass to releaseInterest to release. Each call to registerInterest produces a fresh handle, even when the same eventType is registered multiple times. - [JsonPropertyName("handle")] - public string Handle { get; set; } = string.Empty; -} + private readonly string? _value; -/// Event type to register consumer interest for, used by runtime gating logic. -[Experimental(Diagnostics.Experimental)] -internal sealed class RegisterEventInterestParams -{ - /// The event type the consumer wants the runtime to treat as 'observed' for behavior-switching gating. Some runtime code paths inspect whether any consumer is interested in a specific event type and choose a different implementation accordingly (e.g. `mcp.oauth_required`: when interest is registered the runtime delegates interactive OAuth token acquisition to the consumer via `mcp.oauth_required` events; when no interest is registered the runtime still attempts non-interactive reconnect from cached or refreshable tokens, and only marks the server `needs-auth` if usable credentials are unavailable — it does not open a browser or start interactive OAuth without a consumer). SDK clients that long-poll events do NOT automatically appear as listeners to these gating checks — they must explicitly call `registerInterest` for each event type they want the runtime to count as having a consumer. Multiple registrations for the same event type from the same or different consumers are tracked independently and must each be released. See: `mcp.oauth_required`, `sampling.requested`, `auto_mode_switch.requested`, `session_limits_exhausted.requested`, `user_input.requested`, `elicitation.requested`, `command.queued`, `exit_plan_mode.requested`. - [JsonPropertyName("eventType")] - public string EventType { get; set; } = string.Empty; + /// Initializes a new instance of the struct. + /// The value to associate with this . + [JsonConstructor] + public DiscoveredMcpServerType(string value) + { + ArgumentException.ThrowIfNullOrWhiteSpace(value); + _value = value; + } - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; -} + /// Gets the value associated with this . + public string Value => _value ?? string.Empty; -/// Indicates whether the operation succeeded. -[Experimental(Diagnostics.Experimental)] -public sealed class EventLogReleaseInterestResult -{ - /// Whether the operation succeeded. - [JsonPropertyName("success")] - public bool Success { get; set; } -} + /// Server communicates over stdio with a local child process. + public static DiscoveredMcpServerType Stdio { get; } = new("stdio"); -/// Opaque handle previously returned by `registerInterest` to release. -[Experimental(Diagnostics.Experimental)] -internal sealed class ReleaseEventInterestParams -{ - /// Handle returned by a previous `registerInterest` call. Idempotent: releasing an unknown or already-released handle is a no-op (returns success). When the last outstanding handle for an event type is released, the runtime reverts to its 'no consumer' code path for that event type. - [JsonPropertyName("handle")] - public string Handle { get; set; } = string.Empty; + /// Server communicates over streamable HTTP. + public static DiscoveredMcpServerType Http { get; } = new("http"); - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; -} + /// Server communicates over Server-Sent Events (deprecated). + public static DiscoveredMcpServerType Sse { get; } = new("sse"); -/// Request count and cost metrics for this model. -[Experimental(Diagnostics.Experimental)] -public sealed class UsageMetricsModelMetricRequests -{ - /// User-initiated premium request cost (with multiplier applied). - [JsonPropertyName("cost")] - public double Cost { get; set; } + /// Server is backed by an in-memory runtime implementation. + public static DiscoveredMcpServerType Memory { get; } = new("memory"); - /// Number of API requests made with this model. - [JsonPropertyName("count")] - public long Count { get; set; } -} + /// Returns a value indicating whether two instances are equivalent. + public static bool operator ==(DiscoveredMcpServerType left, DiscoveredMcpServerType right) => left.Equals(right); -/// Per-model token-detail entry containing the accumulated token count for one token type. -[Experimental(Diagnostics.Experimental)] -public sealed class UsageMetricsModelMetricTokenDetail -{ - /// Accumulated token count for this token type. - [JsonPropertyName("tokenCount")] - public long TokenCount { get; set; } -} + /// Returns a value indicating whether two instances are not equivalent. + public static bool operator !=(DiscoveredMcpServerType left, DiscoveredMcpServerType right) => !(left == right); -/// Token usage metrics for this model. -[Experimental(Diagnostics.Experimental)] -public sealed class UsageMetricsModelMetricUsage -{ - /// Total tokens read from prompt cache. - [JsonPropertyName("cacheReadTokens")] - public long CacheReadTokens { get; set; } + /// + public override bool Equals(object? obj) => obj is DiscoveredMcpServerType other && Equals(other); - /// Total tokens written to prompt cache. - [JsonPropertyName("cacheWriteTokens")] - public long CacheWriteTokens { get; set; } + /// + public bool Equals(DiscoveredMcpServerType other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); - /// Total input tokens consumed. - [JsonPropertyName("inputTokens")] - public long InputTokens { get; set; } + /// + public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); - /// Total output tokens produced. - [JsonPropertyName("outputTokens")] - public long OutputTokens { get; set; } + /// + public override string ToString() => Value; - /// Total output tokens used for reasoning. - [JsonPropertyName("reasoningTokens")] - public long? ReasoningTokens { get; set; } + /// Provides a for serializing instances. + [EditorBrowsable(EditorBrowsableState.Never)] + public sealed class Converter : JsonConverter + { + /// + public override DiscoveredMcpServerType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); + } + + /// + public override void Write(Utf8JsonWriter writer, DiscoveredMcpServerType value, JsonSerializerOptions options) + { + GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(DiscoveredMcpServerType)); + } + } } -/// Per-model usage metrics, including request counts/costs, token usage, nano-AI units, and per-token-type details. + +/// A wire feature a caller can require of the catalog surface, negotiated per request. A grant means the runtime understands the feature's contract, not that the deployment has enabled the operation; typed unavailable results report availability separately. [Experimental(Diagnostics.Experimental)] -public sealed class UsageMetricsModelMetric +[JsonConverter(typeof(Converter))] +[DebuggerDisplay("{Value,nq}")] +public readonly struct CatalogCapability : IEquatable { - /// Latest known prompt-cache expiration for this model. A timestamp in the past indicates that the observed cache has expired. - [JsonPropertyName("cacheExpiresAt")] - public DateTimeOffset? CacheExpiresAt { get; set; } + private readonly string? _value; - /// Request count and cost metrics for this model. - [JsonPropertyName("requests")] - public UsageMetricsModelMetricRequests Requests { get => field ??= new(); set; } + /// Initializes a new instance of the struct. + /// The value to associate with this . + [JsonConstructor] + public CatalogCapability(string value) + { + ArgumentException.ThrowIfNullOrWhiteSpace(value); + _value = value; + } - /// Token count details per type. - [JsonPropertyName("tokenDetails")] - public IDictionary? TokenDetails { get; set; } + /// Gets the value associated with this . + public string Value => _value ?? string.Empty; - /// Accumulated nano-AI units cost for this model. - [JsonPropertyName("totalNanoAiu")] - public double? TotalNanoAiu { get; set; } + /// Understands the current `application/mcp-server-card+json` media type. + public static CatalogCapability McpServerCard { get; } = new("mcp-server-card"); - /// Token usage metrics for this model. - [JsonPropertyName("usage")] - public UsageMetricsModelMetricUsage Usage { get => field ??= new(); set; } -} + /// Understands the legacy `application/mcp-server+json` media type. + public static CatalogCapability LegacyMcpServerCard { get; } = new("legacy-mcp-server-card"); -/// Usage attributed to one agent instance, including its identity, API duration, AI units, and per-model breakdown. -[Experimental(Diagnostics.Experimental)] -public sealed class UsageMetricsAgentMetric -{ - /// Human-readable label for this subagent invocation, copied from the originating `subagent.started` event. For task-tool subagents this is the invocation's task description rather than the agent's configured display name, so group by `agentName` for stable per-agent labels. - [JsonPropertyName("agentDisplayName")] - public string? AgentDisplayName { get; set; } + /// Understands `application/ai-skill` candidates as discovery-only and typed non-installable. + public static CatalogCapability AiSkillDiscovery { get; } = new("ai-skill-discovery"); - /// Configured agent name, when this is a subagent. - [JsonPropertyName("agentName")] - public string? AgentName { get; set; } + /// Understands side-effect-free MCP install-plan requests, results, and plan handles; `planning-unavailable` separately reports that planning is not enabled. + public static CatalogCapability McpInstallPlanning { get; } = new("mcp-install-planning"); - /// Per-model usage for this agent, keyed by model identifier. - [JsonPropertyName("modelMetrics")] - public IDictionary ModelMetrics { get => field ??= new Dictionary(); set; } + /// Understands plans that enumerate every eligible transport rather than a single preferred one. + public static CatalogCapability MultipleTransportChoice { get; } = new("multiple-transport-choice"); - /// Time spent in model API calls by this agent, in milliseconds. - [JsonConverter(typeof(MillisecondsTimeSpanConverter))] - [JsonPropertyName("totalApiDurationMs")] - public TimeSpan TotalApiDuration { get; set; } + /// Returns a value indicating whether two instances are equivalent. + public static bool operator ==(CatalogCapability left, CatalogCapability right) => left.Equals(right); - /// Accumulated nano-AI units cost for this agent. - [JsonPropertyName("totalNanoAiu")] - public double TotalNanoAiu { get; set; } -} + /// Returns a value indicating whether two instances are not equivalent. + public static bool operator !=(CatalogCapability left, CatalogCapability right) => !(left == right); -/// Aggregated code change metrics. -[Experimental(Diagnostics.Experimental)] -public sealed class UsageMetricsCodeChanges -{ - /// Distinct file paths modified during the session. - [JsonPropertyName("filesModified")] - public IList FilesModified { get => field ??= []; set; } + /// + public override bool Equals(object? obj) => obj is CatalogCapability other && Equals(other); - /// Number of distinct files modified. - [JsonPropertyName("filesModifiedCount")] - public long FilesModifiedCount { get; set; } + /// + public bool Equals(CatalogCapability other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); - /// Total lines of code added. - [JsonPropertyName("linesAdded")] - public long LinesAdded { get; set; } + /// + public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); - /// Total lines of code removed. - [JsonPropertyName("linesRemoved")] - public long LinesRemoved { get; set; } -} + /// + public override string ToString() => Value; -/// Session-wide token-detail entry containing the accumulated token count for one token type. -[Experimental(Diagnostics.Experimental)] -public sealed class UsageMetricsTokenDetail -{ - /// Accumulated token count for this token type. - [JsonPropertyName("tokenCount")] - public long TokenCount { get; set; } + /// Provides a for serializing instances. + [EditorBrowsable(EditorBrowsableState.Never)] + public sealed class Converter : JsonConverter + { + /// + public override CatalogCapability Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); + } + + /// + public override void Write(Utf8JsonWriter writer, CatalogCapability value, JsonSerializerOptions options) + { + GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(CatalogCapability)); + } + } } -/// Accumulated session usage metrics, including premium request cost, token counts, model breakdown, and code-change totals. + +/// Whether a planned configuration change would create or modify an entry. [Experimental(Diagnostics.Experimental)] -public sealed class UsageGetMetricsResult +[JsonConverter(typeof(Converter))] +[DebuggerDisplay("{Value,nq}")] +public readonly struct McpPlanConfigurationOperation : IEquatable { - /// Per-agent usage metrics, keyed by agent instance identifier. The main conversation uses the stable key `main`. - [JsonPropertyName("agentMetrics")] - public IDictionary? AgentMetrics { get; set; } + private readonly string? _value; - /// Aggregated code change metrics. - [JsonPropertyName("codeChanges")] - public UsageMetricsCodeChanges CodeChanges { get => field ??= new(); set; } + /// Initializes a new instance of the struct. + /// The value to associate with this . + [JsonConstructor] + public McpPlanConfigurationOperation(string value) + { + ArgumentException.ThrowIfNullOrWhiteSpace(value); + _value = value; + } - /// Currently active model identifier. - [JsonPropertyName("currentModel")] - public string? CurrentModel { get; set; } + /// Gets the value associated with this . + public string Value => _value ?? string.Empty; - /// Input tokens from the most recent main-agent API call. - [JsonPropertyName("lastCallInputTokens")] - public long LastCallInputTokens { get; set; } + /// Creates a configuration entry that does not exist yet. + public static McpPlanConfigurationOperation Add { get; } = new("add"); - /// Output tokens from the most recent main-agent API call. - [JsonPropertyName("lastCallOutputTokens")] - public long LastCallOutputTokens { get; set; } + /// Modifies a configuration entry that already exists. + public static McpPlanConfigurationOperation Update { get; } = new("update"); - /// Per-model token and request metrics, keyed by model identifier. - [JsonPropertyName("modelMetrics")] - public IDictionary ModelMetrics { get => field ??= new Dictionary(); set; } + /// Returns a value indicating whether two instances are equivalent. + public static bool operator ==(McpPlanConfigurationOperation left, McpPlanConfigurationOperation right) => left.Equals(right); - /// ISO 8601 timestamp when the session started. - [JsonPropertyName("sessionStartTime")] - public DateTimeOffset SessionStartTime { get; set; } + /// Returns a value indicating whether two instances are not equivalent. + public static bool operator !=(McpPlanConfigurationOperation left, McpPlanConfigurationOperation right) => !(left == right); - /// Session-wide per-token-type accumulated token counts. - [JsonPropertyName("tokenDetails")] - public IDictionary? TokenDetails { get; set; } + /// + public override bool Equals(object? obj) => obj is McpPlanConfigurationOperation other && Equals(other); - /// Total time spent in model API calls (milliseconds). - [JsonConverter(typeof(MillisecondsTimeSpanConverter))] - [JsonPropertyName("totalApiDurationMs")] - public TimeSpan TotalApiDuration { get; set; } + /// + public bool Equals(McpPlanConfigurationOperation other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); - /// Session-wide accumulated nano-AI units cost. - [JsonPropertyName("totalNanoAiu")] - public double? TotalNanoAiu { get; set; } + /// + public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); - /// Total user-initiated premium request cost across all models (may be fractional due to multipliers). - [JsonPropertyName("totalPremiumRequestCost")] - public double TotalPremiumRequestCost { get; set; } + /// + public override string ToString() => Value; - /// Raw count of user-initiated API requests. - [JsonPropertyName("totalUserRequests")] - public long TotalUserRequests { get; set; } -} + /// Provides a for serializing instances. + [EditorBrowsable(EditorBrowsableState.Never)] + public sealed class Converter : JsonConverter + { + /// + public override McpPlanConfigurationOperation Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); + } -/// Identifies the target session. -[Experimental(Diagnostics.Experimental)] -internal sealed class SessionUsageGetMetricsRequest -{ - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// + public override void Write(Utf8JsonWriter writer, McpPlanConfigurationOperation value, JsonSerializerOptions options) + { + GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(McpPlanConfigurationOperation)); + } + } } -/// Prediction result. Available results include prediction details; unavailable results include an explicit reason. -/// Polymorphic base type discriminated by kind. + +/// Configuration scope an MCP install plan targets. [Experimental(Diagnostics.Experimental)] -[JsonPolymorphic( - TypeDiscriminatorPropertyName = "kind", - UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToBaseType)] -[JsonDerivedType(typeof(SessionLimitPredictionResultAvailable), "available")] -[JsonDerivedType(typeof(SessionLimitPredictionResultUnavailable), "unavailable")] -public partial class SessionLimitPredictionResult +[JsonConverter(typeof(Converter))] +[DebuggerDisplay("{Value,nq}")] +public readonly struct McpPlanScope : IEquatable { - /// The type discriminator. - [JsonPropertyName("kind")] - public virtual string Kind { get; set; } = string.Empty; -} + private readonly string? _value; + + /// Initializes a new instance of the struct. + /// The value to associate with this . + [JsonConstructor] + public McpPlanScope(string value) + { + ArgumentException.ThrowIfNullOrWhiteSpace(value); + _value = value; + } + /// Gets the value associated with this . + public string Value => _value ?? string.Empty; -/// Baseline data provenance for a prediction. -[Experimental(Diagnostics.Experimental)] -public sealed class SessionLimitPredictionBaselineData -{ - /// End of the baseline data slice. - [JsonPropertyName("windowEnd")] - public string WindowEnd { get; set; } = string.Empty; + /// The user's own MCP configuration. + public static McpPlanScope User { get; } = new("user"); + + /// Returns a value indicating whether two instances are equivalent. + public static bool operator ==(McpPlanScope left, McpPlanScope right) => left.Equals(right); + + /// Returns a value indicating whether two instances are not equivalent. + public static bool operator !=(McpPlanScope left, McpPlanScope right) => !(left == right); + + /// + public override bool Equals(object? obj) => obj is McpPlanScope other && Equals(other); + + /// + public bool Equals(McpPlanScope other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); + + /// + public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); + + /// + public override string ToString() => Value; + + /// Provides a for serializing instances. + [EditorBrowsable(EditorBrowsableState.Never)] + public sealed class Converter : JsonConverter + { + /// + public override McpPlanScope Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); + } - /// Start of the baseline data slice. - [JsonPropertyName("windowStart")] - public string WindowStart { get; set; } = string.Empty; + /// + public override void Write(Utf8JsonWriter writer, McpPlanScope value, JsonSerializerOptions options) + { + GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(McpPlanScope)); + } + } } -/// Semantic usage tier and its AI-credit cap. -[Experimental(Diagnostics.Experimental)] -public sealed class SessionLimitPredictionTierOption -{ - /// AI-credit cap for this tier. - [JsonPropertyName("cap")] - public double Cap { get; set; } - - /// Semantic usage tier. - [JsonPropertyName("tier")] - public SessionLimitPredictionTier Tier { get; set; } -} -/// Explainable AI-credit session-limit prediction. +/// What policy decided for a planned server. [Experimental(Diagnostics.Experimental)] -public sealed class SessionLimitPredictionDetails +[JsonConverter(typeof(Converter))] +[DebuggerDisplay("{Value,nq}")] +public readonly struct McpPlanPolicyDecision : IEquatable { - /// Baseline data provenance. - [JsonPropertyName("baselineData")] - public SessionLimitPredictionBaselineData BaselineData { get => field ??= new(); set; } - - /// Client population used for the prediction. - [JsonPropertyName("clientType")] - public SessionLimitPredictionClientType ClientType { get; set; } + private readonly string? _value; - /// Resolved model family when known. - [JsonPropertyName("family")] - public string? Family { get; set; } + /// Initializes a new instance of the struct. + /// The value to associate with this . + [JsonConstructor] + public McpPlanPolicyDecision(string value) + { + ArgumentException.ThrowIfNullOrWhiteSpace(value); + _value = value; + } - /// Model identifier used for lookup. - [JsonPropertyName("modelId")] - public string ModelId { get; set; } = string.Empty; + /// Gets the value associated with this . + public string Value => _value ?? string.Empty; - /// Recommended maximum AI credits for this session. - [JsonPropertyName("recommendedCap")] - public double RecommendedCap { get; set; } + /// Policy permits the server. + public static McpPlanPolicyDecision Allowed { get; } = new("allowed"); - /// Tier chosen as the recommended cap. - [JsonPropertyName("recommendedTier")] - public SessionLimitPredictionTier RecommendedTier { get; set; } + /// Policy forbids the server, so the plan cannot be applied. + public static McpPlanPolicyDecision Blocked { get; } = new("blocked"); - /// Baseline fallback level used to create the prediction. - [JsonPropertyName("source")] - public SessionLimitPredictionSource Source { get; set; } + /// Policy permits the server only after an explicit approval. + public static McpPlanPolicyDecision RequiresApproval { get; } = new("requires-approval"); - /// Key matched at the source level, such as a model id, family id, or `global`. - [JsonPropertyName("sourceKey")] - public string SourceKey { get; set; } = string.Empty; + /// Returns a value indicating whether two instances are equivalent. + public static bool operator ==(McpPlanPolicyDecision left, McpPlanPolicyDecision right) => left.Equals(right); - /// Ordered usage tiers and their AI-credit caps. - [JsonPropertyName("tiers")] - public IList Tiers { get => field ??= []; set; } -} + /// Returns a value indicating whether two instances are not equivalent. + public static bool operator !=(McpPlanPolicyDecision left, McpPlanPolicyDecision right) => !(left == right); -/// The available variant of . -[Experimental(Diagnostics.Experimental)] -public partial class SessionLimitPredictionResultAvailable : SessionLimitPredictionResult -{ /// - [JsonIgnore] - public override string Kind => "available"; + public override bool Equals(object? obj) => obj is McpPlanPolicyDecision other && Equals(other); - /// Predicted session limit details. - [JsonPropertyName("prediction")] - public required SessionLimitPredictionDetails Prediction { get; set; } -} + /// + public bool Equals(McpPlanPolicyDecision other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); -/// The unavailable variant of . -[Experimental(Diagnostics.Experimental)] -public partial class SessionLimitPredictionResultUnavailable : SessionLimitPredictionResult -{ /// - [JsonIgnore] - public override string Kind => "unavailable"; + public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); - /// Reason no prediction is available. - [JsonPropertyName("reason")] - public required SessionLimitPredictionUnavailableReason Reason { get; set; } -} + /// + public override string ToString() => Value; -/// RPC data type for SessionLimitPredictionPredict operations. -[Experimental(Diagnostics.Experimental)] -public sealed class SessionLimitPredictionPredictRequest -{ - /// Client type to size for. Defaults to `cli-interactive`. - [JsonPropertyName("clientType")] - public SessionLimitPredictionClientType? ClientType { get; set; } + /// Provides a for serializing instances. + [EditorBrowsable(EditorBrowsableState.Never)] + public sealed class Converter : JsonConverter + { + /// + public override McpPlanPolicyDecision Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); + } - /// Optional model identifier override. If omitted, the session's current model is used. - [JsonPropertyName("modelId")] - public string? ModelId { get; set; } + /// + public override void Write(Utf8JsonWriter writer, McpPlanPolicyDecision value, JsonSerializerOptions options) + { + GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(McpPlanPolicyDecision)); + } + } } -/// RPC data type for SessionLimitPredictionPredictRequestWithSession operations. -[Experimental(Diagnostics.Experimental)] -internal sealed class SessionLimitPredictionPredictRequestWithSession -{ - /// Client type to size for. Defaults to `cli-interactive`. - [JsonPropertyName("clientType")] - public SessionLimitPredictionClientType? ClientType { get; set; } - - /// Optional model identifier override. If omitted, the session's current model is used. - [JsonPropertyName("modelId")] - public string? ModelId { get; set; } - - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; -} -/// GitHub URL for the session and a flag indicating whether remote steering is enabled. +/// Which authority produced a policy decision. [Experimental(Diagnostics.Experimental)] -public sealed class RemoteEnableResult +[JsonConverter(typeof(Converter))] +[DebuggerDisplay("{Value,nq}")] +public readonly struct McpPlanPolicySource : IEquatable { - /// Whether remote steering is enabled. - [JsonPropertyName("remoteSteerable")] - public bool RemoteSteerable { get; set; } + private readonly string? _value; - /// GitHub frontend URL for this session. - [Url] - [StringSyntax(StringSyntaxAttribute.Uri)] - [JsonPropertyName("url")] - public string? Url { get; set; } -} + /// Initializes a new instance of the struct. + /// The value to associate with this . + [JsonConstructor] + public McpPlanPolicySource(string value) + { + ArgumentException.ThrowIfNullOrWhiteSpace(value); + _value = value; + } -/// Optional remote session mode ("off", "export", or "on"); defaults to enabling both export and remote steering. -[Experimental(Diagnostics.Experimental)] -internal sealed class RemoteEnableRequest -{ - /// Per-session remote mode. "off" disables remote, "export" exports session events to GitHub without enabling remote steering, "on" enables both export and remote steering. - [JsonPropertyName("mode")] - public RemoteSessionMode? Mode { get; set; } + /// Gets the value associated with this . + public string Value => _value ?? string.Empty; - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; -} + /// No policy applied, so the server is permitted by default. + public static McpPlanPolicySource None { get; } = new("none"); -/// Identifies the target session. -[Experimental(Diagnostics.Experimental)] -internal sealed class SessionRemoteDisableRequest -{ - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; -} + /// An enterprise allowlist evaluated the server. + public static McpPlanPolicySource EnterpriseAllowlist { get; } = new("enterprise-allowlist"); -/// Persist a steerability change as a `session.remote_steerable_changed` event. Used by the host (CLI / SDK consumer) when it has just finished enabling or disabling steering on a remote exporter that the runtime does not directly own. -[Experimental(Diagnostics.Experimental)] -public sealed class RemoteNotifySteerableChangedResult -{ -} + /// The registry the card came from evaluated the server. + public static McpPlanPolicySource RegistryPolicy { get; } = new("registry-policy"); -/// New remote-steerability state to persist as a `session.remote_steerable_changed` event. -[Experimental(Diagnostics.Experimental)] -internal sealed class RemoteNotifySteerableChangedRequest -{ - /// Whether the session now supports remote steering via GitHub. The runtime persists this as a `session.remote_steerable_changed` event so resume/replay sees the up-to-date capability. - [JsonPropertyName("remoteSteerable")] - public bool RemoteSteerable { get; set; } + /// Local trust settings evaluated the server. + public static McpPlanPolicySource LocalTrust { get; } = new("local-trust"); - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; -} + /// Returns a value indicating whether two instances are equivalent. + public static bool operator ==(McpPlanPolicySource left, McpPlanPolicySource right) => left.Equals(right); -/// Current sharing status and shareable GitHub URL for a session. -[Experimental(Diagnostics.Experimental)] -public sealed class VisibilityGetResult -{ - /// Shareable GitHub URL for the session. Present when the session is synced and the URL can be resolved. - [Url] - [StringSyntax(StringSyntaxAttribute.Uri)] - [JsonPropertyName("shareUrl")] - public string? ShareUrl { get; set; } + /// Returns a value indicating whether two instances are not equivalent. + public static bool operator !=(McpPlanPolicySource left, McpPlanPolicySource right) => !(left == right); - /// Current sharing status. Absent when the session is not synced or the status could not be retrieved (e.g. the user is not authenticated). - [JsonPropertyName("status")] - public SessionVisibilityStatus? Status { get; set; } + /// + public override bool Equals(object? obj) => obj is McpPlanPolicySource other && Equals(other); - /// Whether the session has been synced to Mission Control (i.e. has a GitHub task). When false, the session cannot be shared and `status`/`shareUrl` are absent. - [JsonPropertyName("synced")] - public bool Synced { get; set; } -} + /// + public bool Equals(McpPlanPolicySource other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); -/// Identifies the target session. -[Experimental(Diagnostics.Experimental)] -internal sealed class SessionVisibilityGetRequest -{ - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; -} + /// + public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); -/// Effective sharing status and shareable GitHub URL after updating session visibility. -[Experimental(Diagnostics.Experimental)] -public sealed class VisibilitySetResult -{ - /// Shareable GitHub URL for the session. Present when the session is synced and the URL can be resolved. - [Url] - [StringSyntax(StringSyntaxAttribute.Uri)] - [JsonPropertyName("shareUrl")] - public string? ShareUrl { get; set; } + /// + public override string ToString() => Value; - /// Effective sharing status after the update. May differ from the requested status for task types that are already visible to repository readers by default. Absent when the update could not be applied (e.g. the session is not synced or the user is not authenticated). - [JsonPropertyName("status")] - public SessionVisibilityStatus? Status { get; set; } + /// Provides a for serializing instances. + [EditorBrowsable(EditorBrowsableState.Never)] + public sealed class Converter : JsonConverter + { + /// + public override McpPlanPolicySource Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); + } - /// Whether the session has been synced to Mission Control (i.e. has a GitHub task). When false, the visibility change could not be applied and `status`/`shareUrl` are absent. - [JsonPropertyName("synced")] - public bool Synced { get; set; } + /// + public override void Write(Utf8JsonWriter writer, McpPlanPolicySource value, JsonSerializerOptions options) + { + GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(McpPlanPolicySource)); + } + } } -/// Desired sharing status for the session. -[Experimental(Diagnostics.Experimental)] -internal sealed class VisibilitySetRequest -{ - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; - - /// Sharing status to apply. "repo" makes the session visible to repository readers; "unshared" restricts it to the creator and collaborators. - [JsonPropertyName("status")] - public SessionVisibilityStatus Status { get; set; } -} -/// Scheduled prompt entry with ID, timing (`intervalMs`, `cron`, or `at`), prompt text, recurrence, and next run time. +/// Canonical digest algorithm for a validated MCP card. [Experimental(Diagnostics.Experimental)] -public sealed class ScheduleEntry -{ - /// Absolute fire time (epoch milliseconds) for a one-shot calendar schedule. - [JsonPropertyName("at")] - public long? At { get; set; } - - /// 5-field cron expression for a recurring calendar schedule, evaluated in `tz`. - [JsonPropertyName("cron")] - public string? Cron { get; set; } - - /// Display-only label for the prompt as shown in the UI (e.g. `/skill-name` for a skill-invocation schedule). The actual enqueued prompt is `prompt`. - [JsonPropertyName("displayPrompt")] - public string? DisplayPrompt { get; set; } +[JsonConverter(typeof(Converter))] +[DebuggerDisplay("{Value,nq}")] +public readonly struct CardDigestAlgorithm : IEquatable +{ + private readonly string? _value; - /// Sequential id assigned by the runtime within the session. Stable across resumes (rebuilt from the event log). - [JsonPropertyName("id")] - public long Id { get; set; } + /// Initializes a new instance of the struct. + /// The value to associate with this . + [JsonConstructor] + public CardDigestAlgorithm(string value) + { + ArgumentException.ThrowIfNullOrWhiteSpace(value); + _value = value; + } - /// Interval between scheduled ticks, in milliseconds (relative-interval schedules). - [JsonConverter(typeof(MillisecondsTimeSpanConverter))] - [JsonPropertyName("intervalMs")] - public TimeSpan? Interval { get; set; } + /// Gets the value associated with this . + public string Value => _value ?? string.Empty; - /// ISO 8601 timestamp when the next tick is scheduled to fire. - [JsonPropertyName("nextRunAt")] - public DateTimeOffset NextRunAt { get; set; } + /// SHA-256 over RFC 8785 canonical JSON encoded as UTF-8. + public static CardDigestAlgorithm Sha256Rfc8785 { get; } = new("sha256-rfc8785"); - /// Prompt text that gets enqueued on every tick. - [JsonPropertyName("prompt")] - public string Prompt { get; set; } = string.Empty; + /// Returns a value indicating whether two instances are equivalent. + public static bool operator ==(CardDigestAlgorithm left, CardDigestAlgorithm right) => left.Equals(right); - /// Whether the schedule re-arms after each tick (`/every`) or fires once (`/after`). - [JsonPropertyName("recurring")] - public bool Recurring { get; set; } + /// Returns a value indicating whether two instances are not equivalent. + public static bool operator !=(CardDigestAlgorithm left, CardDigestAlgorithm right) => !(left == right); - /// True for a self-paced (`dynamic`) schedule: no fixed cadence; the model arms each next run via the `manage_schedule` `wakeup` action. `nextRunAt` is model-controlled. - [JsonPropertyName("selfPaced")] - public bool? SelfPaced { get; set; } + /// + public override bool Equals(object? obj) => obj is CardDigestAlgorithm other && Equals(other); - /// IANA timezone the `cron` expression is evaluated in. - [JsonPropertyName("tz")] - public string? Tz { get; set; } -} + /// + public bool Equals(CardDigestAlgorithm other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); -/// Snapshot of the currently active recurring prompts for this session. -[Experimental(Diagnostics.Experimental)] -public sealed class ScheduleList -{ - /// Active scheduled prompts, ordered by id. - [JsonPropertyName("entries")] - public IList Entries { get => field ??= []; set; } -} + /// + public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); -/// Identifies the target session. -[Experimental(Diagnostics.Experimental)] -internal sealed class SessionScheduleListRequest -{ - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; -} + /// + public override string ToString() => Value; -/// Identifies the target session. -[Experimental(Diagnostics.Experimental)] -internal sealed class SessionScheduleHydrateRequest -{ - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; -} + /// Provides a for serializing instances. + [EditorBrowsable(EditorBrowsableState.Never)] + public sealed class Converter : JsonConverter + { + /// + public override CardDigestAlgorithm Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); + } -/// Whether the session currently has an active self-paced schedule. -[Experimental(Diagnostics.Experimental)] -internal sealed class ScheduleHasSelfPacedResult -{ - /// True when at least one active schedule is self-paced. - [JsonPropertyName("hasSelfPaced")] - public bool HasSelfPaced { get; set; } + /// + public override void Write(Utf8JsonWriter writer, CardDigestAlgorithm value, JsonSerializerOptions options) + { + GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(CardDigestAlgorithm)); + } + } } -/// Identifies the target session. -[Experimental(Diagnostics.Experimental)] -internal sealed class SessionScheduleHasSelfPacedRequest -{ - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; -} -/// Result of registering or re-arming a scheduled prompt. +/// JSON MCP card media type accepted for install planning. [Experimental(Diagnostics.Experimental)] -internal sealed class ScheduleAddResult +[JsonConverter(typeof(Converter))] +[DebuggerDisplay("{Value,nq}")] +public readonly struct McpServerCardMediaType : IEquatable { - /// The registered or updated schedule entry. - [JsonPropertyName("entry")] - public ScheduleEntry? Entry { get; set; } + private readonly string? _value; - /// User-facing validation error, when registration failed. - [JsonPropertyName("error")] - public string? Error { get; set; } -} + /// Initializes a new instance of the struct. + /// The value to associate with this . + [JsonConstructor] + public McpServerCardMediaType(string value) + { + ArgumentException.ThrowIfNullOrWhiteSpace(value); + _value = value; + } -/// Register a relative-interval scheduled prompt. -[Experimental(Diagnostics.Experimental)] -internal sealed class ScheduleAddRequest -{ - /// Optional display-only prompt label. - [JsonPropertyName("displayPrompt")] - public string? DisplayPrompt { get; set; } + /// Gets the value associated with this . + public string Value => _value ?? string.Empty; - /// Human-readable interval such as `30s`, `5m`, or `2h`. - [JsonPropertyName("interval")] - public string Interval { get; set; } = string.Empty; + /// The current MCP server card media type. + public static McpServerCardMediaType ApplicationMcpServerCardJson { get; } = new("application/mcp-server-card+json"); - /// Prompt text to enqueue when the schedule fires. - [JsonPropertyName("prompt")] - public string Prompt { get; set; } = string.Empty; + /// The legacy MCP server card media type, accepted for compatibility. + public static McpServerCardMediaType ApplicationMcpServerJson { get; } = new("application/mcp-server+json"); - /// Whether the schedule should re-arm after each tick. Defaults to true. - [JsonPropertyName("recurring")] - public bool? Recurring { get; set; } + /// Returns a value indicating whether two instances are equivalent. + public static bool operator ==(McpServerCardMediaType left, McpServerCardMediaType right) => left.Equals(right); - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; -} + /// Returns a value indicating whether two instances are not equivalent. + public static bool operator !=(McpServerCardMediaType left, McpServerCardMediaType right) => !(left == right); -/// Register a cron scheduled prompt. -[Experimental(Diagnostics.Experimental)] -internal sealed class ScheduleAddCronRequest -{ - /// 5-field cron expression. - [JsonPropertyName("cron")] - public string Cron { get; set; } = string.Empty; + /// + public override bool Equals(object? obj) => obj is McpServerCardMediaType other && Equals(other); - /// Optional display-only prompt label. - [JsonPropertyName("displayPrompt")] - public string? DisplayPrompt { get; set; } + /// + public bool Equals(McpServerCardMediaType other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); - /// Prompt text to enqueue when the schedule fires. - [JsonPropertyName("prompt")] - public string Prompt { get; set; } = string.Empty; + /// + public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); - /// Whether the schedule should re-arm after each tick. Defaults to true. - [JsonPropertyName("recurring")] - public bool? Recurring { get; set; } + /// + public override string ToString() => Value; - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// Provides a for serializing instances. + [EditorBrowsable(EditorBrowsableState.Never)] + public sealed class Converter : JsonConverter + { + /// + public override McpServerCardMediaType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); + } - /// IANA timezone for evaluating the cron expression. - [JsonPropertyName("tz")] - public string? Tz { get; set; } + /// + public override void Write(Utf8JsonWriter writer, McpServerCardMediaType value, JsonSerializerOptions options) + { + GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(McpServerCardMediaType)); + } + } } -/// Register an absolute-time scheduled prompt. + +/// Where a required value is applied when the planned server is launched. [Experimental(Diagnostics.Experimental)] -internal sealed class ScheduleAddAtRequest +[JsonConverter(typeof(Converter))] +[DebuggerDisplay("{Value,nq}")] +public readonly struct McpPlanValueCategory : IEquatable { - /// Epoch milliseconds when the prompt should fire. - [JsonPropertyName("at")] - public long At { get; set; } + private readonly string? _value; - /// Optional display-only prompt label. - [JsonPropertyName("displayPrompt")] - public string? DisplayPrompt { get; set; } + /// Initializes a new instance of the struct. + /// The value to associate with this . + [JsonConstructor] + public McpPlanValueCategory(string value) + { + ArgumentException.ThrowIfNullOrWhiteSpace(value); + _value = value; + } - /// Prompt text to enqueue when the schedule fires. - [JsonPropertyName("prompt")] - public string Prompt { get; set; } = string.Empty; + /// Gets the value associated with this . + public string Value => _value ?? string.Empty; - /// Whether the schedule should re-arm after each tick. Defaults to false. - [JsonPropertyName("recurring")] - public bool? Recurring { get; set; } + /// Set as an environment variable on the launched process. + public static McpPlanValueCategory EnvironmentVariable { get; } = new("environment-variable"); - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; -} + /// Passed to the runtime that launches the package. + public static McpPlanValueCategory RuntimeArgument { get; } = new("runtime-argument"); -/// Register a self-paced scheduled prompt. -[Experimental(Diagnostics.Experimental)] -internal sealed class ScheduleAddSelfPacedRequest -{ - /// Optional display-only prompt label. - [JsonPropertyName("displayPrompt")] - public string? DisplayPrompt { get; set; } + /// Passed to the packaged server itself. + public static McpPlanValueCategory PackageArgument { get; } = new("package-argument"); - /// Prompt text to enqueue when the schedule fires. - [JsonPropertyName("prompt")] - public string Prompt { get; set; } = string.Empty; + /// Sent as a request header to a remote endpoint. + public static McpPlanValueCategory Header { get; } = new("header"); - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; -} + /// Substituted into the remote endpoint URL. + public static McpPlanValueCategory UrlVariable { get; } = new("url-variable"); -/// Re-arm a self-paced scheduled prompt. -[Experimental(Diagnostics.Experimental)] -internal sealed class ScheduleRearmSelfPacedRequest -{ - /// Epoch milliseconds when the prompt should next fire. - [JsonPropertyName("at")] - public long At { get; set; } + /// Returns a value indicating whether two instances are equivalent. + public static bool operator ==(McpPlanValueCategory left, McpPlanValueCategory right) => left.Equals(right); - /// Id of the self-paced scheduled prompt. - [JsonPropertyName("id")] - public long Id { get; set; } + /// Returns a value indicating whether two instances are not equivalent. + public static bool operator !=(McpPlanValueCategory left, McpPlanValueCategory right) => !(left == right); - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; -} + /// + public override bool Equals(object? obj) => obj is McpPlanValueCategory other && Equals(other); -/// Remove a scheduled prompt by id. The result entry is omitted if the id was unknown. -[Experimental(Diagnostics.Experimental)] -public sealed class ScheduleStopResult -{ - /// The removed entry, or omitted if no entry matched. - [JsonPropertyName("entry")] - public ScheduleEntry? Entry { get; set; } -} + /// + public bool Equals(McpPlanValueCategory other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); -/// Identifier of the scheduled prompt to remove. -[Experimental(Diagnostics.Experimental)] -internal sealed class ScheduleStopRequest -{ - /// Id of the scheduled prompt to remove. - [JsonPropertyName("id")] - public long Id { get; set; } + /// + public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; -} + /// + public override string ToString() => Value; -/// A bearer token supplied by the SDK client for a BYOK provider. The runtime sets it as `Authorization: Bearer <token>` on the outbound request and does no caching; the SDK consumer owns token caching and refresh. -[Experimental(Diagnostics.Experimental)] -public sealed class ProviderTokenAcquireResult -{ - /// The bearer token value (without the `Bearer ` prefix). - [JsonPropertyName("token")] - public string Token { get; set; } = string.Empty; + /// Provides a for serializing instances. + [EditorBrowsable(EditorBrowsableState.Never)] + public sealed class Converter : JsonConverter + { + /// + public override McpPlanValueCategory Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); + } + + /// + public override void Write(Utf8JsonWriter writer, McpPlanValueCategory value, JsonSerializerOptions options) + { + GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(McpPlanValueCategory)); + } + } } -/// Asks the SDK client to acquire a bearer token for a BYOK provider whose config set `hasBearerTokenProvider: true`. Issued by the runtime before each outbound model request; the runtime does no caching, so this is sent once per request. + +/// Scalar type a required value must conform to. [Experimental(Diagnostics.Experimental)] -public sealed class ProviderTokenAcquireRequest +[JsonConverter(typeof(Converter))] +[DebuggerDisplay("{Value,nq}")] +public readonly struct McpPlanScalarValueType : IEquatable { - /// Name of the BYOK provider needing a token. For the legacy whole-session provider this is the implicit provider name; for named providers it is the configured provider name. - [JsonPropertyName("providerName")] - public string ProviderName { get; set; } = string.Empty; + private readonly string? _value; - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; -} + /// Initializes a new instance of the struct. + /// The value to associate with this . + [JsonConstructor] + public McpPlanScalarValueType(string value) + { + ArgumentException.ThrowIfNullOrWhiteSpace(value); + _value = value; + } -/// Result returned by an extension factory closure. -[Experimental(Diagnostics.Experimental)] -public sealed class FactoryExecuteResult -{ - /// Factory result value. - [JsonPropertyName("result")] - public JsonElement? Result { get; set; } -} + /// Gets the value associated with this . + public string Value => _value ?? string.Empty; -/// Parameters sent to the owning extension to execute a factory closure. -[Experimental(Diagnostics.Experimental)] -public sealed class FactoryExecuteRequest -{ - /// Factory input value. - [JsonPropertyName("args")] - public JsonElement Args { get; set; } + /// Free text. + public static McpPlanScalarValueType String { get; } = new("string"); - /// Opaque token identifying this factory execution attempt. - [JsonPropertyName("executionToken")] - public string ExecutionToken { get; set; } = string.Empty; + /// A number. + public static McpPlanScalarValueType Number { get; } = new("number"); - /// Registered factory name. - [JsonPropertyName("name")] - public string Name { get; set; } = string.Empty; + /// A boolean. + public static McpPlanScalarValueType Boolean { get; } = new("boolean"); - /// Factory run identifier. - [JsonPropertyName("runId")] - public string RunId { get; set; } = string.Empty; + /// A filesystem path. + public static McpPlanScalarValueType Path { get; } = new("path"); - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; -} + /// Returns a value indicating whether two instances are equivalent. + public static bool operator ==(McpPlanScalarValueType left, McpPlanScalarValueType right) => left.Equals(right); -/// Parameters for cooperatively aborting a factory body. -[Experimental(Diagnostics.Experimental)] -public sealed class FactoryAbortRequest -{ - /// Factory run identifier. - [JsonPropertyName("runId")] - public string RunId { get; set; } = string.Empty; + /// Returns a value indicating whether two instances are not equivalent. + public static bool operator !=(McpPlanScalarValueType left, McpPlanScalarValueType right) => !(left == right); - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; -} + /// + public override bool Equals(object? obj) => obj is McpPlanScalarValueType other && Equals(other); -/// Describes a filesystem error. -[Experimental(Diagnostics.Experimental)] -public sealed class SessionFsError -{ - /// Error classification. - [JsonPropertyName("code")] - public SessionFsErrorCode Code { get; set; } + /// + public bool Equals(McpPlanScalarValueType other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); - /// Free-form detail about the error, for logging/diagnostics. - [JsonPropertyName("message")] - public string? Message { get; set; } -} + /// + public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); -/// File content as a UTF-8 string, or a filesystem error if the read failed. -[Experimental(Diagnostics.Experimental)] -public sealed class SessionFsReadFileResult -{ - /// File content as UTF-8 string. - [JsonPropertyName("content")] - public string Content { get; set; } = string.Empty; + /// + public override string ToString() => Value; - /// Describes a filesystem error. - [JsonPropertyName("error")] - public SessionFsError? Error { get; set; } + /// Provides a for serializing instances. + [EditorBrowsable(EditorBrowsableState.Never)] + public sealed class Converter : JsonConverter + { + /// + public override McpPlanScalarValueType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); + } + + /// + public override void Write(Utf8JsonWriter writer, McpPlanScalarValueType value, JsonSerializerOptions options) + { + GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(McpPlanScalarValueType)); + } + } } -/// Path of the file to read from the client-provided session filesystem. + +/// Discriminator for an enumerated required value. [Experimental(Diagnostics.Experimental)] -public sealed class SessionFsReadFileRequest +[JsonConverter(typeof(Converter))] +[DebuggerDisplay("{Value,nq}")] +public readonly struct McpPlanEnumValueType : IEquatable { - /// Path using SessionFs conventions. - [JsonPropertyName("path")] - public string Path { get; set; } = string.Empty; + private readonly string? _value; - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; -} + /// Initializes a new instance of the struct. + /// The value to associate with this . + [JsonConstructor] + public McpPlanEnumValueType(string value) + { + ArgumentException.ThrowIfNullOrWhiteSpace(value); + _value = value; + } -/// File path, content to write, and optional mode for the client-provided session filesystem. -[Experimental(Diagnostics.Experimental)] -public sealed class SessionFsWriteFileRequest -{ - /// Content to write. - [JsonPropertyName("content")] - public string Content { get; set; } = string.Empty; + /// Gets the value associated with this . + public string Value => _value ?? string.Empty; - /// Optional POSIX-style mode for newly created files. - [JsonPropertyName("mode")] - public long? Mode { get; set; } + /// One of a fixed, non-empty set of permitted values. + public static McpPlanEnumValueType Enum { get; } = new("enum"); - /// Path using SessionFs conventions. - [JsonPropertyName("path")] - public string Path { get; set; } = string.Empty; + /// Returns a value indicating whether two instances are equivalent. + public static bool operator ==(McpPlanEnumValueType left, McpPlanEnumValueType right) => left.Equals(right); - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; -} + /// Returns a value indicating whether two instances are not equivalent. + public static bool operator !=(McpPlanEnumValueType left, McpPlanEnumValueType right) => !(left == right); -/// File path, content to append, and optional mode for the client-provided session filesystem. -[Experimental(Diagnostics.Experimental)] -public sealed class SessionFsAppendFileRequest -{ - /// Content to append. - [JsonPropertyName("content")] - public string Content { get; set; } = string.Empty; + /// + public override bool Equals(object? obj) => obj is McpPlanEnumValueType other && Equals(other); - /// Optional POSIX-style mode for newly created files. - [JsonPropertyName("mode")] - public long? Mode { get; set; } + /// + public bool Equals(McpPlanEnumValueType other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); - /// Path using SessionFs conventions. - [JsonPropertyName("path")] - public string Path { get; set; } = string.Empty; + /// + public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; -} + /// + public override string ToString() => Value; -/// Indicates whether the requested path exists in the client-provided session filesystem. -[Experimental(Diagnostics.Experimental)] -public sealed class SessionFsExistsResult -{ - /// Whether the path exists. - [JsonPropertyName("exists")] - public bool Exists { get; set; } + /// Provides a for serializing instances. + [EditorBrowsable(EditorBrowsableState.Never)] + public sealed class Converter : JsonConverter + { + /// + public override McpPlanEnumValueType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); + } + + /// + public override void Write(Utf8JsonWriter writer, McpPlanEnumValueType value, JsonSerializerOptions options) + { + GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(McpPlanEnumValueType)); + } + } } -/// Path to test for existence in the client-provided session filesystem. + +/// Transport exposed by a locally launched package. [Experimental(Diagnostics.Experimental)] -public sealed class SessionFsExistsRequest +[JsonConverter(typeof(Converter))] +[DebuggerDisplay("{Value,nq}")] +public readonly struct McpPlanPackageTransport : IEquatable { - /// Path using SessionFs conventions. - [JsonPropertyName("path")] - public string Path { get; set; } = string.Empty; + private readonly string? _value; - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; -} + /// Initializes a new instance of the struct. + /// The value to associate with this . + [JsonConstructor] + public McpPlanPackageTransport(string value) + { + ArgumentException.ThrowIfNullOrWhiteSpace(value); + _value = value; + } -/// Filesystem metadata for the requested path, or a filesystem error if the stat failed. -[Experimental(Diagnostics.Experimental)] -public sealed class SessionFsStatResult -{ - /// ISO 8601 timestamp of creation. - [JsonPropertyName("birthtime")] - public DateTimeOffset Birthtime { get; set; } + /// Gets the value associated with this . + public string Value => _value ?? string.Empty; - /// Describes a filesystem error. - [JsonPropertyName("error")] - public SessionFsError? Error { get; set; } + /// A locally launched process spoken to over standard input and output. + public static McpPlanPackageTransport Stdio { get; } = new("stdio"); - /// Whether the path is a directory. - [JsonPropertyName("isDirectory")] - public bool IsDirectory { get; set; } + /// Returns a value indicating whether two instances are equivalent. + public static bool operator ==(McpPlanPackageTransport left, McpPlanPackageTransport right) => left.Equals(right); - /// Whether the path is a file. - [JsonPropertyName("isFile")] - public bool IsFile { get; set; } + /// Returns a value indicating whether two instances are not equivalent. + public static bool operator !=(McpPlanPackageTransport left, McpPlanPackageTransport right) => !(left == right); - /// ISO 8601 timestamp of last modification. - [JsonPropertyName("mtime")] - public DateTimeOffset Mtime { get; set; } + /// + public override bool Equals(object? obj) => obj is McpPlanPackageTransport other && Equals(other); - /// File size in bytes. - [JsonPropertyName("size")] - public long Size { get; set; } + /// + public bool Equals(McpPlanPackageTransport other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); + + /// + public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); + + /// + public override string ToString() => Value; + + /// Provides a for serializing instances. + [EditorBrowsable(EditorBrowsableState.Never)] + public sealed class Converter : JsonConverter + { + /// + public override McpPlanPackageTransport Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); + } + + /// + public override void Write(Utf8JsonWriter writer, McpPlanPackageTransport value, JsonSerializerOptions options) + { + GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(McpPlanPackageTransport)); + } + } } -/// Path whose metadata should be returned from the client-provided session filesystem. -[Experimental(Diagnostics.Experimental)] -public sealed class SessionFsStatRequest -{ - /// Path using SessionFs conventions. - [JsonPropertyName("path")] - public string Path { get; set; } = string.Empty; - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; -} +/// Transport exposed by a remote endpoint. +[Experimental(Diagnostics.Experimental)] +[JsonConverter(typeof(Converter))] +[DebuggerDisplay("{Value,nq}")] +public readonly struct McpPlanRemoteTransport : IEquatable +{ + private readonly string? _value; + + /// Initializes a new instance of the struct. + /// The value to associate with this . + [JsonConstructor] + public McpPlanRemoteTransport(string value) + { + ArgumentException.ThrowIfNullOrWhiteSpace(value); + _value = value; + } + + /// Gets the value associated with this . + public string Value => _value ?? string.Empty; + + /// An HTTP endpoint. + public static McpPlanRemoteTransport Http { get; } = new("http"); + + /// A streamable HTTP endpoint. + public static McpPlanRemoteTransport StreamableHttp { get; } = new("streamable-http"); + + /// A server-sent events endpoint. + public static McpPlanRemoteTransport Sse { get; } = new("sse"); -/// Directory path to create in the client-provided session filesystem, with options for recursive creation and POSIX mode. -[Experimental(Diagnostics.Experimental)] -public sealed class SessionFsMkdirRequest -{ - /// Optional POSIX-style mode for newly created directories. - [JsonPropertyName("mode")] - public long? Mode { get; set; } + /// Returns a value indicating whether two instances are equivalent. + public static bool operator ==(McpPlanRemoteTransport left, McpPlanRemoteTransport right) => left.Equals(right); - /// Path using SessionFs conventions. - [JsonPropertyName("path")] - public string Path { get; set; } = string.Empty; + /// Returns a value indicating whether two instances are not equivalent. + public static bool operator !=(McpPlanRemoteTransport left, McpPlanRemoteTransport right) => !(left == right); - /// Create parent directories as needed. - [JsonPropertyName("recursive")] - public bool? Recursive { get; set; } + /// + public override bool Equals(object? obj) => obj is McpPlanRemoteTransport other && Equals(other); - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; -} + /// + public bool Equals(McpPlanRemoteTransport other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); -/// Names of entries in the requested directory, or a filesystem error if the read failed. -[Experimental(Diagnostics.Experimental)] -public sealed class SessionFsReaddirResult -{ - /// Entry names in the directory. - [JsonPropertyName("entries")] - public IList Entries { get => field ??= []; set; } + /// + public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); - /// Describes a filesystem error. - [JsonPropertyName("error")] - public SessionFsError? Error { get; set; } -} + /// + public override string ToString() => Value; -/// Directory path whose entries should be listed from the client-provided session filesystem. -[Experimental(Diagnostics.Experimental)] -public sealed class SessionFsReaddirRequest -{ - /// Path using SessionFs conventions. - [JsonPropertyName("path")] - public string Path { get; set; } = string.Empty; + /// Provides a for serializing instances. + [EditorBrowsable(EditorBrowsableState.Never)] + public sealed class Converter : JsonConverter + { + /// + public override McpPlanRemoteTransport Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); + } - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// + public override void Write(Utf8JsonWriter writer, McpPlanRemoteTransport value, JsonSerializerOptions options) + { + GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(McpPlanRemoteTransport)); + } + } } -/// Directory entry returned by session filesystem `readdirWithTypes`, with name and entry type. + +/// Why capability and protocol-version negotiation refused a caller. [Experimental(Diagnostics.Experimental)] -public sealed class SessionFsReaddirWithTypesEntry +[JsonConverter(typeof(Converter))] +[DebuggerDisplay("{Value,nq}")] +public readonly struct CatalogNegotiationRefusedReason : IEquatable { - /// Entry name. - [JsonPropertyName("name")] - public string Name { get; set; } = string.Empty; + private readonly string? _value; - /// Entry type. - [JsonPropertyName("type")] - public SessionFsReaddirWithTypesEntryType Type { get; set; } -} + /// Initializes a new instance of the struct. + /// The value to associate with this . + [JsonConstructor] + public CatalogNegotiationRefusedReason(string value) + { + ArgumentException.ThrowIfNullOrWhiteSpace(value); + _value = value; + } -/// Entries in the requested directory paired with file/directory type information, or a filesystem error if the read failed. -[Experimental(Diagnostics.Experimental)] -public sealed class SessionFsReaddirWithTypesResult -{ - /// Directory entries with type information. - [JsonPropertyName("entries")] - public IList Entries { get => field ??= []; set; } + /// Gets the value associated with this . + public string Value => _value ?? string.Empty; - /// Describes a filesystem error. - [JsonPropertyName("error")] - public SessionFsError? Error { get; set; } -} + /// The caller's protocol version is below the lowest this runtime serves. + public static CatalogNegotiationRefusedReason UnsupportedProtocolVersion { get; } = new("unsupported-protocol-version"); -/// Directory path whose entries (with type information) should be listed from the client-provided session filesystem. -[Experimental(Diagnostics.Experimental)] -public sealed class SessionFsReaddirWithTypesRequest -{ - /// Path using SessionFs conventions. - [JsonPropertyName("path")] - public string Path { get; set; } = string.Empty; + /// The caller requires at least one capability this runtime cannot honour. + public static CatalogNegotiationRefusedReason UnsupportedCapability { get; } = new("unsupported-capability"); - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; -} + /// Returns a value indicating whether two instances are equivalent. + public static bool operator ==(CatalogNegotiationRefusedReason left, CatalogNegotiationRefusedReason right) => left.Equals(right); -/// Path to remove from the client-provided session filesystem, with options for recursive removal and force. -[Experimental(Diagnostics.Experimental)] -public sealed class SessionFsRmRequest -{ - /// Ignore errors if the path does not exist. - [JsonPropertyName("force")] - public bool? Force { get; set; } + /// Returns a value indicating whether two instances are not equivalent. + public static bool operator !=(CatalogNegotiationRefusedReason left, CatalogNegotiationRefusedReason right) => !(left == right); - /// Path using SessionFs conventions. - [JsonPropertyName("path")] - public string Path { get; set; } = string.Empty; + /// + public override bool Equals(object? obj) => obj is CatalogNegotiationRefusedReason other && Equals(other); - /// Remove directories and their contents recursively. - [JsonPropertyName("recursive")] - public bool? Recursive { get; set; } + /// + public bool Equals(CatalogNegotiationRefusedReason other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; -} + /// + public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); -/// Source and destination paths for renaming or moving an entry in the client-provided session filesystem. -[Experimental(Diagnostics.Experimental)] -public sealed class SessionFsRenameRequest -{ - /// Destination path using SessionFs conventions. - [JsonPropertyName("dest")] - public string Dest { get; set; } = string.Empty; + /// + public override string ToString() => Value; - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// Provides a for serializing instances. + [EditorBrowsable(EditorBrowsableState.Never)] + public sealed class Converter : JsonConverter + { + /// + public override CatalogNegotiationRefusedReason Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); + } - /// Source path using SessionFs conventions. - [JsonPropertyName("src")] - public string Src { get; set; } = string.Empty; + /// + public override void Write(Utf8JsonWriter writer, CatalogNegotiationRefusedReason value, JsonSerializerOptions options) + { + GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(CatalogNegotiationRefusedReason)); + } + } } -/// Query results including rows, columns, and rows affected, or a filesystem error if execution failed. + +/// Which kind of opaque handle was presented. [Experimental(Diagnostics.Experimental)] -public sealed class SessionFsSqliteQueryResult +[JsonConverter(typeof(Converter))] +[DebuggerDisplay("{Value,nq}")] +public readonly struct CatalogHandleType : IEquatable { - /// Column names from the result set. - [JsonPropertyName("columns")] - public IList Columns { get => field ??= []; set; } + private readonly string? _value; - /// Describes a filesystem error. - [JsonPropertyName("error")] - public SessionFsError? Error { get; set; } + /// Initializes a new instance of the struct. + /// The value to associate with this . + [JsonConstructor] + public CatalogHandleType(string value) + { + ArgumentException.ThrowIfNullOrWhiteSpace(value); + _value = value; + } - /// SQLite last_insert_rowid() value for INSERT. - [JsonPropertyName("lastInsertRowid")] - public long? LastInsertRowid { get; set; } + /// Gets the value associated with this . + public string Value => _value ?? string.Empty; - /// For SELECT: array of row objects. For others: empty array. - [JsonPropertyName("rows")] - public IList> Rows { get => field ??= []; set; } + /// A search candidate handle. + public static CatalogHandleType Candidate { get; } = new("candidate"); - /// Number of rows affected (for INSERT/UPDATE/DELETE). - [JsonPropertyName("rowsAffected")] - public long RowsAffected { get; set; } -} + /// An install plan handle. + public static CatalogHandleType Plan { get; } = new("plan"); -/// SQL query, query type, and optional bind parameters for executing a SQLite query against the per-session database. The provider applies its SQLite busy timeout for every call. -[Experimental(Diagnostics.Experimental)] -public sealed class SessionFsSqliteQueryRequest -{ - /// Optional named bind parameters. - [JsonPropertyName("params")] - public IDictionary? Params { get; set; } + /// Returns a value indicating whether two instances are equivalent. + public static bool operator ==(CatalogHandleType left, CatalogHandleType right) => left.Equals(right); - /// SQL query to execute. - [JsonPropertyName("query")] - public string Query { get; set; } = string.Empty; + /// Returns a value indicating whether two instances are not equivalent. + public static bool operator !=(CatalogHandleType left, CatalogHandleType right) => !(left == right); - /// How to execute the query: 'exec' for DDL/multi-statement (no results), 'query' for SELECT (returns rows), 'run' for INSERT/UPDATE/DELETE (returns rowsAffected). - [JsonPropertyName("queryType")] - public SessionFsSqliteQueryType QueryType { get; set; } + /// + public override bool Equals(object? obj) => obj is CatalogHandleType other && Equals(other); - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; -} + /// + public bool Equals(CatalogHandleType other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); -/// Classified SQLite transaction failure. busyOrLocked guarantees rollback; postCommitAmbiguous must never be retried. -[Experimental(Diagnostics.Experimental)] -public sealed class SessionFsSqliteTransactionError -{ - /// Machine-readable classification of the transaction failure. - [JsonPropertyName("errorClass")] - public SessionFsSqliteTransactionErrorClass ErrorClass { get; set; } + /// + public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); - /// Human-readable transaction failure message. - [JsonPropertyName("message")] - public string Message { get; set; } = string.Empty; -} + /// + public override string ToString() => Value; -/// Per-statement results, or a classified transaction error. -[Experimental(Diagnostics.Experimental)] -public sealed class SessionFsSqliteTransactionResult -{ - /// Classified transaction failure, when execution did not succeed. - [JsonPropertyName("error")] - public SessionFsSqliteTransactionError? Error { get; set; } + /// Provides a for serializing instances. + [EditorBrowsable(EditorBrowsableState.Never)] + public sealed class Converter : JsonConverter + { + /// + public override CatalogHandleType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); + } - /// Per-statement query results in input order. - [JsonPropertyName("results")] - public IList Results { get => field ??= []; set; } + /// + public override void Write(Utf8JsonWriter writer, CatalogHandleType value, JsonSerializerOptions options) + { + GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(CatalogHandleType)); + } + } } -/// One statement in an atomic SQLite transaction. + +/// Why a presented handle was rejected. [Experimental(Diagnostics.Experimental)] -public sealed class SessionFsSqliteTransactionStatement +[JsonConverter(typeof(Converter))] +[DebuggerDisplay("{Value,nq}")] +public readonly struct CatalogHandleRejectionReason : IEquatable { - /// Optional named bind parameters. - [JsonPropertyName("params")] - public IDictionary? Params { get; set; } + private readonly string? _value; - /// SQL statement to execute. - [JsonPropertyName("query")] - public string Query { get; set; } = string.Empty; + /// Initializes a new instance of the struct. + /// The value to associate with this . + [JsonConstructor] + public CatalogHandleRejectionReason(string value) + { + ArgumentException.ThrowIfNullOrWhiteSpace(value); + _value = value; + } + + /// Gets the value associated with this . + public string Value => _value ?? string.Empty; + + /// The handle is unparseable, unknown, or was issued for a different operation. + public static CatalogHandleRejectionReason Invalid { get; } = new("invalid"); + + /// The handle's time to live has elapsed. + public static CatalogHandleRejectionReason Stale { get; } = new("stale"); + + /// The handle has already been used, and handles are single-use. + public static CatalogHandleRejectionReason Replayed { get; } = new("replayed"); - /// How to execute the statement. - [JsonPropertyName("queryType")] - public SessionFsSqliteQueryType QueryType { get; set; } -} + /// The handle was issued by a different runtime instance. + public static CatalogHandleRejectionReason Foreign { get; } = new("foreign"); -/// Statements to execute atomically. Providers apply busy handling for every call. -[Experimental(Diagnostics.Experimental)] -public sealed class SessionFsSqliteTransactionRequest -{ - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// Returns a value indicating whether two instances are equivalent. + public static bool operator ==(CatalogHandleRejectionReason left, CatalogHandleRejectionReason right) => left.Equals(right); - /// Ordered SQL statements to execute in one transaction. - [JsonPropertyName("statements")] - public IList Statements { get => field ??= []; set; } -} + /// Returns a value indicating whether two instances are not equivalent. + public static bool operator !=(CatalogHandleRejectionReason left, CatalogHandleRejectionReason right) => !(left == right); -/// Indicates whether the per-session SQLite database already exists. -[Experimental(Diagnostics.Experimental)] -public sealed class SessionFsSqliteExistsResult -{ - /// Whether the session database already exists. - [JsonPropertyName("exists")] - public bool Exists { get; set; } -} + /// + public override bool Equals(object? obj) => obj is CatalogHandleRejectionReason other && Equals(other); -/// Identifies the target session. -public sealed class SessionFsSqliteExistsRequest -{ - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; -} + /// + public bool Equals(CatalogHandleRejectionReason other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); -/// Canvas open result returned by the provider. -[Experimental(Diagnostics.Experimental)] -public sealed class CanvasProviderOpenResult -{ - /// Provider-supplied status text. - [JsonPropertyName("status")] - public string? Status { get; set; } + /// + public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); - /// Provider-supplied title. - [JsonPropertyName("title")] - public string? Title { get; set; } + /// + public override string ToString() => Value; - /// URL for web-rendered canvases. - [JsonPropertyName("url")] - public string? Url { get; set; } -} + /// Provides a for serializing instances. + [EditorBrowsable(EditorBrowsableState.Never)] + public sealed class Converter : JsonConverter + { + /// + public override CatalogHandleRejectionReason Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); + } -/// Host capabilities. -[Experimental(Diagnostics.Experimental)] -public sealed class CanvasHostContextCapabilities -{ - /// Whether canvas rendering is supported. - [JsonPropertyName("canvases")] - public bool? Canvases { get; set; } + /// + public override void Write(Utf8JsonWriter writer, CatalogHandleRejectionReason value, JsonSerializerOptions options) + { + GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(CatalogHandleRejectionReason)); + } + } } -/// Host context supplied by the runtime. -[Experimental(Diagnostics.Experimental)] -public sealed class CanvasHostContext -{ - /// Host capabilities. - [JsonPropertyName("capabilities")] - public CanvasHostContextCapabilities? Capabilities { get; set; } -} -/// Session context supplied by the runtime. +/// Which request field was rejected before any work was done. [Experimental(Diagnostics.Experimental)] -public sealed class CanvasSessionContext +[JsonConverter(typeof(Converter))] +[DebuggerDisplay("{Value,nq}")] +public readonly struct CatalogInvalidRequestField : IEquatable { - /// Active session working directory, when known. - [JsonPropertyName("workingDirectory")] - public string? WorkingDirectory { get; set; } -} + private readonly string? _value; -/// Canvas open parameters sent to the provider. -[Experimental(Diagnostics.Experimental)] -public sealed class CanvasProviderOpenRequest -{ - /// Provider-local canvas identifier. - [JsonPropertyName("canvasId")] - public string CanvasId { get; set; } = string.Empty; + /// Initializes a new instance of the struct. + /// The value to associate with this . + [JsonConstructor] + public CatalogInvalidRequestField(string value) + { + ArgumentException.ThrowIfNullOrWhiteSpace(value); + _value = value; + } - /// Owning provider identifier. - [JsonPropertyName("extensionId")] - public string ExtensionId { get; set; } = string.Empty; + /// Gets the value associated with this . + public string Value => _value ?? string.Empty; - /// Host context supplied by the runtime. - [JsonPropertyName("host")] - public CanvasHostContext? Host { get; set; } + /// The search query was empty or longer than permitted. + public static CatalogInvalidRequestField Query { get; } = new("query"); - /// Canvas open input. - [JsonPropertyName("input")] - public JsonElement? Input { get; set; } + /// The requested result count fell outside its permitted range. + public static CatalogInvalidRequestField Limit { get; } = new("limit"); - /// Stable caller-supplied canvas instance identifier. - [JsonPropertyName("instanceId")] - public string InstanceId { get; set; } = string.Empty; + /// The requested candidate kinds were empty or contained a duplicate. + public static CatalogInvalidRequestField Kinds { get; } = new("kinds"); - /// Session context supplied by the runtime. - [JsonPropertyName("session")] - public CanvasSessionContext? Session { get; set; } + /// The negotiation block was missing or malformed. + public static CatalogInvalidRequestField Contract { get; } = new("contract"); - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; -} + /// The plan source was missing or malformed. + public static CatalogInvalidRequestField Source { get; } = new("source"); -/// Canvas close parameters sent to the provider. -[Experimental(Diagnostics.Experimental)] -public sealed class CanvasProviderCloseRequest -{ - /// Provider-local canvas identifier. - [JsonPropertyName("canvasId")] - public string CanvasId { get; set; } = string.Empty; + /// The supplied card was missing its media type, URL, or data. + public static CatalogInvalidRequestField Card { get; } = new("card"); - /// Owning provider identifier. - [JsonPropertyName("extensionId")] - public string ExtensionId { get; set; } = string.Empty; + /// The requested configuration scope is not one this runtime writes. + public static CatalogInvalidRequestField Scope { get; } = new("scope"); - /// Host context supplied by the runtime. - [JsonPropertyName("host")] - public CanvasHostContext? Host { get; set; } + /// Returns a value indicating whether two instances are equivalent. + public static bool operator ==(CatalogInvalidRequestField left, CatalogInvalidRequestField right) => left.Equals(right); - /// Canvas instance identifier. - [JsonPropertyName("instanceId")] - public string InstanceId { get; set; } = string.Empty; + /// Returns a value indicating whether two instances are not equivalent. + public static bool operator !=(CatalogInvalidRequestField left, CatalogInvalidRequestField right) => !(left == right); - /// Session context supplied by the runtime. - [JsonPropertyName("session")] - public CanvasSessionContext? Session { get; set; } + /// + public override bool Equals(object? obj) => obj is CatalogInvalidRequestField other && Equals(other); - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; + /// + public bool Equals(CatalogInvalidRequestField other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); + + /// + public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); + + /// + public override string ToString() => Value; + + /// Provides a for serializing instances. + [EditorBrowsable(EditorBrowsableState.Never)] + public sealed class Converter : JsonConverter + { + /// + public override CatalogInvalidRequestField Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); + } + + /// + public override void Write(Utf8JsonWriter writer, CatalogInvalidRequestField value, JsonSerializerOptions options) + { + GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(CatalogInvalidRequestField)); + } + } } -/// Canvas action invocation parameters sent to the provider. + +/// Why the catalog authority did not accept the caller's identity. [Experimental(Diagnostics.Experimental)] -public sealed class CanvasProviderInvokeActionRequest +[JsonConverter(typeof(Converter))] +[DebuggerDisplay("{Value,nq}")] +public readonly struct CatalogAuthenticationRequiredReason : IEquatable { - /// Action name to invoke. - [JsonPropertyName("actionName")] - public string ActionName { get; set; } = string.Empty; + private readonly string? _value; - /// Provider-local canvas identifier. - [JsonPropertyName("canvasId")] - public string CanvasId { get; set; } = string.Empty; + /// Initializes a new instance of the struct. + /// The value to associate with this . + [JsonConstructor] + public CatalogAuthenticationRequiredReason(string value) + { + ArgumentException.ThrowIfNullOrWhiteSpace(value); + _value = value; + } - /// Owning provider identifier. - [JsonPropertyName("extensionId")] - public string ExtensionId { get; set; } = string.Empty; + /// Gets the value associated with this . + public string Value => _value ?? string.Empty; - /// Host context supplied by the runtime. - [JsonPropertyName("host")] - public CanvasHostContext? Host { get; set; } + /// No credential was presented, so there is nothing to refresh and the caller must sign in. + public static CatalogAuthenticationRequiredReason NoCredential { get; } = new("no-credential"); - /// Action input. - [JsonPropertyName("input")] - public JsonElement? Input { get; set; } + /// A credential was presented and its lifetime has elapsed. A silent refresh is worth attempting before prompting anyone. + public static CatalogAuthenticationRequiredReason CredentialExpired { get; } = new("credential-expired"); - /// Canvas instance identifier. - [JsonPropertyName("instanceId")] - public string InstanceId { get; set; } = string.Empty; + /// A credential was presented and the authority refused it, for example because it was revoked, malformed, or issued for another audience. Refreshing the same rejected credential is not useful; the caller must sign in again. + public static CatalogAuthenticationRequiredReason CredentialRejected { get; } = new("credential-rejected"); - /// Session context supplied by the runtime. - [JsonPropertyName("session")] - public CanvasSessionContext? Session { get; set; } + /// Returns a value indicating whether two instances are equivalent. + public static bool operator ==(CatalogAuthenticationRequiredReason left, CatalogAuthenticationRequiredReason right) => left.Equals(right); - /// Target session identifier. - [JsonPropertyName("sessionId")] - public string SessionId { get; set; } = string.Empty; -} + /// Returns a value indicating whether two instances are not equivalent. + public static bool operator !=(CatalogAuthenticationRequiredReason left, CatalogAuthenticationRequiredReason right) => !(left == right); -/// Opaque integrator-owned process launch profile for one extension entrypoint. -[Experimental(Diagnostics.Experimental)] -public sealed class ExtensionLaunchProfile -{ - /// Opaque integrator-defined arguments passed to the executable. The runtime does not append the extension entrypoint. - [JsonPropertyName("args")] - public IList Args { get => field ??= []; set; } + /// + public override bool Equals(object? obj) => obj is CatalogAuthenticationRequiredReason other && Equals(other); - /// Opaque integrator-defined environment variables. Runtime-owned COPILOT_SDK_PATH, SESSION_ID, and COPILOT_EXTENSION_PARENT_PID values take precedence. - [JsonPropertyName("env")] - public IDictionary Env { get => field ??= new Dictionary(); set; } + /// + public bool Equals(CatalogAuthenticationRequiredReason other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); - /// Executable used to launch the extension entrypoint. - [UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "Safe for generated string properties: JSON Schema minLength/maxLength map to string length validation, not reflection over trimmed Count members")] - [MinLength(1)] - [JsonPropertyName("executable")] - public string Executable { get; set; } = string.Empty; -} + /// + public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); -/// The launch profile for a supported entrypoint. Omit launch when the provider does not support the entrypoint. -[Experimental(Diagnostics.Experimental)] -public sealed class ExtensionLaunchProviderResolveResult -{ - /// Opaque launch profile, omitted when this provider does not support the entrypoint. - [JsonPropertyName("launch")] - public ExtensionLaunchProfile? Launch { get; set; } + /// + public override string ToString() => Value; + + /// Provides a for serializing instances. + [EditorBrowsable(EditorBrowsableState.Never)] + public sealed class Converter : JsonConverter + { + /// + public override CatalogAuthenticationRequiredReason Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); + } + + /// + public override void Write(Utf8JsonWriter writer, CatalogAuthenticationRequiredReason value, JsonSerializerOptions options) + { + GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(CatalogAuthenticationRequiredReason)); + } + } } -/// A discovered extension entrypoint that the registered integrator may classify and resolve to an opaque launch profile. + +/// Categorised network failure, low cardinality so it can be aggregated without carrying a URL. [Experimental(Diagnostics.Experimental)] -public sealed class ExtensionLaunchProviderResolveRequest +[JsonConverter(typeof(Converter))] +[DebuggerDisplay("{Value,nq}")] +public readonly struct CatalogNetworkFailureReason : IEquatable { - /// Source-qualified extension identifier. - [JsonPropertyName("id")] - public string Id { get; set; } = string.Empty; + private readonly string? _value; - /// Absolute path to the discovered extension entrypoint. - [JsonPropertyName("modulePath")] - public string ModulePath { get; set; } = string.Empty; + /// Initializes a new instance of the struct. + /// The value to associate with this . + [JsonConstructor] + public CatalogNetworkFailureReason(string value) + { + ArgumentException.ThrowIfNullOrWhiteSpace(value); + _value = value; + } + + /// Gets the value associated with this . + public string Value => _value ?? string.Empty; + + /// No network is available, so nothing was attempted. + public static CatalogNetworkFailureReason Offline { get; } = new("offline"); - /// Human-readable extension name. - [JsonPropertyName("name")] - public string Name { get; set; } = string.Empty; + /// The authority's name could not be resolved. + public static CatalogNetworkFailureReason Dns { get; } = new("dns"); - /// Discovery source for the extension entrypoint. - [JsonPropertyName("source")] - public ExtensionSource Source { get; set; } -} + /// The request exceeded its time budget. + public static CatalogNetworkFailureReason Timeout { get; } = new("timeout"); -/// Acknowledgement. Returning successfully simply means the SDK accepted the start frame; it does not imply the request will succeed. -[Experimental(Diagnostics.Experimental)] -public sealed class LlmInferenceHttpRequestStartResult -{ -} + /// The TLS handshake or certificate validation failed. + public static CatalogNetworkFailureReason Tls { get; } = new("tls"); -/// The head of an outbound model-layer HTTP request. -[Experimental(Diagnostics.Experimental)] -public sealed class LlmInferenceHttpRequestStartRequest -{ - /// Stable identity of the agent trajectory that issued this request. Present when the request originates from an agent turn; absent for requests outside any agent context. This is the same identity used by lifecycle and bridged session events and remains constant across turns and retries. - [JsonPropertyName("agentId")] - public string? AgentId { get; set; } + /// The connection was refused or reset. + public static CatalogNetworkFailureReason ConnectionRefused { get; } = new("connection-refused"); - /// Identity of the agent invocation (one agentic loop) that issued this request. It remains fixed across physical retries within the invocation and is distinct from the stable trajectory `agentId`. A caller-supplied invocation id always takes precedence (this covers auxiliary calls that have no model call id). Otherwise, first-party CAPI requests fall back to the runtime's agent task id — the same value the runtime emits as the `X-Agent-Task-Id` header — while custom-provider requests fall back to the model call id. - [JsonPropertyName("agentInvocationId")] - public string? AgentInvocationId { get; set; } + /// The authority returned a status the runtime treats as a failure. + public static CatalogNetworkFailureReason HttpStatus { get; } = new("http-status"); - /// HTTP request headers, preserving multiple values per name. - [JsonPropertyName("headers")] - public IDictionary> Headers { get => field ??= new Dictionary>(); set; } + /// The response exceeded the permitted size. + public static CatalogNetworkFailureReason ResponseTooLarge { get; } = new("response-too-large"); - /// Coarse classification of the interaction that produced this request. Open string for forward-compatibility; known values include `conversation-agent`, `conversation-subagent`, `conversation-sampling`, `conversation-background`, `conversation-compaction`, and `conversation-user`. Absent when the runtime did not classify the request. Comes from the runtime's per-request agent context independently of transport; on the CAPI transport the runtime derives the upstream `X-Interaction-Type` header from this same context. - [JsonPropertyName("interactionType")] - public string? InteractionType { get; set; } + /// A redirect was refused by the runtime's redirect policy. + public static CatalogNetworkFailureReason RedirectRejected { get; } = new("redirect-rejected"); - /// HTTP method, e.g. GET, POST. - [JsonPropertyName("method")] - public string Method { get; set; } = string.Empty; + /// Returns a value indicating whether two instances are equivalent. + public static bool operator ==(CatalogNetworkFailureReason left, CatalogNetworkFailureReason right) => left.Equals(right); - /// Stable identity of the immediate parent trajectory. Present for child trajectories such as subagents and conversation-sampling requests; absent for root-agent and non-agent requests. - [JsonPropertyName("parentAgentId")] - public string? ParentAgentId { get; set; } + /// Returns a value indicating whether two instances are not equivalent. + public static bool operator !=(CatalogNetworkFailureReason left, CatalogNetworkFailureReason right) => !(left == right); - /// Opaque runtime-minted id, unique per in-flight request. The SDK uses this to correlate httpRequestChunk frames and to address its httpResponseStart / httpResponseChunk replies back to the runtime. - [JsonPropertyName("requestId")] - public string RequestId { get; set; } = string.Empty; + /// + public override bool Equals(object? obj) => obj is CatalogNetworkFailureReason other && Equals(other); - /// Id of the runtime session that triggered this request, when one is in scope. Absent for requests issued outside any session (e.g. startup model-catalog or capability resolution). This is a payload field — not a dispatch key — because the client-global API is registered process-wide rather than per session. - [JsonPropertyName("sessionId")] - public string? SessionId { get; set; } + /// + public bool Equals(CatalogNetworkFailureReason other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); - /// Transport the runtime would otherwise use for this request. `http` (the default when absent) covers plain HTTP and SSE responses; `websocket` indicates a full-duplex message channel where each body chunk maps to one WebSocket message and the `binary` flag distinguishes text from binary frames. The SDK consumer uses this to decide whether to service the request with an HTTP client or a WebSocket client. It is the one piece of request metadata the consumer cannot reliably infer from the URL or headers alone. - [JsonPropertyName("transport")] - public LlmInferenceHttpRequestStartTransport? Transport { get; set; } + /// + public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); - /// Absolute request URL. - [JsonPropertyName("url")] - public string Url { get; set; } = string.Empty; -} + /// + public override string ToString() => Value; -/// Acknowledgement. The SDK is free to ignore the ack and treat chunk delivery as fire-and-forget. -[Experimental(Diagnostics.Experimental)] -public sealed class LlmInferenceHttpRequestChunkResult -{ + /// Provides a for serializing instances. + [EditorBrowsable(EditorBrowsableState.Never)] + public sealed class Converter : JsonConverter + { + /// + public override CatalogNetworkFailureReason Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); + } + + /// + public override void Write(Utf8JsonWriter writer, CatalogNetworkFailureReason value, JsonSerializerOptions options) + { + GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(CatalogNetworkFailureReason)); + } + } } -/// A request body chunk or cancellation signal. + +/// Which hardened-fetch control refused a retrieval. [Experimental(Diagnostics.Experimental)] -public sealed class LlmInferenceHttpRequestChunkRequest +[JsonConverter(typeof(Converter))] +[DebuggerDisplay("{Value,nq}")] +public readonly struct CatalogUnsafeRetrievalReason : IEquatable { - /// Identity of the agent invocation (one agentic loop) this body chunk belongs to, matching the `agentInvocationId` semantics on httpRequestStart. Carried per chunk so a persistent transport can attribute successive turns correctly: when a WebSocket connection is reused across turns, the httpRequestStart identity reflects only the turn that opened the connection, so each later turn stamps its own invocation id here. Absent when the runtime has no invocation context for the request, or on the plain-HTTP transport where every request has its own httpRequestStart. - [JsonPropertyName("agentInvocationId")] - public string? AgentInvocationId { get; set; } + private readonly string? _value; - /// When true, `data` is base64-encoded bytes. When absent or false, `data` is UTF-8 text. - [JsonPropertyName("binary")] - public bool? Binary { get; set; } + /// Initializes a new instance of the struct. + /// The value to associate with this . + [JsonConstructor] + public CatalogUnsafeRetrievalReason(string value) + { + ArgumentException.ThrowIfNullOrWhiteSpace(value); + _value = value; + } - /// When true, the runtime is cancelling the in-flight request (e.g. upstream consumer aborted). `data` is ignored. Implies end-of-request. - [JsonPropertyName("cancel")] - public bool? Cancel { get; set; } + /// Gets the value associated with this . + public string Value => _value ?? string.Empty; - /// Optional human-readable reason for the cancellation, propagated for logging. - [JsonPropertyName("cancelReason")] - public string? CancelReason { get; set; } + /// The URL used a scheme the runtime refuses to fetch. + public static CatalogUnsafeRetrievalReason BlockedScheme { get; } = new("blocked-scheme"); - /// Body byte range. UTF-8 text when `binary` is absent or false; base64-encoded bytes when `binary` is true. May be empty. - [JsonPropertyName("data")] - public string Data { get; set; } = string.Empty; + /// The URL embedded credentials. + public static CatalogUnsafeRetrievalReason CredentialsInUrl { get; } = new("credentials-in-url"); - /// When true, this is the final body chunk for the request. The SDK may rely on having received an end-marked chunk before treating the request body as complete. - [JsonPropertyName("end")] - public bool? End { get; set; } + /// The URL resolved to a loopback, private, link-local, or cloud metadata address. + public static CatalogUnsafeRetrievalReason BlockedAddress { get; } = new("blocked-address"); - /// Matches the requestId from the originating httpRequestStart frame. - [JsonPropertyName("requestId")] - public string RequestId { get; set; } = string.Empty; -} + /// A redirect target resolved to a blocked address. + public static CatalogUnsafeRetrievalReason RedirectToBlockedAddress { get; } = new("redirect-to-blocked-address"); -/// Client environment metadata describing the process that produced a telemetry event. -[Experimental(Diagnostics.Experimental)] -public sealed class GitHubTelemetryClientInfo -{ - /// Copilot CLI version string. - [JsonPropertyName("cli_version")] - public string CliVersion { get; set; } = string.Empty; + /// The configured proxy policy refused the request. + public static CatalogUnsafeRetrievalReason ProxyRejected { get; } = new("proxy-rejected"); - /// Name of the client application. - [JsonPropertyName("client_name")] - public string? ClientName { get; set; } + /// The authority is not permitted for card retrieval. + public static CatalogUnsafeRetrievalReason HostNotPermitted { get; } = new("host-not-permitted"); - /// Type of client. - [JsonPropertyName("client_type")] - public string? ClientType { get; set; } + /// Returns a value indicating whether two instances are equivalent. + public static bool operator ==(CatalogUnsafeRetrievalReason left, CatalogUnsafeRetrievalReason right) => left.Equals(right); - /// Copilot subscription plan, when known. - [JsonPropertyName("copilot_plan")] - public string? CopilotPlan { get; set; } + /// Returns a value indicating whether two instances are not equivalent. + public static bool operator !=(CatalogUnsafeRetrievalReason left, CatalogUnsafeRetrievalReason right) => !(left == right); - /// Stable machine identifier for the device. - [JsonPropertyName("dev_device_id")] - public string? DevDeviceId { get; set; } + /// + public override bool Equals(object? obj) => obj is CatalogUnsafeRetrievalReason other && Equals(other); - /// Whether the user is a GitHub/Microsoft staff member. - [JsonPropertyName("is_staff")] - public bool? IsStaff { get; set; } + /// + public bool Equals(CatalogUnsafeRetrievalReason other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); - /// Node.js runtime version string. - [JsonPropertyName("node_version")] - public string NodeVersion { get; set; } = string.Empty; + /// + public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); - /// Operating system architecture (e.g. arm64, x64). - [JsonPropertyName("os_arch")] - public string OsArch { get; set; } = string.Empty; + /// + public override string ToString() => Value; - /// Operating system platform (e.g. darwin, linux, win32). - [JsonPropertyName("os_platform")] - public string OsPlatform { get; set; } = string.Empty; + /// Provides a for serializing instances. + [EditorBrowsable(EditorBrowsableState.Never)] + public sealed class Converter : JsonConverter + { + /// + public override CatalogUnsafeRetrievalReason Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); + } - /// Operating system version string. - [JsonPropertyName("os_version")] - public string OsVersion { get; set; } = string.Empty; + /// + public override void Write(Utf8JsonWriter writer, CatalogUnsafeRetrievalReason value, JsonSerializerOptions options) + { + GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(CatalogUnsafeRetrievalReason)); + } + } } -/// A single telemetry event in the runtime's native GitHub-shaped telemetry format, forwarded verbatim to opted-in hosts. The `restricted` flag on the enclosing GitHubTelemetryNotification distinguishes standard from restricted events; the payload shape is identical for both. + +/// Media type a catalog card is interpreted as. [Experimental(Diagnostics.Experimental)] -public sealed class GitHubTelemetryEvent +[JsonConverter(typeof(Converter))] +[DebuggerDisplay("{Value,nq}")] +public readonly struct CatalogMediaType : IEquatable { - /// Client environment metadata. - [JsonPropertyName("client")] - public GitHubTelemetryClientInfo? Client { get; set; } + private readonly string? _value; - /// Copilot tracking ID for user-level attribution. - [JsonPropertyName("copilot_tracking_id")] - public string? CopilotTrackingId { get; set; } + /// Initializes a new instance of the struct. + /// The value to associate with this . + [JsonConstructor] + public CatalogMediaType(string value) + { + ArgumentException.ThrowIfNullOrWhiteSpace(value); + _value = value; + } - /// Timestamp when the event was created (ISO 8601 format). - [JsonPropertyName("created_at")] - public string? CreatedAt { get; set; } + /// Gets the value associated with this . + public string Value => _value ?? string.Empty; - /// Experiment assignment context. - [JsonPropertyName("exp_assignment_context")] - public string? ExpAssignmentContext { get; set; } + /// The current MCP server card media type. + public static CatalogMediaType ApplicationMcpServerCardJson { get; } = new("application/mcp-server-card+json"); - /// Feature flags enabled for this session, as a map from flag to value. - [JsonPropertyName("features")] - public IDictionary? Features { get; set; } + /// The legacy MCP server card media type, accepted for compatibility. + public static CatalogMediaType ApplicationMcpServerJson { get; } = new("application/mcp-server+json"); - /// Event type/kind (e.g. get_completion_with_tools_turn, tool_call_executed). - [JsonPropertyName("kind")] - public string Kind { get; set; } = string.Empty; + /// An AI skill card. Representable and searchable, but typed non-installable. + public static CatalogMediaType ApplicationAiSkill { get; } = new("application/ai-skill"); - /// Numeric metrics as a map from key to value. - [JsonPropertyName("metrics")] - public IDictionary Metrics { get => field ??= new Dictionary(); set; } + /// Returns a value indicating whether two instances are equivalent. + public static bool operator ==(CatalogMediaType left, CatalogMediaType right) => left.Equals(right); - /// Reference to the model call that produced this event. - [JsonPropertyName("model_call_id")] - public string? ModelCallId { get; set; } + /// Returns a value indicating whether two instances are not equivalent. + public static bool operator !=(CatalogMediaType left, CatalogMediaType right) => !(left == right); - /// String-valued properties as a map from key to value. - [JsonPropertyName("properties")] - public IDictionary Properties { get => field ??= new Dictionary(); set; } + /// + public override bool Equals(object? obj) => obj is CatalogMediaType other && Equals(other); - /// Session identifier the event belongs to. - [JsonPropertyName("session_id")] - public string? SessionId { get; set; } -} + /// + public bool Equals(CatalogMediaType other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); -/// Payload for a `gitHubTelemetry.event` notification: a single GitHub telemetry event the runtime forwards to a host connection that opted into telemetry forwarding during the `server.connect` handshake. -[Experimental(Diagnostics.Experimental)] -public sealed class GitHubTelemetryNotification -{ - /// The telemetry event, in the runtime's native GitHub-shaped telemetry format. - [JsonPropertyName("event")] - public GitHubTelemetryEvent Event { get => field ??= new(); set; } + /// + public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); - /// Whether this is a restricted telemetry event (cli.restricted_telemetry). Hosts must route restricted events to first-party Microsoft stores only. - [JsonPropertyName("restricted")] - public bool Restricted { get; set; } + /// + public override string ToString() => Value; - /// Session the telemetry event belongs to, when it is session-scoped. Omitted for sessionless events (for example, `server.sendTelemetry` calls with no session id), which are still forwarded to opted-in connections. - [JsonPropertyName("sessionId")] - public string? SessionId { get; set; } + /// Provides a for serializing instances. + [EditorBrowsable(EditorBrowsableState.Never)] + public sealed class Converter : JsonConverter + { + /// + public override CatalogMediaType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); + } + + /// + public override void Write(Utf8JsonWriter writer, CatalogMediaType value, JsonSerializerOptions options) + { + GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(CatalogMediaType)); + } + } } -/// Resolved Anthropic adaptive-thinking capability for a model. + +/// How a card failed validation. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] -public readonly struct AdaptiveThinkingSupport : IEquatable +public readonly struct CatalogMalformedCardReason : IEquatable { private readonly string? _value; - /// Initializes a new instance of the struct. - /// The value to associate with this . + /// Initializes a new instance of the struct. + /// The value to associate with this . [JsonConstructor] - public AdaptiveThinkingSupport(string value) + public CatalogMalformedCardReason(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } - /// Gets the value associated with this . + /// Gets the value associated with this . public string Value => _value ?? string.Empty; - /// The model does not accept thinking.type='adaptive'. - public static AdaptiveThinkingSupport Unsupported { get; } = new("unsupported"); + /// The document is not well-formed JSON. + public static CatalogMalformedCardReason InvalidJson { get; } = new("invalid-json"); - /// The model accepts adaptive thinking but also accepts thinking.type='enabled'. - public static AdaptiveThinkingSupport Optional { get; } = new("optional"); + /// The document does not satisfy its media type's schema. + public static CatalogMalformedCardReason SchemaViolation { get; } = new("schema-violation"); - /// The model only accepts adaptive thinking and rejects thinking.type='enabled' with HTTP 400 (e.g. opus-4.7/4.8). - public static AdaptiveThinkingSupport Required { get; } = new("required"); + /// The declared media type is not one this runtime understands. + public static CatalogMalformedCardReason UnsupportedMediaType { get; } = new("unsupported-media-type"); - /// Returns a value indicating whether two instances are equivalent. - public static bool operator ==(AdaptiveThinkingSupport left, AdaptiveThinkingSupport right) => left.Equals(right); + /// A field the media type requires is absent. + public static CatalogMalformedCardReason MissingRequiredField { get; } = new("missing-required-field"); - /// Returns a value indicating whether two instances are not equivalent. - public static bool operator !=(AdaptiveThinkingSupport left, AdaptiveThinkingSupport right) => !(left == right); + /// The document exceeded the permitted size. + public static CatalogMalformedCardReason SizeLimitExceeded { get; } = new("size-limit-exceeded"); + + /// Returns a value indicating whether two instances are equivalent. + public static bool operator ==(CatalogMalformedCardReason left, CatalogMalformedCardReason right) => left.Equals(right); + + /// Returns a value indicating whether two instances are not equivalent. + public static bool operator !=(CatalogMalformedCardReason left, CatalogMalformedCardReason right) => !(left == right); /// - public override bool Equals(object? obj) => obj is AdaptiveThinkingSupport other && Equals(other); + public override bool Equals(object? obj) => obj is CatalogMalformedCardReason other && Equals(other); /// - public bool Equals(AdaptiveThinkingSupport other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); + public bool Equals(CatalogMalformedCardReason other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); /// public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); @@ -16936,65 +20031,68 @@ public AdaptiveThinkingSupport(string value) /// public override string ToString() => Value; - /// Provides a for serializing instances. + /// Provides a for serializing instances. [EditorBrowsable(EditorBrowsableState.Never)] - public sealed class Converter : JsonConverter + public sealed class Converter : JsonConverter { /// - public override AdaptiveThinkingSupport Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override CatalogMalformedCardReason Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// - public override void Write(Utf8JsonWriter writer, AdaptiveThinkingSupport value, JsonSerializerOptions options) + public override void Write(Utf8JsonWriter writer, CatalogMalformedCardReason value, JsonSerializerOptions options) { - GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(AdaptiveThinkingSupport)); + GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(CatalogMalformedCardReason)); } } } -/// Model capability category for grouping in the model picker. +/// Which wire-contract rule an upstream response broke. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] -public readonly struct ModelPickerCategory : IEquatable +public readonly struct CatalogContractViolationReason : IEquatable { private readonly string? _value; - /// Initializes a new instance of the struct. - /// The value to associate with this . + /// Initializes a new instance of the struct. + /// The value to associate with this . [JsonConstructor] - public ModelPickerCategory(string value) + public CatalogContractViolationReason(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } - /// Gets the value associated with this . + /// Gets the value associated with this . public string Value => _value ?? string.Empty; - /// Lightweight model category optimized for faster, lower-cost interactions. - public static ModelPickerCategory Lightweight { get; } = new("lightweight"); + /// A result carried both a URL and embedded data, when exactly one is permitted. + public static CatalogContractViolationReason BothUrlAndData { get; } = new("both-url-and-data"); - /// Versatile model category suitable for a broad range of tasks. - public static ModelPickerCategory Versatile { get; } = new("versatile"); + /// A result carried neither a URL nor embedded data, when exactly one is required. + public static CatalogContractViolationReason NeitherUrlNorData { get; } = new("neither-url-nor-data"); - /// Powerful model category optimized for complex tasks. - public static ModelPickerCategory Powerful { get; } = new("powerful"); + /// Two results claimed the same normalised identity. + public static CatalogContractViolationReason DuplicateIdentity { get; } = new("duplicate-identity"); - /// Returns a value indicating whether two instances are equivalent. - public static bool operator ==(ModelPickerCategory left, ModelPickerCategory right) => left.Equals(right); + /// A result declared no media type, or one this contract does not model. + public static CatalogContractViolationReason UnknownMediaType { get; } = new("unknown-media-type"); - /// Returns a value indicating whether two instances are not equivalent. - public static bool operator !=(ModelPickerCategory left, ModelPickerCategory right) => !(left == right); + /// Returns a value indicating whether two instances are equivalent. + public static bool operator ==(CatalogContractViolationReason left, CatalogContractViolationReason right) => left.Equals(right); + + /// Returns a value indicating whether two instances are not equivalent. + public static bool operator !=(CatalogContractViolationReason left, CatalogContractViolationReason right) => !(left == right); /// - public override bool Equals(object? obj) => obj is ModelPickerCategory other && Equals(other); + public override bool Equals(object? obj) => obj is CatalogContractViolationReason other && Equals(other); /// - public bool Equals(ModelPickerCategory other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); + public bool Equals(CatalogContractViolationReason other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); /// public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); @@ -17002,68 +20100,65 @@ public ModelPickerCategory(string value) /// public override string ToString() => Value; - /// Provides a for serializing instances. + /// Provides a for serializing instances. [EditorBrowsable(EditorBrowsableState.Never)] - public sealed class Converter : JsonConverter + public sealed class Converter : JsonConverter { /// - public override ModelPickerCategory Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override CatalogContractViolationReason Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// - public override void Write(Utf8JsonWriter writer, ModelPickerCategory value, JsonSerializerOptions options) + public override void Write(Utf8JsonWriter writer, CatalogContractViolationReason value, JsonSerializerOptions options) { - GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(ModelPickerCategory)); + GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(CatalogContractViolationReason)); } } } -/// Relative cost tier for token-based billing users. +/// Why no usable transport could be offered. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] -public readonly struct ModelPickerPriceCategory : IEquatable +public readonly struct CatalogUnavailableTransportReason : IEquatable { private readonly string? _value; - /// Initializes a new instance of the struct. - /// The value to associate with this . + /// Initializes a new instance of the struct. + /// The value to associate with this . [JsonConstructor] - public ModelPickerPriceCategory(string value) + public CatalogUnavailableTransportReason(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } - /// Gets the value associated with this . + /// Gets the value associated with this . public string Value => _value ?? string.Empty; - /// Lowest relative token cost tier. - public static ModelPickerPriceCategory Low { get; } = new("low"); - - /// Medium relative token cost tier. - public static ModelPickerPriceCategory Medium { get; } = new("medium"); + /// The card advertises no transport this runtime can use. + public static CatalogUnavailableTransportReason NoEligibleTransport { get; } = new("no-eligible-transport"); - /// High relative token cost tier. - public static ModelPickerPriceCategory High { get; } = new("high"); + /// Every advertised transport is of a kind this runtime does not implement. + public static CatalogUnavailableTransportReason TransportNotSupported { get; } = new("transport-not-supported"); - /// Highest relative token cost tier. - public static ModelPickerPriceCategory VeryHigh { get; } = new("very_high"); + /// Eligible remotes could not be enumerated, so no explicit choice can be offered. + public static CatalogUnavailableTransportReason RemoteEnumerationUnavailable { get; } = new("remote-enumeration-unavailable"); - /// Returns a value indicating whether two instances are equivalent. - public static bool operator ==(ModelPickerPriceCategory left, ModelPickerPriceCategory right) => left.Equals(right); + /// Returns a value indicating whether two instances are equivalent. + public static bool operator ==(CatalogUnavailableTransportReason left, CatalogUnavailableTransportReason right) => left.Equals(right); - /// Returns a value indicating whether two instances are not equivalent. - public static bool operator !=(ModelPickerPriceCategory left, ModelPickerPriceCategory right) => !(left == right); + /// Returns a value indicating whether two instances are not equivalent. + public static bool operator !=(CatalogUnavailableTransportReason left, CatalogUnavailableTransportReason right) => !(left == right); /// - public override bool Equals(object? obj) => obj is ModelPickerPriceCategory other && Equals(other); + public override bool Equals(object? obj) => obj is CatalogUnavailableTransportReason other && Equals(other); /// - public bool Equals(ModelPickerPriceCategory other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); + public bool Equals(CatalogUnavailableTransportReason other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); /// public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); @@ -17071,65 +20166,65 @@ public ModelPickerPriceCategory(string value) /// public override string ToString() => Value; - /// Provides a for serializing instances. + /// Provides a for serializing instances. [EditorBrowsable(EditorBrowsableState.Never)] - public sealed class Converter : JsonConverter + public sealed class Converter : JsonConverter { /// - public override ModelPickerPriceCategory Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override CatalogUnavailableTransportReason Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// - public override void Write(Utf8JsonWriter writer, ModelPickerPriceCategory value, JsonSerializerOptions options) + public override void Write(Utf8JsonWriter writer, CatalogUnavailableTransportReason value, JsonSerializerOptions options) { - GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(ModelPickerPriceCategory)); + GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(CatalogUnavailableTransportReason)); } } } -/// Current policy state for this model. +/// Why a discoverable candidate cannot be installed. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] -public readonly struct ModelPolicyState : IEquatable +public readonly struct CatalogNotInstallableReason : IEquatable { private readonly string? _value; - /// Initializes a new instance of the struct. - /// The value to associate with this . + /// Initializes a new instance of the struct. + /// The value to associate with this . [JsonConstructor] - public ModelPolicyState(string value) + public CatalogNotInstallableReason(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } - /// Gets the value associated with this . + /// Gets the value associated with this . public string Value => _value ?? string.Empty; - /// The model is enabled by policy. - public static ModelPolicyState Enabled { get; } = new("enabled"); + /// This kind of resource is not installable through this surface. + public static CatalogNotInstallableReason KindNotInstallable { get; } = new("kind-not-installable"); - /// The model is disabled by policy. - public static ModelPolicyState Disabled { get; } = new("disabled"); + /// AI skills are discoverable but have no typed importer in this phase. + public static CatalogNotInstallableReason AiSkillNotInstallable { get; } = new("ai-skill-not-installable"); - /// No explicit policy is configured for the model. - public static ModelPolicyState Unconfigured { get; } = new("unconfigured"); + /// Policy forbids installing this candidate. + public static CatalogNotInstallableReason PolicyForbids { get; } = new("policy-forbids"); - /// Returns a value indicating whether two instances are equivalent. - public static bool operator ==(ModelPolicyState left, ModelPolicyState right) => left.Equals(right); + /// Returns a value indicating whether two instances are equivalent. + public static bool operator ==(CatalogNotInstallableReason left, CatalogNotInstallableReason right) => left.Equals(right); - /// Returns a value indicating whether two instances are not equivalent. - public static bool operator !=(ModelPolicyState left, ModelPolicyState right) => !(left == right); + /// Returns a value indicating whether two instances are not equivalent. + public static bool operator !=(CatalogNotInstallableReason left, CatalogNotInstallableReason right) => !(left == right); /// - public override bool Equals(object? obj) => obj is ModelPolicyState other && Equals(other); + public override bool Equals(object? obj) => obj is CatalogNotInstallableReason other && Equals(other); /// - public bool Equals(ModelPolicyState other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); + public bool Equals(CatalogNotInstallableReason other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); /// public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); @@ -17137,68 +20232,68 @@ public ModelPolicyState(string value) /// public override string ToString() => Value; - /// Provides a for serializing instances. + /// Provides a for serializing instances. [EditorBrowsable(EditorBrowsableState.Never)] - public sealed class Converter : JsonConverter + public sealed class Converter : JsonConverter { /// - public override ModelPolicyState Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override CatalogNotInstallableReason Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// - public override void Write(Utf8JsonWriter writer, ModelPolicyState value, JsonSerializerOptions options) + public override void Write(Utf8JsonWriter writer, CatalogNotInstallableReason value, JsonSerializerOptions options) { - GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(ModelPolicyState)); + GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(CatalogNotInstallableReason)); } } } -/// Server transport type: stdio, http, sse (deprecated), or memory. +/// Why a catalog operation is not available on this runtime. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] -public readonly struct DiscoveredMcpServerType : IEquatable +public readonly struct CatalogUnavailableReason : IEquatable { private readonly string? _value; - /// Initializes a new instance of the struct. - /// The value to associate with this . + /// Initializes a new instance of the struct. + /// The value to associate with this . [JsonConstructor] - public DiscoveredMcpServerType(string value) + public CatalogUnavailableReason(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } - /// Gets the value associated with this . + /// Gets the value associated with this . public string Value => _value ?? string.Empty; - /// Server communicates over stdio with a local child process. - public static DiscoveredMcpServerType Stdio { get; } = new("stdio"); + /// Bounded search is not wired up on this runtime build. + public static CatalogUnavailableReason SearchUnavailable { get; } = new("search-unavailable"); - /// Server communicates over streamable HTTP. - public static DiscoveredMcpServerType Http { get; } = new("http"); + /// Install planning is not wired up on this runtime build. + public static CatalogUnavailableReason PlanningUnavailable { get; } = new("planning-unavailable"); - /// Server communicates over Server-Sent Events (deprecated). - public static DiscoveredMcpServerType Sse { get; } = new("sse"); + /// No catalog authority is configured for this runtime. + public static CatalogUnavailableReason AuthorityNotConfigured { get; } = new("authority-not-configured"); - /// Server is backed by an in-memory runtime implementation. - public static DiscoveredMcpServerType Memory { get; } = new("memory"); + /// The surface is disabled by policy on this runtime. + public static CatalogUnavailableReason DisabledByPolicy { get; } = new("disabled-by-policy"); - /// Returns a value indicating whether two instances are equivalent. - public static bool operator ==(DiscoveredMcpServerType left, DiscoveredMcpServerType right) => left.Equals(right); + /// Returns a value indicating whether two instances are equivalent. + public static bool operator ==(CatalogUnavailableReason left, CatalogUnavailableReason right) => left.Equals(right); - /// Returns a value indicating whether two instances are not equivalent. - public static bool operator !=(DiscoveredMcpServerType left, DiscoveredMcpServerType right) => !(left == right); + /// Returns a value indicating whether two instances are not equivalent. + public static bool operator !=(CatalogUnavailableReason left, CatalogUnavailableReason right) => !(left == right); /// - public override bool Equals(object? obj) => obj is DiscoveredMcpServerType other && Equals(other); + public override bool Equals(object? obj) => obj is CatalogUnavailableReason other && Equals(other); /// - public bool Equals(DiscoveredMcpServerType other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); + public bool Equals(CatalogUnavailableReason other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); /// public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); @@ -17206,20 +20301,20 @@ public DiscoveredMcpServerType(string value) /// public override string ToString() => Value; - /// Provides a for serializing instances. + /// Provides a for serializing instances. [EditorBrowsable(EditorBrowsableState.Never)] - public sealed class Converter : JsonConverter + public sealed class Converter : JsonConverter { /// - public override DiscoveredMcpServerType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override CatalogUnavailableReason Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// - public override void Write(Utf8JsonWriter writer, DiscoveredMcpServerType value, JsonSerializerOptions options) + public override void Write(Utf8JsonWriter writer, CatalogUnavailableReason value, JsonSerializerOptions options) { - GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(DiscoveredMcpServerType)); + GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(CatalogUnavailableReason)); } } } @@ -17354,6 +20449,132 @@ public override void Write(Utf8JsonWriter writer, DiscoveredExtensionMode value, } +/// Whether an MCP server candidate can be planned for installation. +[Experimental(Diagnostics.Experimental)] +[JsonConverter(typeof(Converter))] +[DebuggerDisplay("{Value,nq}")] +public readonly struct CatalogMcpServerInstallability : IEquatable +{ + private readonly string? _value; + + /// Initializes a new instance of the struct. + /// The value to associate with this . + [JsonConstructor] + public CatalogMcpServerInstallability(string value) + { + ArgumentException.ThrowIfNullOrWhiteSpace(value); + _value = value; + } + + /// Gets the value associated with this . + public string Value => _value ?? string.Empty; + + /// An install plan can be computed for this MCP server candidate. + public static CatalogMcpServerInstallability Installable { get; } = new("installable"); + + /// Policy forbids installing this MCP server candidate. + public static CatalogMcpServerInstallability NotInstallablePolicy { get; } = new("not-installable-policy"); + + /// Returns a value indicating whether two instances are equivalent. + public static bool operator ==(CatalogMcpServerInstallability left, CatalogMcpServerInstallability right) => left.Equals(right); + + /// Returns a value indicating whether two instances are not equivalent. + public static bool operator !=(CatalogMcpServerInstallability left, CatalogMcpServerInstallability right) => !(left == right); + + /// + public override bool Equals(object? obj) => obj is CatalogMcpServerInstallability other && Equals(other); + + /// + public bool Equals(CatalogMcpServerInstallability other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); + + /// + public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); + + /// + public override string ToString() => Value; + + /// Provides a for serializing instances. + [EditorBrowsable(EditorBrowsableState.Never)] + public sealed class Converter : JsonConverter + { + /// + public override CatalogMcpServerInstallability Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); + } + + /// + public override void Write(Utf8JsonWriter writer, CatalogMcpServerInstallability value, JsonSerializerOptions options) + { + GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(CatalogMcpServerInstallability)); + } + } +} + + +/// What kind of resource a catalog candidate describes. +[Experimental(Diagnostics.Experimental)] +[JsonConverter(typeof(Converter))] +[DebuggerDisplay("{Value,nq}")] +public readonly struct CatalogCandidateKind : IEquatable +{ + private readonly string? _value; + + /// Initializes a new instance of the struct. + /// The value to associate with this . + [JsonConstructor] + public CatalogCandidateKind(string value) + { + ArgumentException.ThrowIfNullOrWhiteSpace(value); + _value = value; + } + + /// Gets the value associated with this . + public string Value => _value ?? string.Empty; + + /// An MCP server, which can be planned for installation. + public static CatalogCandidateKind McpServer { get; } = new("mcp-server"); + + /// An AI skill, which is discoverable but not installable through this surface. + public static CatalogCandidateKind AiSkill { get; } = new("ai-skill"); + + /// Returns a value indicating whether two instances are equivalent. + public static bool operator ==(CatalogCandidateKind left, CatalogCandidateKind right) => left.Equals(right); + + /// Returns a value indicating whether two instances are not equivalent. + public static bool operator !=(CatalogCandidateKind left, CatalogCandidateKind right) => !(left == right); + + /// + public override bool Equals(object? obj) => obj is CatalogCandidateKind other && Equals(other); + + /// + public bool Equals(CatalogCandidateKind other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); + + /// + public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); + + /// + public override string ToString() => Value; + + /// Provides a for serializing instances. + [EditorBrowsable(EditorBrowsableState.Never)] + public sealed class Converter : JsonConverter + { + /// + public override CatalogCandidateKind Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); + } + + /// + public override void Write(Utf8JsonWriter writer, CatalogCandidateKind value, JsonSerializerOptions options) + { + GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(CatalogCandidateKind)); + } + } +} + + /// Which tier this directory belongs to. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] @@ -23479,8 +26700,8 @@ public PermissionDecisionSource(string value) /// Gets the value associated with this . public string Value => _value ?? string.Empty; - /// The response followed the auto-approval judge recommendation. - public static PermissionDecisionSource JudgeRecommendation { get; } = new("judge_recommendation"); + /// The response followed the assisted-approval judge recommendation. + public static PermissionDecisionSource AssistedApproval { get; } = new("assisted_approval"); /// A human supplied the response through an interactive prompt. public static PermissionDecisionSource HumanResponse { get; } = new("human_response"); @@ -23666,115 +26887,49 @@ public override void Write(Utf8JsonWriter writer, PermissionsSetApproveAllSource } -/// Current or requested allow-all mode. -[Experimental(Diagnostics.Experimental)] -[JsonConverter(typeof(Converter))] -[DebuggerDisplay("{Value,nq}")] -public readonly struct PermissionsAllowAllMode : IEquatable -{ - private readonly string? _value; - - /// Initializes a new instance of the struct. - /// The value to associate with this . - [JsonConstructor] - public PermissionsAllowAllMode(string value) - { - ArgumentException.ThrowIfNullOrWhiteSpace(value); - _value = value; - } - - /// Gets the value associated with this . - public string Value => _value ?? string.Empty; - - /// Permission requests follow the normal approval flow. - public static PermissionsAllowAllMode Off { get; } = new("off"); - - /// Tool, path, and URL permission requests are automatically approved. - public static PermissionsAllowAllMode On { get; } = new("on"); - - /// Permission requests follow the normal approval flow with an LLM advisory recommendation attached; clients may choose to auto-approve requests the judge evaluated as acceptable. - public static PermissionsAllowAllMode Auto { get; } = new("auto"); - - /// Returns a value indicating whether two instances are equivalent. - public static bool operator ==(PermissionsAllowAllMode left, PermissionsAllowAllMode right) => left.Equals(right); - - /// Returns a value indicating whether two instances are not equivalent. - public static bool operator !=(PermissionsAllowAllMode left, PermissionsAllowAllMode right) => !(left == right); - - /// - public override bool Equals(object? obj) => obj is PermissionsAllowAllMode other && Equals(other); - - /// - public bool Equals(PermissionsAllowAllMode other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); - - /// - public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); - - /// - public override string ToString() => Value; - - /// Provides a for serializing instances. - [EditorBrowsable(EditorBrowsableState.Never)] - public sealed class Converter : JsonConverter - { - /// - public override PermissionsAllowAllMode Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) - { - return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); - } - - /// - public override void Write(Utf8JsonWriter writer, PermissionsAllowAllMode value, JsonSerializerOptions options) - { - GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(PermissionsAllowAllMode)); - } - } -} - - -/// Optional source for allow-all telemetry. Defaults to `rpc` when omitted for SDK callers. +/// Optional source for permission-mode telemetry. Defaults to `rpc` when omitted for SDK callers. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] -public readonly struct PermissionsSetAllowAllSource : IEquatable +public readonly struct PermissionModeSource : IEquatable { private readonly string? _value; - /// Initializes a new instance of the struct. - /// The value to associate with this . + /// Initializes a new instance of the struct. + /// The value to associate with this . [JsonConstructor] - public PermissionsSetAllowAllSource(string value) + public PermissionModeSource(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } - /// Gets the value associated with this . + /// Gets the value associated with this . public string Value => _value ?? string.Empty; - /// Allow-all was enabled from a CLI command-line flag. - public static PermissionsSetAllowAllSource CliFlag { get; } = new("cli_flag"); + /// The mode was set from a CLI command-line flag. + public static PermissionModeSource CliFlag { get; } = new("cli_flag"); - /// Allow-all was enabled by a slash command. - public static PermissionsSetAllowAllSource SlashCommand { get; } = new("slash_command"); + /// The mode was set by a slash command. + public static PermissionModeSource SlashCommand { get; } = new("slash_command"); - /// Allow-all was enabled by confirming autopilot behavior. - public static PermissionsSetAllowAllSource AutopilotConfirmation { get; } = new("autopilot_confirmation"); + /// The mode was set by confirming autopilot behavior. + public static PermissionModeSource AutopilotConfirmation { get; } = new("autopilot_confirmation"); - /// Allow-all was enabled through an RPC caller. - public static PermissionsSetAllowAllSource Rpc { get; } = new("rpc"); + /// The mode was set through an RPC caller. + public static PermissionModeSource Rpc { get; } = new("rpc"); - /// Returns a value indicating whether two instances are equivalent. - public static bool operator ==(PermissionsSetAllowAllSource left, PermissionsSetAllowAllSource right) => left.Equals(right); + /// Returns a value indicating whether two instances are equivalent. + public static bool operator ==(PermissionModeSource left, PermissionModeSource right) => left.Equals(right); - /// Returns a value indicating whether two instances are not equivalent. - public static bool operator !=(PermissionsSetAllowAllSource left, PermissionsSetAllowAllSource right) => !(left == right); + /// Returns a value indicating whether two instances are not equivalent. + public static bool operator !=(PermissionModeSource left, PermissionModeSource right) => !(left == right); /// - public override bool Equals(object? obj) => obj is PermissionsSetAllowAllSource other && Equals(other); + public override bool Equals(object? obj) => obj is PermissionModeSource other && Equals(other); /// - public bool Equals(PermissionsSetAllowAllSource other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); + public bool Equals(PermissionModeSource other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); /// public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); @@ -23782,20 +26937,20 @@ public PermissionsSetAllowAllSource(string value) /// public override string ToString() => Value; - /// Provides a for serializing instances. + /// Provides a for serializing instances. [EditorBrowsable(EditorBrowsableState.Never)] - public sealed class Converter : JsonConverter + public sealed class Converter : JsonConverter { /// - public override PermissionsSetAllowAllSource Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override PermissionModeSource Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// - public override void Write(Utf8JsonWriter writer, PermissionsSetAllowAllSource value, JsonSerializerOptions options) + public override void Write(Utf8JsonWriter writer, PermissionModeSource value, JsonSerializerOptions options) { - GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(PermissionsSetAllowAllSource)); + GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(PermissionModeSource)); } } } @@ -25740,6 +28895,12 @@ public async Task RegisterExtensionLaunchProviderAsync(CancellationToken cancell Interlocked.CompareExchange(ref field, new(_rpc), null) ?? field; + /// Catalog APIs. + public ServerCatalogApi Catalog => + field ?? + Interlocked.CompareExchange(ref field, new(_rpc), null) ?? + field; + /// Plugins APIs. public ServerPluginsApi Plugins => field ?? @@ -25977,6 +29138,21 @@ public async Task DiscoverAsync(string? workingDirectory = nu return await CopilotClient.InvokeRpcAsync(_rpc, "mcp.discover", [request], cancellationToken); } + /// Requests a side-effect-free MCP install plan from a catalog candidate handle or a caller-supplied card. This host-implemented server method is available through SDK/TUI hosts; standalone and C-ABI runtimes whose host does not implement server-method dispatch return JSON-RPC MethodNotFound. A runtime with planning available returns a normalised plan and opaque single-use plan handle; a runtime without it returns the typed planning-unavailable result. A completed plan reports resource identity, provenance, eligible transport choices, the user-scope target, required typed values and secret placeholders, the policy result, the configuration changes installing would make, and whether a reload would be needed. Planning never writes configuration, stores a secret, or reloads MCP servers, so abandoning a plan needs no call and leaves nothing behind. + /// Protocol version and capabilities the caller requires. + /// What to plan: either a candidate handle from a previous search, or a card supplied directly. + /// Configuration scope the plan targets. Defaults to user scope when omitted. + /// The to monitor for cancellation requests. The default is . + /// Outcome of an mcp.planInstall call: either a normalised plan, or one typed refusal. Nothing is written in either case. + public async Task PlanInstallAsync(CatalogClientContract contract, McpPlanInstallSource source, McpPlanScope? scope = null, CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(contract); + ArgumentNullException.ThrowIfNull(source); + + var request = new McpPlanInstallRequest { Contract = contract, Source = source, Scope = scope }; + return await CopilotClient.InvokeRpcAsync(_rpc, "mcp.planInstall", [request], cancellationToken); + } + /// Config APIs. public ServerMcpConfigApi Config => field ?? @@ -26112,6 +29288,34 @@ public async Task DisableAsync(IList ids, CancellationToken cancellation } } +/// Provides server-scoped Catalog APIs. +[Experimental(Diagnostics.Experimental)] +public sealed class ServerCatalogApi +{ + private readonly JsonRpc _rpc; + + internal ServerCatalogApi(JsonRpc rpc) + { + _rpc = rpc; + } + + /// Requests a bounded catalog search. This host-implemented server method is available through SDK/TUI hosts; standalone and C-ABI runtimes whose host does not implement server-method dispatch return JSON-RPC MethodNotFound. A runtime with search available returns inert candidate summaries, each with an opaque single-use handle scoped to this runtime instance; a runtime without it returns the typed search-unavailable result. Public authorities may be searched anonymously, while an authority that requires credentials yields the typed authentication-required result. All returned text, URLs, and package metadata are untrusted external data and can never trigger instructions, tools, or installation. Read-only: nothing is installed, configured, or persisted. + /// Protocol version and capabilities the caller requires. + /// Free-text search query. Never written to logs or telemetry. + /// Maximum number of candidates to return. Defaults to 10 when omitted. + /// Restrict results to these candidate kinds. When omitted, every kind the runtime supports is searched. + /// The to monitor for cancellation requests. The default is . + /// Outcome of a catalog.search call: either bounded inert candidates, or one typed refusal. Never a partial success. + public async Task SearchAsync(CatalogClientContract contract, string query, int? limit = null, IList? kinds = null, CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(contract); + ArgumentNullException.ThrowIfNull(query); + + var request = new CatalogSearchRequest { Contract = contract, Query = query, Limit = limit, Kinds = kinds }; + return await CopilotClient.InvokeRpcAsync(_rpc, "catalog.search", [request], cancellationToken); + } +} + /// Provides server-scoped Plugins APIs. [Experimental(Diagnostics.Experimental)] public sealed class ServerPluginsApi @@ -28865,6 +32069,17 @@ public async Task ReloadAsync(CancellationToken cancellationToken = default) await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.mcp.reload", [request], cancellationToken); } + /// Releases any turns waiting on an in-flight MCP load without cancelling the load, letting the agent proceed while MCP servers finish connecting in the background. No-op when no MCP load is in flight or waiting turns were already released. + /// The to monitor for cancellation requests. The default is . + /// Result of moving in-flight MCP loading to the background. + public async Task MoveLoadingToBackgroundAsync(CancellationToken cancellationToken = default) + { + _session.ThrowIfDisposed(); + + var request = new SessionMcpMoveLoadingToBackgroundRequest { SessionId = _session.SessionId }; + return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.mcp.moveLoadingToBackground", [request], cancellationToken); + } + /// Reloads MCP server connections for the session with an explicit host-provided configuration. /// The to monitor for cancellation requests. The default is . /// MCP server startup filtering result. @@ -30044,30 +33259,29 @@ public async Task SetApproveAllAsync(bool enable return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.permissions.setApproveAll", [request], cancellationToken); } - /// Sets the allow-all permission mode for the session. Used by attach-mode clients (e.g. LocalRpcSession's `/allow-all` forwarder) to flip the target session's permission state. The `on` mode swaps in unrestricted path and URL managers and emits `session.permissions_changed` on transition; the `auto` mode keeps normal prompt paths active while attaching LLM safety recommendations. The result returns the authoritative post-mutation state so callers can update their local mirrors without racing the `session.permissions_changed` notification on the same wire. - /// Allow-all mode to apply. `on` enables full allow-all; `auto` enables advisory LLM auto-approval; `off` disables both. - /// Legacy full allow-all toggle. Prefer `mode`; when `mode` is omitted, `enabled: true` is treated as `mode: "on"` and any other value is treated as `mode: "off"`. - /// Optional model id for the `auto` mode auto-approval LLM judging. Only meaningful when `mode` is `auto`; ignored otherwise. When omitted, the session resolves a default judge model: `gpt-5.5` for CAPI sessions and the session's active model for BYOK sessions. - /// Optional source for allow-all telemetry. Defaults to `rpc` when omitted for SDK callers. + /// Sets the permission mode for the session. `manual` follows the normal approval flow, `assisted` attaches LLM safety recommendations, and `allow-all` automatically approves permission requests. The result returns the authoritative post-mutation mode so callers can update local state without racing the `session.permissions_changed` notification. + /// Permission mode to apply. + /// Optional judge model id for assisted mode. When omitted, the session resolves the provider default: `gpt-5.5` for CAPI sessions and the active session model for BYOK sessions. + /// Optional source for permission-mode telemetry. Defaults to `rpc` when omitted for SDK callers. /// The to monitor for cancellation requests. The default is . - /// Indicates whether the operation succeeded and reports the post-mutation state. - public async Task SetAllowAllAsync(PermissionsAllowAllMode? mode = null, bool? enabled = null, string? model = null, PermissionsSetAllowAllSource? source = null, CancellationToken cancellationToken = default) + /// Indicates whether the requested permission mode was applied and reports the authoritative post-mutation mode. + public async Task SetModeAsync(PermissionMode mode, string? assistedApprovalModel = null, PermissionModeSource? source = null, CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); - var request = new PermissionsSetAllowAllRequest { SessionId = _session.SessionId, Mode = mode, Enabled = enabled, Model = model, Source = source }; - return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.permissions.setAllowAll", [request], cancellationToken); + var request = new PermissionsSetModeRequest { SessionId = _session.SessionId, Mode = mode, AssistedApprovalModel = assistedApprovalModel, Source = source }; + return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.permissions.setMode", [request], cancellationToken); } - /// Returns the current allow-all permission mode for the session. + /// Returns the current permission mode for the session. /// The to monitor for cancellation requests. The default is . - /// Current allow-all permission mode. - public async Task GetAllowAllAsync(CancellationToken cancellationToken = default) + /// Current permission mode. + public async Task GetModeAsync(CancellationToken cancellationToken = default) { _session.ThrowIfDisposed(); - var request = new PermissionsGetAllowAllRequest { SessionId = _session.SessionId }; - return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.permissions.getAllowAll", [request], cancellationToken); + var request = new PermissionsGetModeRequest { SessionId = _session.SessionId }; + return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.permissions.getMode", [request], cancellationToken); } /// Adds or removes session-scoped or location-scoped permission rules. @@ -31665,6 +34879,8 @@ public static void RegisterClientGlobalApiHandlers(JsonRpc rpc, ClientGlobalApiH [JsonSerializable(typeof(GitHub.Copilot.AssistantUsageData), TypeInfoPropertyName = "SessionEventsAssistantUsageData")] [JsonSerializable(typeof(GitHub.Copilot.AssistantUsageEvent), TypeInfoPropertyName = "SessionEventsAssistantUsageEvent")] [JsonSerializable(typeof(GitHub.Copilot.AssistantUsageTransport), TypeInfoPropertyName = "SessionEventsAssistantUsageTransport")] +[JsonSerializable(typeof(GitHub.Copilot.AssistedApprovalJudgeFailureReason), TypeInfoPropertyName = "SessionEventsAssistedApprovalJudgeFailureReason")] +[JsonSerializable(typeof(GitHub.Copilot.AssistedApprovalRecommendation), TypeInfoPropertyName = "SessionEventsAssistedApprovalRecommendation")] [JsonSerializable(typeof(GitHub.Copilot.Attachment), TypeInfoPropertyName = "SessionEventsAttachment")] [JsonSerializable(typeof(GitHub.Copilot.AttachmentBlob), TypeInfoPropertyName = "SessionEventsAttachmentBlob")] [JsonSerializable(typeof(GitHub.Copilot.AttachmentDirectory), TypeInfoPropertyName = "SessionEventsAttachmentDirectory")] @@ -31688,8 +34904,6 @@ public static void RegisterClientGlobalApiHandlers(JsonRpc rpc, ClientGlobalApiH [JsonSerializable(typeof(GitHub.Copilot.AttachmentSelectionDetails), TypeInfoPropertyName = "SessionEventsAttachmentSelectionDetails")] [JsonSerializable(typeof(GitHub.Copilot.AttachmentSelectionDetailsEnd), TypeInfoPropertyName = "SessionEventsAttachmentSelectionDetailsEnd")] [JsonSerializable(typeof(GitHub.Copilot.AttachmentSelectionDetailsStart), TypeInfoPropertyName = "SessionEventsAttachmentSelectionDetailsStart")] -[JsonSerializable(typeof(GitHub.Copilot.AutoApprovalJudgeFailureReason), TypeInfoPropertyName = "SessionEventsAutoApprovalJudgeFailureReason")] -[JsonSerializable(typeof(GitHub.Copilot.AutoApprovalRecommendation), TypeInfoPropertyName = "SessionEventsAutoApprovalRecommendation")] [JsonSerializable(typeof(GitHub.Copilot.AutoModeResolvedReasoningBucket), TypeInfoPropertyName = "SessionEventsAutoModeResolvedReasoningBucket")] [JsonSerializable(typeof(GitHub.Copilot.AutoModeSwitchCompletedData), TypeInfoPropertyName = "SessionEventsAutoModeSwitchCompletedData")] [JsonSerializable(typeof(GitHub.Copilot.AutoModeSwitchCompletedEvent), TypeInfoPropertyName = "SessionEventsAutoModeSwitchCompletedEvent")] @@ -31817,10 +35031,10 @@ public static void RegisterClientGlobalApiHandlers(JsonRpc rpc, ClientGlobalApiH [JsonSerializable(typeof(GitHub.Copilot.OmittedBinaryType), TypeInfoPropertyName = "SessionEventsOmittedBinaryType")] [JsonSerializable(typeof(GitHub.Copilot.PendingMessagesModifiedData), TypeInfoPropertyName = "SessionEventsPendingMessagesModifiedData")] [JsonSerializable(typeof(GitHub.Copilot.PendingMessagesModifiedEvent), TypeInfoPropertyName = "SessionEventsPendingMessagesModifiedEvent")] -[JsonSerializable(typeof(GitHub.Copilot.PermissionAllowAllMode), TypeInfoPropertyName = "SessionEventsPermissionAllowAllMode")] -[JsonSerializable(typeof(GitHub.Copilot.PermissionAutoApproval), TypeInfoPropertyName = "SessionEventsPermissionAutoApproval")] +[JsonSerializable(typeof(GitHub.Copilot.PermissionAssistedApproval), TypeInfoPropertyName = "SessionEventsPermissionAssistedApproval")] [JsonSerializable(typeof(GitHub.Copilot.PermissionCompletedData), TypeInfoPropertyName = "SessionEventsPermissionCompletedData")] [JsonSerializable(typeof(GitHub.Copilot.PermissionCompletedEvent), TypeInfoPropertyName = "SessionEventsPermissionCompletedEvent")] +[JsonSerializable(typeof(GitHub.Copilot.PermissionMode), TypeInfoPropertyName = "SessionEventsPermissionMode")] [JsonSerializable(typeof(GitHub.Copilot.PermissionPromptRequest), TypeInfoPropertyName = "SessionEventsPermissionPromptRequest")] [JsonSerializable(typeof(GitHub.Copilot.PermissionPromptRequestCommands), TypeInfoPropertyName = "SessionEventsPermissionPromptRequestCommands")] [JsonSerializable(typeof(GitHub.Copilot.PermissionPromptRequestCustomTool), TypeInfoPropertyName = "SessionEventsPermissionPromptRequestCustomTool")] @@ -32016,8 +35230,6 @@ public static void RegisterClientGlobalApiHandlers(JsonRpc rpc, ClientGlobalApiH [JsonSerializable(typeof(AgentSetPromptRequest))] [JsonSerializable(typeof(AgentsDiscoverRequest))] [JsonSerializable(typeof(AgentsGetDiscoveryPathsRequest))] -[JsonSerializable(typeof(AllowAllPermissionSetResult))] -[JsonSerializable(typeof(AllowAllPermissionState))] [JsonSerializable(typeof(AuthIdentity))] [JsonSerializable(typeof(AuthInfo))] [JsonSerializable(typeof(AuthValidationError))] @@ -32044,6 +35256,15 @@ public static void RegisterClientGlobalApiHandlers(JsonRpc rpc, ClientGlobalApiH [JsonSerializable(typeof(CanvasProviderUnregisterRequest))] [JsonSerializable(typeof(CanvasSessionContext))] [JsonSerializable(typeof(CapiSessionOptions))] +[JsonSerializable(typeof(CardDigest))] +[JsonSerializable(typeof(CatalogAiSkillCandidateProvenance))] +[JsonSerializable(typeof(CatalogCandidate))] +[JsonSerializable(typeof(CatalogCandidateSource))] +[JsonSerializable(typeof(CatalogClientContract))] +[JsonSerializable(typeof(CatalogMcpServerCandidateProvenance))] +[JsonSerializable(typeof(CatalogNegotiatedContract))] +[JsonSerializable(typeof(CatalogSearchRequest))] +[JsonSerializable(typeof(CatalogSearchResult))] [JsonSerializable(typeof(CommandList))] [JsonSerializable(typeof(CommandsFinalizeInvocationEffectRequest))] [JsonSerializable(typeof(CommandsFinalizeInvocationEffectRequestEffect))] @@ -32242,6 +35463,7 @@ public static void RegisterClientGlobalApiHandlers(JsonRpc rpc, ClientGlobalApiH [JsonSerializable(typeof(McpHeadersHandlePendingHeadersRefreshRequestRequest))] [JsonSerializable(typeof(McpHeadersHandlePendingHeadersRefreshRequestResult))] [JsonSerializable(typeof(McpHostState))] +[JsonSerializable(typeof(McpInstallPlan))] [JsonSerializable(typeof(McpIsServerRunningRequest))] [JsonSerializable(typeof(McpIsServerRunningResult))] [JsonSerializable(typeof(McpListToolsRequest))] @@ -32256,6 +35478,17 @@ public static void RegisterClientGlobalApiHandlers(JsonRpc rpc, ClientGlobalApiH [JsonSerializable(typeof(McpOauthProbeResult))] [JsonSerializable(typeof(McpOauthRespondRequest))] [JsonSerializable(typeof(McpOauthRespondResult))] +[JsonSerializable(typeof(McpPlanConfigurationChange))] +[JsonSerializable(typeof(McpPlanInstallRequest))] +[JsonSerializable(typeof(McpPlanInstallResult))] +[JsonSerializable(typeof(McpPlanInstallSource))] +[JsonSerializable(typeof(McpPlanPolicyResult))] +[JsonSerializable(typeof(McpPlanProvenance))] +[JsonSerializable(typeof(McpPlanRequiredValue))] +[JsonSerializable(typeof(McpPlanResourceIdentity))] +[JsonSerializable(typeof(McpPlanSecretPlaceholder))] +[JsonSerializable(typeof(McpPlanTarget))] +[JsonSerializable(typeof(McpPlanTransportChoice))] [JsonSerializable(typeof(McpRegisterExternalClientRequest))] [JsonSerializable(typeof(McpReloadWithConfigRequest))] [JsonSerializable(typeof(McpRemoveGitHubResult))] @@ -32273,6 +35506,7 @@ public static void RegisterClientGlobalApiHandlers(JsonRpc rpc, ClientGlobalApiH [JsonSerializable(typeof(McpRestartServerRequest))] [JsonSerializable(typeof(McpSamplingExecutionResult))] [JsonSerializable(typeof(McpServer))] +[JsonSerializable(typeof(McpServerCardReference))] [JsonSerializable(typeof(McpServerFailureInfo))] [JsonSerializable(typeof(McpServerList))] [JsonSerializable(typeof(McpServerNeedsAuthInfo))] @@ -32331,6 +35565,7 @@ public static void RegisterClientGlobalApiHandlers(JsonRpc rpc, ClientGlobalApiH [JsonSerializable(typeof(ModelSwitchToRequest))] [JsonSerializable(typeof(ModelSwitchToResult))] [JsonSerializable(typeof(ModelsListRequest))] +[JsonSerializable(typeof(MoveMcpLoadingToBackgroundResult))] [JsonSerializable(typeof(NameGetResult))] [JsonSerializable(typeof(NameSetAutoRequest))] [JsonSerializable(typeof(NameSetAutoResult))] @@ -32371,7 +35606,8 @@ public static void RegisterClientGlobalApiHandlers(JsonRpc rpc, ClientGlobalApiH [JsonSerializable(typeof(PermissionsConfigureParams))] [JsonSerializable(typeof(PermissionsConfigureResult))] [JsonSerializable(typeof(PermissionsFolderTrustAddTrustedResult))] -[JsonSerializable(typeof(PermissionsGetAllowAllRequest))] +[JsonSerializable(typeof(PermissionsGetModeRequest))] +[JsonSerializable(typeof(PermissionsGetModeResult))] [JsonSerializable(typeof(PermissionsLocationsAddToolApprovalDetails))] [JsonSerializable(typeof(PermissionsLocationsAddToolApprovalResult))] [JsonSerializable(typeof(PermissionsModifyRulesParams))] @@ -32383,9 +35619,10 @@ public static void RegisterClientGlobalApiHandlers(JsonRpc rpc, ClientGlobalApiH [JsonSerializable(typeof(PermissionsPendingRequestsRequest))] [JsonSerializable(typeof(PermissionsResetSessionApprovalsRequest))] [JsonSerializable(typeof(PermissionsResetSessionApprovalsResult))] -[JsonSerializable(typeof(PermissionsSetAllowAllRequest))] [JsonSerializable(typeof(PermissionsSetApproveAllRequest))] [JsonSerializable(typeof(PermissionsSetApproveAllResult))] +[JsonSerializable(typeof(PermissionsSetModeRequest))] +[JsonSerializable(typeof(PermissionsSetModeResult))] [JsonSerializable(typeof(PermissionsSetRequiredRequest))] [JsonSerializable(typeof(PermissionsSetRequiredResult))] [JsonSerializable(typeof(PermissionsUrlsSetUnrestrictedModeResult))] @@ -32588,6 +35825,7 @@ public static void RegisterClientGlobalApiHandlers(JsonRpc rpc, ClientGlobalApiH [JsonSerializable(typeof(SessionLoadDeferredRepoHooksResult))] [JsonSerializable(typeof(SessionMcpAppsGetHostContextRequest))] [JsonSerializable(typeof(SessionMcpListRequest))] +[JsonSerializable(typeof(SessionMcpMoveLoadingToBackgroundRequest))] [JsonSerializable(typeof(SessionMcpReloadRequest))] [JsonSerializable(typeof(SessionMcpRemoveGitHubRequest))] [JsonSerializable(typeof(SessionMetadataActivityRequest))] diff --git a/dotnet/src/Generated/SessionEvents.cs b/dotnet/src/Generated/SessionEvents.cs index 7bf9926e09..fa0563a8e4 100644 --- a/dotnet/src/Generated/SessionEvents.cs +++ b/dotnet/src/Generated/SessionEvents.cs @@ -382,8 +382,9 @@ public sealed partial class SessionSessionLimitsChangedEvent : SessionEvent public required SessionSessionLimitsChangedData Data { get; set; } } -/// Permissions change details carrying the aggregate allow-all transition. +/// Permission-mode transition details. /// Represents the session.permissions_changed event. +[Experimental(Diagnostics.Experimental)] public sealed partial class SessionPermissionsChangedEvent : SessionEvent { /// @@ -2205,28 +2206,25 @@ public sealed partial class SessionSessionLimitsChangedData public SessionLimitsConfig? SessionLimits { get; set; } } -/// Permissions change details carrying the aggregate allow-all transition. +/// Permission-mode transition details. +[Experimental(Diagnostics.Experimental)] public sealed partial class SessionPermissionsChangedData { - /// Allow-all mode after the change. + /// Explicit LLM judge model override used by assisted mode; omitted when the provider default applies. [Experimental(Diagnostics.Experimental)] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("allowAllPermissionMode")] - public PermissionAllowAllMode? AllowAllPermissionMode { get; set; } - - /// Aggregate allow-all flag after the change. - [JsonPropertyName("allowAllPermissions")] - public required bool AllowAllPermissions { get; set; } + [JsonPropertyName("assistedApprovalModel")] + public string? AssistedApprovalModel { get; set; } - /// Allow-all mode before the change. + /// Permission mode after the change. [Experimental(Diagnostics.Experimental)] - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("previousAllowAllPermissionMode")] - public PermissionAllowAllMode? PreviousAllowAllPermissionMode { get; set; } + [JsonPropertyName("mode")] + public required PermissionMode Mode { get; set; } - /// Aggregate allow-all flag before the change. - [JsonPropertyName("previousAllowAllPermissions")] - public required bool PreviousAllowAllPermissions { get; set; } + /// Permission mode before the change. + [Experimental(Diagnostics.Experimental)] + [JsonPropertyName("previousMode")] + public required PermissionMode PreviousMode { get; set; } } /// Plan file operation details indicating what changed. @@ -7813,15 +7811,15 @@ public override bool? ManagedApprovalRequired public required string Url { get; set; } } -/// Auto-approval judge information attached to a permission request. Present (non-null) only when the session's allow-all mode is "auto"; its absence means auto mode was off and the judge did not evaluate the request. The `recommendation` conveys the judge's disposition for this request. -/// Nested data type for PermissionAutoApproval. +/// Assisted-approval judge information attached to a permission request. Present only in assisted mode; its absence means the judge did not evaluate the request. The `recommendation` conveys the judge's disposition for this request. +/// Nested data type for PermissionAssistedApproval. [Experimental(Diagnostics.Experimental)] -public sealed partial class PermissionAutoApproval +public sealed partial class PermissionAssistedApproval { /// Classified cause of an `error` recommendation. Absent for every other recommendation. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("failureReason")] - public AutoApprovalJudgeFailureReason? FailureReason { get; set; } + public AssistedApprovalJudgeFailureReason? FailureReason { get; set; } /// Model id that produced the recommendation, when the judge was consulted and reported one. Absent for `excluded` (the judge was not consulted) and for failures that occurred before a model was selected. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] @@ -7833,9 +7831,9 @@ public sealed partial class PermissionAutoApproval [JsonPropertyName("reason")] public string? Reason { get; set; } - /// The auto-approval safety judge's outcome for this request. + /// The assisted-approval safety judge's outcome for this request. [JsonPropertyName("recommendation")] - public required AutoApprovalRecommendation Recommendation { get; set; } + public required AssistedApprovalRecommendation Recommendation { get; set; } } /// Memory operation permission request. @@ -7851,10 +7849,11 @@ public sealed partial class PermissionRequestMemory : PermissionRequest [JsonPropertyName("action")] public PermissionRequestMemoryAction? Action { get; set; } - /// Auto-approval judge information for this request; present only when auto mode is enabled. + /// Assisted-approval judge information for this request; present only in assisted mode. + [Experimental(Diagnostics.Experimental)] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("autoApproval")] - public PermissionAutoApproval? AutoApproval { get; set; } + [JsonPropertyName("assistedApproval")] + public PermissionAssistedApproval? AssistedApproval { get; set; } /// Source references for the stored fact (store only). [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] @@ -8153,11 +8152,11 @@ public sealed partial class PermissionPromptRequestCommands : PermissionPromptRe [JsonIgnore] public override string Kind => "commands"; - /// Auto-approval judge information for this request; present only when auto mode is enabled. + /// Assisted-approval judge information for this request; present only in assisted mode. [Experimental(Diagnostics.Experimental)] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("autoApproval")] - public PermissionAutoApproval? AutoApproval { get; set; } + [JsonPropertyName("assistedApproval")] + public PermissionAssistedApproval? AssistedApproval { get; set; } /// Whether the UI can offer session-wide approval for this command pattern. [JsonPropertyName("canOfferSessionApproval")] @@ -8199,11 +8198,11 @@ public sealed partial class PermissionPromptRequestWrite : PermissionPromptReque [JsonIgnore] public override string Kind => "write"; - /// Auto-approval judge information for this request; present only when auto mode is enabled. + /// Assisted-approval judge information for this request; present only in assisted mode. [Experimental(Diagnostics.Experimental)] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("autoApproval")] - public PermissionAutoApproval? AutoApproval { get; set; } + [JsonPropertyName("assistedApproval")] + public PermissionAssistedApproval? AssistedApproval { get; set; } /// Whether the UI can offer session-wide approval for file write operations. [JsonPropertyName("canOfferSessionApproval")] @@ -8245,11 +8244,11 @@ public sealed partial class PermissionPromptRequestRead : PermissionPromptReques [JsonIgnore] public override string Kind => "read"; - /// Auto-approval judge information for this request; present only when auto mode is enabled. + /// Assisted-approval judge information for this request; present only in assisted mode. [Experimental(Diagnostics.Experimental)] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("autoApproval")] - public PermissionAutoApproval? AutoApproval { get; set; } + [JsonPropertyName("assistedApproval")] + public PermissionAssistedApproval? AssistedApproval { get; set; } /// Human-readable description of why the file is being read. [JsonPropertyName("intention")] @@ -8283,11 +8282,11 @@ public sealed partial class PermissionPromptRequestMcp : PermissionPromptRequest [JsonPropertyName("args")] public JsonElement? Args { get; set; } - /// Auto-approval judge information for this request; present only when auto mode is enabled. + /// Assisted-approval judge information for this request; present only in assisted mode. [Experimental(Diagnostics.Experimental)] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("autoApproval")] - public PermissionAutoApproval? AutoApproval { get; set; } + [JsonPropertyName("assistedApproval")] + public PermissionAssistedApproval? AssistedApproval { get; set; } /// Advisory runtime permission recommendation. The host remains responsible for deciding the request and may reject it. [Experimental(Diagnostics.Experimental)] @@ -8321,11 +8320,11 @@ public sealed partial class PermissionPromptRequestUrl : PermissionPromptRequest [JsonIgnore] public override string Kind => "url"; - /// Auto-approval judge information for this request; present only when auto mode is enabled. + /// Assisted-approval judge information for this request; present only in assisted mode. [Experimental(Diagnostics.Experimental)] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("autoApproval")] - public PermissionAutoApproval? AutoApproval { get; set; } + [JsonPropertyName("assistedApproval")] + public PermissionAssistedApproval? AssistedApproval { get; set; } /// Human-readable description of why the URL is being accessed. [JsonPropertyName("intention")] @@ -8374,11 +8373,11 @@ public sealed partial class PermissionPromptRequestMemory : PermissionPromptRequ [JsonPropertyName("action")] public PermissionRequestMemoryAction? Action { get; set; } - /// Auto-approval judge information for this request; present only when auto mode is enabled. + /// Assisted-approval judge information for this request; present only in assisted mode. [Experimental(Diagnostics.Experimental)] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("autoApproval")] - public PermissionAutoApproval? AutoApproval { get; set; } + [JsonPropertyName("assistedApproval")] + public PermissionAssistedApproval? AssistedApproval { get; set; } /// Source references for the stored fact (store only). [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] @@ -8423,11 +8422,11 @@ public sealed partial class PermissionPromptRequestCustomTool : PermissionPrompt [JsonPropertyName("args")] public JsonElement? Args { get; set; } - /// Auto-approval judge information for this request; present only when auto mode is enabled. + /// Assisted-approval judge information for this request; present only in assisted mode. [Experimental(Diagnostics.Experimental)] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("autoApproval")] - public PermissionAutoApproval? AutoApproval { get; set; } + [JsonPropertyName("assistedApproval")] + public PermissionAssistedApproval? AssistedApproval { get; set; } /// Tool call ID that triggered this permission request. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] @@ -8455,11 +8454,11 @@ public sealed partial class PermissionPromptRequestPath : PermissionPromptReques [JsonPropertyName("accessKind")] public required PermissionPromptRequestPathAccessKind AccessKind { get; set; } - /// Auto-approval judge information for this request; present only when auto mode is enabled. + /// Assisted-approval judge information for this request; present only in assisted mode. [Experimental(Diagnostics.Experimental)] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("autoApproval")] - public PermissionAutoApproval? AutoApproval { get; set; } + [JsonPropertyName("assistedApproval")] + public PermissionAssistedApproval? AssistedApproval { get; set; } /// File paths that require explicit approval. [JsonPropertyName("paths")] @@ -8479,11 +8478,11 @@ public sealed partial class PermissionPromptRequestHook : PermissionPromptReques [JsonIgnore] public override string Kind => "hook"; - /// Auto-approval judge information for this request; present only when auto mode is enabled. + /// Assisted-approval judge information for this request; present only in assisted mode. [Experimental(Diagnostics.Experimental)] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("autoApproval")] - public PermissionAutoApproval? AutoApproval { get; set; } + [JsonPropertyName("assistedApproval")] + public PermissionAssistedApproval? AssistedApproval { get; set; } /// Optional message from the hook explaining why confirmation is needed. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] @@ -8513,11 +8512,11 @@ public sealed partial class PermissionPromptRequestExtensionManagement : Permiss [JsonIgnore] public override string Kind => "extension-management"; - /// Auto-approval judge information for this request; present only when auto mode is enabled. + /// Assisted-approval judge information for this request; present only in assisted mode. [Experimental(Diagnostics.Experimental)] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("autoApproval")] - public PermissionAutoApproval? AutoApproval { get; set; } + [JsonPropertyName("assistedApproval")] + public PermissionAssistedApproval? AssistedApproval { get; set; } /// Name of the extension being managed. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] @@ -8546,11 +8545,11 @@ public sealed partial class PermissionPromptRequestFactory : PermissionPromptReq [JsonPropertyName("approvalKey")] public required string ApprovalKey { get; set; } - /// Auto-approval judge information for this request; present only when auto mode is enabled. + /// Assisted-approval judge information for this request; present only in assisted mode. [Experimental(Diagnostics.Experimental)] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("autoApproval")] - public PermissionAutoApproval? AutoApproval { get; set; } + [JsonPropertyName("assistedApproval")] + public PermissionAssistedApproval? AssistedApproval { get; set; } /// Whether this factory is eligible for persistent approval. [JsonPropertyName("canPersistApproval")] @@ -8631,11 +8630,11 @@ public sealed partial class PermissionPromptRequestExtensionPermissionAccess : P [JsonIgnore] public override string Kind => "extension-permission-access"; - /// Auto-approval judge information for this request; present only when auto mode is enabled. + /// Assisted-approval judge information for this request; present only in assisted mode. [Experimental(Diagnostics.Experimental)] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("autoApproval")] - public PermissionAutoApproval? AutoApproval { get; set; } + [JsonPropertyName("assistedApproval")] + public PermissionAssistedApproval? AssistedApproval { get; set; } /// Capabilities the extension is requesting. [JsonPropertyName("capabilities")] @@ -8659,11 +8658,11 @@ public sealed partial class PermissionPromptRequestExtensionEnvAccess : Permissi [JsonIgnore] public override string Kind => "extension-env-access"; - /// Auto-approval judge information for this request; present only when auto mode is enabled. + /// Assisted-approval judge information for this request; present only in assisted mode. [Experimental(Diagnostics.Experimental)] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - [JsonPropertyName("autoApproval")] - public PermissionAutoApproval? AutoApproval { get; set; } + [JsonPropertyName("assistedApproval")] + public PermissionAssistedApproval? AssistedApproval { get; set; } /// Names of the sensitive environment variables the extension is requesting. Values never appear here. [JsonPropertyName("environmentVariables")] @@ -10011,46 +10010,46 @@ public override void Write(Utf8JsonWriter writer, SessionMode value, JsonSeriali } } -/// Allow-all mode for the session. +/// Permission mode for the session. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] -public readonly struct PermissionAllowAllMode : IEquatable +public readonly struct PermissionMode : IEquatable { private readonly string? _value; - /// Initializes a new instance of the struct. - /// The value to associate with this . + /// Initializes a new instance of the struct. + /// The value to associate with this . [JsonConstructor] - public PermissionAllowAllMode(string value) + public PermissionMode(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } - /// Gets the value associated with this . + /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// Permission requests follow the normal approval flow. - public static PermissionAllowAllMode Off { get; } = new("off"); + public static PermissionMode Manual { get; } = new("manual"); - /// Tool, path, and URL permission requests are automatically approved. - public static PermissionAllowAllMode On { get; } = new("on"); + /// Permission requests include an LLM safety recommendation; clients may automatically approve requests judged acceptable. + public static PermissionMode Assisted { get; } = new("assisted"); - /// Permission requests follow the normal approval flow with an LLM advisory recommendation attached; clients may choose to auto-approve requests the judge evaluated as acceptable. - public static PermissionAllowAllMode Auto { get; } = new("auto"); + /// Tool, path, and URL permission requests are automatically approved. + public static PermissionMode AllowAll { get; } = new("allow-all"); - /// Returns a value indicating whether two instances are equivalent. - public static bool operator ==(PermissionAllowAllMode left, PermissionAllowAllMode right) => left.Equals(right); + /// Returns a value indicating whether two instances are equivalent. + public static bool operator ==(PermissionMode left, PermissionMode right) => left.Equals(right); - /// Returns a value indicating whether two instances are not equivalent. - public static bool operator !=(PermissionAllowAllMode left, PermissionAllowAllMode right) => !(left == right); + /// Returns a value indicating whether two instances are not equivalent. + public static bool operator !=(PermissionMode left, PermissionMode right) => !(left == right); /// - public override bool Equals(object? obj) => obj is PermissionAllowAllMode other && Equals(other); + public override bool Equals(object? obj) => obj is PermissionMode other && Equals(other); /// - public bool Equals(PermissionAllowAllMode other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); + public bool Equals(PermissionMode other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); /// public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); @@ -10058,20 +10057,20 @@ public PermissionAllowAllMode(string value) /// public override string ToString() => Value; - /// Provides a for serializing instances. + /// Provides a for serializing instances. [EditorBrowsable(EditorBrowsableState.Never)] - public sealed class Converter : JsonConverter + public sealed class Converter : JsonConverter { /// - public override PermissionAllowAllMode Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override PermissionMode Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// - public override void Write(Utf8JsonWriter writer, PermissionAllowAllMode value, JsonSerializerOptions options) + public override void Write(Utf8JsonWriter writer, PermissionMode value, JsonSerializerOptions options) { - GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(PermissionAllowAllMode)); + GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(PermissionMode)); } } } @@ -12209,52 +12208,52 @@ public override void Write(Utf8JsonWriter writer, PermissionRequestMemoryAction } } -/// Why the auto-approval judge produced no usable recommendation. Present only alongside an `error` recommendation, where the human-readable reason is a fixed string and therefore cannot distinguish these cases. Intended to make a judge failure reportable by a consumer that has no access to the host's logs. +/// Why the assisted-approval judge produced no usable recommendation. Present only alongside an `error` recommendation, where the human-readable reason is a fixed string and therefore cannot distinguish these cases. Intended to make a judge failure reportable by a consumer that has no access to the host's logs. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] -public readonly struct AutoApprovalJudgeFailureReason : IEquatable +public readonly struct AssistedApprovalJudgeFailureReason : IEquatable { private readonly string? _value; - /// Initializes a new instance of the struct. - /// The value to associate with this . + /// Initializes a new instance of the struct. + /// The value to associate with this . [JsonConstructor] - public AutoApprovalJudgeFailureReason(string value) + public AssistedApprovalJudgeFailureReason(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } - /// Gets the value associated with this . + /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// The judge model call exceeded its deadline. - public static AutoApprovalJudgeFailureReason Timeout { get; } = new("timeout"); + public static AssistedApprovalJudgeFailureReason Timeout { get; } = new("timeout"); /// The judge model call was cancelled before it returned. - public static AutoApprovalJudgeFailureReason Abort { get; } = new("abort"); + public static AssistedApprovalJudgeFailureReason Abort { get; } = new("abort"); /// The judge model call completed but returned no content. - public static AutoApprovalJudgeFailureReason EmptyResponse { get; } = new("empty_response"); + public static AssistedApprovalJudgeFailureReason EmptyResponse { get; } = new("empty_response"); /// The judge model call failed (for example a transport, authentication, or rate-limit error). - public static AutoApprovalJudgeFailureReason ModelError { get; } = new("model_error"); + public static AssistedApprovalJudgeFailureReason ModelError { get; } = new("model_error"); /// The judge model replied, but the reply carried no ALLOW/DENY verdict. - public static AutoApprovalJudgeFailureReason ParseError { get; } = new("parse_error"); + public static AssistedApprovalJudgeFailureReason ParseError { get; } = new("parse_error"); - /// Returns a value indicating whether two instances are equivalent. - public static bool operator ==(AutoApprovalJudgeFailureReason left, AutoApprovalJudgeFailureReason right) => left.Equals(right); + /// Returns a value indicating whether two instances are equivalent. + public static bool operator ==(AssistedApprovalJudgeFailureReason left, AssistedApprovalJudgeFailureReason right) => left.Equals(right); - /// Returns a value indicating whether two instances are not equivalent. - public static bool operator !=(AutoApprovalJudgeFailureReason left, AutoApprovalJudgeFailureReason right) => !(left == right); + /// Returns a value indicating whether two instances are not equivalent. + public static bool operator !=(AssistedApprovalJudgeFailureReason left, AssistedApprovalJudgeFailureReason right) => !(left == right); /// - public override bool Equals(object? obj) => obj is AutoApprovalJudgeFailureReason other && Equals(other); + public override bool Equals(object? obj) => obj is AssistedApprovalJudgeFailureReason other && Equals(other); /// - public bool Equals(AutoApprovalJudgeFailureReason other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); + public bool Equals(AssistedApprovalJudgeFailureReason other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); /// public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); @@ -12262,67 +12261,67 @@ public AutoApprovalJudgeFailureReason(string value) /// public override string ToString() => Value; - /// Provides a for serializing instances. + /// Provides a for serializing instances. [EditorBrowsable(EditorBrowsableState.Never)] - public sealed class Converter : JsonConverter + public sealed class Converter : JsonConverter { /// - public override AutoApprovalJudgeFailureReason Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override AssistedApprovalJudgeFailureReason Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// - public override void Write(Utf8JsonWriter writer, AutoApprovalJudgeFailureReason value, JsonSerializerOptions options) + public override void Write(Utf8JsonWriter writer, AssistedApprovalJudgeFailureReason value, JsonSerializerOptions options) { - GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(AutoApprovalJudgeFailureReason)); + GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(AssistedApprovalJudgeFailureReason)); } } } -/// Outcome of the auto-approval safety judge for a permission request. Present only when auto mode is enabled; its absence means the judge did not evaluate the request (auto mode was off). +/// Outcome of the assisted-approval safety judge for a permission request. Present only in assisted mode; its absence means the judge did not evaluate the request. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] -public readonly struct AutoApprovalRecommendation : IEquatable +public readonly struct AssistedApprovalRecommendation : IEquatable { private readonly string? _value; - /// Initializes a new instance of the struct. - /// The value to associate with this . + /// Initializes a new instance of the struct. + /// The value to associate with this . [JsonConstructor] - public AutoApprovalRecommendation(string value) + public AssistedApprovalRecommendation(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } - /// Gets the value associated with this . + /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// The judge evaluated the request and recommends automatically approving it. - public static AutoApprovalRecommendation Approve { get; } = new("approve"); + public static AssistedApprovalRecommendation Approve { get; } = new("approve"); - /// The judge evaluated the request and does not recommend auto-approving it; explicit approval is required. Whether that means prompting, denying, or something else is the consumer's decision. - public static AutoApprovalRecommendation RequireApproval { get; } = new("requireApproval"); + /// The judge evaluated the request and does not recommend automatically approving it; explicit approval is required. Whether that means prompting, denying, or something else is the consumer's decision. + public static AssistedApprovalRecommendation RequireApproval { get; } = new("requireApproval"); - /// Auto mode is enabled, but this request category is never auto-approvable (for example, sandbox-bypass requests), so the judge was not consulted. - public static AutoApprovalRecommendation Excluded { get; } = new("excluded"); + /// Assisted mode is enabled, but this request category is never automatically approvable (for example, sandbox-bypass requests), so the judge was not consulted. + public static AssistedApprovalRecommendation Excluded { get; } = new("excluded"); /// The judge was consulted but did not return a usable recommendation, so the request requires explicit approval. - public static AutoApprovalRecommendation Error { get; } = new("error"); + public static AssistedApprovalRecommendation Error { get; } = new("error"); - /// Returns a value indicating whether two instances are equivalent. - public static bool operator ==(AutoApprovalRecommendation left, AutoApprovalRecommendation right) => left.Equals(right); + /// Returns a value indicating whether two instances are equivalent. + public static bool operator ==(AssistedApprovalRecommendation left, AssistedApprovalRecommendation right) => left.Equals(right); - /// Returns a value indicating whether two instances are not equivalent. - public static bool operator !=(AutoApprovalRecommendation left, AutoApprovalRecommendation right) => !(left == right); + /// Returns a value indicating whether two instances are not equivalent. + public static bool operator !=(AssistedApprovalRecommendation left, AssistedApprovalRecommendation right) => !(left == right); /// - public override bool Equals(object? obj) => obj is AutoApprovalRecommendation other && Equals(other); + public override bool Equals(object? obj) => obj is AssistedApprovalRecommendation other && Equals(other); /// - public bool Equals(AutoApprovalRecommendation other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); + public bool Equals(AssistedApprovalRecommendation other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); /// public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); @@ -12330,20 +12329,20 @@ public AutoApprovalRecommendation(string value) /// public override string ToString() => Value; - /// Provides a for serializing instances. + /// Provides a for serializing instances. [EditorBrowsable(EditorBrowsableState.Never)] - public sealed class Converter : JsonConverter + public sealed class Converter : JsonConverter { /// - public override AutoApprovalRecommendation Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override AssistedApprovalRecommendation Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// - public override void Write(Utf8JsonWriter writer, AutoApprovalRecommendation value, JsonSerializerOptions options) + public override void Write(Utf8JsonWriter writer, AssistedApprovalRecommendation value, JsonSerializerOptions options) { - GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(AutoApprovalRecommendation)); + GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(AssistedApprovalRecommendation)); } } } @@ -13389,14 +13388,14 @@ public ManagedSettingsEnforcedEscalation(string value) /// Gets the value associated with this . public string Value => _value ?? string.Empty; - /// Full allow-all ("/allow-all on") permissions — auto-approving tools, paths, and URLs. + /// Full allow-all permissions — automatically approving tools, paths, and URLs. public static ManagedSettingsEnforcedEscalation AllowAll { get; } = new("allow_all"); - /// Auto-approval of all tool permission requests. + /// Automatic approval of all tool permission requests. public static ManagedSettingsEnforcedEscalation ApproveAll { get; } = new("approve_all"); - /// Advisory auto-approval ("/allow-all auto") mode — keeps normal prompt paths and adds LLM-advised approval, distinct from full allow-all. - public static ManagedSettingsEnforcedEscalation AutoApproval { get; } = new("auto_approval"); + /// Assisted mode — keeps normal prompt paths and adds an LLM recommendation, distinct from allow-all. + public static ManagedSettingsEnforcedEscalation AssistedApproval { get; } = new("assisted_approval"); /// Unrestricted filesystem access outside the session's allowed directories. public static ManagedSettingsEnforcedEscalation UnrestrictedPaths { get; } = new("unrestricted_paths"); @@ -14155,7 +14154,7 @@ public override void Write(Utf8JsonWriter writer, ExtensionsLoadedExtensionStatu [JsonSerializable(typeof(OmittedBinaryResult))] [JsonSerializable(typeof(PendingMessagesModifiedData))] [JsonSerializable(typeof(PendingMessagesModifiedEvent))] -[JsonSerializable(typeof(PermissionAutoApproval))] +[JsonSerializable(typeof(PermissionAssistedApproval))] [JsonSerializable(typeof(PermissionCompletedData))] [JsonSerializable(typeof(PermissionCompletedEvent))] [JsonSerializable(typeof(PermissionPromptRequest))] diff --git a/dotnet/test/E2E/RewindE2ETests.cs b/dotnet/test/E2E/RewindE2ETests.cs index ced06b93f7..75aa328abe 100644 --- a/dotnet/test/E2E/RewindE2ETests.cs +++ b/dotnet/test/E2E/RewindE2ETests.cs @@ -42,10 +42,13 @@ await TestHelper.WaitForConditionAsync( async () => { rewindPoints = await session.Rpc.History.ListRewindPointsAsync(); - return rewindPoints.UnavailableReason is null; + return rewindPoints.UnavailableReason is null + && rewindPoints.Points.Count == 1 + && rewindPoints.Points[0].CanRestoreFiles + && rewindPoints.Points[0].FileCount == 1; }, timeout: TimeSpan.FromSeconds(10), - timeoutMessage: "Timed out waiting for rewind points to become available.", + timeoutMessage: "Timed out waiting for a restorable file rewind point.", pollInterval: TimeSpan.FromMilliseconds(100)); Assert.NotNull(rewindPoints); diff --git a/dotnet/test/E2E/RpcSessionStateExtrasE2ETests.cs b/dotnet/test/E2E/RpcSessionStateExtrasE2ETests.cs index 28ec9b7cfe..72663c35a4 100644 --- a/dotnet/test/E2E/RpcSessionStateExtrasE2ETests.cs +++ b/dotnet/test/E2E/RpcSessionStateExtrasE2ETests.cs @@ -12,7 +12,7 @@ namespace GitHub.Copilot.Test.E2E; /// /// E2E coverage for session-scoped RPC methods that were previously untested: /// completions, model.list, metadata.activity/context attribution/heaviest messages, -/// permissions.getAllowAll/setAllowAll, plan.readSqlTodos, provider.add, +/// permissions.getMode/setMode, plan.readSqlTodos, provider.add, /// telemetry.getEngagementId, tools.getCurrentMetadata/updateSubagentSettings, /// session visibility, and the session-scoped plugins.reload. /// @@ -158,22 +158,22 @@ public async Task Should_Get_And_Set_AllowAll_Permissions() try { - var initial = await session.Rpc.Permissions.GetAllowAllAsync(); - Assert.False(initial.Enabled, "Allow-all should be disabled on a fresh session."); + var initial = await session.Rpc.Permissions.GetModeAsync(); + Assert.Equal(PermissionMode.Manual, initial.Mode); - var enable = await session.Rpc.Permissions.SetAllowAllAsync(enabled: true); + var enable = await session.Rpc.Permissions.SetModeAsync(PermissionMode.AllowAll); Assert.True(enable.Success); - Assert.True(enable.Enabled); - Assert.True((await session.Rpc.Permissions.GetAllowAllAsync()).Enabled); + Assert.Equal(PermissionMode.AllowAll, enable.Mode); + Assert.Equal(PermissionMode.AllowAll, (await session.Rpc.Permissions.GetModeAsync()).Mode); - var disable = await session.Rpc.Permissions.SetAllowAllAsync(enabled: false); + var disable = await session.Rpc.Permissions.SetModeAsync(PermissionMode.Manual); Assert.True(disable.Success); - Assert.False(disable.Enabled); - Assert.False((await session.Rpc.Permissions.GetAllowAllAsync()).Enabled); + Assert.Equal(PermissionMode.Manual, disable.Mode); + Assert.Equal(PermissionMode.Manual, (await session.Rpc.Permissions.GetModeAsync()).Mode); } finally { - await session.Rpc.Permissions.SetAllowAllAsync(enabled: false); + await session.Rpc.Permissions.SetModeAsync(PermissionMode.Manual); } } diff --git a/dotnet/test/E2E/RpcUiEphemeralQueryE2ETests.cs b/dotnet/test/E2E/RpcUiEphemeralQueryE2ETests.cs index 428cb78526..8fbf0d571d 100644 --- a/dotnet/test/E2E/RpcUiEphemeralQueryE2ETests.cs +++ b/dotnet/test/E2E/RpcUiEphemeralQueryE2ETests.cs @@ -19,10 +19,10 @@ namespace GitHub.Copilot.Test.E2E; public class RpcUiEphemeralQueryE2ETests(E2ETestFixture fixture, ITestOutputHelper output) : E2ETestBase(fixture, "rpc_ui_ephemeral_query", output) { - // TODO(cli-1.0.81-2): CLI 1.0.81-2 fails session.ui.ephemeralQuery against the recorded - // snapshot ("Failed to get response from the AI model"). Re-enable once the runtime - // fix ships. - [Fact(Skip = "Blocked on CLI 1.0.81-2 session.ui.ephemeralQuery regression")] + // TODO(cli-1.0.81-2): CLI 1.0.81-4 still fails session.ui.ephemeralQuery against the + // recorded snapshot ("Failed to get response from the AI model"). Re-enable once the + // runtime fix ships. + [Fact(Skip = "Blocked on CLI 1.0.81-4 session.ui.ephemeralQuery regression")] public async Task Should_Answer_Ephemeral_Query() { await using var session = await CreateSessionAsync(); diff --git a/go/inprocess_disabled.go b/go/inprocess_disabled.go index b86ed5ca36..d0626a74d3 100644 --- a/go/inprocess_disabled.go +++ b/go/inprocess_disabled.go @@ -6,6 +6,8 @@ import "errors" const inProcessAvailable = false +var errInProcessUnavailable = errors.New("in-process transport unavailable") + func createInProcessHost(string, inProcessHostConfig) (inProcessHost, error) { - return nil, errors.New("in-process transport unavailable") + return nil, errInProcessUnavailable } diff --git a/go/internal/e2e/abort_e2e_test.go b/go/internal/e2e/abort_e2e_test.go index 0953456888..569518bca7 100644 --- a/go/internal/e2e/abort_e2e_test.go +++ b/go/internal/e2e/abort_e2e_test.go @@ -32,6 +32,7 @@ func TestAbortE2E(t *testing.T) { var mu sync.Mutex var events []copilot.SessionEvent firstDelta := make(chan *copilot.AssistantMessageDeltaData, 1) + sessionIdle := make(chan struct{}, 1) session.On(func(event copilot.SessionEvent) { mu.Lock() @@ -43,6 +44,12 @@ func TestAbortE2E(t *testing.T) { default: } } + if _, ok := event.Data.(*copilot.SessionIdleData); ok { + select { + case sessionIdle <- struct{}{}: + default: + } + } }) // Fire-and-forget — we'll abort before it finishes @@ -67,6 +74,11 @@ func TestAbortE2E(t *testing.T) { if err := session.Abort(t.Context()); err != nil { t.Fatalf("Abort failed: %v", err) } + select { + case <-sessionIdle: + case <-time.After(60 * time.Second): + t.Fatal("Timed out waiting for session to become idle after abort") + } mu.Lock() snapshot := make([]copilot.SessionEvent, len(events)) @@ -85,33 +97,15 @@ func TestAbortE2E(t *testing.T) { t.Error("Expected at least one assistant.message_delta event before abort") } - // Session should be usable after abort. Wait for the specific recovery - // message rather than racing against a late idle from the aborted turn. - recoveryReceived := make(chan *copilot.AssistantMessageData, 1) - session.On(func(event copilot.SessionEvent) { - if d, ok := event.Data.(*copilot.AssistantMessageData); ok { - if strings.Contains(strings.ToLower(d.Content), "abort_recovery_ok") { - select { - case recoveryReceived <- d: - default: - } - } - } + // Session should be usable after abort. + msg, err := session.SendAndWait(t.Context(), copilot.MessageOptions{ + Prompt: "Say 'abort_recovery_ok'.", }) - - go func() { - _, _ = session.Send(t.Context(), copilot.MessageOptions{ - Prompt: "Say 'abort_recovery_ok'.", - }) - }() - - select { - case msg := <-recoveryReceived: - if !strings.Contains(strings.ToLower(msg.Content), "abort_recovery_ok") { - t.Errorf("Expected recovery message to contain 'abort_recovery_ok', got %q", msg.Content) - } - case <-time.After(60 * time.Second): - t.Fatal("Timed out waiting for recovery message after abort") + if err != nil { + t.Fatalf("Recovery SendAndWait failed after abort: %v", err) + } + if content := assistantContent(t, msg); !strings.Contains(strings.ToLower(content), "abort_recovery_ok") { + t.Errorf("Expected recovery message to contain 'abort_recovery_ok', got %q", content) } }) @@ -144,6 +138,16 @@ func TestAbortE2E(t *testing.T) { } t.Cleanup(func() { _ = session.Disconnect() }) + sessionIdle := make(chan struct{}, 1) + session.On(func(event copilot.SessionEvent) { + if _, ok := event.Data.(*copilot.SessionIdleData); ok { + select { + case sessionIdle <- struct{}{}: + default: + } + } + }) + // Fire-and-forget go func() { _, _ = session.Send(t.Context(), copilot.MessageOptions{ @@ -172,33 +176,21 @@ func TestAbortE2E(t *testing.T) { case releaseTool <- "RELEASED_AFTER_ABORT": default: } - - // Session should be usable after abort - recoveryReceived := make(chan *copilot.AssistantMessageData, 1) - session.On(func(event copilot.SessionEvent) { - if d, ok := event.Data.(*copilot.AssistantMessageData); ok { - if strings.Contains(d.Content, "tool_abort_recovery_ok") { - select { - case recoveryReceived <- d: - default: - } - } - } - }) - - go func() { - _, _ = session.Send(t.Context(), copilot.MessageOptions{ - Prompt: "Say 'tool_abort_recovery_ok'.", - }) - }() - select { - case msg := <-recoveryReceived: - if !strings.Contains(msg.Content, "tool_abort_recovery_ok") { - t.Errorf("Expected recovery message to contain 'tool_abort_recovery_ok', got %q", msg.Content) - } + case <-sessionIdle: case <-time.After(60 * time.Second): - t.Fatal("Timed out waiting for recovery message after abort") + t.Fatal("Timed out waiting for session to become idle after tool abort") + } + + // Session should be usable after abort. + msg, err := session.SendAndWait(t.Context(), copilot.MessageOptions{ + Prompt: "Say 'tool_abort_recovery_ok'.", + }) + if err != nil { + t.Fatalf("Recovery SendAndWait failed after tool abort: %v", err) + } + if content := assistantContent(t, msg); !strings.Contains(content, "tool_abort_recovery_ok") { + t.Errorf("Expected recovery message to contain 'tool_abort_recovery_ok', got %q", content) } }) } diff --git a/go/internal/e2e/rpc_session_state_extras_e2e_test.go b/go/internal/e2e/rpc_session_state_extras_e2e_test.go index 1e33e8a8bc..99dc0b7572 100644 --- a/go/internal/e2e/rpc_session_state_extras_e2e_test.go +++ b/go/internal/e2e/rpc_session_state_extras_e2e_test.go @@ -70,45 +70,45 @@ func TestRpcSessionStateExtras(t *testing.T) { session := createPortedSession(t, client, nil) defer session.Disconnect() defer func() { - _, _ = session.RPC.Permissions.SetAllowAll(t.Context(), &rpc.PermissionsSetAllowAllRequest{Enabled: copilot.Bool(false)}) + _, _ = session.RPC.Permissions.SetMode(t.Context(), &rpc.PermissionsSetModeRequest{Mode: rpc.PermissionModeManual}) }() - initial, err := session.RPC.Permissions.GetAllowAll(t.Context()) + initial, err := session.RPC.Permissions.GetMode(t.Context()) if err != nil { - t.Fatalf("Permissions.GetAllowAll initial failed: %v", err) + t.Fatalf("Permissions.GetMode initial failed: %v", err) } - if initial.Enabled { - t.Fatal("Allow-all should be disabled on a fresh session") + if initial.Mode != rpc.PermissionModeManual { + t.Fatalf("Expected manual mode on a fresh session, got %q", initial.Mode) } - enable, err := session.RPC.Permissions.SetAllowAll(t.Context(), &rpc.PermissionsSetAllowAllRequest{Enabled: copilot.Bool(true)}) + enable, err := session.RPC.Permissions.SetMode(t.Context(), &rpc.PermissionsSetModeRequest{Mode: rpc.PermissionModeAllowAll}) if err != nil { - t.Fatalf("Permissions.SetAllowAll(true) failed: %v", err) + t.Fatalf("Permissions.SetMode(allow-all) failed: %v", err) } - if !enable.Success || !enable.Enabled { - t.Fatalf("Expected successful enable, got %+v", enable) + if !enable.Success || enable.Mode != rpc.PermissionModeAllowAll { + t.Fatalf("Expected successful allow-all mode change, got %+v", enable) } - afterEnable, err := session.RPC.Permissions.GetAllowAll(t.Context()) + afterEnable, err := session.RPC.Permissions.GetMode(t.Context()) if err != nil { - t.Fatalf("Permissions.GetAllowAll after enable failed: %v", err) + t.Fatalf("Permissions.GetMode after allow-all failed: %v", err) } - if !afterEnable.Enabled { - t.Fatal("Expected allow-all to be enabled") + if afterEnable.Mode != rpc.PermissionModeAllowAll { + t.Fatalf("Expected allow-all mode, got %q", afterEnable.Mode) } - disable, err := session.RPC.Permissions.SetAllowAll(t.Context(), &rpc.PermissionsSetAllowAllRequest{Enabled: copilot.Bool(false)}) + disable, err := session.RPC.Permissions.SetMode(t.Context(), &rpc.PermissionsSetModeRequest{Mode: rpc.PermissionModeManual}) if err != nil { - t.Fatalf("Permissions.SetAllowAll(false) failed: %v", err) + t.Fatalf("Permissions.SetMode(manual) failed: %v", err) } - if !disable.Success || disable.Enabled { - t.Fatalf("Expected successful disable, got %+v", disable) + if !disable.Success || disable.Mode != rpc.PermissionModeManual { + t.Fatalf("Expected successful manual mode change, got %+v", disable) } - afterDisable, err := session.RPC.Permissions.GetAllowAll(t.Context()) + afterDisable, err := session.RPC.Permissions.GetMode(t.Context()) if err != nil { - t.Fatalf("Permissions.GetAllowAll after disable failed: %v", err) + t.Fatalf("Permissions.GetMode after manual failed: %v", err) } - if afterDisable.Enabled { - t.Fatal("Expected allow-all to be disabled") + if afterDisable.Mode != rpc.PermissionModeManual { + t.Fatalf("Expected manual mode, got %q", afterDisable.Mode) } }) diff --git a/go/internal/e2e/rpc_ui_ephemeral_query_e2e_test.go b/go/internal/e2e/rpc_ui_ephemeral_query_e2e_test.go index 073af7d91b..413187abd1 100644 --- a/go/internal/e2e/rpc_ui_ephemeral_query_e2e_test.go +++ b/go/internal/e2e/rpc_ui_ephemeral_query_e2e_test.go @@ -14,10 +14,10 @@ func TestRpcUiEphemeralQuery(t *testing.T) { t.Cleanup(func() { client.ForceStop() }) t.Run("should_answer_ephemeral_query", func(t *testing.T) { - // TODO(cli-1.0.81-2): CLI 1.0.81-2 fails session.ui.ephemeralQuery against the + // TODO(cli-1.0.81-2): CLI 1.0.81-4 still fails session.ui.ephemeralQuery against the // recorded snapshot ("Failed to get response from the AI model"). Re-enable once // the runtime fix ships. - t.Skip("blocked on CLI 1.0.81-2 session.ui.ephemeralQuery regression") + t.Skip("blocked on CLI 1.0.81-4 session.ui.ephemeralQuery regression") ctx.ConfigureForTest(t) session := createPortedSession(t, client, nil) diff --git a/go/rpc/zrpc.go b/go/rpc/zrpc.go index 3a31d4c814..d8735313a9 100644 --- a/go/rpc/zrpc.go +++ b/go/rpc/zrpc.go @@ -461,28 +461,6 @@ type AgentsGetDiscoveryPathsRequest struct { ProjectPaths []string `json:"projectPaths,omitzero"` } -// Indicates whether the operation succeeded and reports the post-mutation state. -// Experimental: AllowAllPermissionSetResult is part of an experimental API and may change -// or be removed. -type AllowAllPermissionSetResult struct { - // Authoritative full allow-all state after the mutation - Enabled bool `json:"enabled"` - // Authoritative allow-all mode after the mutation - Mode *PermissionsAllowAllMode `json:"mode,omitempty"` - // Whether the operation succeeded - Success bool `json:"success"` -} - -// Current allow-all permission mode. -// Experimental: AllowAllPermissionState is part of an experimental API and may change or be -// removed. -type AllowAllPermissionState struct { - // Whether full allow-all permissions are currently active - Enabled bool `json:"enabled"` - // Current allow-all mode - Mode *PermissionsAllowAllMode `json:"mode,omitempty"` -} - // A user message attachment — a file, directory, code selection, blob, GitHub-anchored // pointer, or extension-supplied context payload // Experimental: Attachment is part of an experimental API and may change or be removed. @@ -1366,6 +1344,473 @@ type CapiSessionOptions struct { EnableWebSocketResponses *bool `json:"enableWebSocketResponses,omitempty"` } +// 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: CardDigest is part of an experimental API and may change or be removed. +type CardDigest struct { + // Digest algorithm and canonical representation + Algorithm CardDigestAlgorithm `json:"algorithm"` + // SHA-256 digest of the RFC 8785 canonical UTF-8 bytes, encoded as exactly 64 lowercase + // hexadecimal characters. + Value string `json:"value"` +} + +// SHA-256 digest encoded as exactly 64 lowercase hexadecimal characters. +// Experimental: CardDigestValue is part of an experimental API and may change or be removed. +type CardDigestValue string + +// 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: CatalogAiSkillCandidateProvenance is part of an experimental API and may +// change or be removed. +type CatalogAiSkillCandidateProvenance struct { + // Host of the catalog authority that advertised the reference, without path, query, or + // credentials. Inert untrusted data. + Authority string `json:"authority"` + // Media type advertised for the referenced AI skill card + MediaType CatalogAiSkillCandidateProvenanceMediaType `json:"mediaType"` + // ISO 8601 timestamp at which the runtime observed the catalog reference. This is not a + // retrieval or validation timestamp. + ObservedAt string `json:"observedAt"` +} + +// 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. +// Experimental: CatalogCandidate is part of an experimental API and may change or be +// removed. +type CatalogCandidate interface { + catalogCandidate() + Kind() CatalogCandidateKind +} + +type RawCatalogCandidateData struct { + Discriminator CatalogCandidateKind + Raw json.RawMessage +} + +func (RawCatalogCandidateData) catalogCandidate() {} +func (r RawCatalogCandidateData) Kind() CatalogCandidateKind { + return r.Discriminator +} + +// An inert AI skill catalog result. AI skills are discovery-only and cannot be represented +// as installable through this surface. +// Experimental: CatalogAiSkillCandidate is part of an experimental API and may change or be +// removed. +type CatalogAiSkillCandidate struct { + // Description taken verbatim from the card. Inert untrusted text. + Description *string `json:"description,omitempty"` + // Display name taken verbatim from the card. Inert untrusted text. + DisplayName string `json:"displayName"` + // 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. + Handle string `json:"handle"` + // ISO 8601 timestamp after which the handle is stale and will be rejected. + HandleExpiresAt string `json:"handleExpiresAt"` + // AI skills are discovery-only and cannot be installed through this surface + Installability CatalogAiSkillCandidateInstallability `json:"installability"` + // Media type of the underlying AI skill card + MediaType CatalogAiSkillCandidateMediaType `json:"mediaType"` + // Where the catalog reference was observed, without the card itself or any content digest. + Provenance CatalogAiSkillCandidateProvenance `json:"provenance"` + // Publisher taken verbatim from the card. Inert untrusted text. + Publisher *string `json:"publisher,omitempty"` + // 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. + Source CatalogCandidateSource `json:"source"` +} + +func (CatalogAiSkillCandidate) catalogCandidate() {} +func (CatalogAiSkillCandidate) Kind() CatalogCandidateKind { + return CatalogCandidateKindAiSkill +} + +// 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. +// Experimental: CatalogMCPServerCandidate is part of an experimental API and may change or +// be removed. +type CatalogMCPServerCandidate struct { + // Description taken verbatim from the card. Inert untrusted text. + Description *string `json:"description,omitempty"` + // Display name taken verbatim from the card. Inert untrusted text. + DisplayName string `json:"displayName"` + // 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. + Handle string `json:"handle"` + // ISO 8601 timestamp after which the handle is stale and will be rejected. + HandleExpiresAt string `json:"handleExpiresAt"` + // Whether this MCP server can be planned for installation, and if policy prevents it. + Installability CatalogMCPServerInstallability `json:"installability"` + // JSON MCP media type of the underlying card. + MediaType MCPServerCardMediaType `json:"mediaType"` + // Where the catalog reference was observed, without the card itself or any content digest. + Provenance CatalogMCPServerCandidateProvenance `json:"provenance"` + // Publisher taken verbatim from the card. Inert untrusted text. + Publisher *string `json:"publisher,omitempty"` + // 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. + Source CatalogCandidateSource `json:"source"` +} + +func (CatalogMCPServerCandidate) catalogCandidate() {} +func (CatalogMCPServerCandidate) Kind() CatalogCandidateKind { + return CatalogCandidateKindMCPServer +} + +// 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. +// Experimental: CatalogCandidateSource is part of an experimental API and may change or be +// removed. +type CatalogCandidateSource interface { + catalogCandidateSource() + Kind() CatalogCandidateSourceKind +} + +type RawCatalogCandidateSourceData struct { + Discriminator CatalogCandidateSourceKind + Raw json.RawMessage +} + +func (RawCatalogCandidateSourceData) catalogCandidateSource() {} +func (r RawCatalogCandidateSourceData) Kind() CatalogCandidateSourceKind { + return r.Discriminator +} + +// Candidate whose card reference arrived inline. The document and its content-derived +// properties stay behind the runtime boundary. +// Experimental: CatalogCandidateSourceEmbedded is part of an experimental API and may +// change or be removed. +type CatalogCandidateSourceEmbedded struct { +} + +func (CatalogCandidateSourceEmbedded) catalogCandidateSource() {} +func (CatalogCandidateSourceEmbedded) Kind() CatalogCandidateSourceKind { + return CatalogCandidateSourceKindEmbedded +} + +// Candidate whose card is retrieved from a URL through the runtime's hardened fetch +// boundary. +// Experimental: CatalogCandidateSourceURL is part of an experimental API and may change or +// be removed. +type CatalogCandidateSourceURL struct { + // Card URL as advertised. Inert untrusted data: the runtime retrieves it only through its + // own hardened boundary, and it is never logged. + URL string `json:"url"` +} + +func (CatalogCandidateSourceURL) catalogCandidateSource() {} +func (CatalogCandidateSourceURL) Kind() CatalogCandidateSourceKind { + return CatalogCandidateSourceKindURL +} + +// Bounded extensible wire-feature identifier. Known values are described by +// `CatalogCapability`; newer callers may send future identifiers so an older runtime can +// return a typed negotiation refusal instead of failing schema validation. Capability +// negotiation establishes contract understanding, while each operation's result separately +// reports runtime availability. +// Experimental: CatalogCapabilityID is part of an experimental API and may change or be +// removed. +type CatalogCapabilityID string + +// The protocol version and capability set a caller requires, supplied on every catalog +// request so negotiation cannot be skipped by omission. +// Experimental: CatalogClientContract is part of an experimental API and may change or be +// removed. +type CatalogClientContract struct { + // 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. + ProtocolVersion int64 `json:"protocolVersion"` + // 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. + RequiredCapabilities []string `json:"requiredCapabilities"` +} + +// 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: CatalogMCPServerCandidateProvenance is part of an experimental API and may +// change or be removed. +type CatalogMCPServerCandidateProvenance struct { + // Host of the catalog authority that advertised the reference, without path, query, or + // credentials. Inert untrusted data. + Authority string `json:"authority"` + // JSON MCP media type advertised for the referenced card. + MediaType MCPServerCardMediaType `json:"mediaType"` + // ISO 8601 timestamp at which the runtime observed the catalog reference. This is not a + // retrieval or validation timestamp. + ObservedAt string `json:"observedAt"` +} + +// The protocol version and capability set the runtime actually honoured for a successful +// catalog operation. +// Experimental: CatalogNegotiatedContract is part of an experimental API and may change or +// be removed. +type CatalogNegotiatedContract struct { + // 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. + GrantedCapabilities []CatalogCapability `json:"grantedCapabilities"` + // Protocol version of the runtime that served the request. + RuntimeProtocolVersion int64 `json:"runtimeProtocolVersion"` +} + +// 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: CatalogSearchRequest is part of an experimental API and may change or be +// removed. +type CatalogSearchRequest struct { + // Protocol version and capabilities the caller requires. + Contract CatalogClientContract `json:"contract"` + // Restrict results to these candidate kinds. When omitted, every kind the runtime supports + // is searched. + Kinds []CatalogCandidateKind `json:"kinds,omitzero"` + // Maximum number of candidates to return. Defaults to 10 when omitted. + Limit *int32 `json:"limit,omitempty"` + // Free-text search query. Never written to logs or telemetry. + Query string `json:"query"` +} + +// Outcome of a catalog.search call: either bounded inert candidates, or one typed refusal. +// Never a partial success. +// Experimental: CatalogSearchResult is part of an experimental API and may change or be +// removed. +type CatalogSearchResult interface { + catalogSearchResult() + Kind() CatalogSearchResultKind +} + +type RawCatalogSearchResultData struct { + Discriminator CatalogSearchResultKind + Raw json.RawMessage +} + +func (RawCatalogSearchResultData) catalogSearchResult() {} +func (r RawCatalogSearchResultData) Kind() CatalogSearchResultKind { + return r.Discriminator +} + +// 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. +// Experimental: CatalogAuthenticationRequiredError is part of an experimental API and may +// change or be removed. +type CatalogAuthenticationRequiredError struct { + // Human-readable explanation, safe to surface. Never contains a credential or token, nor a + // query, URL, handle, or secret. + Message string `json:"message"` + // Why authentication failed. Only an expired credential justifies attempting a silent + // refresh; an absent or rejected credential requires sign-in. + Reason CatalogAuthenticationRequiredReason `json:"reason"` +} + +func (CatalogAuthenticationRequiredError) catalogSearchResult() {} +func (CatalogAuthenticationRequiredError) Kind() CatalogSearchResultKind { + return CatalogSearchResultKindAuthenticationRequired +} + +// 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. +// Experimental: CatalogContractViolationError is part of an experimental API and may change +// or be removed. +type CatalogContractViolationError struct { + // Human-readable explanation, safe to surface. Never echoes response content, nor a query, + // URL, handle, or secret. + Message string `json:"message"` + // Which rule the response broke. + Reason CatalogContractViolationReason `json:"reason"` +} + +func (CatalogContractViolationError) catalogSearchResult() {} +func (CatalogContractViolationError) Kind() CatalogSearchResultKind { + return CatalogSearchResultKindContractViolation +} + +// The request was rejected before any work was done, because a bounded field fell outside +// its permitted range or a required field was unusable. +// Experimental: CatalogInvalidRequestError is part of an experimental API and may change or +// be removed. +type CatalogInvalidRequestError struct { + // Which request field was rejected. + Field CatalogInvalidRequestField `json:"field"` + // Human-readable explanation, safe to surface. Never echoes the offending value, nor a + // query, URL, handle, or secret. + Message string `json:"message"` +} + +func (CatalogInvalidRequestError) catalogSearchResult() {} +func (CatalogInvalidRequestError) Kind() CatalogSearchResultKind { + return CatalogSearchResultKindInvalidRequest +} + +// A card could not be parsed or did not satisfy its declared media type's schema. +// Experimental: CatalogMalformedCardError is part of an experimental API and may change or +// be removed. +type CatalogMalformedCardError struct { + // Media type the card was interpreted as, when it declared one this runtime recognises. + MediaType *CatalogMediaType `json:"mediaType,omitempty"` + // Human-readable explanation, safe to surface. Never echoes card content, nor a query, URL, + // handle, or secret. + Message string `json:"message"` + // How the card failed validation. + Reason CatalogMalformedCardReason `json:"reason"` +} + +func (CatalogMalformedCardError) catalogSearchResult() {} +func (CatalogMalformedCardError) Kind() CatalogSearchResultKind { + return CatalogSearchResultKindMalformedCard +} + +// The caller's protocol version or required capabilities cannot be honoured. Returned +// instead of a partial or ambiguous success. +// Experimental: CatalogNegotiationRefusedError is part of an experimental API and may +// change or be removed. +type CatalogNegotiationRefusedError struct { + // Human-readable explanation, safe to surface. Never contains a query, URL, handle, or + // secret. + Message string `json:"message"` + // Lowest caller protocol version this runtime will serve. + MinimumSupportedProtocolVersion int64 `json:"minimumSupportedProtocolVersion"` + // Whether the version or the capability set was the problem. + Reason CatalogNegotiationRefusedReason `json:"reason"` + // Protocol version of the runtime that refused the request. + RuntimeProtocolVersion int64 `json:"runtimeProtocolVersion"` + // 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. + SupportedCapabilities []CatalogCapability `json:"supportedCapabilities"` + // The subset of the caller's bounded extensible capability identifiers this runtime cannot + // honour. + UnsupportedCapabilities []string `json:"unsupportedCapabilities"` +} + +func (CatalogNegotiationRefusedError) catalogSearchResult() {} +func (CatalogNegotiationRefusedError) Kind() CatalogSearchResultKind { + return CatalogSearchResultKindNegotiationRefused +} + +// The runtime could not reach the catalog authority or retrieve a card. Covers being +// offline as well as transport-level failure. +// Experimental: CatalogNetworkFailureError is part of an experimental API and may change or +// be removed. +type CatalogNetworkFailureError struct { + // Human-readable explanation, safe to surface. Never contains a query, URL, handle, or + // secret. + Message string `json:"message"` + // Categorised failure, low cardinality so it can be aggregated without carrying a URL. + Reason CatalogNetworkFailureReason `json:"reason"` + // HTTP status code, when the failure was a rejected response. + StatusCode *int32 `json:"statusCode,omitempty"` +} + +func (CatalogNetworkFailureError) catalogSearchResult() {} +func (CatalogNetworkFailureError) Kind() CatalogSearchResultKind { + return CatalogSearchResultKindNetworkFailure +} + +// Registry or enterprise policy refused the operation. +// Experimental: CatalogPolicyRejectedError is part of an experimental API and may change or +// be removed. +type CatalogPolicyRejectedError struct { + // Human-readable explanation, safe to surface. Never contains a query, URL, handle, or + // secret. + Message string `json:"message"` + // Which authority produced the decision. + Source MCPPlanPolicySource `json:"source"` +} + +func (CatalogPolicyRejectedError) catalogSearchResult() {} +func (CatalogPolicyRejectedError) Kind() CatalogSearchResultKind { + return CatalogSearchResultKindPolicyRejected +} + +// A completed catalog search: inert candidate summaries, each carrying a single-use handle. +// Experimental: CatalogSearchSucceeded is part of an experimental API and may change or be +// removed. +type CatalogSearchSucceeded struct { + // Matching candidates, never more than the requested limit. All text is inert untrusted + // data. + Candidates []CatalogCandidate `json:"candidates"` + // Protocol version and capabilities the runtime honoured. + Negotiated CatalogNegotiatedContract `json:"negotiated"` + // 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. + SearchID string `json:"searchId"` + // Whether further matches existed beyond the requested limit. + Truncated bool `json:"truncated"` +} + +func (CatalogSearchSucceeded) catalogSearchResult() {} +func (CatalogSearchSucceeded) Kind() CatalogSearchResultKind { + return CatalogSearchResultKindSucceeded +} + +// The operation is not available on this runtime. Distinct from a network failure: nothing +// was attempted. +// Experimental: CatalogUnavailableError is part of an experimental API and may change or be +// removed. +type CatalogUnavailableError struct { + // Human-readable explanation, safe to surface. Never contains a query, URL, handle, or + // secret. + Message string `json:"message"` + // Why the operation is unavailable. + Reason CatalogUnavailableReason `json:"reason"` +} + +func (CatalogUnavailableError) catalogSearchResult() {} +func (CatalogUnavailableError) Kind() CatalogSearchResultKind { + return CatalogSearchResultKindUnavailable +} + +// Retrieval was refused by the runtime's hardened fetch boundary before any request left +// the process, or before a redirect was followed. +// Experimental: CatalogUnsafeRetrievalError is part of an experimental API and may change +// or be removed. +type CatalogUnsafeRetrievalError struct { + // Human-readable explanation, safe to surface. Never contains the refused URL, nor a query, + // handle, or secret. + Message string `json:"message"` + // Which control refused the retrieval, low cardinality so it can be aggregated without + // carrying a URL. + Reason CatalogUnsafeRetrievalReason `json:"reason"` +} + +func (CatalogUnsafeRetrievalError) catalogSearchResult() {} +func (CatalogUnsafeRetrievalError) Kind() CatalogSearchResultKind { + return CatalogSearchResultKindUnsafeRetrieval +} + +// The request asked for a candidate kind this runtime does not serve. +// Experimental: CatalogUnsupportedKindError is part of an experimental API and may change +// or be removed. +type CatalogUnsupportedKindError struct { + // Human-readable explanation, safe to surface. Never contains a query, URL, handle, or + // secret. + Message string `json:"message"` + // The kinds from the request that are not supported. + RequestedKinds []CatalogCandidateKind `json:"requestedKinds"` + // Every candidate kind this runtime can serve. + SupportedKinds []CatalogCandidateKind `json:"supportedKinds"` +} + +func (CatalogUnsupportedKindError) catalogSearchResult() {} +func (CatalogUnsupportedKindError) Kind() CatalogSearchResultKind { + return CatalogSearchResultKindUnsupportedKind +} + // Slash commands available in the session, after applying any include/exclude filters. // Experimental: CommandList is part of an experimental API and may change or be removed. type CommandList struct { @@ -4628,6 +5073,44 @@ type MCPHostState struct { PendingConnections []string `json:"pendingConnections"` } +// A normalised, inert description of what installing an MCP server would involve. Carries +// no raw card, no install specification, and no secret value. +// Experimental: MCPInstallPlan is part of an experimental API and may change or be removed. +type MCPInstallPlan struct { + // The configuration changes installing would make, described rather than serialised, so the + // mutable configuration payload stays behind the runtime boundary. + ConfigurationChanges []MCPPlanConfigurationChange `json:"configurationChanges"` + // Normalised identity of the server the plan would install. + Identity MCPPlanResourceIdentity `json:"identity"` + // 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. + PlanHandle string `json:"planHandle"` + // 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. + PlanHandleExpiresAt string `json:"planHandleExpiresAt"` + // Outcome of evaluating the server against registry and enterprise policy. + Policy MCPPlanPolicyResult `json:"policy"` + // Origin and semantic digest of the exact validated JSON MCP card content bound to this + // plan. + Provenance MCPPlanProvenance `json:"provenance"` + // Identifier of the choice the runtime would pick by default. Omitted when there is no + // eligible transport, or when the runtime expresses no preference. + RecommendedTransportChoiceID *string `json:"recommendedTransportChoiceId,omitempty"` + // Whether applying this plan would require an MCP reload to take effect. Planning itself + // never reloads. + ReloadRequired bool `json:"reloadRequired"` + // Whether the plan cannot be applied without further input, because a required value has no + // default or a secret must be supplied. + RequiresInteractiveConfiguration bool `json:"requiresInteractiveConfiguration"` + // Configuration scope and key the plan would write to. + Target MCPPlanTarget `json:"target"` + // 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. + TransportChoices []MCPPlanTransportChoice `json:"transportChoices"` +} + // Server name to check running status for. // Experimental: MCPIsServerRunningRequest is part of an experimental API and may change or // be removed. @@ -4875,6 +5358,439 @@ type MCPOauthRespondResult struct { Success bool `json:"success"` } +// One change applying the plan would make, described rather than serialised so the +// configuration payload stays behind the runtime boundary. +// Experimental: MCPPlanConfigurationChange is part of an experimental API and may change or +// be removed. +type MCPPlanConfigurationChange struct { + // Names of the configuration fields the change would set, without their values. + ChangedFields []string `json:"changedFields"` + // Configuration key the change applies to. + ConfigKey string `json:"configKey"` + // Whether the change would create a new entry or modify an existing one. + Operation MCPPlanConfigurationOperation `json:"operation"` + // Scope the change would be written to. + Scope MCPPlanScope `json:"scope"` + // Secret placeholders the written configuration would reference. The constrained + // placeholder type cannot carry a literal secret value. + SecretReferences []string `json:"secretReferences"` +} + +// A side-effect-free request for an MCP install plan. Computing a plan never writes +// configuration, stores a secret, or reloads MCP servers. +// Experimental: MCPPlanInstallRequest is part of an experimental API and may change or be +// removed. +type MCPPlanInstallRequest struct { + // Protocol version and capabilities the caller requires. + Contract CatalogClientContract `json:"contract"` + // Configuration scope the plan targets. Defaults to user scope when omitted. + Scope *MCPPlanScope `json:"scope,omitempty"` + // What to plan: either a candidate handle from a previous search, or a card supplied + // directly. + Source MCPPlanInstallSource `json:"source"` +} + +// Outcome of an mcp.planInstall call: either a normalised plan, or one typed refusal. +// Nothing is written in either case. +// Experimental: MCPPlanInstallResult is part of an experimental API and may change or be +// removed. +type MCPPlanInstallResult interface { + mcpPlanInstallResult() + mcpPlanInstallResultKind() MCPPlanInstallResultKind +} + +type RawMCPPlanInstallResultData struct { + Discriminator MCPPlanInstallResultKind + Raw json.RawMessage +} + +func (RawMCPPlanInstallResultData) mcpPlanInstallResult() {} +func (r RawMCPPlanInstallResultData) mcpPlanInstallResultKind() MCPPlanInstallResultKind { + return r.Discriminator +} +func (CatalogAuthenticationRequiredError) mcpPlanInstallResult() {} +func (CatalogAuthenticationRequiredError) mcpPlanInstallResultKind() MCPPlanInstallResultKind { + return MCPPlanInstallResultKindAuthenticationRequired +} +func (CatalogContractViolationError) mcpPlanInstallResult() {} +func (CatalogContractViolationError) mcpPlanInstallResultKind() MCPPlanInstallResultKind { + return MCPPlanInstallResultKindContractViolation +} + +// A presented handle was not accepted. Handles are runtime-instance scoped, TTL-bound, and +// single-use, so each way of failing is reported distinctly. +// Experimental: CatalogHandleRejectedError is part of an experimental API and may change or +// be removed. +type CatalogHandleRejectedError struct { + // Which kind of handle was presented. + HandleType CatalogHandleType `json:"handleType"` + // Human-readable explanation, safe to surface. Never contains the handle itself, nor a + // query, URL, or secret. + Message string `json:"message"` + // Why the handle was rejected. + Reason CatalogHandleRejectionReason `json:"reason"` +} + +func (CatalogHandleRejectedError) mcpPlanInstallResult() {} +func (CatalogHandleRejectedError) mcpPlanInstallResultKind() MCPPlanInstallResultKind { + return MCPPlanInstallResultKindHandleRejected +} +func (CatalogInvalidRequestError) mcpPlanInstallResult() {} +func (CatalogInvalidRequestError) mcpPlanInstallResultKind() MCPPlanInstallResultKind { + return MCPPlanInstallResultKindInvalidRequest +} +func (CatalogMalformedCardError) mcpPlanInstallResult() {} +func (CatalogMalformedCardError) mcpPlanInstallResultKind() MCPPlanInstallResultKind { + return MCPPlanInstallResultKindMalformedCard +} +func (CatalogNegotiationRefusedError) mcpPlanInstallResult() {} +func (CatalogNegotiationRefusedError) mcpPlanInstallResultKind() MCPPlanInstallResultKind { + return MCPPlanInstallResultKindNegotiationRefused +} +func (CatalogNetworkFailureError) mcpPlanInstallResult() {} +func (CatalogNetworkFailureError) mcpPlanInstallResultKind() MCPPlanInstallResultKind { + return MCPPlanInstallResultKindNetworkFailure +} + +// The candidate is discoverable but cannot be installed. `application/ai-skill` resolves +// here, because it stays searchable while remaining typed non-installable. +// Experimental: CatalogNotInstallableError is part of an experimental API and may change or +// be removed. +type CatalogNotInstallableError struct { + // Human-readable explanation, safe to surface. Never contains a query, URL, handle, or + // secret. + Message string `json:"message"` + // Why the candidate cannot be installed. + Reason CatalogNotInstallableReason `json:"reason"` +} + +func (CatalogNotInstallableError) mcpPlanInstallResult() {} +func (CatalogNotInstallableError) mcpPlanInstallResultKind() MCPPlanInstallResultKind { + return MCPPlanInstallResultKindNotInstallable +} +func (CatalogPolicyRejectedError) mcpPlanInstallResult() {} +func (CatalogPolicyRejectedError) mcpPlanInstallResultKind() MCPPlanInstallResultKind { + return MCPPlanInstallResultKindPolicyRejected +} +func (CatalogUnavailableError) mcpPlanInstallResult() {} +func (CatalogUnavailableError) mcpPlanInstallResultKind() MCPPlanInstallResultKind { + return MCPPlanInstallResultKindUnavailable +} + +// No transport this runtime can use is available for the requested server. +// Experimental: CatalogUnavailableTransportError is part of an experimental API and may +// change or be removed. +type CatalogUnavailableTransportError struct { + // Human-readable explanation, safe to surface. Never contains a query, URL, handle, or + // secret. + Message string `json:"message"` + // Why no transport could be offered. + Reason CatalogUnavailableTransportReason `json:"reason"` +} + +func (CatalogUnavailableTransportError) mcpPlanInstallResult() {} +func (CatalogUnavailableTransportError) mcpPlanInstallResultKind() MCPPlanInstallResultKind { + return MCPPlanInstallResultKindUnavailableTransport +} +func (CatalogUnsafeRetrievalError) mcpPlanInstallResult() {} +func (CatalogUnsafeRetrievalError) mcpPlanInstallResultKind() MCPPlanInstallResultKind { + return MCPPlanInstallResultKindUnsafeRetrieval +} + +// 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. +// Experimental: MCPPlanInstallPlanned is part of an experimental API and may change or be +// removed. +type MCPPlanInstallPlanned struct { + // Protocol version and capabilities the runtime honoured. + Negotiated CatalogNegotiatedContract `json:"negotiated"` + // The normalised plan. + Plan MCPInstallPlan `json:"plan"` +} + +func (MCPPlanInstallPlanned) mcpPlanInstallResult() {} +func (MCPPlanInstallPlanned) mcpPlanInstallResultKind() MCPPlanInstallResultKind { + return MCPPlanInstallResultKindPlanned +} + +// What an install plan is computed from: a candidate handle from a previous search, or a +// card supplied directly. +// Experimental: MCPPlanInstallSource is part of an experimental API and may change or be +// removed. +type MCPPlanInstallSource interface { + mcpPlanInstallSource() + Kind() MCPPlanInstallSourceKind +} + +type RawMCPPlanInstallSourceData struct { + Discriminator MCPPlanInstallSourceKind + Raw json.RawMessage +} + +func (RawMCPPlanInstallSourceData) mcpPlanInstallSource() {} +func (r RawMCPPlanInstallSourceData) Kind() MCPPlanInstallSourceKind { + return r.Discriminator +} + +// Plan from a candidate returned by a previous catalog search. +// Experimental: MCPPlanInstallSourceCandidate is part of an experimental API and may change +// or be removed. +type MCPPlanInstallSourceCandidate struct { + // Single-use candidate handle. Consumed by this call, so a replay of the same handle is + // rejected. + CandidateHandle string `json:"candidateHandle"` + // 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. + SearchID string `json:"searchId"` +} + +func (MCPPlanInstallSourceCandidate) mcpPlanInstallSource() {} +func (MCPPlanInstallSourceCandidate) Kind() MCPPlanInstallSourceKind { + return MCPPlanInstallSourceKindCandidate +} + +// Plan from a card supplied directly by the caller, without a preceding search. +// Experimental: MCPPlanInstallSourceCard is part of an experimental API and may change or +// be removed. +type MCPPlanInstallSourceCard struct { + // The card to plan from: exactly one of a URL or embedded data. + Card MCPServerCardReference `json:"card"` +} + +func (MCPPlanInstallSourceCard) mcpPlanInstallSource() {} +func (MCPPlanInstallSourceCard) Kind() MCPPlanInstallSourceKind { + return MCPPlanInstallSourceKindCard +} + +// Outcome of evaluating the planned server against registry and enterprise policy. +// Evaluation is read-only. +// Experimental: MCPPlanPolicyResult is part of an experimental API and may change or be +// removed. +type MCPPlanPolicyResult struct { + // What policy decided for this server. + Decision MCPPlanPolicyDecision `json:"decision"` + // Human-readable explanation, safe to surface. Never contains a query, URL, handle, or + // secret. + Reason *string `json:"reason,omitempty"` + // Which authority produced the decision. + Source MCPPlanPolicySource `json:"source"` +} + +// Provenance of the exact validated JSON MCP card content bound privately to a completed +// plan and its opaque handle. +// Experimental: MCPPlanProvenance is part of an experimental API and may change or be +// removed. +type MCPPlanProvenance struct { + // Authority associated with the validated card, without path, query, or credentials. Inert + // untrusted data. + Authority string `json:"authority"` + // Semantic digest of the exact validated JSON content bound to the plan handle. + CardDigest CardDigest `json:"cardDigest"` + // JSON MCP media type the validated card was interpreted as. + MediaType MCPServerCardMediaType `json:"mediaType"` + // ISO 8601 timestamp at which the runtime completed strict parsing and schema validation of + // the card content. + ValidatedAt string `json:"validatedAt"` +} + +// 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. +// Experimental: MCPPlanRequiredValue is part of an experimental API and may change or be +// removed. +type MCPPlanRequiredValue interface { + mcpPlanRequiredValue() + Kind() MCPPlanRequiredValueKind +} + +type RawMCPPlanRequiredValueData struct { + Discriminator MCPPlanRequiredValueKind + Raw json.RawMessage +} + +func (RawMCPPlanRequiredValueData) mcpPlanRequiredValue() {} +func (r RawMCPPlanRequiredValueData) Kind() MCPPlanRequiredValueKind { + return r.Discriminator +} + +// One enumerated non-secret value a transport choice needs before it can be applied. The +// permitted values are structurally required. +// Experimental: MCPPlanRequiredValueEnum is part of an experimental API and may change or +// be removed. +type MCPPlanRequiredValueEnum struct { + // Where the value is applied when the server is launched. + Category MCPPlanValueCategory `json:"category"` + // 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. + DefaultValue *string `json:"defaultValue,omitempty"` + // Human-readable explanation from the card. Inert untrusted text. + Description *string `json:"description,omitempty"` + // Non-empty permitted value set. Inert untrusted data. + EnumValues []string `json:"enumValues"` + // Whether the value may be supplied more than once. + IsRepeated bool `json:"isRepeated"` + // Key the value is supplied under. Inert untrusted data. + Key string `json:"key"` + // Whether the value must be present for the plan to be applicable. + Required bool `json:"required"` + // Human-readable label from the card. Inert untrusted text. + Title *string `json:"title,omitempty"` + // Discriminator: the value must be one of `enumValues`. + ValueType MCPPlanEnumValueType `json:"valueType"` +} + +func (MCPPlanRequiredValueEnum) mcpPlanRequiredValue() {} +func (MCPPlanRequiredValueEnum) Kind() MCPPlanRequiredValueKind { + return MCPPlanRequiredValueKindEnum +} + +// One non-secret scalar value a transport choice needs before it can be applied. +// Experimental: MCPPlanRequiredValueScalar is part of an experimental API and may change or +// be removed. +type MCPPlanRequiredValueScalar struct { + // Where the value is applied when the server is launched. + Category MCPPlanValueCategory `json:"category"` + // 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. + DefaultValue *string `json:"defaultValue,omitempty"` + // Human-readable explanation from the card. Inert untrusted text. + Description *string `json:"description,omitempty"` + // Whether the value may be supplied more than once. + IsRepeated bool `json:"isRepeated"` + // Key the value is supplied under. Inert untrusted data. + Key string `json:"key"` + // Whether the value must be present for the plan to be applicable. + Required bool `json:"required"` + // Human-readable label from the card. Inert untrusted text. + Title *string `json:"title,omitempty"` + // Scalar type the value must conform to. + ValueType MCPPlanScalarValueType `json:"valueType"` +} + +func (MCPPlanRequiredValueScalar) mcpPlanRequiredValue() {} +func (MCPPlanRequiredValueScalar) Kind() MCPPlanRequiredValueKind { + return MCPPlanRequiredValueKindScalar +} + +// Normalised identity of the MCP server a plan targets, independent of how the card spelled +// it. +// Experimental: MCPPlanResourceIdentity is part of an experimental API and may change or be +// removed. +type MCPPlanResourceIdentity struct { + // Canonical, normalised name of the server, for example `io.github.owner/server`. + CanonicalName string `json:"canonicalName"` + // Registry identifier of the server, when it came from a registry. + RegistryID *string `json:"registryId,omitempty"` + // Local configuration key the server would be recorded under. + ServerName string `json:"serverName"` + // Version advertised by the card, when it declares one. + Version *string `json:"version,omitempty"` +} + +// 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: MCPPlanSecretPlaceholder is part of an experimental API and may change or +// be removed. +type MCPPlanSecretPlaceholder struct { + // Key the secret is supplied under. Inert untrusted data. + Key string `json:"key"` + // The runtime-assigned `${secret:}` placeholder written into configuration in place of + // the value. + Placeholder string `json:"placeholder"` + // Human-readable label from the card. Inert untrusted text. + Title *string `json:"title,omitempty"` +} + +// A runtime-assigned secret placeholder. The identifier is carried once, inside the +// placeholder, so it cannot contradict a separate secret-id field. +// Experimental: MCPPlanSecretReference is part of an experimental API and may change or be +// removed. +type MCPPlanSecretReference string + +// Where a plan would be written. +// Experimental: MCPPlanTarget is part of an experimental API and may change or be removed. +type MCPPlanTarget struct { + // Configuration key the server would be recorded under within that scope. + ConfigKey string `json:"configKey"` + // Configuration scope the plan targets. + Scope MCPPlanScope `json:"scope"` +} + +// 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. +// Experimental: MCPPlanTransportChoice is part of an experimental API and may change or be +// removed. +type MCPPlanTransportChoice interface { + mcpPlanTransportChoice() + Transport() MCPPlanTransportChoiceTransport +} + +type RawMCPPlanTransportChoiceData struct { + Discriminator MCPPlanTransportChoiceTransport + Raw json.RawMessage +} + +func (RawMCPPlanTransportChoiceData) mcpPlanTransportChoice() {} +func (r RawMCPPlanTransportChoiceData) Transport() MCPPlanTransportChoiceTransport { + return r.Discriminator +} + +// An eligible local-package transport choice. Package identity is required and a remote +// endpoint cannot be represented. +// Experimental: MCPPlanTransportChoicePackage is part of an experimental API and may change +// or be removed. +type MCPPlanTransportChoicePackage struct { + // Stable identifier for this choice within the plan, used to select it when the plan is + // applied. + ChoiceID string `json:"choiceId"` + // Discriminator: this choice runs a local package + InstallMethod MCPPlanPackageInstallMethod `json:"installMethod"` + // Package identifier. Inert untrusted data. + PackageIdentifier string `json:"packageIdentifier"` + // Packaging ecosystem, for example `oci` or `npm`. + PackageType string `json:"packageType"` + // Typed values this choice requires, excluding secrets. + RequiredValues []MCPPlanRequiredValue `json:"requiredValues"` + // Secrets this choice requires, referenced by placeholder only. + SecretPlaceholders []MCPPlanSecretPlaceholder `json:"secretPlaceholders"` +} + +func (MCPPlanTransportChoicePackage) mcpPlanTransportChoice() {} +func (MCPPlanTransportChoicePackage) Transport() MCPPlanTransportChoiceTransport { + return MCPPlanTransportChoiceTransportStdio +} + +// An eligible remote-endpoint transport choice. The endpoint is required and package +// identity cannot be represented. +// Experimental: MCPPlanTransportChoiceRemote is part of an experimental API and may change +// or be removed. +type MCPPlanTransportChoiceRemote struct { + // Stable identifier for this choice within the plan, used to select it when the plan is + // applied. + ChoiceID string `json:"choiceId"` + // Endpoint URL. Inert untrusted data. + Endpoint string `json:"endpoint"` + // Discriminator: this choice connects to a remote endpoint + InstallMethod MCPPlanRemoteInstallMethod `json:"installMethod"` + // Typed values this choice requires, excluding secrets. + RequiredValues []MCPPlanRequiredValue `json:"requiredValues"` + // Secrets this choice requires, referenced by placeholder only. + SecretPlaceholders []MCPPlanSecretPlaceholder `json:"secretPlaceholders"` + Discriminator MCPPlanRemoteTransport `json:"transport,omitempty"` +} + +func (MCPPlanTransportChoiceRemote) mcpPlanTransportChoice() {} +func (r MCPPlanTransportChoiceRemote) Transport() MCPPlanTransportChoiceTransport { + if r.Discriminator == "" { + return MCPPlanTransportChoiceTransportHTTP + } + return MCPPlanTransportChoiceTransport(r.Discriminator) +} + // Registration parameters for an external MCP client. // Experimental: MCPRegisterExternalClientRequest is part of an experimental API and may // change or be removed. @@ -5328,6 +6244,59 @@ type MCPServerAuthConfigRedirectPort struct { RedirectPort *int32 `json:"redirectPort,omitempty"` } +// 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. +// Experimental: MCPServerCardReference is part of an experimental API and may change or be +// removed. +type MCPServerCardReference interface { + mcpServerCardReference() + Kind() MCPServerCardReferenceKind +} + +type RawMCPServerCardReferenceData struct { + Discriminator MCPServerCardReferenceKind + Raw json.RawMessage +} + +func (RawMCPServerCardReferenceData) mcpServerCardReference() {} +func (r RawMCPServerCardReferenceData) Kind() MCPServerCardReferenceKind { + return r.Discriminator +} + +// An MCP server card supplied inline as an inert document. +// Experimental: MCPServerCardEmbedded is part of an experimental API and may change or be +// removed. +type MCPServerCardEmbedded struct { + // 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. + Data string `json:"data"` + // Media type the card is expected to conform to. + MediaType MCPServerCardMediaType `json:"mediaType"` +} + +func (MCPServerCardEmbedded) mcpServerCardReference() {} +func (MCPServerCardEmbedded) Kind() MCPServerCardReferenceKind { + return MCPServerCardReferenceKindEmbedded +} + +// An MCP server card to be retrieved from a URL through the runtime's hardened fetch +// boundary. +// Experimental: MCPServerCardURL is part of an experimental API and may change or be +// removed. +type MCPServerCardURL struct { + // Media type the card is expected to conform to. + MediaType MCPServerCardMediaType `json:"mediaType"` + // Card URL. Retrieved only through the runtime's hardened boundary, with scheme, + // credential, address-range, redirect, timeout, and response-size controls applied. Never + // logged. + URL string `json:"url"` +} + +func (MCPServerCardURL) mcpServerCardReference() {} +func (MCPServerCardURL) Kind() MCPServerCardReferenceKind { + return MCPServerCardReferenceKindURL +} + // MCP server configuration (stdio, remote HTTP/SSE, or in-process) // Experimental: MCPServerConfig is part of an experimental API and may change or be removed. type MCPServerConfig interface { @@ -6128,6 +7097,16 @@ type ModeSetResult struct { Warning *string `json:"warning,omitempty"` } +// Result of moving in-flight MCP loading to the background. +// Experimental: MoveMCPLoadingToBackgroundResult is part of an experimental API and may +// change or be removed. +type MoveMCPLoadingToBackgroundResult struct { + // 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. + MovedToBackground bool `json:"movedToBackground"` +} + // External SDK input for a named custom model provider. Ingested by the native protocol // boundary before host dispatch. // Experimental: NamedProviderConfig is part of an experimental API and may change or be @@ -7147,9 +8126,17 @@ type PermissionsFolderTrustAddTrustedResult struct { } // No parameters. -// Experimental: PermissionsGetAllowAllRequest is part of an experimental API and may change -// or be removed. -type PermissionsGetAllowAllRequest struct { +// Experimental: PermissionsGetModeRequest is part of an experimental API and may change or +// be removed. +type PermissionsGetModeRequest struct { +} + +// Current permission mode. +// Experimental: PermissionsGetModeResult is part of an experimental API and may change or +// be removed. +type PermissionsGetModeResult struct { + // Current permission mode + Mode PermissionMode `json:"mode"` } // Tool approval to persist and apply @@ -7412,24 +8399,6 @@ type PermissionsResetSessionApprovalsResult struct { Success bool `json:"success"` } -// Allow-all mode to apply for the session. -// Experimental: PermissionsSetAllowAllRequest is part of an experimental API and may change -// or be removed. -type PermissionsSetAllowAllRequest struct { - // Legacy full allow-all toggle. Prefer `mode`; when `mode` is omitted, `enabled: true` is - // treated as `mode: "on"` and any other value is treated as `mode: "off"`. - Enabled *bool `json:"enabled,omitempty"` - // Allow-all mode to apply. `on` enables full allow-all; `auto` enables advisory LLM - // auto-approval; `off` disables both. - Mode *PermissionsAllowAllMode `json:"mode,omitempty"` - // Optional model id for the `auto` mode auto-approval LLM judging. Only meaningful when - // `mode` is `auto`; ignored otherwise. When omitted, the session resolves a default judge - // model: `gpt-5.5` for CAPI sessions and the session's active model for BYOK sessions. - Model *string `json:"model,omitempty"` - // Optional source for allow-all telemetry. Defaults to `rpc` when omitted for SDK callers. - Source *PermissionsSetAllowAllSource `json:"source,omitempty"` -} - // Allow-all toggle for tool permission requests, with an optional telemetry source. // Experimental: PermissionsSetApproveAllRequest is part of an experimental API and may // change or be removed. @@ -7448,6 +8417,32 @@ type PermissionsSetApproveAllResult struct { Success bool `json:"success"` } +// Permission mode to apply for the session. +// Experimental: PermissionsSetModeRequest is part of an experimental API and may change or +// be removed. +type PermissionsSetModeRequest struct { + // Optional judge model id for assisted mode. When omitted, the session resolves the + // provider default: `gpt-5.5` for CAPI sessions and the active session model for BYOK + // sessions. + AssistedApprovalModel *string `json:"assistedApprovalModel,omitempty"` + // Permission mode to apply + Mode PermissionMode `json:"mode"` + // Optional source for permission-mode telemetry. Defaults to `rpc` when omitted for SDK + // callers. + Source *PermissionModeSource `json:"source,omitempty"` +} + +// Indicates whether the requested permission mode was applied and reports the authoritative +// post-mutation mode. +// Experimental: PermissionsSetModeResult is part of an experimental API and may change or +// be removed. +type PermissionsSetModeResult struct { + // Authoritative permission mode after the mutation + Mode PermissionMode `json:"mode"` + // Whether the operation succeeded + Success bool `json:"success"` +} + // Toggles whether permission prompts should be bridged into session events for this client. // Experimental: PermissionsSetRequiredRequest is part of an experimental API and may change // or be removed. @@ -7565,6 +8560,11 @@ type PlanSQLTodoDependency struct { // because the SQL schema is best-effort and the agent may not have populated every column. // Experimental: PlanSQLTodosRow is part of an experimental API and may change or be removed. type PlanSQLTodosRow struct { + // 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. + CreatedAt *string `json:"createdAt,omitempty"` // Todo description. Description *string `json:"description,omitempty"` // Todo identifier. @@ -14503,73 +15503,389 @@ const ( AgentRegistrySpawnValidationErrorReasonYoloNotAllowed AgentRegistrySpawnValidationErrorReason = "yolo-not-allowed" ) -// Type of GitHub reference -// Experimental: AttachmentGitHubReferenceType is part of an experimental API and may change -// or be removed. -type AttachmentGitHubReferenceType string +// Type of GitHub reference +// Experimental: AttachmentGitHubReferenceType is part of an experimental API and may change +// or be removed. +type AttachmentGitHubReferenceType string + +const ( + // GitHub discussion reference. + AttachmentGitHubReferenceTypeDiscussion AttachmentGitHubReferenceType = "discussion" + // GitHub issue reference. + AttachmentGitHubReferenceTypeIssue AttachmentGitHubReferenceType = "issue" + // GitHub pull request reference. + AttachmentGitHubReferenceTypePr AttachmentGitHubReferenceType = "pr" +) + +// Type discriminator for Attachment. +type AttachmentType string + +const ( + AttachmentTypeBlob AttachmentType = "blob" + AttachmentTypeDirectory AttachmentType = "directory" + AttachmentTypeExtensionContext AttachmentType = "extension_context" + AttachmentTypeFile AttachmentType = "file" + AttachmentTypeGitHubActionsJob AttachmentType = "github_actions_job" + AttachmentTypeGitHubCommit AttachmentType = "github_commit" + AttachmentTypeGitHubFile AttachmentType = "github_file" + AttachmentTypeGitHubFileDiff AttachmentType = "github_file_diff" + AttachmentTypeGitHubReference AttachmentType = "github_reference" + AttachmentTypeGitHubRelease AttachmentType = "github_release" + AttachmentTypeGitHubRepository AttachmentType = "github_repository" + AttachmentTypeGitHubSnippet AttachmentType = "github_snippet" + AttachmentTypeGitHubTreeComparison AttachmentType = "github_tree_comparison" + AttachmentTypeGitHubURL AttachmentType = "github_url" + AttachmentTypeSelection AttachmentType = "selection" +) + +// Type discriminator for AuthInfo. +// Experimental: AuthInfoType is part of an experimental API and may change or be removed. +type AuthInfoType string + +const ( + AuthInfoTypeAPIKey AuthInfoType = "api-key" + AuthInfoTypeCopilotAPIToken AuthInfoType = "copilot-api-token" + AuthInfoTypeEnv AuthInfoType = "env" + AuthInfoTypeGhCLI AuthInfoType = "gh-cli" + AuthInfoTypeHMAC AuthInfoType = "hmac" + AuthInfoTypeToken AuthInfoType = "token" + AuthInfoTypeUser AuthInfoType = "user" +) + +// Custom input-format kind. +// Experimental: BuiltinToolFormatType is part of an experimental API and may change or be +// removed. +type BuiltinToolFormatType string + +const ( + // The tool input is parsed with the supplied grammar. + BuiltinToolFormatTypeGrammar BuiltinToolFormatType = "grammar" +) + +// Root JSON Schema type for a built-in tool input. +// Experimental: BuiltinToolInputSchemaType is part of an experimental API and may change or +// be removed. +type BuiltinToolInputSchemaType string + +const ( + // The tool accepts a JSON object. + BuiltinToolInputSchemaTypeObject BuiltinToolInputSchemaType = "object" +) + +// Canonical digest algorithm for a validated MCP card +// Experimental: CardDigestAlgorithm is part of an experimental API and may change or be +// removed. +type CardDigestAlgorithm string + +const ( + // SHA-256 over RFC 8785 canonical JSON encoded as UTF-8. + CardDigestAlgorithmSha256Rfc8785 CardDigestAlgorithm = "sha256-rfc8785" +) + +// AI skills are discovery-only and cannot be installed through this surface +type CatalogAiSkillCandidateInstallability string + +const ( + CatalogAiSkillCandidateInstallabilityNotInstallableKind CatalogAiSkillCandidateInstallability = "not-installable-kind" +) + +// Media type of the underlying AI skill card +type CatalogAiSkillCandidateMediaType string + +const ( + CatalogAiSkillCandidateMediaTypeApplicationAiSkill CatalogAiSkillCandidateMediaType = "application/ai-skill" +) + +// Media type advertised for the referenced AI skill card +type CatalogAiSkillCandidateProvenanceMediaType string + +const ( + CatalogAiSkillCandidateProvenanceMediaTypeApplicationAiSkill CatalogAiSkillCandidateProvenanceMediaType = "application/ai-skill" +) + +// Why the catalog authority did not accept the caller's identity +// Experimental: CatalogAuthenticationRequiredReason is part of an experimental API and may +// change or be removed. +type CatalogAuthenticationRequiredReason string + +const ( + // A credential was presented and its lifetime has elapsed. A silent refresh is worth + // attempting before prompting anyone. + CatalogAuthenticationRequiredReasonCredentialExpired CatalogAuthenticationRequiredReason = "credential-expired" + // A credential was presented and the authority refused it, for example because it was + // revoked, malformed, or issued for another audience. Refreshing the same rejected + // credential is not useful; the caller must sign in again. + CatalogAuthenticationRequiredReasonCredentialRejected CatalogAuthenticationRequiredReason = "credential-rejected" + // No credential was presented, so there is nothing to refresh and the caller must sign in. + CatalogAuthenticationRequiredReasonNoCredential CatalogAuthenticationRequiredReason = "no-credential" +) + +// Kind discriminator for CatalogCandidate. +// Experimental: CatalogCandidateKind is part of an experimental API and may change or be +// removed. +type CatalogCandidateKind string + +const ( + CatalogCandidateKindAiSkill CatalogCandidateKind = "ai-skill" + CatalogCandidateKindMCPServer CatalogCandidateKind = "mcp-server" +) + +// Kind discriminator for CatalogCandidateSource. +type CatalogCandidateSourceKind string + +const ( + CatalogCandidateSourceKindEmbedded CatalogCandidateSourceKind = "embedded" + CatalogCandidateSourceKindURL CatalogCandidateSourceKind = "url" +) + +// A wire feature a caller can require of the catalog surface, negotiated per request. A +// grant means the runtime understands the feature's contract, not that the deployment has +// enabled the operation; typed unavailable results report availability separately. +// Experimental: CatalogCapability is part of an experimental API and may change or be +// removed. +type CatalogCapability string + +const ( + // Understands `application/ai-skill` candidates as discovery-only and typed non-installable. + CatalogCapabilityAiSkillDiscovery CatalogCapability = "ai-skill-discovery" + // Understands the legacy `application/mcp-server+json` media type. + CatalogCapabilityLegacyMCPServerCard CatalogCapability = "legacy-mcp-server-card" + // Understands side-effect-free MCP install-plan requests, results, and plan handles; + // `planning-unavailable` separately reports that planning is not enabled. + CatalogCapabilityMCPInstallPlanning CatalogCapability = "mcp-install-planning" + // Understands the current `application/mcp-server-card+json` media type. + CatalogCapabilityMCPServerCard CatalogCapability = "mcp-server-card" + // Understands plans that enumerate every eligible transport rather than a single preferred + // one. + CatalogCapabilityMultipleTransportChoice CatalogCapability = "multiple-transport-choice" +) + +// Which wire-contract rule an upstream response broke +// Experimental: CatalogContractViolationReason is part of an experimental API and may +// change or be removed. +type CatalogContractViolationReason string + +const ( + // A result carried both a URL and embedded data, when exactly one is permitted. + CatalogContractViolationReasonBothURLAndData CatalogContractViolationReason = "both-url-and-data" + // Two results claimed the same normalised identity. + CatalogContractViolationReasonDuplicateIdentity CatalogContractViolationReason = "duplicate-identity" + // A result carried neither a URL nor embedded data, when exactly one is required. + CatalogContractViolationReasonNeitherURLNorData CatalogContractViolationReason = "neither-url-nor-data" + // A result declared no media type, or one this contract does not model. + CatalogContractViolationReasonUnknownMediaType CatalogContractViolationReason = "unknown-media-type" +) + +// Why a presented handle was rejected +// Experimental: CatalogHandleRejectionReason is part of an experimental API and may change +// or be removed. +type CatalogHandleRejectionReason string + +const ( + // The handle was issued by a different runtime instance. + CatalogHandleRejectionReasonForeign CatalogHandleRejectionReason = "foreign" + // The handle is unparseable, unknown, or was issued for a different operation. + CatalogHandleRejectionReasonInvalid CatalogHandleRejectionReason = "invalid" + // The handle has already been used, and handles are single-use. + CatalogHandleRejectionReasonReplayed CatalogHandleRejectionReason = "replayed" + // The handle's time to live has elapsed. + CatalogHandleRejectionReasonStale CatalogHandleRejectionReason = "stale" +) + +// Which kind of opaque handle was presented +// Experimental: CatalogHandleType is part of an experimental API and may change or be +// removed. +type CatalogHandleType string + +const ( + // A search candidate handle. + CatalogHandleTypeCandidate CatalogHandleType = "candidate" + // An install plan handle. + CatalogHandleTypePlan CatalogHandleType = "plan" +) + +// Which request field was rejected before any work was done +// Experimental: CatalogInvalidRequestField is part of an experimental API and may change or +// be removed. +type CatalogInvalidRequestField string + +const ( + // The supplied card was missing its media type, URL, or data. + CatalogInvalidRequestFieldCard CatalogInvalidRequestField = "card" + // The negotiation block was missing or malformed. + CatalogInvalidRequestFieldContract CatalogInvalidRequestField = "contract" + // The requested candidate kinds were empty or contained a duplicate. + CatalogInvalidRequestFieldKinds CatalogInvalidRequestField = "kinds" + // The requested result count fell outside its permitted range. + CatalogInvalidRequestFieldLimit CatalogInvalidRequestField = "limit" + // The search query was empty or longer than permitted. + CatalogInvalidRequestFieldQuery CatalogInvalidRequestField = "query" + // The requested configuration scope is not one this runtime writes. + CatalogInvalidRequestFieldScope CatalogInvalidRequestField = "scope" + // The plan source was missing or malformed. + CatalogInvalidRequestFieldSource CatalogInvalidRequestField = "source" +) + +// How a card failed validation +// Experimental: CatalogMalformedCardReason is part of an experimental API and may change or +// be removed. +type CatalogMalformedCardReason string + +const ( + // The document is not well-formed JSON. + CatalogMalformedCardReasonInvalidJSON CatalogMalformedCardReason = "invalid-json" + // A field the media type requires is absent. + CatalogMalformedCardReasonMissingRequiredField CatalogMalformedCardReason = "missing-required-field" + // The document does not satisfy its media type's schema. + CatalogMalformedCardReasonSchemaViolation CatalogMalformedCardReason = "schema-violation" + // The document exceeded the permitted size. + CatalogMalformedCardReasonSizeLimitExceeded CatalogMalformedCardReason = "size-limit-exceeded" + // The declared media type is not one this runtime understands. + CatalogMalformedCardReasonUnsupportedMediaType CatalogMalformedCardReason = "unsupported-media-type" +) + +// Whether an MCP server candidate can be planned for installation +// Experimental: CatalogMCPServerInstallability is part of an experimental API and may +// change or be removed. +type CatalogMCPServerInstallability string + +const ( + // An install plan can be computed for this MCP server candidate. + CatalogMCPServerInstallabilityInstallable CatalogMCPServerInstallability = "installable" + // Policy forbids installing this MCP server candidate. + CatalogMCPServerInstallabilityNotInstallablePolicy CatalogMCPServerInstallability = "not-installable-policy" +) + +// Media type a catalog card is interpreted as +// Experimental: CatalogMediaType is part of an experimental API and may change or be +// removed. +type CatalogMediaType string + +const ( + // An AI skill card. Representable and searchable, but typed non-installable. + CatalogMediaTypeApplicationAiSkill CatalogMediaType = "application/ai-skill" + // The current MCP server card media type. + CatalogMediaTypeApplicationMCPServerCardJSON CatalogMediaType = "application/mcp-server-card+json" + // The legacy MCP server card media type, accepted for compatibility. + CatalogMediaTypeApplicationMCPServerJSON CatalogMediaType = "application/mcp-server+json" +) + +// Why capability and protocol-version negotiation refused a caller +// Experimental: CatalogNegotiationRefusedReason is part of an experimental API and may +// change or be removed. +type CatalogNegotiationRefusedReason string const ( - // GitHub discussion reference. - AttachmentGitHubReferenceTypeDiscussion AttachmentGitHubReferenceType = "discussion" - // GitHub issue reference. - AttachmentGitHubReferenceTypeIssue AttachmentGitHubReferenceType = "issue" - // GitHub pull request reference. - AttachmentGitHubReferenceTypePr AttachmentGitHubReferenceType = "pr" + // The caller requires at least one capability this runtime cannot honour. + CatalogNegotiationRefusedReasonUnsupportedCapability CatalogNegotiationRefusedReason = "unsupported-capability" + // The caller's protocol version is below the lowest this runtime serves. + CatalogNegotiationRefusedReasonUnsupportedProtocolVersion CatalogNegotiationRefusedReason = "unsupported-protocol-version" ) -// Type discriminator for Attachment. -type AttachmentType string +// Categorised network failure, low cardinality so it can be aggregated without carrying a +// URL +// Experimental: CatalogNetworkFailureReason is part of an experimental API and may change +// or be removed. +type CatalogNetworkFailureReason string const ( - AttachmentTypeBlob AttachmentType = "blob" - AttachmentTypeDirectory AttachmentType = "directory" - AttachmentTypeExtensionContext AttachmentType = "extension_context" - AttachmentTypeFile AttachmentType = "file" - AttachmentTypeGitHubActionsJob AttachmentType = "github_actions_job" - AttachmentTypeGitHubCommit AttachmentType = "github_commit" - AttachmentTypeGitHubFile AttachmentType = "github_file" - AttachmentTypeGitHubFileDiff AttachmentType = "github_file_diff" - AttachmentTypeGitHubReference AttachmentType = "github_reference" - AttachmentTypeGitHubRelease AttachmentType = "github_release" - AttachmentTypeGitHubRepository AttachmentType = "github_repository" - AttachmentTypeGitHubSnippet AttachmentType = "github_snippet" - AttachmentTypeGitHubTreeComparison AttachmentType = "github_tree_comparison" - AttachmentTypeGitHubURL AttachmentType = "github_url" - AttachmentTypeSelection AttachmentType = "selection" + // The connection was refused or reset. + CatalogNetworkFailureReasonConnectionRefused CatalogNetworkFailureReason = "connection-refused" + // The authority's name could not be resolved. + CatalogNetworkFailureReasonDns CatalogNetworkFailureReason = "dns" + // The authority returned a status the runtime treats as a failure. + CatalogNetworkFailureReasonHTTPStatus CatalogNetworkFailureReason = "http-status" + // No network is available, so nothing was attempted. + CatalogNetworkFailureReasonOffline CatalogNetworkFailureReason = "offline" + // A redirect was refused by the runtime's redirect policy. + CatalogNetworkFailureReasonRedirectRejected CatalogNetworkFailureReason = "redirect-rejected" + // The response exceeded the permitted size. + CatalogNetworkFailureReasonResponseTooLarge CatalogNetworkFailureReason = "response-too-large" + // The request exceeded its time budget. + CatalogNetworkFailureReasonTimeout CatalogNetworkFailureReason = "timeout" + // The TLS handshake or certificate validation failed. + CatalogNetworkFailureReasonTls CatalogNetworkFailureReason = "tls" ) -// Type discriminator for AuthInfo. -// Experimental: AuthInfoType is part of an experimental API and may change or be removed. -type AuthInfoType string +// Why a discoverable candidate cannot be installed +// Experimental: CatalogNotInstallableReason is part of an experimental API and may change +// or be removed. +type CatalogNotInstallableReason string const ( - AuthInfoTypeAPIKey AuthInfoType = "api-key" - AuthInfoTypeCopilotAPIToken AuthInfoType = "copilot-api-token" - AuthInfoTypeEnv AuthInfoType = "env" - AuthInfoTypeGhCLI AuthInfoType = "gh-cli" - AuthInfoTypeHMAC AuthInfoType = "hmac" - AuthInfoTypeToken AuthInfoType = "token" - AuthInfoTypeUser AuthInfoType = "user" + // AI skills are discoverable but have no typed importer in this phase. + CatalogNotInstallableReasonAiSkillNotInstallable CatalogNotInstallableReason = "ai-skill-not-installable" + // This kind of resource is not installable through this surface. + CatalogNotInstallableReasonKindNotInstallable CatalogNotInstallableReason = "kind-not-installable" + // Policy forbids installing this candidate. + CatalogNotInstallableReasonPolicyForbids CatalogNotInstallableReason = "policy-forbids" ) -// Custom input-format kind. -// Experimental: BuiltinToolFormatType is part of an experimental API and may change or be -// removed. -type BuiltinToolFormatType string +// Kind discriminator for CatalogSearchResult. +type CatalogSearchResultKind string const ( - // The tool input is parsed with the supplied grammar. - BuiltinToolFormatTypeGrammar BuiltinToolFormatType = "grammar" + CatalogSearchResultKindAuthenticationRequired CatalogSearchResultKind = "authentication-required" + CatalogSearchResultKindContractViolation CatalogSearchResultKind = "contract-violation" + CatalogSearchResultKindInvalidRequest CatalogSearchResultKind = "invalid-request" + CatalogSearchResultKindMalformedCard CatalogSearchResultKind = "malformed-card" + CatalogSearchResultKindNegotiationRefused CatalogSearchResultKind = "negotiation-refused" + CatalogSearchResultKindNetworkFailure CatalogSearchResultKind = "network-failure" + CatalogSearchResultKindPolicyRejected CatalogSearchResultKind = "policy-rejected" + CatalogSearchResultKindSucceeded CatalogSearchResultKind = "succeeded" + CatalogSearchResultKindUnavailable CatalogSearchResultKind = "unavailable" + CatalogSearchResultKindUnsafeRetrieval CatalogSearchResultKind = "unsafe-retrieval" + CatalogSearchResultKindUnsupportedKind CatalogSearchResultKind = "unsupported-kind" ) -// Root JSON Schema type for a built-in tool input. -// Experimental: BuiltinToolInputSchemaType is part of an experimental API and may change or +// Why a catalog operation is not available on this runtime +// Experimental: CatalogUnavailableReason is part of an experimental API and may change or // be removed. -type BuiltinToolInputSchemaType string +type CatalogUnavailableReason string const ( - // The tool accepts a JSON object. - BuiltinToolInputSchemaTypeObject BuiltinToolInputSchemaType = "object" + // No catalog authority is configured for this runtime. + CatalogUnavailableReasonAuthorityNotConfigured CatalogUnavailableReason = "authority-not-configured" + // The surface is disabled by policy on this runtime. + CatalogUnavailableReasonDisabledByPolicy CatalogUnavailableReason = "disabled-by-policy" + // Install planning is not wired up on this runtime build. + CatalogUnavailableReasonPlanningUnavailable CatalogUnavailableReason = "planning-unavailable" + // Bounded search is not wired up on this runtime build. + CatalogUnavailableReasonSearchUnavailable CatalogUnavailableReason = "search-unavailable" +) + +// Why no usable transport could be offered +// Experimental: CatalogUnavailableTransportReason is part of an experimental API and may +// change or be removed. +type CatalogUnavailableTransportReason string + +const ( + // The card advertises no transport this runtime can use. + CatalogUnavailableTransportReasonNoEligibleTransport CatalogUnavailableTransportReason = "no-eligible-transport" + // Eligible remotes could not be enumerated, so no explicit choice can be offered. + CatalogUnavailableTransportReasonRemoteEnumerationUnavailable CatalogUnavailableTransportReason = "remote-enumeration-unavailable" + // Every advertised transport is of a kind this runtime does not implement. + CatalogUnavailableTransportReasonTransportNotSupported CatalogUnavailableTransportReason = "transport-not-supported" +) + +// Which hardened-fetch control refused a retrieval +// Experimental: CatalogUnsafeRetrievalReason is part of an experimental API and may change +// or be removed. +type CatalogUnsafeRetrievalReason string + +const ( + // The URL resolved to a loopback, private, link-local, or cloud metadata address. + CatalogUnsafeRetrievalReasonBlockedAddress CatalogUnsafeRetrievalReason = "blocked-address" + // The URL used a scheme the runtime refuses to fetch. + CatalogUnsafeRetrievalReasonBlockedScheme CatalogUnsafeRetrievalReason = "blocked-scheme" + // The URL embedded credentials. + CatalogUnsafeRetrievalReasonCredentialsInURL CatalogUnsafeRetrievalReason = "credentials-in-url" + // The authority is not permitted for card retrieval. + CatalogUnsafeRetrievalReasonHostNotPermitted CatalogUnsafeRetrievalReason = "host-not-permitted" + // The configured proxy policy refused the request. + CatalogUnsafeRetrievalReasonProxyRejected CatalogUnsafeRetrievalReason = "proxy-rejected" + // A redirect target resolved to a blocked address. + CatalogUnsafeRetrievalReasonRedirectToBlockedAddress CatalogUnsafeRetrievalReason = "redirect-to-blocked-address" ) // Whether a pending slash-command invocation effect was applied or cancelled by the host. @@ -15406,6 +16722,230 @@ const ( MCPOauthProbeResultStatusNoAuthRequired MCPOauthProbeResultStatus = "no-auth-required" ) +// Whether a planned configuration change would create or modify an entry +// Experimental: MCPPlanConfigurationOperation is part of an experimental API and may change +// or be removed. +type MCPPlanConfigurationOperation string + +const ( + // Creates a configuration entry that does not exist yet. + MCPPlanConfigurationOperationAdd MCPPlanConfigurationOperation = "add" + // Modifies a configuration entry that already exists. + MCPPlanConfigurationOperationUpdate MCPPlanConfigurationOperation = "update" +) + +// Discriminator for an enumerated required value +// Experimental: MCPPlanEnumValueType is part of an experimental API and may change or be +// removed. +type MCPPlanEnumValueType string + +const ( + // One of a fixed, non-empty set of permitted values. + MCPPlanEnumValueTypeEnum MCPPlanEnumValueType = "enum" +) + +// Kind discriminator for MCPPlanInstallResult. +type MCPPlanInstallResultKind string + +const ( + MCPPlanInstallResultKindAuthenticationRequired MCPPlanInstallResultKind = "authentication-required" + MCPPlanInstallResultKindContractViolation MCPPlanInstallResultKind = "contract-violation" + MCPPlanInstallResultKindHandleRejected MCPPlanInstallResultKind = "handle-rejected" + MCPPlanInstallResultKindInvalidRequest MCPPlanInstallResultKind = "invalid-request" + MCPPlanInstallResultKindMalformedCard MCPPlanInstallResultKind = "malformed-card" + MCPPlanInstallResultKindNegotiationRefused MCPPlanInstallResultKind = "negotiation-refused" + MCPPlanInstallResultKindNetworkFailure MCPPlanInstallResultKind = "network-failure" + MCPPlanInstallResultKindNotInstallable MCPPlanInstallResultKind = "not-installable" + MCPPlanInstallResultKindPlanned MCPPlanInstallResultKind = "planned" + MCPPlanInstallResultKindPolicyRejected MCPPlanInstallResultKind = "policy-rejected" + MCPPlanInstallResultKindUnavailable MCPPlanInstallResultKind = "unavailable" + MCPPlanInstallResultKindUnavailableTransport MCPPlanInstallResultKind = "unavailable-transport" + MCPPlanInstallResultKindUnsafeRetrieval MCPPlanInstallResultKind = "unsafe-retrieval" +) + +// Discriminator for a candidate-backed install-plan source +// Experimental: MCPPlanInstallSourceCandidateKind is part of an experimental API and may +// change or be removed. +type MCPPlanInstallSourceCandidateKind string + +const ( + // Plan from a candidate returned by catalog search. + MCPPlanInstallSourceCandidateKindCandidate MCPPlanInstallSourceCandidateKind = "candidate" +) + +// Discriminator for a caller-supplied-card install-plan source +// Experimental: MCPPlanInstallSourceCardKind is part of an experimental API and may change +// or be removed. +type MCPPlanInstallSourceCardKind string + +const ( + // Plan directly from a caller-supplied card. + MCPPlanInstallSourceCardKindCard MCPPlanInstallSourceCardKind = "card" +) + +// Kind discriminator for MCPPlanInstallSource. +type MCPPlanInstallSourceKind string + +const ( + MCPPlanInstallSourceKindCandidate MCPPlanInstallSourceKind = "candidate" + MCPPlanInstallSourceKindCard MCPPlanInstallSourceKind = "card" +) + +// Discriminator for a package-backed transport choice +// Experimental: MCPPlanPackageInstallMethod is part of an experimental API and may change +// or be removed. +type MCPPlanPackageInstallMethod string + +const ( + // Install and run a local package. + MCPPlanPackageInstallMethodPackage MCPPlanPackageInstallMethod = "package" +) + +// Transport exposed by a locally launched package +// Experimental: MCPPlanPackageTransport is part of an experimental API and may change or be +// removed. +type MCPPlanPackageTransport string + +const ( + // A locally launched process spoken to over standard input and output. + MCPPlanPackageTransportStdio MCPPlanPackageTransport = "stdio" +) + +// What policy decided for a planned server +// Experimental: MCPPlanPolicyDecision is part of an experimental API and may change or be +// removed. +type MCPPlanPolicyDecision string + +const ( + // Policy permits the server. + MCPPlanPolicyDecisionAllowed MCPPlanPolicyDecision = "allowed" + // Policy forbids the server, so the plan cannot be applied. + MCPPlanPolicyDecisionBlocked MCPPlanPolicyDecision = "blocked" + // Policy permits the server only after an explicit approval. + MCPPlanPolicyDecisionRequiresApproval MCPPlanPolicyDecision = "requires-approval" +) + +// Which authority produced a policy decision +// Experimental: MCPPlanPolicySource is part of an experimental API and may change or be +// removed. +type MCPPlanPolicySource string + +const ( + // An enterprise allowlist evaluated the server. + MCPPlanPolicySourceEnterpriseAllowlist MCPPlanPolicySource = "enterprise-allowlist" + // Local trust settings evaluated the server. + MCPPlanPolicySourceLocalTrust MCPPlanPolicySource = "local-trust" + // No policy applied, so the server is permitted by default. + MCPPlanPolicySourceNone MCPPlanPolicySource = "none" + // The registry the card came from evaluated the server. + MCPPlanPolicySourceRegistryPolicy MCPPlanPolicySource = "registry-policy" +) + +// Discriminator for a remote-endpoint transport choice +// Experimental: MCPPlanRemoteInstallMethod is part of an experimental API and may change or +// be removed. +type MCPPlanRemoteInstallMethod string + +const ( + // Connect to a remote endpoint. + MCPPlanRemoteInstallMethodRemote MCPPlanRemoteInstallMethod = "remote" +) + +// Transport exposed by a remote endpoint +// Experimental: MCPPlanRemoteTransport is part of an experimental API and may change or be +// removed. +type MCPPlanRemoteTransport string + +const ( + // An HTTP endpoint. + MCPPlanRemoteTransportHTTP MCPPlanRemoteTransport = "http" + // A server-sent events endpoint. + MCPPlanRemoteTransportSSE MCPPlanRemoteTransport = "sse" + // A streamable HTTP endpoint. + MCPPlanRemoteTransportStreamableHTTP MCPPlanRemoteTransport = "streamable-http" +) + +// Discriminator for an enumerated required value +// Experimental: MCPPlanRequiredValueEnumKind is part of an experimental API and may change +// or be removed. +type MCPPlanRequiredValueEnumKind string + +const ( + // The value uses a fixed non-empty enumeration. + MCPPlanRequiredValueEnumKindEnum MCPPlanRequiredValueEnumKind = "enum" +) + +// Kind discriminator for MCPPlanRequiredValue. +type MCPPlanRequiredValueKind string + +const ( + MCPPlanRequiredValueKindEnum MCPPlanRequiredValueKind = "enum" + MCPPlanRequiredValueKindScalar MCPPlanRequiredValueKind = "scalar" +) + +// Discriminator for a scalar required value +// Experimental: MCPPlanRequiredValueScalarKind is part of an experimental API and may +// change or be removed. +type MCPPlanRequiredValueScalarKind string + +const ( + // The value uses one scalar type. + MCPPlanRequiredValueScalarKindScalar MCPPlanRequiredValueScalarKind = "scalar" +) + +// Scalar type a required value must conform to +// Experimental: MCPPlanScalarValueType is part of an experimental API and may change or be +// removed. +type MCPPlanScalarValueType string + +const ( + // A boolean. + MCPPlanScalarValueTypeBoolean MCPPlanScalarValueType = "boolean" + // A number. + MCPPlanScalarValueTypeNumber MCPPlanScalarValueType = "number" + // A filesystem path. + MCPPlanScalarValueTypePath MCPPlanScalarValueType = "path" + // Free text. + MCPPlanScalarValueTypeString MCPPlanScalarValueType = "string" +) + +// Configuration scope an MCP install plan targets +// Experimental: MCPPlanScope is part of an experimental API and may change or be removed. +type MCPPlanScope string + +const ( + // The user's own MCP configuration. + MCPPlanScopeUser MCPPlanScope = "user" +) + +// Transport discriminator for MCPPlanTransportChoice. +type MCPPlanTransportChoiceTransport string + +const ( + MCPPlanTransportChoiceTransportHTTP MCPPlanTransportChoiceTransport = "http" + MCPPlanTransportChoiceTransportSSE MCPPlanTransportChoiceTransport = "sse" + MCPPlanTransportChoiceTransportStdio MCPPlanTransportChoiceTransport = "stdio" + MCPPlanTransportChoiceTransportStreamableHTTP MCPPlanTransportChoiceTransport = "streamable-http" +) + +// Where a required value is applied when the planned server is launched +// Experimental: MCPPlanValueCategory is part of an experimental API and may change or be +// removed. +type MCPPlanValueCategory string + +const ( + // Set as an environment variable on the launched process. + MCPPlanValueCategoryEnvironmentVariable MCPPlanValueCategory = "environment-variable" + // Sent as a request header to a remote endpoint. + MCPPlanValueCategoryHeader MCPPlanValueCategory = "header" + // Passed to the packaged server itself. + MCPPlanValueCategoryPackageArgument MCPPlanValueCategory = "package-argument" + // Passed to the runtime that launches the package. + MCPPlanValueCategoryRuntimeArgument MCPPlanValueCategory = "runtime-argument" + // Substituted into the remote endpoint URL. + MCPPlanValueCategoryURLVariable MCPPlanValueCategory = "url-variable" +) + // 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. @@ -15422,6 +16962,46 @@ const ( MCPSamplingExecutionActionSuccess MCPSamplingExecutionAction = "success" ) +// Discriminator for an embedded MCP server card +// Experimental: MCPServerCardEmbeddedKind is part of an experimental API and may change or +// be removed. +type MCPServerCardEmbeddedKind string + +const ( + // Use the embedded card document. + MCPServerCardEmbeddedKindEmbedded MCPServerCardEmbeddedKind = "embedded" +) + +// JSON MCP card media type accepted for install planning +// Experimental: MCPServerCardMediaType is part of an experimental API and may change or be +// removed. +type MCPServerCardMediaType string + +const ( + // The current MCP server card media type. + MCPServerCardMediaTypeApplicationMCPServerCardJSON MCPServerCardMediaType = "application/mcp-server-card+json" + // The legacy MCP server card media type, accepted for compatibility. + MCPServerCardMediaTypeApplicationMCPServerJSON MCPServerCardMediaType = "application/mcp-server+json" +) + +// Kind discriminator for MCPServerCardReference. +type MCPServerCardReferenceKind string + +const ( + MCPServerCardReferenceKindEmbedded MCPServerCardReferenceKind = "embedded" + MCPServerCardReferenceKindURL MCPServerCardReferenceKind = "url" +) + +// Discriminator for a URL-backed MCP server card +// Experimental: MCPServerCardURLKind is part of an experimental API and may change or be +// removed. +type MCPServerCardURLKind string + +const ( + // Retrieve the card from its URL. + MCPServerCardURLKindURL MCPServerCardURLKind = "url" +) + // Controls if tools provided by this server can be loaded on demand via tool search (auto) // or always included in the initial tool list (never) // Experimental: MCPServerConfigDeferTools is part of an experimental API and may change or @@ -15808,13 +17388,13 @@ const ( type PermissionDecisionSource string const ( + // The response followed the assisted-approval judge recommendation. + PermissionDecisionSourceAssistedApproval PermissionDecisionSource = "assisted_approval" // The host applied a standing policy or override rather than a judge recommendation or // human decision. PermissionDecisionSourceHostPolicy PermissionDecisionSource = "host_policy" // A human supplied the response through an interactive prompt. PermissionDecisionSourceHumanResponse PermissionDecisionSource = "human_response" - // The response followed the auto-approval judge recommendation. - PermissionDecisionSourceJudgeRecommendation PermissionDecisionSource = "judge_recommendation" // The host denied the request because no interactive user response was available. PermissionDecisionSourceUnattendedFallback PermissionDecisionSource = "unattended_fallback" ) @@ -15847,19 +17427,35 @@ const ( PermissionLocationTypeRepo PermissionLocationType = "repo" ) -// Current or requested allow-all mode. -// Experimental: PermissionsAllowAllMode is part of an experimental API and may change or be -// removed. -type PermissionsAllowAllMode string +// Current or requested permission mode. +// Experimental: PermissionMode is part of an experimental API and may change or be removed. +type PermissionMode string const ( - // Permission requests follow the normal approval flow with an LLM advisory recommendation - // attached; clients may choose to auto-approve requests the judge evaluated as acceptable. - PermissionsAllowAllModeAuto PermissionsAllowAllMode = "auto" - // Permission requests follow the normal approval flow. - PermissionsAllowAllModeOff PermissionsAllowAllMode = "off" // Tool, path, and URL permission requests are automatically approved. - PermissionsAllowAllModeOn PermissionsAllowAllMode = "on" + PermissionModeAllowAll PermissionMode = "allow-all" + // Permission requests include an LLM safety recommendation; clients may automatically + // approve requests judged acceptable. + PermissionModeAssisted PermissionMode = "assisted" + // Permission requests follow the normal approval flow. + PermissionModeManual PermissionMode = "manual" +) + +// Optional source for permission-mode telemetry. Defaults to `rpc` when omitted for SDK +// callers. +// Experimental: PermissionModeSource is part of an experimental API and may change or be +// removed. +type PermissionModeSource string + +const ( + // The mode was set by confirming autopilot behavior. + PermissionModeSourceAutopilotConfirmation PermissionModeSource = "autopilot_confirmation" + // The mode was set from a CLI command-line flag. + PermissionModeSourceCLIFlag PermissionModeSource = "cli_flag" + // The mode was set through an RPC caller. + PermissionModeSourceRPC PermissionModeSource = "rpc" + // The mode was set by a slash command. + PermissionModeSourceSlashCommand PermissionModeSource = "slash_command" ) // Allowed values for the `PermissionsConfigureAdditionalContentExclusionPolicyScope` @@ -15905,22 +17501,6 @@ const ( PermissionsModifyRulesScopeSession PermissionsModifyRulesScope = "session" ) -// Optional source for allow-all telemetry. Defaults to `rpc` when omitted for SDK callers. -// Experimental: PermissionsSetAllowAllSource is part of an experimental API and may change -// or be removed. -type PermissionsSetAllowAllSource string - -const ( - // Allow-all was enabled by confirming autopilot behavior. - PermissionsSetAllowAllSourceAutopilotConfirmation PermissionsSetAllowAllSource = "autopilot_confirmation" - // Allow-all was enabled from a CLI command-line flag. - PermissionsSetAllowAllSourceCLIFlag PermissionsSetAllowAllSource = "cli_flag" - // Allow-all was enabled through an RPC caller. - PermissionsSetAllowAllSourceRPC PermissionsSetAllowAllSource = "rpc" - // Allow-all was enabled by a slash command. - PermissionsSetAllowAllSourceSlashCommand PermissionsSetAllowAllSource = "slash_command" -) - // Optional source for allow-all telemetry. Defaults to `rpc` when omitted for SDK callers. // Experimental: PermissionsSetApproveAllSource is part of an experimental API and may // change or be removed. @@ -17211,6 +18791,38 @@ func (a *ServerAgentsAPI) GetDiscoveryPaths(ctx context.Context, params *AgentsG return &result, nil } +// Experimental: ServerCatalogAPI contains experimental APIs that may change or be removed. +type ServerCatalogAPI serverAPI + +// Search requests a bounded catalog search. This host-implemented server method is +// available through SDK/TUI hosts; standalone and C-ABI runtimes whose host does not +// implement server-method dispatch return JSON-RPC MethodNotFound. A runtime with search +// available returns inert candidate summaries, each with an opaque single-use handle scoped +// to this runtime instance; a runtime without it returns the typed search-unavailable +// result. Public authorities may be searched anonymously, while an authority that requires +// credentials yields the typed authentication-required result. All returned text, URLs, and +// package metadata are untrusted external data and can never trigger instructions, tools, +// or installation. Read-only: nothing is installed, configured, or persisted. +// +// RPC method: catalog.search. +// +// Parameters: 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. +// +// Returns: Outcome of a catalog.search call: either bounded inert candidates, or one typed +// refusal. Never a partial success. +func (a *ServerCatalogAPI) Search(ctx context.Context, params *CatalogSearchRequest) (CatalogSearchResult, error) { + raw, err := a.client.Request(ctx, "catalog.search", params) + if err != nil { + return nil, err + } + result, err := unmarshalCatalogSearchResult(raw) + if err != nil { + return nil, err + } + return result, nil +} + // Experimental: ServerCommandsAPI contains experimental APIs that may change or be removed. type ServerCommandsAPI serverAPI @@ -17451,6 +19063,36 @@ func (a *ServerMCPAPI) Discover(ctx context.Context, params *MCPDiscoverRequest) return &result, nil } +// PlanInstall requests a side-effect-free MCP install plan from a catalog candidate handle +// or a caller-supplied card. This host-implemented server method is available through +// SDK/TUI hosts; standalone and C-ABI runtimes whose host does not implement server-method +// dispatch return JSON-RPC MethodNotFound. A runtime with planning available returns a +// normalised plan and opaque single-use plan handle; a runtime without it returns the typed +// planning-unavailable result. A completed plan reports resource identity, provenance, +// eligible transport choices, the user-scope target, required typed values and secret +// placeholders, the policy result, the configuration changes installing would make, and +// whether a reload would be needed. Planning never writes configuration, stores a secret, +// or reloads MCP servers, so abandoning a plan needs no call and leaves nothing behind. +// +// RPC method: mcp.planInstall. +// +// Parameters: A side-effect-free request for an MCP install plan. Computing a plan never +// writes configuration, stores a secret, or reloads MCP servers. +// +// Returns: Outcome of an mcp.planInstall call: either a normalised plan, or one typed +// refusal. Nothing is written in either case. +func (a *ServerMCPAPI) PlanInstall(ctx context.Context, params *MCPPlanInstallRequest) (MCPPlanInstallResult, error) { + raw, err := a.client.Request(ctx, "mcp.planInstall", params) + if err != nil { + return nil, err + } + result, err := unmarshalMCPPlanInstallResult(raw) + if err != nil { + return nil, err + } + return result, nil +} + // Experimental: ServerMCPConfigAPI contains experimental APIs that may change or be removed. type ServerMCPConfigAPI serverAPI @@ -18619,6 +20261,7 @@ type ServerRPC struct { Account *ServerAccountAPI AgentRegistry *ServerAgentRegistryAPI Agents *ServerAgentsAPI + Catalog *ServerCatalogAPI Commands *ServerCommandsAPI Extensions *ServerExtensionsAPI Instructions *ServerInstructionsAPI @@ -18682,6 +20325,7 @@ func NewServerRPC(client *jsonrpc2.Client) *ServerRPC { r.Account = (*ServerAccountAPI)(&r.common) r.AgentRegistry = (*ServerAgentRegistryAPI)(&r.common) r.Agents = (*ServerAgentsAPI)(&r.common) + r.Catalog = (*ServerCatalogAPI)(&r.common) r.Commands = (*ServerCommandsAPI)(&r.common) r.Extensions = (*ServerExtensionsAPI)(&r.common) r.Instructions = (*ServerInstructionsAPI)(&r.common) @@ -20585,6 +22229,26 @@ func (a *MCPAPI) ListTools(ctx context.Context, params *MCPListToolsRequest) (*M return &result, nil } +// MoveLoadingToBackground releases any turns waiting on an in-flight MCP load without +// cancelling the load, letting the agent proceed while MCP servers finish connecting in the +// background. No-op when no MCP load is in flight or waiting turns were already released. +// +// RPC method: session.mcp.moveLoadingToBackground. +// +// Returns: Result of moving in-flight MCP loading to the background. +func (a *MCPAPI) MoveLoadingToBackground(ctx context.Context) (*MoveMCPLoadingToBackgroundResult, error) { + req := map[string]any{"sessionId": a.sessionID} + raw, err := a.client.Request(ctx, "session.mcp.moveLoadingToBackground", req) + if err != nil { + return nil, err + } + var result MoveMCPLoadingToBackgroundResult + if err := json.Unmarshal(raw, &result); err != nil { + return nil, err + } + return &result, nil +} + // Reloads MCP server connections for the session. // // RPC method: session.mcp.reload. @@ -21925,18 +23589,18 @@ func (a *PermissionsAPI) Configure(ctx context.Context, params *PermissionsConfi return &result, nil } -// GetAllowAll returns the current allow-all permission mode for the session. +// GetMode returns the current permission mode for the session. // -// RPC method: session.permissions.getAllowAll. +// RPC method: session.permissions.getMode. // -// Returns: Current allow-all permission mode. -func (a *PermissionsAPI) GetAllowAll(ctx context.Context) (*AllowAllPermissionState, error) { +// Returns: Current permission mode. +func (a *PermissionsAPI) GetMode(ctx context.Context) (*PermissionsGetModeResult, error) { req := map[string]any{"sessionId": a.sessionID} - raw, err := a.client.Request(ctx, "session.permissions.getAllowAll", req) + raw, err := a.client.Request(ctx, "session.permissions.getMode", req) if err != nil { return nil, err } - var result AllowAllPermissionState + var result PermissionsGetModeResult if err := json.Unmarshal(raw, &result); err != nil { return nil, err } @@ -22075,68 +23739,62 @@ func (a *PermissionsAPI) ResetSessionApprovals(ctx context.Context, params *Perm return &result, nil } -// SetAllowAll sets the allow-all permission mode for the session. Used by attach-mode -// clients (e.g. LocalRpcSession's `/allow-all` forwarder) to flip the target session's -// permission state. The `on` mode swaps in unrestricted path and URL managers and emits -// `session.permissions_changed` on transition; the `auto` mode keeps normal prompt paths -// active while attaching LLM safety recommendations. The result returns the authoritative -// post-mutation state so callers can update their local mirrors without racing the -// `session.permissions_changed` notification on the same wire. +// SetApproveAll enables or disables automatic approval of tool permission requests for the +// session. // -// RPC method: session.permissions.setAllowAll. +// RPC method: session.permissions.setApproveAll. // -// Parameters: Allow-all mode to apply for the session. +// Parameters: Allow-all toggle for tool permission requests, with an optional telemetry +// source. // -// Returns: Indicates whether the operation succeeded and reports the post-mutation state. -func (a *PermissionsAPI) SetAllowAll(ctx context.Context, params *PermissionsSetAllowAllRequest) (*AllowAllPermissionSetResult, error) { +// Returns: Indicates whether the operation succeeded. +func (a *PermissionsAPI) SetApproveAll(ctx context.Context, params *PermissionsSetApproveAllRequest) (*PermissionsSetApproveAllResult, error) { req := map[string]any{"sessionId": a.sessionID} if params != nil { - if params.Enabled != nil { - req["enabled"] = *params.Enabled - } - if params.Mode != nil { - req["mode"] = *params.Mode - } - if params.Model != nil { - req["model"] = *params.Model - } + req["enabled"] = params.Enabled if params.Source != nil { req["source"] = *params.Source } } - raw, err := a.client.Request(ctx, "session.permissions.setAllowAll", req) + raw, err := a.client.Request(ctx, "session.permissions.setApproveAll", req) if err != nil { return nil, err } - var result AllowAllPermissionSetResult + var result PermissionsSetApproveAllResult if err := json.Unmarshal(raw, &result); err != nil { return nil, err } return &result, nil } -// SetApproveAll enables or disables automatic approval of tool permission requests for the -// session. +// SetMode sets the permission mode for the session. `manual` follows the normal approval +// flow, `assisted` attaches LLM safety recommendations, and `allow-all` automatically +// approves permission requests. The result returns the authoritative post-mutation mode so +// callers can update local state without racing the `session.permissions_changed` +// notification. // -// RPC method: session.permissions.setApproveAll. +// RPC method: session.permissions.setMode. // -// Parameters: Allow-all toggle for tool permission requests, with an optional telemetry -// source. +// Parameters: Permission mode to apply for the session. // -// Returns: Indicates whether the operation succeeded. -func (a *PermissionsAPI) SetApproveAll(ctx context.Context, params *PermissionsSetApproveAllRequest) (*PermissionsSetApproveAllResult, error) { +// Returns: Indicates whether the requested permission mode was applied and reports the +// authoritative post-mutation mode. +func (a *PermissionsAPI) SetMode(ctx context.Context, params *PermissionsSetModeRequest) (*PermissionsSetModeResult, error) { req := map[string]any{"sessionId": a.sessionID} if params != nil { - req["enabled"] = params.Enabled + if params.AssistedApprovalModel != nil { + req["assistedApprovalModel"] = *params.AssistedApprovalModel + } + req["mode"] = params.Mode if params.Source != nil { req["source"] = *params.Source } } - raw, err := a.client.Request(ctx, "session.permissions.setApproveAll", req) + raw, err := a.client.Request(ctx, "session.permissions.setMode", req) if err != nil { return nil, err } - var result PermissionsSetApproveAllResult + var result PermissionsSetModeResult if err := json.Unmarshal(raw, &result); err != nil { return nil, err } diff --git a/go/rpc/zrpc_encoding.go b/go/rpc/zrpc_encoding.go index 7f0dc9e1e1..fadbc5da1b 100644 --- a/go/rpc/zrpc_encoding.go +++ b/go/rpc/zrpc_encoding.go @@ -654,6 +654,443 @@ func (r *BuiltinToolDescriptor) UnmarshalJSON(data []byte) error { return nil } +func unmarshalCatalogCandidate(data []byte) (CatalogCandidate, error) { + if string(data) == "null" { + return nil, nil + } + type rawUnion struct { + Kind CatalogCandidateKind `json:"kind"` + } + var raw rawUnion + if err := json.Unmarshal(data, &raw); err != nil { + return nil, err + } + + switch raw.Kind { + case CatalogCandidateKindAiSkill: + var d CatalogAiSkillCandidate + if err := json.Unmarshal(data, &d); err != nil { + return nil, err + } + return &d, nil + case CatalogCandidateKindMCPServer: + var d CatalogMCPServerCandidate + if err := json.Unmarshal(data, &d); err != nil { + return nil, err + } + return &d, nil + default: + return &RawCatalogCandidateData{Discriminator: raw.Kind, Raw: data}, nil + } +} + +func (r RawCatalogCandidateData) MarshalJSON() ([]byte, error) { + if r.Raw != nil { + return r.Raw, nil + } + return json.Marshal(struct { + Kind CatalogCandidateKind `json:"kind"` + }{ + Kind: r.Discriminator, + }) +} + +func unmarshalCatalogCandidateSource(data []byte) (CatalogCandidateSource, error) { + if string(data) == "null" { + return nil, nil + } + type rawUnion struct { + Kind CatalogCandidateSourceKind `json:"kind"` + } + var raw rawUnion + if err := json.Unmarshal(data, &raw); err != nil { + return nil, err + } + + switch raw.Kind { + case CatalogCandidateSourceKindEmbedded: + var d CatalogCandidateSourceEmbedded + if err := json.Unmarshal(data, &d); err != nil { + return nil, err + } + return &d, nil + case CatalogCandidateSourceKindURL: + var d CatalogCandidateSourceURL + if err := json.Unmarshal(data, &d); err != nil { + return nil, err + } + return &d, nil + default: + return &RawCatalogCandidateSourceData{Discriminator: raw.Kind, Raw: data}, nil + } +} + +func (r RawCatalogCandidateSourceData) MarshalJSON() ([]byte, error) { + if r.Raw != nil { + return r.Raw, nil + } + return json.Marshal(struct { + Kind CatalogCandidateSourceKind `json:"kind"` + }{ + Kind: r.Discriminator, + }) +} + +func (r CatalogCandidateSourceEmbedded) MarshalJSON() ([]byte, error) { + type alias CatalogCandidateSourceEmbedded + return json.Marshal(struct { + Kind CatalogCandidateSourceKind `json:"kind"` + alias + }{ + Kind: r.Kind(), + alias: alias(r), + }) +} + +func (r CatalogCandidateSourceURL) MarshalJSON() ([]byte, error) { + type alias CatalogCandidateSourceURL + return json.Marshal(struct { + Kind CatalogCandidateSourceKind `json:"kind"` + alias + }{ + Kind: r.Kind(), + alias: alias(r), + }) +} + +func (r *CatalogAiSkillCandidate) UnmarshalJSON(data []byte) error { + type rawCatalogAiSkillCandidate struct { + Description *string `json:"description,omitempty"` + DisplayName string `json:"displayName"` + Handle string `json:"handle"` + HandleExpiresAt string `json:"handleExpiresAt"` + Installability CatalogAiSkillCandidateInstallability `json:"installability"` + MediaType CatalogAiSkillCandidateMediaType `json:"mediaType"` + Provenance CatalogAiSkillCandidateProvenance `json:"provenance"` + Publisher *string `json:"publisher,omitempty"` + Source json.RawMessage `json:"source"` + } + var raw rawCatalogAiSkillCandidate + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + r.Description = raw.Description + r.DisplayName = raw.DisplayName + r.Handle = raw.Handle + r.HandleExpiresAt = raw.HandleExpiresAt + r.Installability = raw.Installability + r.MediaType = raw.MediaType + r.Provenance = raw.Provenance + r.Publisher = raw.Publisher + if raw.Source != nil { + value, err := unmarshalCatalogCandidateSource(raw.Source) + if err != nil { + return err + } + r.Source = value + } + return nil +} + +func (r CatalogAiSkillCandidate) MarshalJSON() ([]byte, error) { + type alias CatalogAiSkillCandidate + return json.Marshal(struct { + Kind CatalogCandidateKind `json:"kind"` + alias + }{ + Kind: r.Kind(), + alias: alias(r), + }) +} + +func (r *CatalogMCPServerCandidate) UnmarshalJSON(data []byte) error { + type rawCatalogMCPServerCandidate struct { + Description *string `json:"description,omitempty"` + DisplayName string `json:"displayName"` + Handle string `json:"handle"` + HandleExpiresAt string `json:"handleExpiresAt"` + Installability CatalogMCPServerInstallability `json:"installability"` + MediaType MCPServerCardMediaType `json:"mediaType"` + Provenance CatalogMCPServerCandidateProvenance `json:"provenance"` + Publisher *string `json:"publisher,omitempty"` + Source json.RawMessage `json:"source"` + } + var raw rawCatalogMCPServerCandidate + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + r.Description = raw.Description + r.DisplayName = raw.DisplayName + r.Handle = raw.Handle + r.HandleExpiresAt = raw.HandleExpiresAt + r.Installability = raw.Installability + r.MediaType = raw.MediaType + r.Provenance = raw.Provenance + r.Publisher = raw.Publisher + if raw.Source != nil { + value, err := unmarshalCatalogCandidateSource(raw.Source) + if err != nil { + return err + } + r.Source = value + } + return nil +} + +func (r CatalogMCPServerCandidate) MarshalJSON() ([]byte, error) { + type alias CatalogMCPServerCandidate + return json.Marshal(struct { + Kind CatalogCandidateKind `json:"kind"` + alias + }{ + Kind: r.Kind(), + alias: alias(r), + }) +} + +func unmarshalCatalogSearchResult(data []byte) (CatalogSearchResult, error) { + if string(data) == "null" { + return nil, nil + } + type rawUnion struct { + Kind CatalogSearchResultKind `json:"kind"` + } + var raw rawUnion + if err := json.Unmarshal(data, &raw); err != nil { + return nil, err + } + + switch raw.Kind { + case CatalogSearchResultKindAuthenticationRequired: + var d CatalogAuthenticationRequiredError + if err := json.Unmarshal(data, &d); err != nil { + return nil, err + } + return &d, nil + case CatalogSearchResultKindContractViolation: + var d CatalogContractViolationError + if err := json.Unmarshal(data, &d); err != nil { + return nil, err + } + return &d, nil + case CatalogSearchResultKindInvalidRequest: + var d CatalogInvalidRequestError + if err := json.Unmarshal(data, &d); err != nil { + return nil, err + } + return &d, nil + case CatalogSearchResultKindMalformedCard: + var d CatalogMalformedCardError + if err := json.Unmarshal(data, &d); err != nil { + return nil, err + } + return &d, nil + case CatalogSearchResultKindNegotiationRefused: + var d CatalogNegotiationRefusedError + if err := json.Unmarshal(data, &d); err != nil { + return nil, err + } + return &d, nil + case CatalogSearchResultKindNetworkFailure: + var d CatalogNetworkFailureError + if err := json.Unmarshal(data, &d); err != nil { + return nil, err + } + return &d, nil + case CatalogSearchResultKindPolicyRejected: + var d CatalogPolicyRejectedError + if err := json.Unmarshal(data, &d); err != nil { + return nil, err + } + return &d, nil + case CatalogSearchResultKindSucceeded: + var d CatalogSearchSucceeded + if err := json.Unmarshal(data, &d); err != nil { + return nil, err + } + return &d, nil + case CatalogSearchResultKindUnavailable: + var d CatalogUnavailableError + if err := json.Unmarshal(data, &d); err != nil { + return nil, err + } + return &d, nil + case CatalogSearchResultKindUnsafeRetrieval: + var d CatalogUnsafeRetrievalError + if err := json.Unmarshal(data, &d); err != nil { + return nil, err + } + return &d, nil + case CatalogSearchResultKindUnsupportedKind: + var d CatalogUnsupportedKindError + if err := json.Unmarshal(data, &d); err != nil { + return nil, err + } + return &d, nil + default: + return &RawCatalogSearchResultData{Discriminator: raw.Kind, Raw: data}, nil + } +} + +func (r RawCatalogSearchResultData) MarshalJSON() ([]byte, error) { + if r.Raw != nil { + return r.Raw, nil + } + return json.Marshal(struct { + Kind CatalogSearchResultKind `json:"kind"` + }{ + Kind: r.Discriminator, + }) +} + +func (r CatalogAuthenticationRequiredError) MarshalJSON() ([]byte, error) { + type alias CatalogAuthenticationRequiredError + return json.Marshal(struct { + Kind CatalogSearchResultKind `json:"kind"` + alias + }{ + Kind: r.Kind(), + alias: alias(r), + }) +} + +func (r CatalogContractViolationError) MarshalJSON() ([]byte, error) { + type alias CatalogContractViolationError + return json.Marshal(struct { + Kind CatalogSearchResultKind `json:"kind"` + alias + }{ + Kind: r.Kind(), + alias: alias(r), + }) +} + +func (r CatalogInvalidRequestError) MarshalJSON() ([]byte, error) { + type alias CatalogInvalidRequestError + return json.Marshal(struct { + Kind CatalogSearchResultKind `json:"kind"` + alias + }{ + Kind: r.Kind(), + alias: alias(r), + }) +} + +func (r CatalogMalformedCardError) MarshalJSON() ([]byte, error) { + type alias CatalogMalformedCardError + return json.Marshal(struct { + Kind CatalogSearchResultKind `json:"kind"` + alias + }{ + Kind: r.Kind(), + alias: alias(r), + }) +} + +func (r CatalogNegotiationRefusedError) MarshalJSON() ([]byte, error) { + type alias CatalogNegotiationRefusedError + return json.Marshal(struct { + Kind CatalogSearchResultKind `json:"kind"` + alias + }{ + Kind: r.Kind(), + alias: alias(r), + }) +} + +func (r CatalogNetworkFailureError) MarshalJSON() ([]byte, error) { + type alias CatalogNetworkFailureError + return json.Marshal(struct { + Kind CatalogSearchResultKind `json:"kind"` + alias + }{ + Kind: r.Kind(), + alias: alias(r), + }) +} + +func (r CatalogPolicyRejectedError) MarshalJSON() ([]byte, error) { + type alias CatalogPolicyRejectedError + return json.Marshal(struct { + Kind CatalogSearchResultKind `json:"kind"` + alias + }{ + Kind: r.Kind(), + alias: alias(r), + }) +} + +func (r *CatalogSearchSucceeded) UnmarshalJSON(data []byte) error { + type rawCatalogSearchSucceeded struct { + Candidates []json.RawMessage `json:"candidates"` + Negotiated CatalogNegotiatedContract `json:"negotiated"` + SearchID string `json:"searchId"` + Truncated bool `json:"truncated"` + } + var raw rawCatalogSearchSucceeded + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + if raw.Candidates != nil { + r.Candidates = make([]CatalogCandidate, 0, len(raw.Candidates)) + for _, rawItem := range raw.Candidates { + value, err := unmarshalCatalogCandidate(rawItem) + if err != nil { + return err + } + r.Candidates = append(r.Candidates, value) + } + } + r.Negotiated = raw.Negotiated + r.SearchID = raw.SearchID + r.Truncated = raw.Truncated + return nil +} + +func (r CatalogSearchSucceeded) MarshalJSON() ([]byte, error) { + type alias CatalogSearchSucceeded + return json.Marshal(struct { + Kind CatalogSearchResultKind `json:"kind"` + alias + }{ + Kind: r.Kind(), + alias: alias(r), + }) +} + +func (r CatalogUnavailableError) MarshalJSON() ([]byte, error) { + type alias CatalogUnavailableError + return json.Marshal(struct { + Kind CatalogSearchResultKind `json:"kind"` + alias + }{ + Kind: r.Kind(), + alias: alias(r), + }) +} + +func (r CatalogUnsafeRetrievalError) MarshalJSON() ([]byte, error) { + type alias CatalogUnsafeRetrievalError + return json.Marshal(struct { + Kind CatalogSearchResultKind `json:"kind"` + alias + }{ + Kind: r.Kind(), + alias: alias(r), + }) +} + +func (r CatalogUnsupportedKindError) MarshalJSON() ([]byte, error) { + type alias CatalogUnsupportedKindError + return json.Marshal(struct { + Kind CatalogSearchResultKind `json:"kind"` + alias + }{ + Kind: r.Kind(), + alias: alias(r), + }) +} + func unmarshalQueuedCommandResult(data []byte) (QueuedCommandResult, error) { if string(data) == "null" { return nil, nil @@ -1736,41 +2173,282 @@ func (r RawMCPHeadersHandlePendingHeadersRefreshRequestData) MarshalJSON() ([]by func (r MCPHeadersHandlePendingHeadersRefreshRequestHeaders) MarshalJSON() ([]byte, error) { type alias MCPHeadersHandlePendingHeadersRefreshRequestHeaders return json.Marshal(struct { - Kind MCPHeadersHandlePendingHeadersRefreshRequestKind `json:"kind"` + Kind MCPHeadersHandlePendingHeadersRefreshRequestKind `json:"kind"` + alias + }{ + Kind: r.Kind(), + alias: alias(r), + }) +} + +func (r MCPHeadersHandlePendingHeadersRefreshRequestNone) MarshalJSON() ([]byte, error) { + type alias MCPHeadersHandlePendingHeadersRefreshRequestNone + return json.Marshal(struct { + Kind MCPHeadersHandlePendingHeadersRefreshRequestKind `json:"kind"` + alias + }{ + Kind: r.Kind(), + alias: alias(r), + }) +} + +func (r *MCPHeadersHandlePendingHeadersRefreshRequestRequest) UnmarshalJSON(data []byte) error { + type rawMCPHeadersHandlePendingHeadersRefreshRequestRequest struct { + RequestID string `json:"requestId"` + Result json.RawMessage `json:"result"` + } + var raw rawMCPHeadersHandlePendingHeadersRefreshRequestRequest + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + r.RequestID = raw.RequestID + if raw.Result != nil { + value, err := unmarshalMCPHeadersHandlePendingHeadersRefreshRequest(raw.Result) + if err != nil { + return err + } + r.Result = value + } + return nil +} + +func unmarshalMCPPlanTransportChoice(data []byte) (MCPPlanTransportChoice, error) { + if string(data) == "null" { + return nil, nil + } + type rawUnion struct { + Transport MCPPlanTransportChoiceTransport `json:"transport"` + } + var raw rawUnion + if err := json.Unmarshal(data, &raw); err != nil { + return nil, err + } + + switch raw.Transport { + case MCPPlanTransportChoiceTransportHTTP: + var d MCPPlanTransportChoiceRemote + if err := json.Unmarshal(data, &d); err != nil { + return nil, err + } + return &d, nil + case MCPPlanTransportChoiceTransportSSE: + var d MCPPlanTransportChoiceRemote + if err := json.Unmarshal(data, &d); err != nil { + return nil, err + } + return &d, nil + case MCPPlanTransportChoiceTransportStdio: + var d MCPPlanTransportChoicePackage + if err := json.Unmarshal(data, &d); err != nil { + return nil, err + } + return &d, nil + case MCPPlanTransportChoiceTransportStreamableHTTP: + var d MCPPlanTransportChoiceRemote + if err := json.Unmarshal(data, &d); err != nil { + return nil, err + } + return &d, nil + default: + return &RawMCPPlanTransportChoiceData{Discriminator: raw.Transport, Raw: data}, nil + } +} + +func (r RawMCPPlanTransportChoiceData) MarshalJSON() ([]byte, error) { + if r.Raw != nil { + return r.Raw, nil + } + return json.Marshal(struct { + Transport MCPPlanTransportChoiceTransport `json:"transport"` + }{ + Transport: r.Discriminator, + }) +} + +func unmarshalMCPPlanRequiredValue(data []byte) (MCPPlanRequiredValue, error) { + if string(data) == "null" { + return nil, nil + } + type rawUnion struct { + Kind MCPPlanRequiredValueKind `json:"kind"` + } + var raw rawUnion + if err := json.Unmarshal(data, &raw); err != nil { + return nil, err + } + + switch raw.Kind { + case MCPPlanRequiredValueKindEnum: + var d MCPPlanRequiredValueEnum + if err := json.Unmarshal(data, &d); err != nil { + return nil, err + } + return &d, nil + case MCPPlanRequiredValueKindScalar: + var d MCPPlanRequiredValueScalar + if err := json.Unmarshal(data, &d); err != nil { + return nil, err + } + return &d, nil + default: + return &RawMCPPlanRequiredValueData{Discriminator: raw.Kind, Raw: data}, nil + } +} + +func (r RawMCPPlanRequiredValueData) MarshalJSON() ([]byte, error) { + if r.Raw != nil { + return r.Raw, nil + } + return json.Marshal(struct { + Kind MCPPlanRequiredValueKind `json:"kind"` + }{ + Kind: r.Discriminator, + }) +} + +func (r MCPPlanRequiredValueEnum) MarshalJSON() ([]byte, error) { + type alias MCPPlanRequiredValueEnum + return json.Marshal(struct { + Kind MCPPlanRequiredValueKind `json:"kind"` + alias + }{ + Kind: r.Kind(), + alias: alias(r), + }) +} + +func (r MCPPlanRequiredValueScalar) MarshalJSON() ([]byte, error) { + type alias MCPPlanRequiredValueScalar + return json.Marshal(struct { + Kind MCPPlanRequiredValueKind `json:"kind"` + alias + }{ + Kind: r.Kind(), + alias: alias(r), + }) +} + +func (r *MCPPlanTransportChoicePackage) UnmarshalJSON(data []byte) error { + type rawMCPPlanTransportChoicePackage struct { + ChoiceID string `json:"choiceId"` + InstallMethod MCPPlanPackageInstallMethod `json:"installMethod"` + PackageIdentifier string `json:"packageIdentifier"` + PackageType string `json:"packageType"` + RequiredValues []json.RawMessage `json:"requiredValues"` + SecretPlaceholders []MCPPlanSecretPlaceholder `json:"secretPlaceholders"` + } + var raw rawMCPPlanTransportChoicePackage + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + r.ChoiceID = raw.ChoiceID + r.InstallMethod = raw.InstallMethod + r.PackageIdentifier = raw.PackageIdentifier + r.PackageType = raw.PackageType + if raw.RequiredValues != nil { + r.RequiredValues = make([]MCPPlanRequiredValue, 0, len(raw.RequiredValues)) + for _, rawItem := range raw.RequiredValues { + value, err := unmarshalMCPPlanRequiredValue(rawItem) + if err != nil { + return err + } + r.RequiredValues = append(r.RequiredValues, value) + } + } + r.SecretPlaceholders = raw.SecretPlaceholders + return nil +} + +func (r MCPPlanTransportChoicePackage) MarshalJSON() ([]byte, error) { + type alias MCPPlanTransportChoicePackage + return json.Marshal(struct { + Transport MCPPlanTransportChoiceTransport `json:"transport"` alias }{ - Kind: r.Kind(), - alias: alias(r), + Transport: r.Transport(), + alias: alias(r), }) } -func (r MCPHeadersHandlePendingHeadersRefreshRequestNone) MarshalJSON() ([]byte, error) { - type alias MCPHeadersHandlePendingHeadersRefreshRequestNone +func (r *MCPPlanTransportChoiceRemote) UnmarshalJSON(data []byte) error { + type rawMCPPlanTransportChoiceRemote struct { + ChoiceID string `json:"choiceId"` + Endpoint string `json:"endpoint"` + InstallMethod MCPPlanRemoteInstallMethod `json:"installMethod"` + RequiredValues []json.RawMessage `json:"requiredValues"` + SecretPlaceholders []MCPPlanSecretPlaceholder `json:"secretPlaceholders"` + Discriminator MCPPlanRemoteTransport `json:"transport,omitempty"` + } + var raw rawMCPPlanTransportChoiceRemote + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + r.ChoiceID = raw.ChoiceID + r.Endpoint = raw.Endpoint + r.InstallMethod = raw.InstallMethod + if raw.RequiredValues != nil { + r.RequiredValues = make([]MCPPlanRequiredValue, 0, len(raw.RequiredValues)) + for _, rawItem := range raw.RequiredValues { + value, err := unmarshalMCPPlanRequiredValue(rawItem) + if err != nil { + return err + } + r.RequiredValues = append(r.RequiredValues, value) + } + } + r.SecretPlaceholders = raw.SecretPlaceholders + r.Discriminator = raw.Discriminator + return nil +} + +func (r MCPPlanTransportChoiceRemote) MarshalJSON() ([]byte, error) { + type alias MCPPlanTransportChoiceRemote return json.Marshal(struct { - Kind MCPHeadersHandlePendingHeadersRefreshRequestKind `json:"kind"` + Transport MCPPlanTransportChoiceTransport `json:"transport"` alias }{ - Kind: r.Kind(), - alias: alias(r), + Transport: r.Transport(), + alias: alias(r), }) } -func (r *MCPHeadersHandlePendingHeadersRefreshRequestRequest) UnmarshalJSON(data []byte) error { - type rawMCPHeadersHandlePendingHeadersRefreshRequestRequest struct { - RequestID string `json:"requestId"` - Result json.RawMessage `json:"result"` +func (r *MCPInstallPlan) UnmarshalJSON(data []byte) error { + type rawMCPInstallPlan struct { + ConfigurationChanges []MCPPlanConfigurationChange `json:"configurationChanges"` + Identity MCPPlanResourceIdentity `json:"identity"` + PlanHandle string `json:"planHandle"` + PlanHandleExpiresAt string `json:"planHandleExpiresAt"` + Policy MCPPlanPolicyResult `json:"policy"` + Provenance MCPPlanProvenance `json:"provenance"` + RecommendedTransportChoiceID *string `json:"recommendedTransportChoiceId,omitempty"` + ReloadRequired bool `json:"reloadRequired"` + RequiresInteractiveConfiguration bool `json:"requiresInteractiveConfiguration"` + Target MCPPlanTarget `json:"target"` + TransportChoices []json.RawMessage `json:"transportChoices"` } - var raw rawMCPHeadersHandlePendingHeadersRefreshRequestRequest + var raw rawMCPInstallPlan if err := json.Unmarshal(data, &raw); err != nil { return err } - r.RequestID = raw.RequestID - if raw.Result != nil { - value, err := unmarshalMCPHeadersHandlePendingHeadersRefreshRequest(raw.Result) - if err != nil { - return err + r.ConfigurationChanges = raw.ConfigurationChanges + r.Identity = raw.Identity + r.PlanHandle = raw.PlanHandle + r.PlanHandleExpiresAt = raw.PlanHandleExpiresAt + r.Policy = raw.Policy + r.Provenance = raw.Provenance + r.RecommendedTransportChoiceID = raw.RecommendedTransportChoiceID + r.ReloadRequired = raw.ReloadRequired + r.RequiresInteractiveConfiguration = raw.RequiresInteractiveConfiguration + r.Target = raw.Target + if raw.TransportChoices != nil { + r.TransportChoices = make([]MCPPlanTransportChoice, 0, len(raw.TransportChoices)) + for _, rawItem := range raw.TransportChoices { + value, err := unmarshalMCPPlanTransportChoice(rawItem) + if err != nil { + return err + } + r.TransportChoices = append(r.TransportChoices, value) } - r.Result = value } return nil } @@ -1955,6 +2633,323 @@ func (r MCPOauthProbeResultNoAuthRequired) MarshalJSON() ([]byte, error) { }) } +func unmarshalMCPPlanInstallSource(data []byte) (MCPPlanInstallSource, error) { + if string(data) == "null" { + return nil, nil + } + type rawUnion struct { + Kind MCPPlanInstallSourceKind `json:"kind"` + } + var raw rawUnion + if err := json.Unmarshal(data, &raw); err != nil { + return nil, err + } + + switch raw.Kind { + case MCPPlanInstallSourceKindCandidate: + var d MCPPlanInstallSourceCandidate + if err := json.Unmarshal(data, &d); err != nil { + return nil, err + } + return &d, nil + case MCPPlanInstallSourceKindCard: + var d MCPPlanInstallSourceCard + if err := json.Unmarshal(data, &d); err != nil { + return nil, err + } + return &d, nil + default: + return &RawMCPPlanInstallSourceData{Discriminator: raw.Kind, Raw: data}, nil + } +} + +func (r RawMCPPlanInstallSourceData) MarshalJSON() ([]byte, error) { + if r.Raw != nil { + return r.Raw, nil + } + return json.Marshal(struct { + Kind MCPPlanInstallSourceKind `json:"kind"` + }{ + Kind: r.Discriminator, + }) +} + +func (r MCPPlanInstallSourceCandidate) MarshalJSON() ([]byte, error) { + type alias MCPPlanInstallSourceCandidate + return json.Marshal(struct { + Kind MCPPlanInstallSourceKind `json:"kind"` + alias + }{ + Kind: r.Kind(), + alias: alias(r), + }) +} + +func unmarshalMCPServerCardReference(data []byte) (MCPServerCardReference, error) { + if string(data) == "null" { + return nil, nil + } + type rawUnion struct { + Kind MCPServerCardReferenceKind `json:"kind"` + } + var raw rawUnion + if err := json.Unmarshal(data, &raw); err != nil { + return nil, err + } + + switch raw.Kind { + case MCPServerCardReferenceKindEmbedded: + var d MCPServerCardEmbedded + if err := json.Unmarshal(data, &d); err != nil { + return nil, err + } + return &d, nil + case MCPServerCardReferenceKindURL: + var d MCPServerCardURL + if err := json.Unmarshal(data, &d); err != nil { + return nil, err + } + return &d, nil + default: + return &RawMCPServerCardReferenceData{Discriminator: raw.Kind, Raw: data}, nil + } +} + +func (r RawMCPServerCardReferenceData) MarshalJSON() ([]byte, error) { + if r.Raw != nil { + return r.Raw, nil + } + return json.Marshal(struct { + Kind MCPServerCardReferenceKind `json:"kind"` + }{ + Kind: r.Discriminator, + }) +} + +func (r MCPServerCardEmbedded) MarshalJSON() ([]byte, error) { + type alias MCPServerCardEmbedded + return json.Marshal(struct { + Kind MCPServerCardReferenceKind `json:"kind"` + alias + }{ + Kind: r.Kind(), + alias: alias(r), + }) +} + +func (r MCPServerCardURL) MarshalJSON() ([]byte, error) { + type alias MCPServerCardURL + return json.Marshal(struct { + Kind MCPServerCardReferenceKind `json:"kind"` + alias + }{ + Kind: r.Kind(), + alias: alias(r), + }) +} + +func (r *MCPPlanInstallSourceCard) UnmarshalJSON(data []byte) error { + type rawMCPPlanInstallSourceCard struct { + Card json.RawMessage `json:"card"` + } + var raw rawMCPPlanInstallSourceCard + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + if raw.Card != nil { + value, err := unmarshalMCPServerCardReference(raw.Card) + if err != nil { + return err + } + r.Card = value + } + return nil +} + +func (r MCPPlanInstallSourceCard) MarshalJSON() ([]byte, error) { + type alias MCPPlanInstallSourceCard + return json.Marshal(struct { + Kind MCPPlanInstallSourceKind `json:"kind"` + alias + }{ + Kind: r.Kind(), + alias: alias(r), + }) +} + +func (r *MCPPlanInstallRequest) UnmarshalJSON(data []byte) error { + type rawMCPPlanInstallRequest struct { + Contract CatalogClientContract `json:"contract"` + Scope *MCPPlanScope `json:"scope,omitempty"` + Source json.RawMessage `json:"source"` + } + var raw rawMCPPlanInstallRequest + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + r.Contract = raw.Contract + r.Scope = raw.Scope + if raw.Source != nil { + value, err := unmarshalMCPPlanInstallSource(raw.Source) + if err != nil { + return err + } + r.Source = value + } + return nil +} + +func unmarshalMCPPlanInstallResult(data []byte) (MCPPlanInstallResult, error) { + if string(data) == "null" { + return nil, nil + } + type rawUnion struct { + Kind MCPPlanInstallResultKind `json:"kind"` + } + var raw rawUnion + if err := json.Unmarshal(data, &raw); err != nil { + return nil, err + } + + switch raw.Kind { + case MCPPlanInstallResultKindAuthenticationRequired: + var d CatalogAuthenticationRequiredError + if err := json.Unmarshal(data, &d); err != nil { + return nil, err + } + return &d, nil + case MCPPlanInstallResultKindContractViolation: + var d CatalogContractViolationError + if err := json.Unmarshal(data, &d); err != nil { + return nil, err + } + return &d, nil + case MCPPlanInstallResultKindHandleRejected: + var d CatalogHandleRejectedError + if err := json.Unmarshal(data, &d); err != nil { + return nil, err + } + return &d, nil + case MCPPlanInstallResultKindInvalidRequest: + var d CatalogInvalidRequestError + if err := json.Unmarshal(data, &d); err != nil { + return nil, err + } + return &d, nil + case MCPPlanInstallResultKindMalformedCard: + var d CatalogMalformedCardError + if err := json.Unmarshal(data, &d); err != nil { + return nil, err + } + return &d, nil + case MCPPlanInstallResultKindNegotiationRefused: + var d CatalogNegotiationRefusedError + if err := json.Unmarshal(data, &d); err != nil { + return nil, err + } + return &d, nil + case MCPPlanInstallResultKindNetworkFailure: + var d CatalogNetworkFailureError + if err := json.Unmarshal(data, &d); err != nil { + return nil, err + } + return &d, nil + case MCPPlanInstallResultKindNotInstallable: + var d CatalogNotInstallableError + if err := json.Unmarshal(data, &d); err != nil { + return nil, err + } + return &d, nil + case MCPPlanInstallResultKindPlanned: + var d MCPPlanInstallPlanned + if err := json.Unmarshal(data, &d); err != nil { + return nil, err + } + return &d, nil + case MCPPlanInstallResultKindPolicyRejected: + var d CatalogPolicyRejectedError + if err := json.Unmarshal(data, &d); err != nil { + return nil, err + } + return &d, nil + case MCPPlanInstallResultKindUnavailable: + var d CatalogUnavailableError + if err := json.Unmarshal(data, &d); err != nil { + return nil, err + } + return &d, nil + case MCPPlanInstallResultKindUnavailableTransport: + var d CatalogUnavailableTransportError + if err := json.Unmarshal(data, &d); err != nil { + return nil, err + } + return &d, nil + case MCPPlanInstallResultKindUnsafeRetrieval: + var d CatalogUnsafeRetrievalError + if err := json.Unmarshal(data, &d); err != nil { + return nil, err + } + return &d, nil + default: + return &RawMCPPlanInstallResultData{Discriminator: raw.Kind, Raw: data}, nil + } +} + +func (r RawMCPPlanInstallResultData) MarshalJSON() ([]byte, error) { + if r.Raw != nil { + return r.Raw, nil + } + return json.Marshal(struct { + Kind MCPPlanInstallResultKind `json:"kind"` + }{ + Kind: r.Discriminator, + }) +} + +func (r CatalogHandleRejectedError) MarshalJSON() ([]byte, error) { + type alias CatalogHandleRejectedError + return json.Marshal(struct { + Kind MCPPlanInstallResultKind `json:"kind"` + alias + }{ + Kind: r.mcpPlanInstallResultKind(), + alias: alias(r), + }) +} + +func (r CatalogNotInstallableError) MarshalJSON() ([]byte, error) { + type alias CatalogNotInstallableError + return json.Marshal(struct { + Kind MCPPlanInstallResultKind `json:"kind"` + alias + }{ + Kind: r.mcpPlanInstallResultKind(), + alias: alias(r), + }) +} + +func (r CatalogUnavailableTransportError) MarshalJSON() ([]byte, error) { + type alias CatalogUnavailableTransportError + return json.Marshal(struct { + Kind MCPPlanInstallResultKind `json:"kind"` + alias + }{ + Kind: r.mcpPlanInstallResultKind(), + alias: alias(r), + }) +} + +func (r MCPPlanInstallPlanned) MarshalJSON() ([]byte, error) { + type alias MCPPlanInstallPlanned + return json.Marshal(struct { + Kind MCPPlanInstallResultKind `json:"kind"` + alias + }{ + Kind: r.mcpPlanInstallResultKind(), + alias: alias(r), + }) +} + func matchesMCPServerConfigHTTP(data []byte) bool { var rawGroup0 struct { Command json.RawMessage `json:"command"` diff --git a/go/rpc/zsession_events.go b/go/rpc/zsession_events.go index fac17cfad1..82b0470dbf 100644 --- a/go/rpc/zsession_events.go +++ b/go/rpc/zsession_events.go @@ -161,41 +161,43 @@ const ( SessionEventTypeSessionMCPServerStatusChanged SessionEventType = "session.mcp_server_status_changed" SessionEventTypeSessionModeChanged SessionEventType = "session.mode_changed" SessionEventTypeSessionModelChange SessionEventType = "session.model_change" - SessionEventTypeSessionPermissionsChanged SessionEventType = "session.permissions_changed" - SessionEventTypeSessionPlanChanged SessionEventType = "session.plan_changed" - SessionEventTypeSessionRemoteSteerableChanged SessionEventType = "session.remote_steerable_changed" - SessionEventTypeSessionResume SessionEventType = "session.resume" - SessionEventTypeSessionScheduleCancelled SessionEventType = "session.schedule_cancelled" - SessionEventTypeSessionScheduleCreated SessionEventType = "session.schedule_created" - SessionEventTypeSessionScheduleRearmed SessionEventType = "session.schedule_rearmed" - SessionEventTypeSessionSessionLimitsChanged SessionEventType = "session.session_limits_changed" - SessionEventTypeSessionShutdown SessionEventType = "session.shutdown" - SessionEventTypeSessionSkillsLoaded SessionEventType = "session.skills_loaded" - SessionEventTypeSessionSnapshotRewind SessionEventType = "session.snapshot_rewind" - SessionEventTypeSessionStart SessionEventType = "session.start" - SessionEventTypeSessionTaskComplete SessionEventType = "session.task_complete" - SessionEventTypeSessionTitleChanged SessionEventType = "session.title_changed" - SessionEventTypeSessionTodosChanged SessionEventType = "session.todos_changed" - SessionEventTypeSessionToolsUpdated SessionEventType = "session.tools_updated" - SessionEventTypeSessionTruncation SessionEventType = "session.truncation" - SessionEventTypeSessionUsageCheckpoint SessionEventType = "session.usage_checkpoint" - SessionEventTypeSessionUsageInfo SessionEventType = "session.usage_info" - SessionEventTypeSessionWarning SessionEventType = "session.warning" - SessionEventTypeSessionWorkspaceFileChanged SessionEventType = "session.workspace_file_changed" - SessionEventTypeSkillInvoked SessionEventType = "skill.invoked" - SessionEventTypeSubagentCompleted SessionEventType = "subagent.completed" - SessionEventTypeSubagentDeselected SessionEventType = "subagent.deselected" - SessionEventTypeSubagentFailed SessionEventType = "subagent.failed" - SessionEventTypeSubagentSelected SessionEventType = "subagent.selected" - SessionEventTypeSubagentStarted SessionEventType = "subagent.started" - SessionEventTypeSystemMessage SessionEventType = "system.message" - SessionEventTypeSystemNotification SessionEventType = "system.notification" - SessionEventTypeToolExecutionComplete SessionEventType = "tool.execution_complete" - SessionEventTypeToolExecutionPartialResult SessionEventType = "tool.execution_partial_result" - SessionEventTypeToolExecutionProgress SessionEventType = "tool.execution_progress" - SessionEventTypeToolExecutionStart SessionEventType = "tool.execution_start" - SessionEventTypeToolSearchActivated SessionEventType = "tool_search.activated" - SessionEventTypeToolUserRequested SessionEventType = "tool.user_requested" + // Experimental: SessionEventTypeSessionPermissionsChanged identifies an experimental event + // that may change or be removed. + SessionEventTypeSessionPermissionsChanged SessionEventType = "session.permissions_changed" + SessionEventTypeSessionPlanChanged SessionEventType = "session.plan_changed" + SessionEventTypeSessionRemoteSteerableChanged SessionEventType = "session.remote_steerable_changed" + SessionEventTypeSessionResume SessionEventType = "session.resume" + SessionEventTypeSessionScheduleCancelled SessionEventType = "session.schedule_cancelled" + SessionEventTypeSessionScheduleCreated SessionEventType = "session.schedule_created" + SessionEventTypeSessionScheduleRearmed SessionEventType = "session.schedule_rearmed" + SessionEventTypeSessionSessionLimitsChanged SessionEventType = "session.session_limits_changed" + SessionEventTypeSessionShutdown SessionEventType = "session.shutdown" + SessionEventTypeSessionSkillsLoaded SessionEventType = "session.skills_loaded" + SessionEventTypeSessionSnapshotRewind SessionEventType = "session.snapshot_rewind" + SessionEventTypeSessionStart SessionEventType = "session.start" + SessionEventTypeSessionTaskComplete SessionEventType = "session.task_complete" + SessionEventTypeSessionTitleChanged SessionEventType = "session.title_changed" + SessionEventTypeSessionTodosChanged SessionEventType = "session.todos_changed" + SessionEventTypeSessionToolsUpdated SessionEventType = "session.tools_updated" + SessionEventTypeSessionTruncation SessionEventType = "session.truncation" + SessionEventTypeSessionUsageCheckpoint SessionEventType = "session.usage_checkpoint" + SessionEventTypeSessionUsageInfo SessionEventType = "session.usage_info" + SessionEventTypeSessionWarning SessionEventType = "session.warning" + SessionEventTypeSessionWorkspaceFileChanged SessionEventType = "session.workspace_file_changed" + SessionEventTypeSkillInvoked SessionEventType = "skill.invoked" + SessionEventTypeSubagentCompleted SessionEventType = "subagent.completed" + SessionEventTypeSubagentDeselected SessionEventType = "subagent.deselected" + SessionEventTypeSubagentFailed SessionEventType = "subagent.failed" + SessionEventTypeSubagentSelected SessionEventType = "subagent.selected" + SessionEventTypeSubagentStarted SessionEventType = "subagent.started" + SessionEventTypeSystemMessage SessionEventType = "system.message" + SessionEventTypeSystemNotification SessionEventType = "system.notification" + SessionEventTypeToolExecutionComplete SessionEventType = "tool.execution_complete" + SessionEventTypeToolExecutionPartialResult SessionEventType = "tool.execution_partial_result" + SessionEventTypeToolExecutionProgress SessionEventType = "tool.execution_progress" + SessionEventTypeToolExecutionStart SessionEventType = "tool.execution_start" + SessionEventTypeToolSearchActivated SessionEventType = "tool_search.activated" + SessionEventTypeToolUserRequested SessionEventType = "tool.user_requested" // Experimental: SessionEventTypeUIEphemeralQuery identifies an experimental event that may // change or be removed. SessionEventTypeUIEphemeralQuery SessionEventType = "ui.ephemeral_query" @@ -1554,18 +1556,18 @@ type PermissionRequestedData struct { func (*PermissionRequestedData) sessionEventData() {} func (*PermissionRequestedData) Type() SessionEventType { return SessionEventTypePermissionRequested } -// Permissions change details carrying the aggregate allow-all transition. +// Permission-mode transition details. +// Experimental: SessionPermissionsChangedData is part of an experimental API and may change or be removed. type SessionPermissionsChangedData struct { - // Allow-all mode after the change - // Experimental: AllowAllPermissionMode is part of an experimental API and may change or be removed. - AllowAllPermissionMode *PermissionAllowAllMode `json:"allowAllPermissionMode,omitempty"` - // Aggregate allow-all flag after the change - AllowAllPermissions bool `json:"allowAllPermissions"` - // Allow-all mode before the change - // Experimental: PreviousAllowAllPermissionMode is part of an experimental API and may change or be removed. - PreviousAllowAllPermissionMode *PermissionAllowAllMode `json:"previousAllowAllPermissionMode,omitempty"` - // Aggregate allow-all flag before the change - PreviousAllowAllPermissions bool `json:"previousAllowAllPermissions"` + // Explicit LLM judge model override used by assisted mode; omitted when the provider default applies + // Experimental: AssistedApprovalModel is part of an experimental API and may change or be removed. + AssistedApprovalModel *string `json:"assistedApprovalModel,omitempty"` + // Permission mode after the change + // Experimental: Mode is part of an experimental API and may change or be removed. + Mode PermissionMode `json:"mode"` + // Permission mode before the change + // Experimental: PreviousMode is part of an experimental API and may change or be removed. + PreviousMode PermissionMode `json:"previousMode"` } func (*SessionPermissionsChangedData) sessionEventData() {} @@ -2906,17 +2908,17 @@ type ModelCallFailureRequestFingerprint struct { ToolResultMessageCount int64 `json:"toolResultMessageCount"` } -// Auto-approval judge information attached to a permission request. Present (non-null) only when the session's allow-all mode is "auto"; its absence means auto mode was off and the judge did not evaluate the request. The `recommendation` conveys the judge's disposition for this request. -// Experimental: PermissionAutoApproval is part of an experimental API and may change or be removed. -type PermissionAutoApproval struct { +// Assisted-approval judge information attached to a permission request. Present only in assisted mode; its absence means the judge did not evaluate the request. The `recommendation` conveys the judge's disposition for this request. +// Experimental: PermissionAssistedApproval is part of an experimental API and may change or be removed. +type PermissionAssistedApproval struct { // Classified cause of an `error` recommendation. Absent for every other recommendation. - FailureReason *AutoApprovalJudgeFailureReason `json:"failureReason,omitempty"` + FailureReason *AssistedApprovalJudgeFailureReason `json:"failureReason,omitempty"` // Model id that produced the recommendation, when the judge was consulted and reported one. Absent for `excluded` (the judge was not consulted) and for failures that occurred before a model was selected. Model *string `json:"model,omitempty"` // Human-readable reason for the judge's recommendation, when available. Reason *string `json:"reason,omitempty"` - // The auto-approval safety judge's outcome for this request. - Recommendation AutoApprovalRecommendation `json:"recommendation"` + // The assisted-approval safety judge's outcome for this request. + Recommendation AssistedApprovalRecommendation `json:"recommendation"` } // Derived user-facing permission prompt details for UI consumers @@ -2937,9 +2939,9 @@ func (r RawPermissionPromptRequest) Kind() PermissionPromptRequestKind { // Shell command permission prompt type PermissionPromptRequestCommands struct { - // Auto-approval judge information for this request; present only when auto mode is enabled. - // Experimental: AutoApproval is part of an experimental API and may change or be removed. - AutoApproval *PermissionAutoApproval `json:"autoApproval,omitempty"` + // Assisted-approval judge information for this request; present only in assisted mode. + // Experimental: AssistedApproval is part of an experimental API and may change or be removed. + AssistedApproval *PermissionAssistedApproval `json:"assistedApproval,omitempty"` // Whether the UI can offer session-wide approval for this command pattern CanOfferSessionApproval bool `json:"canOfferSessionApproval"` // Command identifiers covered by this approval prompt @@ -2965,9 +2967,9 @@ func (PermissionPromptRequestCommands) Kind() PermissionPromptRequestKind { type PermissionPromptRequestCustomTool struct { // Arguments to pass to the custom tool Args any `json:"args,omitempty"` - // Auto-approval judge information for this request; present only when auto mode is enabled. - // Experimental: AutoApproval is part of an experimental API and may change or be removed. - AutoApproval *PermissionAutoApproval `json:"autoApproval,omitempty"` + // Assisted-approval judge information for this request; present only in assisted mode. + // Experimental: AssistedApproval is part of an experimental API and may change or be removed. + AssistedApproval *PermissionAssistedApproval `json:"assistedApproval,omitempty"` // Tool call ID that triggered this permission request ToolCallID *string `json:"toolCallId,omitempty"` // Description of what the custom tool does @@ -2983,9 +2985,9 @@ func (PermissionPromptRequestCustomTool) Kind() PermissionPromptRequestKind { // Extension sensitive environment variable access prompt type PermissionPromptRequestExtensionEnvAccess struct { - // Auto-approval judge information for this request; present only when auto mode is enabled. - // Experimental: AutoApproval is part of an experimental API and may change or be removed. - AutoApproval *PermissionAutoApproval `json:"autoApproval,omitempty"` + // Assisted-approval judge information for this request; present only in assisted mode. + // Experimental: AssistedApproval is part of an experimental API and may change or be removed. + AssistedApproval *PermissionAssistedApproval `json:"assistedApproval,omitempty"` // Names of the sensitive environment variables the extension is requesting. Values never appear here. EnvironmentVariables []string `json:"environmentVariables"` // Name of the extension requesting environment variable access @@ -3001,9 +3003,9 @@ func (PermissionPromptRequestExtensionEnvAccess) Kind() PermissionPromptRequestK // Extension management permission prompt type PermissionPromptRequestExtensionManagement struct { - // Auto-approval judge information for this request; present only when auto mode is enabled. - // Experimental: AutoApproval is part of an experimental API and may change or be removed. - AutoApproval *PermissionAutoApproval `json:"autoApproval,omitempty"` + // Assisted-approval judge information for this request; present only in assisted mode. + // Experimental: AssistedApproval is part of an experimental API and may change or be removed. + AssistedApproval *PermissionAssistedApproval `json:"assistedApproval,omitempty"` // Name of the extension being managed ExtensionName *string `json:"extensionName,omitempty"` // The extension management operation (scaffold, reload) @@ -3019,9 +3021,9 @@ func (PermissionPromptRequestExtensionManagement) Kind() PermissionPromptRequest // Extension permission access prompt type PermissionPromptRequestExtensionPermissionAccess struct { - // Auto-approval judge information for this request; present only when auto mode is enabled. - // Experimental: AutoApproval is part of an experimental API and may change or be removed. - AutoApproval *PermissionAutoApproval `json:"autoApproval,omitempty"` + // Assisted-approval judge information for this request; present only in assisted mode. + // Experimental: AssistedApproval is part of an experimental API and may change or be removed. + AssistedApproval *PermissionAssistedApproval `json:"assistedApproval,omitempty"` // Capabilities the extension is requesting Capabilities []string `json:"capabilities"` // Name of the extension requesting permission access @@ -3039,9 +3041,9 @@ func (PermissionPromptRequestExtensionPermissionAccess) Kind() PermissionPromptR type PermissionPromptRequestFactory struct { // Canonical key used for scoped factory approvals ApprovalKey string `json:"approvalKey"` - // Auto-approval judge information for this request; present only when auto mode is enabled. - // Experimental: AutoApproval is part of an experimental API and may change or be removed. - AutoApproval *PermissionAutoApproval `json:"autoApproval,omitempty"` + // Assisted-approval judge information for this request; present only in assisted mode. + // Experimental: AssistedApproval is part of an experimental API and may change or be removed. + AssistedApproval *PermissionAssistedApproval `json:"assistedApproval,omitempty"` // Whether this factory is eligible for persistent approval CanPersistApproval bool `json:"canPersistApproval"` // Factory-declared AI-credit limit before any run/resume caller override is applied. @@ -3081,9 +3083,9 @@ func (PermissionPromptRequestFactory) Kind() PermissionPromptRequestKind { // Hook confirmation permission prompt type PermissionPromptRequestHook struct { - // Auto-approval judge information for this request; present only when auto mode is enabled. - // Experimental: AutoApproval is part of an experimental API and may change or be removed. - AutoApproval *PermissionAutoApproval `json:"autoApproval,omitempty"` + // Assisted-approval judge information for this request; present only in assisted mode. + // Experimental: AssistedApproval is part of an experimental API and may change or be removed. + AssistedApproval *PermissionAssistedApproval `json:"assistedApproval,omitempty"` // Optional message from the hook explaining why confirmation is needed HookMessage *string `json:"hookMessage,omitempty"` // Arguments of the tool call being gated @@ -3103,9 +3105,9 @@ func (PermissionPromptRequestHook) Kind() PermissionPromptRequestKind { type PermissionPromptRequestMCP struct { // Arguments to pass to the MCP tool Args any `json:"args,omitempty"` - // Auto-approval judge information for this request; present only when auto mode is enabled. - // Experimental: AutoApproval is part of an experimental API and may change or be removed. - AutoApproval *PermissionAutoApproval `json:"autoApproval,omitempty"` + // Assisted-approval judge information for this request; present only in assisted mode. + // Experimental: AssistedApproval is part of an experimental API and may change or be removed. + AssistedApproval *PermissionAssistedApproval `json:"assistedApproval,omitempty"` // Advisory runtime permission recommendation. The host remains responsible for deciding the request and may reject it. // Experimental: PermissionRecommendation is part of an experimental API and may change or be removed. PermissionRecommendation *PermissionRecommendation `json:"permissionRecommendation,omitempty"` @@ -3128,9 +3130,9 @@ func (PermissionPromptRequestMCP) Kind() PermissionPromptRequestKind { type PermissionPromptRequestMemory struct { // Whether this is a store or vote memory operation Action *PermissionRequestMemoryAction `json:"action,omitempty"` - // Auto-approval judge information for this request; present only when auto mode is enabled. - // Experimental: AutoApproval is part of an experimental API and may change or be removed. - AutoApproval *PermissionAutoApproval `json:"autoApproval,omitempty"` + // Assisted-approval judge information for this request; present only in assisted mode. + // Experimental: AssistedApproval is part of an experimental API and may change or be removed. + AssistedApproval *PermissionAssistedApproval `json:"assistedApproval,omitempty"` // Source references for the stored fact (store only) Citations *string `json:"citations,omitempty"` // Vote direction (vote only) @@ -3154,9 +3156,9 @@ func (PermissionPromptRequestMemory) Kind() PermissionPromptRequestKind { type PermissionPromptRequestPath struct { // Underlying permission kind that needs path approval AccessKind PermissionPromptRequestPathAccessKind `json:"accessKind"` - // Auto-approval judge information for this request; present only when auto mode is enabled. - // Experimental: AutoApproval is part of an experimental API and may change or be removed. - AutoApproval *PermissionAutoApproval `json:"autoApproval,omitempty"` + // Assisted-approval judge information for this request; present only in assisted mode. + // Experimental: AssistedApproval is part of an experimental API and may change or be removed. + AssistedApproval *PermissionAssistedApproval `json:"assistedApproval,omitempty"` // File paths that require explicit approval Paths []string `json:"paths"` // Tool call ID that triggered this permission request @@ -3170,9 +3172,9 @@ func (PermissionPromptRequestPath) Kind() PermissionPromptRequestKind { // File read permission prompt type PermissionPromptRequestRead struct { - // Auto-approval judge information for this request; present only when auto mode is enabled. - // Experimental: AutoApproval is part of an experimental API and may change or be removed. - AutoApproval *PermissionAutoApproval `json:"autoApproval,omitempty"` + // Assisted-approval judge information for this request; present only in assisted mode. + // Experimental: AssistedApproval is part of an experimental API and may change or be removed. + AssistedApproval *PermissionAssistedApproval `json:"assistedApproval,omitempty"` // Human-readable description of why the file is being read Intention string `json:"intention"` // Whether managed policy requires a human response and forbids host auto-approval @@ -3190,9 +3192,9 @@ func (PermissionPromptRequestRead) Kind() PermissionPromptRequestKind { // URL access permission prompt type PermissionPromptRequestURL struct { - // Auto-approval judge information for this request; present only when auto mode is enabled. - // Experimental: AutoApproval is part of an experimental API and may change or be removed. - AutoApproval *PermissionAutoApproval `json:"autoApproval,omitempty"` + // Assisted-approval judge information for this request; present only in assisted mode. + // Experimental: AssistedApproval is part of an experimental API and may change or be removed. + AssistedApproval *PermissionAssistedApproval `json:"assistedApproval,omitempty"` // Human-readable description of why the URL is being accessed Intention string `json:"intention"` // Whether managed policy requires a human response and forbids host auto-approval @@ -3216,9 +3218,9 @@ func (PermissionPromptRequestURL) Kind() PermissionPromptRequestKind { // File write permission prompt type PermissionPromptRequestWrite struct { - // Auto-approval judge information for this request; present only when auto mode is enabled. - // Experimental: AutoApproval is part of an experimental API and may change or be removed. - AutoApproval *PermissionAutoApproval `json:"autoApproval,omitempty"` + // Assisted-approval judge information for this request; present only in assisted mode. + // Experimental: AssistedApproval is part of an experimental API and may change or be removed. + AssistedApproval *PermissionAssistedApproval `json:"assistedApproval,omitempty"` // Whether the UI can offer session-wide approval for file write operations CanOfferSessionApproval bool `json:"canOfferSessionApproval"` // Unified diff showing the proposed changes @@ -3419,8 +3421,9 @@ func (PermissionRequestMCP) Kind() PermissionRequestKind { type PermissionRequestMemory struct { // Whether this is a store or vote memory operation Action *PermissionRequestMemoryAction `json:"action,omitempty"` - // Auto-approval judge information for this request; present only when auto mode is enabled. - AutoApproval *PermissionAutoApproval `json:"autoApproval,omitempty"` + // Assisted-approval judge information for this request; present only in assisted mode. + // Experimental: AssistedApproval is part of an experimental API and may change or be removed. + AssistedApproval *PermissionAssistedApproval `json:"assistedApproval,omitempty"` // Source references for the stored fact (store only) Citations *string `json:"citations,omitempty"` // Vote direction (vote only) @@ -4443,36 +4446,36 @@ const ( AssistantUsageTransportWebsocket AssistantUsageTransport = "websocket" ) -// Why the auto-approval judge produced no usable recommendation. Present only alongside an `error` recommendation, where the human-readable reason is a fixed string and therefore cannot distinguish these cases. Intended to make a judge failure reportable by a consumer that has no access to the host's logs. -// Experimental: AutoApprovalJudgeFailureReason is part of an experimental API and may change or be removed. -type AutoApprovalJudgeFailureReason string +// Why the assisted-approval judge produced no usable recommendation. Present only alongside an `error` recommendation, where the human-readable reason is a fixed string and therefore cannot distinguish these cases. Intended to make a judge failure reportable by a consumer that has no access to the host's logs. +// Experimental: AssistedApprovalJudgeFailureReason is part of an experimental API and may change or be removed. +type AssistedApprovalJudgeFailureReason string const ( // The judge model call was cancelled before it returned. - AutoApprovalJudgeFailureReasonAbort AutoApprovalJudgeFailureReason = "abort" + AssistedApprovalJudgeFailureReasonAbort AssistedApprovalJudgeFailureReason = "abort" // The judge model call completed but returned no content. - AutoApprovalJudgeFailureReasonEmptyResponse AutoApprovalJudgeFailureReason = "empty_response" + AssistedApprovalJudgeFailureReasonEmptyResponse AssistedApprovalJudgeFailureReason = "empty_response" // The judge model call failed (for example a transport, authentication, or rate-limit error). - AutoApprovalJudgeFailureReasonModelError AutoApprovalJudgeFailureReason = "model_error" + AssistedApprovalJudgeFailureReasonModelError AssistedApprovalJudgeFailureReason = "model_error" // The judge model replied, but the reply carried no ALLOW/DENY verdict. - AutoApprovalJudgeFailureReasonParseError AutoApprovalJudgeFailureReason = "parse_error" + AssistedApprovalJudgeFailureReasonParseError AssistedApprovalJudgeFailureReason = "parse_error" // The judge model call exceeded its deadline. - AutoApprovalJudgeFailureReasonTimeout AutoApprovalJudgeFailureReason = "timeout" + AssistedApprovalJudgeFailureReasonTimeout AssistedApprovalJudgeFailureReason = "timeout" ) -// Outcome of the auto-approval safety judge for a permission request. Present only when auto mode is enabled; its absence means the judge did not evaluate the request (auto mode was off). -// Experimental: AutoApprovalRecommendation is part of an experimental API and may change or be removed. -type AutoApprovalRecommendation string +// Outcome of the assisted-approval safety judge for a permission request. Present only in assisted mode; its absence means the judge did not evaluate the request. +// Experimental: AssistedApprovalRecommendation is part of an experimental API and may change or be removed. +type AssistedApprovalRecommendation string const ( // The judge evaluated the request and recommends automatically approving it. - AutoApprovalRecommendationApprove AutoApprovalRecommendation = "approve" + AssistedApprovalRecommendationApprove AssistedApprovalRecommendation = "approve" // The judge was consulted but did not return a usable recommendation, so the request requires explicit approval. - AutoApprovalRecommendationError AutoApprovalRecommendation = "error" - // Auto mode is enabled, but this request category is never auto-approvable (for example, sandbox-bypass requests), so the judge was not consulted. - AutoApprovalRecommendationExcluded AutoApprovalRecommendation = "excluded" - // The judge evaluated the request and does not recommend auto-approving it; explicit approval is required. Whether that means prompting, denying, or something else is the consumer's decision. - AutoApprovalRecommendationRequireApproval AutoApprovalRecommendation = "requireApproval" + AssistedApprovalRecommendationError AssistedApprovalRecommendation = "error" + // Assisted mode is enabled, but this request category is never automatically approvable (for example, sandbox-bypass requests), so the judge was not consulted. + AssistedApprovalRecommendationExcluded AssistedApprovalRecommendation = "excluded" + // The judge evaluated the request and does not recommend automatically approving it; explicit approval is required. Whether that means prompting, denying, or something else is the consumer's decision. + AssistedApprovalRecommendationRequireApproval AssistedApprovalRecommendation = "requireApproval" ) // Coarse request-difficulty bucket for UX explainability @@ -4701,12 +4704,12 @@ const ( type ManagedSettingsEnforcedEscalation string const ( - // Full allow-all ("/allow-all on") permissions — auto-approving tools, paths, and URLs. + // Full allow-all permissions — automatically approving tools, paths, and URLs. ManagedSettingsEnforcedEscalationAllowAll ManagedSettingsEnforcedEscalation = "allow_all" - // Auto-approval of all tool permission requests. + // Automatic approval of all tool permission requests. ManagedSettingsEnforcedEscalationApproveAll ManagedSettingsEnforcedEscalation = "approve_all" - // Advisory auto-approval ("/allow-all auto") mode — keeps normal prompt paths and adds LLM-advised approval, distinct from full allow-all. - ManagedSettingsEnforcedEscalationAutoApproval ManagedSettingsEnforcedEscalation = "auto_approval" + // Assisted mode — keeps normal prompt paths and adds an LLM recommendation, distinct from allow-all. + ManagedSettingsEnforcedEscalationAssistedApproval ManagedSettingsEnforcedEscalation = "assisted_approval" // Unrestricted filesystem access outside the session's allowed directories. ManagedSettingsEnforcedEscalationUnrestrictedPaths ManagedSettingsEnforcedEscalation = "unrestricted_paths" // Unrestricted URL fetch access. @@ -4850,19 +4853,6 @@ const ( OmittedBinaryTypeResource OmittedBinaryType = "resource" ) -// Allow-all mode for the session. -// Experimental: PermissionAllowAllMode is part of an experimental API and may change or be removed. -type PermissionAllowAllMode string - -const ( - // Permission requests follow the normal approval flow with an LLM advisory recommendation attached; clients may choose to auto-approve requests the judge evaluated as acceptable. - PermissionAllowAllModeAuto PermissionAllowAllMode = "auto" - // Permission requests follow the normal approval flow. - PermissionAllowAllModeOff PermissionAllowAllMode = "off" - // Tool, path, and URL permission requests are automatically approved. - PermissionAllowAllModeOn PermissionAllowAllMode = "on" -) - // Kind discriminator for PermissionPromptRequest. type PermissionPromptRequestKind string diff --git a/go/types.go b/go/types.go index 1fca9d1796..60781d1da8 100644 --- a/go/types.go +++ b/go/types.go @@ -408,10 +408,10 @@ const ( type PermissionDecisionSource = rpc.PermissionDecisionSource const ( - PermissionDecisionSourceHostPolicy = rpc.PermissionDecisionSourceHostPolicy - PermissionDecisionSourceHumanResponse = rpc.PermissionDecisionSourceHumanResponse - PermissionDecisionSourceJudgeRecommendation = rpc.PermissionDecisionSourceJudgeRecommendation - PermissionDecisionSourceUnattendedFallback = rpc.PermissionDecisionSourceUnattendedFallback + PermissionDecisionSourceAssistedApproval = rpc.PermissionDecisionSourceAssistedApproval + PermissionDecisionSourceHostPolicy = rpc.PermissionDecisionSourceHostPolicy + PermissionDecisionSourceHumanResponse = rpc.PermissionDecisionSourceHumanResponse + PermissionDecisionSourceUnattendedFallback = rpc.PermissionDecisionSourceUnattendedFallback ) // PermissionDecisionSurface identifies the client surface that submitted a diff --git a/go/zsession_events.go b/go/zsession_events.go index 51b892eff0..711943b45d 100644 --- a/go/zsession_events.go +++ b/go/zsession_events.go @@ -33,6 +33,8 @@ type ( AssistantUsageCopilotUsageTokenDetail = rpc.AssistantUsageCopilotUsageTokenDetail AssistantUsageData = rpc.AssistantUsageData AssistantUsageTransport = rpc.AssistantUsageTransport + AssistedApprovalJudgeFailureReason = rpc.AssistedApprovalJudgeFailureReason + AssistedApprovalRecommendation = rpc.AssistedApprovalRecommendation Attachment = rpc.Attachment AttachmentBlob = rpc.AttachmentBlob AttachmentDirectory = rpc.AttachmentDirectory @@ -57,8 +59,6 @@ type ( AttachmentSelectionDetailsEnd = rpc.AttachmentSelectionDetailsEnd AttachmentSelectionDetailsStart = rpc.AttachmentSelectionDetailsStart AttachmentType = rpc.AttachmentType - AutoApprovalJudgeFailureReason = rpc.AutoApprovalJudgeFailureReason - AutoApprovalRecommendation = rpc.AutoApprovalRecommendation AutoModeResolvedReasoningBucket = rpc.AutoModeResolvedReasoningBucket AutoModeSwitchCompletedData = rpc.AutoModeSwitchCompletedData AutoModeSwitchRequestedData = rpc.AutoModeSwitchRequestedData @@ -161,11 +161,10 @@ type ( OmittedBinaryResult = rpc.OmittedBinaryResult OmittedBinaryType = rpc.OmittedBinaryType PendingMessagesModifiedData = rpc.PendingMessagesModifiedData - PermissionAllowAllMode = rpc.PermissionAllowAllMode PermissionApproved = rpc.PermissionApproved PermissionApprovedForLocation = rpc.PermissionApprovedForLocation PermissionApprovedForSession = rpc.PermissionApprovedForSession - PermissionAutoApproval = rpc.PermissionAutoApproval + PermissionAssistedApproval = rpc.PermissionAssistedApproval PermissionCancelled = rpc.PermissionCancelled PermissionCompletedData = rpc.PermissionCompletedData PermissionDeniedByContentExclusionPolicy = rpc.PermissionDeniedByContentExclusionPolicy @@ -173,6 +172,7 @@ type ( PermissionDeniedByRules = rpc.PermissionDeniedByRules PermissionDeniedInteractivelyByUser = rpc.PermissionDeniedInteractivelyByUser PermissionDeniedNoApprovalRuleAndCouldNotRequestFromUser = rpc.PermissionDeniedNoApprovalRuleAndCouldNotRequestFromUser + PermissionMode = rpc.PermissionMode PermissionPromptRequest = rpc.PermissionPromptRequest PermissionPromptRequestCommands = rpc.PermissionPromptRequestCommands PermissionPromptRequestCustomTool = rpc.PermissionPromptRequestCustomTool @@ -411,6 +411,15 @@ const ( AssistantUsageAPIEndpointWsResponses = rpc.AssistantUsageAPIEndpointWsResponses AssistantUsageTransportHTTP = rpc.AssistantUsageTransportHTTP AssistantUsageTransportWebsocket = rpc.AssistantUsageTransportWebsocket + AssistedApprovalJudgeFailureReasonAbort = rpc.AssistedApprovalJudgeFailureReasonAbort + AssistedApprovalJudgeFailureReasonEmptyResponse = rpc.AssistedApprovalJudgeFailureReasonEmptyResponse + AssistedApprovalJudgeFailureReasonModelError = rpc.AssistedApprovalJudgeFailureReasonModelError + AssistedApprovalJudgeFailureReasonParseError = rpc.AssistedApprovalJudgeFailureReasonParseError + AssistedApprovalJudgeFailureReasonTimeout = rpc.AssistedApprovalJudgeFailureReasonTimeout + AssistedApprovalRecommendationApprove = rpc.AssistedApprovalRecommendationApprove + AssistedApprovalRecommendationError = rpc.AssistedApprovalRecommendationError + AssistedApprovalRecommendationExcluded = rpc.AssistedApprovalRecommendationExcluded + AssistedApprovalRecommendationRequireApproval = rpc.AssistedApprovalRecommendationRequireApproval AttachmentGitHubReferenceTypeDiscussion = rpc.AttachmentGitHubReferenceTypeDiscussion AttachmentGitHubReferenceTypeIssue = rpc.AttachmentGitHubReferenceTypeIssue AttachmentGitHubReferenceTypePr = rpc.AttachmentGitHubReferenceTypePr @@ -429,15 +438,6 @@ const ( AttachmentTypeGitHubTreeComparison = rpc.AttachmentTypeGitHubTreeComparison AttachmentTypeGitHubURL = rpc.AttachmentTypeGitHubURL AttachmentTypeSelection = rpc.AttachmentTypeSelection - AutoApprovalJudgeFailureReasonAbort = rpc.AutoApprovalJudgeFailureReasonAbort - AutoApprovalJudgeFailureReasonEmptyResponse = rpc.AutoApprovalJudgeFailureReasonEmptyResponse - AutoApprovalJudgeFailureReasonModelError = rpc.AutoApprovalJudgeFailureReasonModelError - AutoApprovalJudgeFailureReasonParseError = rpc.AutoApprovalJudgeFailureReasonParseError - AutoApprovalJudgeFailureReasonTimeout = rpc.AutoApprovalJudgeFailureReasonTimeout - AutoApprovalRecommendationApprove = rpc.AutoApprovalRecommendationApprove - AutoApprovalRecommendationError = rpc.AutoApprovalRecommendationError - AutoApprovalRecommendationExcluded = rpc.AutoApprovalRecommendationExcluded - AutoApprovalRecommendationRequireApproval = rpc.AutoApprovalRecommendationRequireApproval AutoModeResolvedReasoningBucketHigh = rpc.AutoModeResolvedReasoningBucketHigh AutoModeResolvedReasoningBucketLow = rpc.AutoModeResolvedReasoningBucketLow AutoModeResolvedReasoningBucketMedium = rpc.AutoModeResolvedReasoningBucketMedium @@ -497,7 +497,7 @@ const ( ManagedSettingsEnforcedActionBypassPermissionsBlocked = rpc.ManagedSettingsEnforcedActionBypassPermissionsBlocked ManagedSettingsEnforcedEscalationAllowAll = rpc.ManagedSettingsEnforcedEscalationAllowAll ManagedSettingsEnforcedEscalationApproveAll = rpc.ManagedSettingsEnforcedEscalationApproveAll - ManagedSettingsEnforcedEscalationAutoApproval = rpc.ManagedSettingsEnforcedEscalationAutoApproval + ManagedSettingsEnforcedEscalationAssistedApproval = rpc.ManagedSettingsEnforcedEscalationAssistedApproval ManagedSettingsEnforcedEscalationUnrestrictedPaths = rpc.ManagedSettingsEnforcedEscalationUnrestrictedPaths ManagedSettingsEnforcedEscalationUnrestrictedURLs = rpc.ManagedSettingsEnforcedEscalationUnrestrictedURLs ManagedSettingsResolvedSourceClient = rpc.ManagedSettingsResolvedSourceClient @@ -557,9 +557,9 @@ const ( OmittedBinaryOmittedReasonTooLarge = rpc.OmittedBinaryOmittedReasonTooLarge OmittedBinaryTypeImage = rpc.OmittedBinaryTypeImage OmittedBinaryTypeResource = rpc.OmittedBinaryTypeResource - PermissionAllowAllModeAuto = rpc.PermissionAllowAllModeAuto - PermissionAllowAllModeOff = rpc.PermissionAllowAllModeOff - PermissionAllowAllModeOn = rpc.PermissionAllowAllModeOn + PermissionModeAllowAll = rpc.PermissionModeAllowAll + PermissionModeAssisted = rpc.PermissionModeAssisted + PermissionModeManual = rpc.PermissionModeManual PermissionPromptRequestKindCommands = rpc.PermissionPromptRequestKindCommands PermissionPromptRequestKindCustomTool = rpc.PermissionPromptRequestKindCustomTool PermissionPromptRequestKindExtensionEnvAccess = rpc.PermissionPromptRequestKindExtensionEnvAccess diff --git a/java/pom.xml b/java/pom.xml index 9f909300c5..df47ef1a45 100644 --- a/java/pom.xml +++ b/java/pom.xml @@ -63,7 +63,7 @@ DO NOT EDIT MANUALLY. Updated by the update-copilot-dependency workflow. --> - ^1.0.81-2 + ^1.0.81-4 true diff --git a/java/scripts/codegen/java.ts b/java/scripts/codegen/java.ts index f9e96f4148..785049afa1 100644 --- a/java/scripts/codegen/java.ts +++ b/java/scripts/codegen/java.ts @@ -167,7 +167,9 @@ function toCamelCase(name: string): string { } function toEnumConstant(value: string): string { - return value.toUpperCase().replace(/[-. /:]/g, "_").replace(/^_+/, "").replace(/_+/g, "_"); + const constant = value.toUpperCase().replace(/[^A-Z0-9]/g, "_").replace(/^_+/, "").replace(/_+/g, "_"); + if (constant.length === 0) return "_"; + return /^[0-9]/.test(constant) ? `_${constant}` : constant; } // ── Schema path resolution ─────────────────────────────────────────────────── diff --git a/java/scripts/codegen/package-lock.json b/java/scripts/codegen/package-lock.json index 17c12ba7d8..ae260cb1cf 100644 --- a/java/scripts/codegen/package-lock.json +++ b/java/scripts/codegen/package-lock.json @@ -6,7 +6,7 @@ "": { "name": "copilot-sdk-java-codegen", "dependencies": { - "@github/copilot": "^1.0.81-2", + "@github/copilot": "^1.0.81-4", "json-schema": "^0.4.0", "tsx": "^4.23.1" } @@ -428,9 +428,9 @@ } }, "node_modules/@github/copilot": { - "version": "1.0.81-2", - "resolved": "https://registry.npmjs.org/@github/copilot/-/copilot-1.0.81-2.tgz", - "integrity": "sha512-FeeCKM0Pcm1mwC6uJQ/nkI5Bc33xe10dn3rtvYl3+ZzyKtAS7I8IeGvGrA773bsAgiHiyfj+KEQQlqKsBCgtPQ==", + "version": "1.0.81-4", + "resolved": "https://registry.npmjs.org/@github/copilot/-/copilot-1.0.81-4.tgz", + "integrity": "sha512-XSHSlWqDhoajHMjRouZv0gqPfG3MVJvLFCoWToT8/fbQ7rmE9rB4w0sefzmh30CrQANCWd+uiIUOe9H3QL32WA==", "license": "SEE LICENSE IN LICENSE.md", "dependencies": { "detect-libc": "^2.1.2" @@ -439,20 +439,20 @@ "copilot": "npm-loader.js" }, "optionalDependencies": { - "@github/copilot-darwin-arm64": "1.0.81-2", - "@github/copilot-darwin-x64": "1.0.81-2", - "@github/copilot-linux-arm64": "1.0.81-2", - "@github/copilot-linux-x64": "1.0.81-2", - "@github/copilot-linuxmusl-arm64": "1.0.81-2", - "@github/copilot-linuxmusl-x64": "1.0.81-2", - "@github/copilot-win32-arm64": "1.0.81-2", - "@github/copilot-win32-x64": "1.0.81-2" + "@github/copilot-darwin-arm64": "1.0.81-4", + "@github/copilot-darwin-x64": "1.0.81-4", + "@github/copilot-linux-arm64": "1.0.81-4", + "@github/copilot-linux-x64": "1.0.81-4", + "@github/copilot-linuxmusl-arm64": "1.0.81-4", + "@github/copilot-linuxmusl-x64": "1.0.81-4", + "@github/copilot-win32-arm64": "1.0.81-4", + "@github/copilot-win32-x64": "1.0.81-4" } }, "node_modules/@github/copilot-darwin-arm64": { - "version": "1.0.81-2", - "resolved": "https://registry.npmjs.org/@github/copilot-darwin-arm64/-/copilot-darwin-arm64-1.0.81-2.tgz", - "integrity": "sha512-BS7LPiXvOYd8H4VoD7BCOJ/R+JGIO9JxFMYn/ICXGpL/405s8eX+QXj6GNtFIOAEXPWr0fBweIVi9ExrKMiimQ==", + "version": "1.0.81-4", + "resolved": "https://registry.npmjs.org/@github/copilot-darwin-arm64/-/copilot-darwin-arm64-1.0.81-4.tgz", + "integrity": "sha512-6XEOnrQdqdZ/tbhKU2D37tk0PGwKdNT5LGLvjjrWx+TDCFO/xZSu85+Rxl4AZP1SHKwWJRZdamDmETj4vn4VWQ==", "cpu": [ "arm64" ], @@ -466,9 +466,9 @@ } }, "node_modules/@github/copilot-darwin-x64": { - "version": "1.0.81-2", - "resolved": "https://registry.npmjs.org/@github/copilot-darwin-x64/-/copilot-darwin-x64-1.0.81-2.tgz", - "integrity": "sha512-geVSBY7KlT4je8Xct1DTiisWQmfvj2Mjf1kWim81bp9W4Z18MEsEGXFeHAeYE2ZSwhdfMZCJprDF66orrHJ92w==", + "version": "1.0.81-4", + "resolved": "https://registry.npmjs.org/@github/copilot-darwin-x64/-/copilot-darwin-x64-1.0.81-4.tgz", + "integrity": "sha512-o1ghvv7EUGO3CGbZyGyQJgu9mCFEyXq9FUUmvcxsBXxfjk7PR1CywK4cJVeZxac8LL//DQ/q42JzkaSfXU29Wg==", "cpu": [ "x64" ], @@ -482,9 +482,9 @@ } }, "node_modules/@github/copilot-linux-arm64": { - "version": "1.0.81-2", - "resolved": "https://registry.npmjs.org/@github/copilot-linux-arm64/-/copilot-linux-arm64-1.0.81-2.tgz", - "integrity": "sha512-uov9YOKlhyiaQfbgi6SzyAGjBLXegYRNJkgckG/7Xq/TbxF0Bmve3/lSuzve+p/EOnzPVwR1kGPDEuGU3g97Rw==", + "version": "1.0.81-4", + "resolved": "https://registry.npmjs.org/@github/copilot-linux-arm64/-/copilot-linux-arm64-1.0.81-4.tgz", + "integrity": "sha512-pHCwhBe+IVtliSxOEiwhS+GQXRvLuJxOQzdqAZYhbaEJKWeqWTw40LnhqaQFaGhOp1GAJF+6FodG/SfUZYAx5g==", "cpu": [ "arm64" ], @@ -498,9 +498,9 @@ } }, "node_modules/@github/copilot-linux-x64": { - "version": "1.0.81-2", - "resolved": "https://registry.npmjs.org/@github/copilot-linux-x64/-/copilot-linux-x64-1.0.81-2.tgz", - "integrity": "sha512-wsuXQDnMBdc0Q/hoO5+n+GaBPClzmgcxD2pVvM7i8JxgDAOm3NxHxGF9eYt1h5I+42/Y16t23n12PGARGupfAA==", + "version": "1.0.81-4", + "resolved": "https://registry.npmjs.org/@github/copilot-linux-x64/-/copilot-linux-x64-1.0.81-4.tgz", + "integrity": "sha512-icy4c4jfQzXNShlGptRiUPKpHUhGX9qBxc+118WBv3H68o38Pi//6UP/ZRq9PvcVrPwxbA9HkFASNwBiEzshdA==", "cpu": [ "x64" ], @@ -514,9 +514,9 @@ } }, "node_modules/@github/copilot-linuxmusl-arm64": { - "version": "1.0.81-2", - "resolved": "https://registry.npmjs.org/@github/copilot-linuxmusl-arm64/-/copilot-linuxmusl-arm64-1.0.81-2.tgz", - "integrity": "sha512-Wi0u31vhBqxajGqpjODhTEwzzqDnfS1mRhKJ/FflH5ieMKsS8YLVHiCUaZFNFZtN1FIFU0ixIQqgUXCvaBP+0Q==", + "version": "1.0.81-4", + "resolved": "https://registry.npmjs.org/@github/copilot-linuxmusl-arm64/-/copilot-linuxmusl-arm64-1.0.81-4.tgz", + "integrity": "sha512-k54g1q9Umz7eFGTpOqG5H1l1m2eNSs8jqFLuEpvGGdu7SU5g6Cz0aWq2VM27l+HcChyjp2dGenhQe/s7KxLSMw==", "cpu": [ "arm64" ], @@ -530,9 +530,9 @@ } }, "node_modules/@github/copilot-linuxmusl-x64": { - "version": "1.0.81-2", - "resolved": "https://registry.npmjs.org/@github/copilot-linuxmusl-x64/-/copilot-linuxmusl-x64-1.0.81-2.tgz", - "integrity": "sha512-wbb1+aM/jSTE3tDCqwiADe/aUqosGsPzQZIliG/CMsByT02nbwl0CMZGocnsYyDcoKragGmAHqHxgD6sWsJB1g==", + "version": "1.0.81-4", + "resolved": "https://registry.npmjs.org/@github/copilot-linuxmusl-x64/-/copilot-linuxmusl-x64-1.0.81-4.tgz", + "integrity": "sha512-ETjiiuMGDdO6ZdytQ3w8u7wvtkDQCLc0zSnZXXYWxnG4y9qLut8VHFoTJ+P07lBrHKXo7tZsJ6W0d1gOQTBnvw==", "cpu": [ "x64" ], @@ -546,9 +546,9 @@ } }, "node_modules/@github/copilot-win32-arm64": { - "version": "1.0.81-2", - "resolved": "https://registry.npmjs.org/@github/copilot-win32-arm64/-/copilot-win32-arm64-1.0.81-2.tgz", - "integrity": "sha512-gyONPnQf3Im0lTkC+1NW79P6p8A1F4Cs7dO3ruVBbtDG8SPFJXWNs4LkKIIN/laIa28xYQPraD+hdM/qLZ4E6w==", + "version": "1.0.81-4", + "resolved": "https://registry.npmjs.org/@github/copilot-win32-arm64/-/copilot-win32-arm64-1.0.81-4.tgz", + "integrity": "sha512-/Md1/LN56gORjyGwHXjZ6suY6om7NVL8+j9D/X/xb6Ar2acagyivL8Dm3tesgUMYLniLgn7dyEXPVYS/bqkpmQ==", "cpu": [ "arm64" ], @@ -562,9 +562,9 @@ } }, "node_modules/@github/copilot-win32-x64": { - "version": "1.0.81-2", - "resolved": "https://registry.npmjs.org/@github/copilot-win32-x64/-/copilot-win32-x64-1.0.81-2.tgz", - "integrity": "sha512-+EcwzwOmJvQ1t2HpDEe93hyMLzvQTUkINnfy/v7EIJu9i2i49m144DyHIafGPcwiEW+AzYpY+6aRqSnNwrGx7Q==", + "version": "1.0.81-4", + "resolved": "https://registry.npmjs.org/@github/copilot-win32-x64/-/copilot-win32-x64-1.0.81-4.tgz", + "integrity": "sha512-CrHbH0fRl2tlreKbDbm6+NmK/3HwMZR7BE86WTmYHJMXt3PcEWRtklU/fQuH0qjURtW4wX6PWrdmjcyVOkRJcA==", "cpu": [ "x64" ], diff --git a/java/scripts/codegen/package.json b/java/scripts/codegen/package.json index 71063b782f..d726548d0e 100644 --- a/java/scripts/codegen/package.json +++ b/java/scripts/codegen/package.json @@ -7,7 +7,7 @@ "generate:java": "tsx java.ts" }, "dependencies": { - "@github/copilot": "^1.0.81-2", + "@github/copilot": "^1.0.81-4", "json-schema": "^0.4.0", "tsx": "^4.23.1" } diff --git a/java/sdk/pom.xml b/java/sdk/pom.xml index 3988639287..f3bb516403 100644 --- a/java/sdk/pom.xml +++ b/java/sdk/pom.xml @@ -630,20 +630,11 @@ did not produce the multi-release output. Re-build on JDK 25+ and verify the 1 none **/AskUserTest.java @@ -680,12 +671,8 @@ did not produce the multi-release output. Re-build on JDK 25+ and verify the 1 none **/ErgonomicToolDefinitionIT.java diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/ManagedSettingsEnforcedEscalation.java b/java/sdk/src/generated/java/com/github/copilot/generated/ManagedSettingsEnforcedEscalation.java index cdeea72b4f..3b4f9917fc 100644 --- a/java/sdk/src/generated/java/com/github/copilot/generated/ManagedSettingsEnforcedEscalation.java +++ b/java/sdk/src/generated/java/com/github/copilot/generated/ManagedSettingsEnforcedEscalation.java @@ -20,8 +20,8 @@ public enum ManagedSettingsEnforcedEscalation { ALLOW_ALL("allow_all"), /** The {@code approve_all} variant. */ APPROVE_ALL("approve_all"), - /** The {@code auto_approval} variant. */ - AUTO_APPROVAL("auto_approval"), + /** The {@code assisted_approval} variant. */ + ASSISTED_APPROVAL("assisted_approval"), /** The {@code unrestricted_paths} variant. */ UNRESTRICTED_PATHS("unrestricted_paths"), /** The {@code unrestricted_urls} variant. */ diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/PermissionAllowAllMode.java b/java/sdk/src/generated/java/com/github/copilot/generated/PermissionMode.java similarity index 59% rename from java/sdk/src/generated/java/com/github/copilot/generated/PermissionAllowAllMode.java rename to java/sdk/src/generated/java/com/github/copilot/generated/PermissionMode.java index d05b936e6a..421ad76139 100644 --- a/java/sdk/src/generated/java/com/github/copilot/generated/PermissionAllowAllMode.java +++ b/java/sdk/src/generated/java/com/github/copilot/generated/PermissionMode.java @@ -10,28 +10,28 @@ import javax.annotation.processing.Generated; /** - * Allow-all mode for the session. + * Permission mode for the session. * * @since 1.0.0 */ @javax.annotation.processing.Generated("copilot-sdk-codegen") -public enum PermissionAllowAllMode { - /** The {@code off} variant. */ - OFF("off"), - /** The {@code on} variant. */ - ON("on"), - /** The {@code auto} variant. */ - AUTO("auto"); +public enum PermissionMode { + /** The {@code manual} variant. */ + MANUAL("manual"), + /** The {@code assisted} variant. */ + ASSISTED("assisted"), + /** The {@code allow-all} variant. */ + ALLOW_ALL("allow-all"); private final String value; - PermissionAllowAllMode(String value) { this.value = value; } + PermissionMode(String value) { this.value = value; } @com.fasterxml.jackson.annotation.JsonValue public String getValue() { return value; } @com.fasterxml.jackson.annotation.JsonCreator - public static PermissionAllowAllMode fromValue(String value) { - for (PermissionAllowAllMode v : values()) { + public static PermissionMode fromValue(String value) { + for (PermissionMode v : values()) { if (v.value.equals(value)) return v; } - throw new IllegalArgumentException("Unknown PermissionAllowAllMode value: " + value); + throw new IllegalArgumentException("Unknown PermissionMode value: " + value); } } diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/SessionPermissionsChangedEvent.java b/java/sdk/src/generated/java/com/github/copilot/generated/SessionPermissionsChangedEvent.java index c1f82f5af7..ef332617ac 100644 --- a/java/sdk/src/generated/java/com/github/copilot/generated/SessionPermissionsChangedEvent.java +++ b/java/sdk/src/generated/java/com/github/copilot/generated/SessionPermissionsChangedEvent.java @@ -13,7 +13,7 @@ import javax.annotation.processing.Generated; /** - * Session event "session.permissions_changed". Permissions change details carrying the aggregate allow-all transition. + * Session event "session.permissions_changed". Permission-mode transition details. * @since 1.0.0 */ @JsonIgnoreProperties(ignoreUnknown = true) @@ -34,14 +34,12 @@ public final class SessionPermissionsChangedEvent extends SessionEvent { @JsonIgnoreProperties(ignoreUnknown = true) @JsonInclude(JsonInclude.Include.NON_NULL) public record SessionPermissionsChangedEventData( - /** Aggregate allow-all flag before the change */ - @JsonProperty("previousAllowAllPermissions") Boolean previousAllowAllPermissions, - /** Aggregate allow-all flag after the change */ - @JsonProperty("allowAllPermissions") Boolean allowAllPermissions, - /** Allow-all mode before the change */ - @JsonProperty("previousAllowAllPermissionMode") PermissionAllowAllMode previousAllowAllPermissionMode, - /** Allow-all mode after the change */ - @JsonProperty("allowAllPermissionMode") PermissionAllowAllMode allowAllPermissionMode + /** Permission mode before the change */ + @JsonProperty("previousMode") PermissionMode previousMode, + /** Permission mode after the change */ + @JsonProperty("mode") PermissionMode mode, + /** Explicit LLM judge model override used by assisted mode; omitted when the provider default applies */ + @JsonProperty("assistedApprovalModel") String assistedApprovalModel ) { } } diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CardDigest.java b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CardDigest.java new file mode 100644 index 0000000000..f14f9abdfc --- /dev/null +++ b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CardDigest.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * 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. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record CardDigest( + /** Digest algorithm and canonical representation */ + @JsonProperty("algorithm") CardDigestAlgorithm algorithm, + /** SHA-256 digest of the RFC 8785 canonical UTF-8 bytes, encoded as exactly 64 lowercase hexadecimal characters. */ + @JsonProperty("value") String value +) { +} diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/PermissionsAllowAllMode.java b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CardDigestAlgorithm.java similarity index 59% rename from java/sdk/src/generated/java/com/github/copilot/generated/rpc/PermissionsAllowAllMode.java rename to java/sdk/src/generated/java/com/github/copilot/generated/rpc/CardDigestAlgorithm.java index db24a2bad1..83a691705b 100644 --- a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/PermissionsAllowAllMode.java +++ b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CardDigestAlgorithm.java @@ -10,28 +10,24 @@ import javax.annotation.processing.Generated; /** - * Current or requested allow-all mode. + * Canonical digest algorithm for a validated MCP card * * @since 1.0.0 */ @javax.annotation.processing.Generated("copilot-sdk-codegen") -public enum PermissionsAllowAllMode { - /** The {@code off} variant. */ - OFF("off"), - /** The {@code on} variant. */ - ON("on"), - /** The {@code auto} variant. */ - AUTO("auto"); +public enum CardDigestAlgorithm { + /** The {@code sha256-rfc8785} variant. */ + SHA256_RFC8785("sha256-rfc8785"); private final String value; - PermissionsAllowAllMode(String value) { this.value = value; } + CardDigestAlgorithm(String value) { this.value = value; } @com.fasterxml.jackson.annotation.JsonValue public String getValue() { return value; } @com.fasterxml.jackson.annotation.JsonCreator - public static PermissionsAllowAllMode fromValue(String value) { - for (PermissionsAllowAllMode v : values()) { + public static CardDigestAlgorithm fromValue(String value) { + for (CardDigestAlgorithm v : values()) { if (v.value.equals(value)) return v; } - throw new IllegalArgumentException("Unknown PermissionsAllowAllMode value: " + value); + throw new IllegalArgumentException("Unknown CardDigestAlgorithm value: " + value); } } diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogAuthenticationRequiredError.java b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogAuthenticationRequiredError.java new file mode 100644 index 0000000000..3433f0e977 --- /dev/null +++ b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogAuthenticationRequiredError.java @@ -0,0 +1,44 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * 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. + * + * @since 1.0.0 + */ +@JsonIgnoreProperties(ignoreUnknown = true) +@JsonInclude(JsonInclude.Include.NON_NULL) +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public final class CatalogAuthenticationRequiredError extends CatalogSearchResult { + + @JsonProperty("kind") + private final String kind = "authentication-required"; + + @Override + public String getKind() { return kind; } + + /** Why authentication failed. Only an expired credential justifies attempting a silent refresh; an absent or rejected credential requires sign-in. */ + @JsonProperty("reason") + private CatalogAuthenticationRequiredReason reason; + + /** Human-readable explanation, safe to surface. Never contains a credential or token, nor a query, URL, handle, or secret. */ + @JsonProperty("message") + private String message; + + public CatalogAuthenticationRequiredReason getReason() { return reason; } + public void setReason(CatalogAuthenticationRequiredReason reason) { this.reason = reason; } + + public String getMessage() { return message; } + public void setMessage(String message) { this.message = message; } +} diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogAuthenticationRequiredReason.java b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogAuthenticationRequiredReason.java new file mode 100644 index 0000000000..1c87593273 --- /dev/null +++ b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogAuthenticationRequiredReason.java @@ -0,0 +1,37 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Why the catalog authority did not accept the caller's identity + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum CatalogAuthenticationRequiredReason { + /** The {@code no-credential} variant. */ + NO_CREDENTIAL("no-credential"), + /** The {@code credential-expired} variant. */ + CREDENTIAL_EXPIRED("credential-expired"), + /** The {@code credential-rejected} variant. */ + CREDENTIAL_REJECTED("credential-rejected"); + + private final String value; + CatalogAuthenticationRequiredReason(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static CatalogAuthenticationRequiredReason fromValue(String value) { + for (CatalogAuthenticationRequiredReason v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown CatalogAuthenticationRequiredReason value: " + value); + } +} diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogCandidateKind.java b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogCandidateKind.java new file mode 100644 index 0000000000..e7316cf872 --- /dev/null +++ b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogCandidateKind.java @@ -0,0 +1,35 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * What kind of resource a catalog candidate describes + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum CatalogCandidateKind { + /** The {@code mcp-server} variant. */ + MCP_SERVER("mcp-server"), + /** The {@code ai-skill} variant. */ + AI_SKILL("ai-skill"); + + private final String value; + CatalogCandidateKind(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static CatalogCandidateKind fromValue(String value) { + for (CatalogCandidateKind v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown CatalogCandidateKind value: " + value); + } +} diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogCapability.java b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogCapability.java new file mode 100644 index 0000000000..bb1662ba27 --- /dev/null +++ b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogCapability.java @@ -0,0 +1,41 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * A wire feature a caller can require of the catalog surface, negotiated per request. A grant means the runtime understands the feature's contract, not that the deployment has enabled the operation; typed unavailable results report availability separately. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum CatalogCapability { + /** The {@code mcp-server-card} variant. */ + MCP_SERVER_CARD("mcp-server-card"), + /** The {@code legacy-mcp-server-card} variant. */ + LEGACY_MCP_SERVER_CARD("legacy-mcp-server-card"), + /** The {@code ai-skill-discovery} variant. */ + AI_SKILL_DISCOVERY("ai-skill-discovery"), + /** The {@code mcp-install-planning} variant. */ + MCP_INSTALL_PLANNING("mcp-install-planning"), + /** The {@code multiple-transport-choice} variant. */ + MULTIPLE_TRANSPORT_CHOICE("multiple-transport-choice"); + + private final String value; + CatalogCapability(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static CatalogCapability fromValue(String value) { + for (CatalogCapability v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown CatalogCapability value: " + value); + } +} diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogClientContract.java b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogClientContract.java new file mode 100644 index 0000000000..62cf8db22c --- /dev/null +++ b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogClientContract.java @@ -0,0 +1,30 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import javax.annotation.processing.Generated; + +/** + * The protocol version and capability set a caller requires, supplied on every catalog request so negotiation cannot be skipped by omission. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record 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. */ + @JsonProperty("protocolVersion") Long protocolVersion, + /** 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. */ + @JsonProperty("requiredCapabilities") List requiredCapabilities +) { +} diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogContractViolationError.java b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogContractViolationError.java new file mode 100644 index 0000000000..5951d75a5e --- /dev/null +++ b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogContractViolationError.java @@ -0,0 +1,44 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * 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. + * + * @since 1.0.0 + */ +@JsonIgnoreProperties(ignoreUnknown = true) +@JsonInclude(JsonInclude.Include.NON_NULL) +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public final class CatalogContractViolationError extends CatalogSearchResult { + + @JsonProperty("kind") + private final String kind = "contract-violation"; + + @Override + public String getKind() { return kind; } + + /** Which rule the response broke. */ + @JsonProperty("reason") + private CatalogContractViolationReason reason; + + /** Human-readable explanation, safe to surface. Never echoes response content, nor a query, URL, handle, or secret. */ + @JsonProperty("message") + private String message; + + public CatalogContractViolationReason getReason() { return reason; } + public void setReason(CatalogContractViolationReason reason) { this.reason = reason; } + + public String getMessage() { return message; } + public void setMessage(String message) { this.message = message; } +} diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogContractViolationReason.java b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogContractViolationReason.java new file mode 100644 index 0000000000..f289d67666 --- /dev/null +++ b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogContractViolationReason.java @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Which wire-contract rule an upstream response broke + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum CatalogContractViolationReason { + /** The {@code both-url-and-data} variant. */ + BOTH_URL_AND_DATA("both-url-and-data"), + /** The {@code neither-url-nor-data} variant. */ + NEITHER_URL_NOR_DATA("neither-url-nor-data"), + /** The {@code duplicate-identity} variant. */ + DUPLICATE_IDENTITY("duplicate-identity"), + /** The {@code unknown-media-type} variant. */ + UNKNOWN_MEDIA_TYPE("unknown-media-type"); + + private final String value; + CatalogContractViolationReason(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static CatalogContractViolationReason fromValue(String value) { + for (CatalogContractViolationReason v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown CatalogContractViolationReason value: " + value); + } +} diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogHandleRejectedError.java b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogHandleRejectedError.java new file mode 100644 index 0000000000..7469d6194d --- /dev/null +++ b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogHandleRejectedError.java @@ -0,0 +1,51 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * A presented handle was not accepted. Handles are runtime-instance scoped, TTL-bound, and single-use, so each way of failing is reported distinctly. + * + * @since 1.0.0 + */ +@JsonIgnoreProperties(ignoreUnknown = true) +@JsonInclude(JsonInclude.Include.NON_NULL) +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public final class CatalogHandleRejectedError extends McpPlanInstallResult { + + @JsonProperty("kind") + private final String kind = "handle-rejected"; + + @Override + public String getKind() { return kind; } + + /** Which kind of handle was presented. */ + @JsonProperty("handleType") + private CatalogHandleType handleType; + + /** Why the handle was rejected. */ + @JsonProperty("reason") + private CatalogHandleRejectionReason reason; + + /** Human-readable explanation, safe to surface. Never contains the handle itself, nor a query, URL, or secret. */ + @JsonProperty("message") + private String message; + + public CatalogHandleType getHandleType() { return handleType; } + public void setHandleType(CatalogHandleType handleType) { this.handleType = handleType; } + + public CatalogHandleRejectionReason getReason() { return reason; } + public void setReason(CatalogHandleRejectionReason reason) { this.reason = reason; } + + public String getMessage() { return message; } + public void setMessage(String message) { this.message = message; } +} diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogHandleRejectionReason.java b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogHandleRejectionReason.java new file mode 100644 index 0000000000..6db6b69365 --- /dev/null +++ b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogHandleRejectionReason.java @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Why a presented handle was rejected + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum CatalogHandleRejectionReason { + /** The {@code invalid} variant. */ + INVALID("invalid"), + /** The {@code stale} variant. */ + STALE("stale"), + /** The {@code replayed} variant. */ + REPLAYED("replayed"), + /** The {@code foreign} variant. */ + FOREIGN("foreign"); + + private final String value; + CatalogHandleRejectionReason(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static CatalogHandleRejectionReason fromValue(String value) { + for (CatalogHandleRejectionReason v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown CatalogHandleRejectionReason value: " + value); + } +} diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogHandleType.java b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogHandleType.java new file mode 100644 index 0000000000..a14ceef85b --- /dev/null +++ b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogHandleType.java @@ -0,0 +1,35 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Which kind of opaque handle was presented + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum CatalogHandleType { + /** The {@code candidate} variant. */ + CANDIDATE("candidate"), + /** The {@code plan} variant. */ + PLAN("plan"); + + private final String value; + CatalogHandleType(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static CatalogHandleType fromValue(String value) { + for (CatalogHandleType v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown CatalogHandleType value: " + value); + } +} diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogInvalidRequestError.java b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogInvalidRequestError.java new file mode 100644 index 0000000000..0f9eb7e769 --- /dev/null +++ b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogInvalidRequestError.java @@ -0,0 +1,44 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * The request was rejected before any work was done, because a bounded field fell outside its permitted range or a required field was unusable. + * + * @since 1.0.0 + */ +@JsonIgnoreProperties(ignoreUnknown = true) +@JsonInclude(JsonInclude.Include.NON_NULL) +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public final class CatalogInvalidRequestError extends CatalogSearchResult { + + @JsonProperty("kind") + private final String kind = "invalid-request"; + + @Override + public String getKind() { return kind; } + + /** Which request field was rejected. */ + @JsonProperty("field") + private CatalogInvalidRequestField field; + + /** Human-readable explanation, safe to surface. Never echoes the offending value, nor a query, URL, handle, or secret. */ + @JsonProperty("message") + private String message; + + public CatalogInvalidRequestField getField() { return field; } + public void setField(CatalogInvalidRequestField field) { this.field = field; } + + public String getMessage() { return message; } + public void setMessage(String message) { this.message = message; } +} diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogInvalidRequestField.java b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogInvalidRequestField.java new file mode 100644 index 0000000000..b930640163 --- /dev/null +++ b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogInvalidRequestField.java @@ -0,0 +1,45 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Which request field was rejected before any work was done + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum CatalogInvalidRequestField { + /** The {@code query} variant. */ + QUERY("query"), + /** The {@code limit} variant. */ + LIMIT("limit"), + /** The {@code kinds} variant. */ + KINDS("kinds"), + /** The {@code contract} variant. */ + CONTRACT("contract"), + /** The {@code source} variant. */ + SOURCE("source"), + /** The {@code card} variant. */ + CARD("card"), + /** The {@code scope} variant. */ + SCOPE("scope"); + + private final String value; + CatalogInvalidRequestField(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static CatalogInvalidRequestField fromValue(String value) { + for (CatalogInvalidRequestField v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown CatalogInvalidRequestField value: " + value); + } +} diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogMalformedCardError.java b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogMalformedCardError.java new file mode 100644 index 0000000000..24cb5cae13 --- /dev/null +++ b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogMalformedCardError.java @@ -0,0 +1,51 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * A card could not be parsed or did not satisfy its declared media type's schema. + * + * @since 1.0.0 + */ +@JsonIgnoreProperties(ignoreUnknown = true) +@JsonInclude(JsonInclude.Include.NON_NULL) +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public final class CatalogMalformedCardError extends CatalogSearchResult { + + @JsonProperty("kind") + private final String kind = "malformed-card"; + + @Override + public String getKind() { return kind; } + + /** How the card failed validation. */ + @JsonProperty("reason") + private CatalogMalformedCardReason reason; + + /** Media type the card was interpreted as, when it declared one this runtime recognises. */ + @JsonProperty("mediaType") + private CatalogMediaType mediaType; + + /** Human-readable explanation, safe to surface. Never echoes card content, nor a query, URL, handle, or secret. */ + @JsonProperty("message") + private String message; + + public CatalogMalformedCardReason getReason() { return reason; } + public void setReason(CatalogMalformedCardReason reason) { this.reason = reason; } + + public CatalogMediaType getMediaType() { return mediaType; } + public void setMediaType(CatalogMediaType mediaType) { this.mediaType = mediaType; } + + public String getMessage() { return message; } + public void setMessage(String message) { this.message = message; } +} diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogMalformedCardReason.java b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogMalformedCardReason.java new file mode 100644 index 0000000000..17c1a05407 --- /dev/null +++ b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogMalformedCardReason.java @@ -0,0 +1,41 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * How a card failed validation + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum CatalogMalformedCardReason { + /** The {@code invalid-json} variant. */ + INVALID_JSON("invalid-json"), + /** The {@code schema-violation} variant. */ + SCHEMA_VIOLATION("schema-violation"), + /** The {@code unsupported-media-type} variant. */ + UNSUPPORTED_MEDIA_TYPE("unsupported-media-type"), + /** The {@code missing-required-field} variant. */ + MISSING_REQUIRED_FIELD("missing-required-field"), + /** The {@code size-limit-exceeded} variant. */ + SIZE_LIMIT_EXCEEDED("size-limit-exceeded"); + + private final String value; + CatalogMalformedCardReason(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static CatalogMalformedCardReason fromValue(String value) { + for (CatalogMalformedCardReason v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown CatalogMalformedCardReason value: " + value); + } +} diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogMediaType.java b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogMediaType.java new file mode 100644 index 0000000000..1528b052ee --- /dev/null +++ b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogMediaType.java @@ -0,0 +1,37 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Media type a catalog card is interpreted as + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum CatalogMediaType { + /** The {@code application/mcp-server-card+json} variant. */ + APPLICATION_MCP_SERVER_CARD_JSON("application/mcp-server-card+json"), + /** The {@code application/mcp-server+json} variant. */ + APPLICATION_MCP_SERVER_JSON("application/mcp-server+json"), + /** The {@code application/ai-skill} variant. */ + APPLICATION_AI_SKILL("application/ai-skill"); + + private final String value; + CatalogMediaType(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static CatalogMediaType fromValue(String value) { + for (CatalogMediaType v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown CatalogMediaType value: " + value); + } +} diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogNegotiatedContract.java b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogNegotiatedContract.java new file mode 100644 index 0000000000..379525fc28 --- /dev/null +++ b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogNegotiatedContract.java @@ -0,0 +1,30 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import javax.annotation.processing.Generated; + +/** + * The protocol version and capability set the runtime actually honoured for a successful catalog operation. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record CatalogNegotiatedContract( + /** Protocol version of the runtime that served the request. */ + @JsonProperty("runtimeProtocolVersion") Long runtimeProtocolVersion, + /** 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. */ + @JsonProperty("grantedCapabilities") List grantedCapabilities +) { +} diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogNegotiationRefusedError.java b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogNegotiationRefusedError.java new file mode 100644 index 0000000000..56e20d3b4e --- /dev/null +++ b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogNegotiationRefusedError.java @@ -0,0 +1,73 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import javax.annotation.processing.Generated; + +/** + * The caller's protocol version or required capabilities cannot be honoured. Returned instead of a partial or ambiguous success. + * + * @since 1.0.0 + */ +@JsonIgnoreProperties(ignoreUnknown = true) +@JsonInclude(JsonInclude.Include.NON_NULL) +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public final class CatalogNegotiationRefusedError extends CatalogSearchResult { + + @JsonProperty("kind") + private final String kind = "negotiation-refused"; + + @Override + public String getKind() { return kind; } + + /** Whether the version or the capability set was the problem. */ + @JsonProperty("reason") + private CatalogNegotiationRefusedReason reason; + + /** Protocol version of the runtime that refused the request. */ + @JsonProperty("runtimeProtocolVersion") + private Long runtimeProtocolVersion; + + /** Lowest caller protocol version this runtime will serve. */ + @JsonProperty("minimumSupportedProtocolVersion") + private Long minimumSupportedProtocolVersion; + + /** 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. */ + @JsonProperty("supportedCapabilities") + private List supportedCapabilities; + + /** The subset of the caller's bounded extensible capability identifiers this runtime cannot honour. */ + @JsonProperty("unsupportedCapabilities") + private List unsupportedCapabilities; + + /** Human-readable explanation, safe to surface. Never contains a query, URL, handle, or secret. */ + @JsonProperty("message") + private String message; + + public CatalogNegotiationRefusedReason getReason() { return reason; } + public void setReason(CatalogNegotiationRefusedReason reason) { this.reason = reason; } + + public Long getRuntimeProtocolVersion() { return runtimeProtocolVersion; } + public void setRuntimeProtocolVersion(Long runtimeProtocolVersion) { this.runtimeProtocolVersion = runtimeProtocolVersion; } + + public Long getMinimumSupportedProtocolVersion() { return minimumSupportedProtocolVersion; } + public void setMinimumSupportedProtocolVersion(Long minimumSupportedProtocolVersion) { this.minimumSupportedProtocolVersion = minimumSupportedProtocolVersion; } + + public List getSupportedCapabilities() { return supportedCapabilities; } + public void setSupportedCapabilities(List supportedCapabilities) { this.supportedCapabilities = supportedCapabilities; } + + public List getUnsupportedCapabilities() { return unsupportedCapabilities; } + public void setUnsupportedCapabilities(List unsupportedCapabilities) { this.unsupportedCapabilities = unsupportedCapabilities; } + + public String getMessage() { return message; } + public void setMessage(String message) { this.message = message; } +} diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogNegotiationRefusedReason.java b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogNegotiationRefusedReason.java new file mode 100644 index 0000000000..ee86246b4a --- /dev/null +++ b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogNegotiationRefusedReason.java @@ -0,0 +1,35 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Why capability and protocol-version negotiation refused a caller + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum CatalogNegotiationRefusedReason { + /** The {@code unsupported-protocol-version} variant. */ + UNSUPPORTED_PROTOCOL_VERSION("unsupported-protocol-version"), + /** The {@code unsupported-capability} variant. */ + UNSUPPORTED_CAPABILITY("unsupported-capability"); + + private final String value; + CatalogNegotiationRefusedReason(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static CatalogNegotiationRefusedReason fromValue(String value) { + for (CatalogNegotiationRefusedReason v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown CatalogNegotiationRefusedReason value: " + value); + } +} diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogNetworkFailureError.java b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogNetworkFailureError.java new file mode 100644 index 0000000000..d4afb32c3d --- /dev/null +++ b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogNetworkFailureError.java @@ -0,0 +1,51 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * The runtime could not reach the catalog authority or retrieve a card. Covers being offline as well as transport-level failure. + * + * @since 1.0.0 + */ +@JsonIgnoreProperties(ignoreUnknown = true) +@JsonInclude(JsonInclude.Include.NON_NULL) +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public final class CatalogNetworkFailureError extends CatalogSearchResult { + + @JsonProperty("kind") + private final String kind = "network-failure"; + + @Override + public String getKind() { return kind; } + + /** Categorised failure, low cardinality so it can be aggregated without carrying a URL. */ + @JsonProperty("reason") + private CatalogNetworkFailureReason reason; + + /** HTTP status code, when the failure was a rejected response. */ + @JsonProperty("statusCode") + private Long statusCode; + + /** Human-readable explanation, safe to surface. Never contains a query, URL, handle, or secret. */ + @JsonProperty("message") + private String message; + + public CatalogNetworkFailureReason getReason() { return reason; } + public void setReason(CatalogNetworkFailureReason reason) { this.reason = reason; } + + public Long getStatusCode() { return statusCode; } + public void setStatusCode(Long statusCode) { this.statusCode = statusCode; } + + public String getMessage() { return message; } + public void setMessage(String message) { this.message = message; } +} diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogNetworkFailureReason.java b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogNetworkFailureReason.java new file mode 100644 index 0000000000..c28d1cc4a7 --- /dev/null +++ b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogNetworkFailureReason.java @@ -0,0 +1,47 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Categorised network failure, low cardinality so it can be aggregated without carrying a URL + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum CatalogNetworkFailureReason { + /** The {@code offline} variant. */ + OFFLINE("offline"), + /** The {@code dns} variant. */ + DNS("dns"), + /** The {@code timeout} variant. */ + TIMEOUT("timeout"), + /** The {@code tls} variant. */ + TLS("tls"), + /** The {@code connection-refused} variant. */ + CONNECTION_REFUSED("connection-refused"), + /** The {@code http-status} variant. */ + HTTP_STATUS("http-status"), + /** The {@code response-too-large} variant. */ + RESPONSE_TOO_LARGE("response-too-large"), + /** The {@code redirect-rejected} variant. */ + REDIRECT_REJECTED("redirect-rejected"); + + private final String value; + CatalogNetworkFailureReason(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static CatalogNetworkFailureReason fromValue(String value) { + for (CatalogNetworkFailureReason v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown CatalogNetworkFailureReason value: " + value); + } +} diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogNotInstallableError.java b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogNotInstallableError.java new file mode 100644 index 0000000000..2ba3c84ec4 --- /dev/null +++ b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogNotInstallableError.java @@ -0,0 +1,44 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * The candidate is discoverable but cannot be installed. `application/ai-skill` resolves here, because it stays searchable while remaining typed non-installable. + * + * @since 1.0.0 + */ +@JsonIgnoreProperties(ignoreUnknown = true) +@JsonInclude(JsonInclude.Include.NON_NULL) +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public final class CatalogNotInstallableError extends McpPlanInstallResult { + + @JsonProperty("kind") + private final String kind = "not-installable"; + + @Override + public String getKind() { return kind; } + + /** Why the candidate cannot be installed. */ + @JsonProperty("reason") + private CatalogNotInstallableReason reason; + + /** Human-readable explanation, safe to surface. Never contains a query, URL, handle, or secret. */ + @JsonProperty("message") + private String message; + + public CatalogNotInstallableReason getReason() { return reason; } + public void setReason(CatalogNotInstallableReason reason) { this.reason = reason; } + + public String getMessage() { return message; } + public void setMessage(String message) { this.message = message; } +} diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogNotInstallableReason.java b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogNotInstallableReason.java new file mode 100644 index 0000000000..75abb619e2 --- /dev/null +++ b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogNotInstallableReason.java @@ -0,0 +1,37 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Why a discoverable candidate cannot be installed + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum CatalogNotInstallableReason { + /** The {@code kind-not-installable} variant. */ + KIND_NOT_INSTALLABLE("kind-not-installable"), + /** The {@code ai-skill-not-installable} variant. */ + AI_SKILL_NOT_INSTALLABLE("ai-skill-not-installable"), + /** The {@code policy-forbids} variant. */ + POLICY_FORBIDS("policy-forbids"); + + private final String value; + CatalogNotInstallableReason(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static CatalogNotInstallableReason fromValue(String value) { + for (CatalogNotInstallableReason v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown CatalogNotInstallableReason value: " + value); + } +} diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogPolicyRejectedError.java b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogPolicyRejectedError.java new file mode 100644 index 0000000000..56542ba46e --- /dev/null +++ b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogPolicyRejectedError.java @@ -0,0 +1,44 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Registry or enterprise policy refused the operation. + * + * @since 1.0.0 + */ +@JsonIgnoreProperties(ignoreUnknown = true) +@JsonInclude(JsonInclude.Include.NON_NULL) +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public final class CatalogPolicyRejectedError extends CatalogSearchResult { + + @JsonProperty("kind") + private final String kind = "policy-rejected"; + + @Override + public String getKind() { return kind; } + + /** Which authority produced the decision. */ + @JsonProperty("source") + private McpPlanPolicySource source; + + /** Human-readable explanation, safe to surface. Never contains a query, URL, handle, or secret. */ + @JsonProperty("message") + private String message; + + public McpPlanPolicySource getSource() { return source; } + public void setSource(McpPlanPolicySource source) { this.source = source; } + + public String getMessage() { return message; } + public void setMessage(String message) { this.message = message; } +} diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogSearchParams.java b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogSearchParams.java new file mode 100644 index 0000000000..ee5e703621 --- /dev/null +++ b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogSearchParams.java @@ -0,0 +1,37 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.github.copilot.CopilotExperimental; +import java.util.List; +import javax.annotation.processing.Generated; + +/** + * 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. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ +@CopilotExperimental +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record CatalogSearchParams( + /** Protocol version and capabilities the caller requires. */ + @JsonProperty("contract") CatalogClientContract contract, + /** Free-text search query. Never written to logs or telemetry. */ + @JsonProperty("query") String query, + /** Maximum number of candidates to return. Defaults to 10 when omitted. */ + @JsonProperty("limit") Long limit, + /** Restrict results to these candidate kinds. When omitted, every kind the runtime supports is searched. */ + @JsonProperty("kinds") List kinds +) { +} diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogSearchResult.java b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogSearchResult.java new file mode 100644 index 0000000000..4bfbf32701 --- /dev/null +++ b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogSearchResult.java @@ -0,0 +1,44 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import javax.annotation.processing.Generated; + +/** + * Outcome of a catalog.search call: either bounded inert candidates, or one typed refusal. Never a partial success. + * + * @since 1.0.0 + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "kind", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = CatalogSearchSucceeded.class, name = "succeeded"), + @JsonSubTypes.Type(value = CatalogNegotiationRefusedError.class, name = "negotiation-refused"), + @JsonSubTypes.Type(value = CatalogUnsupportedKindError.class, name = "unsupported-kind"), + @JsonSubTypes.Type(value = CatalogInvalidRequestError.class, name = "invalid-request"), + @JsonSubTypes.Type(value = CatalogAuthenticationRequiredError.class, name = "authentication-required"), + @JsonSubTypes.Type(value = CatalogPolicyRejectedError.class, name = "policy-rejected"), + @JsonSubTypes.Type(value = CatalogNetworkFailureError.class, name = "network-failure"), + @JsonSubTypes.Type(value = CatalogUnsafeRetrievalError.class, name = "unsafe-retrieval"), + @JsonSubTypes.Type(value = CatalogMalformedCardError.class, name = "malformed-card"), + @JsonSubTypes.Type(value = CatalogContractViolationError.class, name = "contract-violation"), + @JsonSubTypes.Type(value = CatalogUnavailableError.class, name = "unavailable") +}) +@JsonIgnoreProperties(ignoreUnknown = true) +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public abstract class CatalogSearchResult { + + /** + * Returns the discriminator value for this variant. + * + * @return the kind discriminator + */ + public abstract String getKind(); +} diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogSearchSucceeded.java b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogSearchSucceeded.java new file mode 100644 index 0000000000..8ecd11788a --- /dev/null +++ b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogSearchSucceeded.java @@ -0,0 +1,59 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import javax.annotation.processing.Generated; + +/** + * A completed catalog search: inert candidate summaries, each carrying a single-use handle. + * + * @since 1.0.0 + */ +@JsonIgnoreProperties(ignoreUnknown = true) +@JsonInclude(JsonInclude.Include.NON_NULL) +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public final class CatalogSearchSucceeded extends CatalogSearchResult { + + @JsonProperty("kind") + private final String kind = "succeeded"; + + @Override + public String getKind() { return kind; } + + /** 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. */ + @JsonProperty("searchId") + private String searchId; + + /** Matching candidates, never more than the requested limit. All text is inert untrusted data. */ + @JsonProperty("candidates") + private List candidates; + + /** Whether further matches existed beyond the requested limit. */ + @JsonProperty("truncated") + private Boolean truncated; + + /** Protocol version and capabilities the runtime honoured. */ + @JsonProperty("negotiated") + private CatalogNegotiatedContract negotiated; + + public String getSearchId() { return searchId; } + public void setSearchId(String searchId) { this.searchId = searchId; } + + public List getCandidates() { return candidates; } + public void setCandidates(List candidates) { this.candidates = candidates; } + + public Boolean getTruncated() { return truncated; } + public void setTruncated(Boolean truncated) { this.truncated = truncated; } + + public CatalogNegotiatedContract getNegotiated() { return negotiated; } + public void setNegotiated(CatalogNegotiatedContract negotiated) { this.negotiated = negotiated; } +} diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogUnavailableError.java b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogUnavailableError.java new file mode 100644 index 0000000000..7f21c57085 --- /dev/null +++ b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogUnavailableError.java @@ -0,0 +1,44 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * The operation is not available on this runtime. Distinct from a network failure: nothing was attempted. + * + * @since 1.0.0 + */ +@JsonIgnoreProperties(ignoreUnknown = true) +@JsonInclude(JsonInclude.Include.NON_NULL) +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public final class CatalogUnavailableError extends CatalogSearchResult { + + @JsonProperty("kind") + private final String kind = "unavailable"; + + @Override + public String getKind() { return kind; } + + /** Why the operation is unavailable. */ + @JsonProperty("reason") + private CatalogUnavailableReason reason; + + /** Human-readable explanation, safe to surface. Never contains a query, URL, handle, or secret. */ + @JsonProperty("message") + private String message; + + public CatalogUnavailableReason getReason() { return reason; } + public void setReason(CatalogUnavailableReason reason) { this.reason = reason; } + + public String getMessage() { return message; } + public void setMessage(String message) { this.message = message; } +} diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogUnavailableReason.java b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogUnavailableReason.java new file mode 100644 index 0000000000..c7bf4dcd76 --- /dev/null +++ b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogUnavailableReason.java @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Why a catalog operation is not available on this runtime + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum CatalogUnavailableReason { + /** The {@code search-unavailable} variant. */ + SEARCH_UNAVAILABLE("search-unavailable"), + /** The {@code planning-unavailable} variant. */ + PLANNING_UNAVAILABLE("planning-unavailable"), + /** The {@code authority-not-configured} variant. */ + AUTHORITY_NOT_CONFIGURED("authority-not-configured"), + /** The {@code disabled-by-policy} variant. */ + DISABLED_BY_POLICY("disabled-by-policy"); + + private final String value; + CatalogUnavailableReason(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static CatalogUnavailableReason fromValue(String value) { + for (CatalogUnavailableReason v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown CatalogUnavailableReason value: " + value); + } +} diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogUnavailableTransportError.java b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogUnavailableTransportError.java new file mode 100644 index 0000000000..3c40687eac --- /dev/null +++ b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogUnavailableTransportError.java @@ -0,0 +1,44 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * No transport this runtime can use is available for the requested server. + * + * @since 1.0.0 + */ +@JsonIgnoreProperties(ignoreUnknown = true) +@JsonInclude(JsonInclude.Include.NON_NULL) +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public final class CatalogUnavailableTransportError extends McpPlanInstallResult { + + @JsonProperty("kind") + private final String kind = "unavailable-transport"; + + @Override + public String getKind() { return kind; } + + /** Why no transport could be offered. */ + @JsonProperty("reason") + private CatalogUnavailableTransportReason reason; + + /** Human-readable explanation, safe to surface. Never contains a query, URL, handle, or secret. */ + @JsonProperty("message") + private String message; + + public CatalogUnavailableTransportReason getReason() { return reason; } + public void setReason(CatalogUnavailableTransportReason reason) { this.reason = reason; } + + public String getMessage() { return message; } + public void setMessage(String message) { this.message = message; } +} diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogUnavailableTransportReason.java b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogUnavailableTransportReason.java new file mode 100644 index 0000000000..d532967313 --- /dev/null +++ b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogUnavailableTransportReason.java @@ -0,0 +1,37 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Why no usable transport could be offered + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum CatalogUnavailableTransportReason { + /** The {@code no-eligible-transport} variant. */ + NO_ELIGIBLE_TRANSPORT("no-eligible-transport"), + /** The {@code transport-not-supported} variant. */ + TRANSPORT_NOT_SUPPORTED("transport-not-supported"), + /** The {@code remote-enumeration-unavailable} variant. */ + REMOTE_ENUMERATION_UNAVAILABLE("remote-enumeration-unavailable"); + + private final String value; + CatalogUnavailableTransportReason(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static CatalogUnavailableTransportReason fromValue(String value) { + for (CatalogUnavailableTransportReason v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown CatalogUnavailableTransportReason value: " + value); + } +} diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogUnsafeRetrievalError.java b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogUnsafeRetrievalError.java new file mode 100644 index 0000000000..513ce5b80f --- /dev/null +++ b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogUnsafeRetrievalError.java @@ -0,0 +1,44 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Retrieval was refused by the runtime's hardened fetch boundary before any request left the process, or before a redirect was followed. + * + * @since 1.0.0 + */ +@JsonIgnoreProperties(ignoreUnknown = true) +@JsonInclude(JsonInclude.Include.NON_NULL) +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public final class CatalogUnsafeRetrievalError extends CatalogSearchResult { + + @JsonProperty("kind") + private final String kind = "unsafe-retrieval"; + + @Override + public String getKind() { return kind; } + + /** Which control refused the retrieval, low cardinality so it can be aggregated without carrying a URL. */ + @JsonProperty("reason") + private CatalogUnsafeRetrievalReason reason; + + /** Human-readable explanation, safe to surface. Never contains the refused URL, nor a query, handle, or secret. */ + @JsonProperty("message") + private String message; + + public CatalogUnsafeRetrievalReason getReason() { return reason; } + public void setReason(CatalogUnsafeRetrievalReason reason) { this.reason = reason; } + + public String getMessage() { return message; } + public void setMessage(String message) { this.message = message; } +} diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogUnsafeRetrievalReason.java b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogUnsafeRetrievalReason.java new file mode 100644 index 0000000000..e05931dac1 --- /dev/null +++ b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogUnsafeRetrievalReason.java @@ -0,0 +1,43 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Which hardened-fetch control refused a retrieval + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum CatalogUnsafeRetrievalReason { + /** The {@code blocked-scheme} variant. */ + BLOCKED_SCHEME("blocked-scheme"), + /** The {@code credentials-in-url} variant. */ + CREDENTIALS_IN_URL("credentials-in-url"), + /** The {@code blocked-address} variant. */ + BLOCKED_ADDRESS("blocked-address"), + /** The {@code redirect-to-blocked-address} variant. */ + REDIRECT_TO_BLOCKED_ADDRESS("redirect-to-blocked-address"), + /** The {@code proxy-rejected} variant. */ + PROXY_REJECTED("proxy-rejected"), + /** The {@code host-not-permitted} variant. */ + HOST_NOT_PERMITTED("host-not-permitted"); + + private final String value; + CatalogUnsafeRetrievalReason(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static CatalogUnsafeRetrievalReason fromValue(String value) { + for (CatalogUnsafeRetrievalReason v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown CatalogUnsafeRetrievalReason value: " + value); + } +} diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogUnsupportedKindError.java b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogUnsupportedKindError.java new file mode 100644 index 0000000000..06cc7bc5a8 --- /dev/null +++ b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/CatalogUnsupportedKindError.java @@ -0,0 +1,52 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import javax.annotation.processing.Generated; + +/** + * The request asked for a candidate kind this runtime does not serve. + * + * @since 1.0.0 + */ +@JsonIgnoreProperties(ignoreUnknown = true) +@JsonInclude(JsonInclude.Include.NON_NULL) +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public final class CatalogUnsupportedKindError extends CatalogSearchResult { + + @JsonProperty("kind") + private final String kind = "unsupported-kind"; + + @Override + public String getKind() { return kind; } + + /** The kinds from the request that are not supported. */ + @JsonProperty("requestedKinds") + private List requestedKinds; + + /** Every candidate kind this runtime can serve. */ + @JsonProperty("supportedKinds") + private List supportedKinds; + + /** Human-readable explanation, safe to surface. Never contains a query, URL, handle, or secret. */ + @JsonProperty("message") + private String message; + + public List getRequestedKinds() { return requestedKinds; } + public void setRequestedKinds(List requestedKinds) { this.requestedKinds = requestedKinds; } + + public List getSupportedKinds() { return supportedKinds; } + public void setSupportedKinds(List supportedKinds) { this.supportedKinds = supportedKinds; } + + public String getMessage() { return message; } + public void setMessage(String message) { this.message = message; } +} diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/McpInstallPlan.java b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/McpInstallPlan.java new file mode 100644 index 0000000000..7274ce2b7f --- /dev/null +++ b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/McpInstallPlan.java @@ -0,0 +1,48 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import javax.annotation.processing.Generated; + +/** + * A normalised, inert description of what installing an MCP server would involve. Carries no raw card, no install specification, and no secret value. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record McpInstallPlan( + /** 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. */ + @JsonProperty("planHandle") String planHandle, + /** 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. */ + @JsonProperty("planHandleExpiresAt") String planHandleExpiresAt, + /** Normalised identity of the server the plan would install. */ + @JsonProperty("identity") McpPlanResourceIdentity identity, + /** Origin and semantic digest of the exact validated JSON MCP card content bound to this plan. */ + @JsonProperty("provenance") McpPlanProvenance provenance, + /** 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. */ + @JsonProperty("transportChoices") List transportChoices, + /** Identifier of the choice the runtime would pick by default. Omitted when there is no eligible transport, or when the runtime expresses no preference. */ + @JsonProperty("recommendedTransportChoiceId") String recommendedTransportChoiceId, + /** Configuration scope and key the plan would write to. */ + @JsonProperty("target") McpPlanTarget target, + /** Outcome of evaluating the server against registry and enterprise policy. */ + @JsonProperty("policy") McpPlanPolicyResult policy, + /** The configuration changes installing would make, described rather than serialised, so the mutable configuration payload stays behind the runtime boundary. */ + @JsonProperty("configurationChanges") List configurationChanges, + /** Whether applying this plan would require an MCP reload to take effect. Planning itself never reloads. */ + @JsonProperty("reloadRequired") Boolean reloadRequired, + /** Whether the plan cannot be applied without further input, because a required value has no default or a secret must be supplied. */ + @JsonProperty("requiresInteractiveConfiguration") Boolean requiresInteractiveConfiguration +) { +} diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/McpPlanConfigurationChange.java b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/McpPlanConfigurationChange.java new file mode 100644 index 0000000000..d419772111 --- /dev/null +++ b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/McpPlanConfigurationChange.java @@ -0,0 +1,36 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import javax.annotation.processing.Generated; + +/** + * One change applying the plan would make, described rather than serialised so the configuration payload stays behind the runtime boundary. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record McpPlanConfigurationChange( + /** Whether the change would create a new entry or modify an existing one. */ + @JsonProperty("operation") McpPlanConfigurationOperation operation, + /** Scope the change would be written to. */ + @JsonProperty("scope") McpPlanScope scope, + /** Configuration key the change applies to. */ + @JsonProperty("configKey") String configKey, + /** Names of the configuration fields the change would set, without their values. */ + @JsonProperty("changedFields") List changedFields, + /** Secret placeholders the written configuration would reference. The constrained placeholder type cannot carry a literal secret value. */ + @JsonProperty("secretReferences") List secretReferences +) { +} diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/McpPlanConfigurationOperation.java b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/McpPlanConfigurationOperation.java new file mode 100644 index 0000000000..a661db48ab --- /dev/null +++ b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/McpPlanConfigurationOperation.java @@ -0,0 +1,35 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Whether a planned configuration change would create or modify an entry + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum McpPlanConfigurationOperation { + /** The {@code add} variant. */ + ADD("add"), + /** The {@code update} variant. */ + UPDATE("update"); + + private final String value; + McpPlanConfigurationOperation(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static McpPlanConfigurationOperation fromValue(String value) { + for (McpPlanConfigurationOperation v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown McpPlanConfigurationOperation value: " + value); + } +} diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/McpPlanInstallParams.java b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/McpPlanInstallParams.java new file mode 100644 index 0000000000..7b182fe2d6 --- /dev/null +++ b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/McpPlanInstallParams.java @@ -0,0 +1,34 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.github.copilot.CopilotExperimental; +import javax.annotation.processing.Generated; + +/** + * A side-effect-free request for an MCP install plan. Computing a plan never writes configuration, stores a secret, or reloads MCP servers. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ +@CopilotExperimental +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record McpPlanInstallParams( + /** Protocol version and capabilities the caller requires. */ + @JsonProperty("contract") CatalogClientContract contract, + /** What to plan: either a candidate handle from a previous search, or a card supplied directly. */ + @JsonProperty("source") Object source, + /** Configuration scope the plan targets. Defaults to user scope when omitted. */ + @JsonProperty("scope") McpPlanScope scope +) { +} diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/McpPlanInstallPlanned.java b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/McpPlanInstallPlanned.java new file mode 100644 index 0000000000..571353a384 --- /dev/null +++ b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/McpPlanInstallPlanned.java @@ -0,0 +1,44 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * 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. + * + * @since 1.0.0 + */ +@JsonIgnoreProperties(ignoreUnknown = true) +@JsonInclude(JsonInclude.Include.NON_NULL) +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public final class McpPlanInstallPlanned extends McpPlanInstallResult { + + @JsonProperty("kind") + private final String kind = "planned"; + + @Override + public String getKind() { return kind; } + + /** The normalised plan. */ + @JsonProperty("plan") + private McpInstallPlan plan; + + /** Protocol version and capabilities the runtime honoured. */ + @JsonProperty("negotiated") + private CatalogNegotiatedContract negotiated; + + public McpInstallPlan getPlan() { return plan; } + public void setPlan(McpInstallPlan plan) { this.plan = plan; } + + public CatalogNegotiatedContract getNegotiated() { return negotiated; } + public void setNegotiated(CatalogNegotiatedContract negotiated) { this.negotiated = negotiated; } +} diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/McpPlanInstallResult.java b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/McpPlanInstallResult.java new file mode 100644 index 0000000000..d257703477 --- /dev/null +++ b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/McpPlanInstallResult.java @@ -0,0 +1,46 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import javax.annotation.processing.Generated; + +/** + * Outcome of an mcp.planInstall call: either a normalised plan, or one typed refusal. Nothing is written in either case. + * + * @since 1.0.0 + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "kind", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = McpPlanInstallPlanned.class, name = "planned"), + @JsonSubTypes.Type(value = CatalogNegotiationRefusedError.class, name = "negotiation-refused"), + @JsonSubTypes.Type(value = CatalogHandleRejectedError.class, name = "handle-rejected"), + @JsonSubTypes.Type(value = CatalogInvalidRequestError.class, name = "invalid-request"), + @JsonSubTypes.Type(value = CatalogAuthenticationRequiredError.class, name = "authentication-required"), + @JsonSubTypes.Type(value = CatalogPolicyRejectedError.class, name = "policy-rejected"), + @JsonSubTypes.Type(value = CatalogNetworkFailureError.class, name = "network-failure"), + @JsonSubTypes.Type(value = CatalogUnsafeRetrievalError.class, name = "unsafe-retrieval"), + @JsonSubTypes.Type(value = CatalogMalformedCardError.class, name = "malformed-card"), + @JsonSubTypes.Type(value = CatalogContractViolationError.class, name = "contract-violation"), + @JsonSubTypes.Type(value = CatalogUnavailableTransportError.class, name = "unavailable-transport"), + @JsonSubTypes.Type(value = CatalogNotInstallableError.class, name = "not-installable"), + @JsonSubTypes.Type(value = CatalogUnavailableError.class, name = "unavailable") +}) +@JsonIgnoreProperties(ignoreUnknown = true) +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public abstract class McpPlanInstallResult { + + /** + * Returns the discriminator value for this variant. + * + * @return the kind discriminator + */ + public abstract String getKind(); +} diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/McpPlanPolicyDecision.java b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/McpPlanPolicyDecision.java new file mode 100644 index 0000000000..be32c283a0 --- /dev/null +++ b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/McpPlanPolicyDecision.java @@ -0,0 +1,37 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * What policy decided for a planned server + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum McpPlanPolicyDecision { + /** The {@code allowed} variant. */ + ALLOWED("allowed"), + /** The {@code blocked} variant. */ + BLOCKED("blocked"), + /** The {@code requires-approval} variant. */ + REQUIRES_APPROVAL("requires-approval"); + + private final String value; + McpPlanPolicyDecision(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static McpPlanPolicyDecision fromValue(String value) { + for (McpPlanPolicyDecision v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown McpPlanPolicyDecision value: " + value); + } +} diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/McpPlanPolicyResult.java b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/McpPlanPolicyResult.java new file mode 100644 index 0000000000..ee8d2ff0c1 --- /dev/null +++ b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/McpPlanPolicyResult.java @@ -0,0 +1,31 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Outcome of evaluating the planned server against registry and enterprise policy. Evaluation is read-only. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record McpPlanPolicyResult( + /** What policy decided for this server. */ + @JsonProperty("decision") McpPlanPolicyDecision decision, + /** Which authority produced the decision. */ + @JsonProperty("source") McpPlanPolicySource source, + /** Human-readable explanation, safe to surface. Never contains a query, URL, handle, or secret. */ + @JsonProperty("reason") String reason +) { +} diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/McpPlanPolicySource.java b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/McpPlanPolicySource.java new file mode 100644 index 0000000000..f6c0498f3b --- /dev/null +++ b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/McpPlanPolicySource.java @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Which authority produced a policy decision + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum McpPlanPolicySource { + /** The {@code none} variant. */ + NONE("none"), + /** The {@code enterprise-allowlist} variant. */ + ENTERPRISE_ALLOWLIST("enterprise-allowlist"), + /** The {@code registry-policy} variant. */ + REGISTRY_POLICY("registry-policy"), + /** The {@code local-trust} variant. */ + LOCAL_TRUST("local-trust"); + + private final String value; + McpPlanPolicySource(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static McpPlanPolicySource fromValue(String value) { + for (McpPlanPolicySource v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown McpPlanPolicySource value: " + value); + } +} diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/McpPlanProvenance.java b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/McpPlanProvenance.java new file mode 100644 index 0000000000..5b7d6531d3 --- /dev/null +++ b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/McpPlanProvenance.java @@ -0,0 +1,33 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Provenance of the exact validated JSON MCP card content bound privately to a completed plan and its opaque handle. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record McpPlanProvenance( + /** Authority associated with the validated card, without path, query, or credentials. Inert untrusted data. */ + @JsonProperty("authority") String authority, + /** ISO 8601 timestamp at which the runtime completed strict parsing and schema validation of the card content. */ + @JsonProperty("validatedAt") String validatedAt, + /** Semantic digest of the exact validated JSON content bound to the plan handle. */ + @JsonProperty("cardDigest") CardDigest cardDigest, + /** JSON MCP media type the validated card was interpreted as. */ + @JsonProperty("mediaType") McpServerCardMediaType mediaType +) { +} diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/McpPlanResourceIdentity.java b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/McpPlanResourceIdentity.java new file mode 100644 index 0000000000..abe525c1dc --- /dev/null +++ b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/McpPlanResourceIdentity.java @@ -0,0 +1,33 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Normalised identity of the MCP server a plan targets, independent of how the card spelled it. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record McpPlanResourceIdentity( + /** Canonical, normalised name of the server, for example `io.github.owner/server`. */ + @JsonProperty("canonicalName") String canonicalName, + /** Local configuration key the server would be recorded under. */ + @JsonProperty("serverName") String serverName, + /** Version advertised by the card, when it declares one. */ + @JsonProperty("version") String version, + /** Registry identifier of the server, when it came from a registry. */ + @JsonProperty("registryId") String registryId +) { +} diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/McpPlanScope.java b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/McpPlanScope.java new file mode 100644 index 0000000000..41f5d72016 --- /dev/null +++ b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/McpPlanScope.java @@ -0,0 +1,33 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Configuration scope an MCP install plan targets + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum McpPlanScope { + /** The {@code user} variant. */ + USER("user"); + + private final String value; + McpPlanScope(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static McpPlanScope fromValue(String value) { + for (McpPlanScope v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown McpPlanScope value: " + value); + } +} diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/McpPlanTarget.java b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/McpPlanTarget.java new file mode 100644 index 0000000000..95362a4cca --- /dev/null +++ b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/McpPlanTarget.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Where a plan would be written. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record McpPlanTarget( + /** Configuration scope the plan targets. */ + @JsonProperty("scope") McpPlanScope scope, + /** Configuration key the server would be recorded under within that scope. */ + @JsonProperty("configKey") String configKey +) { +} diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/McpServerCardMediaType.java b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/McpServerCardMediaType.java new file mode 100644 index 0000000000..4258f7d4d4 --- /dev/null +++ b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/McpServerCardMediaType.java @@ -0,0 +1,35 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * JSON MCP card media type accepted for install planning + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum McpServerCardMediaType { + /** The {@code application/mcp-server-card+json} variant. */ + APPLICATION_MCP_SERVER_CARD_JSON("application/mcp-server-card+json"), + /** The {@code application/mcp-server+json} variant. */ + APPLICATION_MCP_SERVER_JSON("application/mcp-server+json"); + + private final String value; + McpServerCardMediaType(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static McpServerCardMediaType fromValue(String value) { + for (McpServerCardMediaType v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown McpServerCardMediaType value: " + value); + } +} diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/PermissionDecisionSource.java b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/PermissionDecisionSource.java index ee807b095f..56f5793c5e 100644 --- a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/PermissionDecisionSource.java +++ b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/PermissionDecisionSource.java @@ -16,8 +16,8 @@ */ @javax.annotation.processing.Generated("copilot-sdk-codegen") public enum PermissionDecisionSource { - /** The {@code judge_recommendation} variant. */ - JUDGE_RECOMMENDATION("judge_recommendation"), + /** The {@code assisted_approval} variant. */ + ASSISTED_APPROVAL("assisted_approval"), /** The {@code human_response} variant. */ HUMAN_RESPONSE("human_response"), /** The {@code host_policy} variant. */ diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/PermissionMode.java b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/PermissionMode.java new file mode 100644 index 0000000000..1f4ea9b6bc --- /dev/null +++ b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/PermissionMode.java @@ -0,0 +1,37 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Current or requested permission mode. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum PermissionMode { + /** The {@code manual} variant. */ + MANUAL("manual"), + /** The {@code assisted} variant. */ + ASSISTED("assisted"), + /** The {@code allow-all} variant. */ + ALLOW_ALL("allow-all"); + + private final String value; + PermissionMode(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static PermissionMode fromValue(String value) { + for (PermissionMode v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown PermissionMode value: " + value); + } +} diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/PermissionsSetAllowAllSource.java b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/PermissionModeSource.java similarity index 70% rename from java/sdk/src/generated/java/com/github/copilot/generated/rpc/PermissionsSetAllowAllSource.java rename to java/sdk/src/generated/java/com/github/copilot/generated/rpc/PermissionModeSource.java index a7ff9ae9aa..2174e7fc29 100644 --- a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/PermissionsSetAllowAllSource.java +++ b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/PermissionModeSource.java @@ -10,12 +10,12 @@ import javax.annotation.processing.Generated; /** - * Optional source for allow-all telemetry. Defaults to `rpc` when omitted for SDK callers. + * Optional source for permission-mode telemetry. Defaults to `rpc` when omitted for SDK callers. * * @since 1.0.0 */ @javax.annotation.processing.Generated("copilot-sdk-codegen") -public enum PermissionsSetAllowAllSource { +public enum PermissionModeSource { /** The {@code cli_flag} variant. */ CLI_FLAG("cli_flag"), /** The {@code slash_command} variant. */ @@ -26,14 +26,14 @@ public enum PermissionsSetAllowAllSource { RPC("rpc"); private final String value; - PermissionsSetAllowAllSource(String value) { this.value = value; } + PermissionModeSource(String value) { this.value = value; } @com.fasterxml.jackson.annotation.JsonValue public String getValue() { return value; } @com.fasterxml.jackson.annotation.JsonCreator - public static PermissionsSetAllowAllSource fromValue(String value) { - for (PermissionsSetAllowAllSource v : values()) { + public static PermissionModeSource fromValue(String value) { + for (PermissionModeSource v : values()) { if (v.value.equals(value)) return v; } - throw new IllegalArgumentException("Unknown PermissionsSetAllowAllSource value: " + value); + throw new IllegalArgumentException("Unknown PermissionModeSource value: " + value); } } diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/PlanSqlTodosRow.java b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/PlanSqlTodosRow.java index bee0a48546..56e0e3dfcc 100644 --- a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/PlanSqlTodosRow.java +++ b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/PlanSqlTodosRow.java @@ -28,6 +28,8 @@ public record PlanSqlTodosRow( /** Todo description. */ @JsonProperty("description") String description, /** Todo status. */ - @JsonProperty("status") String status + @JsonProperty("status") String status, + /** 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. */ + @JsonProperty("createdAt") String createdAt ) { } diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/ServerCatalogApi.java b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/ServerCatalogApi.java new file mode 100644 index 0000000000..9b320cbb39 --- /dev/null +++ b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/ServerCatalogApi.java @@ -0,0 +1,40 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.generated.rpc; + +import com.github.copilot.CopilotExperimental; +import java.util.concurrent.CompletableFuture; +import javax.annotation.processing.Generated; + +/** + * API methods for the {@code catalog} namespace. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public final class ServerCatalogApi { + + private final RpcCaller caller; + + /** @param caller the RPC transport function */ + ServerCatalogApi(RpcCaller caller) { + this.caller = caller; + } + + /** + * 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. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + @CopilotExperimental + public CompletableFuture search(CatalogSearchParams params) { + return caller.invoke("catalog.search", params, CatalogSearchResult.class); + } + +} diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/ServerMcpApi.java b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/ServerMcpApi.java index b29c27fa4c..88dd7621fd 100644 --- a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/ServerMcpApi.java +++ b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/ServerMcpApi.java @@ -41,4 +41,15 @@ public CompletableFuture discover(McpDiscoverParams params) { return caller.invoke("mcp.discover", params, McpDiscoverResult.class); } + /** + * A side-effect-free request for an MCP install plan. Computing a plan never writes configuration, stores a secret, or reloads MCP servers. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + @CopilotExperimental + public CompletableFuture planInstall(McpPlanInstallParams params) { + return caller.invoke("mcp.planInstall", params, McpPlanInstallResult.class); + } + } diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/ServerRpc.java b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/ServerRpc.java index 1307ece6b4..111cee2560 100644 --- a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/ServerRpc.java +++ b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/ServerRpc.java @@ -37,6 +37,8 @@ public final class ServerRpc { public final ServerMcpApi mcp; /** API methods for the {@code extensions} namespace. */ public final ServerExtensionsApi extensions; + /** API methods for the {@code catalog} namespace. */ + public final ServerCatalogApi catalog; /** API methods for the {@code plugins} namespace. */ public final ServerPluginsApi plugins; /** API methods for the {@code skills} namespace. */ @@ -75,6 +77,7 @@ public ServerRpc(RpcCaller caller) { this.secrets = new ServerSecretsApi(caller); this.mcp = new ServerMcpApi(caller); this.extensions = new ServerExtensionsApi(caller); + this.catalog = new ServerCatalogApi(caller); this.plugins = new ServerPluginsApi(caller); this.skills = new ServerSkillsApi(caller); this.agents = new ServerAgentsApi(caller); diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/SessionMcpApi.java b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/SessionMcpApi.java index 2f50a62125..ed66b7bc15 100644 --- a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/SessionMcpApi.java +++ b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/SessionMcpApi.java @@ -113,6 +113,17 @@ public CompletableFuture reload() { return caller.invoke("session.mcp.reload", java.util.Map.of("sessionId", this.sessionId), Void.class); } + /** + * Identifies the target session. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + @CopilotExperimental + public CompletableFuture moveLoadingToBackground() { + return caller.invoke("session.mcp.moveLoadingToBackground", java.util.Map.of("sessionId", this.sessionId), SessionMcpMoveLoadingToBackgroundResult.class); + } + /** * Opaque MCP reload configuration. *

diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/SessionPermissionsGetAllowAllResult.java b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/SessionMcpMoveLoadingToBackgroundParams.java similarity index 75% rename from java/sdk/src/generated/java/com/github/copilot/generated/rpc/SessionPermissionsGetAllowAllResult.java rename to java/sdk/src/generated/java/com/github/copilot/generated/rpc/SessionMcpMoveLoadingToBackgroundParams.java index 28d9915df2..9c3305c3bd 100644 --- a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/SessionPermissionsGetAllowAllResult.java +++ b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/SessionMcpMoveLoadingToBackgroundParams.java @@ -14,7 +14,7 @@ import javax.annotation.processing.Generated; /** - * Current allow-all permission mode. + * Identifies the target session. * * @apiNote This method is experimental and may change in a future version. * @since 1.0.0 @@ -23,10 +23,8 @@ @javax.annotation.processing.Generated("copilot-sdk-codegen") @JsonInclude(JsonInclude.Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) -public record SessionPermissionsGetAllowAllResult( - /** Whether full allow-all permissions are currently active */ - @JsonProperty("enabled") Boolean enabled, - /** Current allow-all mode */ - @JsonProperty("mode") PermissionsAllowAllMode mode +public record SessionMcpMoveLoadingToBackgroundParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId ) { } diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/SessionMcpMoveLoadingToBackgroundResult.java b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/SessionMcpMoveLoadingToBackgroundResult.java new file mode 100644 index 0000000000..8890481647 --- /dev/null +++ b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/SessionMcpMoveLoadingToBackgroundResult.java @@ -0,0 +1,30 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.github.copilot.CopilotExperimental; +import javax.annotation.processing.Generated; + +/** + * Result of moving in-flight MCP loading to the background. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ +@CopilotExperimental +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionMcpMoveLoadingToBackgroundResult( + /** 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. */ + @JsonProperty("movedToBackground") Boolean movedToBackground +) { +} diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/SessionPermissionsApi.java b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/SessionPermissionsApi.java index 25d2e36666..8b397f2d4d 100644 --- a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/SessionPermissionsApi.java +++ b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/SessionPermissionsApi.java @@ -103,7 +103,7 @@ public CompletableFuture setApproveAll(Se } /** - * Allow-all mode to apply for the session. + * Permission mode to apply for the session. *

* Note: the {@code sessionId} field in the params record is overridden * by the session-scoped wrapper; any value provided is ignored. @@ -112,10 +112,10 @@ public CompletableFuture setApproveAll(Se * @since 1.0.0 */ @CopilotExperimental - public CompletableFuture setAllowAll(SessionPermissionsSetAllowAllParams params) { + public CompletableFuture setMode(SessionPermissionsSetModeParams params) { com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); _p.put("sessionId", this.sessionId); - return caller.invoke("session.permissions.setAllowAll", _p, SessionPermissionsSetAllowAllResult.class); + return caller.invoke("session.permissions.setMode", _p, SessionPermissionsSetModeResult.class); } /** @@ -125,8 +125,8 @@ public CompletableFuture setAllowAll(Sessio * @since 1.0.0 */ @CopilotExperimental - public CompletableFuture getAllowAll() { - return caller.invoke("session.permissions.getAllowAll", java.util.Map.of("sessionId", this.sessionId), SessionPermissionsGetAllowAllResult.class); + public CompletableFuture getMode() { + return caller.invoke("session.permissions.getMode", java.util.Map.of("sessionId", this.sessionId), SessionPermissionsGetModeResult.class); } /** diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/SessionPermissionsGetAllowAllParams.java b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/SessionPermissionsGetModeParams.java similarity index 95% rename from java/sdk/src/generated/java/com/github/copilot/generated/rpc/SessionPermissionsGetAllowAllParams.java rename to java/sdk/src/generated/java/com/github/copilot/generated/rpc/SessionPermissionsGetModeParams.java index 761640a4fb..5d41d3c6a2 100644 --- a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/SessionPermissionsGetAllowAllParams.java +++ b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/SessionPermissionsGetModeParams.java @@ -23,7 +23,7 @@ @javax.annotation.processing.Generated("copilot-sdk-codegen") @JsonInclude(JsonInclude.Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) -public record SessionPermissionsGetAllowAllParams( +public record SessionPermissionsGetModeParams( /** Target session identifier */ @JsonProperty("sessionId") String sessionId ) { diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/SessionPermissionsGetModeResult.java b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/SessionPermissionsGetModeResult.java new file mode 100644 index 0000000000..1ccb45375c --- /dev/null +++ b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/SessionPermissionsGetModeResult.java @@ -0,0 +1,30 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.github.copilot.CopilotExperimental; +import javax.annotation.processing.Generated; + +/** + * Current permission mode. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ +@CopilotExperimental +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionPermissionsGetModeResult( + /** Current permission mode */ + @JsonProperty("mode") PermissionMode mode +) { +} diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/SessionPermissionsSetAllowAllParams.java b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/SessionPermissionsSetModeParams.java similarity index 50% rename from java/sdk/src/generated/java/com/github/copilot/generated/rpc/SessionPermissionsSetAllowAllParams.java rename to java/sdk/src/generated/java/com/github/copilot/generated/rpc/SessionPermissionsSetModeParams.java index f31646f766..712d460243 100644 --- a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/SessionPermissionsSetAllowAllParams.java +++ b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/SessionPermissionsSetModeParams.java @@ -14,7 +14,7 @@ import javax.annotation.processing.Generated; /** - * Allow-all mode to apply for the session. + * Permission mode to apply for the session. * * @apiNote This method is experimental and may change in a future version. * @since 1.0.0 @@ -23,16 +23,14 @@ @javax.annotation.processing.Generated("copilot-sdk-codegen") @JsonInclude(JsonInclude.Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) -public record SessionPermissionsSetAllowAllParams( +public record SessionPermissionsSetModeParams( /** Target session identifier */ @JsonProperty("sessionId") String sessionId, - /** Allow-all mode to apply. `on` enables full allow-all; `auto` enables advisory LLM auto-approval; `off` disables both. */ - @JsonProperty("mode") PermissionsAllowAllMode mode, - /** Legacy full allow-all toggle. Prefer `mode`; when `mode` is omitted, `enabled: true` is treated as `mode: "on"` and any other value is treated as `mode: "off"`. */ - @JsonProperty("enabled") Boolean enabled, - /** Optional model id for the `auto` mode auto-approval LLM judging. Only meaningful when `mode` is `auto`; ignored otherwise. When omitted, the session resolves a default judge model: `gpt-5.5` for CAPI sessions and the session's active model for BYOK sessions. */ - @JsonProperty("model") String model, - /** Optional source for allow-all telemetry. Defaults to `rpc` when omitted for SDK callers. */ - @JsonProperty("source") PermissionsSetAllowAllSource source + /** Permission mode to apply */ + @JsonProperty("mode") PermissionMode mode, + /** Optional judge model id for assisted mode. When omitted, the session resolves the provider default: `gpt-5.5` for CAPI sessions and the active session model for BYOK sessions. */ + @JsonProperty("assistedApprovalModel") String assistedApprovalModel, + /** Optional source for permission-mode telemetry. Defaults to `rpc` when omitted for SDK callers. */ + @JsonProperty("source") PermissionModeSource source ) { } diff --git a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/SessionPermissionsSetAllowAllResult.java b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/SessionPermissionsSetModeResult.java similarity index 73% rename from java/sdk/src/generated/java/com/github/copilot/generated/rpc/SessionPermissionsSetAllowAllResult.java rename to java/sdk/src/generated/java/com/github/copilot/generated/rpc/SessionPermissionsSetModeResult.java index 9b14d8f6ad..1ee34568ea 100644 --- a/java/sdk/src/generated/java/com/github/copilot/generated/rpc/SessionPermissionsSetAllowAllResult.java +++ b/java/sdk/src/generated/java/com/github/copilot/generated/rpc/SessionPermissionsSetModeResult.java @@ -14,7 +14,7 @@ import javax.annotation.processing.Generated; /** - * Indicates whether the operation succeeded and reports the post-mutation state. + * Indicates whether the requested permission mode was applied and reports the authoritative post-mutation mode. * * @apiNote This method is experimental and may change in a future version. * @since 1.0.0 @@ -23,12 +23,10 @@ @javax.annotation.processing.Generated("copilot-sdk-codegen") @JsonInclude(JsonInclude.Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) -public record SessionPermissionsSetAllowAllResult( +public record SessionPermissionsSetModeResult( /** Whether the operation succeeded */ @JsonProperty("success") Boolean success, - /** Authoritative full allow-all state after the mutation */ - @JsonProperty("enabled") Boolean enabled, - /** Authoritative allow-all mode after the mutation */ - @JsonProperty("mode") PermissionsAllowAllMode mode + /** Authoritative permission mode after the mutation */ + @JsonProperty("mode") PermissionMode mode ) { } diff --git a/nodejs/package-lock.json b/nodejs/package-lock.json index a3665c091f..3d51d6d238 100644 --- a/nodejs/package-lock.json +++ b/nodejs/package-lock.json @@ -9,7 +9,7 @@ "version": "0.0.0-dev", "license": "MIT", "dependencies": { - "@github/copilot": "^1.0.81-2", + "@github/copilot": "^1.0.81-4", "koffi": "^3.1.0", "vscode-jsonrpc": "^8.2.1", "zod": "^4.3.6" @@ -658,8 +658,8 @@ } }, "node_modules/@github/copilot": { - "version": "1.0.81-2", - "integrity": "sha512-FeeCKM0Pcm1mwC6uJQ/nkI5Bc33xe10dn3rtvYl3+ZzyKtAS7I8IeGvGrA773bsAgiHiyfj+KEQQlqKsBCgtPQ==", + "version": "1.0.81-4", + "integrity": "sha512-XSHSlWqDhoajHMjRouZv0gqPfG3MVJvLFCoWToT8/fbQ7rmE9rB4w0sefzmh30CrQANCWd+uiIUOe9H3QL32WA==", "license": "SEE LICENSE IN LICENSE.md", "dependencies": { "detect-libc": "^2.1.2" @@ -668,19 +668,19 @@ "copilot": "npm-loader.js" }, "optionalDependencies": { - "@github/copilot-darwin-arm64": "1.0.81-2", - "@github/copilot-darwin-x64": "1.0.81-2", - "@github/copilot-linux-arm64": "1.0.81-2", - "@github/copilot-linux-x64": "1.0.81-2", - "@github/copilot-linuxmusl-arm64": "1.0.81-2", - "@github/copilot-linuxmusl-x64": "1.0.81-2", - "@github/copilot-win32-arm64": "1.0.81-2", - "@github/copilot-win32-x64": "1.0.81-2" + "@github/copilot-darwin-arm64": "1.0.81-4", + "@github/copilot-darwin-x64": "1.0.81-4", + "@github/copilot-linux-arm64": "1.0.81-4", + "@github/copilot-linux-x64": "1.0.81-4", + "@github/copilot-linuxmusl-arm64": "1.0.81-4", + "@github/copilot-linuxmusl-x64": "1.0.81-4", + "@github/copilot-win32-arm64": "1.0.81-4", + "@github/copilot-win32-x64": "1.0.81-4" } }, "node_modules/@github/copilot-darwin-arm64": { - "version": "1.0.81-2", - "integrity": "sha512-BS7LPiXvOYd8H4VoD7BCOJ/R+JGIO9JxFMYn/ICXGpL/405s8eX+QXj6GNtFIOAEXPWr0fBweIVi9ExrKMiimQ==", + "version": "1.0.81-4", + "integrity": "sha512-6XEOnrQdqdZ/tbhKU2D37tk0PGwKdNT5LGLvjjrWx+TDCFO/xZSu85+Rxl4AZP1SHKwWJRZdamDmETj4vn4VWQ==", "cpu": [ "arm64" ], @@ -694,8 +694,8 @@ } }, "node_modules/@github/copilot-darwin-x64": { - "version": "1.0.81-2", - "integrity": "sha512-geVSBY7KlT4je8Xct1DTiisWQmfvj2Mjf1kWim81bp9W4Z18MEsEGXFeHAeYE2ZSwhdfMZCJprDF66orrHJ92w==", + "version": "1.0.81-4", + "integrity": "sha512-o1ghvv7EUGO3CGbZyGyQJgu9mCFEyXq9FUUmvcxsBXxfjk7PR1CywK4cJVeZxac8LL//DQ/q42JzkaSfXU29Wg==", "cpu": [ "x64" ], @@ -709,8 +709,8 @@ } }, "node_modules/@github/copilot-linux-arm64": { - "version": "1.0.81-2", - "integrity": "sha512-uov9YOKlhyiaQfbgi6SzyAGjBLXegYRNJkgckG/7Xq/TbxF0Bmve3/lSuzve+p/EOnzPVwR1kGPDEuGU3g97Rw==", + "version": "1.0.81-4", + "integrity": "sha512-pHCwhBe+IVtliSxOEiwhS+GQXRvLuJxOQzdqAZYhbaEJKWeqWTw40LnhqaQFaGhOp1GAJF+6FodG/SfUZYAx5g==", "cpu": [ "arm64" ], @@ -724,8 +724,8 @@ } }, "node_modules/@github/copilot-linux-x64": { - "version": "1.0.81-2", - "integrity": "sha512-wsuXQDnMBdc0Q/hoO5+n+GaBPClzmgcxD2pVvM7i8JxgDAOm3NxHxGF9eYt1h5I+42/Y16t23n12PGARGupfAA==", + "version": "1.0.81-4", + "integrity": "sha512-icy4c4jfQzXNShlGptRiUPKpHUhGX9qBxc+118WBv3H68o38Pi//6UP/ZRq9PvcVrPwxbA9HkFASNwBiEzshdA==", "cpu": [ "x64" ], @@ -739,8 +739,8 @@ } }, "node_modules/@github/copilot-linuxmusl-arm64": { - "version": "1.0.81-2", - "integrity": "sha512-Wi0u31vhBqxajGqpjODhTEwzzqDnfS1mRhKJ/FflH5ieMKsS8YLVHiCUaZFNFZtN1FIFU0ixIQqgUXCvaBP+0Q==", + "version": "1.0.81-4", + "integrity": "sha512-k54g1q9Umz7eFGTpOqG5H1l1m2eNSs8jqFLuEpvGGdu7SU5g6Cz0aWq2VM27l+HcChyjp2dGenhQe/s7KxLSMw==", "cpu": [ "arm64" ], @@ -754,8 +754,8 @@ } }, "node_modules/@github/copilot-linuxmusl-x64": { - "version": "1.0.81-2", - "integrity": "sha512-wbb1+aM/jSTE3tDCqwiADe/aUqosGsPzQZIliG/CMsByT02nbwl0CMZGocnsYyDcoKragGmAHqHxgD6sWsJB1g==", + "version": "1.0.81-4", + "integrity": "sha512-ETjiiuMGDdO6ZdytQ3w8u7wvtkDQCLc0zSnZXXYWxnG4y9qLut8VHFoTJ+P07lBrHKXo7tZsJ6W0d1gOQTBnvw==", "cpu": [ "x64" ], @@ -769,8 +769,8 @@ } }, "node_modules/@github/copilot-win32-arm64": { - "version": "1.0.81-2", - "integrity": "sha512-gyONPnQf3Im0lTkC+1NW79P6p8A1F4Cs7dO3ruVBbtDG8SPFJXWNs4LkKIIN/laIa28xYQPraD+hdM/qLZ4E6w==", + "version": "1.0.81-4", + "integrity": "sha512-/Md1/LN56gORjyGwHXjZ6suY6om7NVL8+j9D/X/xb6Ar2acagyivL8Dm3tesgUMYLniLgn7dyEXPVYS/bqkpmQ==", "cpu": [ "arm64" ], @@ -784,8 +784,8 @@ } }, "node_modules/@github/copilot-win32-x64": { - "version": "1.0.81-2", - "integrity": "sha512-+EcwzwOmJvQ1t2HpDEe93hyMLzvQTUkINnfy/v7EIJu9i2i49m144DyHIafGPcwiEW+AzYpY+6aRqSnNwrGx7Q==", + "version": "1.0.81-4", + "integrity": "sha512-CrHbH0fRl2tlreKbDbm6+NmK/3HwMZR7BE86WTmYHJMXt3PcEWRtklU/fQuH0qjURtW4wX6PWrdmjcyVOkRJcA==", "cpu": [ "x64" ], diff --git a/nodejs/package.json b/nodejs/package.json index 58e39bc618..304b6857b7 100644 --- a/nodejs/package.json +++ b/nodejs/package.json @@ -56,7 +56,7 @@ "author": "GitHub", "license": "MIT", "dependencies": { - "@github/copilot": "^1.0.81-2", + "@github/copilot": "^1.0.81-4", "koffi": "^3.1.0", "vscode-jsonrpc": "^8.2.1", "zod": "^4.3.6" diff --git a/nodejs/samples/package-lock.json b/nodejs/samples/package-lock.json index c82bd2fbdd..2f64e44aae 100644 --- a/nodejs/samples/package-lock.json +++ b/nodejs/samples/package-lock.json @@ -18,7 +18,7 @@ "version": "0.0.0-dev", "license": "MIT", "dependencies": { - "@github/copilot": "^1.0.81-2", + "@github/copilot": "^1.0.81-4", "koffi": "^3.1.0", "vscode-jsonrpc": "^8.2.1", "zod": "^4.3.6" diff --git a/nodejs/src/generated/rpc.ts b/nodejs/src/generated/rpc.ts index 2d2c6fd4aa..3e91ca8e06 100644 --- a/nodejs/src/generated/rpc.ts +++ b/nodejs/src/generated/rpc.ts @@ -5,7 +5,7 @@ import type { MessageConnection } from "vscode-jsonrpc/node.js"; -import type { AbortReason, Attachment, ContextTier, EmbeddedBlobResourceContents, EmbeddedTextResourceContents, McpOauthHttpResponse, McpOauthWWWAuthenticateParams, McpServerSource, McpServerStatus, ModelChangeSource, PermissionPromptRequest, PermissionRule, ReasoningSummary, SessionEvent, SessionLimitsConfig, SessionMode, ShutdownType, SkillSource, TaskCompleteData, TaskCompletionOutcome, UserToolSessionApproval, Verbosity } from "./session-events.js"; +import type { AbortReason, Attachment, ContextTier, EmbeddedBlobResourceContents, EmbeddedTextResourceContents, McpOauthHttpResponse, McpOauthWWWAuthenticateParams, McpServerSource, McpServerStatus, ModelChangeSource, PermissionMode, PermissionPromptRequest, PermissionRule, ReasoningSummary, SessionEvent, SessionLimitsConfig, SessionMode, ShutdownType, SkillSource, TaskCompleteData, TaskCompletionOutcome, UserToolSessionApproval, Verbosity } from "./session-events.js"; /** A value that can be represented losslessly on the SDK JSON wire. */ export type JsonValue = null | boolean | number | string | JsonValue[] | { [key: string]: JsonValue }; @@ -243,20 +243,6 @@ export type AgentRegistrySpawnValidationErrorField = | "model" /** The permissionMode parameter */ | "permissionMode"; -/** - * Current or requested allow-all mode. - * - * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema - * via the `definition` "PermissionsAllowAllMode". - */ -/** @experimental */ -export type PermissionsAllowAllMode = - /** Permission requests follow the normal approval flow. */ - | "off" - /** Tool, path, and URL permission requests are automatically approved. */ - | "on" - /** Permission requests follow the normal approval flow with an LLM advisory recommendation attached; clients may choose to auto-approve requests the judge evaluated as acceptable. */ - | "auto"; /** * Authentication type * @@ -327,6 +313,347 @@ export type CanvasJsonSchema = JsonValue; */ /** @experimental */ export type CanvasActionInvokeResult = JsonValue; +/** + * Canonical digest algorithm for a validated MCP card + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "CardDigestAlgorithm". + */ +/** @experimental */ +export type CardDigestAlgorithm = /** SHA-256 over RFC 8785 canonical JSON encoded as UTF-8. */ "sha256-rfc8785"; +/** + * SHA-256 digest encoded as exactly 64 lowercase hexadecimal characters. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "CardDigestValue". + */ +/** @experimental */ +export type CardDigestValue = string; +/** + * 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. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "CatalogCandidateSource". + */ +/** @experimental */ +export type CatalogCandidateSource = CatalogCandidateSourceUrl | CatalogCandidateSourceEmbedded; +/** + * Why the catalog authority did not accept the caller's identity + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "CatalogAuthenticationRequiredReason". + */ +/** @experimental */ +export type CatalogAuthenticationRequiredReason = + /** No credential was presented, so there is nothing to refresh and the caller must sign in. */ + | "no-credential" + /** A credential was presented and its lifetime has elapsed. A silent refresh is worth attempting before prompting anyone. */ + | "credential-expired" + /** A credential was presented and the authority refused it, for example because it was revoked, malformed, or issued for another audience. Refreshing the same rejected credential is not useful; the caller must sign in again. */ + | "credential-rejected"; +/** + * 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. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "CatalogCandidate". + */ +/** @experimental */ +export type CatalogCandidate = CatalogMcpServerCandidate | CatalogAiSkillCandidate; +/** + * JSON MCP card media type accepted for install planning + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "McpServerCardMediaType". + */ +/** @experimental */ +export type McpServerCardMediaType = + /** The current MCP server card media type. */ + | "application/mcp-server-card+json" + /** The legacy MCP server card media type, accepted for compatibility. */ + | "application/mcp-server+json"; +/** + * Whether an MCP server candidate can be planned for installation + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "CatalogMcpServerInstallability". + */ +/** @experimental */ +export type CatalogMcpServerInstallability = + /** An install plan can be computed for this MCP server candidate. */ + | "installable" + /** Policy forbids installing this MCP server candidate. */ + | "not-installable-policy"; +/** + * What kind of resource a catalog candidate describes + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "CatalogCandidateKind". + */ +/** @experimental */ +export type CatalogCandidateKind = + /** An MCP server, which can be planned for installation. */ + | "mcp-server" + /** An AI skill, which is discoverable but not installable through this surface. */ + | "ai-skill"; +/** + * A wire feature a caller can require of the catalog surface, negotiated per request. A grant means the runtime understands the feature's contract, not that the deployment has enabled the operation; typed unavailable results report availability separately. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "CatalogCapability". + */ +/** @experimental */ +export type CatalogCapability = + /** Understands the current `application/mcp-server-card+json` media type. */ + | "mcp-server-card" + /** Understands the legacy `application/mcp-server+json` media type. */ + | "legacy-mcp-server-card" + /** Understands `application/ai-skill` candidates as discovery-only and typed non-installable. */ + | "ai-skill-discovery" + /** Understands side-effect-free MCP install-plan requests, results, and plan handles; `planning-unavailable` separately reports that planning is not enabled. */ + | "mcp-install-planning" + /** Understands plans that enumerate every eligible transport rather than a single preferred one. */ + | "multiple-transport-choice"; +/** + * Bounded extensible wire-feature identifier. Known values are described by `CatalogCapability`; newer callers may send future identifiers so an older runtime can return a typed negotiation refusal instead of failing schema validation. Capability negotiation establishes contract understanding, while each operation's result separately reports runtime availability. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "CatalogCapabilityId". + */ +/** @experimental */ +export type CatalogCapabilityId = string; +/** + * Which wire-contract rule an upstream response broke + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "CatalogContractViolationReason". + */ +/** @experimental */ +export type CatalogContractViolationReason = + /** A result carried both a URL and embedded data, when exactly one is permitted. */ + | "both-url-and-data" + /** A result carried neither a URL nor embedded data, when exactly one is required. */ + | "neither-url-nor-data" + /** Two results claimed the same normalised identity. */ + | "duplicate-identity" + /** A result declared no media type, or one this contract does not model. */ + | "unknown-media-type"; +/** + * Which kind of opaque handle was presented + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "CatalogHandleType". + */ +/** @experimental */ +export type CatalogHandleType = + /** A search candidate handle. */ + | "candidate" + /** An install plan handle. */ + | "plan"; +/** + * Why a presented handle was rejected + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "CatalogHandleRejectionReason". + */ +/** @experimental */ +export type CatalogHandleRejectionReason = + /** The handle is unparseable, unknown, or was issued for a different operation. */ + | "invalid" + /** The handle's time to live has elapsed. */ + | "stale" + /** The handle has already been used, and handles are single-use. */ + | "replayed" + /** The handle was issued by a different runtime instance. */ + | "foreign"; +/** + * Which request field was rejected before any work was done + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "CatalogInvalidRequestField". + */ +/** @experimental */ +export type CatalogInvalidRequestField = + /** The search query was empty or longer than permitted. */ + | "query" + /** The requested result count fell outside its permitted range. */ + | "limit" + /** The requested candidate kinds were empty or contained a duplicate. */ + | "kinds" + /** The negotiation block was missing or malformed. */ + | "contract" + /** The plan source was missing or malformed. */ + | "source" + /** The supplied card was missing its media type, URL, or data. */ + | "card" + /** The requested configuration scope is not one this runtime writes. */ + | "scope"; +/** + * How a card failed validation + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "CatalogMalformedCardReason". + */ +/** @experimental */ +export type CatalogMalformedCardReason = + /** The document is not well-formed JSON. */ + | "invalid-json" + /** The document does not satisfy its media type's schema. */ + | "schema-violation" + /** The declared media type is not one this runtime understands. */ + | "unsupported-media-type" + /** A field the media type requires is absent. */ + | "missing-required-field" + /** The document exceeded the permitted size. */ + | "size-limit-exceeded"; +/** + * Media type a catalog card is interpreted as + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "CatalogMediaType". + */ +/** @experimental */ +export type CatalogMediaType = + /** The current MCP server card media type. */ + | "application/mcp-server-card+json" + /** The legacy MCP server card media type, accepted for compatibility. */ + | "application/mcp-server+json" + /** An AI skill card. Representable and searchable, but typed non-installable. */ + | "application/ai-skill"; +/** + * Why capability and protocol-version negotiation refused a caller + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "CatalogNegotiationRefusedReason". + */ +/** @experimental */ +export type CatalogNegotiationRefusedReason = + /** The caller's protocol version is below the lowest this runtime serves. */ + | "unsupported-protocol-version" + /** The caller requires at least one capability this runtime cannot honour. */ + | "unsupported-capability"; +/** + * Categorised network failure, low cardinality so it can be aggregated without carrying a URL + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "CatalogNetworkFailureReason". + */ +/** @experimental */ +export type CatalogNetworkFailureReason = + /** No network is available, so nothing was attempted. */ + | "offline" + /** The authority's name could not be resolved. */ + | "dns" + /** The request exceeded its time budget. */ + | "timeout" + /** The TLS handshake or certificate validation failed. */ + | "tls" + /** The connection was refused or reset. */ + | "connection-refused" + /** The authority returned a status the runtime treats as a failure. */ + | "http-status" + /** The response exceeded the permitted size. */ + | "response-too-large" + /** A redirect was refused by the runtime's redirect policy. */ + | "redirect-rejected"; +/** + * Why a discoverable candidate cannot be installed + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "CatalogNotInstallableReason". + */ +/** @experimental */ +export type CatalogNotInstallableReason = + /** This kind of resource is not installable through this surface. */ + | "kind-not-installable" + /** AI skills are discoverable but have no typed importer in this phase. */ + | "ai-skill-not-installable" + /** Policy forbids installing this candidate. */ + | "policy-forbids"; +/** + * Which authority produced a policy decision + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "McpPlanPolicySource". + */ +/** @experimental */ +export type McpPlanPolicySource = + /** No policy applied, so the server is permitted by default. */ + | "none" + /** An enterprise allowlist evaluated the server. */ + | "enterprise-allowlist" + /** The registry the card came from evaluated the server. */ + | "registry-policy" + /** Local trust settings evaluated the server. */ + | "local-trust"; +/** + * Outcome of a catalog.search call: either bounded inert candidates, or one typed refusal. Never a partial success. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "CatalogSearchResult". + */ +/** @experimental */ +export type CatalogSearchResult = + | CatalogSearchSucceeded + | CatalogNegotiationRefusedError + | CatalogUnsupportedKindError + | CatalogInvalidRequestError + | CatalogAuthenticationRequiredError + | CatalogPolicyRejectedError + | CatalogNetworkFailureError + | CatalogUnsafeRetrievalError + | CatalogMalformedCardError + | CatalogContractViolationError + | CatalogUnavailableError; +/** + * Which hardened-fetch control refused a retrieval + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "CatalogUnsafeRetrievalReason". + */ +/** @experimental */ +export type CatalogUnsafeRetrievalReason = + /** The URL used a scheme the runtime refuses to fetch. */ + | "blocked-scheme" + /** The URL embedded credentials. */ + | "credentials-in-url" + /** The URL resolved to a loopback, private, link-local, or cloud metadata address. */ + | "blocked-address" + /** A redirect target resolved to a blocked address. */ + | "redirect-to-blocked-address" + /** The configured proxy policy refused the request. */ + | "proxy-rejected" + /** The authority is not permitted for card retrieval. */ + | "host-not-permitted"; +/** + * Why a catalog operation is not available on this runtime + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "CatalogUnavailableReason". + */ +/** @experimental */ +export type CatalogUnavailableReason = + /** Bounded search is not wired up on this runtime build. */ + | "search-unavailable" + /** Install planning is not wired up on this runtime build. */ + | "planning-unavailable" + /** No catalog authority is configured for this runtime. */ + | "authority-not-configured" + /** The surface is disabled by policy on this runtime. */ + | "disabled-by-policy"; +/** + * Why no usable transport could be offered + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "CatalogUnavailableTransportReason". + */ +/** @experimental */ +export type CatalogUnavailableTransportReason = + /** The card advertises no transport this runtime can use. */ + | "no-eligible-transport" + /** Every advertised transport is of a kind this runtime does not implement. */ + | "transport-not-supported" + /** Eligible remotes could not be enumerated, so no explicit choice can be offered. */ + | "remote-enumeration-unavailable"; /** * Coarse command category for grouping and behavior: runtime built-in, skill-backed command, or SDK/client-owned command * @@ -1334,6 +1661,162 @@ export type McpHeadersHandlePendingHeadersRefreshRequest = */ kind: "none"; }; +/** + * 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. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "McpPlanTransportChoice". + */ +/** @experimental */ +export type McpPlanTransportChoice = McpPlanTransportChoicePackage | McpPlanTransportChoiceRemote; +/** + * Transport exposed by a locally launched package + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "McpPlanPackageTransport". + */ +/** @experimental */ +export type McpPlanPackageTransport = + /** A locally launched process spoken to over standard input and output. */ + "stdio"; +/** + * Discriminator for a package-backed transport choice + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "McpPlanPackageInstallMethod". + */ +/** @experimental */ +export type McpPlanPackageInstallMethod = /** Install and run a local package. */ "package"; +/** + * 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. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "McpPlanRequiredValue". + */ +/** @experimental */ +export type McpPlanRequiredValue = McpPlanRequiredValueScalar | McpPlanRequiredValueEnum; +/** + * Discriminator for a scalar required value + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "McpPlanRequiredValueScalarKind". + */ +/** @experimental */ +export type McpPlanRequiredValueScalarKind = /** The value uses one scalar type. */ "scalar"; +/** + * Where a required value is applied when the planned server is launched + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "McpPlanValueCategory". + */ +/** @experimental */ +export type McpPlanValueCategory = + /** Set as an environment variable on the launched process. */ + | "environment-variable" + /** Passed to the runtime that launches the package. */ + | "runtime-argument" + /** Passed to the packaged server itself. */ + | "package-argument" + /** Sent as a request header to a remote endpoint. */ + | "header" + /** Substituted into the remote endpoint URL. */ + | "url-variable"; +/** + * Scalar type a required value must conform to + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "McpPlanScalarValueType". + */ +/** @experimental */ +export type McpPlanScalarValueType = + /** Free text. */ + | "string" + /** A number. */ + | "number" + /** A boolean. */ + | "boolean" + /** A filesystem path. */ + | "path"; +/** + * Discriminator for an enumerated required value + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "McpPlanRequiredValueEnumKind". + */ +/** @experimental */ +export type McpPlanRequiredValueEnumKind = /** The value uses a fixed non-empty enumeration. */ "enum"; +/** + * Discriminator for an enumerated required value + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "McpPlanEnumValueType". + */ +/** @experimental */ +export type McpPlanEnumValueType = /** One of a fixed, non-empty set of permitted values. */ "enum"; +/** + * A runtime-assigned secret placeholder. The identifier is carried once, inside the placeholder, so it cannot contradict a separate secret-id field. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "McpPlanSecretReference". + */ +/** @experimental */ +export type McpPlanSecretReference = string; +/** + * Transport exposed by a remote endpoint + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "McpPlanRemoteTransport". + */ +/** @experimental */ +export type McpPlanRemoteTransport = + /** An HTTP endpoint. */ + | "http" + /** A streamable HTTP endpoint. */ + | "streamable-http" + /** A server-sent events endpoint. */ + | "sse"; +/** + * Discriminator for a remote-endpoint transport choice + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "McpPlanRemoteInstallMethod". + */ +/** @experimental */ +export type McpPlanRemoteInstallMethod = /** Connect to a remote endpoint. */ "remote"; +/** + * Configuration scope an MCP install plan targets + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "McpPlanScope". + */ +/** @experimental */ +export type McpPlanScope = /** The user's own MCP configuration. */ "user"; +/** + * What policy decided for a planned server + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "McpPlanPolicyDecision". + */ +/** @experimental */ +export type McpPlanPolicyDecision = + /** Policy permits the server. */ + | "allowed" + /** Policy forbids the server, so the plan cannot be applied. */ + | "blocked" + /** Policy permits the server only after an explicit approval. */ + | "requires-approval"; +/** + * Whether a planned configuration change would create or modify an entry + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "McpPlanConfigurationOperation". + */ +/** @experimental */ +export type McpPlanConfigurationOperation = + /** Creates a configuration entry that does not exist yet. */ + | "add" + /** Modifies a configuration entry that already exists. */ + | "update"; /** * Consumer allowed to call an MCP tool. * @@ -1446,6 +1929,75 @@ export type McpOauthProbeResult = */ status: "failed"; }; +/** + * What an install plan is computed from: a candidate handle from a previous search, or a card supplied directly. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "McpPlanInstallSource". + */ +/** @experimental */ +export type McpPlanInstallSource = McpPlanInstallSourceCandidate | McpPlanInstallSourceCard; +/** + * Discriminator for a candidate-backed install-plan source + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "McpPlanInstallSourceCandidateKind". + */ +/** @experimental */ +export type McpPlanInstallSourceCandidateKind = /** Plan from a candidate returned by catalog search. */ "candidate"; +/** + * Discriminator for a caller-supplied-card install-plan source + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "McpPlanInstallSourceCardKind". + */ +/** @experimental */ +export type McpPlanInstallSourceCardKind = /** Plan directly from a caller-supplied card. */ "card"; +/** + * 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. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "McpServerCardReference". + */ +/** @experimental */ +export type McpServerCardReference = McpServerCardUrl | McpServerCardEmbedded; +/** + * Discriminator for a URL-backed MCP server card + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "McpServerCardUrlKind". + */ +/** @experimental */ +export type McpServerCardUrlKind = /** Retrieve the card from its URL. */ "url"; +/** + * Discriminator for an embedded MCP server card + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "McpServerCardEmbeddedKind". + */ +/** @experimental */ +export type McpServerCardEmbeddedKind = /** Use the embedded card document. */ "embedded"; +/** + * Outcome of an mcp.planInstall call: either a normalised plan, or one typed refusal. Nothing is written in either case. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "McpPlanInstallResult". + */ +/** @experimental */ +export type McpPlanInstallResult = + | McpPlanInstallPlanned + | CatalogNegotiationRefusedError + | CatalogHandleRejectedError + | CatalogInvalidRequestError + | CatalogAuthenticationRequiredError + | CatalogPolicyRejectedError + | CatalogNetworkFailureError + | CatalogUnsafeRetrievalError + | CatalogMalformedCardError + | CatalogContractViolationError + | CatalogUnavailableTransportError + | CatalogNotInstallableError + | CatalogUnavailableError; /** * MCP server configuration (stdio, remote HTTP/SSE, or in-process) * @@ -1930,8 +2482,8 @@ export type PermissionDecisionOutcome = */ /** @experimental */ export type PermissionDecisionSource = - /** The response followed the auto-approval judge recommendation. */ - | "judge_recommendation" + /** The response followed the assisted-approval judge recommendation. */ + | "assisted_approval" /** A human supplied the response through an interactive prompt. */ | "human_response" /** The host applied a standing policy or override rather than a judge recommendation or human decision. */ @@ -1985,6 +2537,22 @@ export type PermissionLocationType = | "repo" /** The permission location is persisted at the working directory. */ | "dir"; +/** + * Optional source for permission-mode telemetry. Defaults to `rpc` when omitted for SDK callers. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "PermissionModeSource". + */ +/** @experimental */ +export type PermissionModeSource = + /** The mode was set from a CLI command-line flag. */ + | "cli_flag" + /** The mode was set by a slash command. */ + | "slash_command" + /** The mode was set by confirming autopilot behavior. */ + | "autopilot_confirmation" + /** The mode was set through an RPC caller. */ + | "rpc"; /** * Allowed values for the `PermissionsConfigureAdditionalContentExclusionPolicyScope` enumeration. * @@ -2013,10 +2581,10 @@ export type PermissionsModifyRulesScope = * Optional source for allow-all telemetry. Defaults to `rpc` when omitted for SDK callers. * * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema - * via the `definition` "PermissionsSetAllowAllSource". + * via the `definition` "PermissionsSetApproveAllSource". */ /** @experimental */ -export type PermissionsSetAllowAllSource = +export type PermissionsSetApproveAllSource = /** Allow-all was enabled from a CLI command-line flag. */ | "cli_flag" /** Allow-all was enabled by a slash command. */ @@ -2026,23 +2594,7 @@ export type PermissionsSetAllowAllSource = /** Allow-all was enabled through an RPC caller. */ | "rpc"; /** - * Optional source for allow-all telemetry. Defaults to `rpc` when omitted for SDK callers. - * - * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema - * via the `definition` "PermissionsSetApproveAllSource". - */ -/** @experimental */ -export type PermissionsSetApproveAllSource = - /** Allow-all was enabled from a CLI command-line flag. */ - | "cli_flag" - /** Allow-all was enabled by a slash command. */ - | "slash_command" - /** Allow-all was enabled by confirming autopilot behavior. */ - | "autopilot_confirmation" - /** Allow-all was enabled through an RPC caller. */ - | "rpc"; -/** - * Optional flags controlling which side effects the reload performs. + * Optional flags controlling which side effects the reload performs. * * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "PluginsReloadRequest". @@ -4254,38 +4806,6 @@ export interface AgentsGetDiscoveryPathsRequest { */ excludeHostAgents?: boolean; } -/** - * Indicates whether the operation succeeded and reports the post-mutation state. - * - * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema - * via the `definition` "AllowAllPermissionSetResult". - */ -/** @experimental */ -export interface AllowAllPermissionSetResult { - /** - * Whether the operation succeeded - */ - success: boolean; - /** - * Authoritative full allow-all state after the mutation - */ - enabled: boolean; - mode?: PermissionsAllowAllMode; -} -/** - * Current allow-all permission mode. - * - * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema - * via the `definition` "AllowAllPermissionState". - */ -/** @experimental */ -export interface AllowAllPermissionState { - /** - * Whether full allow-all permissions are currently active - */ - enabled: boolean; - mode?: PermissionsAllowAllMode; -} /** * Credential-free authentication identity safe to expose to hosts and user interfaces. * @@ -4754,91 +5274,605 @@ export interface CanvasProviderOpenRequest { */ sessionId: string; /** - * Owning provider identifier + * Owning provider identifier + */ + extensionId: string; + /** + * Provider-local canvas identifier + */ + canvasId: string; + /** + * Stable caller-supplied canvas instance identifier + */ + instanceId: string; + /** + * Canvas open input + */ + input?: JsonValue; + host?: CanvasHostContext; + session?: CanvasSessionContext; +} +/** + * Canvas open result returned by the provider. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "CanvasProviderOpenResult". + */ +/** @experimental */ +export interface CanvasProviderOpenResult { + /** + * URL for web-rendered canvases + */ + url?: string; + /** + * Provider-supplied title + */ + title?: string; + /** + * Provider-supplied status text + */ + status?: string; +} +/** + * Internal canvas provider registration parameters. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "CanvasProviderRegisterRequest". + */ +/** @experimental */ +export interface CanvasProviderRegisterRequest { + /** + * Connection identifier for callback routing + */ + connectionId: string; + /** + * Provider metadata supplied by the host + */ + info: JsonValue; + /** + * Canvas contributions supplied by the provider + */ + canvases: JsonValue[]; +} +/** + * Internal canvas provider unregistration parameters. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "CanvasProviderUnregisterRequest". + */ +/** @experimental */ +export interface CanvasProviderUnregisterRequest { + /** + * Connection identifier to unregister + */ + connectionId: string; +} +/** + * Options scoped to the built-in CAPI (Copilot API) provider. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "CapiSessionOptions". + */ +/** @experimental */ +export interface CapiSessionOptions { + /** + * 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. + */ + enableWebSocketResponses?: boolean; +} +/** + * 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. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "CardDigest". + */ +/** @experimental */ +export interface CardDigest { + algorithm: CardDigestAlgorithm; + value: CardDigestValue; +} +/** + * An inert AI skill catalog result. AI skills are discovery-only and cannot be represented as installable through this surface. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "CatalogAiSkillCandidate". + */ +/** @experimental */ +export interface CatalogAiSkillCandidate { + /** + * 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. + */ + handle: string; + /** + * ISO 8601 timestamp after which the handle is stale and will be rejected. + */ + handleExpiresAt: string; + /** + * Discriminator: this candidate describes an AI skill + */ + kind: "ai-skill"; + /** + * Media type of the underlying AI skill card + */ + mediaType: "application/ai-skill"; + /** + * AI skills are discovery-only and cannot be installed through this surface + */ + installability: "not-installable-kind"; + /** + * Display name taken verbatim from the card. Inert untrusted text. + */ + displayName: string; + /** + * Description taken verbatim from the card. Inert untrusted text. + */ + description?: string; + /** + * Publisher taken verbatim from the card. Inert untrusted text. + */ + publisher?: string; + source: CatalogCandidateSource; + provenance: CatalogAiSkillCandidateProvenance; +} +/** + * Candidate whose card is retrieved from a URL through the runtime's hardened fetch boundary. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "CatalogCandidateSourceUrl". + */ +/** @experimental */ +export interface CatalogCandidateSourceUrl { + /** + * Discriminator: the card is URL-backed, and carries no embedded data + */ + kind: "url"; + /** + * Card URL as advertised. Inert untrusted data: the runtime retrieves it only through its own hardened boundary, and it is never logged. + */ + url: string; +} +/** + * Candidate whose card reference arrived inline. The document and its content-derived properties stay behind the runtime boundary. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "CatalogCandidateSourceEmbedded". + */ +/** @experimental */ +export interface CatalogCandidateSourceEmbedded { + /** + * Discriminator: the card is embedded, and carries no URL + */ + kind: "embedded"; +} +/** + * 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. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "CatalogAiSkillCandidateProvenance". + */ +/** @experimental */ +export interface CatalogAiSkillCandidateProvenance { + /** + * Host of the catalog authority that advertised the reference, without path, query, or credentials. Inert untrusted data. + */ + authority: string; + /** + * ISO 8601 timestamp at which the runtime observed the catalog reference. This is not a retrieval or validation timestamp. + */ + observedAt: string; + /** + * Media type advertised for the referenced AI skill card + */ + mediaType: "application/ai-skill"; +} +/** + * 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. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "CatalogAuthenticationRequiredError". + */ +/** @experimental */ +export interface CatalogAuthenticationRequiredError { + /** + * Discriminator: the caller is not authenticated + */ + kind: "authentication-required"; + reason: CatalogAuthenticationRequiredReason; + /** + * Human-readable explanation, safe to surface. Never contains a credential or token, nor a query, URL, handle, or secret. + */ + message: string; +} +/** + * 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. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "CatalogMcpServerCandidate". + */ +/** @experimental */ +export interface CatalogMcpServerCandidate { + /** + * 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. + */ + handle: string; + /** + * ISO 8601 timestamp after which the handle is stale and will be rejected. + */ + handleExpiresAt: string; + /** + * Discriminator: this candidate describes an MCP server + */ + kind: "mcp-server"; + mediaType: McpServerCardMediaType; + installability: CatalogMcpServerInstallability; + /** + * Display name taken verbatim from the card. Inert untrusted text. + */ + displayName: string; + /** + * Description taken verbatim from the card. Inert untrusted text. + */ + description?: string; + /** + * Publisher taken verbatim from the card. Inert untrusted text. + */ + publisher?: string; + source: CatalogCandidateSource; + provenance: CatalogMcpServerCandidateProvenance; +} +/** + * 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. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "CatalogMcpServerCandidateProvenance". + */ +/** @experimental */ +export interface CatalogMcpServerCandidateProvenance { + /** + * Host of the catalog authority that advertised the reference, without path, query, or credentials. Inert untrusted data. + */ + authority: string; + /** + * ISO 8601 timestamp at which the runtime observed the catalog reference. This is not a retrieval or validation timestamp. + */ + observedAt: string; + mediaType: McpServerCardMediaType; +} +/** + * The protocol version and capability set a caller requires, supplied on every catalog request so negotiation cannot be skipped by omission. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "CatalogClientContract". + */ +/** @experimental */ +export interface 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. + */ + protocolVersion: number; + /** + * 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. + * + * @maxItems 32 + */ + requiredCapabilities: CatalogCapabilityId[]; +} +/** + * 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. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "CatalogContractViolationError". + */ +/** @experimental */ +export interface CatalogContractViolationError { + /** + * Discriminator: the upstream response broke the contract + */ + kind: "contract-violation"; + reason: CatalogContractViolationReason; + /** + * Human-readable explanation, safe to surface. Never echoes response content, nor a query, URL, handle, or secret. + */ + message: string; +} +/** + * A presented handle was not accepted. Handles are runtime-instance scoped, TTL-bound, and single-use, so each way of failing is reported distinctly. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "CatalogHandleRejectedError". + */ +/** @experimental */ +export interface CatalogHandleRejectedError { + /** + * Discriminator: a handle was rejected + */ + kind: "handle-rejected"; + handleType: CatalogHandleType; + reason: CatalogHandleRejectionReason; + /** + * Human-readable explanation, safe to surface. Never contains the handle itself, nor a query, URL, or secret. + */ + message: string; +} +/** + * The request was rejected before any work was done, because a bounded field fell outside its permitted range or a required field was unusable. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "CatalogInvalidRequestError". + */ +/** @experimental */ +export interface CatalogInvalidRequestError { + /** + * Discriminator: the request itself was invalid + */ + kind: "invalid-request"; + field: CatalogInvalidRequestField; + /** + * Human-readable explanation, safe to surface. Never echoes the offending value, nor a query, URL, handle, or secret. + */ + message: string; +} +/** + * A card could not be parsed or did not satisfy its declared media type's schema. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "CatalogMalformedCardError". + */ +/** @experimental */ +export interface CatalogMalformedCardError { + /** + * Discriminator: the card was malformed + */ + kind: "malformed-card"; + reason: CatalogMalformedCardReason; + mediaType?: CatalogMediaType; + /** + * Human-readable explanation, safe to surface. Never echoes card content, nor a query, URL, handle, or secret. + */ + message: string; +} +/** + * The protocol version and capability set the runtime actually honoured for a successful catalog operation. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "CatalogNegotiatedContract". + */ +/** @experimental */ +export interface CatalogNegotiatedContract { + /** + * Protocol version of the runtime that served the request. + */ + runtimeProtocolVersion: number; + /** + * 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. + */ + grantedCapabilities: CatalogCapability[]; +} +/** + * The caller's protocol version or required capabilities cannot be honoured. Returned instead of a partial or ambiguous success. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "CatalogNegotiationRefusedError". + */ +/** @experimental */ +export interface CatalogNegotiationRefusedError { + /** + * Discriminator: capability or protocol-version negotiation failed + */ + kind: "negotiation-refused"; + reason: CatalogNegotiationRefusedReason; + /** + * Protocol version of the runtime that refused the request. + */ + runtimeProtocolVersion: number; + /** + * Lowest caller protocol version this runtime will serve. + */ + minimumSupportedProtocolVersion: number; + /** + * 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. + */ + supportedCapabilities: CatalogCapability[]; + /** + * The subset of the caller's bounded extensible capability identifiers this runtime cannot honour. + * + * @maxItems 32 + */ + unsupportedCapabilities: CatalogCapabilityId[]; + /** + * Human-readable explanation, safe to surface. Never contains a query, URL, handle, or secret. + */ + message: string; +} +/** + * The runtime could not reach the catalog authority or retrieve a card. Covers being offline as well as transport-level failure. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "CatalogNetworkFailureError". + */ +/** @experimental */ +export interface CatalogNetworkFailureError { + /** + * Discriminator: the network operation failed + */ + kind: "network-failure"; + reason: CatalogNetworkFailureReason; + /** + * HTTP status code, when the failure was a rejected response. + */ + statusCode?: number; + /** + * Human-readable explanation, safe to surface. Never contains a query, URL, handle, or secret. + */ + message: string; +} +/** + * The candidate is discoverable but cannot be installed. `application/ai-skill` resolves here, because it stays searchable while remaining typed non-installable. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "CatalogNotInstallableError". + */ +/** @experimental */ +export interface CatalogNotInstallableError { + /** + * Discriminator: the candidate cannot be installed + */ + kind: "not-installable"; + reason: CatalogNotInstallableReason; + /** + * Human-readable explanation, safe to surface. Never contains a query, URL, handle, or secret. + */ + message: string; +} +/** + * Registry or enterprise policy refused the operation. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "CatalogPolicyRejectedError". + */ +/** @experimental */ +export interface CatalogPolicyRejectedError { + /** + * Discriminator: policy refused the operation + */ + kind: "policy-rejected"; + source: McpPlanPolicySource; + /** + * Human-readable explanation, safe to surface. Never contains a query, URL, handle, or secret. + */ + message: string; +} +/** + * 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. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "CatalogSearchRequest". + */ +/** @experimental */ +export interface CatalogSearchRequest { + contract: CatalogClientContract; + /** + * Free-text search query. Never written to logs or telemetry. + */ + query: string; + /** + * Maximum number of candidates to return. Defaults to 10 when omitted. + */ + limit?: number; + /** + * Restrict results to these candidate kinds. When omitted, every kind the runtime supports is searched. + * + * @minItems 1 + * @maxItems 2 + */ + kinds?: [CatalogCandidateKind] | [CatalogCandidateKind, CatalogCandidateKind]; +} +/** + * A completed catalog search: inert candidate summaries, each carrying a single-use handle. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "CatalogSearchSucceeded". + */ +/** @experimental */ +export interface CatalogSearchSucceeded { + /** + * Discriminator: the search completed */ - extensionId: string; + kind: "succeeded"; /** - * Provider-local canvas identifier + * 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. */ - canvasId: string; + searchId: string; /** - * Stable caller-supplied canvas instance identifier + * Matching candidates, never more than the requested limit. All text is inert untrusted data. + * + * @maxItems 50 */ - instanceId: string; + candidates: CatalogCandidate[]; /** - * Canvas open input + * Whether further matches existed beyond the requested limit. */ - input?: JsonValue; - host?: CanvasHostContext; - session?: CanvasSessionContext; + truncated: boolean; + negotiated: CatalogNegotiatedContract; } /** - * Canvas open result returned by the provider. + * The request asked for a candidate kind this runtime does not serve. * * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema - * via the `definition` "CanvasProviderOpenResult". + * via the `definition` "CatalogUnsupportedKindError". */ /** @experimental */ -export interface CanvasProviderOpenResult { +export interface CatalogUnsupportedKindError { /** - * URL for web-rendered canvases + * Discriminator: an unsupported candidate kind was requested */ - url?: string; + kind: "unsupported-kind"; /** - * Provider-supplied title + * The kinds from the request that are not supported. */ - title?: string; + requestedKinds: CatalogCandidateKind[]; /** - * Provider-supplied status text + * Every candidate kind this runtime can serve. */ - status?: string; + supportedKinds: CatalogCandidateKind[]; + /** + * Human-readable explanation, safe to surface. Never contains a query, URL, handle, or secret. + */ + message: string; } /** - * Internal canvas provider registration parameters. + * Retrieval was refused by the runtime's hardened fetch boundary before any request left the process, or before a redirect was followed. * * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema - * via the `definition` "CanvasProviderRegisterRequest". + * via the `definition` "CatalogUnsafeRetrievalError". */ /** @experimental */ -export interface CanvasProviderRegisterRequest { - /** - * Connection identifier for callback routing - */ - connectionId: string; +export interface CatalogUnsafeRetrievalError { /** - * Provider metadata supplied by the host + * Discriminator: retrieval was refused as unsafe */ - info: JsonValue; + kind: "unsafe-retrieval"; + reason: CatalogUnsafeRetrievalReason; /** - * Canvas contributions supplied by the provider + * Human-readable explanation, safe to surface. Never contains the refused URL, nor a query, handle, or secret. */ - canvases: JsonValue[]; + message: string; } /** - * Internal canvas provider unregistration parameters. + * The operation is not available on this runtime. Distinct from a network failure: nothing was attempted. * * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema - * via the `definition` "CanvasProviderUnregisterRequest". + * via the `definition` "CatalogUnavailableError". */ /** @experimental */ -export interface CanvasProviderUnregisterRequest { +export interface CatalogUnavailableError { /** - * Connection identifier to unregister + * Discriminator: the operation is not available */ - connectionId: string; + kind: "unavailable"; + reason: CatalogUnavailableReason; + /** + * Human-readable explanation, safe to surface. Never contains a query, URL, handle, or secret. + */ + message: string; } /** - * Options scoped to the built-in CAPI (Copilot API) provider. + * No transport this runtime can use is available for the requested server. * * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema - * via the `definition` "CapiSessionOptions". + * via the `definition` "CatalogUnavailableTransportError". */ /** @experimental */ -export interface CapiSessionOptions { +export interface CatalogUnavailableTransportError { /** - * 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. + * Discriminator: no usable transport is available */ - enableWebSocketResponses?: boolean; + kind: "unavailable-transport"; + reason: CatalogUnavailableTransportReason; + /** + * Human-readable explanation, safe to surface. Never contains a query, URL, handle, or secret. + */ + message: string; } /** * Slash commands available in the session, after applying any include/exclude filters. @@ -9123,192 +10157,486 @@ export interface McpDiscoverResult { /** @experimental */ export interface McpEnableRequest { /** - * Name of the MCP server to enable + * Name of the MCP server to enable + */ + serverName: string; +} +/** + * Identifiers and raw MCP CreateMessageRequest params used to run a sampling inference. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "McpExecuteSamplingParams". + */ +/** @experimental */ +export interface McpExecuteSamplingParams { + /** + * 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. + */ + requestId: string; + /** + * Name of the MCP server that initiated the sampling request + */ + serverName: string; + /** + * 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). + */ + mcpRequestId: JsonValue; + request: McpExecuteSamplingRequest; +} +/** + * 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. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "McpExecuteSamplingRequest". + */ +/** @experimental */ +export interface McpExecuteSamplingRequest { + [k: string]: unknown | undefined; +} +/** + * 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. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "McpExecuteSamplingResult". + */ +/** @experimental */ +export interface McpExecuteSamplingResult { + [k: string]: unknown | undefined; +} +/** + * MCP server whose connection attempt failed. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "McpFailedServer". + */ +/** @experimental */ +export interface McpFailedServer { + /** + * The config key of the server that failed to connect. + */ + name: string; + /** + * The captured connection failure detail. + */ + error?: string; +} +/** + * MCP server filtered by policy, with name, reason, and optional redacted reason. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "McpFilteredServer". + */ +/** @experimental */ +export interface McpFilteredServer { + /** + * Filtered server name + */ + name: string; + /** + * Human-readable filter reason + */ + reason: string; + /** + * PII-free filter reason + */ + redactedReason?: string; + /** + * @deprecated + * Deprecated. This field is no longer populated. + */ + enterpriseName?: string; +} +/** + * MCP headers refresh request id and the host response. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "McpHeadersHandlePendingHeadersRefreshRequestRequest". + */ +/** @experimental */ +export interface McpHeadersHandlePendingHeadersRefreshRequestRequest { + /** + * Headers refresh request identifier from mcp.headers_refresh_required + */ + requestId: string; + result: McpHeadersHandlePendingHeadersRefreshRequest; +} +/** + * Indicates whether the pending MCP headers refresh response was accepted. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "McpHeadersHandlePendingHeadersRefreshRequestResult". + */ +/** @experimental */ +export interface McpHeadersHandlePendingHeadersRefreshRequestResult { + /** + * Whether the response was accepted. False if the request was unknown, timed out, or already resolved. + */ + success: boolean; +} +/** + * Host-level state, omitted when no MCP host is initialized. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "McpHostState". + */ +/** @experimental */ +export interface McpHostState { + /** + * Whether third-party MCP servers are policy-enabled for this session. + */ + mcp3pEnabled: boolean; + /** + * Configured servers that are explicitly disabled. + */ + disabledServers: string[]; + /** + * Configured servers filtered out by MCP server policy. + */ + filteredServers: string[]; + /** + * Names of currently-connected MCP clients. + */ + clients: string[]; + /** + * Names of servers with in-flight connection attempts. + */ + pendingConnections: string[]; + /** + * Map of server name to recorded connection failure. + */ + failedServers: { + [k: string]: McpServerFailureInfo | undefined; + }; + /** + * Map of server name to recorded pending-auth state. + */ + needsAuthServers: { + [k: string]: McpServerNeedsAuthInfo | undefined; + }; +} +/** + * Recorded MCP server connection failure. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "McpServerFailureInfo". + */ +/** @experimental */ +export interface McpServerFailureInfo { + /** + * Failure message produced when the MCP server connection failed. + */ + message: string; + /** + * epoch-ms timestamp at which the failure was recorded. + */ + timestamp: number; +} +/** + * Recorded MCP server pending-auth state. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "McpServerNeedsAuthInfo". + */ +/** @experimental */ +export interface McpServerNeedsAuthInfo { + /** + * epoch-ms timestamp at which the server signalled it needs authentication. + */ + timestamp: number; +} +/** + * A normalised, inert description of what installing an MCP server would involve. Carries no raw card, no install specification, and no secret value. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "McpInstallPlan". + */ +/** @experimental */ +export interface McpInstallPlan { + /** + * 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. + */ + planHandle: string; + /** + * 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. + */ + planHandleExpiresAt: string; + identity: McpPlanResourceIdentity; + provenance: McpPlanProvenance; + /** + * 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. + * + * @minItems 1 + * @maxItems 50 + */ + transportChoices: [McpPlanTransportChoice, ...McpPlanTransportChoice[]]; + /** + * Identifier of the choice the runtime would pick by default. Omitted when there is no eligible transport, or when the runtime expresses no preference. + */ + recommendedTransportChoiceId?: string; + target: McpPlanTarget; + policy: McpPlanPolicyResult; + /** + * The configuration changes installing would make, described rather than serialised, so the mutable configuration payload stays behind the runtime boundary. */ - serverName: string; + configurationChanges: McpPlanConfigurationChange[]; + /** + * Whether applying this plan would require an MCP reload to take effect. Planning itself never reloads. + */ + reloadRequired: boolean; + /** + * Whether the plan cannot be applied without further input, because a required value has no default or a secret must be supplied. + */ + requiresInteractiveConfiguration: boolean; } /** - * Identifiers and raw MCP CreateMessageRequest params used to run a sampling inference. + * Normalised identity of the MCP server a plan targets, independent of how the card spelled it. * * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema - * via the `definition` "McpExecuteSamplingParams". + * via the `definition` "McpPlanResourceIdentity". */ /** @experimental */ -export interface McpExecuteSamplingParams { +export interface McpPlanResourceIdentity { /** - * 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. + * Canonical, normalised name of the server, for example `io.github.owner/server`. */ - requestId: string; + canonicalName: string; /** - * Name of the MCP server that initiated the sampling request + * Local configuration key the server would be recorded under. */ serverName: string; /** - * 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). + * Version advertised by the card, when it declares one. */ - mcpRequestId: JsonValue; - request: McpExecuteSamplingRequest; -} -/** - * 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. - * - * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema - * via the `definition` "McpExecuteSamplingRequest". - */ -/** @experimental */ -export interface McpExecuteSamplingRequest { - [k: string]: unknown | undefined; + version?: string; + /** + * Registry identifier of the server, when it came from a registry. + */ + registryId?: string; } /** - * 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. + * Provenance of the exact validated JSON MCP card content bound privately to a completed plan and its opaque handle. * * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema - * via the `definition` "McpExecuteSamplingResult". + * via the `definition` "McpPlanProvenance". */ /** @experimental */ -export interface McpExecuteSamplingResult { - [k: string]: unknown | undefined; +export interface McpPlanProvenance { + /** + * Authority associated with the validated card, without path, query, or credentials. Inert untrusted data. + */ + authority: string; + /** + * ISO 8601 timestamp at which the runtime completed strict parsing and schema validation of the card content. + */ + validatedAt: string; + cardDigest: CardDigest; + mediaType: McpServerCardMediaType; } /** - * MCP server whose connection attempt failed. + * An eligible local-package transport choice. Package identity is required and a remote endpoint cannot be represented. * * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema - * via the `definition` "McpFailedServer". + * via the `definition` "McpPlanTransportChoicePackage". */ /** @experimental */ -export interface McpFailedServer { +export interface McpPlanTransportChoicePackage { /** - * The config key of the server that failed to connect. + * Stable identifier for this choice within the plan, used to select it when the plan is applied. */ - name: string; + choiceId: string; + transport: McpPlanPackageTransport; + installMethod: McpPlanPackageInstallMethod; /** - * The captured connection failure detail. + * Packaging ecosystem, for example `oci` or `npm`. */ - error?: string; + packageType: string; + /** + * Package identifier. Inert untrusted data. + */ + packageIdentifier: string; + /** + * Typed values this choice requires, excluding secrets. + */ + requiredValues: McpPlanRequiredValue[]; + /** + * Secrets this choice requires, referenced by placeholder only. + */ + secretPlaceholders: McpPlanSecretPlaceholder[]; } /** - * MCP server filtered by policy, with name, reason, and optional redacted reason. + * One non-secret scalar value a transport choice needs before it can be applied. * * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema - * via the `definition` "McpFilteredServer". + * via the `definition` "McpPlanRequiredValueScalar". */ /** @experimental */ -export interface McpFilteredServer { +export interface McpPlanRequiredValueScalar { + kind: McpPlanRequiredValueScalarKind; /** - * Filtered server name + * Key the value is supplied under. Inert untrusted data. */ - name: string; + key: string; + category: McpPlanValueCategory; + valueType: McpPlanScalarValueType; /** - * Human-readable filter reason + * Whether the value must be present for the plan to be applicable. */ - reason: string; + required: boolean; /** - * PII-free filter reason + * 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. */ - redactedReason?: string; + defaultValue?: string; /** - * @deprecated - * Deprecated. This field is no longer populated. + * Human-readable label from the card. Inert untrusted text. */ - enterpriseName?: string; + title?: string; + /** + * Human-readable explanation from the card. Inert untrusted text. + */ + description?: string; + /** + * Whether the value may be supplied more than once. + */ + isRepeated: boolean; } /** - * MCP headers refresh request id and the host response. + * One enumerated non-secret value a transport choice needs before it can be applied. The permitted values are structurally required. * * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema - * via the `definition` "McpHeadersHandlePendingHeadersRefreshRequestRequest". + * via the `definition` "McpPlanRequiredValueEnum". */ /** @experimental */ -export interface McpHeadersHandlePendingHeadersRefreshRequestRequest { +export interface McpPlanRequiredValueEnum { + kind: McpPlanRequiredValueEnumKind; /** - * Headers refresh request identifier from mcp.headers_refresh_required + * Key the value is supplied under. Inert untrusted data. */ - requestId: string; - result: McpHeadersHandlePendingHeadersRefreshRequest; + key: string; + category: McpPlanValueCategory; + valueType: McpPlanEnumValueType; + /** + * Whether the value must be present for the plan to be applicable. + */ + required: boolean; + /** + * 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. + */ + defaultValue?: string; + /** + * Human-readable label from the card. Inert untrusted text. + */ + title?: string; + /** + * Human-readable explanation from the card. Inert untrusted text. + */ + description?: string; + /** + * Non-empty permitted value set. Inert untrusted data. + * + * @minItems 1 + */ + enumValues: [string, ...string[]]; + /** + * Whether the value may be supplied more than once. + */ + isRepeated: boolean; } /** - * Indicates whether the pending MCP headers refresh response was accepted. + * 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. * * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema - * via the `definition` "McpHeadersHandlePendingHeadersRefreshRequestResult". + * via the `definition` "McpPlanSecretPlaceholder". */ /** @experimental */ -export interface McpHeadersHandlePendingHeadersRefreshRequestResult { +export interface McpPlanSecretPlaceholder { /** - * Whether the response was accepted. False if the request was unknown, timed out, or already resolved. + * Key the secret is supplied under. Inert untrusted data. */ - success: boolean; + key: string; + placeholder: McpPlanSecretReference; + /** + * Human-readable label from the card. Inert untrusted text. + */ + title?: string; } /** - * Host-level state, omitted when no MCP host is initialized. + * An eligible remote-endpoint transport choice. The endpoint is required and package identity cannot be represented. * * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema - * via the `definition` "McpHostState". + * via the `definition` "McpPlanTransportChoiceRemote". */ /** @experimental */ -export interface McpHostState { - /** - * Whether third-party MCP servers are policy-enabled for this session. - */ - mcp3pEnabled: boolean; - /** - * Configured servers that are explicitly disabled. - */ - disabledServers: string[]; - /** - * Configured servers filtered out by MCP server policy. - */ - filteredServers: string[]; +export interface McpPlanTransportChoiceRemote { /** - * Names of currently-connected MCP clients. + * Stable identifier for this choice within the plan, used to select it when the plan is applied. */ - clients: string[]; + choiceId: string; + transport: McpPlanRemoteTransport; + installMethod: McpPlanRemoteInstallMethod; /** - * Names of servers with in-flight connection attempts. + * Endpoint URL. Inert untrusted data. */ - pendingConnections: string[]; + endpoint: string; /** - * Map of server name to recorded connection failure. + * Typed values this choice requires, excluding secrets. */ - failedServers: { - [k: string]: McpServerFailureInfo | undefined; - }; + requiredValues: McpPlanRequiredValue[]; /** - * Map of server name to recorded pending-auth state. + * Secrets this choice requires, referenced by placeholder only. */ - needsAuthServers: { - [k: string]: McpServerNeedsAuthInfo | undefined; - }; + secretPlaceholders: McpPlanSecretPlaceholder[]; } /** - * Recorded MCP server connection failure. + * Where a plan would be written. * * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema - * via the `definition` "McpServerFailureInfo". + * via the `definition` "McpPlanTarget". */ /** @experimental */ -export interface McpServerFailureInfo { +export interface McpPlanTarget { + scope: McpPlanScope; /** - * Failure message produced when the MCP server connection failed. + * Configuration key the server would be recorded under within that scope. */ - message: string; + configKey: string; +} +/** + * Outcome of evaluating the planned server against registry and enterprise policy. Evaluation is read-only. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "McpPlanPolicyResult". + */ +/** @experimental */ +export interface McpPlanPolicyResult { + decision: McpPlanPolicyDecision; + source: McpPlanPolicySource; /** - * epoch-ms timestamp at which the failure was recorded. + * Human-readable explanation, safe to surface. Never contains a query, URL, handle, or secret. */ - timestamp: number; + reason?: string; } /** - * Recorded MCP server pending-auth state. + * One change applying the plan would make, described rather than serialised so the configuration payload stays behind the runtime boundary. * * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema - * via the `definition` "McpServerNeedsAuthInfo". + * via the `definition` "McpPlanConfigurationChange". */ /** @experimental */ -export interface McpServerNeedsAuthInfo { +export interface McpPlanConfigurationChange { + operation: McpPlanConfigurationOperation; + scope: McpPlanScope; /** - * epoch-ms timestamp at which the server signalled it needs authentication. + * Configuration key the change applies to. */ - timestamp: number; + configKey: string; + /** + * Names of the configuration fields the change would set, without their values. + */ + changedFields: string[]; + /** + * Secret placeholders the written configuration would reference. The constrained placeholder type cannot carry a literal secret value. + */ + secretReferences: McpPlanSecretReference[]; } /** * Server name to check running status for. @@ -9531,6 +10859,92 @@ export interface McpOauthRespondResult { */ success: boolean; } +/** + * 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. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "McpPlanInstallPlanned". + */ +/** @experimental */ +export interface McpPlanInstallPlanned { + /** + * Discriminator: a plan was computed and nothing was changed + */ + kind: "planned"; + plan: McpInstallPlan; + negotiated: CatalogNegotiatedContract; +} +/** + * A side-effect-free request for an MCP install plan. Computing a plan never writes configuration, stores a secret, or reloads MCP servers. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "McpPlanInstallRequest". + */ +/** @experimental */ +export interface McpPlanInstallRequest { + contract: CatalogClientContract; + source: McpPlanInstallSource; + scope?: McpPlanScope; +} +/** + * Plan from a candidate returned by a previous catalog search. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "McpPlanInstallSourceCandidate". + */ +/** @experimental */ +export interface McpPlanInstallSourceCandidate { + kind: McpPlanInstallSourceCandidateKind; + /** + * Single-use candidate handle. Consumed by this call, so a replay of the same handle is rejected. + */ + candidateHandle: string; + /** + * 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. + */ + searchId: string; +} +/** + * Plan from a card supplied directly by the caller, without a preceding search. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "McpPlanInstallSourceCard". + */ +/** @experimental */ +export interface McpPlanInstallSourceCard { + kind: McpPlanInstallSourceCardKind; + card: McpServerCardReference; +} +/** + * An MCP server card to be retrieved from a URL through the runtime's hardened fetch boundary. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "McpServerCardUrl". + */ +/** @experimental */ +export interface McpServerCardUrl { + kind: McpServerCardUrlKind; + mediaType: McpServerCardMediaType; + /** + * Card URL. Retrieved only through the runtime's hardened boundary, with scheme, credential, address-range, redirect, timeout, and response-size controls applied. Never logged. + */ + url: string; +} +/** + * An MCP server card supplied inline as an inert document. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "McpServerCardEmbedded". + */ +/** @experimental */ +export interface McpServerCardEmbedded { + kind: McpServerCardEmbeddedKind; + mediaType: McpServerCardMediaType; + /** + * 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. + */ + data: string; +} /** * Registration parameters for an external MCP client. * @@ -11035,6 +12449,19 @@ export interface ModeSetResult { */ armInteractiveContinuation?: boolean; } +/** + * Result of moving in-flight MCP loading to the background. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "MoveMcpLoadingToBackgroundResult". + */ +/** @experimental */ +export interface 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. + */ + movedToBackground: boolean; +} /** * External SDK input for a named custom model provider. Ingested by the native protocol boundary before host dispatch. * @@ -12435,10 +13862,20 @@ export interface PermissionsFolderTrustAddTrustedResult { * No parameters. * * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema - * via the `definition` "PermissionsGetAllowAllRequest". + * via the `definition` "PermissionsGetModeRequest". */ /** @experimental */ -export interface PermissionsGetAllowAllRequest {} +export interface PermissionsGetModeRequest {} +/** + * Current permission mode. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "PermissionsGetModeResult". + */ +/** @experimental */ +export interface PermissionsGetModeResult { + mode: PermissionMode; +} /** * Indicates whether the operation succeeded. * @@ -12569,50 +14006,60 @@ export interface PermissionsResetSessionApprovalsResult { success: boolean; } /** - * Allow-all mode to apply for the session. + * Allow-all toggle for tool permission requests, with an optional telemetry source. * * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema - * via the `definition` "PermissionsSetAllowAllRequest". + * via the `definition` "PermissionsSetApproveAllRequest". */ /** @experimental */ -export interface PermissionsSetAllowAllRequest { - mode?: PermissionsAllowAllMode; +export interface PermissionsSetApproveAllRequest { /** - * Legacy full allow-all toggle. Prefer `mode`; when `mode` is omitted, `enabled: true` is treated as `mode: "on"` and any other value is treated as `mode: "off"`. + * Whether to auto-approve all tool permission requests */ - enabled?: boolean; + enabled: boolean; + source?: PermissionsSetApproveAllSource; +} +/** + * Indicates whether the operation succeeded. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "PermissionsSetApproveAllResult". + */ +/** @experimental */ +export interface PermissionsSetApproveAllResult { /** - * Optional model id for the `auto` mode auto-approval LLM judging. Only meaningful when `mode` is `auto`; ignored otherwise. When omitted, the session resolves a default judge model: `gpt-5.5` for CAPI sessions and the session's active model for BYOK sessions. + * Whether the operation succeeded */ - model?: string; - source?: PermissionsSetAllowAllSource; + success: boolean; } /** - * Allow-all toggle for tool permission requests, with an optional telemetry source. + * Permission mode to apply for the session. * * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema - * via the `definition` "PermissionsSetApproveAllRequest". + * via the `definition` "PermissionsSetModeRequest". */ /** @experimental */ -export interface PermissionsSetApproveAllRequest { +export interface PermissionsSetModeRequest { + mode: PermissionMode; /** - * Whether to auto-approve all tool permission requests + * Optional judge model id for assisted mode. When omitted, the session resolves the provider default: `gpt-5.5` for CAPI sessions and the active session model for BYOK sessions. */ - enabled: boolean; - source?: PermissionsSetApproveAllSource; + assistedApprovalModel?: string; + source?: PermissionModeSource; } /** - * Indicates whether the operation succeeded. + * Indicates whether the requested permission mode was applied and reports the authoritative post-mutation mode. * * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema - * via the `definition` "PermissionsSetApproveAllResult". + * via the `definition` "PermissionsSetModeResult". */ /** @experimental */ -export interface PermissionsSetApproveAllResult { +export interface PermissionsSetModeResult { /** * Whether the operation succeeded */ success: boolean; + mode: PermissionMode; } /** * Toggles whether permission prompts should be bridged into session events for this client. @@ -12758,6 +14205,10 @@ export interface PlanSqlTodosRow { * Todo status. */ status?: string; + /** + * 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. + */ + createdAt?: string; } /** * Todo rows + dependency edges read from the session SQL database. @@ -21130,6 +22581,15 @@ export function createServerRpc(connection: MessageConnection) { */ discover: async (params: McpDiscoverRequest): Promise => connection.sendRequest("mcp.discover", params), + /** + * Requests a side-effect-free MCP install plan from a catalog candidate handle or a caller-supplied card. This host-implemented server method is available through SDK/TUI hosts; standalone and C-ABI runtimes whose host does not implement server-method dispatch return JSON-RPC MethodNotFound. A runtime with planning available returns a normalised plan and opaque single-use plan handle; a runtime without it returns the typed planning-unavailable result. A completed plan reports resource identity, provenance, eligible transport choices, the user-scope target, required typed values and secret placeholders, the policy result, the configuration changes installing would make, and whether a reload would be needed. Planning never writes configuration, stores a secret, or reloads MCP servers, so abandoning a plan needs no call and leaves nothing behind. + * + * @param params A side-effect-free request for an MCP install plan. Computing a plan never writes configuration, stores a secret, or reloads MCP servers. + * + * @returns Outcome of an mcp.planInstall call: either a normalised plan, or one typed refusal. Nothing is written in either case. + */ + planInstall: async (params: McpPlanInstallRequest): Promise => + connection.sendRequest("mcp.planInstall", params), }, /** @experimental */ extensions: { @@ -21163,6 +22623,18 @@ export function createServerRpc(connection: MessageConnection) { registerExtensionLaunchProvider: async (): Promise => connection.sendRequest("registerExtensionLaunchProvider", {}), /** @experimental */ + catalog: { + /** + * Requests a bounded catalog search. This host-implemented server method is available through SDK/TUI hosts; standalone and C-ABI runtimes whose host does not implement server-method dispatch return JSON-RPC MethodNotFound. A runtime with search available returns inert candidate summaries, each with an opaque single-use handle scoped to this runtime instance; a runtime without it returns the typed search-unavailable result. Public authorities may be searched anonymously, while an authority that requires credentials yields the typed authentication-required result. All returned text, URLs, and package metadata are untrusted external data and can never trigger instructions, tools, or installation. Read-only: nothing is installed, configured, or persisted. + * + * @param params 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. + * + * @returns Outcome of a catalog.search call: either bounded inert candidates, or one typed refusal. Never a partial success. + */ + search: async (params: CatalogSearchRequest): Promise => + connection.sendRequest("catalog.search", params), + }, + /** @experimental */ plugins: { /** * Lists plugins installed in user/global state. @@ -22526,6 +23998,13 @@ export function createSessionRpc(connection: MessageConnection, sessionId: strin */ reload: async (): Promise => connection.sendRequest("session.mcp.reload", { sessionId }), + /** + * Releases any turns waiting on an in-flight MCP load without cancelling the load, letting the agent proceed while MCP servers finish connecting in the background. No-op when no MCP load is in flight or waiting turns were already released. + * + * @returns Result of moving in-flight MCP loading to the background. + */ + moveLoadingToBackground: async (): Promise => + connection.sendRequest("session.mcp.moveLoadingToBackground", { sessionId }), /** * Runs an MCP sampling inference on behalf of an MCP server. * @@ -23101,21 +24580,21 @@ export function createSessionRpc(connection: MessageConnection, sessionId: strin setApproveAll: async (params: PermissionsSetApproveAllRequest): Promise => connection.sendRequest("session.permissions.setApproveAll", { sessionId, ...params }), /** - * Sets the allow-all permission mode for the session. Used by attach-mode clients (e.g. LocalRpcSession's `/allow-all` forwarder) to flip the target session's permission state. The `on` mode swaps in unrestricted path and URL managers and emits `session.permissions_changed` on transition; the `auto` mode keeps normal prompt paths active while attaching LLM safety recommendations. The result returns the authoritative post-mutation state so callers can update their local mirrors without racing the `session.permissions_changed` notification on the same wire. + * Sets the permission mode for the session. `manual` follows the normal approval flow, `assisted` attaches LLM safety recommendations, and `allow-all` automatically approves permission requests. The result returns the authoritative post-mutation mode so callers can update local state without racing the `session.permissions_changed` notification. * - * @param params Allow-all mode to apply for the session. + * @param params Permission mode to apply for the session. * - * @returns Indicates whether the operation succeeded and reports the post-mutation state. + * @returns Indicates whether the requested permission mode was applied and reports the authoritative post-mutation mode. */ - setAllowAll: async (params: PermissionsSetAllowAllRequest): Promise => - connection.sendRequest("session.permissions.setAllowAll", { sessionId, ...params }), + setMode: async (params: PermissionsSetModeRequest): Promise => + connection.sendRequest("session.permissions.setMode", { sessionId, ...params }), /** - * Returns the current allow-all permission mode for the session. + * Returns the current permission mode for the session. * - * @returns Current allow-all permission mode. + * @returns Current permission mode. */ - getAllowAll: async (): Promise => - connection.sendRequest("session.permissions.getAllowAll", { sessionId }), + getMode: async (): Promise => + connection.sendRequest("session.permissions.getMode", { sessionId }), /** * Adds or removes session-scoped or location-scoped permission rules. * diff --git a/nodejs/src/generated/session-events.ts b/nodejs/src/generated/session-events.ts index 4f9654e068..fdb82ab14e 100644 --- a/nodejs/src/generated/session-events.ts +++ b/nodejs/src/generated/session-events.ts @@ -229,16 +229,16 @@ export type SessionMode = /** The agent is working autonomously toward task completion. */ | "autopilot"; /** - * Allow-all mode for the session. + * Permission mode for the session. */ /** @experimental */ -export type PermissionAllowAllMode = +export type PermissionMode = /** Permission requests follow the normal approval flow. */ - | "off" + | "manual" + /** Permission requests include an LLM safety recommendation; clients may automatically approve requests judged acceptable. */ + | "assisted" /** Tool, path, and URL permission requests are automatically approved. */ - | "on" - /** Permission requests follow the normal approval flow with an LLM advisory recommendation attached; clients may choose to auto-approve requests the judge evaluated as acceptable. */ - | "auto"; + | "allow-all"; /** * The type of operation performed on the plan file */ @@ -604,10 +604,10 @@ export type PermissionRequestMemoryAction = /** Vote on an existing memory. */ | "vote"; /** - * Why the auto-approval judge produced no usable recommendation. Present only alongside an `error` recommendation, where the human-readable reason is a fixed string and therefore cannot distinguish these cases. Intended to make a judge failure reportable by a consumer that has no access to the host's logs. + * Why the assisted-approval judge produced no usable recommendation. Present only alongside an `error` recommendation, where the human-readable reason is a fixed string and therefore cannot distinguish these cases. Intended to make a judge failure reportable by a consumer that has no access to the host's logs. */ /** @experimental */ -export type AutoApprovalJudgeFailureReason = +export type AssistedApprovalJudgeFailureReason = /** The judge model call exceeded its deadline. */ | "timeout" /** The judge model call was cancelled before it returned. */ @@ -619,15 +619,15 @@ export type AutoApprovalJudgeFailureReason = /** The judge model replied, but the reply carried no ALLOW/DENY verdict. */ | "parse_error"; /** - * Outcome of the auto-approval safety judge for a permission request. Present only when auto mode is enabled; its absence means the judge did not evaluate the request (auto mode was off). + * Outcome of the assisted-approval safety judge for a permission request. Present only in assisted mode; its absence means the judge did not evaluate the request. */ /** @experimental */ -export type AutoApprovalRecommendation = +export type AssistedApprovalRecommendation = /** The judge evaluated the request and recommends automatically approving it. */ | "approve" - /** The judge evaluated the request and does not recommend auto-approving it; explicit approval is required. Whether that means prompting, denying, or something else is the consumer's decision. */ + /** The judge evaluated the request and does not recommend automatically approving it; explicit approval is required. Whether that means prompting, denying, or something else is the consumer's decision. */ | "requireApproval" - /** Auto mode is enabled, but this request category is never auto-approvable (for example, sandbox-bypass requests), so the judge was not consulted. */ + /** Assisted mode is enabled, but this request category is never automatically approvable (for example, sandbox-bypass requests), so the judge was not consulted. */ | "excluded" /** The judge was consulted but did not return a usable recommendation, so the request requires explicit approval. */ | "error"; @@ -846,12 +846,12 @@ export type ManagedSettingsEnforcedAction = * For a `bypass_permissions_blocked` action, which permission-escalation primitive was refused */ export type ManagedSettingsEnforcedEscalation = - /** Full allow-all ("/allow-all on") permissions — auto-approving tools, paths, and URLs. */ + /** Full allow-all permissions — automatically approving tools, paths, and URLs. */ | "allow_all" - /** Auto-approval of all tool permission requests. */ + /** Automatic approval of all tool permission requests. */ | "approve_all" - /** Advisory auto-approval ("/allow-all auto") mode — keeps normal prompt paths and adds LLM-advised approval, distinct from full allow-all. */ - | "auto_approval" + /** Assisted mode — keeps normal prompt paths and adds an LLM recommendation, distinct from allow-all. */ + | "assisted_approval" /** Unrestricted filesystem access outside the session's allowed directories. */ | "unrestricted_paths" /** Unrestricted URL fetch access. */ @@ -1821,8 +1821,9 @@ export interface SessionLimitsChangedData { sessionLimits: SessionLimitsConfig | null; } /** - * Session event "session.permissions_changed". Permissions change details carrying the aggregate allow-all transition. + * Session event "session.permissions_changed". Permission-mode transition details. */ +/** @experimental */ export interface PermissionsChangedEvent { /** * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events. @@ -1851,29 +1852,28 @@ export interface PermissionsChangedEvent { type: "session.permissions_changed"; } /** - * Permissions change details carrying the aggregate allow-all transition. + * Permission-mode transition details. */ +/** @experimental */ export interface PermissionsChangedData { /** - * Allow-all mode after the change + * Explicit LLM judge model override used by assisted mode; omitted when the provider default applies * * @experimental */ - allowAllPermissionMode?: PermissionAllowAllMode; + assistedApprovalModel?: string; /** - * Aggregate allow-all flag after the change - */ - allowAllPermissions: boolean; - /** - * Allow-all mode before the change + * Permission mode after the change * * @experimental */ - previousAllowAllPermissionMode?: PermissionAllowAllMode; + mode: PermissionMode; /** - * Aggregate allow-all flag before the change + * Permission mode before the change + * + * @experimental */ - previousAllowAllPermissions: boolean; + previousMode: PermissionMode; } /** * Session event "session.plan_changed". Plan file operation details indicating what changed @@ -6790,7 +6790,12 @@ export interface PermissionRequestUrl { */ export interface PermissionRequestMemory { action?: PermissionRequestMemoryAction; - autoApproval?: PermissionAutoApproval; + /** + * Assisted-approval judge information for this request; present only in assisted mode. + * + * @experimental + */ + assistedApproval?: PermissionAssistedApproval; /** * Source references for the stored fact (store only) */ @@ -6823,11 +6828,11 @@ export interface PermissionRequestMemory { toolCallId?: string; } /** - * Auto-approval judge information attached to a permission request. Present (non-null) only when the session's allow-all mode is "auto"; its absence means auto mode was off and the judge did not evaluate the request. The `recommendation` conveys the judge's disposition for this request. + * Assisted-approval judge information attached to a permission request. Present only in assisted mode; its absence means the judge did not evaluate the request. The `recommendation` conveys the judge's disposition for this request. */ /** @experimental */ -export interface PermissionAutoApproval { - failureReason?: AutoApprovalJudgeFailureReason; +export interface PermissionAssistedApproval { + failureReason?: AssistedApprovalJudgeFailureReason; /** * Model id that produced the recommendation, when the judge was consulted and reported one. Absent for `excluded` (the judge was not consulted) and for failures that occurred before a model was selected. */ @@ -6836,7 +6841,7 @@ export interface PermissionAutoApproval { * Human-readable reason for the judge's recommendation, when available. */ reason?: string; - recommendation: AutoApprovalRecommendation; + recommendation: AssistedApprovalRecommendation; } /** * Custom tool invocation permission request @@ -7041,11 +7046,11 @@ export interface PermissionRequestExtensionEnvAccess { */ export interface PermissionPromptRequestCommands { /** - * Auto-approval judge information for this request; present only when auto mode is enabled. + * Assisted-approval judge information for this request; present only in assisted mode. * * @experimental */ - autoApproval?: PermissionAutoApproval; + assistedApproval?: PermissionAssistedApproval; /** * Whether the UI can offer session-wide approval for this command pattern */ @@ -7084,11 +7089,11 @@ export interface PermissionPromptRequestCommands { */ export interface PermissionPromptRequestWrite { /** - * Auto-approval judge information for this request; present only when auto mode is enabled. + * Assisted-approval judge information for this request; present only in assisted mode. * * @experimental */ - autoApproval?: PermissionAutoApproval; + assistedApproval?: PermissionAssistedApproval; /** * Whether the UI can offer session-wide approval for file write operations */ @@ -7127,11 +7132,11 @@ export interface PermissionPromptRequestWrite { */ export interface PermissionPromptRequestRead { /** - * Auto-approval judge information for this request; present only when auto mode is enabled. + * Assisted-approval judge information for this request; present only in assisted mode. * * @experimental */ - autoApproval?: PermissionAutoApproval; + assistedApproval?: PermissionAssistedApproval; /** * Human-readable description of why the file is being read */ @@ -7162,11 +7167,11 @@ export interface PermissionPromptRequestMcp { */ args?: JsonValue; /** - * Auto-approval judge information for this request; present only when auto mode is enabled. + * Assisted-approval judge information for this request; present only in assisted mode. * * @experimental */ - autoApproval?: PermissionAutoApproval; + assistedApproval?: PermissionAssistedApproval; /** * Prompt kind discriminator */ @@ -7199,11 +7204,11 @@ export interface PermissionPromptRequestMcp { */ export interface PermissionPromptRequestUrl { /** - * Auto-approval judge information for this request; present only when auto mode is enabled. + * Assisted-approval judge information for this request; present only in assisted mode. * * @experimental */ - autoApproval?: PermissionAutoApproval; + assistedApproval?: PermissionAssistedApproval; /** * Human-readable description of why the URL is being accessed */ @@ -7243,11 +7248,11 @@ export interface PermissionPromptRequestUrl { export interface PermissionPromptRequestMemory { action?: PermissionRequestMemoryAction; /** - * Auto-approval judge information for this request; present only when auto mode is enabled. + * Assisted-approval judge information for this request; present only in assisted mode. * * @experimental */ - autoApproval?: PermissionAutoApproval; + assistedApproval?: PermissionAssistedApproval; /** * Source references for the stored fact (store only) */ @@ -7283,11 +7288,11 @@ export interface PermissionPromptRequestCustomTool { */ args?: JsonValue; /** - * Auto-approval judge information for this request; present only when auto mode is enabled. + * Assisted-approval judge information for this request; present only in assisted mode. * * @experimental */ - autoApproval?: PermissionAutoApproval; + assistedApproval?: PermissionAssistedApproval; /** * Prompt kind discriminator */ @@ -7311,11 +7316,11 @@ export interface PermissionPromptRequestCustomTool { export interface PermissionPromptRequestPath { accessKind: PermissionPromptRequestPathAccessKind; /** - * Auto-approval judge information for this request; present only when auto mode is enabled. + * Assisted-approval judge information for this request; present only in assisted mode. * * @experimental */ - autoApproval?: PermissionAutoApproval; + assistedApproval?: PermissionAssistedApproval; /** * Prompt kind discriminator */ @@ -7334,11 +7339,11 @@ export interface PermissionPromptRequestPath { */ export interface PermissionPromptRequestHook { /** - * Auto-approval judge information for this request; present only when auto mode is enabled. + * Assisted-approval judge information for this request; present only in assisted mode. * * @experimental */ - autoApproval?: PermissionAutoApproval; + assistedApproval?: PermissionAssistedApproval; /** * Optional message from the hook explaining why confirmation is needed */ @@ -7365,11 +7370,11 @@ export interface PermissionPromptRequestHook { */ export interface PermissionPromptRequestExtensionManagement { /** - * Auto-approval judge information for this request; present only when auto mode is enabled. + * Assisted-approval judge information for this request; present only in assisted mode. * * @experimental */ - autoApproval?: PermissionAutoApproval; + assistedApproval?: PermissionAssistedApproval; /** * Name of the extension being managed */ @@ -7396,11 +7401,11 @@ export interface PermissionPromptRequestFactory { */ approvalKey: string; /** - * Auto-approval judge information for this request; present only when auto mode is enabled. + * Assisted-approval judge information for this request; present only in assisted mode. * * @experimental */ - autoApproval?: PermissionAutoApproval; + assistedApproval?: PermissionAssistedApproval; /** * Whether this factory is eligible for persistent approval */ @@ -7468,11 +7473,11 @@ export interface PermissionPromptRequestFactory { */ export interface PermissionPromptRequestExtensionPermissionAccess { /** - * Auto-approval judge information for this request; present only when auto mode is enabled. + * Assisted-approval judge information for this request; present only in assisted mode. * * @experimental */ - autoApproval?: PermissionAutoApproval; + assistedApproval?: PermissionAssistedApproval; /** * Capabilities the extension is requesting */ @@ -7495,11 +7500,11 @@ export interface PermissionPromptRequestExtensionPermissionAccess { */ export interface PermissionPromptRequestExtensionEnvAccess { /** - * Auto-approval judge information for this request; present only when auto mode is enabled. + * Assisted-approval judge information for this request; present only in assisted mode. * * @experimental */ - autoApproval?: PermissionAutoApproval; + assistedApproval?: PermissionAssistedApproval; /** * Names of the sensitive environment variables the extension is requesting. Values never appear here. * diff --git a/nodejs/test/e2e/rpc_session_state_extras.e2e.test.ts b/nodejs/test/e2e/rpc_session_state_extras.e2e.test.ts index 54f40fe12c..6111809914 100644 --- a/nodejs/test/e2e/rpc_session_state_extras.e2e.test.ts +++ b/nodejs/test/e2e/rpc_session_state_extras.e2e.test.ts @@ -203,21 +203,21 @@ describe("Session-scoped state extras RPC", async () => { it("should get and set allowall permissions", { timeout: 120_000 }, async () => { const session = await createSession(); try { - const initial = await session.rpc.permissions.getAllowAll(); - expect(initial.enabled).toBe(false); + const initial = await session.rpc.permissions.getMode(); + expect(initial.mode).toBe("manual"); - const enable = await session.rpc.permissions.setAllowAll({ enabled: true }); + const enable = await session.rpc.permissions.setMode({ mode: "allow-all" }); expect(enable.success).toBe(true); - expect(enable.enabled).toBe(true); - expect((await session.rpc.permissions.getAllowAll()).enabled).toBe(true); + expect(enable.mode).toBe("allow-all"); + expect((await session.rpc.permissions.getMode()).mode).toBe("allow-all"); - const disable = await session.rpc.permissions.setAllowAll({ enabled: false }); + const disable = await session.rpc.permissions.setMode({ mode: "manual" }); expect(disable.success).toBe(true); - expect(disable.enabled).toBe(false); - expect((await session.rpc.permissions.getAllowAll()).enabled).toBe(false); + expect(disable.mode).toBe("manual"); + expect((await session.rpc.permissions.getMode()).mode).toBe("manual"); } finally { try { - await session.rpc.permissions.setAllowAll({ enabled: false }); + await session.rpc.permissions.setMode({ mode: "manual" }); } catch { // Best-effort reset. } diff --git a/nodejs/test/e2e/rpc_ui_ephemeral_query.e2e.test.ts b/nodejs/test/e2e/rpc_ui_ephemeral_query.e2e.test.ts index 537329094e..07bdc54199 100644 --- a/nodejs/test/e2e/rpc_ui_ephemeral_query.e2e.test.ts +++ b/nodejs/test/e2e/rpc_ui_ephemeral_query.e2e.test.ts @@ -9,9 +9,9 @@ import { createSdkTestContext } from "./harness/sdkTestContext.js"; describe("UI ephemeral query RPC", async () => { const { copilotClient: client } = await createSdkTestContext(); - // TODO(cli-1.0.81-2): CLI 1.0.81-2 fails session.ui.ephemeralQuery against the recorded - // snapshot ("Failed to get response from the AI model"). Re-enable once the runtime - // fix ships. + // TODO(cli-1.0.81-2): CLI 1.0.81-4 still fails session.ui.ephemeralQuery against the + // recorded snapshot ("Failed to get response from the AI model"). Re-enable once the + // runtime fix ships. it.skip("should answer ephemeral query", { timeout: 120_000 }, async () => { const session = await client.createSession({ onPermissionRequest: approveAll }); try { diff --git a/nodejs/vitest.config.ts b/nodejs/vitest.config.ts index fb9795d9de..eec87f977e 100644 --- a/nodejs/vitest.config.ts +++ b/nodejs/vitest.config.ts @@ -5,13 +5,10 @@ const integrationTestTimeout = process.platform === "win32" ? 60000 : 30000; const isInProcessTransport = (process.env.COPILOT_SDK_DEFAULT_CONNECTION ?? "").toLowerCase() === "inprocess"; -// TODO(cli-1.0.81-2): under @github/copilot 1.0.81-2 every model-driven turn hangs when the -// runtime is hosted in-process (FFI). The session never reaches idle, so each test fails on -// its own timeout with no error surfaced by the runtime; suites that only exercise RPC -// without a model turn still pass. The same suites pass on the default (stdio) cell on all -// three OSes, and they all passed in-process on 1.0.76-5, so the lost coverage is limited to -// the transport rather than the behavior. Delete this list once a @github/copilot build -// carrying the fix is picked up. +// TODO(cli-1.0.81-4): model-driven turns eventually stop completing when the runtime is +// hosted in-process against CAPI. The shared runtime then poisons every later model-driven +// test until the job times out. These suites still run over stdio on all three OSes, while +// pure-RPC in-process coverage remains enabled. const inProcessBlockedE2E = [ "**/test/e2e/abort.e2e.test.ts", "**/test/e2e/agent_and_compact_rpc.e2e.test.ts", diff --git a/python/copilot/generated/rpc.py b/python/copilot/generated/rpc.py index 8a5a38853c..d8915a626d 100644 --- a/python/copilot/generated/rpc.py +++ b/python/copilot/generated/rpc.py @@ -6,7 +6,7 @@ from typing import ClassVar, TYPE_CHECKING -from .session_events import AbortReason, Attachment, ContextTier, EmbeddedBlobResourceContents, EmbeddedTextResourceContents, McpOauthHttpResponse, McpOauthWWWAuthenticateParams, McpServerSource, McpServerStatus, ModelChangeSource, PermissionPromptRequest, PermissionRule, ReasoningSummary, SessionEvent, SessionLimitsConfig, SessionMode, ShutdownType, SkillSource, TaskCompletionOutcome, UserToolSessionApproval, Verbosity +from .session_events import AbortReason, Attachment, ContextTier, EmbeddedBlobResourceContents, EmbeddedTextResourceContents, McpOauthHttpResponse, McpOauthWWWAuthenticateParams, McpServerSource, McpServerStatus, ModelChangeSource, PermissionMode, PermissionPromptRequest, PermissionRule, ReasoningSummary, SessionEvent, SessionLimitsConfig, SessionMode, ShutdownType, SkillSource, TaskCompletionOutcome, UserToolSessionApproval, Verbosity if TYPE_CHECKING: from .._jsonrpc import JsonRpcClient @@ -708,21 +708,6 @@ def to_dict(self) -> dict: result["projectPaths"] = from_union([lambda x: from_list(from_str, x), from_none], self.project_paths) return result -# Experimental: this type is part of an experimental API and may change or be removed. -class PermissionsAllowAllMode(Enum): - """Authoritative allow-all mode after the mutation - - Current or requested allow-all mode. - - Current allow-all mode - - Allow-all mode to apply. `on` enables full allow-all; `auto` enables advisory LLM - auto-approval; `off` disables both. - """ - AUTO = "auto" - OFF = "off" - ON = "on" - class APIKeyAuthInfoType(Enum): API_KEY = "api-key" @@ -1081,6 +1066,418 @@ def to_dict(self) -> dict: result["enableWebSocketResponses"] = from_union([from_bool, from_none], self.enable_web_socket_responses) return result +# Experimental: this type is part of an experimental API and may change or be removed. +class CardDigestAlgorithm(Enum): + """Canonical digest algorithm for a validated MCP card""" + + SHA256_RFC8785 = "sha256-rfc8785" + +class Installability(Enum): + NOT_INSTALLABLE_KIND = "not-installable-kind" + +class CatalogAISkillCandidateKind(Enum): + AI_SKILL = "ai-skill" + +class MediaType(Enum): + APPLICATION_AI_SKILL = "application/ai-skill" + +class CatalogCandidateSourceKind(Enum): + """Discriminator for a URL-backed MCP server card + + Discriminator for an embedded MCP server card + """ + EMBEDDED = "embedded" + URL = "url" + +class CatalogAuthenticationRequiredErrorKind(Enum): + AUTHENTICATION_REQUIRED = "authentication-required" + +# Experimental: this type is part of an experimental API and may change or be removed. +class CatalogAuthenticationRequiredReason(Enum): + """Why authentication failed. Only an expired credential justifies attempting a silent + refresh; an absent or rejected credential requires sign-in. + + Why the catalog authority did not accept the caller's identity + """ + CREDENTIAL_EXPIRED = "credential-expired" + CREDENTIAL_REJECTED = "credential-rejected" + NO_CREDENTIAL = "no-credential" + +class CatalogCandidateInstallability(Enum): + """Whether this MCP server can be planned for installation, and if policy prevents it. + + Whether an MCP server candidate can be planned for installation + """ + INSTALLABLE = "installable" + NOT_INSTALLABLE_KIND = "not-installable-kind" + NOT_INSTALLABLE_POLICY = "not-installable-policy" + +# Experimental: this type is part of an experimental API and may change or be removed. +class CatalogCandidateKind(Enum): + """What kind of resource a catalog candidate describes""" + + AI_SKILL = "ai-skill" + MCP_SERVER = "mcp-server" + +# Experimental: this type is part of an experimental API and may change or be removed. +class CatalogMediaType(Enum): + """JSON MCP media type of the underlying card. + + JSON MCP card media type accepted for install planning + + JSON MCP media type advertised for the referenced card. + + JSON MCP media type the validated card was interpreted as. + + Media type the card is expected to conform to. + + Media type the card was interpreted as, when it declared one this runtime recognises. + + Media type a catalog card is interpreted as + """ + APPLICATION_AI_SKILL = "application/ai-skill" + APPLICATION_MCP_SERVER_CARD_JSON = "application/mcp-server-card+json" + APPLICATION_MCP_SERVER_JSON = "application/mcp-server+json" + +# Experimental: this type is part of an experimental API and may change or be removed. +class MCPServerCardEmbeddedKind(Enum): + """Discriminator for an embedded MCP server card""" + + EMBEDDED = "embedded" + +# Experimental: this type is part of an experimental API and may change or be removed. +class MCPServerCardURLKind(Enum): + """Discriminator for a URL-backed MCP server card""" + + URL = "url" + +# Experimental: this type is part of an experimental API and may change or be removed. +class CatalogCapability(Enum): + """A wire feature a caller can require of the catalog surface, negotiated per request. A + grant means the runtime understands the feature's contract, not that the deployment has + enabled the operation; typed unavailable results report availability separately. + """ + AI_SKILL_DISCOVERY = "ai-skill-discovery" + LEGACY_MCP_SERVER_CARD = "legacy-mcp-server-card" + MCP_INSTALL_PLANNING = "mcp-install-planning" + MCP_SERVER_CARD = "mcp-server-card" + MULTIPLE_TRANSPORT_CHOICE = "multiple-transport-choice" + +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class CatalogClientContract: + """The protocol version and capability set a caller requires, supplied on every catalog + request so negotiation cannot be skipped by omission. + + Protocol version and capabilities the caller requires. + """ + protocol_version: int + """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. + """ + required_capabilities: list[str] + """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. + """ + + @staticmethod + def from_dict(obj: Any) -> 'CatalogClientContract': + assert isinstance(obj, dict) + protocol_version = from_int(obj.get("protocolVersion")) + required_capabilities = from_list(from_str, obj.get("requiredCapabilities")) + return CatalogClientContract(protocol_version, required_capabilities) + + def to_dict(self) -> dict: + result: dict = {} + result["protocolVersion"] = from_int(self.protocol_version) + result["requiredCapabilities"] = from_list(from_str, self.required_capabilities) + return result + +class CatalogContractViolationErrorKind(Enum): + CONTRACT_VIOLATION = "contract-violation" + +# Experimental: this type is part of an experimental API and may change or be removed. +class CatalogContractViolationReason(Enum): + """Which rule the response broke. + + Which wire-contract rule an upstream response broke + """ + BOTH_URL_AND_DATA = "both-url-and-data" + DUPLICATE_IDENTITY = "duplicate-identity" + NEITHER_URL_NOR_DATA = "neither-url-nor-data" + UNKNOWN_MEDIA_TYPE = "unknown-media-type" + +# Experimental: this type is part of an experimental API and may change or be removed. +class CatalogHandleType(Enum): + """Which kind of handle was presented. + + Which kind of opaque handle was presented + """ + CANDIDATE = "candidate" + PLAN = "plan" + +class CatalogHandleRejectedErrorKind(Enum): + HANDLE_REJECTED = "handle-rejected" + +# Experimental: this type is part of an experimental API and may change or be removed. +class CatalogHandleRejectionReason(Enum): + """Why the handle was rejected. + + Why a presented handle was rejected + """ + FOREIGN = "foreign" + INVALID = "invalid" + REPLAYED = "replayed" + STALE = "stale" + +# Experimental: this type is part of an experimental API and may change or be removed. +class CatalogInvalidRequestField(Enum): + """Which request field was rejected. + + Which request field was rejected before any work was done + """ + CARD = "card" + CONTRACT = "contract" + KINDS = "kinds" + LIMIT = "limit" + QUERY = "query" + SCOPE = "scope" + SOURCE = "source" + +class CatalogInvalidRequestErrorKind(Enum): + INVALID_REQUEST = "invalid-request" + +class CatalogMalformedCardErrorKind(Enum): + MALFORMED_CARD = "malformed-card" + +# Experimental: this type is part of an experimental API and may change or be removed. +class CatalogMalformedCardReason(Enum): + """How the card failed validation. + + How a card failed validation + """ + INVALID_JSON = "invalid-json" + MISSING_REQUIRED_FIELD = "missing-required-field" + SCHEMA_VIOLATION = "schema-violation" + SIZE_LIMIT_EXCEEDED = "size-limit-exceeded" + UNSUPPORTED_MEDIA_TYPE = "unsupported-media-type" + +# Experimental: this type is part of an experimental API and may change or be removed. +class CatalogMCPServerInstallabilityEnum(Enum): + """Whether this MCP server can be planned for installation, and if policy prevents it. + + Whether an MCP server candidate can be planned for installation + """ + INSTALLABLE = "installable" + NOT_INSTALLABLE_POLICY = "not-installable-policy" + +class CatalogMCPServerCandidateKind(Enum): + MCP_SERVER = "mcp-server" + +# Experimental: this type is part of an experimental API and may change or be removed. +class MCPServerCardMediaType(Enum): + """JSON MCP media type of the underlying card. + + JSON MCP card media type accepted for install planning + + JSON MCP media type advertised for the referenced card. + + JSON MCP media type the validated card was interpreted as. + + Media type the card is expected to conform to. + """ + APPLICATION_MCP_SERVER_CARD_JSON = "application/mcp-server-card+json" + APPLICATION_MCP_SERVER_JSON = "application/mcp-server+json" + +class CatalogNegotiationRefusedErrorKind(Enum): + NEGOTIATION_REFUSED = "negotiation-refused" + +# Experimental: this type is part of an experimental API and may change or be removed. +class CatalogNegotiationRefusedReason(Enum): + """Whether the version or the capability set was the problem. + + Why capability and protocol-version negotiation refused a caller + """ + UNSUPPORTED_CAPABILITY = "unsupported-capability" + UNSUPPORTED_PROTOCOL_VERSION = "unsupported-protocol-version" + +class CatalogNetworkFailureErrorKind(Enum): + NETWORK_FAILURE = "network-failure" + +# Experimental: this type is part of an experimental API and may change or be removed. +class CatalogNetworkFailureReason(Enum): + """Categorised failure, low cardinality so it can be aggregated without carrying a URL. + + Categorised network failure, low cardinality so it can be aggregated without carrying a + URL + """ + CONNECTION_REFUSED = "connection-refused" + DNS = "dns" + HTTP_STATUS = "http-status" + OFFLINE = "offline" + REDIRECT_REJECTED = "redirect-rejected" + RESPONSE_TOO_LARGE = "response-too-large" + TIMEOUT = "timeout" + TLS = "tls" + +class CatalogNotInstallableErrorKind(Enum): + NOT_INSTALLABLE = "not-installable" + +# Experimental: this type is part of an experimental API and may change or be removed. +class CatalogNotInstallableReason(Enum): + """Why the candidate cannot be installed. + + Why a discoverable candidate cannot be installed + """ + AI_SKILL_NOT_INSTALLABLE = "ai-skill-not-installable" + KIND_NOT_INSTALLABLE = "kind-not-installable" + POLICY_FORBIDS = "policy-forbids" + +class CatalogPolicyRejectedErrorKind(Enum): + POLICY_REJECTED = "policy-rejected" + +# Experimental: this type is part of an experimental API and may change or be removed. +class MCPPlanPolicySource(Enum): + """Which authority produced the decision. + + Which authority produced a policy decision + """ + ENTERPRISE_ALLOWLIST = "enterprise-allowlist" + LOCAL_TRUST = "local-trust" + NONE = "none" + REGISTRY_POLICY = "registry-policy" + +class CatalogSearchResultKind(Enum): + AUTHENTICATION_REQUIRED = "authentication-required" + CONTRACT_VIOLATION = "contract-violation" + INVALID_REQUEST = "invalid-request" + MALFORMED_CARD = "malformed-card" + NEGOTIATION_REFUSED = "negotiation-refused" + NETWORK_FAILURE = "network-failure" + POLICY_REJECTED = "policy-rejected" + SUCCEEDED = "succeeded" + UNAVAILABLE = "unavailable" + UNSAFE_RETRIEVAL = "unsafe-retrieval" + UNSUPPORTED_KIND = "unsupported-kind" + +class CatalogSearchResultReason(Enum): + """Whether the version or the capability set was the problem. + + Why capability and protocol-version negotiation refused a caller + + Why authentication failed. Only an expired credential justifies attempting a silent + refresh; an absent or rejected credential requires sign-in. + + Why the catalog authority did not accept the caller's identity + + Categorised failure, low cardinality so it can be aggregated without carrying a URL. + + Categorised network failure, low cardinality so it can be aggregated without carrying a + URL + + Which control refused the retrieval, low cardinality so it can be aggregated without + carrying a URL. + + Which hardened-fetch control refused a retrieval + + How the card failed validation. + + How a card failed validation + + Which rule the response broke. + + Which wire-contract rule an upstream response broke + + Why the operation is unavailable. + + Why a catalog operation is not available on this runtime + """ + AUTHORITY_NOT_CONFIGURED = "authority-not-configured" + BLOCKED_ADDRESS = "blocked-address" + BLOCKED_SCHEME = "blocked-scheme" + BOTH_URL_AND_DATA = "both-url-and-data" + CONNECTION_REFUSED = "connection-refused" + CREDENTIALS_IN_URL = "credentials-in-url" + CREDENTIAL_EXPIRED = "credential-expired" + CREDENTIAL_REJECTED = "credential-rejected" + DISABLED_BY_POLICY = "disabled-by-policy" + DNS = "dns" + DUPLICATE_IDENTITY = "duplicate-identity" + HOST_NOT_PERMITTED = "host-not-permitted" + HTTP_STATUS = "http-status" + INVALID_JSON = "invalid-json" + MISSING_REQUIRED_FIELD = "missing-required-field" + NEITHER_URL_NOR_DATA = "neither-url-nor-data" + NO_CREDENTIAL = "no-credential" + OFFLINE = "offline" + PLANNING_UNAVAILABLE = "planning-unavailable" + PROXY_REJECTED = "proxy-rejected" + REDIRECT_REJECTED = "redirect-rejected" + REDIRECT_TO_BLOCKED_ADDRESS = "redirect-to-blocked-address" + RESPONSE_TOO_LARGE = "response-too-large" + SCHEMA_VIOLATION = "schema-violation" + SEARCH_UNAVAILABLE = "search-unavailable" + SIZE_LIMIT_EXCEEDED = "size-limit-exceeded" + TIMEOUT = "timeout" + TLS = "tls" + UNKNOWN_MEDIA_TYPE = "unknown-media-type" + UNSUPPORTED_CAPABILITY = "unsupported-capability" + UNSUPPORTED_MEDIA_TYPE = "unsupported-media-type" + UNSUPPORTED_PROTOCOL_VERSION = "unsupported-protocol-version" + +class CatalogSearchSucceededKind(Enum): + SUCCEEDED = "succeeded" + +class CatalogUnavailableErrorKind(Enum): + UNAVAILABLE = "unavailable" + +# Experimental: this type is part of an experimental API and may change or be removed. +class CatalogUnavailableReason(Enum): + """Why the operation is unavailable. + + Why a catalog operation is not available on this runtime + """ + AUTHORITY_NOT_CONFIGURED = "authority-not-configured" + DISABLED_BY_POLICY = "disabled-by-policy" + PLANNING_UNAVAILABLE = "planning-unavailable" + SEARCH_UNAVAILABLE = "search-unavailable" + +class CatalogUnavailableTransportErrorKind(Enum): + UNAVAILABLE_TRANSPORT = "unavailable-transport" + +# Experimental: this type is part of an experimental API and may change or be removed. +class CatalogUnavailableTransportReason(Enum): + """Why no transport could be offered. + + Why no usable transport could be offered + """ + NO_ELIGIBLE_TRANSPORT = "no-eligible-transport" + REMOTE_ENUMERATION_UNAVAILABLE = "remote-enumeration-unavailable" + TRANSPORT_NOT_SUPPORTED = "transport-not-supported" + +class CatalogUnsafeRetrievalErrorKind(Enum): + UNSAFE_RETRIEVAL = "unsafe-retrieval" + +# Experimental: this type is part of an experimental API and may change or be removed. +class CatalogUnsafeRetrievalReason(Enum): + """Which control refused the retrieval, low cardinality so it can be aggregated without + carrying a URL. + + Which hardened-fetch control refused a retrieval + """ + BLOCKED_ADDRESS = "blocked-address" + BLOCKED_SCHEME = "blocked-scheme" + CREDENTIALS_IN_URL = "credentials-in-url" + HOST_NOT_PERMITTED = "host-not-permitted" + PROXY_REJECTED = "proxy-rejected" + REDIRECT_TO_BLOCKED_ADDRESS = "redirect-to-blocked-address" + +class CatalogUnsupportedKindErrorKind(Enum): + UNSUPPORTED_KIND = "unsupported-kind" + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SlashCommandInputChoice: @@ -3603,20 +4000,17 @@ def to_dict(self) -> dict: result["output"] = self.output return result -class PurpleSource(Enum): +class InstalledPluginSourceURLSource(Enum): GITHUB = "github" LOCAL = "local" URL = "url" -class FluffySource(Enum): +class PurpleSource(Enum): GITHUB = "github" -class TentacledSource(Enum): +class FluffySource(Enum): LOCAL = "local" -class StickySource(Enum): - URL = "url" - # Experimental: this type is part of an experimental API and may change or be removed. class InstructionLocation(Enum): """Which tier this target belongs to @@ -4825,6 +5219,164 @@ def to_dict(self) -> dict: result["timestamp"] = from_int(self.timestamp) return result +# Experimental: this type is part of an experimental API and may change or be removed. +class MCPPlanConfigurationOperation(Enum): + """Whether the change would create a new entry or modify an existing one. + + Whether a planned configuration change would create or modify an entry + """ + ADD = "add" + UPDATE = "update" + +# Experimental: this type is part of an experimental API and may change or be removed. +class MCPPlanScope(Enum): + """Scope the change would be written to. + + Configuration scope an MCP install plan targets + + Configuration scope the plan targets. + + Configuration scope the plan targets. Defaults to user scope when omitted. + """ + USER = "user" + +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class MCPPlanResourceIdentity: + """Normalised identity of the server the plan would install. + + Normalised identity of the MCP server a plan targets, independent of how the card spelled + it. + """ + canonical_name: str + """Canonical, normalised name of the server, for example `io.github.owner/server`.""" + + server_name: str + """Local configuration key the server would be recorded under.""" + + registry_id: str | None = None + """Registry identifier of the server, when it came from a registry.""" + + version: str | None = None + """Version advertised by the card, when it declares one.""" + + @staticmethod + def from_dict(obj: Any) -> 'MCPPlanResourceIdentity': + assert isinstance(obj, dict) + canonical_name = from_str(obj.get("canonicalName")) + server_name = from_str(obj.get("serverName")) + registry_id = from_union([from_str, from_none], obj.get("registryId")) + version = from_union([from_str, from_none], obj.get("version")) + return MCPPlanResourceIdentity(canonical_name, server_name, registry_id, version) + + def to_dict(self) -> dict: + result: dict = {} + result["canonicalName"] = from_str(self.canonical_name) + result["serverName"] = from_str(self.server_name) + if self.registry_id is not None: + result["registryId"] = from_union([from_str, from_none], self.registry_id) + if self.version is not None: + result["version"] = from_union([from_str, from_none], self.version) + return result + +# Experimental: this type is part of an experimental API and may change or be removed. +class MCPPlanPolicyDecision(Enum): + """What policy decided for this server. + + What policy decided for a planned server + """ + ALLOWED = "allowed" + BLOCKED = "blocked" + REQUIRES_APPROVAL = "requires-approval" + +class InstallMethod(Enum): + """Discriminator for a package-backed transport choice + + Discriminator for a remote-endpoint transport choice + """ + PACKAGE = "package" + REMOTE = "remote" + +# Experimental: this type is part of an experimental API and may change or be removed. +class MCPPlanValueCategory(Enum): + """Where the value is applied when the server is launched. + + Where a required value is applied when the planned server is launched + """ + ENVIRONMENT_VARIABLE = "environment-variable" + HEADER = "header" + PACKAGE_ARGUMENT = "package-argument" + RUNTIME_ARGUMENT = "runtime-argument" + URL_VARIABLE = "url-variable" + +class MCPPlanRequiredValueKind(Enum): + """Discriminator for a scalar required value + + Discriminator for an enumerated required value + """ + ENUM = "enum" + SCALAR = "scalar" + +class MCPPlanRequiredValueValueType(Enum): + """Scalar type the value must conform to. + + Scalar type a required value must conform to + + Discriminator for an enumerated required value + """ + BOOLEAN = "boolean" + ENUM = "enum" + NUMBER = "number" + PATH = "path" + STRING = "string" + +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class MCPPlanSecretPlaceholder: + """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. + """ + key: str + """Key the secret is supplied under. Inert untrusted data.""" + + placeholder: str + """The runtime-assigned `${secret:}` placeholder written into configuration in place of + the value. + """ + title: str | None = None + """Human-readable label from the card. Inert untrusted text.""" + + @staticmethod + def from_dict(obj: Any) -> 'MCPPlanSecretPlaceholder': + assert isinstance(obj, dict) + key = from_str(obj.get("key")) + placeholder = from_str(obj.get("placeholder")) + title = from_union([from_str, from_none], obj.get("title")) + return MCPPlanSecretPlaceholder(key, placeholder, title) + + def to_dict(self) -> dict: + result: dict = {} + result["key"] = from_str(self.key) + result["placeholder"] = from_str(self.placeholder) + if self.title is not None: + result["title"] = from_union([from_str, from_none], self.title) + return result + +class MCPPlanETransport(Enum): + """Local process transport this package choice would use. + + Transport exposed by a locally launched package + + Endpoint transport this remote choice would use. + + Transport exposed by a remote endpoint + """ + HTTP = "http" + SSE = "sse" + STDIO = "stdio" + STREAMABLE_HTTP = "streamable-http" + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPIsServerRunningRequest: @@ -5066,6 +5618,184 @@ def to_dict(self) -> dict: result["success"] = from_bool(self.success) return result +# Experimental: this type is part of an experimental API and may change or be removed. +class MCPPlan(Enum): + """Discriminator for an enumerated required value""" + + ENUM = "enum" + +class MCPPlanInstallPlannedKind(Enum): + PLANNED = "planned" + +class MCPPlanInstallSourceKind(Enum): + """Discriminator for a candidate-backed install-plan source + + Discriminator for a caller-supplied-card install-plan source + """ + CANDIDATE = "candidate" + CARD = "card" + +class MCPPlanInstallResultKind(Enum): + AUTHENTICATION_REQUIRED = "authentication-required" + CONTRACT_VIOLATION = "contract-violation" + HANDLE_REJECTED = "handle-rejected" + INVALID_REQUEST = "invalid-request" + MALFORMED_CARD = "malformed-card" + NEGOTIATION_REFUSED = "negotiation-refused" + NETWORK_FAILURE = "network-failure" + NOT_INSTALLABLE = "not-installable" + PLANNED = "planned" + POLICY_REJECTED = "policy-rejected" + UNAVAILABLE = "unavailable" + UNAVAILABLE_TRANSPORT = "unavailable-transport" + UNSAFE_RETRIEVAL = "unsafe-retrieval" + +class MCPPlanInstallResultReason(Enum): + """Whether the version or the capability set was the problem. + + Why capability and protocol-version negotiation refused a caller + + Why the handle was rejected. + + Why a presented handle was rejected + + Why authentication failed. Only an expired credential justifies attempting a silent + refresh; an absent or rejected credential requires sign-in. + + Why the catalog authority did not accept the caller's identity + + Categorised failure, low cardinality so it can be aggregated without carrying a URL. + + Categorised network failure, low cardinality so it can be aggregated without carrying a + URL + + Which control refused the retrieval, low cardinality so it can be aggregated without + carrying a URL. + + Which hardened-fetch control refused a retrieval + + How the card failed validation. + + How a card failed validation + + Which rule the response broke. + + Which wire-contract rule an upstream response broke + + Why no transport could be offered. + + Why no usable transport could be offered + + Why the candidate cannot be installed. + + Why a discoverable candidate cannot be installed + + Why the operation is unavailable. + + Why a catalog operation is not available on this runtime + """ + AI_SKILL_NOT_INSTALLABLE = "ai-skill-not-installable" + AUTHORITY_NOT_CONFIGURED = "authority-not-configured" + BLOCKED_ADDRESS = "blocked-address" + BLOCKED_SCHEME = "blocked-scheme" + BOTH_URL_AND_DATA = "both-url-and-data" + CONNECTION_REFUSED = "connection-refused" + CREDENTIALS_IN_URL = "credentials-in-url" + CREDENTIAL_EXPIRED = "credential-expired" + CREDENTIAL_REJECTED = "credential-rejected" + DISABLED_BY_POLICY = "disabled-by-policy" + DNS = "dns" + DUPLICATE_IDENTITY = "duplicate-identity" + FOREIGN = "foreign" + HOST_NOT_PERMITTED = "host-not-permitted" + HTTP_STATUS = "http-status" + INVALID = "invalid" + INVALID_JSON = "invalid-json" + KIND_NOT_INSTALLABLE = "kind-not-installable" + MISSING_REQUIRED_FIELD = "missing-required-field" + NEITHER_URL_NOR_DATA = "neither-url-nor-data" + NO_CREDENTIAL = "no-credential" + NO_ELIGIBLE_TRANSPORT = "no-eligible-transport" + OFFLINE = "offline" + PLANNING_UNAVAILABLE = "planning-unavailable" + POLICY_FORBIDS = "policy-forbids" + PROXY_REJECTED = "proxy-rejected" + REDIRECT_REJECTED = "redirect-rejected" + REDIRECT_TO_BLOCKED_ADDRESS = "redirect-to-blocked-address" + REMOTE_ENUMERATION_UNAVAILABLE = "remote-enumeration-unavailable" + REPLAYED = "replayed" + RESPONSE_TOO_LARGE = "response-too-large" + SCHEMA_VIOLATION = "schema-violation" + SEARCH_UNAVAILABLE = "search-unavailable" + SIZE_LIMIT_EXCEEDED = "size-limit-exceeded" + STALE = "stale" + TIMEOUT = "timeout" + TLS = "tls" + TRANSPORT_NOT_SUPPORTED = "transport-not-supported" + UNKNOWN_MEDIA_TYPE = "unknown-media-type" + UNSUPPORTED_CAPABILITY = "unsupported-capability" + UNSUPPORTED_MEDIA_TYPE = "unsupported-media-type" + UNSUPPORTED_PROTOCOL_VERSION = "unsupported-protocol-version" + +# Experimental: this type is part of an experimental API and may change or be removed. +class MCPPlanInstallSourceCandidateKind(Enum): + """Discriminator for a candidate-backed install-plan source""" + + CANDIDATE = "candidate" + +# Experimental: this type is part of an experimental API and may change or be removed. +class MCPPlanInstallSourceCardKind(Enum): + """Discriminator for a caller-supplied-card install-plan source""" + + CARD = "card" + +# Experimental: this type is part of an experimental API and may change or be removed. +class MCPPlanPackageInstallMethod(Enum): + """Discriminator for a package-backed transport choice""" + + PACKAGE = "package" + +# Experimental: this type is part of an experimental API and may change or be removed. +class MCPPlanPackageTransport(Enum): + """Local process transport this package choice would use. + + Transport exposed by a locally launched package + """ + STDIO = "stdio" + +# Experimental: this type is part of an experimental API and may change or be removed. +class MCPPlanRemoteInstallMethod(Enum): + """Discriminator for a remote-endpoint transport choice""" + + REMOTE = "remote" + +# Experimental: this type is part of an experimental API and may change or be removed. +class MCPPlanRemoteTransport(Enum): + """Endpoint transport this remote choice would use. + + Transport exposed by a remote endpoint + """ + HTTP = "http" + SSE = "sse" + STREAMABLE_HTTP = "streamable-http" + +# Experimental: this type is part of an experimental API and may change or be removed. +class MCPPlanRequiredValueScalarKind(Enum): + """Discriminator for a scalar required value""" + + SCALAR = "scalar" + +# Experimental: this type is part of an experimental API and may change or be removed. +class MCPPlanScalarValueTypeEnum(Enum): + """Scalar type the value must conform to. + + Scalar type a required value must conform to + """ + BOOLEAN = "boolean" + NUMBER = "number" + PATH = "path" + STRING = "string" + class MCPServerConfigType(Enum): """Local transport type. Defaults to stdio when omitted. @@ -6084,6 +6814,28 @@ def to_dict(self) -> dict: result["selectionId"] = from_union([from_str, from_none], self.selection_id) return result +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class MoveMCPLoadingToBackgroundResult: + """Result of moving in-flight MCP loading to the background.""" + + moved_to_background: bool + """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. + """ + + @staticmethod + def from_dict(obj: Any) -> 'MoveMCPLoadingToBackgroundResult': + assert isinstance(obj, dict) + moved_to_background = from_bool(obj.get("movedToBackground")) + return MoveMCPLoadingToBackgroundResult(moved_to_background) + + def to_dict(self) -> dict: + result: dict = {} + result["movedToBackground"] = from_bool(self.moved_to_background) + return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class NameGetResult: @@ -6404,9 +7156,9 @@ class PermissionDecisionSource(Enum): Controlled reason or actor responsible for a permission response. """ + ASSISTED_APPROVAL = "assisted_approval" HOST_POLICY = "host_policy" HUMAN_RESPONSE = "human_response" - JUDGE_RECOMMENDATION = "judge_recommendation" UNATTENDED_FALLBACK = "unattended_fallback" # Experimental: this type is part of an experimental API and may change or be removed. @@ -6810,15 +7562,34 @@ def to_dict(self) -> dict: # Experimental: this type is part of an experimental API and may change or be removed. @dataclass -class PermissionsGetAllowAllRequest: +class PermissionsGetModeRequest: """No parameters.""" @staticmethod - def from_dict(obj: Any) -> 'PermissionsGetAllowAllRequest': + def from_dict(obj: Any) -> 'PermissionsGetModeRequest': + assert isinstance(obj, dict) + return PermissionsGetModeRequest() + + def to_dict(self) -> dict: + result: dict = {} + return result + +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class PermissionsGetModeResult: + """Current permission mode.""" + + mode: PermissionMode + """Current permission mode""" + + @staticmethod + def from_dict(obj: Any) -> 'PermissionsGetModeResult': assert isinstance(obj, dict) - return PermissionsGetAllowAllRequest() + mode = PermissionMode(obj.get("mode")) + return PermissionsGetModeResult(mode) def to_dict(self) -> dict: result: dict = {} + result["mode"] = to_enum(PermissionMode, self.mode) return result # Experimental: this type is part of an experimental API and may change or be removed. @@ -7008,6 +7779,31 @@ def to_dict(self) -> dict: result["success"] = from_bool(self.success) return result +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class PermissionsSetModeResult: + """Indicates whether the requested permission mode was applied and reports the authoritative + post-mutation mode. + """ + mode: PermissionMode + """Authoritative permission mode after the mutation""" + + success: bool + """Whether the operation succeeded""" + + @staticmethod + def from_dict(obj: Any) -> 'PermissionsSetModeResult': + assert isinstance(obj, dict) + mode = PermissionMode(obj.get("mode")) + success = from_bool(obj.get("success")) + return PermissionsSetModeResult(mode, success) + + def to_dict(self) -> dict: + result: dict = {} + result["mode"] = to_enum(PermissionMode, self.mode) + result["success"] = from_bool(self.success) + return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsSetRequiredRequest: @@ -7153,6 +7949,12 @@ class PlanSQLTodosRow: """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. """ + created_at: str | None = None + """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. + """ description: str | None = None """Todo description.""" @@ -7168,14 +7970,17 @@ class PlanSQLTodosRow: @staticmethod def from_dict(obj: Any) -> 'PlanSQLTodosRow': assert isinstance(obj, dict) + created_at = from_union([from_str, from_none], obj.get("createdAt")) description = from_union([from_str, from_none], obj.get("description")) id = from_union([from_str, from_none], obj.get("id")) status = from_union([from_str, from_none], obj.get("status")) title = from_union([from_str, from_none], obj.get("title")) - return PlanSQLTodosRow(description, id, status, title) + return PlanSQLTodosRow(created_at, description, id, status, title) def to_dict(self) -> dict: result: dict = {} + if self.created_at is not None: + result["createdAt"] = from_union([from_str, from_none], self.created_at) if self.description is not None: result["description"] = from_union([from_str, from_none], self.description) if self.id is not None: @@ -11173,9 +11978,6 @@ class SessionsOpenCreateKind(Enum): class SessionsOpenHandoffKind(Enum): HANDOFF = "handoff" -class SessionsOpenRemoteKind(Enum): - REMOTE = "remote" - class SessionsOpenResumeKind(Enum): RESUME = "resume" @@ -13048,9 +13850,6 @@ def to_dict(self) -> dict: result["tokenCount"] = from_int(self.token_count) return result -class UserAuthInfoType(Enum): - USER = "user" - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UserSettingMetadata: @@ -13769,61 +14568,6 @@ def to_dict(self) -> dict: result["field"] = from_union([lambda x: to_enum(AgentRegistrySpawnValidationErrorField, x), from_none], self.field) return result -# Experimental: this type is part of an experimental API and may change or be removed. -@dataclass -class AllowAllPermissionSetResult: - """Indicates whether the operation succeeded and reports the post-mutation state.""" - - enabled: bool - """Authoritative full allow-all state after the mutation""" - - success: bool - """Whether the operation succeeded""" - - mode: PermissionsAllowAllMode | None = None - """Authoritative allow-all mode after the mutation""" - - @staticmethod - def from_dict(obj: Any) -> 'AllowAllPermissionSetResult': - assert isinstance(obj, dict) - enabled = from_bool(obj.get("enabled")) - success = from_bool(obj.get("success")) - mode = from_union([PermissionsAllowAllMode, from_none], obj.get("mode")) - return AllowAllPermissionSetResult(enabled, success, mode) - - def to_dict(self) -> dict: - result: dict = {} - result["enabled"] = from_bool(self.enabled) - result["success"] = from_bool(self.success) - if self.mode is not None: - result["mode"] = from_union([lambda x: to_enum(PermissionsAllowAllMode, x), from_none], self.mode) - return result - -# Experimental: this type is part of an experimental API and may change or be removed. -@dataclass -class AllowAllPermissionState: - """Current allow-all permission mode.""" - - enabled: bool - """Whether full allow-all permissions are currently active""" - - mode: PermissionsAllowAllMode | None = None - """Current allow-all mode""" - - @staticmethod - def from_dict(obj: Any) -> 'AllowAllPermissionState': - assert isinstance(obj, dict) - enabled = from_bool(obj.get("enabled")) - mode = from_union([PermissionsAllowAllMode, from_none], obj.get("mode")) - return AllowAllPermissionState(enabled, mode) - - def to_dict(self) -> dict: - result: dict = {} - result["enabled"] = from_bool(self.enabled) - if self.mode is not None: - result["mode"] = from_union([lambda x: to_enum(PermissionsAllowAllMode, x), from_none], self.mode) - return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class BuiltInModelCatalog: @@ -13892,6 +14636,734 @@ def to_dict(self) -> dict: result["type"] = to_enum(BuiltinToolInputSchemaType, self.type) return result +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class CardDigest: + """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. + + Semantic digest of the exact validated JSON content bound to the plan handle. + """ + algorithm: CardDigestAlgorithm + """Digest algorithm and canonical representation""" + + value: str + """SHA-256 digest of the RFC 8785 canonical UTF-8 bytes, encoded as exactly 64 lowercase + hexadecimal characters. + """ + + @staticmethod + def from_dict(obj: Any) -> 'CardDigest': + assert isinstance(obj, dict) + algorithm = CardDigestAlgorithm(obj.get("algorithm")) + value = from_str(obj.get("value")) + return CardDigest(algorithm, value) + + def to_dict(self) -> dict: + result: dict = {} + result["algorithm"] = to_enum(CardDigestAlgorithm, self.algorithm) + result["value"] = from_str(self.value) + return result + +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class CatalogAuthenticationRequiredError: + """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. + """ + kind: ClassVar[str] = "authentication-required" + """Discriminator: the caller is not authenticated""" + + message: str + """Human-readable explanation, safe to surface. Never contains a credential or token, nor a + query, URL, handle, or secret. + """ + reason: CatalogAuthenticationRequiredReason + """Why authentication failed. Only an expired credential justifies attempting a silent + refresh; an absent or rejected credential requires sign-in. + """ + + @staticmethod + def from_dict(obj: Any) -> 'CatalogAuthenticationRequiredError': + assert isinstance(obj, dict) + message = from_str(obj.get("message")) + reason = CatalogAuthenticationRequiredReason(obj.get("reason")) + return CatalogAuthenticationRequiredError(message, reason) + + def to_dict(self) -> dict: + result: dict = {} + result["kind"] = self.kind + result["message"] = from_str(self.message) + result["reason"] = to_enum(CatalogAuthenticationRequiredReason, self.reason) + return result + +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class CatalogCandidateSourceEmbedded: + """Candidate whose card reference arrived inline. The document and its content-derived + properties stay behind the runtime boundary. + """ + kind: ClassVar[str] = "embedded" + """Discriminator: the card is embedded, and carries no URL""" + + @staticmethod + def from_dict(obj: Any) -> 'CatalogCandidateSourceEmbedded': + assert isinstance(obj, dict) + return CatalogCandidateSourceEmbedded() + + def to_dict(self) -> dict: + result: dict = {} + result["kind"] = self.kind + return result + +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class CatalogCandidateSourceURL: + """Candidate whose card is retrieved from a URL through the runtime's hardened fetch + boundary. + """ + kind: ClassVar[str] = "url" + """Discriminator: the card is URL-backed, and carries no embedded data""" + + url: str + """Card URL as advertised. Inert untrusted data: the runtime retrieves it only through its + own hardened boundary, and it is never logged. + """ + + @staticmethod + def from_dict(obj: Any) -> 'CatalogCandidateSourceURL': + assert isinstance(obj, dict) + url = from_str(obj.get("url")) + return CatalogCandidateSourceURL(url) + + def to_dict(self) -> dict: + result: dict = {} + result["kind"] = self.kind + result["url"] = from_str(self.url) + return result + +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class InstalledPluginSourceURL: + """Source descriptor for a direct URL plugin install, with URL, optional ref or full commit + SHA, and optional subpath. + """ + source: MCPServerCardURLKind + """Constant value. Always "url".""" + + url: str + """URL of the plugin source.""" + + path: str | None = None + """Optional source-relative path to the plugin.""" + + ref: str | None = None + """Optional Git ref to resolve.""" + + sha: str | None = None + """Optional full 40-character hexadecimal commit SHA.""" + + @staticmethod + def from_dict(obj: Any) -> 'InstalledPluginSourceURL': + assert isinstance(obj, dict) + source = MCPServerCardURLKind(obj.get("source")) + url = from_str(obj.get("url")) + path = from_union([from_str, from_none], obj.get("path")) + ref = from_union([from_str, from_none], obj.get("ref")) + sha = from_union([from_str, from_none], obj.get("sha")) + return InstalledPluginSourceURL(source, url, path, ref, sha) + + def to_dict(self) -> dict: + result: dict = {} + result["source"] = to_enum(MCPServerCardURLKind, self.source) + result["url"] = from_str(self.url) + if self.path is not None: + result["path"] = from_union([from_str, from_none], self.path) + if self.ref is not None: + result["ref"] = from_union([from_str, from_none], self.ref) + if self.sha is not None: + result["sha"] = from_union([from_str, from_none], self.sha) + return result + +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class SessionInstalledPluginSourceURL: + """Source descriptor for a direct URL plugin install, with URL, optional ref or full commit + SHA, and optional subpath. + """ + source: MCPServerCardURLKind + """Constant value. Always "url".""" + + url: str + """URL of the plugin source.""" + + path: str | None = None + """Optional source-relative path to the plugin.""" + + ref: str | None = None + """Optional Git ref to resolve.""" + + sha: str | None = None + """Optional full 40-character hexadecimal commit SHA.""" + + @staticmethod + def from_dict(obj: Any) -> 'SessionInstalledPluginSourceURL': + assert isinstance(obj, dict) + source = MCPServerCardURLKind(obj.get("source")) + url = from_str(obj.get("url")) + path = from_union([from_str, from_none], obj.get("path")) + ref = from_union([from_str, from_none], obj.get("ref")) + sha = from_union([from_str, from_none], obj.get("sha")) + return SessionInstalledPluginSourceURL(source, url, path, ref, sha) + + def to_dict(self) -> dict: + result: dict = {} + result["source"] = to_enum(MCPServerCardURLKind, self.source) + result["url"] = from_str(self.url) + if self.path is not None: + result["path"] = from_union([from_str, from_none], self.path) + if self.ref is not None: + result["ref"] = from_union([from_str, from_none], self.ref) + if self.sha is not None: + result["sha"] = from_union([from_str, from_none], self.sha) + return result + +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class CatalogNegotiatedContract: + """The protocol version and capability set the runtime actually honoured for a successful + catalog operation. + + Protocol version and capabilities the runtime honoured. + """ + granted_capabilities: list[CatalogCapability] + """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. + """ + runtime_protocol_version: int + """Protocol version of the runtime that served the request.""" + + @staticmethod + def from_dict(obj: Any) -> 'CatalogNegotiatedContract': + assert isinstance(obj, dict) + granted_capabilities = from_list(CatalogCapability, obj.get("grantedCapabilities")) + runtime_protocol_version = from_int(obj.get("runtimeProtocolVersion")) + return CatalogNegotiatedContract(granted_capabilities, runtime_protocol_version) + + def to_dict(self) -> dict: + result: dict = {} + result["grantedCapabilities"] = from_list(lambda x: to_enum(CatalogCapability, x), self.granted_capabilities) + result["runtimeProtocolVersion"] = from_int(self.runtime_protocol_version) + return result + +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class CatalogSearchRequest: + """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. + """ + contract: CatalogClientContract + """Protocol version and capabilities the caller requires.""" + + query: str + """Free-text search query. Never written to logs or telemetry.""" + + kinds: list[CatalogCandidateKind] | None = None + """Restrict results to these candidate kinds. When omitted, every kind the runtime supports + is searched. + """ + limit: int | None = None + """Maximum number of candidates to return. Defaults to 10 when omitted.""" + + @staticmethod + def from_dict(obj: Any) -> 'CatalogSearchRequest': + assert isinstance(obj, dict) + contract = CatalogClientContract.from_dict(obj.get("contract")) + query = from_str(obj.get("query")) + kinds = from_union([lambda x: from_list(CatalogCandidateKind, x), from_none], obj.get("kinds")) + limit = from_union([from_int, from_none], obj.get("limit")) + return CatalogSearchRequest(contract, query, kinds, limit) + + def to_dict(self) -> dict: + result: dict = {} + result["contract"] = to_class(CatalogClientContract, self.contract) + result["query"] = from_str(self.query) + if self.kinds is not None: + result["kinds"] = from_union([lambda x: from_list(lambda x: to_enum(CatalogCandidateKind, x), x), from_none], self.kinds) + if self.limit is not None: + result["limit"] = from_union([from_int, from_none], self.limit) + return result + +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class CatalogContractViolationError: + """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. + """ + kind: ClassVar[str] = "contract-violation" + """Discriminator: the upstream response broke the contract""" + + message: str + """Human-readable explanation, safe to surface. Never echoes response content, nor a query, + URL, handle, or secret. + """ + reason: CatalogContractViolationReason + """Which rule the response broke.""" + + @staticmethod + def from_dict(obj: Any) -> 'CatalogContractViolationError': + assert isinstance(obj, dict) + message = from_str(obj.get("message")) + reason = CatalogContractViolationReason(obj.get("reason")) + return CatalogContractViolationError(message, reason) + + def to_dict(self) -> dict: + result: dict = {} + result["kind"] = self.kind + result["message"] = from_str(self.message) + result["reason"] = to_enum(CatalogContractViolationReason, self.reason) + return result + +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class CatalogHandleRejectedError: + """A presented handle was not accepted. Handles are runtime-instance scoped, TTL-bound, and + single-use, so each way of failing is reported distinctly. + """ + handle_type: CatalogHandleType + """Which kind of handle was presented.""" + + kind: ClassVar[str] = "handle-rejected" + """Discriminator: a handle was rejected""" + + message: str + """Human-readable explanation, safe to surface. Never contains the handle itself, nor a + query, URL, or secret. + """ + reason: CatalogHandleRejectionReason + """Why the handle was rejected.""" + + @staticmethod + def from_dict(obj: Any) -> 'CatalogHandleRejectedError': + assert isinstance(obj, dict) + handle_type = CatalogHandleType(obj.get("handleType")) + message = from_str(obj.get("message")) + reason = CatalogHandleRejectionReason(obj.get("reason")) + return CatalogHandleRejectedError(handle_type, message, reason) + + def to_dict(self) -> dict: + result: dict = {} + result["handleType"] = to_enum(CatalogHandleType, self.handle_type) + result["kind"] = self.kind + result["message"] = from_str(self.message) + result["reason"] = to_enum(CatalogHandleRejectionReason, self.reason) + return result + +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class CatalogInvalidRequestError: + """The request was rejected before any work was done, because a bounded field fell outside + its permitted range or a required field was unusable. + """ + field: CatalogInvalidRequestField + """Which request field was rejected.""" + + kind: ClassVar[str] = "invalid-request" + """Discriminator: the request itself was invalid""" + + message: str + """Human-readable explanation, safe to surface. Never echoes the offending value, nor a + query, URL, handle, or secret. + """ + + @staticmethod + def from_dict(obj: Any) -> 'CatalogInvalidRequestError': + assert isinstance(obj, dict) + field = CatalogInvalidRequestField(obj.get("field")) + message = from_str(obj.get("message")) + return CatalogInvalidRequestError(field, message) + + def to_dict(self) -> dict: + result: dict = {} + result["field"] = to_enum(CatalogInvalidRequestField, self.field) + result["kind"] = self.kind + result["message"] = from_str(self.message) + return result + +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class CatalogMalformedCardError: + """A card could not be parsed or did not satisfy its declared media type's schema.""" + + kind: ClassVar[str] = "malformed-card" + """Discriminator: the card was malformed""" + + message: str + """Human-readable explanation, safe to surface. Never echoes card content, nor a query, URL, + handle, or secret. + """ + reason: CatalogMalformedCardReason + """How the card failed validation.""" + + media_type: CatalogMediaType | None = None + """Media type the card was interpreted as, when it declared one this runtime recognises.""" + + @staticmethod + def from_dict(obj: Any) -> 'CatalogMalformedCardError': + assert isinstance(obj, dict) + message = from_str(obj.get("message")) + reason = CatalogMalformedCardReason(obj.get("reason")) + media_type = from_union([CatalogMediaType, from_none], obj.get("mediaType")) + return CatalogMalformedCardError(message, reason, media_type) + + def to_dict(self) -> dict: + result: dict = {} + result["kind"] = self.kind + result["message"] = from_str(self.message) + result["reason"] = to_enum(CatalogMalformedCardReason, self.reason) + if self.media_type is not None: + result["mediaType"] = from_union([lambda x: to_enum(CatalogMediaType, x), from_none], self.media_type) + return result + +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class MCPServerCardEmbedded: + """An MCP server card supplied inline as an inert document.""" + + data: str + """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. + """ + kind: ClassVar[str] = "embedded" + """Discriminator: the card is embedded, and carries no URL""" + + media_type: MCPServerCardMediaType + """Media type the card is expected to conform to.""" + + @staticmethod + def from_dict(obj: Any) -> 'MCPServerCardEmbedded': + assert isinstance(obj, dict) + data = from_str(obj.get("data")) + media_type = MCPServerCardMediaType(obj.get("mediaType")) + return MCPServerCardEmbedded(data, media_type) + + def to_dict(self) -> dict: + result: dict = {} + result["data"] = from_str(self.data) + result["kind"] = self.kind + result["mediaType"] = to_enum(MCPServerCardMediaType, self.media_type) + return result + +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class MCPServerCardURL: + """An MCP server card to be retrieved from a URL through the runtime's hardened fetch + boundary. + """ + kind: ClassVar[str] = "url" + """Discriminator: the card is URL-backed, and carries no embedded data""" + + media_type: MCPServerCardMediaType + """Media type the card is expected to conform to.""" + + url: str + """Card URL. Retrieved only through the runtime's hardened boundary, with scheme, + credential, address-range, redirect, timeout, and response-size controls applied. Never + logged. + """ + + @staticmethod + def from_dict(obj: Any) -> 'MCPServerCardURL': + assert isinstance(obj, dict) + media_type = MCPServerCardMediaType(obj.get("mediaType")) + url = from_str(obj.get("url")) + return MCPServerCardURL(media_type, url) + + def to_dict(self) -> dict: + result: dict = {} + result["kind"] = self.kind + result["mediaType"] = to_enum(MCPServerCardMediaType, self.media_type) + result["url"] = from_str(self.url) + return result + +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class CatalogNegotiationRefusedError: + """The caller's protocol version or required capabilities cannot be honoured. Returned + instead of a partial or ambiguous success. + """ + kind: ClassVar[str] = "negotiation-refused" + """Discriminator: capability or protocol-version negotiation failed""" + + message: str + """Human-readable explanation, safe to surface. Never contains a query, URL, handle, or + secret. + """ + minimum_supported_protocol_version: int + """Lowest caller protocol version this runtime will serve.""" + + reason: CatalogNegotiationRefusedReason + """Whether the version or the capability set was the problem.""" + + runtime_protocol_version: int + """Protocol version of the runtime that refused the request.""" + + supported_capabilities: list[CatalogCapability] + """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. + """ + unsupported_capabilities: list[str] + """The subset of the caller's bounded extensible capability identifiers this runtime cannot + honour. + """ + + @staticmethod + def from_dict(obj: Any) -> 'CatalogNegotiationRefusedError': + assert isinstance(obj, dict) + message = from_str(obj.get("message")) + minimum_supported_protocol_version = from_int(obj.get("minimumSupportedProtocolVersion")) + reason = CatalogNegotiationRefusedReason(obj.get("reason")) + runtime_protocol_version = from_int(obj.get("runtimeProtocolVersion")) + supported_capabilities = from_list(CatalogCapability, obj.get("supportedCapabilities")) + unsupported_capabilities = from_list(from_str, obj.get("unsupportedCapabilities")) + return CatalogNegotiationRefusedError(message, minimum_supported_protocol_version, reason, runtime_protocol_version, supported_capabilities, unsupported_capabilities) + + def to_dict(self) -> dict: + result: dict = {} + result["kind"] = self.kind + result["message"] = from_str(self.message) + result["minimumSupportedProtocolVersion"] = from_int(self.minimum_supported_protocol_version) + result["reason"] = to_enum(CatalogNegotiationRefusedReason, self.reason) + result["runtimeProtocolVersion"] = from_int(self.runtime_protocol_version) + result["supportedCapabilities"] = from_list(lambda x: to_enum(CatalogCapability, x), self.supported_capabilities) + result["unsupportedCapabilities"] = from_list(from_str, self.unsupported_capabilities) + return result + +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class CatalogNetworkFailureError: + """The runtime could not reach the catalog authority or retrieve a card. Covers being + offline as well as transport-level failure. + """ + kind: ClassVar[str] = "network-failure" + """Discriminator: the network operation failed""" + + message: str + """Human-readable explanation, safe to surface. Never contains a query, URL, handle, or + secret. + """ + reason: CatalogNetworkFailureReason + """Categorised failure, low cardinality so it can be aggregated without carrying a URL.""" + + status_code: int | None = None + """HTTP status code, when the failure was a rejected response.""" + + @staticmethod + def from_dict(obj: Any) -> 'CatalogNetworkFailureError': + assert isinstance(obj, dict) + message = from_str(obj.get("message")) + reason = CatalogNetworkFailureReason(obj.get("reason")) + status_code = from_union([from_int, from_none], obj.get("statusCode")) + return CatalogNetworkFailureError(message, reason, status_code) + + def to_dict(self) -> dict: + result: dict = {} + result["kind"] = self.kind + result["message"] = from_str(self.message) + result["reason"] = to_enum(CatalogNetworkFailureReason, self.reason) + if self.status_code is not None: + result["statusCode"] = from_union([from_int, from_none], self.status_code) + return result + +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class CatalogNotInstallableError: + """The candidate is discoverable but cannot be installed. `application/ai-skill` resolves + here, because it stays searchable while remaining typed non-installable. + """ + kind: ClassVar[str] = "not-installable" + """Discriminator: the candidate cannot be installed""" + + message: str + """Human-readable explanation, safe to surface. Never contains a query, URL, handle, or + secret. + """ + reason: CatalogNotInstallableReason + """Why the candidate cannot be installed.""" + + @staticmethod + def from_dict(obj: Any) -> 'CatalogNotInstallableError': + assert isinstance(obj, dict) + message = from_str(obj.get("message")) + reason = CatalogNotInstallableReason(obj.get("reason")) + return CatalogNotInstallableError(message, reason) + + def to_dict(self) -> dict: + result: dict = {} + result["kind"] = self.kind + result["message"] = from_str(self.message) + result["reason"] = to_enum(CatalogNotInstallableReason, self.reason) + return result + +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class CatalogPolicyRejectedError: + """Registry or enterprise policy refused the operation.""" + + kind: ClassVar[str] = "policy-rejected" + """Discriminator: policy refused the operation""" + + message: str + """Human-readable explanation, safe to surface. Never contains a query, URL, handle, or + secret. + """ + source: MCPPlanPolicySource + """Which authority produced the decision.""" + + @staticmethod + def from_dict(obj: Any) -> 'CatalogPolicyRejectedError': + assert isinstance(obj, dict) + message = from_str(obj.get("message")) + source = MCPPlanPolicySource(obj.get("source")) + return CatalogPolicyRejectedError(message, source) + + def to_dict(self) -> dict: + result: dict = {} + result["kind"] = self.kind + result["message"] = from_str(self.message) + result["source"] = to_enum(MCPPlanPolicySource, self.source) + return result + +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class CatalogUnavailableError: + """The operation is not available on this runtime. Distinct from a network failure: nothing + was attempted. + """ + kind: ClassVar[str] = "unavailable" + """Discriminator: the operation is not available""" + + message: str + """Human-readable explanation, safe to surface. Never contains a query, URL, handle, or + secret. + """ + reason: CatalogUnavailableReason + """Why the operation is unavailable.""" + + @staticmethod + def from_dict(obj: Any) -> 'CatalogUnavailableError': + assert isinstance(obj, dict) + message = from_str(obj.get("message")) + reason = CatalogUnavailableReason(obj.get("reason")) + return CatalogUnavailableError(message, reason) + + def to_dict(self) -> dict: + result: dict = {} + result["kind"] = self.kind + result["message"] = from_str(self.message) + result["reason"] = to_enum(CatalogUnavailableReason, self.reason) + return result + +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class CatalogUnavailableTransportError: + """No transport this runtime can use is available for the requested server.""" + + kind: ClassVar[str] = "unavailable-transport" + """Discriminator: no usable transport is available""" + + message: str + """Human-readable explanation, safe to surface. Never contains a query, URL, handle, or + secret. + """ + reason: CatalogUnavailableTransportReason + """Why no transport could be offered.""" + + @staticmethod + def from_dict(obj: Any) -> 'CatalogUnavailableTransportError': + assert isinstance(obj, dict) + message = from_str(obj.get("message")) + reason = CatalogUnavailableTransportReason(obj.get("reason")) + return CatalogUnavailableTransportError(message, reason) + + def to_dict(self) -> dict: + result: dict = {} + result["kind"] = self.kind + result["message"] = from_str(self.message) + result["reason"] = to_enum(CatalogUnavailableTransportReason, self.reason) + return result + +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class CatalogUnsafeRetrievalError: + """Retrieval was refused by the runtime's hardened fetch boundary before any request left + the process, or before a redirect was followed. + """ + kind: ClassVar[str] = "unsafe-retrieval" + """Discriminator: retrieval was refused as unsafe""" + + message: str + """Human-readable explanation, safe to surface. Never contains the refused URL, nor a query, + handle, or secret. + """ + reason: CatalogUnsafeRetrievalReason + """Which control refused the retrieval, low cardinality so it can be aggregated without + carrying a URL. + """ + + @staticmethod + def from_dict(obj: Any) -> 'CatalogUnsafeRetrievalError': + assert isinstance(obj, dict) + message = from_str(obj.get("message")) + reason = CatalogUnsafeRetrievalReason(obj.get("reason")) + return CatalogUnsafeRetrievalError(message, reason) + + def to_dict(self) -> dict: + result: dict = {} + result["kind"] = self.kind + result["message"] = from_str(self.message) + result["reason"] = to_enum(CatalogUnsafeRetrievalReason, self.reason) + return result + +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class CatalogUnsupportedKindError: + """The request asked for a candidate kind this runtime does not serve.""" + + kind: ClassVar[str] = "unsupported-kind" + """Discriminator: an unsupported candidate kind was requested""" + + message: str + """Human-readable explanation, safe to surface. Never contains a query, URL, handle, or + secret. + """ + requested_kinds: list[CatalogCandidateKind] + """The kinds from the request that are not supported.""" + + supported_kinds: list[CatalogCandidateKind] + """Every candidate kind this runtime can serve.""" + + @staticmethod + def from_dict(obj: Any) -> 'CatalogUnsupportedKindError': + assert isinstance(obj, dict) + message = from_str(obj.get("message")) + requested_kinds = from_list(CatalogCandidateKind, obj.get("requestedKinds")) + supported_kinds = from_list(CatalogCandidateKind, obj.get("supportedKinds")) + return CatalogUnsupportedKindError(message, requested_kinds, supported_kinds) + + def to_dict(self) -> dict: + result: dict = {} + result["kind"] = self.kind + result["message"] = from_str(self.message) + result["requestedKinds"] = from_list(lambda x: to_enum(CatalogCandidateKind, x), self.requested_kinds) + result["supportedKinds"] = from_list(lambda x: to_enum(CatalogCandidateKind, x), self.supported_kinds) + return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SlashCommandInput: @@ -14293,6 +15765,119 @@ def to_dict(self) -> dict: result["url"] = from_union([from_str, from_none], self.url) return result +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class CatalogAISkillCandidateProvenance: + """Where the catalog reference was observed, without the card itself or any content digest. + + 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. + """ + authority: str + """Host of the catalog authority that advertised the reference, without path, query, or + credentials. Inert untrusted data. + """ + media_type: MediaType + """Media type advertised for the referenced AI skill card""" + + observed_at: str + """ISO 8601 timestamp at which the runtime observed the catalog reference. This is not a + retrieval or validation timestamp. + """ + + @staticmethod + def from_dict(obj: Any) -> 'CatalogAISkillCandidateProvenance': + assert isinstance(obj, dict) + authority = from_str(obj.get("authority")) + media_type = MediaType(obj.get("mediaType")) + observed_at = from_str(obj.get("observedAt")) + return CatalogAISkillCandidateProvenance(authority, media_type, observed_at) + + def to_dict(self) -> dict: + result: dict = {} + result["authority"] = from_str(self.authority) + result["mediaType"] = to_enum(MediaType, self.media_type) + result["observedAt"] = from_str(self.observed_at) + return result + +@dataclass +class CatalogCandidateProvenance: + """Where the catalog reference was observed, without the card itself or any content digest. + + 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. + + 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. + """ + authority: str + """Host of the catalog authority that advertised the reference, without path, query, or + credentials. Inert untrusted data. + """ + media_type: CatalogMediaType + """JSON MCP media type advertised for the referenced card. + + Media type advertised for the referenced AI skill card + """ + observed_at: str + """ISO 8601 timestamp at which the runtime observed the catalog reference. This is not a + retrieval or validation timestamp. + """ + + @staticmethod + def from_dict(obj: Any) -> 'CatalogCandidateProvenance': + assert isinstance(obj, dict) + authority = from_str(obj.get("authority")) + media_type = CatalogMediaType(obj.get("mediaType")) + observed_at = from_str(obj.get("observedAt")) + return CatalogCandidateProvenance(authority, media_type, observed_at) + + def to_dict(self) -> dict: + result: dict = {} + result["authority"] = from_str(self.authority) + result["mediaType"] = to_enum(CatalogMediaType, self.media_type) + result["observedAt"] = from_str(self.observed_at) + return result + +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class CatalogMCPServerCandidateProvenance: + """Where the catalog reference was observed, without the card itself or any content digest. + + 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. + """ + authority: str + """Host of the catalog authority that advertised the reference, without path, query, or + credentials. Inert untrusted data. + """ + media_type: MCPServerCardMediaType + """JSON MCP media type advertised for the referenced card.""" + + observed_at: str + """ISO 8601 timestamp at which the runtime observed the catalog reference. This is not a + retrieval or validation timestamp. + """ + + @staticmethod + def from_dict(obj: Any) -> 'CatalogMCPServerCandidateProvenance': + assert isinstance(obj, dict) + authority = from_str(obj.get("authority")) + media_type = MCPServerCardMediaType(obj.get("mediaType")) + observed_at = from_str(obj.get("observedAt")) + return CatalogMCPServerCandidateProvenance(authority, media_type, observed_at) + + def to_dict(self) -> dict: + result: dict = {} + result["authority"] = from_str(self.authority) + result["mediaType"] = to_enum(MCPServerCardMediaType, self.media_type) + result["observedAt"] = from_str(self.observed_at) + return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CompletionsRequestResult: @@ -15607,7 +17192,7 @@ class InstalledPluginSource: Source descriptor for a direct local plugin install, with a local filesystem path. """ - source: PurpleSource + source: InstalledPluginSourceURLSource """Constant value. Always "github". Constant value. Always "url". @@ -15636,7 +17221,7 @@ class InstalledPluginSource: @staticmethod def from_dict(obj: Any) -> 'InstalledPluginSource': assert isinstance(obj, dict) - source = PurpleSource(obj.get("source")) + source = InstalledPluginSourceURLSource(obj.get("source")) path = from_union([from_str, from_none], obj.get("path")) ref = from_union([from_str, from_none], obj.get("ref")) repo = from_union([from_str, from_none], obj.get("repo")) @@ -15646,7 +17231,7 @@ def from_dict(obj: Any) -> 'InstalledPluginSource': def to_dict(self) -> dict: result: dict = {} - result["source"] = to_enum(PurpleSource, self.source) + result["source"] = to_enum(InstalledPluginSourceURLSource, self.source) if self.path is not None: result["path"] = from_union([from_str, from_none], self.path) if self.ref is not None: @@ -15670,7 +17255,7 @@ class SessionInstalledPluginSource: Source descriptor for a direct local plugin install, with a local filesystem path. """ - source: PurpleSource + source: InstalledPluginSourceURLSource """Constant value. Always "github". Constant value. Always "url". @@ -15699,7 +17284,7 @@ class SessionInstalledPluginSource: @staticmethod def from_dict(obj: Any) -> 'SessionInstalledPluginSource': assert isinstance(obj, dict) - source = PurpleSource(obj.get("source")) + source = InstalledPluginSourceURLSource(obj.get("source")) path = from_union([from_str, from_none], obj.get("path")) ref = from_union([from_str, from_none], obj.get("ref")) repo = from_union([from_str, from_none], obj.get("repo")) @@ -15709,7 +17294,7 @@ def from_dict(obj: Any) -> 'SessionInstalledPluginSource': def to_dict(self) -> dict: result: dict = {} - result["source"] = to_enum(PurpleSource, self.source) + result["source"] = to_enum(InstalledPluginSourceURLSource, self.source) if self.path is not None: result["path"] = from_union([from_str, from_none], self.path) if self.ref is not None: @@ -15731,7 +17316,7 @@ class InstalledPluginSourceGitHub: repo: str """GitHub repository in `owner/repo` form.""" - source: FluffySource + source: PurpleSource """Constant value. Always "github".""" path: str | None = None @@ -15747,7 +17332,7 @@ class InstalledPluginSourceGitHub: def from_dict(obj: Any) -> 'InstalledPluginSourceGitHub': assert isinstance(obj, dict) repo = from_str(obj.get("repo")) - source = FluffySource(obj.get("source")) + source = PurpleSource(obj.get("source")) path = from_union([from_str, from_none], obj.get("path")) ref = from_union([from_str, from_none], obj.get("ref")) sha = from_union([from_str, from_none], obj.get("sha")) @@ -15756,7 +17341,7 @@ def from_dict(obj: Any) -> 'InstalledPluginSourceGitHub': def to_dict(self) -> dict: result: dict = {} result["repo"] = from_str(self.repo) - result["source"] = to_enum(FluffySource, self.source) + result["source"] = to_enum(PurpleSource, self.source) if self.path is not None: result["path"] = from_union([from_str, from_none], self.path) if self.ref is not None: @@ -15774,7 +17359,7 @@ class SessionInstalledPluginSourceGitHub: repo: str """GitHub repository in `owner/repo` form.""" - source: FluffySource + source: PurpleSource """Constant value. Always "github".""" path: str | None = None @@ -15790,7 +17375,7 @@ class SessionInstalledPluginSourceGitHub: def from_dict(obj: Any) -> 'SessionInstalledPluginSourceGitHub': assert isinstance(obj, dict) repo = from_str(obj.get("repo")) - source = FluffySource(obj.get("source")) + source = PurpleSource(obj.get("source")) path = from_union([from_str, from_none], obj.get("path")) ref = from_union([from_str, from_none], obj.get("ref")) sha = from_union([from_str, from_none], obj.get("sha")) @@ -15799,7 +17384,7 @@ def from_dict(obj: Any) -> 'SessionInstalledPluginSourceGitHub': def to_dict(self) -> dict: result: dict = {} result["repo"] = from_str(self.repo) - result["source"] = to_enum(FluffySource, self.source) + result["source"] = to_enum(PurpleSource, self.source) if self.path is not None: result["path"] = from_union([from_str, from_none], self.path) if self.ref is not None: @@ -15816,20 +17401,20 @@ class InstalledPluginSourceLocal: path: str """Local filesystem path to the plugin.""" - source: TentacledSource + source: FluffySource """Constant value. Always "local".""" @staticmethod def from_dict(obj: Any) -> 'InstalledPluginSourceLocal': assert isinstance(obj, dict) path = from_str(obj.get("path")) - source = TentacledSource(obj.get("source")) + source = FluffySource(obj.get("source")) return InstalledPluginSourceLocal(path, source) def to_dict(self) -> dict: result: dict = {} result["path"] = from_str(self.path) - result["source"] = to_enum(TentacledSource, self.source) + result["source"] = to_enum(FluffySource, self.source) return result # Experimental: this type is part of an experimental API and may change or be removed. @@ -15840,106 +17425,20 @@ class SessionInstalledPluginSourceLocal: path: str """Local filesystem path to the plugin.""" - source: TentacledSource + source: FluffySource """Constant value. Always "local".""" @staticmethod def from_dict(obj: Any) -> 'SessionInstalledPluginSourceLocal': assert isinstance(obj, dict) path = from_str(obj.get("path")) - source = TentacledSource(obj.get("source")) + source = FluffySource(obj.get("source")) return SessionInstalledPluginSourceLocal(path, source) def to_dict(self) -> dict: result: dict = {} result["path"] = from_str(self.path) - result["source"] = to_enum(TentacledSource, self.source) - return result - -# Experimental: this type is part of an experimental API and may change or be removed. -@dataclass -class InstalledPluginSourceURL: - """Source descriptor for a direct URL plugin install, with URL, optional ref or full commit - SHA, and optional subpath. - """ - source: StickySource - """Constant value. Always "url".""" - - url: str - """URL of the plugin source.""" - - path: str | None = None - """Optional source-relative path to the plugin.""" - - ref: str | None = None - """Optional Git ref to resolve.""" - - sha: str | None = None - """Optional full 40-character hexadecimal commit SHA.""" - - @staticmethod - def from_dict(obj: Any) -> 'InstalledPluginSourceURL': - assert isinstance(obj, dict) - source = StickySource(obj.get("source")) - url = from_str(obj.get("url")) - path = from_union([from_str, from_none], obj.get("path")) - ref = from_union([from_str, from_none], obj.get("ref")) - sha = from_union([from_str, from_none], obj.get("sha")) - return InstalledPluginSourceURL(source, url, path, ref, sha) - - def to_dict(self) -> dict: - result: dict = {} - result["source"] = to_enum(StickySource, self.source) - result["url"] = from_str(self.url) - if self.path is not None: - result["path"] = from_union([from_str, from_none], self.path) - if self.ref is not None: - result["ref"] = from_union([from_str, from_none], self.ref) - if self.sha is not None: - result["sha"] = from_union([from_str, from_none], self.sha) - return result - -# Experimental: this type is part of an experimental API and may change or be removed. -@dataclass -class SessionInstalledPluginSourceURL: - """Source descriptor for a direct URL plugin install, with URL, optional ref or full commit - SHA, and optional subpath. - """ - source: StickySource - """Constant value. Always "url".""" - - url: str - """URL of the plugin source.""" - - path: str | None = None - """Optional source-relative path to the plugin.""" - - ref: str | None = None - """Optional Git ref to resolve.""" - - sha: str | None = None - """Optional full 40-character hexadecimal commit SHA.""" - - @staticmethod - def from_dict(obj: Any) -> 'SessionInstalledPluginSourceURL': - assert isinstance(obj, dict) - source = StickySource(obj.get("source")) - url = from_str(obj.get("url")) - path = from_union([from_str, from_none], obj.get("path")) - ref = from_union([from_str, from_none], obj.get("ref")) - sha = from_union([from_str, from_none], obj.get("sha")) - return SessionInstalledPluginSourceURL(source, url, path, ref, sha) - - def to_dict(self) -> dict: - result: dict = {} - result["source"] = to_enum(StickySource, self.source) - result["url"] = from_str(self.url) - if self.path is not None: - result["path"] = from_union([from_str, from_none], self.path) - if self.ref is not None: - result["ref"] = from_union([from_str, from_none], self.ref) - if self.sha is not None: - result["sha"] = from_union([from_str, from_none], self.sha) + result["source"] = to_enum(FluffySource, self.source) return result # Experimental: this type is part of an experimental API and may change or be removed. @@ -16812,6 +18311,141 @@ def to_dict(self) -> dict: result["pendingConnections"] = from_list(from_str, self.pending_connections) return result +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class MCPPlanConfigurationChange: + """One change applying the plan would make, described rather than serialised so the + configuration payload stays behind the runtime boundary. + """ + changed_fields: list[str] + """Names of the configuration fields the change would set, without their values.""" + + config_key: str + """Configuration key the change applies to.""" + + operation: MCPPlanConfigurationOperation + """Whether the change would create a new entry or modify an existing one.""" + + scope: MCPPlanScope + """Scope the change would be written to.""" + + secret_references: list[str] + """Secret placeholders the written configuration would reference. The constrained + placeholder type cannot carry a literal secret value. + """ + + @staticmethod + def from_dict(obj: Any) -> 'MCPPlanConfigurationChange': + assert isinstance(obj, dict) + changed_fields = from_list(from_str, obj.get("changedFields")) + config_key = from_str(obj.get("configKey")) + operation = MCPPlanConfigurationOperation(obj.get("operation")) + scope = MCPPlanScope(obj.get("scope")) + secret_references = from_list(from_str, obj.get("secretReferences")) + return MCPPlanConfigurationChange(changed_fields, config_key, operation, scope, secret_references) + + def to_dict(self) -> dict: + result: dict = {} + result["changedFields"] = from_list(from_str, self.changed_fields) + result["configKey"] = from_str(self.config_key) + result["operation"] = to_enum(MCPPlanConfigurationOperation, self.operation) + result["scope"] = to_enum(MCPPlanScope, self.scope) + result["secretReferences"] = from_list(from_str, self.secret_references) + return result + +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class MCPPlanTarget: + """Configuration scope and key the plan would write to. + + Where a plan would be written. + """ + config_key: str + """Configuration key the server would be recorded under within that scope.""" + + scope: MCPPlanScope + """Configuration scope the plan targets.""" + + @staticmethod + def from_dict(obj: Any) -> 'MCPPlanTarget': + assert isinstance(obj, dict) + config_key = from_str(obj.get("configKey")) + scope = MCPPlanScope(obj.get("scope")) + return MCPPlanTarget(config_key, scope) + + def to_dict(self) -> dict: + result: dict = {} + result["configKey"] = from_str(self.config_key) + result["scope"] = to_enum(MCPPlanScope, self.scope) + return result + +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class MCPPlanInstallRequest: + """A side-effect-free request for an MCP install plan. Computing a plan never writes + configuration, stores a secret, or reloads MCP servers. + """ + contract: CatalogClientContract + """Protocol version and capabilities the caller requires.""" + + source: MCPPlanInstallSource + """What to plan: either a candidate handle from a previous search, or a card supplied + directly. + """ + scope: MCPPlanScope | None = None + """Configuration scope the plan targets. Defaults to user scope when omitted.""" + + @staticmethod + def from_dict(obj: Any) -> 'MCPPlanInstallRequest': + assert isinstance(obj, dict) + contract = CatalogClientContract.from_dict(obj.get("contract")) + source = _load_MCPPlanInstallSource(obj.get("source")) + scope = from_union([MCPPlanScope, from_none], obj.get("scope")) + return MCPPlanInstallRequest(contract, source, scope) + + def to_dict(self) -> dict: + result: dict = {} + result["contract"] = to_class(CatalogClientContract, self.contract) + result["source"] = (self.source).to_dict() + if self.scope is not None: + result["scope"] = from_union([lambda x: to_enum(MCPPlanScope, x), from_none], self.scope) + return result + +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class MCPPlanPolicyResult: + """Outcome of evaluating the server against registry and enterprise policy. + + Outcome of evaluating the planned server against registry and enterprise policy. + Evaluation is read-only. + """ + decision: MCPPlanPolicyDecision + """What policy decided for this server.""" + + source: MCPPlanPolicySource + """Which authority produced the decision.""" + + reason: str | None = None + """Human-readable explanation, safe to surface. Never contains a query, URL, handle, or + secret. + """ + + @staticmethod + def from_dict(obj: Any) -> 'MCPPlanPolicyResult': + assert isinstance(obj, dict) + decision = MCPPlanPolicyDecision(obj.get("decision")) + source = MCPPlanPolicySource(obj.get("source")) + reason = from_union([from_str, from_none], obj.get("reason")) + return MCPPlanPolicyResult(decision, source, reason) + + def to_dict(self) -> dict: + result: dict = {} + result["decision"] = to_enum(MCPPlanPolicyDecision, self.decision) + result["source"] = to_enum(MCPPlanPolicySource, self.source) + if self.reason is not None: + result["reason"] = from_union([from_str, from_none], self.reason) + return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPOauthPendingRequestResponse: @@ -16849,6 +18483,291 @@ def to_dict(self) -> dict: result["tokenType"] = from_union([from_str, from_none], self.token_type) return result +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class MCPPlanRequiredValueEnum: + """One enumerated non-secret value a transport choice needs before it can be applied. The + permitted values are structurally required. + """ + category: MCPPlanValueCategory + """Where the value is applied when the server is launched.""" + + enum_values: list[str] + """Non-empty permitted value set. Inert untrusted data.""" + + is_repeated: bool + """Whether the value may be supplied more than once.""" + + key: str + """Key the value is supplied under. Inert untrusted data.""" + + kind: ClassVar[str] = "enum" + """Discriminator: this required value uses a fixed enumeration.""" + + required: bool + """Whether the value must be present for the plan to be applicable.""" + + value_type: MCPPlan + """Discriminator: the value must be one of `enumValues`.""" + + default_value: str | None = None + """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. + """ + description: str | None = None + """Human-readable explanation from the card. Inert untrusted text.""" + + title: str | None = None + """Human-readable label from the card. Inert untrusted text.""" + + @staticmethod + def from_dict(obj: Any) -> 'MCPPlanRequiredValueEnum': + assert isinstance(obj, dict) + category = MCPPlanValueCategory(obj.get("category")) + enum_values = from_list(from_str, obj.get("enumValues")) + is_repeated = from_bool(obj.get("isRepeated")) + key = from_str(obj.get("key")) + required = from_bool(obj.get("required")) + value_type = MCPPlan(obj.get("valueType")) + default_value = from_union([from_str, from_none], obj.get("defaultValue")) + description = from_union([from_str, from_none], obj.get("description")) + title = from_union([from_str, from_none], obj.get("title")) + return MCPPlanRequiredValueEnum(category, enum_values, is_repeated, key, required, value_type, default_value, description, title) + + def to_dict(self) -> dict: + result: dict = {} + result["category"] = to_enum(MCPPlanValueCategory, self.category) + result["enumValues"] = from_list(from_str, self.enum_values) + result["isRepeated"] = from_bool(self.is_repeated) + result["key"] = from_str(self.key) + result["kind"] = self.kind + result["required"] = from_bool(self.required) + result["valueType"] = to_enum(MCPPlan, self.value_type) + if self.default_value is not None: + result["defaultValue"] = from_union([from_str, from_none], self.default_value) + if self.description is not None: + result["description"] = from_union([from_str, from_none], self.description) + if self.title is not None: + result["title"] = from_union([from_str, from_none], self.title) + return result + +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class MCPPlanInstallSourceCandidate: + """Plan from a candidate returned by a previous catalog search.""" + + candidate_handle: str + """Single-use candidate handle. Consumed by this call, so a replay of the same handle is + rejected. + """ + kind: ClassVar[str] = "candidate" + """Discriminator: plan from a previously returned candidate""" + + search_id: str + """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. + """ + + @staticmethod + def from_dict(obj: Any) -> 'MCPPlanInstallSourceCandidate': + assert isinstance(obj, dict) + candidate_handle = from_str(obj.get("candidateHandle")) + search_id = from_str(obj.get("searchId")) + return MCPPlanInstallSourceCandidate(candidate_handle, search_id) + + def to_dict(self) -> dict: + result: dict = {} + result["candidateHandle"] = from_str(self.candidate_handle) + result["kind"] = self.kind + result["searchId"] = from_str(self.search_id) + return result + +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class MCPPlanInstallSourceCard: + """Plan from a card supplied directly by the caller, without a preceding search.""" + + card: MCPServerCardReference + """The card to plan from: exactly one of a URL or embedded data.""" + + kind: ClassVar[str] = "card" + """Discriminator: plan from a caller-supplied card""" + + @staticmethod + def from_dict(obj: Any) -> 'MCPPlanInstallSourceCard': + assert isinstance(obj, dict) + card = _load_MCPServerCardReference(obj.get("card")) + return MCPPlanInstallSourceCard(card) + + def to_dict(self) -> dict: + result: dict = {} + result["card"] = (self.card).to_dict() + result["kind"] = self.kind + return result + +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class MCPPlanTransportChoicePackage: + """An eligible local-package transport choice. Package identity is required and a remote + endpoint cannot be represented. + """ + choice_id: str + """Stable identifier for this choice within the plan, used to select it when the plan is + applied. + """ + install_method: MCPPlanPackageInstallMethod + """Discriminator: this choice runs a local package""" + + package_identifier: str + """Package identifier. Inert untrusted data.""" + + package_type: str + """Packaging ecosystem, for example `oci` or `npm`.""" + + required_values: list[MCPPlanRequiredValue] + """Typed values this choice requires, excluding secrets.""" + + secret_placeholders: list[MCPPlanSecretPlaceholder] + """Secrets this choice requires, referenced by placeholder only.""" + + transport: MCPPlanPackageTransport + """Local process transport this package choice would use.""" + + @staticmethod + def from_dict(obj: Any) -> 'MCPPlanTransportChoicePackage': + assert isinstance(obj, dict) + choice_id = from_str(obj.get("choiceId")) + install_method = MCPPlanPackageInstallMethod(obj.get("installMethod")) + package_identifier = from_str(obj.get("packageIdentifier")) + package_type = from_str(obj.get("packageType")) + required_values = from_list(_load_MCPPlanRequiredValue, obj.get("requiredValues")) + secret_placeholders = from_list(MCPPlanSecretPlaceholder.from_dict, obj.get("secretPlaceholders")) + transport = MCPPlanPackageTransport(obj.get("transport")) + return MCPPlanTransportChoicePackage(choice_id, install_method, package_identifier, package_type, required_values, secret_placeholders, transport) + + def to_dict(self) -> dict: + result: dict = {} + result["choiceId"] = from_str(self.choice_id) + result["installMethod"] = to_enum(MCPPlanPackageInstallMethod, self.install_method) + result["packageIdentifier"] = from_str(self.package_identifier) + result["packageType"] = from_str(self.package_type) + result["requiredValues"] = from_list(lambda x: (x).to_dict(), self.required_values) + result["secretPlaceholders"] = from_list(lambda x: to_class(MCPPlanSecretPlaceholder, x), self.secret_placeholders) + result["transport"] = to_enum(MCPPlanPackageTransport, self.transport) + return result + +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class MCPPlanTransportChoiceRemote: + """An eligible remote-endpoint transport choice. The endpoint is required and package + identity cannot be represented. + """ + choice_id: str + """Stable identifier for this choice within the plan, used to select it when the plan is + applied. + """ + endpoint: str + """Endpoint URL. Inert untrusted data.""" + + install_method: MCPPlanRemoteInstallMethod + """Discriminator: this choice connects to a remote endpoint""" + + required_values: list[MCPPlanRequiredValue] + """Typed values this choice requires, excluding secrets.""" + + secret_placeholders: list[MCPPlanSecretPlaceholder] + """Secrets this choice requires, referenced by placeholder only.""" + + transport: MCPPlanRemoteTransport + """Endpoint transport this remote choice would use.""" + + @staticmethod + def from_dict(obj: Any) -> 'MCPPlanTransportChoiceRemote': + assert isinstance(obj, dict) + choice_id = from_str(obj.get("choiceId")) + endpoint = from_str(obj.get("endpoint")) + install_method = MCPPlanRemoteInstallMethod(obj.get("installMethod")) + required_values = from_list(_load_MCPPlanRequiredValue, obj.get("requiredValues")) + secret_placeholders = from_list(MCPPlanSecretPlaceholder.from_dict, obj.get("secretPlaceholders")) + transport = MCPPlanRemoteTransport(obj.get("transport")) + return MCPPlanTransportChoiceRemote(choice_id, endpoint, install_method, required_values, secret_placeholders, transport) + + def to_dict(self) -> dict: + result: dict = {} + result["choiceId"] = from_str(self.choice_id) + result["endpoint"] = from_str(self.endpoint) + result["installMethod"] = to_enum(MCPPlanRemoteInstallMethod, self.install_method) + result["requiredValues"] = from_list(lambda x: (x).to_dict(), self.required_values) + result["secretPlaceholders"] = from_list(lambda x: to_class(MCPPlanSecretPlaceholder, x), self.secret_placeholders) + result["transport"] = to_enum(MCPPlanRemoteTransport, self.transport) + return result + +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class MCPPlanRequiredValueScalar: + """One non-secret scalar value a transport choice needs before it can be applied.""" + + category: MCPPlanValueCategory + """Where the value is applied when the server is launched.""" + + is_repeated: bool + """Whether the value may be supplied more than once.""" + + key: str + """Key the value is supplied under. Inert untrusted data.""" + + kind: ClassVar[str] = "scalar" + """Discriminator: this required value uses a scalar type.""" + + required: bool + """Whether the value must be present for the plan to be applicable.""" + + value_type: MCPPlanScalarValueTypeEnum + """Scalar type the value must conform to.""" + + default_value: str | None = None + """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. + """ + description: str | None = None + """Human-readable explanation from the card. Inert untrusted text.""" + + title: str | None = None + """Human-readable label from the card. Inert untrusted text.""" + + @staticmethod + def from_dict(obj: Any) -> 'MCPPlanRequiredValueScalar': + assert isinstance(obj, dict) + category = MCPPlanValueCategory(obj.get("category")) + is_repeated = from_bool(obj.get("isRepeated")) + key = from_str(obj.get("key")) + required = from_bool(obj.get("required")) + value_type = MCPPlanScalarValueTypeEnum(obj.get("valueType")) + default_value = from_union([from_str, from_none], obj.get("defaultValue")) + description = from_union([from_str, from_none], obj.get("description")) + title = from_union([from_str, from_none], obj.get("title")) + return MCPPlanRequiredValueScalar(category, is_repeated, key, required, value_type, default_value, description, title) + + def to_dict(self) -> dict: + result: dict = {} + result["category"] = to_enum(MCPPlanValueCategory, self.category) + result["isRepeated"] = from_bool(self.is_repeated) + result["key"] = from_str(self.key) + result["kind"] = self.kind + result["required"] = from_bool(self.required) + result["valueType"] = to_enum(MCPPlanScalarValueTypeEnum, self.value_type) + if self.default_value is not None: + result["defaultValue"] = from_union([from_str, from_none], self.default_value) + if self.description is not None: + result["description"] = from_union([from_str, from_none], self.description) + if self.title is not None: + result["title"] = from_union([from_str, from_none], self.title) + return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPResourcesReadResult: @@ -22729,6 +24648,47 @@ def to_dict(self) -> dict: result["logCapture"] = from_union([lambda x: to_class(AgentRegistryLogCapture, x), from_none], self.log_capture) return result +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class MCPPlanProvenance: + """Origin and semantic digest of the exact validated JSON MCP card content bound to this + plan. + + Provenance of the exact validated JSON MCP card content bound privately to a completed + plan and its opaque handle. + """ + authority: str + """Authority associated with the validated card, without path, query, or credentials. Inert + untrusted data. + """ + card_digest: CardDigest + """Semantic digest of the exact validated JSON content bound to the plan handle.""" + + media_type: MCPServerCardMediaType + """JSON MCP media type the validated card was interpreted as.""" + + validated_at: str + """ISO 8601 timestamp at which the runtime completed strict parsing and schema validation of + the card content. + """ + + @staticmethod + def from_dict(obj: Any) -> 'MCPPlanProvenance': + assert isinstance(obj, dict) + authority = from_str(obj.get("authority")) + card_digest = CardDigest.from_dict(obj.get("cardDigest")) + media_type = MCPServerCardMediaType(obj.get("mediaType")) + validated_at = from_str(obj.get("validatedAt")) + return MCPPlanProvenance(authority, card_digest, media_type, validated_at) + + def to_dict(self) -> dict: + result: dict = {} + result["authority"] = from_str(self.authority) + result["cardDigest"] = to_class(CardDigest, self.card_digest) + result["mediaType"] = to_enum(MCPServerCardMediaType, self.media_type) + result["validatedAt"] = from_str(self.validated_at) + return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SlashCommandInfo: @@ -22874,6 +24834,230 @@ def to_dict(self) -> dict: result["openCanvases"] = from_list(lambda x: to_class(OpenCanvasInstance, x), self.open_canvases) return result +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class CatalogAISkillCandidate: + """An inert AI skill catalog result. AI skills are discovery-only and cannot be represented + as installable through this surface. + """ + display_name: str + """Display name taken verbatim from the card. Inert untrusted text.""" + + handle: str + """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. + """ + handle_expires_at: str + """ISO 8601 timestamp after which the handle is stale and will be rejected.""" + + installability: Installability + """AI skills are discovery-only and cannot be installed through this surface""" + + kind: CatalogAISkillCandidateKind + """Discriminator: this candidate describes an AI skill""" + + media_type: MediaType + """Media type of the underlying AI skill card""" + + provenance: CatalogAISkillCandidateProvenance + """Where the catalog reference was observed, without the card itself or any content digest.""" + + source: CatalogCandidateSource + """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. + """ + description: str | None = None + """Description taken verbatim from the card. Inert untrusted text.""" + + publisher: str | None = None + """Publisher taken verbatim from the card. Inert untrusted text.""" + + @staticmethod + def from_dict(obj: Any) -> 'CatalogAISkillCandidate': + assert isinstance(obj, dict) + display_name = from_str(obj.get("displayName")) + handle = from_str(obj.get("handle")) + handle_expires_at = from_str(obj.get("handleExpiresAt")) + installability = Installability(obj.get("installability")) + kind = CatalogAISkillCandidateKind(obj.get("kind")) + media_type = MediaType(obj.get("mediaType")) + provenance = CatalogAISkillCandidateProvenance.from_dict(obj.get("provenance")) + source = _load_CatalogCandidateSource(obj.get("source")) + description = from_union([from_str, from_none], obj.get("description")) + publisher = from_union([from_str, from_none], obj.get("publisher")) + return CatalogAISkillCandidate(display_name, handle, handle_expires_at, installability, kind, media_type, provenance, source, description, publisher) + + def to_dict(self) -> dict: + result: dict = {} + result["displayName"] = from_str(self.display_name) + result["handle"] = from_str(self.handle) + result["handleExpiresAt"] = from_str(self.handle_expires_at) + result["installability"] = to_enum(Installability, self.installability) + result["kind"] = to_enum(CatalogAISkillCandidateKind, self.kind) + result["mediaType"] = to_enum(MediaType, self.media_type) + result["provenance"] = to_class(CatalogAISkillCandidateProvenance, self.provenance) + result["source"] = (self.source).to_dict() + if self.description is not None: + result["description"] = from_union([from_str, from_none], self.description) + if self.publisher is not None: + result["publisher"] = from_union([from_str, from_none], self.publisher) + return result + +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class CatalogCandidate: + """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. + + 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. + + An inert AI skill catalog result. AI skills are discovery-only and cannot be represented + as installable through this surface. + """ + display_name: str + """Display name taken verbatim from the card. Inert untrusted text.""" + + handle: str + """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. + """ + handle_expires_at: str + """ISO 8601 timestamp after which the handle is stale and will be rejected.""" + + installability: CatalogCandidateInstallability + """Whether this MCP server can be planned for installation, and if policy prevents it. + + AI skills are discovery-only and cannot be installed through this surface + """ + kind: CatalogCandidateKind + """Discriminator: this candidate describes an MCP server + + Discriminator: this candidate describes an AI skill + """ + media_type: CatalogMediaType + """JSON MCP media type of the underlying card. + + Media type of the underlying AI skill card + """ + provenance: CatalogCandidateProvenance + """Where the catalog reference was observed, without the card itself or any content digest.""" + + source: CatalogCandidateSource + """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. + """ + description: str | None = None + """Description taken verbatim from the card. Inert untrusted text.""" + + publisher: str | None = None + """Publisher taken verbatim from the card. Inert untrusted text.""" + + @staticmethod + def from_dict(obj: Any) -> 'CatalogCandidate': + assert isinstance(obj, dict) + display_name = from_str(obj.get("displayName")) + handle = from_str(obj.get("handle")) + handle_expires_at = from_str(obj.get("handleExpiresAt")) + installability = CatalogCandidateInstallability(obj.get("installability")) + kind = CatalogCandidateKind(obj.get("kind")) + media_type = CatalogMediaType(obj.get("mediaType")) + provenance = CatalogCandidateProvenance.from_dict(obj.get("provenance")) + source = _load_CatalogCandidateSource(obj.get("source")) + description = from_union([from_str, from_none], obj.get("description")) + publisher = from_union([from_str, from_none], obj.get("publisher")) + return CatalogCandidate(display_name, handle, handle_expires_at, installability, kind, media_type, provenance, source, description, publisher) + + def to_dict(self) -> dict: + result: dict = {} + result["displayName"] = from_str(self.display_name) + result["handle"] = from_str(self.handle) + result["handleExpiresAt"] = from_str(self.handle_expires_at) + result["installability"] = to_enum(CatalogCandidateInstallability, self.installability) + result["kind"] = to_enum(CatalogCandidateKind, self.kind) + result["mediaType"] = to_enum(CatalogMediaType, self.media_type) + result["provenance"] = to_class(CatalogCandidateProvenance, self.provenance) + result["source"] = (self.source).to_dict() + if self.description is not None: + result["description"] = from_union([from_str, from_none], self.description) + if self.publisher is not None: + result["publisher"] = from_union([from_str, from_none], self.publisher) + return result + +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class CatalogMCPServerCandidate: + """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. + """ + display_name: str + """Display name taken verbatim from the card. Inert untrusted text.""" + + handle: str + """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. + """ + handle_expires_at: str + """ISO 8601 timestamp after which the handle is stale and will be rejected.""" + + installability: CatalogMCPServerInstallabilityEnum + """Whether this MCP server can be planned for installation, and if policy prevents it.""" + + kind: CatalogMCPServerCandidateKind + """Discriminator: this candidate describes an MCP server""" + + media_type: MCPServerCardMediaType + """JSON MCP media type of the underlying card.""" + + provenance: CatalogMCPServerCandidateProvenance + """Where the catalog reference was observed, without the card itself or any content digest.""" + + source: CatalogCandidateSource + """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. + """ + description: str | None = None + """Description taken verbatim from the card. Inert untrusted text.""" + + publisher: str | None = None + """Publisher taken verbatim from the card. Inert untrusted text.""" + + @staticmethod + def from_dict(obj: Any) -> 'CatalogMCPServerCandidate': + assert isinstance(obj, dict) + display_name = from_str(obj.get("displayName")) + handle = from_str(obj.get("handle")) + handle_expires_at = from_str(obj.get("handleExpiresAt")) + installability = CatalogMCPServerInstallabilityEnum(obj.get("installability")) + kind = CatalogMCPServerCandidateKind(obj.get("kind")) + media_type = MCPServerCardMediaType(obj.get("mediaType")) + provenance = CatalogMCPServerCandidateProvenance.from_dict(obj.get("provenance")) + source = _load_CatalogCandidateSource(obj.get("source")) + description = from_union([from_str, from_none], obj.get("description")) + publisher = from_union([from_str, from_none], obj.get("publisher")) + return CatalogMCPServerCandidate(display_name, handle, handle_expires_at, installability, kind, media_type, provenance, source, description, publisher) + + def to_dict(self) -> dict: + result: dict = {} + result["displayName"] = from_str(self.display_name) + result["handle"] = from_str(self.handle) + result["handleExpiresAt"] = from_str(self.handle_expires_at) + result["installability"] = to_enum(CatalogMCPServerInstallabilityEnum, self.installability) + result["kind"] = to_enum(CatalogMCPServerCandidateKind, self.kind) + result["mediaType"] = to_enum(MCPServerCardMediaType, self.media_type) + result["provenance"] = to_class(CatalogMCPServerCandidateProvenance, self.provenance) + result["source"] = (self.source).to_dict() + if self.description is not None: + result["description"] = from_union([from_str, from_none], self.description) + if self.publisher is not None: + result["publisher"] = from_union([from_str, from_none], self.publisher) + return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class DebugCollectLogsResult: @@ -26602,6 +28786,90 @@ def to_dict(self) -> dict: result["unavailableReason"] = from_union([lambda x: to_enum(HistoryRewindUnavailableReason, x), from_none], self.unavailable_reason) return result +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class MCPInstallPlan: + """A normalised, inert description of what installing an MCP server would involve. Carries + no raw card, no install specification, and no secret value. + + The normalised plan. + """ + configuration_changes: list[MCPPlanConfigurationChange] + """The configuration changes installing would make, described rather than serialised, so the + mutable configuration payload stays behind the runtime boundary. + """ + identity: MCPPlanResourceIdentity + """Normalised identity of the server the plan would install.""" + + plan_handle: str + """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. + """ + plan_handle_expires_at: str + """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. + """ + policy: MCPPlanPolicyResult + """Outcome of evaluating the server against registry and enterprise policy.""" + + provenance: MCPPlanProvenance + """Origin and semantic digest of the exact validated JSON MCP card content bound to this + plan. + """ + reload_required: bool + """Whether applying this plan would require an MCP reload to take effect. Planning itself + never reloads. + """ + requires_interactive_configuration: bool + """Whether the plan cannot be applied without further input, because a required value has no + default or a secret must be supplied. + """ + target: MCPPlanTarget + """Configuration scope and key the plan would write to.""" + + transport_choices: list[MCPPlanTransportChoice] + """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. + """ + recommended_transport_choice_id: str | None = None + """Identifier of the choice the runtime would pick by default. Omitted when there is no + eligible transport, or when the runtime expresses no preference. + """ + + @staticmethod + def from_dict(obj: Any) -> 'MCPInstallPlan': + assert isinstance(obj, dict) + configuration_changes = from_list(MCPPlanConfigurationChange.from_dict, obj.get("configurationChanges")) + identity = MCPPlanResourceIdentity.from_dict(obj.get("identity")) + plan_handle = from_str(obj.get("planHandle")) + plan_handle_expires_at = from_str(obj.get("planHandleExpiresAt")) + policy = MCPPlanPolicyResult.from_dict(obj.get("policy")) + provenance = MCPPlanProvenance.from_dict(obj.get("provenance")) + reload_required = from_bool(obj.get("reloadRequired")) + requires_interactive_configuration = from_bool(obj.get("requiresInteractiveConfiguration")) + target = MCPPlanTarget.from_dict(obj.get("target")) + transport_choices = from_list(_load_MCPPlanTransportChoice, obj.get("transportChoices")) + recommended_transport_choice_id = from_union([from_str, from_none], obj.get("recommendedTransportChoiceId")) + return MCPInstallPlan(configuration_changes, identity, plan_handle, plan_handle_expires_at, policy, provenance, reload_required, requires_interactive_configuration, target, transport_choices, recommended_transport_choice_id) + + def to_dict(self) -> dict: + result: dict = {} + result["configurationChanges"] = from_list(lambda x: to_class(MCPPlanConfigurationChange, x), self.configuration_changes) + result["identity"] = to_class(MCPPlanResourceIdentity, self.identity) + result["planHandle"] = from_str(self.plan_handle) + result["planHandleExpiresAt"] = from_str(self.plan_handle_expires_at) + result["policy"] = to_class(MCPPlanPolicyResult, self.policy) + result["provenance"] = to_class(MCPPlanProvenance, self.provenance) + result["reloadRequired"] = from_bool(self.reload_required) + result["requiresInteractiveConfiguration"] = from_bool(self.requires_interactive_configuration) + result["target"] = to_class(MCPPlanTarget, self.target) + result["transportChoices"] = from_list(lambda x: (x).to_dict(), self.transport_choices) + if self.recommended_transport_choice_id is not None: + result["recommendedTransportChoiceId"] = from_union([from_str, from_none], self.recommended_transport_choice_id) + return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CommandList: @@ -26776,6 +29044,50 @@ def to_dict(self) -> dict: result["session"] = from_union([lambda x: to_class(CanvasSessionContext, x), from_none], self.session) return result +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class CatalogSearchSucceeded: + """A completed catalog search: inert candidate summaries, each carrying a single-use handle.""" + + candidates: list[CatalogCandidate] + """Matching candidates, never more than the requested limit. All text is inert untrusted + data. + """ + kind: ClassVar[str] = "succeeded" + """Discriminator: the search completed""" + + negotiated: CatalogNegotiatedContract + """Protocol version and capabilities the runtime honoured.""" + + search_id: str + """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. + """ + truncated: bool + """Whether further matches existed beyond the requested limit.""" + + @staticmethod + def from_dict(obj: Any) -> 'CatalogSearchSucceeded': + assert isinstance(obj, dict) + candidates = from_list(CatalogCandidate.from_dict, obj.get("candidates")) + negotiated = CatalogNegotiatedContract.from_dict(obj.get("negotiated")) + search_id = from_str(obj.get("searchId")) + truncated = from_bool(obj.get("truncated")) + return CatalogSearchSucceeded(candidates, negotiated, search_id, truncated) + + def to_dict(self) -> dict: + result: dict = {} + result["candidates"] = from_list(lambda x: to_class(CatalogCandidate, x), self.candidates) + result["kind"] = self.kind + result["negotiated"] = to_class(CatalogNegotiatedContract, self.negotiated) + result["searchId"] = from_str(self.search_id) + result["truncated"] = from_bool(self.truncated) + return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class HandlePendingToolCallRequest: @@ -27901,6 +30213,35 @@ def to_dict(self) -> dict: result["totalNanoAiu"] = from_union([to_float, from_none], self.total_nano_aiu) return result +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class MCPPlanInstallPlanned: + """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. + """ + kind: ClassVar[str] = "planned" + """Discriminator: a plan was computed and nothing was changed""" + + negotiated: CatalogNegotiatedContract + """Protocol version and capabilities the runtime honoured.""" + + plan: MCPInstallPlan + """The normalised plan.""" + + @staticmethod + def from_dict(obj: Any) -> 'MCPPlanInstallPlanned': + assert isinstance(obj, dict) + negotiated = CatalogNegotiatedContract.from_dict(obj.get("negotiated")) + plan = MCPInstallPlan.from_dict(obj.get("plan")) + return MCPPlanInstallPlanned(negotiated, plan) + + def to_dict(self) -> dict: + result: dict = {} + result["kind"] = self.kind + result["negotiated"] = to_class(CatalogNegotiatedContract, self.negotiated) + result["plan"] = to_class(MCPInstallPlan, self.plan) + return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class FactoryListRunsResult: @@ -31249,9 +33590,12 @@ def to_dict(self) -> dict: return result # Experimental: this type is part of an experimental API and may change or be removed. -class PermissionsSetAAllSource(Enum): - """Optional source for allow-all telemetry. Defaults to `rpc` when omitted for SDK callers.""" +class PermissionSource(Enum): + """Optional source for permission-mode telemetry. Defaults to `rpc` when omitted for SDK + callers. + Optional source for allow-all telemetry. Defaults to `rpc` when omitted for SDK callers. + """ AUTOPILOT_CONFIRMATION = "autopilot_confirmation" CLI_FLAG = "cli_flag" RPC = "rpc" @@ -31259,69 +33603,62 @@ class PermissionsSetAAllSource(Enum): # Experimental: this type is part of an experimental API and may change or be removed. @dataclass -class PermissionsSetAllowAllRequest: - """Allow-all mode to apply for the session.""" +class PermissionsSetApproveAllRequest: + """Allow-all toggle for tool permission requests, with an optional telemetry source.""" - enabled: bool | None = None - """Legacy full allow-all toggle. Prefer `mode`; when `mode` is omitted, `enabled: true` is - treated as `mode: "on"` and any other value is treated as `mode: "off"`. - """ - mode: PermissionsAllowAllMode | None = None - """Allow-all mode to apply. `on` enables full allow-all; `auto` enables advisory LLM - auto-approval; `off` disables both. - """ - model: str | None = None - """Optional model id for the `auto` mode auto-approval LLM judging. Only meaningful when - `mode` is `auto`; ignored otherwise. When omitted, the session resolves a default judge - model: `gpt-5.5` for CAPI sessions and the session's active model for BYOK sessions. - """ - source: PermissionsSetAAllSource | None = None + enabled: bool + """Whether to auto-approve all tool permission requests""" + + source: PermissionSource | None = None """Optional source for allow-all telemetry. Defaults to `rpc` when omitted for SDK callers.""" @staticmethod - def from_dict(obj: Any) -> 'PermissionsSetAllowAllRequest': + def from_dict(obj: Any) -> 'PermissionsSetApproveAllRequest': assert isinstance(obj, dict) - enabled = from_union([from_bool, from_none], obj.get("enabled")) - mode = from_union([PermissionsAllowAllMode, from_none], obj.get("mode")) - model = from_union([from_str, from_none], obj.get("model")) - source = from_union([PermissionsSetAAllSource, from_none], obj.get("source")) - return PermissionsSetAllowAllRequest(enabled, mode, model, source) + enabled = from_bool(obj.get("enabled")) + source = from_union([PermissionSource, from_none], obj.get("source")) + return PermissionsSetApproveAllRequest(enabled, source) def to_dict(self) -> dict: result: dict = {} - if self.enabled is not None: - result["enabled"] = from_union([from_bool, from_none], self.enabled) - if self.mode is not None: - result["mode"] = from_union([lambda x: to_enum(PermissionsAllowAllMode, x), from_none], self.mode) - if self.model is not None: - result["model"] = from_union([from_str, from_none], self.model) + result["enabled"] = from_bool(self.enabled) if self.source is not None: - result["source"] = from_union([lambda x: to_enum(PermissionsSetAAllSource, x), from_none], self.source) + result["source"] = from_union([lambda x: to_enum(PermissionSource, x), from_none], self.source) return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass -class PermissionsSetApproveAllRequest: - """Allow-all toggle for tool permission requests, with an optional telemetry source.""" +class PermissionsSetModeRequest: + """Permission mode to apply for the session.""" - enabled: bool - """Whether to auto-approve all tool permission requests""" + mode: PermissionMode + """Permission mode to apply""" - source: PermissionsSetAAllSource | None = None - """Optional source for allow-all telemetry. Defaults to `rpc` when omitted for SDK callers.""" + assisted_approval_model: str | None = None + """Optional judge model id for assisted mode. When omitted, the session resolves the + provider default: `gpt-5.5` for CAPI sessions and the active session model for BYOK + sessions. + """ + source: PermissionSource | None = None + """Optional source for permission-mode telemetry. Defaults to `rpc` when omitted for SDK + callers. + """ @staticmethod - def from_dict(obj: Any) -> 'PermissionsSetApproveAllRequest': + def from_dict(obj: Any) -> 'PermissionsSetModeRequest': assert isinstance(obj, dict) - enabled = from_bool(obj.get("enabled")) - source = from_union([PermissionsSetAAllSource, from_none], obj.get("source")) - return PermissionsSetApproveAllRequest(enabled, source) + mode = PermissionMode(obj.get("mode")) + assisted_approval_model = from_union([from_str, from_none], obj.get("assistedApprovalModel")) + source = from_union([PermissionSource, from_none], obj.get("source")) + return PermissionsSetModeRequest(mode, assisted_approval_model, source) def to_dict(self) -> dict: result: dict = {} - result["enabled"] = from_bool(self.enabled) + result["mode"] = to_enum(PermissionMode, self.mode) + if self.assisted_approval_model is not None: + result["assistedApprovalModel"] = from_union([from_str, from_none], self.assisted_approval_model) if self.source is not None: - result["source"] = from_union([lambda x: to_enum(PermissionsSetAAllSource, x), from_none], self.source) + result["source"] = from_union([lambda x: to_enum(PermissionSource, x), from_none], self.source) return result # Experimental: this type is part of an experimental API and may change or be removed. @@ -32203,8 +34540,6 @@ class RPC: agent_select_result: AgentSelectResult agent_set_prompt_request: AgentSetPromptRequest agents_get_discovery_paths_request: AgentsGetDiscoveryPathsRequest - allow_all_permission_set_result: AllowAllPermissionSetResult - allow_all_permission_state: AllowAllPermissionState api_key_auth_info: APIKeyAuthInfo auth_identity: AuthIdentity auth_info: AuthInfo @@ -32239,6 +34574,52 @@ class RPC: canvas_provider_unregister_request: CanvasProviderUnregisterRequest canvas_session_context: CanvasSessionContext capi_session_options: CapiSessionOptions + card_digest: CardDigest + card_digest_algorithm: CardDigestAlgorithm + card_digest_value: str + catalog_ai_skill_candidate: CatalogAISkillCandidate + catalog_ai_skill_candidate_provenance: CatalogAISkillCandidateProvenance + catalog_authentication_required_error: CatalogAuthenticationRequiredError + catalog_authentication_required_reason: CatalogAuthenticationRequiredReason + catalog_candidate: CatalogCandidate + catalog_candidate_kind: CatalogCandidateKind + catalog_candidate_source: CatalogCandidateSource + catalog_candidate_source_embedded: CatalogCandidateSourceEmbedded + catalog_candidate_source_url: CatalogCandidateSourceURL + catalog_capability: CatalogCapability + catalog_capability_id: str + catalog_client_contract: CatalogClientContract + catalog_contract_violation_error: CatalogContractViolationError + catalog_contract_violation_reason: CatalogContractViolationReason + catalog_handle_rejected_error: CatalogHandleRejectedError + catalog_handle_rejection_reason: CatalogHandleRejectionReason + catalog_handle_type: CatalogHandleType + catalog_invalid_request_error: CatalogInvalidRequestError + catalog_invalid_request_field: CatalogInvalidRequestField + catalog_malformed_card_error: CatalogMalformedCardError + catalog_malformed_card_reason: CatalogMalformedCardReason + catalog_mcp_server_candidate: CatalogMCPServerCandidate + catalog_mcp_server_candidate_provenance: CatalogMCPServerCandidateProvenance + catalog_mcp_server_installability: CatalogMCPServerInstallabilityEnum + catalog_media_type: CatalogMediaType + catalog_negotiated_contract: CatalogNegotiatedContract + catalog_negotiation_refused_error: CatalogNegotiationRefusedError + catalog_negotiation_refused_reason: CatalogNegotiationRefusedReason + catalog_network_failure_error: CatalogNetworkFailureError + catalog_network_failure_reason: CatalogNetworkFailureReason + catalog_not_installable_error: CatalogNotInstallableError + catalog_not_installable_reason: CatalogNotInstallableReason + catalog_policy_rejected_error: CatalogPolicyRejectedError + catalog_search_request: CatalogSearchRequest + catalog_search_result: CatalogSearchResult + catalog_search_succeeded: CatalogSearchSucceeded + catalog_unavailable_error: CatalogUnavailableError + catalog_unavailable_reason: CatalogUnavailableReason + catalog_unavailable_transport_error: CatalogUnavailableTransportError + catalog_unavailable_transport_reason: CatalogUnavailableTransportReason + catalog_unsafe_retrieval_error: CatalogUnsafeRetrievalError + catalog_unsafe_retrieval_reason: CatalogUnsafeRetrievalReason + catalog_unsupported_kind_error: CatalogUnsupportedKindError command_list: CommandList commands_finalize_invocation_effect_request: CommandsFinalizeInvocationEffectRequest commands_finalize_invocation_effect_result: CommandsFinalizeInvocationEffectResult @@ -32501,6 +34882,7 @@ class RPC: mcp_headers_handle_pending_headers_refresh_request_request: MCPHeadersHandlePendingHeadersRefreshRequestRequest mcp_headers_handle_pending_headers_refresh_request_result: MCPHeadersHandlePendingHeadersRefreshRequestResult mcp_host_state: MCPHostState + mcp_install_plan: MCPInstallPlan mcp_is_server_running_request: MCPIsServerRunningRequest mcp_is_server_running_result: MCPIsServerRunningResult mcp_list_tools_request: MCPListToolsRequest @@ -32517,6 +34899,40 @@ class RPC: mcp_oauth_probe_result: MCPOauthProbeResult mcp_oauth_respond_request: MCPOauthRespondRequest mcp_oauth_respond_result: MCPOauthRespondResult + mcp_plan_configuration_change: MCPPlanConfigurationChange + mcp_plan_configuration_operation: MCPPlanConfigurationOperation + mcp_plan_enum_value_type: MCPPlan + mcp_plan_install_planned: MCPPlanInstallPlanned + mcp_plan_install_request: MCPPlanInstallRequest + mcp_plan_install_result: MCPPlanInstallResult + mcp_plan_install_source: MCPPlanInstallSource + mcp_plan_install_source_candidate: MCPPlanInstallSourceCandidate + mcp_plan_install_source_candidate_kind: MCPPlanInstallSourceCandidateKind + mcp_plan_install_source_card: MCPPlanInstallSourceCard + mcp_plan_install_source_card_kind: MCPPlanInstallSourceCardKind + mcp_plan_package_install_method: MCPPlanPackageInstallMethod + mcp_plan_package_transport: MCPPlanPackageTransport + mcp_plan_policy_decision: MCPPlanPolicyDecision + mcp_plan_policy_result: MCPPlanPolicyResult + mcp_plan_policy_source: MCPPlanPolicySource + mcp_plan_provenance: MCPPlanProvenance + mcp_plan_remote_install_method: MCPPlanRemoteInstallMethod + mcp_plan_remote_transport: MCPPlanRemoteTransport + mcp_plan_required_value: MCPPlanRequiredValue + mcp_plan_required_value_enum: MCPPlanRequiredValueEnum + mcp_plan_required_value_enum_kind: MCPPlan + mcp_plan_required_value_scalar: MCPPlanRequiredValueScalar + mcp_plan_required_value_scalar_kind: MCPPlanRequiredValueScalarKind + mcp_plan_resource_identity: MCPPlanResourceIdentity + mcp_plan_scalar_value_type: MCPPlanScalarValueTypeEnum + mcp_plan_scope: MCPPlanScope + mcp_plan_secret_placeholder: MCPPlanSecretPlaceholder + mcp_plan_secret_reference: str + mcp_plan_target: MCPPlanTarget + mcp_plan_transport_choice: MCPPlanTransportChoice + mcp_plan_transport_choice_package: MCPPlanTransportChoicePackage + mcp_plan_transport_choice_remote: MCPPlanTransportChoiceRemote + mcp_plan_value_category: MCPPlanValueCategory mcp_register_external_client_request: MCPRegisterExternalClientRequest mcp_reload_config: MCPReloadConfig mcp_reload_with_config_request: MCPReloadWithConfigRequest @@ -32541,6 +34957,12 @@ class RPC: mcp_server: MCPServer mcp_server_auth_config: bool | MCPServerAuthConfigRedirectPort mcp_server_auth_config_redirect_port: MCPServerAuthConfigRedirectPort + mcp_server_card_embedded: MCPServerCardEmbedded + mcp_server_card_embedded_kind: MCPServerCardEmbeddedKind + mcp_server_card_media_type: MCPServerCardMediaType + mcp_server_card_reference: MCPServerCardReference + mcp_server_card_url: MCPServerCardURL + mcp_server_card_url_kind: MCPServerCardURLKind mcp_server_config: MCPServerConfig mcp_server_config_defer_tools: MCPServerConfigDeferTools mcp_server_config_http: MCPServerConfigHTTP @@ -32611,6 +35033,7 @@ class RPC: model_switch_to_result: ModelSwitchToResult mode_set_request: ModeSetRequest mode_set_result: ModeSetResult + move_mcp_loading_to_background_result: MoveMCPLoadingToBackgroundResult named_provider_config: NamedProviderConfig name_get_result: NameGetResult name_set_auto_request: NameSetAutoRequest @@ -32678,6 +35101,7 @@ class RPC: permission_location_resolve_params: PermissionLocationResolveParams permission_location_resolve_result: PermissionLocationResolveResult permission_location_type: PermissionLocationType + permission_mode_source: PermissionSource permission_paths_add_params: PermissionPathsAddParams permission_paths_allowed_check_params: PermissionPathsAllowedCheckParams permission_paths_allowed_check_result: PermissionPathsAllowedCheckResult @@ -32689,7 +35113,6 @@ class RPC: permission_prompt_shown_notification: PermissionPromptShownNotification permission_request_result: PermissionRequestResult permission_rules_set: PermissionRulesSet - permissions_allow_all_mode: PermissionsAllowAllMode permissions_configure_additional_content_exclusion_policy: PermissionsConfigureAdditionalContentExclusionPolicy permissions_configure_additional_content_exclusion_policy_rule: PermissionsConfigureAdditionalContentExclusionPolicyRule permissions_configure_additional_content_exclusion_policy_rule_source: PermissionsConfigureAdditionalContentExclusionPolicyRuleSource @@ -32697,7 +35120,8 @@ class RPC: permissions_configure_params: PermissionsConfigureParams permissions_configure_result: PermissionsConfigureResult permissions_folder_trust_add_trusted_result: PermissionsFolderTrustAddTrustedResult - permissions_get_allow_all_request: PermissionsGetAllowAllRequest + permissions_get_mode_request: PermissionsGetModeRequest + permissions_get_mode_result: PermissionsGetModeResult permissions_locations_add_tool_approval_details: PermissionsLocationsAddToolApprovalDetails permissions_locations_add_tool_approval_details_commands: PermissionsLocationsAddToolApprovalDetailsCommands permissions_locations_add_tool_approval_details_custom_tool: PermissionsLocationsAddToolApprovalDetailsCustomTool @@ -32721,11 +35145,11 @@ class RPC: permissions_pending_requests_request: PermissionsPendingRequestsRequest permissions_reset_session_approvals_request: PermissionsResetSessionApprovalsRequest permissions_reset_session_approvals_result: PermissionsResetSessionApprovalsResult - permissions_set_allow_all_request: PermissionsSetAllowAllRequest - permissions_set_allow_all_source: PermissionsSetAAllSource permissions_set_approve_all_request: PermissionsSetApproveAllRequest permissions_set_approve_all_result: PermissionsSetApproveAllResult - permissions_set_approve_all_source: PermissionsSetAAllSource + permissions_set_approve_all_source: PermissionSource + permissions_set_mode_request: PermissionsSetModeRequest + permissions_set_mode_result: PermissionsSetModeResult permissions_set_required_request: PermissionsSetRequiredRequest permissions_set_required_result: PermissionsSetRequiredResult permissions_urls_set_unrestricted_mode_result: PermissionsUrlsSetUnrestrictedModeResult @@ -33286,8 +35710,6 @@ def from_dict(obj: Any) -> 'RPC': agent_select_result = AgentSelectResult.from_dict(obj.get("AgentSelectResult")) agent_set_prompt_request = AgentSetPromptRequest.from_dict(obj.get("AgentSetPromptRequest")) agents_get_discovery_paths_request = AgentsGetDiscoveryPathsRequest.from_dict(obj.get("AgentsGetDiscoveryPathsRequest")) - allow_all_permission_set_result = AllowAllPermissionSetResult.from_dict(obj.get("AllowAllPermissionSetResult")) - allow_all_permission_state = AllowAllPermissionState.from_dict(obj.get("AllowAllPermissionState")) api_key_auth_info = APIKeyAuthInfo.from_dict(obj.get("ApiKeyAuthInfo")) auth_identity = AuthIdentity.from_dict(obj.get("AuthIdentity")) auth_info = _load_AuthInfo(obj.get("AuthInfo")) @@ -33322,6 +35744,52 @@ def from_dict(obj: Any) -> 'RPC': canvas_provider_unregister_request = CanvasProviderUnregisterRequest.from_dict(obj.get("CanvasProviderUnregisterRequest")) canvas_session_context = CanvasSessionContext.from_dict(obj.get("CanvasSessionContext")) capi_session_options = CapiSessionOptions.from_dict(obj.get("CapiSessionOptions")) + card_digest = CardDigest.from_dict(obj.get("CardDigest")) + card_digest_algorithm = CardDigestAlgorithm(obj.get("CardDigestAlgorithm")) + card_digest_value = from_str(obj.get("CardDigestValue")) + catalog_ai_skill_candidate = CatalogAISkillCandidate.from_dict(obj.get("CatalogAiSkillCandidate")) + catalog_ai_skill_candidate_provenance = CatalogAISkillCandidateProvenance.from_dict(obj.get("CatalogAiSkillCandidateProvenance")) + catalog_authentication_required_error = CatalogAuthenticationRequiredError.from_dict(obj.get("CatalogAuthenticationRequiredError")) + catalog_authentication_required_reason = CatalogAuthenticationRequiredReason(obj.get("CatalogAuthenticationRequiredReason")) + catalog_candidate = CatalogCandidate.from_dict(obj.get("CatalogCandidate")) + catalog_candidate_kind = CatalogCandidateKind(obj.get("CatalogCandidateKind")) + catalog_candidate_source = _load_CatalogCandidateSource(obj.get("CatalogCandidateSource")) + catalog_candidate_source_embedded = CatalogCandidateSourceEmbedded.from_dict(obj.get("CatalogCandidateSourceEmbedded")) + catalog_candidate_source_url = CatalogCandidateSourceURL.from_dict(obj.get("CatalogCandidateSourceUrl")) + catalog_capability = CatalogCapability(obj.get("CatalogCapability")) + catalog_capability_id = from_str(obj.get("CatalogCapabilityId")) + catalog_client_contract = CatalogClientContract.from_dict(obj.get("CatalogClientContract")) + catalog_contract_violation_error = CatalogContractViolationError.from_dict(obj.get("CatalogContractViolationError")) + catalog_contract_violation_reason = CatalogContractViolationReason(obj.get("CatalogContractViolationReason")) + catalog_handle_rejected_error = CatalogHandleRejectedError.from_dict(obj.get("CatalogHandleRejectedError")) + catalog_handle_rejection_reason = CatalogHandleRejectionReason(obj.get("CatalogHandleRejectionReason")) + catalog_handle_type = CatalogHandleType(obj.get("CatalogHandleType")) + catalog_invalid_request_error = CatalogInvalidRequestError.from_dict(obj.get("CatalogInvalidRequestError")) + catalog_invalid_request_field = CatalogInvalidRequestField(obj.get("CatalogInvalidRequestField")) + catalog_malformed_card_error = CatalogMalformedCardError.from_dict(obj.get("CatalogMalformedCardError")) + catalog_malformed_card_reason = CatalogMalformedCardReason(obj.get("CatalogMalformedCardReason")) + catalog_mcp_server_candidate = CatalogMCPServerCandidate.from_dict(obj.get("CatalogMcpServerCandidate")) + catalog_mcp_server_candidate_provenance = CatalogMCPServerCandidateProvenance.from_dict(obj.get("CatalogMcpServerCandidateProvenance")) + catalog_mcp_server_installability = CatalogMCPServerInstallabilityEnum(obj.get("CatalogMcpServerInstallability")) + catalog_media_type = CatalogMediaType(obj.get("CatalogMediaType")) + catalog_negotiated_contract = CatalogNegotiatedContract.from_dict(obj.get("CatalogNegotiatedContract")) + catalog_negotiation_refused_error = CatalogNegotiationRefusedError.from_dict(obj.get("CatalogNegotiationRefusedError")) + catalog_negotiation_refused_reason = CatalogNegotiationRefusedReason(obj.get("CatalogNegotiationRefusedReason")) + catalog_network_failure_error = CatalogNetworkFailureError.from_dict(obj.get("CatalogNetworkFailureError")) + catalog_network_failure_reason = CatalogNetworkFailureReason(obj.get("CatalogNetworkFailureReason")) + catalog_not_installable_error = CatalogNotInstallableError.from_dict(obj.get("CatalogNotInstallableError")) + catalog_not_installable_reason = CatalogNotInstallableReason(obj.get("CatalogNotInstallableReason")) + catalog_policy_rejected_error = CatalogPolicyRejectedError.from_dict(obj.get("CatalogPolicyRejectedError")) + catalog_search_request = CatalogSearchRequest.from_dict(obj.get("CatalogSearchRequest")) + catalog_search_result = _load_CatalogSearchResult(obj.get("CatalogSearchResult")) + catalog_search_succeeded = CatalogSearchSucceeded.from_dict(obj.get("CatalogSearchSucceeded")) + catalog_unavailable_error = CatalogUnavailableError.from_dict(obj.get("CatalogUnavailableError")) + catalog_unavailable_reason = CatalogUnavailableReason(obj.get("CatalogUnavailableReason")) + catalog_unavailable_transport_error = CatalogUnavailableTransportError.from_dict(obj.get("CatalogUnavailableTransportError")) + catalog_unavailable_transport_reason = CatalogUnavailableTransportReason(obj.get("CatalogUnavailableTransportReason")) + catalog_unsafe_retrieval_error = CatalogUnsafeRetrievalError.from_dict(obj.get("CatalogUnsafeRetrievalError")) + catalog_unsafe_retrieval_reason = CatalogUnsafeRetrievalReason(obj.get("CatalogUnsafeRetrievalReason")) + catalog_unsupported_kind_error = CatalogUnsupportedKindError.from_dict(obj.get("CatalogUnsupportedKindError")) command_list = CommandList.from_dict(obj.get("CommandList")) commands_finalize_invocation_effect_request = CommandsFinalizeInvocationEffectRequest.from_dict(obj.get("CommandsFinalizeInvocationEffectRequest")) commands_finalize_invocation_effect_result = CommandsFinalizeInvocationEffectResult.from_dict(obj.get("CommandsFinalizeInvocationEffectResult")) @@ -33584,6 +36052,7 @@ def from_dict(obj: Any) -> 'RPC': mcp_headers_handle_pending_headers_refresh_request_request = MCPHeadersHandlePendingHeadersRefreshRequestRequest.from_dict(obj.get("McpHeadersHandlePendingHeadersRefreshRequestRequest")) mcp_headers_handle_pending_headers_refresh_request_result = MCPHeadersHandlePendingHeadersRefreshRequestResult.from_dict(obj.get("McpHeadersHandlePendingHeadersRefreshRequestResult")) mcp_host_state = MCPHostState.from_dict(obj.get("McpHostState")) + mcp_install_plan = MCPInstallPlan.from_dict(obj.get("McpInstallPlan")) mcp_is_server_running_request = MCPIsServerRunningRequest.from_dict(obj.get("McpIsServerRunningRequest")) mcp_is_server_running_result = MCPIsServerRunningResult.from_dict(obj.get("McpIsServerRunningResult")) mcp_list_tools_request = MCPListToolsRequest.from_dict(obj.get("McpListToolsRequest")) @@ -33600,6 +36069,40 @@ def from_dict(obj: Any) -> 'RPC': mcp_oauth_probe_result = MCPOauthProbeResult.from_dict(obj.get("McpOauthProbeResult")) mcp_oauth_respond_request = MCPOauthRespondRequest.from_dict(obj.get("McpOauthRespondRequest")) mcp_oauth_respond_result = MCPOauthRespondResult.from_dict(obj.get("McpOauthRespondResult")) + mcp_plan_configuration_change = MCPPlanConfigurationChange.from_dict(obj.get("McpPlanConfigurationChange")) + mcp_plan_configuration_operation = MCPPlanConfigurationOperation(obj.get("McpPlanConfigurationOperation")) + mcp_plan_enum_value_type = MCPPlan(obj.get("McpPlanEnumValueType")) + mcp_plan_install_planned = MCPPlanInstallPlanned.from_dict(obj.get("McpPlanInstallPlanned")) + mcp_plan_install_request = MCPPlanInstallRequest.from_dict(obj.get("McpPlanInstallRequest")) + mcp_plan_install_result = _load_MCPPlanInstallResult(obj.get("McpPlanInstallResult")) + mcp_plan_install_source = _load_MCPPlanInstallSource(obj.get("McpPlanInstallSource")) + mcp_plan_install_source_candidate = MCPPlanInstallSourceCandidate.from_dict(obj.get("McpPlanInstallSourceCandidate")) + mcp_plan_install_source_candidate_kind = MCPPlanInstallSourceCandidateKind(obj.get("McpPlanInstallSourceCandidateKind")) + mcp_plan_install_source_card = MCPPlanInstallSourceCard.from_dict(obj.get("McpPlanInstallSourceCard")) + mcp_plan_install_source_card_kind = MCPPlanInstallSourceCardKind(obj.get("McpPlanInstallSourceCardKind")) + mcp_plan_package_install_method = MCPPlanPackageInstallMethod(obj.get("McpPlanPackageInstallMethod")) + mcp_plan_package_transport = MCPPlanPackageTransport(obj.get("McpPlanPackageTransport")) + mcp_plan_policy_decision = MCPPlanPolicyDecision(obj.get("McpPlanPolicyDecision")) + mcp_plan_policy_result = MCPPlanPolicyResult.from_dict(obj.get("McpPlanPolicyResult")) + mcp_plan_policy_source = MCPPlanPolicySource(obj.get("McpPlanPolicySource")) + mcp_plan_provenance = MCPPlanProvenance.from_dict(obj.get("McpPlanProvenance")) + mcp_plan_remote_install_method = MCPPlanRemoteInstallMethod(obj.get("McpPlanRemoteInstallMethod")) + mcp_plan_remote_transport = MCPPlanRemoteTransport(obj.get("McpPlanRemoteTransport")) + mcp_plan_required_value = _load_MCPPlanRequiredValue(obj.get("McpPlanRequiredValue")) + mcp_plan_required_value_enum = MCPPlanRequiredValueEnum.from_dict(obj.get("McpPlanRequiredValueEnum")) + mcp_plan_required_value_enum_kind = MCPPlan(obj.get("McpPlanRequiredValueEnumKind")) + mcp_plan_required_value_scalar = MCPPlanRequiredValueScalar.from_dict(obj.get("McpPlanRequiredValueScalar")) + mcp_plan_required_value_scalar_kind = MCPPlanRequiredValueScalarKind(obj.get("McpPlanRequiredValueScalarKind")) + mcp_plan_resource_identity = MCPPlanResourceIdentity.from_dict(obj.get("McpPlanResourceIdentity")) + mcp_plan_scalar_value_type = MCPPlanScalarValueTypeEnum(obj.get("McpPlanScalarValueType")) + mcp_plan_scope = MCPPlanScope(obj.get("McpPlanScope")) + mcp_plan_secret_placeholder = MCPPlanSecretPlaceholder.from_dict(obj.get("McpPlanSecretPlaceholder")) + mcp_plan_secret_reference = from_str(obj.get("McpPlanSecretReference")) + mcp_plan_target = MCPPlanTarget.from_dict(obj.get("McpPlanTarget")) + mcp_plan_transport_choice = _load_MCPPlanTransportChoice(obj.get("McpPlanTransportChoice")) + mcp_plan_transport_choice_package = MCPPlanTransportChoicePackage.from_dict(obj.get("McpPlanTransportChoicePackage")) + mcp_plan_transport_choice_remote = MCPPlanTransportChoiceRemote.from_dict(obj.get("McpPlanTransportChoiceRemote")) + mcp_plan_value_category = MCPPlanValueCategory(obj.get("McpPlanValueCategory")) mcp_register_external_client_request = MCPRegisterExternalClientRequest.from_dict(obj.get("McpRegisterExternalClientRequest")) mcp_reload_config = MCPReloadConfig.from_dict(obj.get("McpReloadConfig")) mcp_reload_with_config_request = MCPReloadWithConfigRequest.from_dict(obj.get("McpReloadWithConfigRequest")) @@ -33624,6 +36127,12 @@ def from_dict(obj: Any) -> 'RPC': mcp_server = MCPServer.from_dict(obj.get("McpServer")) mcp_server_auth_config = from_union([from_bool, MCPServerAuthConfigRedirectPort.from_dict], obj.get("McpServerAuthConfig")) mcp_server_auth_config_redirect_port = MCPServerAuthConfigRedirectPort.from_dict(obj.get("McpServerAuthConfigRedirectPort")) + mcp_server_card_embedded = MCPServerCardEmbedded.from_dict(obj.get("McpServerCardEmbedded")) + mcp_server_card_embedded_kind = MCPServerCardEmbeddedKind(obj.get("McpServerCardEmbeddedKind")) + mcp_server_card_media_type = MCPServerCardMediaType(obj.get("McpServerCardMediaType")) + mcp_server_card_reference = _load_MCPServerCardReference(obj.get("McpServerCardReference")) + mcp_server_card_url = MCPServerCardURL.from_dict(obj.get("McpServerCardUrl")) + mcp_server_card_url_kind = MCPServerCardURLKind(obj.get("McpServerCardUrlKind")) mcp_server_config = MCPServerConfig.from_dict(obj.get("McpServerConfig")) mcp_server_config_defer_tools = MCPServerConfigDeferTools(obj.get("McpServerConfigDeferTools")) mcp_server_config_http = MCPServerConfigHTTP.from_dict(obj.get("McpServerConfigHttp")) @@ -33694,6 +36203,7 @@ def from_dict(obj: Any) -> 'RPC': model_switch_to_result = ModelSwitchToResult.from_dict(obj.get("ModelSwitchToResult")) mode_set_request = ModeSetRequest.from_dict(obj.get("ModeSetRequest")) mode_set_result = ModeSetResult.from_dict(obj.get("ModeSetResult")) + move_mcp_loading_to_background_result = MoveMCPLoadingToBackgroundResult.from_dict(obj.get("MoveMcpLoadingToBackgroundResult")) named_provider_config = NamedProviderConfig.from_dict(obj.get("NamedProviderConfig")) name_get_result = NameGetResult.from_dict(obj.get("NameGetResult")) name_set_auto_request = NameSetAutoRequest.from_dict(obj.get("NameSetAutoRequest")) @@ -33761,6 +36271,7 @@ def from_dict(obj: Any) -> 'RPC': permission_location_resolve_params = PermissionLocationResolveParams.from_dict(obj.get("PermissionLocationResolveParams")) permission_location_resolve_result = PermissionLocationResolveResult.from_dict(obj.get("PermissionLocationResolveResult")) permission_location_type = PermissionLocationType(obj.get("PermissionLocationType")) + permission_mode_source = PermissionSource(obj.get("PermissionModeSource")) permission_paths_add_params = PermissionPathsAddParams.from_dict(obj.get("PermissionPathsAddParams")) permission_paths_allowed_check_params = PermissionPathsAllowedCheckParams.from_dict(obj.get("PermissionPathsAllowedCheckParams")) permission_paths_allowed_check_result = PermissionPathsAllowedCheckResult.from_dict(obj.get("PermissionPathsAllowedCheckResult")) @@ -33772,7 +36283,6 @@ def from_dict(obj: Any) -> 'RPC': permission_prompt_shown_notification = PermissionPromptShownNotification.from_dict(obj.get("PermissionPromptShownNotification")) permission_request_result = PermissionRequestResult.from_dict(obj.get("PermissionRequestResult")) permission_rules_set = PermissionRulesSet.from_dict(obj.get("PermissionRulesSet")) - permissions_allow_all_mode = PermissionsAllowAllMode(obj.get("PermissionsAllowAllMode")) permissions_configure_additional_content_exclusion_policy = PermissionsConfigureAdditionalContentExclusionPolicy.from_dict(obj.get("PermissionsConfigureAdditionalContentExclusionPolicy")) permissions_configure_additional_content_exclusion_policy_rule = PermissionsConfigureAdditionalContentExclusionPolicyRule.from_dict(obj.get("PermissionsConfigureAdditionalContentExclusionPolicyRule")) permissions_configure_additional_content_exclusion_policy_rule_source = PermissionsConfigureAdditionalContentExclusionPolicyRuleSource.from_dict(obj.get("PermissionsConfigureAdditionalContentExclusionPolicyRuleSource")) @@ -33780,7 +36290,8 @@ def from_dict(obj: Any) -> 'RPC': permissions_configure_params = PermissionsConfigureParams.from_dict(obj.get("PermissionsConfigureParams")) permissions_configure_result = PermissionsConfigureResult.from_dict(obj.get("PermissionsConfigureResult")) permissions_folder_trust_add_trusted_result = PermissionsFolderTrustAddTrustedResult.from_dict(obj.get("PermissionsFolderTrustAddTrustedResult")) - permissions_get_allow_all_request = PermissionsGetAllowAllRequest.from_dict(obj.get("PermissionsGetAllowAllRequest")) + permissions_get_mode_request = PermissionsGetModeRequest.from_dict(obj.get("PermissionsGetModeRequest")) + permissions_get_mode_result = PermissionsGetModeResult.from_dict(obj.get("PermissionsGetModeResult")) permissions_locations_add_tool_approval_details = _load_PermissionsLocationsAddToolApprovalDetails(obj.get("PermissionsLocationsAddToolApprovalDetails")) permissions_locations_add_tool_approval_details_commands = PermissionsLocationsAddToolApprovalDetailsCommands.from_dict(obj.get("PermissionsLocationsAddToolApprovalDetailsCommands")) permissions_locations_add_tool_approval_details_custom_tool = PermissionsLocationsAddToolApprovalDetailsCustomTool.from_dict(obj.get("PermissionsLocationsAddToolApprovalDetailsCustomTool")) @@ -33804,11 +36315,11 @@ def from_dict(obj: Any) -> 'RPC': permissions_pending_requests_request = PermissionsPendingRequestsRequest.from_dict(obj.get("PermissionsPendingRequestsRequest")) permissions_reset_session_approvals_request = PermissionsResetSessionApprovalsRequest.from_dict(obj.get("PermissionsResetSessionApprovalsRequest")) permissions_reset_session_approvals_result = PermissionsResetSessionApprovalsResult.from_dict(obj.get("PermissionsResetSessionApprovalsResult")) - permissions_set_allow_all_request = PermissionsSetAllowAllRequest.from_dict(obj.get("PermissionsSetAllowAllRequest")) - permissions_set_allow_all_source = PermissionsSetAAllSource(obj.get("PermissionsSetAllowAllSource")) permissions_set_approve_all_request = PermissionsSetApproveAllRequest.from_dict(obj.get("PermissionsSetApproveAllRequest")) permissions_set_approve_all_result = PermissionsSetApproveAllResult.from_dict(obj.get("PermissionsSetApproveAllResult")) - permissions_set_approve_all_source = PermissionsSetAAllSource(obj.get("PermissionsSetApproveAllSource")) + permissions_set_approve_all_source = PermissionSource(obj.get("PermissionsSetApproveAllSource")) + permissions_set_mode_request = PermissionsSetModeRequest.from_dict(obj.get("PermissionsSetModeRequest")) + permissions_set_mode_result = PermissionsSetModeResult.from_dict(obj.get("PermissionsSetModeResult")) permissions_set_required_request = PermissionsSetRequiredRequest.from_dict(obj.get("PermissionsSetRequiredRequest")) permissions_set_required_result = PermissionsSetRequiredResult.from_dict(obj.get("PermissionsSetRequiredResult")) permissions_urls_set_unrestricted_mode_result = PermissionsUrlsSetUnrestrictedModeResult.from_dict(obj.get("PermissionsUrlsSetUnrestrictedModeResult")) @@ -34322,7 +36833,7 @@ def from_dict(obj: Any) -> 'RPC': subagent_settings = from_union([SubagentSettings.from_dict, from_none], obj.get("SubagentSettings")) task_progress = from_union([TaskProgress.from_dict, from_none], obj.get("TaskProgress")) workspace_summary = from_union([WorkspaceSummary.from_dict, from_none], obj.get("WorkspaceSummary")) - return RPC(abort_request, abort_result, account_all_users, account_get_all_users_result, account_get_current_auth_result, account_get_quota_request, account_get_quota_result, account_login_request, account_login_result, account_logout_request, account_logout_result, account_quota_snapshot, adaptive_thinking_support, agent_discovery_path, agent_discovery_path_list, agent_discovery_path_scope, agent_get_current_result, agent_info, agent_info_source, agent_list, agent_list_request, agent_registry_live_target_entry, agent_registry_live_target_entry_attention_kind, agent_registry_live_target_entry_kind, agent_registry_live_target_entry_last_terminal_event, agent_registry_live_target_entry_status, agent_registry_log_capture, agent_registry_log_capture_open_error_reason, agent_registry_spawn_error, agent_registry_spawn_permission_mode, agent_registry_spawn_registry_timeout, agent_registry_spawn_request, agent_registry_spawn_result, agent_registry_spawn_spawned, agent_registry_spawn_validation_error, agent_registry_spawn_validation_error_field, agent_registry_spawn_validation_error_reason, agent_reload_result, agents_discover_request, agent_select_request, agent_select_result, agent_set_prompt_request, agents_get_discovery_paths_request, allow_all_permission_set_result, allow_all_permission_state, api_key_auth_info, auth_identity, auth_info, auth_info_type, auth_validation_error, auth_validation_errors, built_in_model_catalog, built_in_model_catalog_entry, builtin_tool_descriptor, builtin_tool_format, builtin_tool_format_type, builtin_tool_input_schema, builtin_tool_input_schema_type, builtin_tool_safe_for_telemetry, builtin_tool_safe_telemetry_fields, cancel_user_requested_shell_command_result, canvas_action, canvas_action_invoke_request, canvas_action_invoke_result, canvas_close_request, canvas_host_context, canvas_host_context_capabilities, canvas_json_schema, canvas_list, canvas_list_open_result, canvas_open_request, canvas_provider_close_request, canvas_provider_invoke_action_request, canvas_provider_open_request, canvas_provider_open_result, canvas_provider_register_request, canvas_provider_unregister_request, canvas_session_context, capi_session_options, command_list, commands_finalize_invocation_effect_request, commands_finalize_invocation_effect_result, commands_handle_pending_command_request, commands_handle_pending_command_result, commands_invocation_effect_outcome, commands_invocation_origin, commands_invoke_request, commands_list_request, commands_respond_to_queued_command_request, commands_respond_to_queued_command_result, completions_get_trigger_characters_result, completions_request_request, completions_request_result, configure_session_extensions_params, connected_remote_session_metadata, connected_remote_session_metadata_kind, connected_remote_session_metadata_repository, connect_remote_session_params, connect_request, connect_result, content_exclusion_check_paths_request, content_exclusion_check_paths_result, content_exclusion_path_check, content_filter_mode, context_heaviest_message, copilot_api_token_auth_info, copilot_user_response, copilot_user_response_endpoints, copilot_user_response_quota_snapshots, copilot_user_response_quota_snapshots_chat, copilot_user_response_quota_snapshots_completions, copilot_user_response_quota_snapshots_premium_interactions, current_model, current_tool_metadata, debug_collect_logs_collected_entry, debug_collect_logs_destination, debug_collect_logs_entry, debug_collect_logs_entry_kind, debug_collect_logs_include, debug_collect_logs_redaction, debug_collect_logs_request, debug_collect_logs_result, debug_collect_logs_result_kind, debug_collect_logs_skipped_entry, debug_collect_logs_source, disable_bypass_permissions_mode, discovered_canvas, discovered_extension, discovered_extension_mode, discovered_extension_plugin, discovered_extensions, discovered_extensions_disable_request, discovered_extensions_enable_request, discovered_extension_source, discovered_mcp_server, discovered_mcp_server_type, enqueue_command_params, enqueue_command_result, env_auth_info, event_log_read_request, event_log_release_interest_result, event_log_tail_result, event_log_types, events_agent_scope, events_cursor_status, events_read_direction, events_read_result, execute_command_params, execute_command_result, extension, extension_context_push_input, extension_launch_profile, extension_launch_provider_resolve_request, extension_launch_provider_resolve_result, extension_list, extensions_disable_request, extensions_enable_request, extension_source, extension_status, external_tool_result, external_tool_text_result_for_llm, external_tool_text_result_for_llm_binary_results_for_llm, external_tool_text_result_for_llm_binary_results_for_llm_type, external_tool_text_result_for_llm_content, external_tool_text_result_for_llm_content_audio, external_tool_text_result_for_llm_content_image, external_tool_text_result_for_llm_content_resource, external_tool_text_result_for_llm_content_resource_details, external_tool_text_result_for_llm_content_resource_link, external_tool_text_result_for_llm_content_resource_link_icon, external_tool_text_result_for_llm_content_resource_link_icon_theme, external_tool_text_result_for_llm_content_shell_exit, external_tool_text_result_for_llm_content_terminal, external_tool_text_result_for_llm_content_text, factory_abort_request, factory_ack_result, factory_agent_options, factory_agent_request, factory_agent_result, factory_agent_summary, factory_cancel_request, factory_current_phase, factory_declared_limits, factory_durable_operation, factory_execute_request, factory_execute_result, factory_get_run_progress_request, factory_get_run_request, factory_journal_get_request, factory_journal_get_result, factory_journal_put_request, factory_list_runs_request, factory_list_runs_result, factory_log_line, factory_log_line_kind, factory_log_request, factory_phase_observation, factory_phase_status, factory_progress_line, factory_progress_page, factory_resume_request, factory_resume_result, factory_run_consumed, factory_run_detail, factory_run_failure, factory_run_failure_kind, factory_run_limits, factory_run_request, factory_run_result, factory_run_status, factory_run_summary, factory_run_terminal, filter_mapping, fleet_start_request, fleet_start_result, folder_trust_add_params, folder_trust_check_params, folder_trust_check_result, gh_cli_auth_info, git_hub_telemetry_client_info, git_hub_telemetry_event, git_hub_telemetry_notification, handle_pending_tool_call_request, handle_pending_tool_call_result, history_abort_manual_compaction_result, history_cancel_background_compaction_result, history_clear_context_request, history_clear_context_result, history_compact_context_window, history_compact_request, history_compact_result, history_file_restore_skip_reason, history_list_rewind_points_result, history_preview_rewind_request, history_preview_rewind_result, history_rewind_change_type, history_rewind_file_preview, history_rewind_mode, history_rewind_outcome, history_rewind_point, history_rewind_request, history_rewind_result, history_rewind_unavailable_reason, history_skipped_file_restore, history_summarize_for_handoff_result, history_truncate_request, history_truncate_result, hmac_auth_info, hook_invoke_request, hook_invoke_response, hook_type, installed_plugin, installed_plugin_info, installed_plugin_source, installed_plugin_source_git_hub, installed_plugin_source_local, installed_plugin_source_url, instruction_discovery_path, instruction_discovery_path_kind, instruction_discovery_path_list, instruction_discovery_path_location, instructions_discover_request, instructions_get_discovery_paths_request, instructions_get_sources_result, instruction_source, instruction_source_location, instruction_source_type, interrupt_main_turn_request, interrupt_main_turn_result, llm_inference_headers, llm_inference_http_request_chunk_request, llm_inference_http_request_chunk_result, llm_inference_http_request_start_request, llm_inference_http_request_start_result, llm_inference_http_request_start_transport, llm_inference_http_response_chunk_error, llm_inference_http_response_chunk_request, llm_inference_http_response_chunk_result, llm_inference_http_response_start_request, llm_inference_http_response_start_result, llm_inference_set_provider_result, local_session_metadata_value, log_request, log_result, lsp_initialize_request, managed_settings_read_result, marketplace_add_result, marketplace_browse_result, marketplace_info, marketplace_list_result, marketplace_plugin_info, marketplace_refresh_entry, marketplace_refresh_result, marketplace_remove_result, mcp_allowed_server, mcp_apps_call_tool_request, mcp_apps_diagnose_capability, mcp_apps_diagnose_request, mcp_apps_diagnose_result, mcp_apps_diagnose_server, mcp_apps_host_context, mcp_apps_host_context_details, mcp_apps_host_context_details_available_display_mode, mcp_apps_host_context_details_display_mode, mcp_apps_host_context_details_platform, mcp_apps_host_context_details_theme, mcp_apps_list_tools_request, mcp_apps_list_tools_result, mcp_apps_read_resource_request, mcp_apps_read_resource_result, mcp_apps_resource_content, mcp_apps_set_host_context_details, mcp_apps_set_host_context_details_available_display_mode, mcp_apps_set_host_context_details_display_mode, mcp_apps_set_host_context_details_platform, mcp_apps_set_host_context_details_theme, mcp_apps_set_host_context_request, mcp_cancel_sampling_execution_params, mcp_cancel_sampling_execution_result, mcp_config_add_request, mcp_config_disable_request, mcp_config_enable_request, mcp_config_list, mcp_config_remove_request, mcp_config_update_request, mcp_configure_git_hub_request, mcp_configure_git_hub_result, mcp_disable_request, mcp_discover_request, mcp_discover_result, mcp_elicitation_form_mode, mcp_enable_request, mcp_execute_sampling_params, mcp_execute_sampling_request, mcp_execute_sampling_result, mcp_failed_server, mcp_filtered_server, mcp_headers_handle_pending_headers_refresh_request, mcp_headers_handle_pending_headers_refresh_request_request, mcp_headers_handle_pending_headers_refresh_request_result, mcp_host_state, mcp_is_server_running_request, mcp_is_server_running_result, mcp_list_tools_request, mcp_list_tools_result, mcp_oauth_authentication_state_changed_request, mcp_oauth_handle_pending_request, mcp_oauth_handle_pending_result, mcp_oauth_login_grant_type, mcp_oauth_login_request, mcp_oauth_login_result, mcp_oauth_pending_request_response, mcp_oauth_probe_needs_auth_reason, mcp_oauth_probe_request, mcp_oauth_probe_result, mcp_oauth_respond_request, mcp_oauth_respond_result, mcp_register_external_client_request, mcp_reload_config, mcp_reload_with_config_request, mcp_remove_git_hub_result, mcp_resource, mcp_resource_annotations, mcp_resource_content, mcp_resource_icon, mcp_resources_list_request, mcp_resources_list_result, mcp_resources_list_templates_request, mcp_resources_list_templates_result, mcp_resources_read_request, mcp_resources_read_result, mcp_resource_template, mcp_restart_server_request, mcp_safe_for_telemetry, mcp_safe_for_telemetry_fields, mcp_sampling_execution_action, mcp_sampling_execution_result, mcp_serializable_server_config, mcp_server, mcp_server_auth_config, mcp_server_auth_config_redirect_port, mcp_server_config, mcp_server_config_defer_tools, mcp_server_config_http, mcp_server_config_http_oauth_grant_type, mcp_server_config_http_type, mcp_server_config_memory, mcp_server_config_memory_type, mcp_server_config_stdio, mcp_server_config_stdio_type, mcp_server_failure_info, mcp_server_list, mcp_server_needs_auth_info, mcp_set_env_value_mode_details, mcp_set_env_value_mode_params, mcp_set_env_value_mode_result, mcp_start_server_request, mcp_start_servers_result, mcp_stop_server_request, mcp_task_metadata, mcp_tools, mcp_tool_ui, mcp_tool_ui_visibility, mcp_unregister_external_client_request, memory_configuration, metadata_context_attribution_result, metadata_context_heaviest_messages_request, metadata_context_heaviest_messages_result, metadata_context_info_request, metadata_context_info_result, metadata_is_processing_result, metadata_recompute_context_tokens_request, metadata_recompute_context_tokens_result, metadata_record_context_change_request, metadata_record_context_change_result, metadata_set_working_directory_request, metadata_set_working_directory_result, metadata_snapshot_current_mode, metadata_snapshot_remote_metadata, metadata_snapshot_remote_metadata_repository, metadata_snapshot_remote_metadata_task_type, model, model_apply_startup_overlay_request, model_billing, model_billing_promo, model_billing_token_prices, model_billing_token_prices_long_context, model_capabilities, model_capabilities_limits, model_capabilities_limits_vision, model_capabilities_override, model_capabilities_override_limits, model_capabilities_override_limits_vision, model_capabilities_override_supports, model_capabilities_supports, model_list, model_list_request, model_picker_category, model_picker_persistence_request, model_picker_price_category, model_picker_settings_context, model_policy, model_policy_state, model_set_reasoning_effort_request, model_set_reasoning_effort_result, models_list_request, model_switch_confirmation, model_switch_to_request, model_switch_to_result, mode_set_request, mode_set_result, named_provider_config, name_get_result, name_set_auto_request, name_set_auto_result, name_set_request, open_canvas_instance, options_update_additional_content_exclusion_policy, options_update_additional_content_exclusion_policy_rule, options_update_additional_content_exclusion_policy_rule_source, options_update_additional_content_exclusion_policy_scope, options_update_context_tier, options_update_env_value_mode, options_update_reasoning_summary, options_update_tool_filter_precedence, pending_permission_request, pending_permission_request_list, permission_decision, permission_decision_approved, permission_decision_approved_for_location, permission_decision_approved_for_session, permission_decision_approve_for_location, permission_decision_approve_for_location_approval, permission_decision_approve_for_location_approval_commands, permission_decision_approve_for_location_approval_custom_tool, permission_decision_approve_for_location_approval_extension_env_access, permission_decision_approve_for_location_approval_extension_management, permission_decision_approve_for_location_approval_extension_permission_access, permission_decision_approve_for_location_approval_factory, permission_decision_approve_for_location_approval_mcp, permission_decision_approve_for_location_approval_mcp_sampling, permission_decision_approve_for_location_approval_memory, permission_decision_approve_for_location_approval_read, permission_decision_approve_for_location_approval_write, permission_decision_approve_for_session, permission_decision_approve_for_session_approval, permission_decision_approve_for_session_approval_commands, permission_decision_approve_for_session_approval_custom_tool, permission_decision_approve_for_session_approval_extension_env_access, permission_decision_approve_for_session_approval_extension_management, permission_decision_approve_for_session_approval_extension_permission_access, permission_decision_approve_for_session_approval_factory, permission_decision_approve_for_session_approval_mcp, permission_decision_approve_for_session_approval_mcp_sampling, permission_decision_approve_for_session_approval_memory, permission_decision_approve_for_session_approval_read, permission_decision_approve_for_session_approval_write, permission_decision_approve_once, permission_decision_approve_permanently, permission_decision_cancelled, permission_decision_context, permission_decision_denied_by_content_exclusion_policy, permission_decision_denied_by_permission_request_hook, permission_decision_denied_by_rules, permission_decision_denied_interactively_by_user, permission_decision_denied_no_approval_rule_and_could_not_request_from_user, permission_decision_outcome, permission_decision_reject, permission_decision_request, permission_decision_source, permission_decision_surface, permission_decision_user_not_available, permission_location_add_tool_approval_params, permission_location_apply_params, permission_location_apply_result, permission_location_resolve_params, permission_location_resolve_result, permission_location_type, permission_paths_add_params, permission_paths_allowed_check_params, permission_paths_allowed_check_result, permission_paths_config, permission_paths_list, permission_paths_update_primary_params, permission_paths_workspace_check_params, permission_paths_workspace_check_result, permission_prompt_shown_notification, permission_request_result, permission_rules_set, permissions_allow_all_mode, permissions_configure_additional_content_exclusion_policy, permissions_configure_additional_content_exclusion_policy_rule, permissions_configure_additional_content_exclusion_policy_rule_source, permissions_configure_additional_content_exclusion_policy_scope, permissions_configure_params, permissions_configure_result, permissions_folder_trust_add_trusted_result, permissions_get_allow_all_request, permissions_locations_add_tool_approval_details, permissions_locations_add_tool_approval_details_commands, permissions_locations_add_tool_approval_details_custom_tool, permissions_locations_add_tool_approval_details_extension_env_access, permissions_locations_add_tool_approval_details_extension_management, permissions_locations_add_tool_approval_details_extension_permission_access, permissions_locations_add_tool_approval_details_factory, permissions_locations_add_tool_approval_details_mcp, permissions_locations_add_tool_approval_details_mcp_sampling, permissions_locations_add_tool_approval_details_memory, permissions_locations_add_tool_approval_details_read, permissions_locations_add_tool_approval_details_write, permissions_locations_add_tool_approval_result, permissions_modify_rules_params, permissions_modify_rules_result, permissions_modify_rules_scope, permissions_notify_prompt_shown_result, permissions_paths_add_result, permissions_paths_list_request, permissions_paths_update_primary_result, permissions_pending_requests_request, permissions_reset_session_approvals_request, permissions_reset_session_approvals_result, permissions_set_allow_all_request, permissions_set_allow_all_source, permissions_set_approve_all_request, permissions_set_approve_all_result, permissions_set_approve_all_source, permissions_set_required_request, permissions_set_required_result, permissions_urls_set_unrestricted_mode_result, permission_urls_config, permission_urls_set_unrestricted_mode_params, ping_request, ping_result, plan_read_result, plan_read_sql_todos_result, plan_read_sql_todos_with_dependencies_result, plan_sql_todo_dependency, plan_sql_todos_row, plan_update_request, plugin, plugin_install_result, plugin_list, plugin_list_result, plugins_builtin_set_request, plugins_disable_request, plugins_enable_request, plugins_install_request, plugins_marketplaces_add_request, plugins_marketplaces_browse_request, plugins_marketplaces_refresh_request, plugins_marketplaces_remove_request, plugins_reload_request, plugins_uninstall_request, plugins_update_request, plugin_update_all_entry, plugin_update_all_result, plugin_update_result, protocol_external_tool_defer, protocol_external_tool_definition, provider_add_request, provider_add_result, provider_config, provider_config_azure, provider_config_transport, provider_config_type, provider_config_wire_api, provider_endpoint, provider_endpoint_transport, provider_endpoint_type, provider_endpoint_wire_api, provider_get_endpoint_request, provider_model_config, provider_session_token, provider_token_acquire_request, provider_token_acquire_result, push_attachment, push_attachment_blob, push_attachment_directory, push_attachment_file, push_attachment_file_line_range, push_attachment_git_hub_actions_job, push_attachment_git_hub_commit, push_attachment_git_hub_file, push_attachment_git_hub_file_diff, push_attachment_git_hub_file_diff_side, push_attachment_git_hub_reference, push_attachment_git_hub_reference_type, push_attachment_git_hub_release, push_attachment_git_hub_repository, push_attachment_git_hub_snippet, push_attachment_git_hub_tree_comparison, push_attachment_git_hub_tree_comparison_side, push_attachment_git_hub_url, push_attachment_selection, push_attachment_selection_details, push_attachment_selection_details_end, push_attachment_selection_details_start, push_git_hub_repo_ref, queue_begin_deferred_idle_drain_request, queue_begin_deferred_idle_drain_result, queue_consume_system_notifications_request, queued_command_handled, queued_command_not_handled, queued_command_result, queue_defer_session_idle_request, queue_duplicate_at_request, queue_duplicate_at_result, queue_enqueue_resume_pending_result, queue_finish_deferred_idle_drain_request, queue_finish_deferred_idle_drain_result, queue_has_pending_result, queue_insert_at_request, queue_insert_at_result, queue_insert_message, queue_move_item_request, queue_move_item_result, queue_pending_items, queue_pending_items_kind, queue_pending_items_result, queue_remove_at_request, queue_remove_at_result, queue_remove_most_recent_result, queue_send_now_request, queue_send_now_result, queue_set_drain_paused_request, queue_snapshot_result, queue_update_text_request, queue_update_text_result, register_event_interest_params, register_event_interest_result, register_extension_tools_params, register_extension_tools_result, release_event_interest_params, remote_control_config, remote_control_config_existing_mc_session, remote_control_status, remote_control_status_active, remote_control_status_connecting, remote_control_status_error, remote_control_status_off, remote_control_status_result, remote_control_stop_result, remote_control_transfer_result, remote_enable_request, remote_enable_result, remote_notify_steerable_changed_request, remote_notify_steerable_changed_result, remote_session_connection_result, remote_session_host_status, remote_session_metadata_repository, remote_session_metadata_task_type, remote_session_metadata_value, remote_session_mode, remote_session_repository, run_options, sandbox_config, sandbox_config_auth, sandbox_config_user_policy, sandbox_config_user_policy_experimental, sandbox_config_user_policy_experimental_seatbelt, sandbox_config_user_policy_filesystem, sandbox_config_user_policy_network, sandbox_config_user_policy_network_proxy, sandbox_config_user_policy_seatbelt, schedule_add_at_request, schedule_add_cron_request, schedule_add_request, schedule_add_result, schedule_add_self_paced_request, schedule_entry, schedule_has_self_paced_result, schedule_list, schedule_rearm_self_paced_request, schedule_stop_request, schedule_stop_result, secrets_add_filter_values_request, secrets_add_filter_values_result, send_agent_mode, send_attachments_to_message_params, send_message_item, send_messages_request, send_messages_result, send_mode, send_request, send_result, send_system_notification_request, server_agent_list, server_instruction_source_list, server_skill, server_skill_list, session_activity, session_agent_list_request, session_auth_login_request, session_auth_logout_user_request, session_auth_status, session_auth_switch_request, session_bulk_delete_result, session_cancel_all_background_agents_result, session_capability, session_commands_list_request, session_completion_item, session_context, session_context_host_type, session_enrich_metadata_result, session_fs_append_file_request, session_fs_error, session_fs_error_code, session_fs_exists_request, session_fs_exists_result, session_fs_mkdir_request, session_fs_readdir_request, session_fs_readdir_result, session_fs_readdir_with_types_entry, session_fs_readdir_with_types_entry_type, session_fs_readdir_with_types_request, session_fs_readdir_with_types_result, session_fs_read_file_request, session_fs_read_file_result, session_fs_rename_request, session_fs_rm_request, session_fs_set_provider_capabilities, session_fs_set_provider_conventions, session_fs_set_provider_request, session_fs_set_provider_result, session_fs_sqlite_exists_request, session_fs_sqlite_exists_result, session_fs_sqlite_query_request, session_fs_sqlite_query_result, session_fs_sqlite_query_type, session_fs_sqlite_transaction_error, session_fs_sqlite_transaction_error_class, session_fs_sqlite_transaction_request, session_fs_sqlite_transaction_result, session_fs_sqlite_transaction_statement, session_fs_stat_request, session_fs_stat_result, session_fs_write_file_request, session_git_hub_auth_get_all_auth_available_result, session_git_hub_auth_logout_result, session_git_hub_auth_logout_user_result, session_history_compact_request, session_installed_plugin, session_installed_plugin_source, session_installed_plugin_source_git_hub, session_installed_plugin_source_local, session_installed_plugin_source_url, session_limit_prediction_baseline_data, session_limit_prediction_client_type, session_limit_prediction_details, session_limit_prediction_predict_request, session_limit_prediction_request, session_limit_prediction_result, session_limit_prediction_source, session_limit_prediction_tier, session_limit_prediction_tier_option, session_limit_prediction_unavailable_reason, session_list, session_list_entry, session_list_filter, session_load_deferred_repo_hooks_result, session_log_level, session_managed_permissions, session_managed_settings, session_mcp_apps_call_tool_result, session_metadata_snapshot, session_mode, session_model_list, session_model_list_request, session_model_price_category, session_open_options, session_open_options_additional_content_exclusion_policy, session_open_options_additional_content_exclusion_policy_rule, session_open_options_additional_content_exclusion_policy_rule_source, session_open_options_additional_content_exclusion_policy_scope, session_open_options_env_value_mode, session_open_options_reasoning_summary, session_open_params, session_open_result, session_plugins_reload_request, session_provider_get_endpoint_request, session_prune_result, sessions_bulk_delete_request, sessions_check_in_use_request, sessions_check_in_use_result, sessions_close_request, sessions_close_result, sessions_delete_request, sessions_enrich_metadata_request, session_set_credentials_params, session_set_credentials_result, session_settings_built_in_tool_availability_snapshot, session_settings_evaluate_predicate_request, session_settings_evaluate_predicate_result, session_settings_job_snapshot, session_settings_model_snapshot, session_settings_online_evaluation_snapshot, session_settings_predicate_name, session_settings_repo_snapshot, session_settings_snapshot, session_settings_validation_snapshot, sessions_find_by_prefix_request, sessions_find_by_prefix_result, sessions_find_by_task_id_request, sessions_find_by_task_id_result, sessions_fork_request, sessions_fork_result, sessions_get_board_entry_count_request, sessions_get_board_entry_count_result, sessions_get_event_file_path_request, sessions_get_event_file_path_result, sessions_get_last_for_context_request, sessions_get_last_for_context_result, sessions_get_metadata_request, sessions_get_metadata_result, sessions_get_persisted_remote_steerable_request, sessions_get_persisted_remote_steerable_result, session_sizes, sessions_list_non_empty_session_ids_request, sessions_list_non_empty_session_ids_result, sessions_list_request, sessions_load_deferred_repo_hooks_request, sessions_open_attach, sessions_open_cloud, sessions_open_create, sessions_open_handoff, sessions_open_handoff_task_type, sessions_open_progress, sessions_open_progress_status, sessions_open_progress_step, sessions_open_remote, sessions_open_resume, sessions_open_resume_last, sessions_open_status, session_source, sessions_prune_old_request, sessions_register_extension_tools_on_session_options, sessions_release_lock_request, sessions_release_lock_result, sessions_reload_plugin_hooks_request, sessions_reload_plugin_hooks_result, sessions_save_request, sessions_save_result, sessions_set_additional_plugins_request, sessions_set_additional_plugins_result, sessions_set_remote_control_steering_request, sessions_start_remote_control_request, sessions_stop_remote_control_request, sessions_transfer_remote_control_request, session_telemetry_engagement, session_update_options_params, session_update_options_result, session_visibility_status, session_working_directory_context, session_working_directory_context_host_type, shell_cancel_user_requested_request, shell_credentials, shell_exec_request, shell_exec_result, shell_execute_user_requested_request, shell_init_profile, shell_init_script, shell_init_script_shell, shell_kill_request, shell_kill_result, shell_kill_signal, shell_options, shutdown_request, skill, skill_discovery_path, skill_discovery_path_list, skill_discovery_scope, skill_list, skills_config_set_disabled_skills_request, skills_config_set_skill_disabled_request, skills_disable_request, skills_discover_request, skills_enable_request, skills_get_discovery_paths_request, skills_get_invoked_result, skills_invoked_skill, skills_load_diagnostics, slash_command_add_timeline_entry_result, slash_command_agent_prompt_result, slash_command_completed_result, slash_command_info, slash_command_input, slash_command_input_choice, slash_command_input_completion, slash_command_invocation_result, slash_command_kind, slash_command_model_picker_dialog, slash_command_select_subcommand_option, slash_command_select_subcommand_result, slash_command_set_model_result, slash_command_set_plan_model_result, slash_command_show_dialog_result, slash_command_text_result, slash_command_timeline_entry, subagent_settings_entry, subagent_settings_entry_context_tier, task_agent_info, task_agent_progress, task_complete_data, task_completion_decision, task_execution_mode, task_info, task_list, task_progress_line, tasks_cancel_request, tasks_cancel_result, tasks_get_current_promotable_result, tasks_get_progress_request, tasks_get_progress_result, task_shell_info, task_shell_info_attachment_mode, task_shell_progress, tasks_promote_current_to_background_result, tasks_promote_to_background_request, tasks_promote_to_background_result, tasks_refresh_result, tasks_remove_request, tasks_remove_result, tasks_send_message_request, tasks_send_message_result, tasks_start_agent_request, tasks_start_agent_result, task_status, tasks_wait_for_pending_result, telemetry_set_feature_overrides_request, token_auth_info, tool, tool_list, tool_result, tool_result_expanded, tool_result_new_message, tool_result_type, tools_execute_request, tools_get_builtin_descriptors_request, tools_get_builtin_descriptors_result, tools_get_current_metadata_result, tools_initialize_and_validate_result, tools_list_request, tools_set_request, tools_set_result, tools_shell_descriptor_config, tools_task_complete_event_data_request, tools_update_subagent_settings_result, ui_auto_mode_switch_response, ui_elicitation_array_any_of_field, ui_elicitation_array_any_of_field_items, ui_elicitation_array_any_of_field_items_any_of, ui_elicitation_array_enum_field, ui_elicitation_array_enum_field_items, ui_elicitation_field_value, ui_elicitation_request, ui_elicitation_response, ui_elicitation_response_action, ui_elicitation_response_content, ui_elicitation_result, ui_elicitation_schema, ui_elicitation_schema_property, ui_elicitation_schema_property_boolean, ui_elicitation_schema_property_number, ui_elicitation_schema_property_number_type, ui_elicitation_schema_property_string, ui_elicitation_schema_property_string_format, ui_elicitation_string_enum_field, ui_elicitation_string_one_of_field, ui_elicitation_string_one_of_field_one_of, ui_ephemeral_query_request, ui_ephemeral_query_result, ui_exit_plan_mode_action, ui_exit_plan_mode_response, ui_handle_pending_auto_mode_switch_request, ui_handle_pending_elicitation_request, ui_handle_pending_exit_plan_mode_request, ui_handle_pending_result, ui_handle_pending_sampling_request, ui_handle_pending_sampling_response, ui_handle_pending_session_limits_exhausted_request, ui_handle_pending_user_input_request, ui_register_direct_auto_mode_switch_handler_result, ui_session_limits_exhausted_response, ui_session_limits_exhausted_response_action, ui_unregister_direct_auto_mode_switch_handler_request, ui_unregister_direct_auto_mode_switch_handler_result, ui_user_input_response, update_subagent_settings_request, usage_get_metrics_result, usage_metrics_agent_metric, usage_metrics_code_changes, usage_metrics_model_metric, usage_metrics_model_metric_requests, usage_metrics_model_metric_token_detail, usage_metrics_model_metric_usage, usage_metrics_token_detail, user_auth_info, user_requested_shell_command_result, user_setting_metadata, user_settings_get_result, user_settings_set_request, user_settings_set_result, visibility_get_result, visibility_set_request, visibility_set_result, workspace_diff_file_change, workspace_diff_file_change_type, workspace_diff_mode, workspace_diff_result, workspaces_add_summary_request, workspaces_add_summary_result, workspaces_autopilot_objective_exists_result, workspaces_checkpoints, workspaces_create_file_request, workspaces_delete_autopilot_objective_result, workspaces_diff_request, workspaces_ensure_request, workspaces_get_workspace_result, workspaces_list_checkpoints_result, workspaces_list_files_result, workspaces_read_autopilot_objective_result, workspaces_read_checkpoint_request, workspaces_read_checkpoint_result, workspaces_read_file_request, workspaces_read_file_result, workspaces_save_large_paste_request, workspaces_save_large_paste_result, workspaces_truncate_summaries_request, workspace_summary_host_type, workspaces_update_metadata_request, workspaces_workspace_details_host_type, workspaces_write_autopilot_objective_request, workspaces_write_autopilot_objective_result, session_auth_info_result, session_context_attribution, session_context_info, subagent_settings, task_progress, workspace_summary) + return RPC(abort_request, abort_result, account_all_users, account_get_all_users_result, account_get_current_auth_result, account_get_quota_request, account_get_quota_result, account_login_request, account_login_result, account_logout_request, account_logout_result, account_quota_snapshot, adaptive_thinking_support, agent_discovery_path, agent_discovery_path_list, agent_discovery_path_scope, agent_get_current_result, agent_info, agent_info_source, agent_list, agent_list_request, agent_registry_live_target_entry, agent_registry_live_target_entry_attention_kind, agent_registry_live_target_entry_kind, agent_registry_live_target_entry_last_terminal_event, agent_registry_live_target_entry_status, agent_registry_log_capture, agent_registry_log_capture_open_error_reason, agent_registry_spawn_error, agent_registry_spawn_permission_mode, agent_registry_spawn_registry_timeout, agent_registry_spawn_request, agent_registry_spawn_result, agent_registry_spawn_spawned, agent_registry_spawn_validation_error, agent_registry_spawn_validation_error_field, agent_registry_spawn_validation_error_reason, agent_reload_result, agents_discover_request, agent_select_request, agent_select_result, agent_set_prompt_request, agents_get_discovery_paths_request, api_key_auth_info, auth_identity, auth_info, auth_info_type, auth_validation_error, auth_validation_errors, built_in_model_catalog, built_in_model_catalog_entry, builtin_tool_descriptor, builtin_tool_format, builtin_tool_format_type, builtin_tool_input_schema, builtin_tool_input_schema_type, builtin_tool_safe_for_telemetry, builtin_tool_safe_telemetry_fields, cancel_user_requested_shell_command_result, canvas_action, canvas_action_invoke_request, canvas_action_invoke_result, canvas_close_request, canvas_host_context, canvas_host_context_capabilities, canvas_json_schema, canvas_list, canvas_list_open_result, canvas_open_request, canvas_provider_close_request, canvas_provider_invoke_action_request, canvas_provider_open_request, canvas_provider_open_result, canvas_provider_register_request, canvas_provider_unregister_request, canvas_session_context, capi_session_options, card_digest, card_digest_algorithm, card_digest_value, catalog_ai_skill_candidate, catalog_ai_skill_candidate_provenance, catalog_authentication_required_error, catalog_authentication_required_reason, catalog_candidate, catalog_candidate_kind, catalog_candidate_source, catalog_candidate_source_embedded, catalog_candidate_source_url, catalog_capability, catalog_capability_id, catalog_client_contract, catalog_contract_violation_error, catalog_contract_violation_reason, catalog_handle_rejected_error, catalog_handle_rejection_reason, catalog_handle_type, catalog_invalid_request_error, catalog_invalid_request_field, catalog_malformed_card_error, catalog_malformed_card_reason, catalog_mcp_server_candidate, catalog_mcp_server_candidate_provenance, catalog_mcp_server_installability, catalog_media_type, catalog_negotiated_contract, catalog_negotiation_refused_error, catalog_negotiation_refused_reason, catalog_network_failure_error, catalog_network_failure_reason, catalog_not_installable_error, catalog_not_installable_reason, catalog_policy_rejected_error, catalog_search_request, catalog_search_result, catalog_search_succeeded, catalog_unavailable_error, catalog_unavailable_reason, catalog_unavailable_transport_error, catalog_unavailable_transport_reason, catalog_unsafe_retrieval_error, catalog_unsafe_retrieval_reason, catalog_unsupported_kind_error, command_list, commands_finalize_invocation_effect_request, commands_finalize_invocation_effect_result, commands_handle_pending_command_request, commands_handle_pending_command_result, commands_invocation_effect_outcome, commands_invocation_origin, commands_invoke_request, commands_list_request, commands_respond_to_queued_command_request, commands_respond_to_queued_command_result, completions_get_trigger_characters_result, completions_request_request, completions_request_result, configure_session_extensions_params, connected_remote_session_metadata, connected_remote_session_metadata_kind, connected_remote_session_metadata_repository, connect_remote_session_params, connect_request, connect_result, content_exclusion_check_paths_request, content_exclusion_check_paths_result, content_exclusion_path_check, content_filter_mode, context_heaviest_message, copilot_api_token_auth_info, copilot_user_response, copilot_user_response_endpoints, copilot_user_response_quota_snapshots, copilot_user_response_quota_snapshots_chat, copilot_user_response_quota_snapshots_completions, copilot_user_response_quota_snapshots_premium_interactions, current_model, current_tool_metadata, debug_collect_logs_collected_entry, debug_collect_logs_destination, debug_collect_logs_entry, debug_collect_logs_entry_kind, debug_collect_logs_include, debug_collect_logs_redaction, debug_collect_logs_request, debug_collect_logs_result, debug_collect_logs_result_kind, debug_collect_logs_skipped_entry, debug_collect_logs_source, disable_bypass_permissions_mode, discovered_canvas, discovered_extension, discovered_extension_mode, discovered_extension_plugin, discovered_extensions, discovered_extensions_disable_request, discovered_extensions_enable_request, discovered_extension_source, discovered_mcp_server, discovered_mcp_server_type, enqueue_command_params, enqueue_command_result, env_auth_info, event_log_read_request, event_log_release_interest_result, event_log_tail_result, event_log_types, events_agent_scope, events_cursor_status, events_read_direction, events_read_result, execute_command_params, execute_command_result, extension, extension_context_push_input, extension_launch_profile, extension_launch_provider_resolve_request, extension_launch_provider_resolve_result, extension_list, extensions_disable_request, extensions_enable_request, extension_source, extension_status, external_tool_result, external_tool_text_result_for_llm, external_tool_text_result_for_llm_binary_results_for_llm, external_tool_text_result_for_llm_binary_results_for_llm_type, external_tool_text_result_for_llm_content, external_tool_text_result_for_llm_content_audio, external_tool_text_result_for_llm_content_image, external_tool_text_result_for_llm_content_resource, external_tool_text_result_for_llm_content_resource_details, external_tool_text_result_for_llm_content_resource_link, external_tool_text_result_for_llm_content_resource_link_icon, external_tool_text_result_for_llm_content_resource_link_icon_theme, external_tool_text_result_for_llm_content_shell_exit, external_tool_text_result_for_llm_content_terminal, external_tool_text_result_for_llm_content_text, factory_abort_request, factory_ack_result, factory_agent_options, factory_agent_request, factory_agent_result, factory_agent_summary, factory_cancel_request, factory_current_phase, factory_declared_limits, factory_durable_operation, factory_execute_request, factory_execute_result, factory_get_run_progress_request, factory_get_run_request, factory_journal_get_request, factory_journal_get_result, factory_journal_put_request, factory_list_runs_request, factory_list_runs_result, factory_log_line, factory_log_line_kind, factory_log_request, factory_phase_observation, factory_phase_status, factory_progress_line, factory_progress_page, factory_resume_request, factory_resume_result, factory_run_consumed, factory_run_detail, factory_run_failure, factory_run_failure_kind, factory_run_limits, factory_run_request, factory_run_result, factory_run_status, factory_run_summary, factory_run_terminal, filter_mapping, fleet_start_request, fleet_start_result, folder_trust_add_params, folder_trust_check_params, folder_trust_check_result, gh_cli_auth_info, git_hub_telemetry_client_info, git_hub_telemetry_event, git_hub_telemetry_notification, handle_pending_tool_call_request, handle_pending_tool_call_result, history_abort_manual_compaction_result, history_cancel_background_compaction_result, history_clear_context_request, history_clear_context_result, history_compact_context_window, history_compact_request, history_compact_result, history_file_restore_skip_reason, history_list_rewind_points_result, history_preview_rewind_request, history_preview_rewind_result, history_rewind_change_type, history_rewind_file_preview, history_rewind_mode, history_rewind_outcome, history_rewind_point, history_rewind_request, history_rewind_result, history_rewind_unavailable_reason, history_skipped_file_restore, history_summarize_for_handoff_result, history_truncate_request, history_truncate_result, hmac_auth_info, hook_invoke_request, hook_invoke_response, hook_type, installed_plugin, installed_plugin_info, installed_plugin_source, installed_plugin_source_git_hub, installed_plugin_source_local, installed_plugin_source_url, instruction_discovery_path, instruction_discovery_path_kind, instruction_discovery_path_list, instruction_discovery_path_location, instructions_discover_request, instructions_get_discovery_paths_request, instructions_get_sources_result, instruction_source, instruction_source_location, instruction_source_type, interrupt_main_turn_request, interrupt_main_turn_result, llm_inference_headers, llm_inference_http_request_chunk_request, llm_inference_http_request_chunk_result, llm_inference_http_request_start_request, llm_inference_http_request_start_result, llm_inference_http_request_start_transport, llm_inference_http_response_chunk_error, llm_inference_http_response_chunk_request, llm_inference_http_response_chunk_result, llm_inference_http_response_start_request, llm_inference_http_response_start_result, llm_inference_set_provider_result, local_session_metadata_value, log_request, log_result, lsp_initialize_request, managed_settings_read_result, marketplace_add_result, marketplace_browse_result, marketplace_info, marketplace_list_result, marketplace_plugin_info, marketplace_refresh_entry, marketplace_refresh_result, marketplace_remove_result, mcp_allowed_server, mcp_apps_call_tool_request, mcp_apps_diagnose_capability, mcp_apps_diagnose_request, mcp_apps_diagnose_result, mcp_apps_diagnose_server, mcp_apps_host_context, mcp_apps_host_context_details, mcp_apps_host_context_details_available_display_mode, mcp_apps_host_context_details_display_mode, mcp_apps_host_context_details_platform, mcp_apps_host_context_details_theme, mcp_apps_list_tools_request, mcp_apps_list_tools_result, mcp_apps_read_resource_request, mcp_apps_read_resource_result, mcp_apps_resource_content, mcp_apps_set_host_context_details, mcp_apps_set_host_context_details_available_display_mode, mcp_apps_set_host_context_details_display_mode, mcp_apps_set_host_context_details_platform, mcp_apps_set_host_context_details_theme, mcp_apps_set_host_context_request, mcp_cancel_sampling_execution_params, mcp_cancel_sampling_execution_result, mcp_config_add_request, mcp_config_disable_request, mcp_config_enable_request, mcp_config_list, mcp_config_remove_request, mcp_config_update_request, mcp_configure_git_hub_request, mcp_configure_git_hub_result, mcp_disable_request, mcp_discover_request, mcp_discover_result, mcp_elicitation_form_mode, mcp_enable_request, mcp_execute_sampling_params, mcp_execute_sampling_request, mcp_execute_sampling_result, mcp_failed_server, mcp_filtered_server, mcp_headers_handle_pending_headers_refresh_request, mcp_headers_handle_pending_headers_refresh_request_request, mcp_headers_handle_pending_headers_refresh_request_result, mcp_host_state, mcp_install_plan, mcp_is_server_running_request, mcp_is_server_running_result, mcp_list_tools_request, mcp_list_tools_result, mcp_oauth_authentication_state_changed_request, mcp_oauth_handle_pending_request, mcp_oauth_handle_pending_result, mcp_oauth_login_grant_type, mcp_oauth_login_request, mcp_oauth_login_result, mcp_oauth_pending_request_response, mcp_oauth_probe_needs_auth_reason, mcp_oauth_probe_request, mcp_oauth_probe_result, mcp_oauth_respond_request, mcp_oauth_respond_result, mcp_plan_configuration_change, mcp_plan_configuration_operation, mcp_plan_enum_value_type, mcp_plan_install_planned, mcp_plan_install_request, mcp_plan_install_result, mcp_plan_install_source, mcp_plan_install_source_candidate, mcp_plan_install_source_candidate_kind, mcp_plan_install_source_card, mcp_plan_install_source_card_kind, mcp_plan_package_install_method, mcp_plan_package_transport, mcp_plan_policy_decision, mcp_plan_policy_result, mcp_plan_policy_source, mcp_plan_provenance, mcp_plan_remote_install_method, mcp_plan_remote_transport, mcp_plan_required_value, mcp_plan_required_value_enum, mcp_plan_required_value_enum_kind, mcp_plan_required_value_scalar, mcp_plan_required_value_scalar_kind, mcp_plan_resource_identity, mcp_plan_scalar_value_type, mcp_plan_scope, mcp_plan_secret_placeholder, mcp_plan_secret_reference, mcp_plan_target, mcp_plan_transport_choice, mcp_plan_transport_choice_package, mcp_plan_transport_choice_remote, mcp_plan_value_category, mcp_register_external_client_request, mcp_reload_config, mcp_reload_with_config_request, mcp_remove_git_hub_result, mcp_resource, mcp_resource_annotations, mcp_resource_content, mcp_resource_icon, mcp_resources_list_request, mcp_resources_list_result, mcp_resources_list_templates_request, mcp_resources_list_templates_result, mcp_resources_read_request, mcp_resources_read_result, mcp_resource_template, mcp_restart_server_request, mcp_safe_for_telemetry, mcp_safe_for_telemetry_fields, mcp_sampling_execution_action, mcp_sampling_execution_result, mcp_serializable_server_config, mcp_server, mcp_server_auth_config, mcp_server_auth_config_redirect_port, mcp_server_card_embedded, mcp_server_card_embedded_kind, mcp_server_card_media_type, mcp_server_card_reference, mcp_server_card_url, mcp_server_card_url_kind, mcp_server_config, mcp_server_config_defer_tools, mcp_server_config_http, mcp_server_config_http_oauth_grant_type, mcp_server_config_http_type, mcp_server_config_memory, mcp_server_config_memory_type, mcp_server_config_stdio, mcp_server_config_stdio_type, mcp_server_failure_info, mcp_server_list, mcp_server_needs_auth_info, mcp_set_env_value_mode_details, mcp_set_env_value_mode_params, mcp_set_env_value_mode_result, mcp_start_server_request, mcp_start_servers_result, mcp_stop_server_request, mcp_task_metadata, mcp_tools, mcp_tool_ui, mcp_tool_ui_visibility, mcp_unregister_external_client_request, memory_configuration, metadata_context_attribution_result, metadata_context_heaviest_messages_request, metadata_context_heaviest_messages_result, metadata_context_info_request, metadata_context_info_result, metadata_is_processing_result, metadata_recompute_context_tokens_request, metadata_recompute_context_tokens_result, metadata_record_context_change_request, metadata_record_context_change_result, metadata_set_working_directory_request, metadata_set_working_directory_result, metadata_snapshot_current_mode, metadata_snapshot_remote_metadata, metadata_snapshot_remote_metadata_repository, metadata_snapshot_remote_metadata_task_type, model, model_apply_startup_overlay_request, model_billing, model_billing_promo, model_billing_token_prices, model_billing_token_prices_long_context, model_capabilities, model_capabilities_limits, model_capabilities_limits_vision, model_capabilities_override, model_capabilities_override_limits, model_capabilities_override_limits_vision, model_capabilities_override_supports, model_capabilities_supports, model_list, model_list_request, model_picker_category, model_picker_persistence_request, model_picker_price_category, model_picker_settings_context, model_policy, model_policy_state, model_set_reasoning_effort_request, model_set_reasoning_effort_result, models_list_request, model_switch_confirmation, model_switch_to_request, model_switch_to_result, mode_set_request, mode_set_result, move_mcp_loading_to_background_result, named_provider_config, name_get_result, name_set_auto_request, name_set_auto_result, name_set_request, open_canvas_instance, options_update_additional_content_exclusion_policy, options_update_additional_content_exclusion_policy_rule, options_update_additional_content_exclusion_policy_rule_source, options_update_additional_content_exclusion_policy_scope, options_update_context_tier, options_update_env_value_mode, options_update_reasoning_summary, options_update_tool_filter_precedence, pending_permission_request, pending_permission_request_list, permission_decision, permission_decision_approved, permission_decision_approved_for_location, permission_decision_approved_for_session, permission_decision_approve_for_location, permission_decision_approve_for_location_approval, permission_decision_approve_for_location_approval_commands, permission_decision_approve_for_location_approval_custom_tool, permission_decision_approve_for_location_approval_extension_env_access, permission_decision_approve_for_location_approval_extension_management, permission_decision_approve_for_location_approval_extension_permission_access, permission_decision_approve_for_location_approval_factory, permission_decision_approve_for_location_approval_mcp, permission_decision_approve_for_location_approval_mcp_sampling, permission_decision_approve_for_location_approval_memory, permission_decision_approve_for_location_approval_read, permission_decision_approve_for_location_approval_write, permission_decision_approve_for_session, permission_decision_approve_for_session_approval, permission_decision_approve_for_session_approval_commands, permission_decision_approve_for_session_approval_custom_tool, permission_decision_approve_for_session_approval_extension_env_access, permission_decision_approve_for_session_approval_extension_management, permission_decision_approve_for_session_approval_extension_permission_access, permission_decision_approve_for_session_approval_factory, permission_decision_approve_for_session_approval_mcp, permission_decision_approve_for_session_approval_mcp_sampling, permission_decision_approve_for_session_approval_memory, permission_decision_approve_for_session_approval_read, permission_decision_approve_for_session_approval_write, permission_decision_approve_once, permission_decision_approve_permanently, permission_decision_cancelled, permission_decision_context, permission_decision_denied_by_content_exclusion_policy, permission_decision_denied_by_permission_request_hook, permission_decision_denied_by_rules, permission_decision_denied_interactively_by_user, permission_decision_denied_no_approval_rule_and_could_not_request_from_user, permission_decision_outcome, permission_decision_reject, permission_decision_request, permission_decision_source, permission_decision_surface, permission_decision_user_not_available, permission_location_add_tool_approval_params, permission_location_apply_params, permission_location_apply_result, permission_location_resolve_params, permission_location_resolve_result, permission_location_type, permission_mode_source, permission_paths_add_params, permission_paths_allowed_check_params, permission_paths_allowed_check_result, permission_paths_config, permission_paths_list, permission_paths_update_primary_params, permission_paths_workspace_check_params, permission_paths_workspace_check_result, permission_prompt_shown_notification, permission_request_result, permission_rules_set, permissions_configure_additional_content_exclusion_policy, permissions_configure_additional_content_exclusion_policy_rule, permissions_configure_additional_content_exclusion_policy_rule_source, permissions_configure_additional_content_exclusion_policy_scope, permissions_configure_params, permissions_configure_result, permissions_folder_trust_add_trusted_result, permissions_get_mode_request, permissions_get_mode_result, permissions_locations_add_tool_approval_details, permissions_locations_add_tool_approval_details_commands, permissions_locations_add_tool_approval_details_custom_tool, permissions_locations_add_tool_approval_details_extension_env_access, permissions_locations_add_tool_approval_details_extension_management, permissions_locations_add_tool_approval_details_extension_permission_access, permissions_locations_add_tool_approval_details_factory, permissions_locations_add_tool_approval_details_mcp, permissions_locations_add_tool_approval_details_mcp_sampling, permissions_locations_add_tool_approval_details_memory, permissions_locations_add_tool_approval_details_read, permissions_locations_add_tool_approval_details_write, permissions_locations_add_tool_approval_result, permissions_modify_rules_params, permissions_modify_rules_result, permissions_modify_rules_scope, permissions_notify_prompt_shown_result, permissions_paths_add_result, permissions_paths_list_request, permissions_paths_update_primary_result, permissions_pending_requests_request, permissions_reset_session_approvals_request, permissions_reset_session_approvals_result, permissions_set_approve_all_request, permissions_set_approve_all_result, permissions_set_approve_all_source, permissions_set_mode_request, permissions_set_mode_result, permissions_set_required_request, permissions_set_required_result, permissions_urls_set_unrestricted_mode_result, permission_urls_config, permission_urls_set_unrestricted_mode_params, ping_request, ping_result, plan_read_result, plan_read_sql_todos_result, plan_read_sql_todos_with_dependencies_result, plan_sql_todo_dependency, plan_sql_todos_row, plan_update_request, plugin, plugin_install_result, plugin_list, plugin_list_result, plugins_builtin_set_request, plugins_disable_request, plugins_enable_request, plugins_install_request, plugins_marketplaces_add_request, plugins_marketplaces_browse_request, plugins_marketplaces_refresh_request, plugins_marketplaces_remove_request, plugins_reload_request, plugins_uninstall_request, plugins_update_request, plugin_update_all_entry, plugin_update_all_result, plugin_update_result, protocol_external_tool_defer, protocol_external_tool_definition, provider_add_request, provider_add_result, provider_config, provider_config_azure, provider_config_transport, provider_config_type, provider_config_wire_api, provider_endpoint, provider_endpoint_transport, provider_endpoint_type, provider_endpoint_wire_api, provider_get_endpoint_request, provider_model_config, provider_session_token, provider_token_acquire_request, provider_token_acquire_result, push_attachment, push_attachment_blob, push_attachment_directory, push_attachment_file, push_attachment_file_line_range, push_attachment_git_hub_actions_job, push_attachment_git_hub_commit, push_attachment_git_hub_file, push_attachment_git_hub_file_diff, push_attachment_git_hub_file_diff_side, push_attachment_git_hub_reference, push_attachment_git_hub_reference_type, push_attachment_git_hub_release, push_attachment_git_hub_repository, push_attachment_git_hub_snippet, push_attachment_git_hub_tree_comparison, push_attachment_git_hub_tree_comparison_side, push_attachment_git_hub_url, push_attachment_selection, push_attachment_selection_details, push_attachment_selection_details_end, push_attachment_selection_details_start, push_git_hub_repo_ref, queue_begin_deferred_idle_drain_request, queue_begin_deferred_idle_drain_result, queue_consume_system_notifications_request, queued_command_handled, queued_command_not_handled, queued_command_result, queue_defer_session_idle_request, queue_duplicate_at_request, queue_duplicate_at_result, queue_enqueue_resume_pending_result, queue_finish_deferred_idle_drain_request, queue_finish_deferred_idle_drain_result, queue_has_pending_result, queue_insert_at_request, queue_insert_at_result, queue_insert_message, queue_move_item_request, queue_move_item_result, queue_pending_items, queue_pending_items_kind, queue_pending_items_result, queue_remove_at_request, queue_remove_at_result, queue_remove_most_recent_result, queue_send_now_request, queue_send_now_result, queue_set_drain_paused_request, queue_snapshot_result, queue_update_text_request, queue_update_text_result, register_event_interest_params, register_event_interest_result, register_extension_tools_params, register_extension_tools_result, release_event_interest_params, remote_control_config, remote_control_config_existing_mc_session, remote_control_status, remote_control_status_active, remote_control_status_connecting, remote_control_status_error, remote_control_status_off, remote_control_status_result, remote_control_stop_result, remote_control_transfer_result, remote_enable_request, remote_enable_result, remote_notify_steerable_changed_request, remote_notify_steerable_changed_result, remote_session_connection_result, remote_session_host_status, remote_session_metadata_repository, remote_session_metadata_task_type, remote_session_metadata_value, remote_session_mode, remote_session_repository, run_options, sandbox_config, sandbox_config_auth, sandbox_config_user_policy, sandbox_config_user_policy_experimental, sandbox_config_user_policy_experimental_seatbelt, sandbox_config_user_policy_filesystem, sandbox_config_user_policy_network, sandbox_config_user_policy_network_proxy, sandbox_config_user_policy_seatbelt, schedule_add_at_request, schedule_add_cron_request, schedule_add_request, schedule_add_result, schedule_add_self_paced_request, schedule_entry, schedule_has_self_paced_result, schedule_list, schedule_rearm_self_paced_request, schedule_stop_request, schedule_stop_result, secrets_add_filter_values_request, secrets_add_filter_values_result, send_agent_mode, send_attachments_to_message_params, send_message_item, send_messages_request, send_messages_result, send_mode, send_request, send_result, send_system_notification_request, server_agent_list, server_instruction_source_list, server_skill, server_skill_list, session_activity, session_agent_list_request, session_auth_login_request, session_auth_logout_user_request, session_auth_status, session_auth_switch_request, session_bulk_delete_result, session_cancel_all_background_agents_result, session_capability, session_commands_list_request, session_completion_item, session_context, session_context_host_type, session_enrich_metadata_result, session_fs_append_file_request, session_fs_error, session_fs_error_code, session_fs_exists_request, session_fs_exists_result, session_fs_mkdir_request, session_fs_readdir_request, session_fs_readdir_result, session_fs_readdir_with_types_entry, session_fs_readdir_with_types_entry_type, session_fs_readdir_with_types_request, session_fs_readdir_with_types_result, session_fs_read_file_request, session_fs_read_file_result, session_fs_rename_request, session_fs_rm_request, session_fs_set_provider_capabilities, session_fs_set_provider_conventions, session_fs_set_provider_request, session_fs_set_provider_result, session_fs_sqlite_exists_request, session_fs_sqlite_exists_result, session_fs_sqlite_query_request, session_fs_sqlite_query_result, session_fs_sqlite_query_type, session_fs_sqlite_transaction_error, session_fs_sqlite_transaction_error_class, session_fs_sqlite_transaction_request, session_fs_sqlite_transaction_result, session_fs_sqlite_transaction_statement, session_fs_stat_request, session_fs_stat_result, session_fs_write_file_request, session_git_hub_auth_get_all_auth_available_result, session_git_hub_auth_logout_result, session_git_hub_auth_logout_user_result, session_history_compact_request, session_installed_plugin, session_installed_plugin_source, session_installed_plugin_source_git_hub, session_installed_plugin_source_local, session_installed_plugin_source_url, session_limit_prediction_baseline_data, session_limit_prediction_client_type, session_limit_prediction_details, session_limit_prediction_predict_request, session_limit_prediction_request, session_limit_prediction_result, session_limit_prediction_source, session_limit_prediction_tier, session_limit_prediction_tier_option, session_limit_prediction_unavailable_reason, session_list, session_list_entry, session_list_filter, session_load_deferred_repo_hooks_result, session_log_level, session_managed_permissions, session_managed_settings, session_mcp_apps_call_tool_result, session_metadata_snapshot, session_mode, session_model_list, session_model_list_request, session_model_price_category, session_open_options, session_open_options_additional_content_exclusion_policy, session_open_options_additional_content_exclusion_policy_rule, session_open_options_additional_content_exclusion_policy_rule_source, session_open_options_additional_content_exclusion_policy_scope, session_open_options_env_value_mode, session_open_options_reasoning_summary, session_open_params, session_open_result, session_plugins_reload_request, session_provider_get_endpoint_request, session_prune_result, sessions_bulk_delete_request, sessions_check_in_use_request, sessions_check_in_use_result, sessions_close_request, sessions_close_result, sessions_delete_request, sessions_enrich_metadata_request, session_set_credentials_params, session_set_credentials_result, session_settings_built_in_tool_availability_snapshot, session_settings_evaluate_predicate_request, session_settings_evaluate_predicate_result, session_settings_job_snapshot, session_settings_model_snapshot, session_settings_online_evaluation_snapshot, session_settings_predicate_name, session_settings_repo_snapshot, session_settings_snapshot, session_settings_validation_snapshot, sessions_find_by_prefix_request, sessions_find_by_prefix_result, sessions_find_by_task_id_request, sessions_find_by_task_id_result, sessions_fork_request, sessions_fork_result, sessions_get_board_entry_count_request, sessions_get_board_entry_count_result, sessions_get_event_file_path_request, sessions_get_event_file_path_result, sessions_get_last_for_context_request, sessions_get_last_for_context_result, sessions_get_metadata_request, sessions_get_metadata_result, sessions_get_persisted_remote_steerable_request, sessions_get_persisted_remote_steerable_result, session_sizes, sessions_list_non_empty_session_ids_request, sessions_list_non_empty_session_ids_result, sessions_list_request, sessions_load_deferred_repo_hooks_request, sessions_open_attach, sessions_open_cloud, sessions_open_create, sessions_open_handoff, sessions_open_handoff_task_type, sessions_open_progress, sessions_open_progress_status, sessions_open_progress_step, sessions_open_remote, sessions_open_resume, sessions_open_resume_last, sessions_open_status, session_source, sessions_prune_old_request, sessions_register_extension_tools_on_session_options, sessions_release_lock_request, sessions_release_lock_result, sessions_reload_plugin_hooks_request, sessions_reload_plugin_hooks_result, sessions_save_request, sessions_save_result, sessions_set_additional_plugins_request, sessions_set_additional_plugins_result, sessions_set_remote_control_steering_request, sessions_start_remote_control_request, sessions_stop_remote_control_request, sessions_transfer_remote_control_request, session_telemetry_engagement, session_update_options_params, session_update_options_result, session_visibility_status, session_working_directory_context, session_working_directory_context_host_type, shell_cancel_user_requested_request, shell_credentials, shell_exec_request, shell_exec_result, shell_execute_user_requested_request, shell_init_profile, shell_init_script, shell_init_script_shell, shell_kill_request, shell_kill_result, shell_kill_signal, shell_options, shutdown_request, skill, skill_discovery_path, skill_discovery_path_list, skill_discovery_scope, skill_list, skills_config_set_disabled_skills_request, skills_config_set_skill_disabled_request, skills_disable_request, skills_discover_request, skills_enable_request, skills_get_discovery_paths_request, skills_get_invoked_result, skills_invoked_skill, skills_load_diagnostics, slash_command_add_timeline_entry_result, slash_command_agent_prompt_result, slash_command_completed_result, slash_command_info, slash_command_input, slash_command_input_choice, slash_command_input_completion, slash_command_invocation_result, slash_command_kind, slash_command_model_picker_dialog, slash_command_select_subcommand_option, slash_command_select_subcommand_result, slash_command_set_model_result, slash_command_set_plan_model_result, slash_command_show_dialog_result, slash_command_text_result, slash_command_timeline_entry, subagent_settings_entry, subagent_settings_entry_context_tier, task_agent_info, task_agent_progress, task_complete_data, task_completion_decision, task_execution_mode, task_info, task_list, task_progress_line, tasks_cancel_request, tasks_cancel_result, tasks_get_current_promotable_result, tasks_get_progress_request, tasks_get_progress_result, task_shell_info, task_shell_info_attachment_mode, task_shell_progress, tasks_promote_current_to_background_result, tasks_promote_to_background_request, tasks_promote_to_background_result, tasks_refresh_result, tasks_remove_request, tasks_remove_result, tasks_send_message_request, tasks_send_message_result, tasks_start_agent_request, tasks_start_agent_result, task_status, tasks_wait_for_pending_result, telemetry_set_feature_overrides_request, token_auth_info, tool, tool_list, tool_result, tool_result_expanded, tool_result_new_message, tool_result_type, tools_execute_request, tools_get_builtin_descriptors_request, tools_get_builtin_descriptors_result, tools_get_current_metadata_result, tools_initialize_and_validate_result, tools_list_request, tools_set_request, tools_set_result, tools_shell_descriptor_config, tools_task_complete_event_data_request, tools_update_subagent_settings_result, ui_auto_mode_switch_response, ui_elicitation_array_any_of_field, ui_elicitation_array_any_of_field_items, ui_elicitation_array_any_of_field_items_any_of, ui_elicitation_array_enum_field, ui_elicitation_array_enum_field_items, ui_elicitation_field_value, ui_elicitation_request, ui_elicitation_response, ui_elicitation_response_action, ui_elicitation_response_content, ui_elicitation_result, ui_elicitation_schema, ui_elicitation_schema_property, ui_elicitation_schema_property_boolean, ui_elicitation_schema_property_number, ui_elicitation_schema_property_number_type, ui_elicitation_schema_property_string, ui_elicitation_schema_property_string_format, ui_elicitation_string_enum_field, ui_elicitation_string_one_of_field, ui_elicitation_string_one_of_field_one_of, ui_ephemeral_query_request, ui_ephemeral_query_result, ui_exit_plan_mode_action, ui_exit_plan_mode_response, ui_handle_pending_auto_mode_switch_request, ui_handle_pending_elicitation_request, ui_handle_pending_exit_plan_mode_request, ui_handle_pending_result, ui_handle_pending_sampling_request, ui_handle_pending_sampling_response, ui_handle_pending_session_limits_exhausted_request, ui_handle_pending_user_input_request, ui_register_direct_auto_mode_switch_handler_result, ui_session_limits_exhausted_response, ui_session_limits_exhausted_response_action, ui_unregister_direct_auto_mode_switch_handler_request, ui_unregister_direct_auto_mode_switch_handler_result, ui_user_input_response, update_subagent_settings_request, usage_get_metrics_result, usage_metrics_agent_metric, usage_metrics_code_changes, usage_metrics_model_metric, usage_metrics_model_metric_requests, usage_metrics_model_metric_token_detail, usage_metrics_model_metric_usage, usage_metrics_token_detail, user_auth_info, user_requested_shell_command_result, user_setting_metadata, user_settings_get_result, user_settings_set_request, user_settings_set_result, visibility_get_result, visibility_set_request, visibility_set_result, workspace_diff_file_change, workspace_diff_file_change_type, workspace_diff_mode, workspace_diff_result, workspaces_add_summary_request, workspaces_add_summary_result, workspaces_autopilot_objective_exists_result, workspaces_checkpoints, workspaces_create_file_request, workspaces_delete_autopilot_objective_result, workspaces_diff_request, workspaces_ensure_request, workspaces_get_workspace_result, workspaces_list_checkpoints_result, workspaces_list_files_result, workspaces_read_autopilot_objective_result, workspaces_read_checkpoint_request, workspaces_read_checkpoint_result, workspaces_read_file_request, workspaces_read_file_result, workspaces_save_large_paste_request, workspaces_save_large_paste_result, workspaces_truncate_summaries_request, workspace_summary_host_type, workspaces_update_metadata_request, workspaces_workspace_details_host_type, workspaces_write_autopilot_objective_request, workspaces_write_autopilot_objective_result, session_auth_info_result, session_context_attribution, session_context_info, subagent_settings, task_progress, workspace_summary) def to_dict(self) -> dict: result: dict = {} @@ -34369,8 +36880,6 @@ def to_dict(self) -> dict: result["AgentSelectResult"] = to_class(AgentSelectResult, self.agent_select_result) result["AgentSetPromptRequest"] = to_class(AgentSetPromptRequest, self.agent_set_prompt_request) result["AgentsGetDiscoveryPathsRequest"] = to_class(AgentsGetDiscoveryPathsRequest, self.agents_get_discovery_paths_request) - result["AllowAllPermissionSetResult"] = to_class(AllowAllPermissionSetResult, self.allow_all_permission_set_result) - result["AllowAllPermissionState"] = to_class(AllowAllPermissionState, self.allow_all_permission_state) result["ApiKeyAuthInfo"] = to_class(APIKeyAuthInfo, self.api_key_auth_info) result["AuthIdentity"] = to_class(AuthIdentity, self.auth_identity) result["AuthInfo"] = (self.auth_info).to_dict() @@ -34405,6 +36914,52 @@ def to_dict(self) -> dict: result["CanvasProviderUnregisterRequest"] = to_class(CanvasProviderUnregisterRequest, self.canvas_provider_unregister_request) result["CanvasSessionContext"] = to_class(CanvasSessionContext, self.canvas_session_context) result["CapiSessionOptions"] = to_class(CapiSessionOptions, self.capi_session_options) + result["CardDigest"] = to_class(CardDigest, self.card_digest) + result["CardDigestAlgorithm"] = to_enum(CardDigestAlgorithm, self.card_digest_algorithm) + result["CardDigestValue"] = from_str(self.card_digest_value) + result["CatalogAiSkillCandidate"] = to_class(CatalogAISkillCandidate, self.catalog_ai_skill_candidate) + result["CatalogAiSkillCandidateProvenance"] = to_class(CatalogAISkillCandidateProvenance, self.catalog_ai_skill_candidate_provenance) + result["CatalogAuthenticationRequiredError"] = to_class(CatalogAuthenticationRequiredError, self.catalog_authentication_required_error) + result["CatalogAuthenticationRequiredReason"] = to_enum(CatalogAuthenticationRequiredReason, self.catalog_authentication_required_reason) + result["CatalogCandidate"] = to_class(CatalogCandidate, self.catalog_candidate) + result["CatalogCandidateKind"] = to_enum(CatalogCandidateKind, self.catalog_candidate_kind) + result["CatalogCandidateSource"] = (self.catalog_candidate_source).to_dict() + result["CatalogCandidateSourceEmbedded"] = to_class(CatalogCandidateSourceEmbedded, self.catalog_candidate_source_embedded) + result["CatalogCandidateSourceUrl"] = to_class(CatalogCandidateSourceURL, self.catalog_candidate_source_url) + result["CatalogCapability"] = to_enum(CatalogCapability, self.catalog_capability) + result["CatalogCapabilityId"] = from_str(self.catalog_capability_id) + result["CatalogClientContract"] = to_class(CatalogClientContract, self.catalog_client_contract) + result["CatalogContractViolationError"] = to_class(CatalogContractViolationError, self.catalog_contract_violation_error) + result["CatalogContractViolationReason"] = to_enum(CatalogContractViolationReason, self.catalog_contract_violation_reason) + result["CatalogHandleRejectedError"] = to_class(CatalogHandleRejectedError, self.catalog_handle_rejected_error) + result["CatalogHandleRejectionReason"] = to_enum(CatalogHandleRejectionReason, self.catalog_handle_rejection_reason) + result["CatalogHandleType"] = to_enum(CatalogHandleType, self.catalog_handle_type) + result["CatalogInvalidRequestError"] = to_class(CatalogInvalidRequestError, self.catalog_invalid_request_error) + result["CatalogInvalidRequestField"] = to_enum(CatalogInvalidRequestField, self.catalog_invalid_request_field) + result["CatalogMalformedCardError"] = to_class(CatalogMalformedCardError, self.catalog_malformed_card_error) + result["CatalogMalformedCardReason"] = to_enum(CatalogMalformedCardReason, self.catalog_malformed_card_reason) + result["CatalogMcpServerCandidate"] = to_class(CatalogMCPServerCandidate, self.catalog_mcp_server_candidate) + result["CatalogMcpServerCandidateProvenance"] = to_class(CatalogMCPServerCandidateProvenance, self.catalog_mcp_server_candidate_provenance) + result["CatalogMcpServerInstallability"] = to_enum(CatalogMCPServerInstallabilityEnum, self.catalog_mcp_server_installability) + result["CatalogMediaType"] = to_enum(CatalogMediaType, self.catalog_media_type) + result["CatalogNegotiatedContract"] = to_class(CatalogNegotiatedContract, self.catalog_negotiated_contract) + result["CatalogNegotiationRefusedError"] = to_class(CatalogNegotiationRefusedError, self.catalog_negotiation_refused_error) + result["CatalogNegotiationRefusedReason"] = to_enum(CatalogNegotiationRefusedReason, self.catalog_negotiation_refused_reason) + result["CatalogNetworkFailureError"] = to_class(CatalogNetworkFailureError, self.catalog_network_failure_error) + result["CatalogNetworkFailureReason"] = to_enum(CatalogNetworkFailureReason, self.catalog_network_failure_reason) + result["CatalogNotInstallableError"] = to_class(CatalogNotInstallableError, self.catalog_not_installable_error) + result["CatalogNotInstallableReason"] = to_enum(CatalogNotInstallableReason, self.catalog_not_installable_reason) + result["CatalogPolicyRejectedError"] = to_class(CatalogPolicyRejectedError, self.catalog_policy_rejected_error) + result["CatalogSearchRequest"] = to_class(CatalogSearchRequest, self.catalog_search_request) + result["CatalogSearchResult"] = (self.catalog_search_result).to_dict() + result["CatalogSearchSucceeded"] = to_class(CatalogSearchSucceeded, self.catalog_search_succeeded) + result["CatalogUnavailableError"] = to_class(CatalogUnavailableError, self.catalog_unavailable_error) + result["CatalogUnavailableReason"] = to_enum(CatalogUnavailableReason, self.catalog_unavailable_reason) + result["CatalogUnavailableTransportError"] = to_class(CatalogUnavailableTransportError, self.catalog_unavailable_transport_error) + result["CatalogUnavailableTransportReason"] = to_enum(CatalogUnavailableTransportReason, self.catalog_unavailable_transport_reason) + result["CatalogUnsafeRetrievalError"] = to_class(CatalogUnsafeRetrievalError, self.catalog_unsafe_retrieval_error) + result["CatalogUnsafeRetrievalReason"] = to_enum(CatalogUnsafeRetrievalReason, self.catalog_unsafe_retrieval_reason) + result["CatalogUnsupportedKindError"] = to_class(CatalogUnsupportedKindError, self.catalog_unsupported_kind_error) result["CommandList"] = to_class(CommandList, self.command_list) result["CommandsFinalizeInvocationEffectRequest"] = to_class(CommandsFinalizeInvocationEffectRequest, self.commands_finalize_invocation_effect_request) result["CommandsFinalizeInvocationEffectResult"] = to_class(CommandsFinalizeInvocationEffectResult, self.commands_finalize_invocation_effect_result) @@ -34667,6 +37222,7 @@ def to_dict(self) -> dict: result["McpHeadersHandlePendingHeadersRefreshRequestRequest"] = to_class(MCPHeadersHandlePendingHeadersRefreshRequestRequest, self.mcp_headers_handle_pending_headers_refresh_request_request) result["McpHeadersHandlePendingHeadersRefreshRequestResult"] = to_class(MCPHeadersHandlePendingHeadersRefreshRequestResult, self.mcp_headers_handle_pending_headers_refresh_request_result) result["McpHostState"] = to_class(MCPHostState, self.mcp_host_state) + result["McpInstallPlan"] = to_class(MCPInstallPlan, self.mcp_install_plan) result["McpIsServerRunningRequest"] = to_class(MCPIsServerRunningRequest, self.mcp_is_server_running_request) result["McpIsServerRunningResult"] = to_class(MCPIsServerRunningResult, self.mcp_is_server_running_result) result["McpListToolsRequest"] = to_class(MCPListToolsRequest, self.mcp_list_tools_request) @@ -34683,6 +37239,40 @@ def to_dict(self) -> dict: result["McpOauthProbeResult"] = to_class(MCPOauthProbeResult, self.mcp_oauth_probe_result) result["McpOauthRespondRequest"] = to_class(MCPOauthRespondRequest, self.mcp_oauth_respond_request) result["McpOauthRespondResult"] = to_class(MCPOauthRespondResult, self.mcp_oauth_respond_result) + result["McpPlanConfigurationChange"] = to_class(MCPPlanConfigurationChange, self.mcp_plan_configuration_change) + result["McpPlanConfigurationOperation"] = to_enum(MCPPlanConfigurationOperation, self.mcp_plan_configuration_operation) + result["McpPlanEnumValueType"] = to_enum(MCPPlan, self.mcp_plan_enum_value_type) + result["McpPlanInstallPlanned"] = to_class(MCPPlanInstallPlanned, self.mcp_plan_install_planned) + result["McpPlanInstallRequest"] = to_class(MCPPlanInstallRequest, self.mcp_plan_install_request) + result["McpPlanInstallResult"] = (self.mcp_plan_install_result).to_dict() + result["McpPlanInstallSource"] = (self.mcp_plan_install_source).to_dict() + result["McpPlanInstallSourceCandidate"] = to_class(MCPPlanInstallSourceCandidate, self.mcp_plan_install_source_candidate) + result["McpPlanInstallSourceCandidateKind"] = to_enum(MCPPlanInstallSourceCandidateKind, self.mcp_plan_install_source_candidate_kind) + result["McpPlanInstallSourceCard"] = to_class(MCPPlanInstallSourceCard, self.mcp_plan_install_source_card) + result["McpPlanInstallSourceCardKind"] = to_enum(MCPPlanInstallSourceCardKind, self.mcp_plan_install_source_card_kind) + result["McpPlanPackageInstallMethod"] = to_enum(MCPPlanPackageInstallMethod, self.mcp_plan_package_install_method) + result["McpPlanPackageTransport"] = to_enum(MCPPlanPackageTransport, self.mcp_plan_package_transport) + result["McpPlanPolicyDecision"] = to_enum(MCPPlanPolicyDecision, self.mcp_plan_policy_decision) + result["McpPlanPolicyResult"] = to_class(MCPPlanPolicyResult, self.mcp_plan_policy_result) + result["McpPlanPolicySource"] = to_enum(MCPPlanPolicySource, self.mcp_plan_policy_source) + result["McpPlanProvenance"] = to_class(MCPPlanProvenance, self.mcp_plan_provenance) + result["McpPlanRemoteInstallMethod"] = to_enum(MCPPlanRemoteInstallMethod, self.mcp_plan_remote_install_method) + result["McpPlanRemoteTransport"] = to_enum(MCPPlanRemoteTransport, self.mcp_plan_remote_transport) + result["McpPlanRequiredValue"] = (self.mcp_plan_required_value).to_dict() + result["McpPlanRequiredValueEnum"] = to_class(MCPPlanRequiredValueEnum, self.mcp_plan_required_value_enum) + result["McpPlanRequiredValueEnumKind"] = to_enum(MCPPlan, self.mcp_plan_required_value_enum_kind) + result["McpPlanRequiredValueScalar"] = to_class(MCPPlanRequiredValueScalar, self.mcp_plan_required_value_scalar) + result["McpPlanRequiredValueScalarKind"] = to_enum(MCPPlanRequiredValueScalarKind, self.mcp_plan_required_value_scalar_kind) + result["McpPlanResourceIdentity"] = to_class(MCPPlanResourceIdentity, self.mcp_plan_resource_identity) + result["McpPlanScalarValueType"] = to_enum(MCPPlanScalarValueTypeEnum, self.mcp_plan_scalar_value_type) + result["McpPlanScope"] = to_enum(MCPPlanScope, self.mcp_plan_scope) + result["McpPlanSecretPlaceholder"] = to_class(MCPPlanSecretPlaceholder, self.mcp_plan_secret_placeholder) + result["McpPlanSecretReference"] = from_str(self.mcp_plan_secret_reference) + result["McpPlanTarget"] = to_class(MCPPlanTarget, self.mcp_plan_target) + result["McpPlanTransportChoice"] = (self.mcp_plan_transport_choice).to_dict() + result["McpPlanTransportChoicePackage"] = to_class(MCPPlanTransportChoicePackage, self.mcp_plan_transport_choice_package) + result["McpPlanTransportChoiceRemote"] = to_class(MCPPlanTransportChoiceRemote, self.mcp_plan_transport_choice_remote) + result["McpPlanValueCategory"] = to_enum(MCPPlanValueCategory, self.mcp_plan_value_category) result["McpRegisterExternalClientRequest"] = to_class(MCPRegisterExternalClientRequest, self.mcp_register_external_client_request) result["McpReloadConfig"] = to_class(MCPReloadConfig, self.mcp_reload_config) result["McpReloadWithConfigRequest"] = to_class(MCPReloadWithConfigRequest, self.mcp_reload_with_config_request) @@ -34707,6 +37297,12 @@ def to_dict(self) -> dict: result["McpServer"] = to_class(MCPServer, self.mcp_server) result["McpServerAuthConfig"] = from_union([from_bool, lambda x: to_class(MCPServerAuthConfigRedirectPort, x)], self.mcp_server_auth_config) result["McpServerAuthConfigRedirectPort"] = to_class(MCPServerAuthConfigRedirectPort, self.mcp_server_auth_config_redirect_port) + result["McpServerCardEmbedded"] = to_class(MCPServerCardEmbedded, self.mcp_server_card_embedded) + result["McpServerCardEmbeddedKind"] = to_enum(MCPServerCardEmbeddedKind, self.mcp_server_card_embedded_kind) + result["McpServerCardMediaType"] = to_enum(MCPServerCardMediaType, self.mcp_server_card_media_type) + result["McpServerCardReference"] = (self.mcp_server_card_reference).to_dict() + result["McpServerCardUrl"] = to_class(MCPServerCardURL, self.mcp_server_card_url) + result["McpServerCardUrlKind"] = to_enum(MCPServerCardURLKind, self.mcp_server_card_url_kind) result["McpServerConfig"] = to_class(MCPServerConfig, self.mcp_server_config) result["McpServerConfigDeferTools"] = to_enum(MCPServerConfigDeferTools, self.mcp_server_config_defer_tools) result["McpServerConfigHttp"] = to_class(MCPServerConfigHTTP, self.mcp_server_config_http) @@ -34777,6 +37373,7 @@ def to_dict(self) -> dict: result["ModelSwitchToResult"] = to_class(ModelSwitchToResult, self.model_switch_to_result) result["ModeSetRequest"] = to_class(ModeSetRequest, self.mode_set_request) result["ModeSetResult"] = to_class(ModeSetResult, self.mode_set_result) + result["MoveMcpLoadingToBackgroundResult"] = to_class(MoveMCPLoadingToBackgroundResult, self.move_mcp_loading_to_background_result) result["NamedProviderConfig"] = to_class(NamedProviderConfig, self.named_provider_config) result["NameGetResult"] = to_class(NameGetResult, self.name_get_result) result["NameSetAutoRequest"] = to_class(NameSetAutoRequest, self.name_set_auto_request) @@ -34844,6 +37441,7 @@ def to_dict(self) -> dict: result["PermissionLocationResolveParams"] = to_class(PermissionLocationResolveParams, self.permission_location_resolve_params) result["PermissionLocationResolveResult"] = to_class(PermissionLocationResolveResult, self.permission_location_resolve_result) result["PermissionLocationType"] = to_enum(PermissionLocationType, self.permission_location_type) + result["PermissionModeSource"] = to_enum(PermissionSource, self.permission_mode_source) result["PermissionPathsAddParams"] = to_class(PermissionPathsAddParams, self.permission_paths_add_params) result["PermissionPathsAllowedCheckParams"] = to_class(PermissionPathsAllowedCheckParams, self.permission_paths_allowed_check_params) result["PermissionPathsAllowedCheckResult"] = to_class(PermissionPathsAllowedCheckResult, self.permission_paths_allowed_check_result) @@ -34855,7 +37453,6 @@ def to_dict(self) -> dict: result["PermissionPromptShownNotification"] = to_class(PermissionPromptShownNotification, self.permission_prompt_shown_notification) result["PermissionRequestResult"] = to_class(PermissionRequestResult, self.permission_request_result) result["PermissionRulesSet"] = to_class(PermissionRulesSet, self.permission_rules_set) - result["PermissionsAllowAllMode"] = to_enum(PermissionsAllowAllMode, self.permissions_allow_all_mode) result["PermissionsConfigureAdditionalContentExclusionPolicy"] = to_class(PermissionsConfigureAdditionalContentExclusionPolicy, self.permissions_configure_additional_content_exclusion_policy) result["PermissionsConfigureAdditionalContentExclusionPolicyRule"] = to_class(PermissionsConfigureAdditionalContentExclusionPolicyRule, self.permissions_configure_additional_content_exclusion_policy_rule) result["PermissionsConfigureAdditionalContentExclusionPolicyRuleSource"] = to_class(PermissionsConfigureAdditionalContentExclusionPolicyRuleSource, self.permissions_configure_additional_content_exclusion_policy_rule_source) @@ -34863,7 +37460,8 @@ def to_dict(self) -> dict: result["PermissionsConfigureParams"] = to_class(PermissionsConfigureParams, self.permissions_configure_params) result["PermissionsConfigureResult"] = to_class(PermissionsConfigureResult, self.permissions_configure_result) result["PermissionsFolderTrustAddTrustedResult"] = to_class(PermissionsFolderTrustAddTrustedResult, self.permissions_folder_trust_add_trusted_result) - result["PermissionsGetAllowAllRequest"] = to_class(PermissionsGetAllowAllRequest, self.permissions_get_allow_all_request) + result["PermissionsGetModeRequest"] = to_class(PermissionsGetModeRequest, self.permissions_get_mode_request) + result["PermissionsGetModeResult"] = to_class(PermissionsGetModeResult, self.permissions_get_mode_result) result["PermissionsLocationsAddToolApprovalDetails"] = (self.permissions_locations_add_tool_approval_details).to_dict() result["PermissionsLocationsAddToolApprovalDetailsCommands"] = to_class(PermissionsLocationsAddToolApprovalDetailsCommands, self.permissions_locations_add_tool_approval_details_commands) result["PermissionsLocationsAddToolApprovalDetailsCustomTool"] = to_class(PermissionsLocationsAddToolApprovalDetailsCustomTool, self.permissions_locations_add_tool_approval_details_custom_tool) @@ -34887,11 +37485,11 @@ def to_dict(self) -> dict: result["PermissionsPendingRequestsRequest"] = to_class(PermissionsPendingRequestsRequest, self.permissions_pending_requests_request) result["PermissionsResetSessionApprovalsRequest"] = to_class(PermissionsResetSessionApprovalsRequest, self.permissions_reset_session_approvals_request) result["PermissionsResetSessionApprovalsResult"] = to_class(PermissionsResetSessionApprovalsResult, self.permissions_reset_session_approvals_result) - result["PermissionsSetAllowAllRequest"] = to_class(PermissionsSetAllowAllRequest, self.permissions_set_allow_all_request) - result["PermissionsSetAllowAllSource"] = to_enum(PermissionsSetAAllSource, self.permissions_set_allow_all_source) result["PermissionsSetApproveAllRequest"] = to_class(PermissionsSetApproveAllRequest, self.permissions_set_approve_all_request) result["PermissionsSetApproveAllResult"] = to_class(PermissionsSetApproveAllResult, self.permissions_set_approve_all_result) - result["PermissionsSetApproveAllSource"] = to_enum(PermissionsSetAAllSource, self.permissions_set_approve_all_source) + result["PermissionsSetApproveAllSource"] = to_enum(PermissionSource, self.permissions_set_approve_all_source) + result["PermissionsSetModeRequest"] = to_class(PermissionsSetModeRequest, self.permissions_set_mode_request) + result["PermissionsSetModeResult"] = to_class(PermissionsSetModeResult, self.permissions_set_mode_result) result["PermissionsSetRequiredRequest"] = to_class(PermissionsSetRequiredRequest, self.permissions_set_required_request) result["PermissionsSetRequiredResult"] = to_class(PermissionsSetRequiredResult, self.permissions_set_required_result) result["PermissionsUrlsSetUnrestrictedModeResult"] = to_class(PermissionsUrlsSetUnrestrictedModeResult, self.permissions_urls_set_unrestricted_mode_result) @@ -35442,6 +38040,37 @@ def _load_AuthInfo(obj: Any) -> "AuthInfo": case "api-key": return APIKeyAuthInfo.from_dict(obj) case _: raise ValueError(f"Unknown AuthInfo type: {kind!r}") +# 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. +CatalogCandidateSource = CatalogCandidateSourceURL | CatalogCandidateSourceEmbedded + +def _load_CatalogCandidateSource(obj: Any) -> "CatalogCandidateSource": + assert isinstance(obj, dict) + kind = obj.get("kind") + match kind: + case "url": return CatalogCandidateSourceURL.from_dict(obj) + case "embedded": return CatalogCandidateSourceEmbedded.from_dict(obj) + case _: raise ValueError(f"Unknown CatalogCandidateSource kind: {kind!r}") + +# Outcome of a catalog.search call: either bounded inert candidates, or one typed refusal. Never a partial success. +CatalogSearchResult = CatalogSearchSucceeded | CatalogNegotiationRefusedError | CatalogUnsupportedKindError | CatalogInvalidRequestError | CatalogAuthenticationRequiredError | CatalogPolicyRejectedError | CatalogNetworkFailureError | CatalogUnsafeRetrievalError | CatalogMalformedCardError | CatalogContractViolationError | CatalogUnavailableError + +def _load_CatalogSearchResult(obj: Any) -> "CatalogSearchResult": + assert isinstance(obj, dict) + kind = obj.get("kind") + match kind: + case "succeeded": return CatalogSearchSucceeded.from_dict(obj) + case "negotiation-refused": return CatalogNegotiationRefusedError.from_dict(obj) + case "unsupported-kind": return CatalogUnsupportedKindError.from_dict(obj) + case "invalid-request": return CatalogInvalidRequestError.from_dict(obj) + case "authentication-required": return CatalogAuthenticationRequiredError.from_dict(obj) + case "policy-rejected": return CatalogPolicyRejectedError.from_dict(obj) + case "network-failure": return CatalogNetworkFailureError.from_dict(obj) + case "unsafe-retrieval": return CatalogUnsafeRetrievalError.from_dict(obj) + case "malformed-card": return CatalogMalformedCardError.from_dict(obj) + case "contract-violation": return CatalogContractViolationError.from_dict(obj) + case "unavailable": return CatalogUnavailableError.from_dict(obj) + case _: raise ValueError(f"Unknown CatalogSearchResult kind: {kind!r}") + # A content block within a tool result, which may be text, terminal output, image, audio, or a resource ExternalToolTextResultForLlmContent = ExternalToolTextResultForLlmContentText | ExternalToolTextResultForLlmContentTerminal | ExternalToolTextResultForLlmContentShellExit | ExternalToolTextResultForLlmContentImage | ExternalToolTextResultForLlmContentAudio | ExternalToolTextResultForLlmContentResourceLink | ExternalToolTextResultForLlmContentResource @@ -35458,6 +38087,72 @@ def _load_ExternalToolTextResultForLlmContent(obj: Any) -> "ExternalToolTextResu case "resource": return ExternalToolTextResultForLlmContentResource.from_dict(obj) case _: raise ValueError(f"Unknown ExternalToolTextResultForLlmContent type: {kind!r}") +# Outcome of an mcp.planInstall call: either a normalised plan, or one typed refusal. Nothing is written in either case. +MCPPlanInstallResult = MCPPlanInstallPlanned | CatalogNegotiationRefusedError | CatalogHandleRejectedError | CatalogInvalidRequestError | CatalogAuthenticationRequiredError | CatalogPolicyRejectedError | CatalogNetworkFailureError | CatalogUnsafeRetrievalError | CatalogMalformedCardError | CatalogContractViolationError | CatalogUnavailableTransportError | CatalogNotInstallableError | CatalogUnavailableError + +def _load_MCPPlanInstallResult(obj: Any) -> "MCPPlanInstallResult": + assert isinstance(obj, dict) + kind = obj.get("kind") + match kind: + case "planned": return MCPPlanInstallPlanned.from_dict(obj) + case "negotiation-refused": return CatalogNegotiationRefusedError.from_dict(obj) + case "handle-rejected": return CatalogHandleRejectedError.from_dict(obj) + case "invalid-request": return CatalogInvalidRequestError.from_dict(obj) + case "authentication-required": return CatalogAuthenticationRequiredError.from_dict(obj) + case "policy-rejected": return CatalogPolicyRejectedError.from_dict(obj) + case "network-failure": return CatalogNetworkFailureError.from_dict(obj) + case "unsafe-retrieval": return CatalogUnsafeRetrievalError.from_dict(obj) + case "malformed-card": return CatalogMalformedCardError.from_dict(obj) + case "contract-violation": return CatalogContractViolationError.from_dict(obj) + case "unavailable-transport": return CatalogUnavailableTransportError.from_dict(obj) + case "not-installable": return CatalogNotInstallableError.from_dict(obj) + case "unavailable": return CatalogUnavailableError.from_dict(obj) + case _: raise ValueError(f"Unknown MCPPlanInstallResult kind: {kind!r}") + +# What an install plan is computed from: a candidate handle from a previous search, or a card supplied directly. +MCPPlanInstallSource = MCPPlanInstallSourceCandidate | MCPPlanInstallSourceCard + +def _load_MCPPlanInstallSource(obj: Any) -> "MCPPlanInstallSource": + assert isinstance(obj, dict) + kind = obj.get("kind") + match kind: + case "candidate": return MCPPlanInstallSourceCandidate.from_dict(obj) + case "card": return MCPPlanInstallSourceCard.from_dict(obj) + case _: raise ValueError(f"Unknown MCPPlanInstallSource kind: {kind!r}") + +# 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. +MCPPlanRequiredValue = MCPPlanRequiredValueScalar | MCPPlanRequiredValueEnum + +def _load_MCPPlanRequiredValue(obj: Any) -> "MCPPlanRequiredValue": + assert isinstance(obj, dict) + kind = obj.get("kind") + match kind: + case "scalar": return MCPPlanRequiredValueScalar.from_dict(obj) + case "enum": return MCPPlanRequiredValueEnum.from_dict(obj) + case _: raise ValueError(f"Unknown MCPPlanRequiredValue kind: {kind!r}") + +# 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. +MCPPlanTransportChoice = MCPPlanTransportChoicePackage | MCPPlanTransportChoiceRemote + +def _load_MCPPlanTransportChoice(obj: Any) -> "MCPPlanTransportChoice": + assert isinstance(obj, dict) + kind = obj.get("installMethod") + match kind: + case "package": return MCPPlanTransportChoicePackage.from_dict(obj) + case "remote": return MCPPlanTransportChoiceRemote.from_dict(obj) + case _: raise ValueError(f"Unknown MCPPlanTransportChoice installMethod: {kind!r}") + +# 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. +MCPServerCardReference = MCPServerCardURL | MCPServerCardEmbedded + +def _load_MCPServerCardReference(obj: Any) -> "MCPServerCardReference": + assert isinstance(obj, dict) + kind = obj.get("kind") + match kind: + case "url": return MCPServerCardURL.from_dict(obj) + case "embedded": return MCPServerCardEmbedded.from_dict(obj) + case _: raise ValueError(f"Unknown MCPServerCardReference kind: {kind!r}") + # The client's response to the pending permission prompt PermissionDecision = PermissionDecisionApproveOnce | PermissionDecisionApproveForSession | PermissionDecisionApproveForLocation | PermissionDecisionApprovePermanently | PermissionDecisionReject | PermissionDecisionUserNotAvailable | PermissionDecisionApproved | PermissionDecisionApprovedForSession | PermissionDecisionApprovedForLocation | PermissionDecisionCancelled | PermissionDecisionDeniedByRules | PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUser | PermissionDecisionDeniedInteractivelyByUser | PermissionDecisionDeniedByContentExclusionPolicy | PermissionDecisionDeniedByPermissionRequestHook @@ -35652,6 +38347,9 @@ def _load_TaskInfo(obj: Any) -> "TaskInfo": BuiltinToolSafeForTelemetry = bool CanvasActionInvokeResult = Any CanvasJsonSchema = Any +CardDigestValue = str +CatalogCapabilityId = str +CatalogMcpServerInstallability = CatalogMCPServerInstallabilityEnum CommandsListRequest = Any ExternalToolResult = ExternalToolTextResultForLlm ExternalToolTextResultForLlmContentResourceLinkIconTheme = Theme @@ -35671,17 +38369,26 @@ def _load_TaskInfo(obj: Any) -> "TaskInfo": McpExecuteSamplingRequest = dict McpExecuteSamplingResult = dict McpOauthLoginGrantType = MCPGrantType +McpPlanEnumValueType = MCPPlan +McpPlanInstallResult = MCPPlanInstallResult +McpPlanInstallSource = MCPPlanInstallSource +McpPlanRequiredValue = MCPPlanRequiredValue +McpPlanRequiredValueEnumKind = MCPPlan +McpPlanScalarValueType = MCPPlanScalarValueTypeEnum +McpPlanSecretReference = str +McpPlanTransportChoice = MCPPlanTransportChoice McpSafeForTelemetry = bool McpServerAuthConfig = bool +McpServerCardReference = MCPServerCardReference McpServerConfigHttpOauthGrantType = MCPGrantType MetadataSnapshotRemoteMetadataTaskType = TaskType ModelListRequest = Any OptionsUpdateAdditionalContentExclusionPolicyScope = AdditionalContentExclusionPolicyScope OptionsUpdateEnvValueMode = MCPSetEnvValueModeDetails OptionsUpdateReasoningSummary = ReasoningSummary +PermissionModeSource = PermissionSource PermissionsConfigureAdditionalContentExclusionPolicyScope = AdditionalContentExclusionPolicyScope -PermissionsSetAllowAllSource = PermissionsSetAAllSource -PermissionsSetApproveAllSource = PermissionsSetAAllSource +PermissionsSetApproveAllSource = PermissionSource PluginsReloadRequest = Any ProtocolExternalToolDefer = MCPServerConfigDeferTools ProviderConfigTransport = ProviderTransport @@ -35856,6 +38563,11 @@ async def discover(self, params: MCPDiscoverRequest, *, timeout: float | None = params_dict = {k: v for k, v in params.to_dict().items() if v is not None} return MCPDiscoverResult.from_dict(await self._client.request("mcp.discover", params_dict, **_timeout_kwargs(timeout))) + async def plan_install(self, params: MCPPlanInstallRequest, *, timeout: float | None = None) -> MCPPlanInstallResult: + "Requests a side-effect-free MCP install plan from a catalog candidate handle or a caller-supplied card. This host-implemented server method is available through SDK/TUI hosts; standalone and C-ABI runtimes whose host does not implement server-method dispatch return JSON-RPC MethodNotFound. A runtime with planning available returns a normalised plan and opaque single-use plan handle; a runtime without it returns the typed planning-unavailable result. A completed plan reports resource identity, provenance, eligible transport choices, the user-scope target, required typed values and secret placeholders, the policy result, the configuration changes installing would make, and whether a reload would be needed. Planning never writes configuration, stores a secret, or reloads MCP servers, so abandoning a plan needs no call and leaves nothing behind.\n\nArgs:\n params: A side-effect-free request for an MCP install plan. Computing a plan never writes configuration, stores a secret, or reloads MCP servers.\n\nReturns:\n Outcome of an mcp.planInstall call: either a normalised plan, or one typed refusal. Nothing is written in either case." + params_dict = {k: v for k, v in params.to_dict().items() if v is not None} + return _load_MCPPlanInstallResult(await self._client.request("mcp.planInstall", params_dict, **_timeout_kwargs(timeout))) + # Experimental: this API group is experimental and may change or be removed. class ServerExtensionsApi: @@ -35877,6 +38589,17 @@ async def disable(self, params: DiscoveredExtensionsDisableRequest, *, timeout: await self._client.request("extensions.disable", params_dict, **_timeout_kwargs(timeout)) +# Experimental: this API group is experimental and may change or be removed. +class ServerCatalogApi: + def __init__(self, client: "JsonRpcClient"): + self._client = client + + async def search(self, params: CatalogSearchRequest, *, timeout: float | None = None) -> CatalogSearchResult: + "Requests a bounded catalog search. This host-implemented server method is available through SDK/TUI hosts; standalone and C-ABI runtimes whose host does not implement server-method dispatch return JSON-RPC MethodNotFound. A runtime with search available returns inert candidate summaries, each with an opaque single-use handle scoped to this runtime instance; a runtime without it returns the typed search-unavailable result. Public authorities may be searched anonymously, while an authority that requires credentials yields the typed authentication-required result. All returned text, URLs, and package metadata are untrusted external data and can never trigger instructions, tools, or installation. Read-only: nothing is installed, configured, or persisted.\n\nArgs:\n params: 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.\n\nReturns:\n Outcome of a catalog.search call: either bounded inert candidates, or one typed refusal. Never a partial success." + params_dict = {k: v for k, v in params.to_dict().items() if v is not None} + return _load_CatalogSearchResult(await self._client.request("catalog.search", params_dict, **_timeout_kwargs(timeout))) + + # Experimental: this API group is experimental and may change or be removed. class ServerPluginsBuiltinApi: def __init__(self, client: "JsonRpcClient"): @@ -36251,6 +38974,7 @@ def __init__(self, client: "JsonRpcClient"): self.secrets = ServerSecretsApi(client) self.mcp = ServerMcpApi(client) self.extensions = ServerExtensionsApi(client) + self.catalog = ServerCatalogApi(client) self.plugins = ServerPluginsApi(client) self.skills = ServerSkillsApi(client) self.agents = ServerAgentsApi(client) @@ -37001,6 +39725,10 @@ async def reload(self, *, timeout: float | None = None) -> None: "Reloads MCP server connections for the session." await self._client.request("session.mcp.reload", {"sessionId": self._session_id}, **_timeout_kwargs(timeout)) + async def move_loading_to_background(self, *, timeout: float | None = None) -> MoveMCPLoadingToBackgroundResult: + "Releases any turns waiting on an in-flight MCP load without cancelling the load, letting the agent proceed while MCP servers finish connecting in the background. No-op when no MCP load is in flight or waiting turns were already released.\n\nReturns:\n Result of moving in-flight MCP loading to the background." + return MoveMCPLoadingToBackgroundResult.from_dict(await self._client.request("session.mcp.moveLoadingToBackground", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) + async def execute_sampling(self, params: MCPExecuteSamplingParams, *, timeout: float | None = None) -> MCPSamplingExecutionResult: "Runs an MCP sampling inference on behalf of an MCP server.\n\nArgs:\n params: Identifiers and raw MCP CreateMessageRequest params used to run a sampling inference.\n\nReturns:\n Outcome of an MCP sampling execution: success result, failure error, or cancellation." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} @@ -37443,15 +40171,15 @@ async def set_approve_all(self, params: PermissionsSetApproveAllRequest, *, time params_dict["sessionId"] = self._session_id return PermissionsSetApproveAllResult.from_dict(await self._client.request("session.permissions.setApproveAll", params_dict, **_timeout_kwargs(timeout))) - async def set_allow_all(self, params: PermissionsSetAllowAllRequest, *, timeout: float | None = None) -> AllowAllPermissionSetResult: - "Sets the allow-all permission mode for the session. Used by attach-mode clients (e.g. LocalRpcSession's `/allow-all` forwarder) to flip the target session's permission state. The `on` mode swaps in unrestricted path and URL managers and emits `session.permissions_changed` on transition; the `auto` mode keeps normal prompt paths active while attaching LLM safety recommendations. The result returns the authoritative post-mutation state so callers can update their local mirrors without racing the `session.permissions_changed` notification on the same wire.\n\nArgs:\n params: Allow-all mode to apply for the session.\n\nReturns:\n Indicates whether the operation succeeded and reports the post-mutation state." + async def set_mode(self, params: PermissionsSetModeRequest, *, timeout: float | None = None) -> PermissionsSetModeResult: + "Sets the permission mode for the session. `manual` follows the normal approval flow, `assisted` attaches LLM safety recommendations, and `allow-all` automatically approves permission requests. The result returns the authoritative post-mutation mode so callers can update local state without racing the `session.permissions_changed` notification.\n\nArgs:\n params: Permission mode to apply for the session.\n\nReturns:\n Indicates whether the requested permission mode was applied and reports the authoritative post-mutation mode." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return AllowAllPermissionSetResult.from_dict(await self._client.request("session.permissions.setAllowAll", params_dict, **_timeout_kwargs(timeout))) + return PermissionsSetModeResult.from_dict(await self._client.request("session.permissions.setMode", params_dict, **_timeout_kwargs(timeout))) - async def get_allow_all(self, *, timeout: float | None = None) -> AllowAllPermissionState: - "Returns the current allow-all permission mode for the session.\n\nReturns:\n Current allow-all permission mode." - return AllowAllPermissionState.from_dict(await self._client.request("session.permissions.getAllowAll", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) + async def get_mode(self, *, timeout: float | None = None) -> PermissionsGetModeResult: + "Returns the current permission mode for the session.\n\nReturns:\n Current permission mode." + return PermissionsGetModeResult.from_dict(await self._client.request("session.permissions.getMode", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) async def modify_rules(self, params: PermissionsModifyRulesParams, *, timeout: float | None = None) -> PermissionsModifyRulesResult: "Adds or removes session-scoped or location-scoped permission rules.\n\nArgs:\n params: Scope and add/remove instructions for modifying session- or location-scoped permission rules.\n\nReturns:\n Indicates whether the operation succeeded." @@ -38496,8 +41224,6 @@ async def handle_git_hub_telemetry_event(params: dict) -> None: "AgentSetPromptRequest", "AgentsDiscoverRequest", "AgentsGetDiscoveryPathsRequest", - "AllowAllPermissionSetResult", - "AllowAllPermissionState", "ApprovalKind", "AuthIdentity", "AuthInfo", @@ -38535,6 +41261,74 @@ async def handle_git_hub_telemetry_event(params: dict) -> None: "CanvasProviderUnregisterRequest", "CanvasSessionContext", "CapiSessionOptions", + "CardDigest", + "CardDigestAlgorithm", + "CardDigestValue", + "CatalogAISkillCandidate", + "CatalogAISkillCandidateKind", + "CatalogAISkillCandidateProvenance", + "CatalogAuthenticationRequiredError", + "CatalogAuthenticationRequiredErrorKind", + "CatalogAuthenticationRequiredReason", + "CatalogCandidate", + "CatalogCandidateInstallability", + "CatalogCandidateKind", + "CatalogCandidateProvenance", + "CatalogCandidateSource", + "CatalogCandidateSourceEmbedded", + "CatalogCandidateSourceKind", + "CatalogCandidateSourceURL", + "CatalogCapability", + "CatalogCapabilityId", + "CatalogClientContract", + "CatalogContractViolationError", + "CatalogContractViolationErrorKind", + "CatalogContractViolationReason", + "CatalogHandleRejectedError", + "CatalogHandleRejectedErrorKind", + "CatalogHandleRejectionReason", + "CatalogHandleType", + "CatalogInvalidRequestError", + "CatalogInvalidRequestErrorKind", + "CatalogInvalidRequestField", + "CatalogMCPServerCandidate", + "CatalogMCPServerCandidateKind", + "CatalogMCPServerCandidateProvenance", + "CatalogMCPServerInstallabilityEnum", + "CatalogMalformedCardError", + "CatalogMalformedCardErrorKind", + "CatalogMalformedCardReason", + "CatalogMcpServerInstallability", + "CatalogMediaType", + "CatalogNegotiatedContract", + "CatalogNegotiationRefusedError", + "CatalogNegotiationRefusedErrorKind", + "CatalogNegotiationRefusedReason", + "CatalogNetworkFailureError", + "CatalogNetworkFailureErrorKind", + "CatalogNetworkFailureReason", + "CatalogNotInstallableError", + "CatalogNotInstallableErrorKind", + "CatalogNotInstallableReason", + "CatalogPolicyRejectedError", + "CatalogPolicyRejectedErrorKind", + "CatalogSearchRequest", + "CatalogSearchResult", + "CatalogSearchResultKind", + "CatalogSearchResultReason", + "CatalogSearchSucceeded", + "CatalogSearchSucceededKind", + "CatalogUnavailableError", + "CatalogUnavailableErrorKind", + "CatalogUnavailableReason", + "CatalogUnavailableTransportError", + "CatalogUnavailableTransportErrorKind", + "CatalogUnavailableTransportReason", + "CatalogUnsafeRetrievalError", + "CatalogUnsafeRetrievalErrorKind", + "CatalogUnsafeRetrievalReason", + "CatalogUnsupportedKindError", + "CatalogUnsupportedKindErrorKind", "Categories", "ClientGlobalApiHandlers", "ClientSessionApiHandlers", @@ -38738,12 +41532,15 @@ async def handle_git_hub_telemetry_event(params: dict) -> None: "HooksHandler", "Host", "HostType", + "InstallMethod", + "Installability", "InstalledPlugin", "InstalledPluginInfo", "InstalledPluginSource", "InstalledPluginSourceGitHub", "InstalledPluginSourceLocal", "InstalledPluginSourceURL", + "InstalledPluginSourceURLSource", "InstructionDiscoveryPath", "InstructionDiscoveryPathKind", "InstructionDiscoveryPathList", @@ -38819,6 +41616,7 @@ async def handle_git_hub_telemetry_event(params: dict) -> None: "MCPHeadersHandlePendingHeadersRefreshRequestRequest", "MCPHeadersHandlePendingHeadersRefreshRequestResult", "MCPHostState", + "MCPInstallPlan", "MCPIsServerRunningRequest", "MCPIsServerRunningResult", "MCPListToolsRequest", @@ -38835,6 +41633,45 @@ async def handle_git_hub_telemetry_event(params: dict) -> None: "MCPOauthProbeResult", "MCPOauthRespondRequest", "MCPOauthRespondResult", + "MCPPlan", + "MCPPlanConfigurationChange", + "MCPPlanConfigurationOperation", + "MCPPlanETransport", + "MCPPlanInstallPlanned", + "MCPPlanInstallPlannedKind", + "MCPPlanInstallRequest", + "MCPPlanInstallResult", + "MCPPlanInstallResultKind", + "MCPPlanInstallResultReason", + "MCPPlanInstallSource", + "MCPPlanInstallSourceCandidate", + "MCPPlanInstallSourceCandidateKind", + "MCPPlanInstallSourceCard", + "MCPPlanInstallSourceCardKind", + "MCPPlanInstallSourceKind", + "MCPPlanPackageInstallMethod", + "MCPPlanPackageTransport", + "MCPPlanPolicyDecision", + "MCPPlanPolicyResult", + "MCPPlanPolicySource", + "MCPPlanProvenance", + "MCPPlanRemoteInstallMethod", + "MCPPlanRemoteTransport", + "MCPPlanRequiredValue", + "MCPPlanRequiredValueEnum", + "MCPPlanRequiredValueKind", + "MCPPlanRequiredValueScalar", + "MCPPlanRequiredValueScalarKind", + "MCPPlanRequiredValueValueType", + "MCPPlanResourceIdentity", + "MCPPlanScalarValueTypeEnum", + "MCPPlanScope", + "MCPPlanSecretPlaceholder", + "MCPPlanTarget", + "MCPPlanTransportChoice", + "MCPPlanTransportChoicePackage", + "MCPPlanTransportChoiceRemote", + "MCPPlanValueCategory", "MCPRegisterExternalClientRequest", "MCPReloadConfig", "MCPReloadWithConfigRequest", @@ -38858,6 +41695,12 @@ async def handle_git_hub_telemetry_event(params: dict) -> None: "MCPSerializableServerConfigType", "MCPServer", "MCPServerAuthConfigRedirectPort", + "MCPServerCardEmbedded", + "MCPServerCardEmbeddedKind", + "MCPServerCardMediaType", + "MCPServerCardReference", + "MCPServerCardURL", + "MCPServerCardURLKind", "MCPServerConfig", "MCPServerConfigDeferTools", "MCPServerConfigHTTP", @@ -38904,10 +41747,20 @@ async def handle_git_hub_telemetry_event(params: dict) -> None: "McpHeadersApi", "McpOauthApi", "McpOauthLoginGrantType", + "McpPlanEnumValueType", + "McpPlanInstallResult", + "McpPlanInstallSource", + "McpPlanRequiredValue", + "McpPlanRequiredValueEnumKind", + "McpPlanScalarValueType", + "McpPlanSecretReference", + "McpPlanTransportChoice", "McpResourcesApi", "McpSafeForTelemetry", "McpServerAuthConfig", + "McpServerCardReference", "McpServerConfigHttpOauthGrantType", + "MediaType", "MemoryConfiguration", "MetadataApi", "MetadataContextAttributionResult", @@ -38958,6 +41811,7 @@ async def handle_git_hub_telemetry_event(params: dict) -> None: "ModelSwitchToRequest", "ModelSwitchToResult", "ModelsListRequest", + "MoveMCPLoadingToBackgroundResult", "NameApi", "NameGetResult", "NameSetAutoRequest", @@ -39053,6 +41907,7 @@ async def handle_git_hub_telemetry_event(params: dict) -> None: "PermissionLocationResolveParams", "PermissionLocationResolveResult", "PermissionLocationType", + "PermissionModeSource", "PermissionPathsAddParams", "PermissionPathsAllowedCheckParams", "PermissionPathsAllowedCheckResult", @@ -39064,9 +41919,9 @@ async def handle_git_hub_telemetry_event(params: dict) -> None: "PermissionPromptShownNotification", "PermissionRequestResult", "PermissionRulesSet", + "PermissionSource", "PermissionUrlsConfig", "PermissionUrlsSetUnrestrictedModeParams", - "PermissionsAllowAllMode", "PermissionsApi", "PermissionsConfigureAdditionalContentExclusionPolicy", "PermissionsConfigureAdditionalContentExclusionPolicyRule", @@ -39076,7 +41931,8 @@ async def handle_git_hub_telemetry_event(params: dict) -> None: "PermissionsConfigureResult", "PermissionsFolderTrustAddTrustedResult", "PermissionsFolderTrustApi", - "PermissionsGetAllowAllRequest", + "PermissionsGetModeRequest", + "PermissionsGetModeResult", "PermissionsLocationsAddToolApprovalDetails", "PermissionsLocationsAddToolApprovalDetailsCommands", "PermissionsLocationsAddToolApprovalDetailsCustomTool", @@ -39102,12 +41958,11 @@ async def handle_git_hub_telemetry_event(params: dict) -> None: "PermissionsPendingRequestsRequest", "PermissionsResetSessionApprovalsRequest", "PermissionsResetSessionApprovalsResult", - "PermissionsSetAAllSource", - "PermissionsSetAllowAllRequest", - "PermissionsSetAllowAllSource", "PermissionsSetApproveAllRequest", "PermissionsSetApproveAllResult", "PermissionsSetApproveAllSource", + "PermissionsSetModeRequest", + "PermissionsSetModeResult", "PermissionsSetRequiredRequest", "PermissionsSetRequiredResult", "PermissionsUrlsApi", @@ -39301,6 +42156,7 @@ async def handle_git_hub_telemetry_event(params: dict) -> None: "ServerAgentList", "ServerAgentRegistryApi", "ServerAgentsApi", + "ServerCatalogApi", "ServerCommandsApi", "ServerExtensionsApi", "ServerInstructionSourceList", @@ -39482,7 +42338,6 @@ async def handle_git_hub_telemetry_event(params: dict) -> None: "SessionsOpenProgressStatus", "SessionsOpenProgressStep", "SessionsOpenRemote", - "SessionsOpenRemoteKind", "SessionsOpenResume", "SessionsOpenResumeKind", "SessionsOpenResumeLast", @@ -39558,7 +42413,6 @@ async def handle_git_hub_telemetry_event(params: dict) -> None: "SlashCommandTextResult", "SlashCommandTimelineEntry", "Status", - "StickySource", "SubagentSettings", "SubagentSettingsEntry", "SubagentSettingsEntryContextTier", @@ -39600,7 +42454,6 @@ async def handle_git_hub_telemetry_event(params: dict) -> None: "TasksWaitForPendingResult", "TelemetryApi", "TelemetrySetFeatureOverridesRequest", - "TentacledSource", "Theme", "TokenAuthInfo", "TokenAuthInfoType", @@ -39677,7 +42530,6 @@ async def handle_git_hub_telemetry_event(params: dict) -> None: "UsageMetricsModelMetricUsage", "UsageMetricsTokenDetail", "UserAuthInfo", - "UserAuthInfoType", "UserRequestedShellCommandResult", "UserSettingMetadata", "UserSettingsGetResult", diff --git a/python/copilot/generated/session_events.py b/python/copilot/generated/session_events.py index 25b79428a4..68117bdc01 100644 --- a/python/copilot/generated/session_events.py +++ b/python/copilot/generated/session_events.py @@ -138,6 +138,7 @@ class SessionEventType(Enum): SESSION_MODEL_CHANGE = "session.model_change" SESSION_MODE_CHANGED = "session.mode_changed" SESSION_SESSION_LIMITS_CHANGED = "session.session_limits_changed" + # Experimental: this event is part of an experimental API and may change or be removed. SESSION_PERMISSIONS_CHANGED = "session.permissions_changed" SESSION_PLAN_CHANGED = "session.plan_changed" SESSION_TODOS_CHANGED = "session.todos_changed" @@ -924,21 +925,21 @@ def to_dict(self) -> dict: # Experimental: this type is part of an experimental API and may change or be removed. @dataclass -class PermissionAutoApproval: - "Auto-approval judge information attached to a permission request. Present (non-null) only when the session's allow-all mode is \"auto\"; its absence means auto mode was off and the judge did not evaluate the request. The `recommendation` conveys the judge's disposition for this request." - recommendation: AutoApprovalRecommendation - failure_reason: AutoApprovalJudgeFailureReason | None = None +class PermissionAssistedApproval: + "Assisted-approval judge information attached to a permission request. Present only in assisted mode; its absence means the judge did not evaluate the request. The `recommendation` conveys the judge's disposition for this request." + recommendation: AssistedApprovalRecommendation + failure_reason: AssistedApprovalJudgeFailureReason | None = None model: str | None = None reason: str | None = None @staticmethod - def from_dict(obj: Any) -> "PermissionAutoApproval": + def from_dict(obj: Any) -> "PermissionAssistedApproval": assert isinstance(obj, dict) - recommendation = parse_enum(AutoApprovalRecommendation, obj.get("recommendation")) - failure_reason = from_union([from_none, lambda x: parse_enum(AutoApprovalJudgeFailureReason, x)], obj.get("failureReason")) + recommendation = parse_enum(AssistedApprovalRecommendation, obj.get("recommendation")) + failure_reason = from_union([from_none, lambda x: parse_enum(AssistedApprovalJudgeFailureReason, x)], obj.get("failureReason")) model = from_union([from_none, from_str], obj.get("model")) reason = from_union([from_none, from_str], obj.get("reason")) - return PermissionAutoApproval( + return PermissionAssistedApproval( recommendation=recommendation, failure_reason=failure_reason, model=model, @@ -947,9 +948,9 @@ def from_dict(obj: Any) -> "PermissionAutoApproval": def to_dict(self) -> dict: result: dict = {} - result["recommendation"] = to_enum(AutoApprovalRecommendation, self.recommendation) + result["recommendation"] = to_enum(AssistedApprovalRecommendation, self.recommendation) if self.failure_reason is not None: - result["failureReason"] = from_union([from_none, lambda x: to_enum(AutoApprovalJudgeFailureReason, x)], self.failure_reason) + result["failureReason"] = from_union([from_none, lambda x: to_enum(AssistedApprovalJudgeFailureReason, x)], self.failure_reason) if self.model is not None: result["model"] = from_union([from_none, from_str], self.model) if self.reason is not None: @@ -1339,6 +1340,38 @@ def to_dict(self) -> dict: return result +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class SessionPermissionsChangedData: + "Permission-mode transition details." + # Experimental: this field is part of an experimental API and may change or be removed. + mode: PermissionMode + # Experimental: this field is part of an experimental API and may change or be removed. + previous_mode: PermissionMode + # Experimental: this field is part of an experimental API and may change or be removed. + assisted_approval_model: str | None = None + + @staticmethod + def from_dict(obj: Any) -> "SessionPermissionsChangedData": + assert isinstance(obj, dict) + mode = parse_enum(PermissionMode, obj.get("mode")) + previous_mode = parse_enum(PermissionMode, obj.get("previousMode")) + assisted_approval_model = from_union([from_none, from_str], obj.get("assistedApprovalModel")) + return SessionPermissionsChangedData( + mode=mode, + previous_mode=previous_mode, + assisted_approval_model=assisted_approval_model, + ) + + def to_dict(self) -> dict: + result: dict = {} + result["mode"] = to_enum(PermissionMode, self.mode) + result["previousMode"] = to_enum(PermissionMode, self.previous_mode) + if self.assisted_approval_model is not None: + result["assistedApprovalModel"] = from_union([from_none, from_str], self.assisted_approval_model) + return result + + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UiEphemeralQueryData: @@ -4876,7 +4909,7 @@ class PermissionPromptRequestCommands: intention: str kind: ClassVar[str] = "commands" # Experimental: this field is part of an experimental API and may change or be removed. - auto_approval: PermissionAutoApproval | None = None + assisted_approval: PermissionAssistedApproval | None = None managed_approval_required: bool | None = None tool_call_id: str | None = None warning: str | None = None @@ -4888,7 +4921,7 @@ def from_dict(obj: Any) -> "PermissionPromptRequestCommands": command_identifiers = from_list(from_str, obj.get("commandIdentifiers")) full_command_text = from_str(obj.get("fullCommandText")) intention = from_str(obj.get("intention")) - auto_approval = from_union([from_none, PermissionAutoApproval.from_dict], obj.get("autoApproval")) + assisted_approval = from_union([from_none, PermissionAssistedApproval.from_dict], obj.get("assistedApproval")) managed_approval_required = from_union([from_none, from_bool], obj.get("managedApprovalRequired")) tool_call_id = from_union([from_none, from_str], obj.get("toolCallId")) warning = from_union([from_none, from_str], obj.get("warning")) @@ -4897,7 +4930,7 @@ def from_dict(obj: Any) -> "PermissionPromptRequestCommands": command_identifiers=command_identifiers, full_command_text=full_command_text, intention=intention, - auto_approval=auto_approval, + assisted_approval=assisted_approval, managed_approval_required=managed_approval_required, tool_call_id=tool_call_id, warning=warning, @@ -4910,8 +4943,8 @@ def to_dict(self) -> dict: result["fullCommandText"] = from_str(self.full_command_text) result["intention"] = from_str(self.intention) result["kind"] = self.kind - if self.auto_approval is not None: - result["autoApproval"] = from_union([from_none, lambda x: to_class(PermissionAutoApproval, x)], self.auto_approval) + if self.assisted_approval is not None: + result["assistedApproval"] = from_union([from_none, lambda x: to_class(PermissionAssistedApproval, x)], self.assisted_approval) if self.managed_approval_required is not None: result["managedApprovalRequired"] = from_union([from_none, from_bool], self.managed_approval_required) if self.tool_call_id is not None: @@ -4929,7 +4962,7 @@ class PermissionPromptRequestCustomTool: tool_name: str args: Any = None # Experimental: this field is part of an experimental API and may change or be removed. - auto_approval: PermissionAutoApproval | None = None + assisted_approval: PermissionAssistedApproval | None = None tool_call_id: str | None = None @staticmethod @@ -4938,13 +4971,13 @@ def from_dict(obj: Any) -> "PermissionPromptRequestCustomTool": tool_description = from_str(obj.get("toolDescription")) tool_name = from_str(obj.get("toolName")) args = obj.get("args") - auto_approval = from_union([from_none, PermissionAutoApproval.from_dict], obj.get("autoApproval")) + assisted_approval = from_union([from_none, PermissionAssistedApproval.from_dict], obj.get("assistedApproval")) tool_call_id = from_union([from_none, from_str], obj.get("toolCallId")) return PermissionPromptRequestCustomTool( tool_description=tool_description, tool_name=tool_name, args=args, - auto_approval=auto_approval, + assisted_approval=assisted_approval, tool_call_id=tool_call_id, ) @@ -4955,8 +4988,8 @@ def to_dict(self) -> dict: result["toolName"] = from_str(self.tool_name) if self.args is not None: result["args"] = self.args - if self.auto_approval is not None: - result["autoApproval"] = from_union([from_none, lambda x: to_class(PermissionAutoApproval, x)], self.auto_approval) + if self.assisted_approval is not None: + result["assistedApproval"] = from_union([from_none, lambda x: to_class(PermissionAssistedApproval, x)], self.assisted_approval) if self.tool_call_id is not None: result["toolCallId"] = from_union([from_none, from_str], self.tool_call_id) return result @@ -4969,7 +5002,7 @@ class PermissionPromptRequestExtensionEnvAccess: extension_name: str kind: ClassVar[str] = "extension-env-access" # Experimental: this field is part of an experimental API and may change or be removed. - auto_approval: PermissionAutoApproval | None = None + assisted_approval: PermissionAssistedApproval | None = None tool_call_id: str | None = None @staticmethod @@ -4977,12 +5010,12 @@ def from_dict(obj: Any) -> "PermissionPromptRequestExtensionEnvAccess": assert isinstance(obj, dict) environment_variables = from_list(from_str, obj.get("environmentVariables")) extension_name = from_str(obj.get("extensionName")) - auto_approval = from_union([from_none, PermissionAutoApproval.from_dict], obj.get("autoApproval")) + assisted_approval = from_union([from_none, PermissionAssistedApproval.from_dict], obj.get("assistedApproval")) tool_call_id = from_union([from_none, from_str], obj.get("toolCallId")) return PermissionPromptRequestExtensionEnvAccess( environment_variables=environment_variables, extension_name=extension_name, - auto_approval=auto_approval, + assisted_approval=assisted_approval, tool_call_id=tool_call_id, ) @@ -4991,8 +5024,8 @@ def to_dict(self) -> dict: result["environmentVariables"] = from_list(from_str, self.environment_variables) result["extensionName"] = from_str(self.extension_name) result["kind"] = self.kind - if self.auto_approval is not None: - result["autoApproval"] = from_union([from_none, lambda x: to_class(PermissionAutoApproval, x)], self.auto_approval) + if self.assisted_approval is not None: + result["assistedApproval"] = from_union([from_none, lambda x: to_class(PermissionAssistedApproval, x)], self.assisted_approval) if self.tool_call_id is not None: result["toolCallId"] = from_union([from_none, from_str], self.tool_call_id) return result @@ -5004,7 +5037,7 @@ class PermissionPromptRequestExtensionManagement: kind: ClassVar[str] = "extension-management" operation: str # Experimental: this field is part of an experimental API and may change or be removed. - auto_approval: PermissionAutoApproval | None = None + assisted_approval: PermissionAssistedApproval | None = None extension_name: str | None = None tool_call_id: str | None = None @@ -5012,12 +5045,12 @@ class PermissionPromptRequestExtensionManagement: def from_dict(obj: Any) -> "PermissionPromptRequestExtensionManagement": assert isinstance(obj, dict) operation = from_str(obj.get("operation")) - auto_approval = from_union([from_none, PermissionAutoApproval.from_dict], obj.get("autoApproval")) + assisted_approval = from_union([from_none, PermissionAssistedApproval.from_dict], obj.get("assistedApproval")) extension_name = from_union([from_none, from_str], obj.get("extensionName")) tool_call_id = from_union([from_none, from_str], obj.get("toolCallId")) return PermissionPromptRequestExtensionManagement( operation=operation, - auto_approval=auto_approval, + assisted_approval=assisted_approval, extension_name=extension_name, tool_call_id=tool_call_id, ) @@ -5026,8 +5059,8 @@ def to_dict(self) -> dict: result: dict = {} result["kind"] = self.kind result["operation"] = from_str(self.operation) - if self.auto_approval is not None: - result["autoApproval"] = from_union([from_none, lambda x: to_class(PermissionAutoApproval, x)], self.auto_approval) + if self.assisted_approval is not None: + result["assistedApproval"] = from_union([from_none, lambda x: to_class(PermissionAssistedApproval, x)], self.assisted_approval) if self.extension_name is not None: result["extensionName"] = from_union([from_none, from_str], self.extension_name) if self.tool_call_id is not None: @@ -5042,7 +5075,7 @@ class PermissionPromptRequestExtensionPermissionAccess: extension_name: str kind: ClassVar[str] = "extension-permission-access" # Experimental: this field is part of an experimental API and may change or be removed. - auto_approval: PermissionAutoApproval | None = None + assisted_approval: PermissionAssistedApproval | None = None tool_call_id: str | None = None @staticmethod @@ -5050,12 +5083,12 @@ def from_dict(obj: Any) -> "PermissionPromptRequestExtensionPermissionAccess": assert isinstance(obj, dict) capabilities = from_list(from_str, obj.get("capabilities")) extension_name = from_str(obj.get("extensionName")) - auto_approval = from_union([from_none, PermissionAutoApproval.from_dict], obj.get("autoApproval")) + assisted_approval = from_union([from_none, PermissionAssistedApproval.from_dict], obj.get("assistedApproval")) tool_call_id = from_union([from_none, from_str], obj.get("toolCallId")) return PermissionPromptRequestExtensionPermissionAccess( capabilities=capabilities, extension_name=extension_name, - auto_approval=auto_approval, + assisted_approval=assisted_approval, tool_call_id=tool_call_id, ) @@ -5064,8 +5097,8 @@ def to_dict(self) -> dict: result["capabilities"] = from_list(from_str, self.capabilities) result["extensionName"] = from_str(self.extension_name) result["kind"] = self.kind - if self.auto_approval is not None: - result["autoApproval"] = from_union([from_none, lambda x: to_class(PermissionAutoApproval, x)], self.auto_approval) + if self.assisted_approval is not None: + result["assistedApproval"] = from_union([from_none, lambda x: to_class(PermissionAssistedApproval, x)], self.assisted_approval) if self.tool_call_id is not None: result["toolCallId"] = from_union([from_none, from_str], self.tool_call_id) return result @@ -5082,7 +5115,7 @@ class PermissionPromptRequestFactory: operation: FactoryPermissionOperation phases: list[FactoryPermissionPhase] # Experimental: this field is part of an experimental API and may change or be removed. - auto_approval: PermissionAutoApproval | None = None + assisted_approval: PermissionAssistedApproval | None = None declared_max_ai_credits: float | None = None declared_max_concurrent_subagents: int | None = None declared_max_total_subagents: int | None = None @@ -5103,7 +5136,7 @@ def from_dict(obj: Any) -> "PermissionPromptRequestFactory": name = from_str(obj.get("name")) operation = parse_enum(FactoryPermissionOperation, obj.get("operation")) phases = from_list(FactoryPermissionPhase.from_dict, obj.get("phases")) - auto_approval = from_union([from_none, PermissionAutoApproval.from_dict], obj.get("autoApproval")) + assisted_approval = from_union([from_none, PermissionAssistedApproval.from_dict], obj.get("assistedApproval")) declared_max_ai_credits = from_union([from_none, from_float], obj.get("declaredMaxAiCredits")) declared_max_concurrent_subagents = from_union([from_none, from_int], obj.get("declaredMaxConcurrentSubagents")) declared_max_total_subagents = from_union([from_none, from_int], obj.get("declaredMaxTotalSubagents")) @@ -5121,7 +5154,7 @@ def from_dict(obj: Any) -> "PermissionPromptRequestFactory": name=name, operation=operation, phases=phases, - auto_approval=auto_approval, + assisted_approval=assisted_approval, declared_max_ai_credits=declared_max_ai_credits, declared_max_concurrent_subagents=declared_max_concurrent_subagents, declared_max_total_subagents=declared_max_total_subagents, @@ -5143,8 +5176,8 @@ def to_dict(self) -> dict: result["name"] = from_str(self.name) result["operation"] = to_enum(FactoryPermissionOperation, self.operation) result["phases"] = from_list(lambda x: to_class(FactoryPermissionPhase, x), self.phases) - if self.auto_approval is not None: - result["autoApproval"] = from_union([from_none, lambda x: to_class(PermissionAutoApproval, x)], self.auto_approval) + if self.assisted_approval is not None: + result["assistedApproval"] = from_union([from_none, lambda x: to_class(PermissionAssistedApproval, x)], self.assisted_approval) if self.declared_max_ai_credits is not None: result["declaredMaxAiCredits"] = from_union([from_none, to_float], self.declared_max_ai_credits) if self.declared_max_concurrent_subagents is not None: @@ -5174,7 +5207,7 @@ class PermissionPromptRequestHook: kind: ClassVar[str] = "hook" tool_name: str # Experimental: this field is part of an experimental API and may change or be removed. - auto_approval: PermissionAutoApproval | None = None + assisted_approval: PermissionAssistedApproval | None = None hook_message: str | None = None tool_args: Any = None tool_call_id: str | None = None @@ -5183,13 +5216,13 @@ class PermissionPromptRequestHook: def from_dict(obj: Any) -> "PermissionPromptRequestHook": assert isinstance(obj, dict) tool_name = from_str(obj.get("toolName")) - auto_approval = from_union([from_none, PermissionAutoApproval.from_dict], obj.get("autoApproval")) + assisted_approval = from_union([from_none, PermissionAssistedApproval.from_dict], obj.get("assistedApproval")) hook_message = from_union([from_none, from_str], obj.get("hookMessage")) tool_args = obj.get("toolArgs") tool_call_id = from_union([from_none, from_str], obj.get("toolCallId")) return PermissionPromptRequestHook( tool_name=tool_name, - auto_approval=auto_approval, + assisted_approval=assisted_approval, hook_message=hook_message, tool_args=tool_args, tool_call_id=tool_call_id, @@ -5199,8 +5232,8 @@ def to_dict(self) -> dict: result: dict = {} result["kind"] = self.kind result["toolName"] = from_str(self.tool_name) - if self.auto_approval is not None: - result["autoApproval"] = from_union([from_none, lambda x: to_class(PermissionAutoApproval, x)], self.auto_approval) + if self.assisted_approval is not None: + result["assistedApproval"] = from_union([from_none, lambda x: to_class(PermissionAssistedApproval, x)], self.assisted_approval) if self.hook_message is not None: result["hookMessage"] = from_union([from_none, from_str], self.hook_message) if self.tool_args is not None: @@ -5219,7 +5252,7 @@ class PermissionPromptRequestMcp: tool_title: str args: Any = None # Experimental: this field is part of an experimental API and may change or be removed. - auto_approval: PermissionAutoApproval | None = None + assisted_approval: PermissionAssistedApproval | None = None # Experimental: this field is part of an experimental API and may change or be removed. permission_recommendation: PermissionRecommendation | None = None tool_call_id: str | None = None @@ -5231,7 +5264,7 @@ def from_dict(obj: Any) -> "PermissionPromptRequestMcp": tool_name = from_str(obj.get("toolName")) tool_title = from_str(obj.get("toolTitle")) args = obj.get("args") - auto_approval = from_union([from_none, PermissionAutoApproval.from_dict], obj.get("autoApproval")) + assisted_approval = from_union([from_none, PermissionAssistedApproval.from_dict], obj.get("assistedApproval")) permission_recommendation = from_union([from_none, lambda x: parse_enum(PermissionRecommendation, x)], obj.get("permissionRecommendation")) tool_call_id = from_union([from_none, from_str], obj.get("toolCallId")) return PermissionPromptRequestMcp( @@ -5239,7 +5272,7 @@ def from_dict(obj: Any) -> "PermissionPromptRequestMcp": tool_name=tool_name, tool_title=tool_title, args=args, - auto_approval=auto_approval, + assisted_approval=assisted_approval, permission_recommendation=permission_recommendation, tool_call_id=tool_call_id, ) @@ -5252,8 +5285,8 @@ def to_dict(self) -> dict: result["toolTitle"] = from_str(self.tool_title) if self.args is not None: result["args"] = self.args - if self.auto_approval is not None: - result["autoApproval"] = from_union([from_none, lambda x: to_class(PermissionAutoApproval, x)], self.auto_approval) + if self.assisted_approval is not None: + result["assistedApproval"] = from_union([from_none, lambda x: to_class(PermissionAssistedApproval, x)], self.assisted_approval) if self.permission_recommendation is not None: result["permissionRecommendation"] = from_union([from_none, lambda x: to_enum(PermissionRecommendation, x)], self.permission_recommendation) if self.tool_call_id is not None: @@ -5268,7 +5301,7 @@ class PermissionPromptRequestMemory: kind: ClassVar[str] = "memory" action: PermissionRequestMemoryAction | None = None # Experimental: this field is part of an experimental API and may change or be removed. - auto_approval: PermissionAutoApproval | None = None + assisted_approval: PermissionAssistedApproval | None = None citations: str | None = None direction: PermissionRequestMemoryDirection | None = None reason: str | None = None @@ -5280,7 +5313,7 @@ def from_dict(obj: Any) -> "PermissionPromptRequestMemory": assert isinstance(obj, dict) fact = from_str(obj.get("fact")) action = from_union([from_none, lambda x: parse_enum(PermissionRequestMemoryAction, x)], obj.get("action")) - auto_approval = from_union([from_none, PermissionAutoApproval.from_dict], obj.get("autoApproval")) + assisted_approval = from_union([from_none, PermissionAssistedApproval.from_dict], obj.get("assistedApproval")) citations = from_union([from_none, from_str], obj.get("citations")) direction = from_union([from_none, lambda x: parse_enum(PermissionRequestMemoryDirection, x)], obj.get("direction")) reason = from_union([from_none, from_str], obj.get("reason")) @@ -5289,7 +5322,7 @@ def from_dict(obj: Any) -> "PermissionPromptRequestMemory": return PermissionPromptRequestMemory( fact=fact, action=action, - auto_approval=auto_approval, + assisted_approval=assisted_approval, citations=citations, direction=direction, reason=reason, @@ -5303,8 +5336,8 @@ def to_dict(self) -> dict: result["kind"] = self.kind if self.action is not None: result["action"] = from_union([from_none, lambda x: to_enum(PermissionRequestMemoryAction, x)], self.action) - if self.auto_approval is not None: - result["autoApproval"] = from_union([from_none, lambda x: to_class(PermissionAutoApproval, x)], self.auto_approval) + if self.assisted_approval is not None: + result["assistedApproval"] = from_union([from_none, lambda x: to_class(PermissionAssistedApproval, x)], self.assisted_approval) if self.citations is not None: result["citations"] = from_union([from_none, from_str], self.citations) if self.direction is not None: @@ -5325,7 +5358,7 @@ class PermissionPromptRequestPath: kind: ClassVar[str] = "path" paths: list[str] # Experimental: this field is part of an experimental API and may change or be removed. - auto_approval: PermissionAutoApproval | None = None + assisted_approval: PermissionAssistedApproval | None = None tool_call_id: str | None = None @staticmethod @@ -5333,12 +5366,12 @@ def from_dict(obj: Any) -> "PermissionPromptRequestPath": assert isinstance(obj, dict) access_kind = parse_enum(PermissionPromptRequestPathAccessKind, obj.get("accessKind")) paths = from_list(from_str, obj.get("paths")) - auto_approval = from_union([from_none, PermissionAutoApproval.from_dict], obj.get("autoApproval")) + assisted_approval = from_union([from_none, PermissionAssistedApproval.from_dict], obj.get("assistedApproval")) tool_call_id = from_union([from_none, from_str], obj.get("toolCallId")) return PermissionPromptRequestPath( access_kind=access_kind, paths=paths, - auto_approval=auto_approval, + assisted_approval=assisted_approval, tool_call_id=tool_call_id, ) @@ -5347,8 +5380,8 @@ def to_dict(self) -> dict: result["accessKind"] = to_enum(PermissionPromptRequestPathAccessKind, self.access_kind) result["kind"] = self.kind result["paths"] = from_list(from_str, self.paths) - if self.auto_approval is not None: - result["autoApproval"] = from_union([from_none, lambda x: to_class(PermissionAutoApproval, x)], self.auto_approval) + if self.assisted_approval is not None: + result["assistedApproval"] = from_union([from_none, lambda x: to_class(PermissionAssistedApproval, x)], self.assisted_approval) if self.tool_call_id is not None: result["toolCallId"] = from_union([from_none, from_str], self.tool_call_id) return result @@ -5361,7 +5394,7 @@ class PermissionPromptRequestRead: kind: ClassVar[str] = "read" path: str # Experimental: this field is part of an experimental API and may change or be removed. - auto_approval: PermissionAutoApproval | None = None + assisted_approval: PermissionAssistedApproval | None = None managed_approval_required: bool | None = None tool_call_id: str | None = None @@ -5370,13 +5403,13 @@ def from_dict(obj: Any) -> "PermissionPromptRequestRead": assert isinstance(obj, dict) intention = from_str(obj.get("intention")) path = from_str(obj.get("path")) - auto_approval = from_union([from_none, PermissionAutoApproval.from_dict], obj.get("autoApproval")) + assisted_approval = from_union([from_none, PermissionAssistedApproval.from_dict], obj.get("assistedApproval")) managed_approval_required = from_union([from_none, from_bool], obj.get("managedApprovalRequired")) tool_call_id = from_union([from_none, from_str], obj.get("toolCallId")) return PermissionPromptRequestRead( intention=intention, path=path, - auto_approval=auto_approval, + assisted_approval=assisted_approval, managed_approval_required=managed_approval_required, tool_call_id=tool_call_id, ) @@ -5386,8 +5419,8 @@ def to_dict(self) -> dict: result["intention"] = from_str(self.intention) result["kind"] = self.kind result["path"] = from_str(self.path) - if self.auto_approval is not None: - result["autoApproval"] = from_union([from_none, lambda x: to_class(PermissionAutoApproval, x)], self.auto_approval) + if self.assisted_approval is not None: + result["assistedApproval"] = from_union([from_none, lambda x: to_class(PermissionAssistedApproval, x)], self.assisted_approval) if self.managed_approval_required is not None: result["managedApprovalRequired"] = from_union([from_none, from_bool], self.managed_approval_required) if self.tool_call_id is not None: @@ -5402,7 +5435,7 @@ class PermissionPromptRequestUrl: kind: ClassVar[str] = "url" url: str # Experimental: this field is part of an experimental API and may change or be removed. - auto_approval: PermissionAutoApproval | None = None + assisted_approval: PermissionAssistedApproval | None = None managed_approval_required: bool | None = None redirected_from: str | None = None request_sandbox_bypass: bool | None = None @@ -5414,7 +5447,7 @@ def from_dict(obj: Any) -> "PermissionPromptRequestUrl": assert isinstance(obj, dict) intention = from_str(obj.get("intention")) url = from_str(obj.get("url")) - auto_approval = from_union([from_none, PermissionAutoApproval.from_dict], obj.get("autoApproval")) + assisted_approval = from_union([from_none, PermissionAssistedApproval.from_dict], obj.get("assistedApproval")) managed_approval_required = from_union([from_none, from_bool], obj.get("managedApprovalRequired")) redirected_from = from_union([from_none, from_str], obj.get("redirectedFrom")) request_sandbox_bypass = from_union([from_none, from_bool], obj.get("requestSandboxBypass")) @@ -5423,7 +5456,7 @@ def from_dict(obj: Any) -> "PermissionPromptRequestUrl": return PermissionPromptRequestUrl( intention=intention, url=url, - auto_approval=auto_approval, + assisted_approval=assisted_approval, managed_approval_required=managed_approval_required, redirected_from=redirected_from, request_sandbox_bypass=request_sandbox_bypass, @@ -5436,8 +5469,8 @@ def to_dict(self) -> dict: result["intention"] = from_str(self.intention) result["kind"] = self.kind result["url"] = from_str(self.url) - if self.auto_approval is not None: - result["autoApproval"] = from_union([from_none, lambda x: to_class(PermissionAutoApproval, x)], self.auto_approval) + if self.assisted_approval is not None: + result["assistedApproval"] = from_union([from_none, lambda x: to_class(PermissionAssistedApproval, x)], self.assisted_approval) if self.managed_approval_required is not None: result["managedApprovalRequired"] = from_union([from_none, from_bool], self.managed_approval_required) if self.redirected_from is not None: @@ -5460,7 +5493,7 @@ class PermissionPromptRequestWrite: intention: str kind: ClassVar[str] = "write" # Experimental: this field is part of an experimental API and may change or be removed. - auto_approval: PermissionAutoApproval | None = None + assisted_approval: PermissionAssistedApproval | None = None managed_approval_required: bool | None = None new_file_contents: str | None = None tool_call_id: str | None = None @@ -5472,7 +5505,7 @@ def from_dict(obj: Any) -> "PermissionPromptRequestWrite": diff = from_str(obj.get("diff")) file_name = from_str(obj.get("fileName")) intention = from_str(obj.get("intention")) - auto_approval = from_union([from_none, PermissionAutoApproval.from_dict], obj.get("autoApproval")) + assisted_approval = from_union([from_none, PermissionAssistedApproval.from_dict], obj.get("assistedApproval")) managed_approval_required = from_union([from_none, from_bool], obj.get("managedApprovalRequired")) new_file_contents = from_union([from_none, from_str], obj.get("newFileContents")) tool_call_id = from_union([from_none, from_str], obj.get("toolCallId")) @@ -5481,7 +5514,7 @@ def from_dict(obj: Any) -> "PermissionPromptRequestWrite": diff=diff, file_name=file_name, intention=intention, - auto_approval=auto_approval, + assisted_approval=assisted_approval, managed_approval_required=managed_approval_required, new_file_contents=new_file_contents, tool_call_id=tool_call_id, @@ -5494,8 +5527,8 @@ def to_dict(self) -> dict: result["fileName"] = from_str(self.file_name) result["intention"] = from_str(self.intention) result["kind"] = self.kind - if self.auto_approval is not None: - result["autoApproval"] = from_union([from_none, lambda x: to_class(PermissionAutoApproval, x)], self.auto_approval) + if self.assisted_approval is not None: + result["assistedApproval"] = from_union([from_none, lambda x: to_class(PermissionAssistedApproval, x)], self.assisted_approval) if self.managed_approval_required is not None: result["managedApprovalRequired"] = from_union([from_none, from_bool], self.managed_approval_required) if self.new_file_contents is not None: @@ -5848,7 +5881,8 @@ class PermissionRequestMemory: fact: str kind: ClassVar[str] = "memory" action: PermissionRequestMemoryAction | None = None - auto_approval: PermissionAutoApproval | None = None + # Experimental: this field is part of an experimental API and may change or be removed. + assisted_approval: PermissionAssistedApproval | None = None citations: str | None = None direction: PermissionRequestMemoryDirection | None = None reason: str | None = None @@ -5863,7 +5897,7 @@ def from_dict(obj: Any) -> "PermissionRequestMemory": assert isinstance(obj, dict) fact = from_str(obj.get("fact")) action = from_union([from_none, lambda x: parse_enum(PermissionRequestMemoryAction, x)], obj.get("action")) - auto_approval = from_union([from_none, PermissionAutoApproval.from_dict], obj.get("autoApproval")) + assisted_approval = from_union([from_none, PermissionAssistedApproval.from_dict], obj.get("assistedApproval")) citations = from_union([from_none, from_str], obj.get("citations")) direction = from_union([from_none, lambda x: parse_enum(PermissionRequestMemoryDirection, x)], obj.get("direction")) reason = from_union([from_none, from_str], obj.get("reason")) @@ -5875,7 +5909,7 @@ def from_dict(obj: Any) -> "PermissionRequestMemory": return PermissionRequestMemory( fact=fact, action=action, - auto_approval=auto_approval, + assisted_approval=assisted_approval, citations=citations, direction=direction, reason=reason, @@ -5892,8 +5926,8 @@ def to_dict(self) -> dict: result["kind"] = self.kind if self.action is not None: result["action"] = from_union([from_none, lambda x: to_enum(PermissionRequestMemoryAction, x)], self.action) - if self.auto_approval is not None: - result["autoApproval"] = from_union([from_none, lambda x: to_class(PermissionAutoApproval, x)], self.auto_approval) + if self.assisted_approval is not None: + result["assistedApproval"] = from_union([from_none, lambda x: to_class(PermissionAssistedApproval, x)], self.assisted_approval) if self.citations is not None: result["citations"] = from_union([from_none, from_str], self.citations) if self.direction is not None: @@ -7335,41 +7369,6 @@ def to_dict(self) -> dict: return result -@dataclass -class SessionPermissionsChangedData: - "Permissions change details carrying the aggregate allow-all transition." - allow_all_permissions: bool - previous_allow_all_permissions: bool - # Experimental: this field is part of an experimental API and may change or be removed. - allow_all_permission_mode: PermissionAllowAllMode | None = None - # Experimental: this field is part of an experimental API and may change or be removed. - previous_allow_all_permission_mode: PermissionAllowAllMode | None = None - - @staticmethod - def from_dict(obj: Any) -> "SessionPermissionsChangedData": - assert isinstance(obj, dict) - allow_all_permissions = from_bool(obj.get("allowAllPermissions")) - previous_allow_all_permissions = from_bool(obj.get("previousAllowAllPermissions")) - allow_all_permission_mode = from_union([from_none, lambda x: parse_enum(PermissionAllowAllMode, x)], obj.get("allowAllPermissionMode")) - previous_allow_all_permission_mode = from_union([from_none, lambda x: parse_enum(PermissionAllowAllMode, x)], obj.get("previousAllowAllPermissionMode")) - return SessionPermissionsChangedData( - allow_all_permissions=allow_all_permissions, - previous_allow_all_permissions=previous_allow_all_permissions, - allow_all_permission_mode=allow_all_permission_mode, - previous_allow_all_permission_mode=previous_allow_all_permission_mode, - ) - - def to_dict(self) -> dict: - result: dict = {} - result["allowAllPermissions"] = from_bool(self.allow_all_permissions) - result["previousAllowAllPermissions"] = from_bool(self.previous_allow_all_permissions) - if self.allow_all_permission_mode is not None: - result["allowAllPermissionMode"] = from_union([from_none, lambda x: to_enum(PermissionAllowAllMode, x)], self.allow_all_permission_mode) - if self.previous_allow_all_permission_mode is not None: - result["previousAllowAllPermissionMode"] = from_union([from_none, lambda x: to_enum(PermissionAllowAllMode, x)], self.previous_allow_all_permission_mode) - return result - - @dataclass class SessionPlanChangedData: "Plan file operation details indicating what changed" @@ -10527,8 +10526,8 @@ def _load_UserToolSessionApproval(obj: Any) -> "UserToolSessionApproval": # Experimental: this enum is part of an experimental API and may change or be removed. -class AutoApprovalJudgeFailureReason(Enum): - "Why the auto-approval judge produced no usable recommendation. Present only alongside an `error` recommendation, where the human-readable reason is a fixed string and therefore cannot distinguish these cases. Intended to make a judge failure reportable by a consumer that has no access to the host's logs." +class AssistedApprovalJudgeFailureReason(Enum): + "Why the assisted-approval judge produced no usable recommendation. Present only alongside an `error` recommendation, where the human-readable reason is a fixed string and therefore cannot distinguish these cases. Intended to make a judge failure reportable by a consumer that has no access to the host's logs." # The judge model call exceeded its deadline. TIMEOUT = "timeout" # The judge model call was cancelled before it returned. @@ -10542,13 +10541,13 @@ class AutoApprovalJudgeFailureReason(Enum): # Experimental: this enum is part of an experimental API and may change or be removed. -class AutoApprovalRecommendation(Enum): - "Outcome of the auto-approval safety judge for a permission request. Present only when auto mode is enabled; its absence means the judge did not evaluate the request (auto mode was off)." +class AssistedApprovalRecommendation(Enum): + "Outcome of the assisted-approval safety judge for a permission request. Present only in assisted mode; its absence means the judge did not evaluate the request." # The judge evaluated the request and recommends automatically approving it. APPROVE = "approve" - # The judge evaluated the request and does not recommend auto-approving it; explicit approval is required. Whether that means prompting, denying, or something else is the consumer's decision. + # The judge evaluated the request and does not recommend automatically approving it; explicit approval is required. Whether that means prompting, denying, or something else is the consumer's decision. REQUIRE_APPROVAL = "requireApproval" - # Auto mode is enabled, but this request category is never auto-approvable (for example, sandbox-bypass requests), so the judge was not consulted. + # Assisted mode is enabled, but this request category is never automatically approvable (for example, sandbox-bypass requests), so the judge was not consulted. EXCLUDED = "excluded" # The judge was consulted but did not return a usable recommendation, so the request requires explicit approval. ERROR = "error" @@ -10566,14 +10565,14 @@ class CitationProvider(Enum): # Experimental: this enum is part of an experimental API and may change or be removed. -class PermissionAllowAllMode(Enum): - "Allow-all mode for the session." +class PermissionMode(Enum): + "Permission mode for the session." # Permission requests follow the normal approval flow. - OFF = "off" + MANUAL = "manual" + # Permission requests include an LLM safety recommendation; clients may automatically approve requests judged acceptable. + ASSISTED = "assisted" # Tool, path, and URL permission requests are automatically approved. - ON = "on" - # Permission requests follow the normal approval flow with an LLM advisory recommendation attached; clients may choose to auto-approve requests the judge evaluated as acceptable. - AUTO = "auto" + ALLOW_ALL = "allow-all" # Experimental: this enum is part of an experimental API and may change or be removed. @@ -10838,12 +10837,12 @@ class ManagedSettingsEnforcedAction(Enum): class ManagedSettingsEnforcedEscalation(Enum): "For a `bypass_permissions_blocked` action, which permission-escalation primitive was refused" - # Full allow-all ("/allow-all on") permissions — auto-approving tools, paths, and URLs. + # Full allow-all permissions — automatically approving tools, paths, and URLs. ALLOW_ALL = "allow_all" - # Auto-approval of all tool permission requests. + # Automatic approval of all tool permission requests. APPROVE_ALL = "approve_all" - # Advisory auto-approval ("/allow-all auto") mode — keeps normal prompt paths and adds LLM-advised approval, distinct from full allow-all. - AUTO_APPROVAL = "auto_approval" + # Assisted mode — keeps normal prompt paths and adds an LLM recommendation, distinct from allow-all. + ASSISTED_APPROVAL = "assisted_approval" # Unrestricted filesystem access outside the session's allowed directories. UNRESTRICTED_PATHS = "unrestricted_paths" # Unrestricted URL fetch access. @@ -11467,6 +11466,8 @@ def session_event_to_dict(x: SessionEvent) -> Any: "AssistantUsageCopilotUsageTokenDetail", "AssistantUsageData", "AssistantUsageTransport", + "AssistedApprovalJudgeFailureReason", + "AssistedApprovalRecommendation", "Attachment", "AttachmentBlob", "AttachmentDirectory", @@ -11490,8 +11491,6 @@ def session_event_to_dict(x: SessionEvent) -> Any: "AttachmentSelectionDetails", "AttachmentSelectionDetailsEnd", "AttachmentSelectionDetailsStart", - "AutoApprovalJudgeFailureReason", - "AutoApprovalRecommendation", "AutoModeResolvedReasoningBucket", "AutoModeSwitchCompletedData", "AutoModeSwitchRequestedData", @@ -11593,11 +11592,10 @@ def session_event_to_dict(x: SessionEvent) -> Any: "OmittedBinaryResult", "OmittedBinaryType", "PendingMessagesModifiedData", - "PermissionAllowAllMode", "PermissionApproved", "PermissionApprovedForLocation", "PermissionApprovedForSession", - "PermissionAutoApproval", + "PermissionAssistedApproval", "PermissionCancelled", "PermissionCompletedData", "PermissionDeniedByContentExclusionPolicy", @@ -11605,6 +11603,7 @@ def session_event_to_dict(x: SessionEvent) -> Any: "PermissionDeniedByRules", "PermissionDeniedInteractivelyByUser", "PermissionDeniedNoApprovalRuleAndCouldNotRequestFromUser", + "PermissionMode", "PermissionPromptRequest", "PermissionPromptRequestCommands", "PermissionPromptRequestCustomTool", diff --git a/python/e2e/test_rpc_session_state_extras_e2e.py b/python/e2e/test_rpc_session_state_extras_e2e.py index 5d0d881a00..7523059c7b 100644 --- a/python/e2e/test_rpc_session_state_extras_e2e.py +++ b/python/e2e/test_rpc_session_state_extras_e2e.py @@ -19,7 +19,7 @@ MetadataContextHeaviestMessagesRequest, ModelSwitchToRequest, NamedProviderConfig, - PermissionsSetAllowAllRequest, + PermissionsSetModeRequest, ProviderAddRequest, ProviderModelConfig, ProviderType, @@ -32,6 +32,7 @@ VisibilitySetRequest, ) from copilot.session import PermissionHandler +from copilot.session_events import PermissionMode from .testharness import E2ETestContext @@ -185,26 +186,26 @@ async def test_should_get_and_set_allowall_permissions(self, ctx: E2ETestContext on_permission_request=PermissionHandler.approve_all, ) as session: try: - initial = await session.rpc.permissions.get_allow_all() - assert initial.enabled is False + initial = await session.rpc.permissions.get_mode() + assert initial.mode is PermissionMode.MANUAL - enable = await session.rpc.permissions.set_allow_all( - PermissionsSetAllowAllRequest(enabled=True) + enable = await session.rpc.permissions.set_mode( + PermissionsSetModeRequest(mode=PermissionMode.ALLOW_ALL) ) assert enable.success is True - assert enable.enabled is True - assert (await session.rpc.permissions.get_allow_all()).enabled is True + assert enable.mode is PermissionMode.ALLOW_ALL + assert (await session.rpc.permissions.get_mode()).mode is PermissionMode.ALLOW_ALL - disable = await session.rpc.permissions.set_allow_all( - PermissionsSetAllowAllRequest(enabled=False) + disable = await session.rpc.permissions.set_mode( + PermissionsSetModeRequest(mode=PermissionMode.MANUAL) ) assert disable.success is True - assert disable.enabled is False - assert (await session.rpc.permissions.get_allow_all()).enabled is False + assert disable.mode is PermissionMode.MANUAL + assert (await session.rpc.permissions.get_mode()).mode is PermissionMode.MANUAL finally: with contextlib.suppress(Exception): - await session.rpc.permissions.set_allow_all( - PermissionsSetAllowAllRequest(enabled=False) + await session.rpc.permissions.set_mode( + PermissionsSetModeRequest(mode=PermissionMode.MANUAL) ) async def test_should_get_context_attribution_and_heaviest_messages_after_turn( diff --git a/python/e2e/test_rpc_ui_ephemeral_query_e2e.py b/python/e2e/test_rpc_ui_ephemeral_query_e2e.py index 46fa853974..34cce42620 100644 --- a/python/e2e/test_rpc_ui_ephemeral_query_e2e.py +++ b/python/e2e/test_rpc_ui_ephemeral_query_e2e.py @@ -18,10 +18,10 @@ class TestRpcUiEphemeralQuery: - # TODO(cli-1.0.81-2): CLI 1.0.81-2 fails session.ui.ephemeralQuery against the recorded - # snapshot ("Failed to get response from the AI model"). Re-enable once the runtime - # fix ships. - @pytest.mark.skip(reason="blocked on CLI 1.0.81-2 session.ui.ephemeralQuery regression") + # TODO(cli-1.0.81-2): CLI 1.0.81-4 still fails session.ui.ephemeralQuery against the + # recorded snapshot ("Failed to get response from the AI model"). Re-enable once the + # runtime fix ships. + @pytest.mark.skip(reason="blocked on CLI 1.0.81-4 session.ui.ephemeralQuery regression") async def test_should_answer_ephemeral_query(self, ctx: E2ETestContext): async with await ctx.client.create_session( on_permission_request=PermissionHandler.approve_all, diff --git a/python/e2e/test_session_e2e.py b/python/e2e/test_session_e2e.py index b6f173f759..08413f228f 100644 --- a/python/e2e/test_session_e2e.py +++ b/python/e2e/test_session_e2e.py @@ -16,6 +16,7 @@ E2ETestContext, get_final_assistant_message, get_next_event_of_type, + wait_for_condition, ) pytestmark = pytest.mark.asyncio(loop_scope="module") @@ -396,19 +397,26 @@ async def test_should_delete_session(self, ctx: E2ETestContext): ) async def test_should_get_session_metadata(self, ctx: E2ETestContext): - import asyncio - # Create a session and send a message to persist it session = await ctx.client.create_session( on_permission_request=PermissionHandler.approve_all ) await session.send_and_wait("Say hello") - # Small delay to ensure session file is written to disk - await asyncio.sleep(0.2) + metadata = None + + async def metadata_is_available() -> bool: + nonlocal metadata + metadata = await ctx.client.get_session_metadata(session.session_id) + return metadata is not None + + await wait_for_condition( + metadata_is_available, + timeout=10.0, + timeout_message="Timed out waiting for session metadata to persist.", + ) # Get metadata for the session we just created - metadata = await ctx.client.get_session_metadata(session.session_id) assert metadata is not None assert metadata.session_id == session.session_id assert isinstance(metadata.start_time, datetime) diff --git a/rust/src/generated/api_types.rs b/rust/src/generated/api_types.rs index 4aebb49edd..2041fa8f2e 100644 --- a/rust/src/generated/api_types.rs +++ b/rust/src/generated/api_types.rs @@ -11,9 +11,9 @@ use serde::{Deserialize, Serialize}; use super::session_events::{ AbortReason, ContextTier, McpOauthHttpResponse, McpOauthWWWAuthenticateParams, McpServerSource, - McpServerStatus, ModelChangeSource, OmittedBinaryOmittedReason, PermissionPromptRequest, - PermissionRule, ReasoningSummary, SessionLimitsConfig, SessionMode, ShutdownType, SkillSource, - TaskCompletionOutcome, UserToolSessionApproval, Verbosity, + McpServerStatus, ModelChangeSource, OmittedBinaryOmittedReason, PermissionMode, + PermissionPromptRequest, PermissionRule, ReasoningSummary, SessionLimitsConfig, SessionMode, + ShutdownType, SkillSource, TaskCompletionOutcome, UserToolSessionApproval, Verbosity, }; use crate::types::{RequestId, SessionEvent, SessionId}; @@ -57,6 +57,8 @@ pub mod rpc_methods { pub const MCP_CONFIG_RELOAD: &str = "mcp.config.reload"; /// `mcp.discover` pub const MCP_DISCOVER: &str = "mcp.discover"; + /// `mcp.planInstall` + pub const MCP_PLANINSTALL: &str = "mcp.planInstall"; /// `extensions.discover` pub const EXTENSIONS_DISCOVER: &str = "extensions.discover"; /// `extensions.enable` @@ -65,6 +67,8 @@ pub mod rpc_methods { pub const EXTENSIONS_DISABLE: &str = "extensions.disable"; /// `registerExtensionLaunchProvider` pub const REGISTEREXTENSIONLAUNCHPROVIDER: &str = "registerExtensionLaunchProvider"; + /// `catalog.search` + pub const CATALOG_SEARCH: &str = "catalog.search"; /// `plugins.list` pub const PLUGINS_LIST: &str = "plugins.list"; /// `plugins.install` @@ -400,6 +404,8 @@ pub mod rpc_methods { pub const SESSION_MCP_DISABLE: &str = "session.mcp.disable"; /// `session.mcp.reload` pub const SESSION_MCP_RELOAD: &str = "session.mcp.reload"; + /// `session.mcp.moveLoadingToBackground` + pub const SESSION_MCP_MOVELOADINGTOBACKGROUND: &str = "session.mcp.moveLoadingToBackground"; /// `session.mcp.reloadWithConfig` pub const SESSION_MCP_RELOADWITHCONFIG: &str = "session.mcp.reloadWithConfig"; /// `session.mcp.executeSampling` @@ -549,10 +555,10 @@ pub mod rpc_methods { pub const SESSION_PERMISSIONS_PENDINGREQUESTS: &str = "session.permissions.pendingRequests"; /// `session.permissions.setApproveAll` pub const SESSION_PERMISSIONS_SETAPPROVEALL: &str = "session.permissions.setApproveAll"; - /// `session.permissions.setAllowAll` - pub const SESSION_PERMISSIONS_SETALLOWALL: &str = "session.permissions.setAllowAll"; - /// `session.permissions.getAllowAll` - pub const SESSION_PERMISSIONS_GETALLOWALL: &str = "session.permissions.getAllowAll"; + /// `session.permissions.setMode` + pub const SESSION_PERMISSIONS_SETMODE: &str = "session.permissions.setMode"; + /// `session.permissions.getMode` + pub const SESSION_PERMISSIONS_GETMODE: &str = "session.permissions.getMode"; /// `session.permissions.modifyRules` pub const SESSION_PERMISSIONS_MODIFYRULES: &str = "session.permissions.modifyRules"; /// `session.permissions.setRequired` @@ -1905,44 +1911,6 @@ pub struct AgentsGetDiscoveryPathsRequest { pub project_paths: Option>, } -/// Indicates whether the operation succeeded and reports the post-mutation state. -/// -///

-/// -/// **Experimental.** This type is part of an experimental wire-protocol surface -/// and may change or be removed in future SDK or CLI releases. -/// -///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct AllowAllPermissionSetResult { - /// Authoritative full allow-all state after the mutation - pub enabled: bool, - /// Authoritative allow-all mode after the mutation - #[serde(skip_serializing_if = "Option::is_none")] - pub mode: Option, - /// Whether the operation succeeded - pub success: bool, -} - -/// Current allow-all permission mode. -/// -///
-/// -/// **Experimental.** This type is part of an experimental wire-protocol surface -/// and may change or be removed in future SDK or CLI releases. -/// -///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct AllowAllPermissionState { - /// Whether full allow-all permissions are currently active - pub enabled: bool, - /// Current allow-all mode - #[serde(skip_serializing_if = "Option::is_none")] - pub mode: Option, -} - /// Blob attachment with inline base64-encoded data /// ///
@@ -3023,7 +2991,7 @@ pub struct CapiSessionOptions { pub enable_web_socket_responses: Option, } -/// A literal choice the command input accepts, with a human-facing description +/// 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. /// ///
/// @@ -3033,14 +3001,14 @@ pub struct CapiSessionOptions { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SlashCommandInputChoice { - /// Human-readable description shown alongside the choice - pub description: String, - /// The literal choice value (e.g. 'on', 'off', 'show') - pub name: String, +pub struct CardDigest { + /// Digest algorithm and canonical representation + pub algorithm: CardDigestAlgorithm, + /// SHA-256 digest of the RFC 8785 canonical UTF-8 bytes, encoded as exactly 64 lowercase hexadecimal characters. + pub value: String, } -/// Optional unstructured input hint +/// 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. /// ///
/// @@ -3050,24 +3018,16 @@ pub struct SlashCommandInputChoice { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SlashCommandInput { - /// Optional literal choices the input accepts, each with a human-facing description; clients may render these as selectable options - #[serde(skip_serializing_if = "Option::is_none")] - pub choices: Option>, - /// Optional completion hint for the input (e.g. 'directory' for filesystem path completion) - #[serde(skip_serializing_if = "Option::is_none")] - pub completion: Option, - /// Hint to display when command input has not been provided - pub hint: String, - /// When true, clients should pass the full text after the command name as a single argument rather than splitting on whitespace - #[serde(skip_serializing_if = "Option::is_none")] - pub preserve_multiline_input: Option, - /// When true, the command requires non-empty input; clients should render the input hint as required - #[serde(skip_serializing_if = "Option::is_none")] - pub required: Option, +pub struct CatalogAiSkillCandidateProvenance { + /// Host of the catalog authority that advertised the reference, without path, query, or credentials. Inert untrusted data. + pub authority: String, + /// Media type advertised for the referenced AI skill card + pub media_type: CatalogAiSkillCandidateProvenanceMediaType, + /// ISO 8601 timestamp at which the runtime observed the catalog reference. This is not a retrieval or validation timestamp. + pub observed_at: String, } -/// Slash-command metadata with name, aliases, description, kind, input hint, execution allowance, and schedulability. +/// Candidate whose card is retrieved from a URL through the runtime's hardened fetch boundary. /// ///
/// @@ -3077,30 +3037,14 @@ pub struct SlashCommandInput { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SlashCommandInfo { - /// Canonical aliases without leading slashes - #[serde(skip_serializing_if = "Option::is_none")] - pub aliases: Option>, - /// Whether the command may run while an agent turn is active - pub allow_during_agent_execution: bool, - /// Human-readable command description - pub description: String, - /// Whether the command is experimental - #[serde(skip_serializing_if = "Option::is_none")] - pub experimental: Option, - /// Optional unstructured input hint - #[serde(skip_serializing_if = "Option::is_none")] - pub input: Option, - /// Coarse command category for grouping and behavior: runtime built-in, skill-backed command, or SDK/client-owned command - pub kind: SlashCommandKind, - /// Canonical command name without a leading slash - pub name: String, - /// 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. - #[serde(skip_serializing_if = "Option::is_none")] - pub schedulable: Option, +pub struct CatalogCandidateSourceUrl { + /// Discriminator: the card is URL-backed, and carries no embedded data + pub kind: CatalogCandidateSourceUrlKind, + /// Card URL as advertised. Inert untrusted data: the runtime retrieves it only through its own hardened boundary, and it is never logged. + pub url: String, } -/// Slash commands available in the session, after applying any include/exclude filters. +/// Candidate whose card reference arrived inline. The document and its content-derived properties stay behind the runtime boundary. /// ///
/// @@ -3110,12 +3054,12 @@ pub struct SlashCommandInfo { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct CommandList { - /// Commands available in this session - pub commands: Vec, +pub struct CatalogCandidateSourceEmbedded { + /// Discriminator: the card is embedded, and carries no URL + pub kind: CatalogCandidateSourceEmbeddedKind, } -/// The pending slash-command invocation effect to finalize, plus whether the host applied or cancelled it. +/// An inert AI skill catalog result. AI skills are discovery-only and cannot be represented as installable through this surface. /// ///
/// @@ -3123,16 +3067,34 @@ pub struct CommandList { /// and may change or be removed in future SDK or CLI releases. /// ///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct CommandsFinalizeInvocationEffectRequest { - /// The slash-command result object that produced the pending effect, echoed back unchanged. - pub effect: serde_json::Value, - /// Whether the host applied or cancelled the pending invocation effect. - pub outcome: CommandsInvocationEffectOutcome, +pub struct CatalogAiSkillCandidate { + /// Description taken verbatim from the card. Inert untrusted text. + #[serde(skip_serializing_if = "Option::is_none")] + pub description: Option, + /// Display name taken verbatim from the card. Inert untrusted text. + pub display_name: String, + /// 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. + pub handle: String, + /// ISO 8601 timestamp after which the handle is stale and will be rejected. + pub handle_expires_at: String, + /// AI skills are discovery-only and cannot be installed through this surface + pub installability: CatalogAiSkillCandidateInstallability, + /// Discriminator: this candidate describes an AI skill + pub kind: CatalogAiSkillCandidateKind, + /// Media type of the underlying AI skill card + pub media_type: CatalogAiSkillCandidateMediaType, + /// Where the catalog reference was observed, without the card itself or any content digest. + pub provenance: CatalogAiSkillCandidateProvenance, + /// Publisher taken verbatim from the card. Inert untrusted text. + #[serde(skip_serializing_if = "Option::is_none")] + pub publisher: Option, + /// 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. + pub source: CatalogCandidateSource, } -/// Whether finalizing the invocation effect succeeded, and the failure reason when it did not. +/// 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. /// ///
/// @@ -3142,15 +3104,16 @@ pub struct CommandsFinalizeInvocationEffectRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct CommandsFinalizeInvocationEffectResult { - /// Failure reason when the invocation effect could not be finalized. - #[serde(skip_serializing_if = "Option::is_none")] - pub error: Option, - /// Whether the pending invocation effect was finalized successfully. - pub success: bool, +pub struct CatalogAuthenticationRequiredError { + /// Discriminator: the caller is not authenticated + pub kind: CatalogAuthenticationRequiredErrorKind, + /// Human-readable explanation, safe to surface. Never contains a credential or token, nor a query, URL, handle, or secret. + pub message: String, + /// Why authentication failed. Only an expired credential justifies attempting a silent refresh; an absent or rejected credential requires sign-in. + pub reason: CatalogAuthenticationRequiredReason, } -/// Pending command request ID and an optional error if the client handler failed. +/// 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. /// ///
/// @@ -3160,15 +3123,16 @@ pub struct CommandsFinalizeInvocationEffectResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct CommandsHandlePendingCommandRequest { - /// Error message if the command handler failed - #[serde(skip_serializing_if = "Option::is_none")] - pub error: Option, - /// Request ID from the command invocation event - pub request_id: RequestId, +pub struct CatalogMcpServerCandidateProvenance { + /// Host of the catalog authority that advertised the reference, without path, query, or credentials. Inert untrusted data. + pub authority: String, + /// JSON MCP media type advertised for the referenced card. + pub media_type: McpServerCardMediaType, + /// ISO 8601 timestamp at which the runtime observed the catalog reference. This is not a retrieval or validation timestamp. + pub observed_at: String, } -/// Indicates whether the pending client-handled command was completed successfully. +/// 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. /// ///
/// @@ -3176,14 +3140,34 @@ pub struct CommandsHandlePendingCommandRequest { /// and may change or be removed in future SDK or CLI releases. /// ///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct CommandsHandlePendingCommandResult { - /// Whether the command was handled successfully - pub success: bool, +pub struct CatalogMcpServerCandidate { + /// Description taken verbatim from the card. Inert untrusted text. + #[serde(skip_serializing_if = "Option::is_none")] + pub description: Option, + /// Display name taken verbatim from the card. Inert untrusted text. + pub display_name: String, + /// 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. + pub handle: String, + /// ISO 8601 timestamp after which the handle is stale and will be rejected. + pub handle_expires_at: String, + /// Whether this MCP server can be planned for installation, and if policy prevents it. + pub installability: CatalogMcpServerInstallability, + /// Discriminator: this candidate describes an MCP server + pub kind: CatalogMcpServerCandidateKind, + /// JSON MCP media type of the underlying card. + pub media_type: McpServerCardMediaType, + /// Where the catalog reference was observed, without the card itself or any content digest. + pub provenance: CatalogMcpServerCandidateProvenance, + /// Publisher taken verbatim from the card. Inert untrusted text. + #[serde(skip_serializing_if = "Option::is_none")] + pub publisher: Option, + /// 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. + pub source: CatalogCandidateSource, } -/// Slash command name and optional raw input string to invoke. +/// The protocol version and capability set a caller requires, supplied on every catalog request so negotiation cannot be skipped by omission. /// ///
/// @@ -3193,18 +3177,14 @@ pub struct CommandsHandlePendingCommandResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct CommandsInvokeRequest { - /// Raw input after the command name - #[serde(skip_serializing_if = "Option::is_none")] - pub input: Option, - /// Command name. Leading slashes are stripped and the name is matched case-insensitively. - pub name: String, - /// Optional client surface that initiated the invocation - #[serde(skip_serializing_if = "Option::is_none")] - pub origin: Option, +pub struct 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. + pub protocol_version: i64, + /// 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. + pub required_capabilities: Vec, } -/// Optional filters controlling which command sources to include in the listing. +/// 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. /// ///
/// @@ -3214,19 +3194,16 @@ pub struct CommandsInvokeRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct CommandsListRequest { - /// Include runtime built-in commands - #[serde(skip_serializing_if = "Option::is_none")] - pub include_builtins: Option, - /// Include commands registered by protocol clients, including SDK clients and extensions - #[serde(skip_serializing_if = "Option::is_none")] - pub include_client_commands: Option, - /// Include enabled user-invocable skills and commands - #[serde(skip_serializing_if = "Option::is_none")] - pub include_skills: Option, +pub struct CatalogContractViolationError { + /// Discriminator: the upstream response broke the contract + pub kind: CatalogContractViolationErrorKind, + /// Human-readable explanation, safe to surface. Never echoes response content, nor a query, URL, handle, or secret. + pub message: String, + /// Which rule the response broke. + pub reason: CatalogContractViolationReason, } -/// Queued-command request ID and the result indicating whether the host executed it (and whether to stop processing further queued commands). +/// A presented handle was not accepted. Handles are runtime-instance scoped, TTL-bound, and single-use, so each way of failing is reported distinctly. /// ///
/// @@ -3236,14 +3213,18 @@ pub struct CommandsListRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct CommandsRespondToQueuedCommandRequest { - /// Request ID from the `command.queued` event the host is responding to. - pub request_id: RequestId, - /// Result of the queued command execution. - pub result: serde_json::Value, +pub struct CatalogHandleRejectedError { + /// Which kind of handle was presented. + pub handle_type: CatalogHandleType, + /// Discriminator: a handle was rejected + pub kind: CatalogHandleRejectedErrorKind, + /// Human-readable explanation, safe to surface. Never contains the handle itself, nor a query, URL, or secret. + pub message: String, + /// Why the handle was rejected. + pub reason: CatalogHandleRejectionReason, } -/// Indicates whether the queued-command response was matched to a pending request. +/// The request was rejected before any work was done, because a bounded field fell outside its permitted range or a required field was unusable. /// ///
/// @@ -3253,12 +3234,16 @@ pub struct CommandsRespondToQueuedCommandRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct 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. - pub success: bool, +pub struct CatalogInvalidRequestError { + /// Which request field was rejected. + pub field: CatalogInvalidRequestField, + /// Discriminator: the request itself was invalid + pub kind: CatalogInvalidRequestErrorKind, + /// Human-readable explanation, safe to surface. Never echoes the offending value, nor a query, URL, handle, or secret. + pub message: String, } -/// 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`). +/// A card could not be parsed or did not satisfy its declared media type's schema. /// ///
/// @@ -3268,12 +3253,19 @@ pub struct CommandsRespondToQueuedCommandResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct CompletionsGetTriggerCharactersResult { - /// Trigger characters advertised by the host (e.g. `["@", "#"]`). Empty disables host-driven completions for the session. - pub trigger_characters: Vec, +pub struct CatalogMalformedCardError { + /// Discriminator: the card was malformed + pub kind: CatalogMalformedCardErrorKind, + /// Media type the card was interpreted as, when it declared one this runtime recognises. + #[serde(skip_serializing_if = "Option::is_none")] + pub media_type: Option, + /// Human-readable explanation, safe to surface. Never echoes card content, nor a query, URL, handle, or secret. + pub message: String, + /// How the card failed validation. + pub reason: CatalogMalformedCardReason, } -/// Request host-driven completions for the current composer input. +/// The protocol version and capability set the runtime actually honoured for a successful catalog operation. /// ///
/// @@ -3283,14 +3275,14 @@ pub struct CompletionsGetTriggerCharactersResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct CompletionsRequestRequest { - /// Cursor offset within `text`, in UTF-16 code units. - pub offset: i64, - /// The full composed composer input. - pub text: String, +pub struct 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. + pub granted_capabilities: Vec, + /// Protocol version of the runtime that served the request. + pub runtime_protocol_version: i64, } -/// 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. +/// The caller's protocol version or required capabilities cannot be honoured. Returned instead of a partial or ambiguous success. /// ///
/// @@ -3300,24 +3292,24 @@ pub struct CompletionsRequestRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionCompletionItem { - /// Text spliced into the composer when the item is accepted. - pub insert_text: String, - /// Render-kind hint for the picker row (e.g. `"document"`, `"directory"`), derived from the host's display kind. - #[serde(skip_serializing_if = "Option::is_none")] - pub kind: Option, - /// Primary display label for the picker row. Falls back to `insertText` when absent. - #[serde(skip_serializing_if = "Option::is_none")] - pub label: Option, - /// End (exclusive) of the replacement range in `text`, in UTF-16 code units. - #[serde(skip_serializing_if = "Option::is_none")] - pub range_end: Option, - /// Start of the replacement range in `text`, in UTF-16 code units. - #[serde(skip_serializing_if = "Option::is_none")] - pub range_start: Option, +pub struct CatalogNegotiationRefusedError { + /// Discriminator: capability or protocol-version negotiation failed + pub kind: CatalogNegotiationRefusedErrorKind, + /// Human-readable explanation, safe to surface. Never contains a query, URL, handle, or secret. + pub message: String, + /// Lowest caller protocol version this runtime will serve. + pub minimum_supported_protocol_version: i64, + /// Whether the version or the capability set was the problem. + pub reason: CatalogNegotiationRefusedReason, + /// Protocol version of the runtime that refused the request. + pub runtime_protocol_version: i64, + /// 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. + pub supported_capabilities: Vec, + /// The subset of the caller's bounded extensible capability identifiers this runtime cannot honour. + pub unsupported_capabilities: Vec, } -/// Host-driven completion items for the current composer input. Empty when the host returns no items or does not support completions. +/// The runtime could not reach the catalog authority or retrieve a card. Covers being offline as well as transport-level failure. /// ///
/// @@ -3327,12 +3319,19 @@ pub struct SessionCompletionItem { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct CompletionsRequestResult { - /// Completion items in host-ranked order. - pub items: Vec, +pub struct CatalogNetworkFailureError { + /// Discriminator: the network operation failed + pub kind: CatalogNetworkFailureErrorKind, + /// Human-readable explanation, safe to surface. Never contains a query, URL, handle, or secret. + pub message: String, + /// Categorised failure, low cardinality so it can be aggregated without carrying a URL. + pub reason: CatalogNetworkFailureReason, + /// HTTP status code, when the failure was a rejected response. + #[serde(skip_serializing_if = "Option::is_none")] + pub status_code: Option, } -/// Params to attach or detach an in-process ExtensionController delegate. +/// The candidate is discoverable but cannot be installed. `application/ai-skill` resolves here, because it stays searchable while remaining typed non-installable. /// ///
/// @@ -3342,16 +3341,16 @@ pub struct CompletionsRequestResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub(crate) struct ConfigureSessionExtensionsParams { - /// In-process ExtensionController delegate (CLI-only optimization). Marked internal: this field is excluded from the public SDK surface. The post-SDK extension surface exposes list/enable/disable/reload via dedicated RPCs served by the runtime. - #[doc(hidden)] - #[serde(skip_serializing_if = "Option::is_none")] - pub(crate) controller: Option, - /// Session to attach the extension controller delegate to. - pub session_id: SessionId, +pub struct CatalogNotInstallableError { + /// Discriminator: the candidate cannot be installed + pub kind: CatalogNotInstallableErrorKind, + /// Human-readable explanation, safe to surface. Never contains a query, URL, handle, or secret. + pub message: String, + /// Why the candidate cannot be installed. + pub reason: CatalogNotInstallableReason, } -/// Repository associated with the connected remote session. +/// Registry or enterprise policy refused the operation. /// ///
/// @@ -3361,16 +3360,16 @@ pub(crate) struct ConfigureSessionExtensionsParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ConnectedRemoteSessionMetadataRepository { - /// Branch associated with the remote session. - pub branch: String, - /// Repository name. - pub name: String, - /// Repository owner or organization login. - pub owner: String, +pub struct CatalogPolicyRejectedError { + /// Discriminator: policy refused the operation + pub kind: CatalogPolicyRejectedErrorKind, + /// Human-readable explanation, safe to surface. Never contains a query, URL, handle, or secret. + pub message: String, + /// Which authority produced the decision. + pub source: McpPlanPolicySource, } -/// Metadata for a connected remote session. +/// 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. /// ///
/// @@ -3380,38 +3379,20 @@ pub struct ConnectedRemoteSessionMetadataRepository { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ConnectedRemoteSessionMetadata { - /// Neutral SDK discriminator for the connected remote session kind. - pub kind: ConnectedRemoteSessionMetadataKind, - /// Last session update time as an ISO 8601 string. - pub modified_time: String, - /// Optional friendly session name. - #[serde(skip_serializing_if = "Option::is_none")] - pub name: Option, - /// Pull request number associated with the session. - #[serde(skip_serializing_if = "Option::is_none")] - pub pull_request_number: Option, - /// Repository associated with the connected remote session. - pub repository: ConnectedRemoteSessionMetadataRepository, - /// Original remote resource identifier. - #[serde(skip_serializing_if = "Option::is_none")] - pub resource_id: Option, - /// SDK session ID for the connected remote session. - pub session_id: SessionId, - /// Remote session staleness deadline as an ISO 8601 string. +pub struct CatalogSearchRequest { + /// Protocol version and capabilities the caller requires. + pub contract: CatalogClientContract, + /// Restrict results to these candidate kinds. When omitted, every kind the runtime supports is searched. #[serde(skip_serializing_if = "Option::is_none")] - pub stale_at: Option, - /// Session start time as an ISO 8601 string. - pub start_time: String, - /// Remote session state returned by the backing service. + pub kinds: Option>, + /// Maximum number of candidates to return. Defaults to 10 when omitted. #[serde(skip_serializing_if = "Option::is_none")] - pub state: Option, - /// Optional session summary. - #[serde(skip_serializing_if = "Option::is_none")] - pub summary: Option, + pub limit: Option, + /// Free-text search query. Never written to logs or telemetry. + pub query: String, } -/// Remote session connection parameters. +/// A completed catalog search: inert candidate summaries, each carrying a single-use handle. /// ///
/// @@ -3421,12 +3402,20 @@ pub struct ConnectedRemoteSessionMetadata { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ConnectRemoteSessionParams { - /// Session ID to connect to. - pub session_id: SessionId, +pub struct CatalogSearchSucceeded { + /// Matching candidates, never more than the requested limit. All text is inert untrusted data. + pub candidates: Vec, + /// Discriminator: the search completed + pub kind: CatalogSearchSucceededKind, + /// Protocol version and capabilities the runtime honoured. + pub negotiated: CatalogNegotiatedContract, + /// 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. + pub search_id: String, + /// Whether further matches existed beyond the requested limit. + pub truncated: bool, } -/// Connection-level opt-ins for the `server.connect` handshake. Transport authentication is consumed by the native protocol boundary before dispatch. +/// The request asked for a candidate kind this runtime does not serve. /// ///
/// @@ -3436,16 +3425,18 @@ pub struct ConnectRemoteSessionParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub(crate) struct ConnectRequest { - /// 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. - #[serde(skip_serializing_if = "Option::is_none")] - pub enable_git_hub_telemetry_forwarding: Option, - /// Connection token; required when the server was started with COPILOT_CONNECTION_TOKEN - #[serde(skip_serializing_if = "Option::is_none")] - pub token: Option, +pub struct CatalogUnsupportedKindError { + /// Discriminator: an unsupported candidate kind was requested + pub kind: CatalogUnsupportedKindErrorKind, + /// Human-readable explanation, safe to surface. Never contains a query, URL, handle, or secret. + pub message: String, + /// The kinds from the request that are not supported. + pub requested_kinds: Vec, + /// Every candidate kind this runtime can serve. + pub supported_kinds: Vec, } -/// Handshake result reporting the server's protocol version and package version on success. +/// Retrieval was refused by the runtime's hardened fetch boundary before any request left the process, or before a redirect was followed. /// ///
/// @@ -3455,16 +3446,16 @@ pub(crate) struct ConnectRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub(crate) struct ConnectResult { - /// Always true on success - pub ok: bool, - /// Server protocol version number - pub protocol_version: i64, - /// Server package version - pub version: String, +pub struct CatalogUnsafeRetrievalError { + /// Discriminator: retrieval was refused as unsafe + pub kind: CatalogUnsafeRetrievalErrorKind, + /// Human-readable explanation, safe to surface. Never contains the refused URL, nor a query, handle, or secret. + pub message: String, + /// Which control refused the retrieval, low cardinality so it can be aggregated without carrying a URL. + pub reason: CatalogUnsafeRetrievalReason, } -/// Local file system absolute paths within the session working directory to check against its content-exclusion policy. +/// The operation is not available on this runtime. Distinct from a network failure: nothing was attempted. /// ///
/// @@ -3474,12 +3465,16 @@ pub(crate) struct ConnectResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ContentExclusionCheckPathsRequest { - /// Local file system absolute paths within the session working directory to check. Results are returned in the same order, including duplicates. - pub paths: Vec, +pub struct CatalogUnavailableError { + /// Discriminator: the operation is not available + pub kind: CatalogUnavailableErrorKind, + /// Human-readable explanation, safe to surface. Never contains a query, URL, handle, or secret. + pub message: String, + /// Why the operation is unavailable. + pub reason: CatalogUnavailableReason, } -/// Content-exclusion decision for one requested path. +/// No transport this runtime can use is available for the requested server. /// ///
/// @@ -3489,14 +3484,16 @@ pub struct ContentExclusionCheckPathsRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ContentExclusionPathCheck { - /// Whether the session's complete content-exclusion policy excludes the path. - pub excluded: bool, - /// The path supplied by the caller. - pub path: String, +pub struct CatalogUnavailableTransportError { + /// Discriminator: no usable transport is available + pub kind: CatalogUnavailableTransportErrorKind, + /// Human-readable explanation, safe to surface. Never contains a query, URL, handle, or secret. + pub message: String, + /// Why no transport could be offered. + pub reason: CatalogUnavailableTransportReason, } -/// Batch content-exclusion result. Callers must fail closed when policy evaluation is unavailable. +/// A literal choice the command input accepts, with a human-facing description /// ///
/// @@ -3506,14 +3503,14 @@ pub struct ContentExclusionPathCheck { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ContentExclusionCheckPathsResult { - /// Whether the session's policy service was available for the complete batch. When false, checks is empty and callers must treat every requested path as excluded. - pub available: bool, - /// Per-path decisions in request order. Empty when available is false. - pub checks: Vec, +pub struct SlashCommandInputChoice { + /// Human-readable description shown alongside the choice + pub description: String, + /// The literal choice value (e.g. 'on', 'off', 'show') + pub name: String, } -/// A single large message currently in context. +/// Optional unstructured input hint /// ///
/// @@ -3523,18 +3520,24 @@ pub struct ContentExclusionCheckPathsResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ContextHeaviestMessage { - /// Stable identifier for this message within the snapshot. - pub id: String, - /// Human-readable source label, e.g. `tool: bash` or `skill: tmux`. Presentation-only. - pub label: String, - /// Role of the chat message (`user`, `assistant`, or `tool`). - pub role: String, - /// Token count currently in context for this individual message. - pub tokens: i64, +pub struct SlashCommandInput { + /// Optional literal choices the input accepts, each with a human-facing description; clients may render these as selectable options + #[serde(skip_serializing_if = "Option::is_none")] + pub choices: Option>, + /// Optional completion hint for the input (e.g. 'directory' for filesystem path completion) + #[serde(skip_serializing_if = "Option::is_none")] + pub completion: Option, + /// Hint to display when command input has not been provided + pub hint: String, + /// When true, clients should pass the full text after the command name as a single argument rather than splitting on whitespace + #[serde(skip_serializing_if = "Option::is_none")] + pub preserve_multiline_input: Option, + /// When true, the command requires non-empty input; clients should render the input hint as required + #[serde(skip_serializing_if = "Option::is_none")] + pub required: Option, } -/// The currently selected model, reasoning effort, and context tier for the session. The context tier reflects `Session.getContextTier()`, restored from the session journal on resume. +/// Slash-command metadata with name, aliases, description, kind, input hint, execution allowance, and schedulability. /// ///
/// @@ -3544,19 +3547,30 @@ pub struct ContextHeaviestMessage { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct CurrentModel { - /// Context tier for models that support multiple context-window sizes. +pub struct SlashCommandInfo { + /// Canonical aliases without leading slashes #[serde(skip_serializing_if = "Option::is_none")] - pub context_tier: Option, - /// Currently active model identifier + pub aliases: Option>, + /// Whether the command may run while an agent turn is active + pub allow_during_agent_execution: bool, + /// Human-readable command description + pub description: String, + /// Whether the command is experimental #[serde(skip_serializing_if = "Option::is_none")] - pub model_id: Option, - /// 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. + pub experimental: Option, + /// Optional unstructured input hint #[serde(skip_serializing_if = "Option::is_none")] - pub reasoning_effort: Option, + pub input: Option, + /// Coarse command category for grouping and behavior: runtime built-in, skill-backed command, or SDK/client-owned command + pub kind: SlashCommandKind, + /// Canonical command name without a leading slash + pub name: String, + /// 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. + #[serde(skip_serializing_if = "Option::is_none")] + pub schedulable: Option, } -/// Lightweight metadata for a currently initialized session tool +/// Slash commands available in the session, after applying any include/exclude filters. /// ///
/// @@ -3566,29 +3580,12 @@ pub struct CurrentModel { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct CurrentToolMetadata { - /// Whether the tool is loaded on demand via tool search - #[serde(skip_serializing_if = "Option::is_none")] - pub defer_loading: Option, - /// Tool description - pub description: String, - /// JSON Schema for tool input - #[serde(rename = "input_schema", skip_serializing_if = "Option::is_none")] - pub input_schema: Option>, - /// MCP server name for MCP-backed tools - #[serde(skip_serializing_if = "Option::is_none")] - pub mcp_server_name: Option, - /// Raw MCP tool name for MCP-backed tools - #[serde(skip_serializing_if = "Option::is_none")] - pub mcp_tool_name: Option, - /// Model-facing tool name - pub name: String, - /// Optional MCP/config namespaced tool name - #[serde(skip_serializing_if = "Option::is_none")] - pub namespaced_name: Option, +pub struct CommandList { + /// Commands available in this session + pub commands: Vec, } -/// A file included in the redacted debug bundle. +/// The pending slash-command invocation effect to finalize, plus whether the host applied or cancelled it. /// ///
/// @@ -3598,37 +3595,32 @@ pub struct CurrentToolMetadata { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct DebugCollectLogsCollectedEntry { - /// Relative path of the file in the staged bundle/archive. - pub bundle_path: String, - /// Redacted output size in bytes. - pub size_bytes: i64, - /// Source category for this entry. - pub source: DebugCollectLogsSource, +pub struct CommandsFinalizeInvocationEffectRequest { + /// The slash-command result object that produced the pending effect, echoed back unchanged. + pub effect: serde_json::Value, + /// Whether the host applied or cancelled the pending invocation effect. + pub outcome: CommandsInvocationEffectOutcome, } +/// Whether finalizing the invocation effect succeeded, and the failure reason when it did not. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct DebugCollectLogsDestinationArchive { - /// Destination variant discriminator. - pub kind: DebugCollectLogsDestinationArchiveKind, - /// When true, create the archive atomically without overwriting an existing file by appending ` (N)` before the extension as needed. Defaults to false. +pub struct CommandsFinalizeInvocationEffectResult { + /// Failure reason when the invocation effect could not be finalized. #[serde(skip_serializing_if = "Option::is_none")] - pub no_overwrite: Option, - /// Absolute or server-relative path for the .tgz archive to create. - pub output_path: String, -} - -#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct DebugCollectLogsDestinationDirectory { - /// Destination variant discriminator. - pub kind: DebugCollectLogsDestinationDirectoryKind, - /// Directory where redacted files should be staged. The directory is created if needed. - pub output_directory: String, + pub error: Option, + /// Whether the pending invocation effect was finalized successfully. + pub success: bool, } -/// A caller-provided server-local file or directory to include in the debug bundle. +/// Pending command request ID and an optional error if the client handler failed. /// ///
/// @@ -3638,22 +3630,15 @@ pub struct DebugCollectLogsDestinationDirectory { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct DebugCollectLogsEntry { - /// Relative path to use inside the staged bundle/archive. - pub bundle_path: String, - /// Kind of source path to include. - pub kind: DebugCollectLogsEntryKind, - /// Server-local source path to read. - pub path: String, - /// How text content from this entry should be redacted. Defaults to plain-text. - #[serde(skip_serializing_if = "Option::is_none")] - pub redaction: Option, - /// When true, collection fails if this entry cannot be read. Defaults to false, which records the entry in `skippedEntries`. +pub struct CommandsHandlePendingCommandRequest { + /// Error message if the command handler failed #[serde(skip_serializing_if = "Option::is_none")] - pub required: Option, + pub error: Option, + /// Request ID from the command invocation event + pub request_id: RequestId, } -/// Built-in session diagnostics to include in the bundle. Omitted fields default to true. +/// Indicates whether the pending client-handled command was completed successfully. /// ///
/// @@ -3663,31 +3648,12 @@ pub struct DebugCollectLogsEntry { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct 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. - #[serde(skip_serializing_if = "Option::is_none")] - pub current_process_log_path: Option, - /// Include the session event log (`events.jsonl`). Defaults to true. - #[serde(skip_serializing_if = "Option::is_none")] - pub events: Option, - /// Server-local path to the session's events.jsonl file. Internal callers normally omit this and let the runtime derive it from the session. - #[serde(skip_serializing_if = "Option::is_none")] - pub events_path: Option, - /// Maximum number of previous process logs to include. Defaults to 5. - #[serde(skip_serializing_if = "Option::is_none")] - pub previous_process_log_limit: Option, - /// Server-local process log directory to search when `currentProcessLogPath` is unavailable, useful for collecting logs for inactive sessions. - #[serde(skip_serializing_if = "Option::is_none")] - pub process_log_directory: Option, - /// Include process logs for the session. Defaults to true. - #[serde(skip_serializing_if = "Option::is_none")] - pub process_logs: Option, - /// Include interactive shell logs written under the session's `shell-logs` directory. Defaults to true. - #[serde(skip_serializing_if = "Option::is_none")] - pub shell_logs: Option, +pub struct CommandsHandlePendingCommandResult { + /// Whether the command was handled successfully + pub success: bool, } -/// Options for collecting a redacted session debug bundle. +/// Slash command name and optional raw input string to invoke. /// ///
/// @@ -3695,20 +3661,20 @@ pub struct DebugCollectLogsInclude { /// and may change or be removed in future SDK or CLI releases. /// ///
-#[derive(Debug, Clone, Serialize, Deserialize)] +#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct 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. +pub struct CommandsInvokeRequest { + /// Raw input after the command name #[serde(skip_serializing_if = "Option::is_none")] - pub additional_entries: Option>, - /// 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. - pub destination: DebugCollectLogsDestination, - /// Which built-in session diagnostics to include. Omitted fields default to true. + pub input: Option, + /// Command name. Leading slashes are stripped and the name is matched case-insensitively. + pub name: String, + /// Optional client surface that initiated the invocation #[serde(skip_serializing_if = "Option::is_none")] - pub include: Option, + pub origin: Option, } -/// An optional debug bundle entry that could not be included. +/// Optional filters controlling which command sources to include in the listing. /// ///
/// @@ -3718,17 +3684,19 @@ pub struct DebugCollectLogsRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct DebugCollectLogsSkippedEntry { - /// Relative path requested for this bundle entry. - pub bundle_path: String, - /// Server-local source path that could not be read. +pub struct CommandsListRequest { + /// Include runtime built-in commands #[serde(skip_serializing_if = "Option::is_none")] - pub path: Option, - /// Reason the entry was skipped. - pub reason: String, + pub include_builtins: Option, + /// Include commands registered by protocol clients, including SDK clients and extensions + #[serde(skip_serializing_if = "Option::is_none")] + pub include_client_commands: Option, + /// Include enabled user-invocable skills and commands + #[serde(skip_serializing_if = "Option::is_none")] + pub include_skills: Option, } -/// Result of collecting a redacted debug bundle. +/// Queued-command request ID and the result indicating whether the host executed it (and whether to stop processing further queued commands). /// ///
/// @@ -3738,19 +3706,14 @@ pub struct DebugCollectLogsSkippedEntry { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct DebugCollectLogsResult { - /// Files included in the redacted bundle. - pub entries: Vec, - /// Destination kind that was written. - pub kind: DebugCollectLogsResultKind, - /// 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. - pub path: String, - /// Optional files or directories that could not be included. - #[serde(skip_serializing_if = "Option::is_none")] - pub skipped_entries: Option>, +pub struct CommandsRespondToQueuedCommandRequest { + /// Request ID from the `command.queued` event the host is responding to. + pub request_id: RequestId, + /// Result of the queued command execution. + pub result: serde_json::Value, } -/// Installed plugin that contributes a discovered extension. +/// Indicates whether the queued-command response was matched to a pending request. /// ///
/// @@ -3760,12 +3723,12 @@ pub struct DebugCollectLogsResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct DiscoveredExtensionPlugin { - /// Installed plugin name - pub name: String, +pub struct 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. + pub success: bool, } -/// Discovered extension metadata and persistent enablement state. +/// 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`). /// ///
/// @@ -3775,23 +3738,12 @@ pub struct DiscoveredExtensionPlugin { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct DiscoveredExtension { - /// Whether this extension's persistent per-ID preference is enabled - pub enabled: bool, - /// Source-qualified ID accepted by both server and session extension enablement methods - pub id: String, - /// Human-readable extension name - pub name: String, - /// Absolute path to the extension entry module, suitable for revealing it in a file manager - pub path: String, - /// Containing plugin metadata for plugin-contributed extensions - #[serde(skip_serializing_if = "Option::is_none")] - pub plugin: Option, - /// Discovery source - pub source: DiscoveredExtensionSource, +pub struct CompletionsGetTriggerCharactersResult { + /// Trigger characters advertised by the host (e.g. `["@", "#"]`). Empty disables host-driven completions for the session. + pub trigger_characters: Vec, } -/// Extensions discovered from persisted Copilot home state and their effective loading mode. Launch-scoped additional plugins are not included. +/// Request host-driven completions for the current composer input. /// ///
/// @@ -3801,14 +3753,14 @@ pub struct DiscoveredExtension { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct DiscoveredExtensions { - /// Discovered user and enabled installed-plugin extensions from persisted Copilot home state - pub extensions: Vec, - /// Effective extension loading mode. Defaults to load_and_augment when unset. - pub mode: DiscoveredExtensionMode, +pub struct CompletionsRequestRequest { + /// Cursor offset within `text`, in UTF-16 code units. + pub offset: i64, + /// The full composed composer input. + pub text: String, } -/// Source-qualified extension identifiers to persistently disable for future sessions. +/// 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. /// ///
/// @@ -3818,12 +3770,24 @@ pub struct DiscoveredExtensions { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct DiscoveredExtensionsDisableRequest { - /// Source-qualified user or plugin extension IDs to disable - pub ids: Vec, +pub struct SessionCompletionItem { + /// Text spliced into the composer when the item is accepted. + pub insert_text: String, + /// Render-kind hint for the picker row (e.g. `"document"`, `"directory"`), derived from the host's display kind. + #[serde(skip_serializing_if = "Option::is_none")] + pub kind: Option, + /// Primary display label for the picker row. Falls back to `insertText` when absent. + #[serde(skip_serializing_if = "Option::is_none")] + pub label: Option, + /// End (exclusive) of the replacement range in `text`, in UTF-16 code units. + #[serde(skip_serializing_if = "Option::is_none")] + pub range_end: Option, + /// Start of the replacement range in `text`, in UTF-16 code units. + #[serde(skip_serializing_if = "Option::is_none")] + pub range_start: Option, } -/// Source-qualified extension identifiers to persistently enable for future sessions. +/// Host-driven completion items for the current composer input. Empty when the host returns no items or does not support completions. /// ///
/// @@ -3833,12 +3797,12 @@ pub struct DiscoveredExtensionsDisableRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct DiscoveredExtensionsEnableRequest { - /// Source-qualified user or plugin extension IDs to enable - pub ids: Vec, +pub struct CompletionsRequestResult { + /// Completion items in host-ranked order. + pub items: Vec, } -/// MCP server discovered by `mcp.discover`, with config source, optional plugin source, transport type, and enabled state. +/// Params to attach or detach an in-process ExtensionController delegate. /// ///
/// @@ -3848,40 +3812,16 @@ pub struct DiscoveredExtensionsEnableRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct DiscoveredMcpServer { - /// Whether the server is enabled (not in the disabled list) - pub enabled: bool, - /// Server name (config key) - pub name: String, - /// Configuration source: user, workspace, plugin, or builtin - pub source: McpServerSource, - /// Plugin name that provided this server, when source is plugin. - #[serde(skip_serializing_if = "Option::is_none")] - pub source_plugin: Option, - /// Plugin version that provided this server, when source is plugin. - #[serde(skip_serializing_if = "Option::is_none")] - pub source_plugin_version: Option, - /// Server transport type: stdio, http, sse (deprecated), or memory +pub(crate) struct ConfigureSessionExtensionsParams { + /// In-process ExtensionController delegate (CLI-only optimization). Marked internal: this field is excluded from the public SDK surface. The post-SDK extension surface exposes list/enable/disable/reload via dedicated RPCs served by the runtime. + #[doc(hidden)] #[serde(skip_serializing_if = "Option::is_none")] - pub r#type: Option, -} - -/// Slash-prefixed command string to enqueue for FIFO processing. -/// -///
-/// -/// **Experimental.** This type is part of an experimental wire-protocol surface -/// and may change or be removed in future SDK or CLI releases. -/// -///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct 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. - pub command: String, + pub(crate) controller: Option, + /// Session to attach the extension controller delegate to. + pub session_id: SessionId, } -/// Indicates whether the command was accepted into the local execution queue. +/// Repository associated with the connected remote session. /// ///
/// @@ -3891,12 +3831,16 @@ pub struct EnqueueCommandParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct 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). - pub queued: bool, +pub struct ConnectedRemoteSessionMetadataRepository { + /// Branch associated with the remote session. + pub branch: String, + /// Repository name. + pub name: String, + /// Repository owner or organization login. + pub owner: String, } -/// Cursor, batch size, and optional long-poll/filter parameters for reading session events. +/// Metadata for a connected remote session. /// ///
/// @@ -3906,34 +3850,38 @@ pub struct EnqueueCommandResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct EventLogReadRequest { - /// Optional non-empty list of subagent identifiers. When provided, only events owned by one of these agents are returned; ownership recognizes the event envelope's agentId plus legacy data.agentId and data.parentToolCallId markers. This filter takes precedence over agentScope. - #[serde(skip_serializing_if = "Option::is_none")] - pub agent_ids: Option>, - /// Agent-scope filter: 'primary' returns only main-agent events plus events whose type starts with 'subagent.' (matching the typed-subscription default behavior); 'all' returns events from all agents (matching wildcard-subscription behavior). Default is 'all' to preserve wildcard semantics for catch-up callers. - #[serde(skip_serializing_if = "Option::is_none")] - pub agent_scope: Option, - /// Opaque cursor returned by a previous read. Omit on the first call to start from the beginning of the session's persisted history. +pub struct ConnectedRemoteSessionMetadata { + /// Neutral SDK discriminator for the connected remote session kind. + pub kind: ConnectedRemoteSessionMetadataKind, + /// Last session update time as an ISO 8601 string. + pub modified_time: String, + /// Optional friendly session name. #[serde(skip_serializing_if = "Option::is_none")] - pub cursor: Option, - /// Direction to page through the session's persisted event history. 'forward' (default) pages from the cursor toward newer events (or from the start of history when no cursor is given). 'backward' enables tail-first reads: with no cursor it returns the NEWEST `max` events, and the returned cursor pages toward OLDER events on subsequent backward reads. Events within a returned batch are always in chronological (oldest-to-newest) order, even for a backward read. Backward reads cover PERSISTED history only; ephemeral events are never returned by a backward read. `direction` selects the INITIAL read only: the returned cursor is self-describing, so a continuation read pages in the cursor's own direction regardless of the `direction` passed alongside it — a forward cursor always pages forward and a backward cursor always pages backward. Pass the direction that matches the cursor to avoid confusion. + pub name: Option, + /// Pull request number associated with the session. #[serde(skip_serializing_if = "Option::is_none")] - pub direction: Option, - /// When false, skip ephemeral events entirely and return only durable (persisted) events. History-backfill callers that discard ephemerals anyway should set this so the read is bounded by the durable log length instead of racing the ephemeral ring on a busy session. Defaults to true (ephemerals are interleaved with durable events in creation order). Ignored by backward reads, which always cover persisted history only. + pub pull_request_number: Option, + /// Repository associated with the connected remote session. + pub repository: ConnectedRemoteSessionMetadataRepository, + /// Original remote resource identifier. #[serde(skip_serializing_if = "Option::is_none")] - pub include_ephemeral: Option, - /// Maximum number of events to return in this batch (1–1000, default 200). + pub resource_id: Option, + /// SDK session ID for the connected remote session. + pub session_id: SessionId, + /// Remote session staleness deadline as an ISO 8601 string. #[serde(skip_serializing_if = "Option::is_none")] - pub max: Option, - /// Either '*' to receive all event types, or a non-empty list of event types to receive + pub stale_at: Option, + /// Session start time as an ISO 8601 string. + pub start_time: String, + /// Remote session state returned by the backing service. #[serde(skip_serializing_if = "Option::is_none")] - pub types: Option, - /// Milliseconds to wait for new events when the cursor is at the tail of history. 0 (default) returns immediately even if no events are available. Capped at 30000ms. Ephemeral events that arrive during the wait are delivered in this batch but are NOT replayable on a subsequent read (use a non-zero waitMs in your next call to capture future ephemerals as they happen). This applies to forward reads only: a backward read always returns immediately and ignores `waitMs`, because backward paging covers persisted history only while new events append at the tail (the opposite end from a backward page), so no blocking or ephemeral delivery can occur. + pub state: Option, + /// Optional session summary. #[serde(skip_serializing_if = "Option::is_none")] - pub wait_ms: Option, + pub summary: Option, } -/// Indicates whether the operation succeeded. +/// Remote session connection parameters. /// ///
/// @@ -3943,12 +3891,12 @@ pub struct EventLogReadRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct EventLogReleaseInterestResult { - /// Whether the operation succeeded - pub success: bool, +pub struct ConnectRemoteSessionParams { + /// Session ID to connect to. + pub session_id: SessionId, } -/// Snapshot of the current tail cursor without returning any events. Use this when a consumer wants to subscribe to live events going forward without first paginating through the entire persisted history (which would happen if `read` were called without a cursor on a long-lived session). +/// Connection-level opt-ins for the `server.connect` handshake. Transport authentication is consumed by the native protocol boundary before dispatch. /// ///
/// @@ -3958,12 +3906,16 @@ pub struct EventLogReleaseInterestResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct EventLogTailResult { - /// Opaque cursor pointing at the current tail of the session's persisted-events history. Pass back to `read` to receive only events that arrive AFTER this snapshot. When the session has no events, this returns the same sentinel as an unset cursor (i.e. equivalent to omitting the cursor on a first read). - pub cursor: String, +pub(crate) struct ConnectRequest { + /// 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. + #[serde(skip_serializing_if = "Option::is_none")] + pub enable_git_hub_telemetry_forwarding: Option, + /// Connection token; required when the server was started with COPILOT_CONNECTION_TOKEN + #[serde(skip_serializing_if = "Option::is_none")] + pub token: Option, } -/// Batch of session events returned by a read, with cursor and continuation metadata. +/// Handshake result reporting the server's protocol version and package version on success. /// ///
/// @@ -3973,18 +3925,16 @@ pub struct EventLogTailResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct 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). - pub cursor: String, - /// 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. - pub cursor_status: EventsCursorStatus, - /// 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. - pub events: Vec, - /// 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. - pub has_more: bool, +pub(crate) struct ConnectResult { + /// Always true on success + pub ok: bool, + /// Server protocol version number + pub protocol_version: i64, + /// Server package version + pub version: String, } -/// Slash command name and argument string to execute synchronously. +/// Local file system absolute paths within the session working directory to check against its content-exclusion policy. /// ///
/// @@ -3994,14 +3944,12 @@ pub struct EventsReadResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ExecuteCommandParams { - /// Argument string to pass to the command (empty string if none). - pub args: String, - /// Name of the slash command to invoke (without the leading '/'). - pub command_name: String, +pub struct ContentExclusionCheckPathsRequest { + /// Local file system absolute paths within the session working directory to check. Results are returned in the same order, including duplicates. + pub paths: Vec, } -/// Error message produced while executing the command, if any. +/// Content-exclusion decision for one requested path. /// ///
/// @@ -4011,13 +3959,14 @@ pub struct ExecuteCommandParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ExecuteCommandResult { - /// Error message produced while executing the command, if any. Omitted when the handler succeeded. - #[serde(skip_serializing_if = "Option::is_none")] - pub error: Option, +pub struct ContentExclusionPathCheck { + /// Whether the session's complete content-exclusion policy excludes the path. + pub excluded: bool, + /// The path supplied by the caller. + pub path: String, } -/// Discovered extension metadata, including source-qualified ID, name, discovery source, status, and optional process ID. +/// Batch content-exclusion result. Callers must fail closed when policy evaluation is unavailable. /// ///
/// @@ -4027,21 +3976,14 @@ pub struct ExecuteCommandResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct Extension { - /// Source-qualified ID (e.g., 'project:my-ext', 'user:auth-helper', 'plugin:my-plugin:my-ext') - pub id: String, - /// Extension name (directory name) - pub name: String, - /// Process ID if the extension is running - #[serde(skip_serializing_if = "Option::is_none")] - pub pid: Option, - /// Discovery source: project (.github/extensions/), user (~/.copilot/extensions/), plugin (installed plugin), or session (session-state//extensions/) - pub source: ExtensionSource, - /// Current status: running, disabled, failed, or starting - pub status: ExtensionStatus, +pub struct ContentExclusionCheckPathsResult { + /// Whether the session's policy service was available for the complete batch. When false, checks is empty and callers must treat every requested path as excluded. + pub available: bool, + /// Per-path decisions in request order. Empty when available is false. + pub checks: Vec, } -/// Slim input shape for extension_context attachments; identity fields are runtime-derived. +/// A single large message currently in context. /// ///
/// @@ -4051,16 +3993,18 @@ pub struct Extension { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ExtensionContextPushInput { - /// Caller-supplied JSON payload (required, may be null but not undefined) - pub payload: serde_json::Value, - /// Human-readable composer pill label - pub title: String, - /// Attachment type discriminator - pub r#type: ExtensionContextPushInputType, +pub struct ContextHeaviestMessage { + /// Stable identifier for this message within the snapshot. + pub id: String, + /// Human-readable source label, e.g. `tool: bash` or `skill: tmux`. Presentation-only. + pub label: String, + /// Role of the chat message (`user`, `assistant`, or `tool`). + pub role: String, + /// Token count currently in context for this individual message. + pub tokens: i64, } -/// Opaque integrator-owned process launch profile for one extension entrypoint. +/// The currently selected model, reasoning effort, and context tier for the session. The context tier reflects `Session.getContextTier()`, restored from the session journal on resume. /// ///
/// @@ -4070,16 +4014,19 @@ pub struct ExtensionContextPushInput { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ExtensionLaunchProfile { - /// Opaque integrator-defined arguments passed to the executable. The runtime does not append the extension entrypoint. - pub args: Vec, - /// Opaque integrator-defined environment variables. Runtime-owned COPILOT_SDK_PATH, SESSION_ID, and COPILOT_EXTENSION_PARENT_PID values take precedence. - pub env: HashMap, - /// Executable used to launch the extension entrypoint. - pub executable: String, -} - -/// A discovered extension entrypoint that the registered integrator may classify and resolve to an opaque launch profile. +pub struct CurrentModel { + /// Context tier for models that support multiple context-window sizes. + #[serde(skip_serializing_if = "Option::is_none")] + pub context_tier: Option, + /// Currently active model identifier + #[serde(skip_serializing_if = "Option::is_none")] + pub model_id: Option, + /// 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. + #[serde(skip_serializing_if = "Option::is_none")] + pub reasoning_effort: Option, +} + +/// Lightweight metadata for a currently initialized session tool /// ///
/// @@ -4089,18 +4036,29 @@ pub struct ExtensionLaunchProfile { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ExtensionLaunchProviderResolveRequest { - /// Source-qualified extension identifier. - pub id: String, - /// Absolute path to the discovered extension entrypoint. - pub module_path: String, - /// Human-readable extension name. +pub struct CurrentToolMetadata { + /// Whether the tool is loaded on demand via tool search + #[serde(skip_serializing_if = "Option::is_none")] + pub defer_loading: Option, + /// Tool description + pub description: String, + /// JSON Schema for tool input + #[serde(rename = "input_schema", skip_serializing_if = "Option::is_none")] + pub input_schema: Option>, + /// MCP server name for MCP-backed tools + #[serde(skip_serializing_if = "Option::is_none")] + pub mcp_server_name: Option, + /// Raw MCP tool name for MCP-backed tools + #[serde(skip_serializing_if = "Option::is_none")] + pub mcp_tool_name: Option, + /// Model-facing tool name pub name: String, - /// Discovery source for the extension entrypoint. - pub source: ExtensionSource, + /// Optional MCP/config namespaced tool name + #[serde(skip_serializing_if = "Option::is_none")] + pub namespaced_name: Option, } -/// The launch profile for a supported entrypoint. Omit launch when the provider does not support the entrypoint. +/// A file included in the redacted debug bundle. /// ///
/// @@ -4110,13 +4068,37 @@ pub struct ExtensionLaunchProviderResolveRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ExtensionLaunchProviderResolveResult { - /// Opaque launch profile, omitted when this provider does not support the entrypoint. +pub struct DebugCollectLogsCollectedEntry { + /// Relative path of the file in the staged bundle/archive. + pub bundle_path: String, + /// Redacted output size in bytes. + pub size_bytes: i64, + /// Source category for this entry. + pub source: DebugCollectLogsSource, +} + +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct DebugCollectLogsDestinationArchive { + /// Destination variant discriminator. + pub kind: DebugCollectLogsDestinationArchiveKind, + /// When true, create the archive atomically without overwriting an existing file by appending ` (N)` before the extension as needed. Defaults to false. #[serde(skip_serializing_if = "Option::is_none")] - pub launch: Option, + pub no_overwrite: Option, + /// Absolute or server-relative path for the .tgz archive to create. + pub output_path: String, } -/// Extensions discovered for the session, with their current status. +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct DebugCollectLogsDestinationDirectory { + /// Destination variant discriminator. + pub kind: DebugCollectLogsDestinationDirectoryKind, + /// Directory where redacted files should be staged. The directory is created if needed. + pub output_directory: String, +} + +/// A caller-provided server-local file or directory to include in the debug bundle. /// ///
/// @@ -4126,12 +4108,22 @@ pub struct ExtensionLaunchProviderResolveResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ExtensionList { - /// Discovered extensions and their current status - pub extensions: Vec, +pub struct DebugCollectLogsEntry { + /// Relative path to use inside the staged bundle/archive. + pub bundle_path: String, + /// Kind of source path to include. + pub kind: DebugCollectLogsEntryKind, + /// Server-local source path to read. + pub path: String, + /// How text content from this entry should be redacted. Defaults to plain-text. + #[serde(skip_serializing_if = "Option::is_none")] + pub redaction: Option, + /// When true, collection fails if this entry cannot be read. Defaults to false, which records the entry in `skippedEntries`. + #[serde(skip_serializing_if = "Option::is_none")] + pub required: Option, } -/// Source-qualified extension identifier to disable for the session. +/// Built-in session diagnostics to include in the bundle. Omitted fields default to true. /// ///
/// @@ -4141,12 +4133,31 @@ pub struct ExtensionList { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ExtensionsDisableRequest { - /// Source-qualified extension ID to disable - pub id: String, +pub struct 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. + #[serde(skip_serializing_if = "Option::is_none")] + pub current_process_log_path: Option, + /// Include the session event log (`events.jsonl`). Defaults to true. + #[serde(skip_serializing_if = "Option::is_none")] + pub events: Option, + /// Server-local path to the session's events.jsonl file. Internal callers normally omit this and let the runtime derive it from the session. + #[serde(skip_serializing_if = "Option::is_none")] + pub events_path: Option, + /// Maximum number of previous process logs to include. Defaults to 5. + #[serde(skip_serializing_if = "Option::is_none")] + pub previous_process_log_limit: Option, + /// Server-local process log directory to search when `currentProcessLogPath` is unavailable, useful for collecting logs for inactive sessions. + #[serde(skip_serializing_if = "Option::is_none")] + pub process_log_directory: Option, + /// Include process logs for the session. Defaults to true. + #[serde(skip_serializing_if = "Option::is_none")] + pub process_logs: Option, + /// Include interactive shell logs written under the session's `shell-logs` directory. Defaults to true. + #[serde(skip_serializing_if = "Option::is_none")] + pub shell_logs: Option, } -/// Source-qualified extension identifier to enable for the session. +/// Options for collecting a redacted session debug bundle. /// ///
/// @@ -4154,14 +4165,20 @@ pub struct ExtensionsDisableRequest { /// and may change or be removed in future SDK or CLI releases. /// ///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ExtensionsEnableRequest { - /// Source-qualified extension ID to enable - pub id: String, +pub struct 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. + #[serde(skip_serializing_if = "Option::is_none")] + pub additional_entries: Option>, + /// 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. + pub destination: DebugCollectLogsDestination, + /// Which built-in session diagnostics to include. Omitted fields default to true. + #[serde(skip_serializing_if = "Option::is_none")] + pub include: Option, } -/// Binary result returned by a tool for the model +/// An optional debug bundle entry that could not be included. /// ///
/// @@ -4171,22 +4188,17 @@ pub struct ExtensionsEnableRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ExternalToolTextResultForLlmBinaryResultsForLlm { - /// Base64-encoded binary data - pub data: String, - /// Human-readable description of the binary data - #[serde(skip_serializing_if = "Option::is_none")] - pub description: Option, - /// Optional metadata from the producing tool. +pub struct DebugCollectLogsSkippedEntry { + /// Relative path requested for this bundle entry. + pub bundle_path: String, + /// Server-local source path that could not be read. #[serde(skip_serializing_if = "Option::is_none")] - pub metadata: Option>, - /// MIME type of the binary data - pub mime_type: String, - /// Binary result type discriminator. Use "image" for images and "resource" for other binary data. - pub r#type: ExternalToolTextResultForLlmBinaryResultsForLlmType, + pub path: Option, + /// Reason the entry was skipped. + pub reason: String, } -/// Expanded external tool result payload +/// Result of collecting a redacted debug bundle. /// ///
/// @@ -4196,33 +4208,19 @@ pub struct ExternalToolTextResultForLlmBinaryResultsForLlm { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ExternalToolTextResultForLlm { - /// Base64-encoded binary results returned to the model - #[serde(skip_serializing_if = "Option::is_none")] - pub binary_results_for_llm: Option>, - /// Structured content blocks from the tool - #[serde(skip_serializing_if = "Option::is_none")] - pub contents: Option>, - /// Optional error message for failed executions - #[serde(skip_serializing_if = "Option::is_none")] - pub error: Option, - /// Execution outcome classification. Optional for back-compat; normalized to 'success' (or 'failure' when error is present) when missing or unrecognized. - #[serde(skip_serializing_if = "Option::is_none")] - pub result_type: Option, - /// Detailed log content for timeline display - #[serde(skip_serializing_if = "Option::is_none")] - pub session_log: Option, - /// Text result returned to the model - pub text_result_for_llm: String, - /// Tool references returned by a tool-search override: names of deferred tools to surface to the model. When set, the tool result is materialized as `tool_reference` content blocks (rather than plain text) so the model knows which deferred tools are now available. - #[serde(skip_serializing_if = "Option::is_none")] - pub tool_references: Option>, - /// Optional tool-specific telemetry +pub struct DebugCollectLogsResult { + /// Files included in the redacted bundle. + pub entries: Vec, + /// Destination kind that was written. + pub kind: DebugCollectLogsResultKind, + /// 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. + pub path: String, + /// Optional files or directories that could not be included. #[serde(skip_serializing_if = "Option::is_none")] - pub tool_telemetry: Option>, + pub skipped_entries: Option>, } -/// Audio content block with base64-encoded data +/// Installed plugin that contributes a discovered extension. /// ///
/// @@ -4232,16 +4230,12 @@ pub struct ExternalToolTextResultForLlm { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ExternalToolTextResultForLlmContentAudio { - /// Base64-encoded audio data - pub data: String, - /// MIME type of the audio (e.g., audio/wav, audio/mpeg) - pub mime_type: String, - /// Content block type discriminator - pub r#type: ExternalToolTextResultForLlmContentAudioType, +pub struct DiscoveredExtensionPlugin { + /// Installed plugin name + pub name: String, } -/// Image content block with base64-encoded data +/// Discovered extension metadata and persistent enablement state. /// ///
/// @@ -4251,16 +4245,23 @@ pub struct ExternalToolTextResultForLlmContentAudio { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ExternalToolTextResultForLlmContentImage { - /// Base64-encoded image data - pub data: String, - /// MIME type of the image (e.g., image/png, image/jpeg) - pub mime_type: String, - /// Content block type discriminator - pub r#type: ExternalToolTextResultForLlmContentImageType, +pub struct DiscoveredExtension { + /// Whether this extension's persistent per-ID preference is enabled + pub enabled: bool, + /// Source-qualified ID accepted by both server and session extension enablement methods + pub id: String, + /// Human-readable extension name + pub name: String, + /// Absolute path to the extension entry module, suitable for revealing it in a file manager + pub path: String, + /// Containing plugin metadata for plugin-contributed extensions + #[serde(skip_serializing_if = "Option::is_none")] + pub plugin: Option, + /// Discovery source + pub source: DiscoveredExtensionSource, } -/// Embedded resource content block with inline text or binary data +/// Extensions discovered from persisted Copilot home state and their effective loading mode. Launch-scoped additional plugins are not included. /// ///
/// @@ -4270,14 +4271,14 @@ pub struct ExternalToolTextResultForLlmContentImage { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ExternalToolTextResultForLlmContentResource { - /// The embedded resource contents, either text or base64-encoded binary - pub resource: serde_json::Value, - /// Content block type discriminator - pub r#type: ExternalToolTextResultForLlmContentResourceType, +pub struct DiscoveredExtensions { + /// Discovered user and enabled installed-plugin extensions from persisted Copilot home state + pub extensions: Vec, + /// Effective extension loading mode. Defaults to load_and_augment when unset. + pub mode: DiscoveredExtensionMode, } -/// Icon image for a resource +/// Source-qualified extension identifiers to persistently disable for future sessions. /// ///
/// @@ -4287,21 +4288,12 @@ pub struct ExternalToolTextResultForLlmContentResource { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ExternalToolTextResultForLlmContentResourceLinkIcon { - /// MIME type of the icon image - #[serde(skip_serializing_if = "Option::is_none")] - pub mime_type: Option, - /// Available icon sizes (e.g., ['16x16', '32x32']) - #[serde(skip_serializing_if = "Option::is_none")] - pub sizes: Option>, - /// URL or path to the icon image - pub src: String, - /// Theme variant this icon is intended for - #[serde(skip_serializing_if = "Option::is_none")] - pub theme: Option, +pub struct DiscoveredExtensionsDisableRequest { + /// Source-qualified user or plugin extension IDs to disable + pub ids: Vec, } -/// Resource link content block referencing an external resource +/// Source-qualified extension identifiers to persistently enable for future sessions. /// ///
/// @@ -4311,31 +4303,12 @@ pub struct ExternalToolTextResultForLlmContentResourceLinkIcon { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ExternalToolTextResultForLlmContentResourceLink { - /// Human-readable description of the resource - #[serde(skip_serializing_if = "Option::is_none")] - pub description: Option, - /// Icons associated with this resource - #[serde(skip_serializing_if = "Option::is_none")] - pub icons: Option>, - /// MIME type of the resource content - #[serde(skip_serializing_if = "Option::is_none")] - pub mime_type: Option, - /// Resource name identifier - pub name: String, - /// Size of the resource in bytes - #[serde(skip_serializing_if = "Option::is_none")] - pub size: Option, - /// Human-readable display title for the resource - #[serde(skip_serializing_if = "Option::is_none")] - pub title: Option, - /// Content block type discriminator - pub r#type: ExternalToolTextResultForLlmContentResourceLinkType, - /// URI identifying the resource - pub uri: String, +pub struct DiscoveredExtensionsEnableRequest { + /// Source-qualified user or plugin extension IDs to enable + pub ids: Vec, } -/// Shell command exit metadata with optional output preview +/// MCP server discovered by `mcp.discover`, with config source, optional plugin source, transport type, and enabled state. /// ///
/// @@ -4345,25 +4318,25 @@ pub struct ExternalToolTextResultForLlmContentResourceLink { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ExternalToolTextResultForLlmContentShellExit { - /// Working directory where the shell command was executed +pub struct DiscoveredMcpServer { + /// Whether the server is enabled (not in the disabled list) + pub enabled: bool, + /// Server name (config key) + pub name: String, + /// Configuration source: user, workspace, plugin, or builtin + pub source: McpServerSource, + /// Plugin name that provided this server, when source is plugin. #[serde(skip_serializing_if = "Option::is_none")] - pub cwd: Option, - /// Exit code from the completed shell command - pub exit_code: i64, - /// Output associated with this shell command, if available. May be partial, truncated, or a preview; not guaranteed to be full output. + pub source_plugin: Option, + /// Plugin version that provided this server, when source is plugin. #[serde(skip_serializing_if = "Option::is_none")] - pub output_preview: Option, - /// Whether outputPreview is known to be incomplete or truncated + pub source_plugin_version: Option, + /// Server transport type: stdio, http, sse (deprecated), or memory #[serde(skip_serializing_if = "Option::is_none")] - pub output_truncated: Option, - /// Shell id, as assigned by Copilot runtime - pub shell_id: String, - /// Content block type discriminator - pub r#type: ExternalToolTextResultForLlmContentShellExitType, + pub r#type: Option, } -/// Terminal/shell output content block with optional exit code and working directory +/// Slash-prefixed command string to enqueue for FIFO processing. /// ///
/// @@ -4373,20 +4346,12 @@ pub struct ExternalToolTextResultForLlmContentShellExit { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ExternalToolTextResultForLlmContentTerminal { - /// Working directory where the command was executed - #[serde(skip_serializing_if = "Option::is_none")] - pub cwd: Option, - /// Process exit code, if the command has completed - #[serde(skip_serializing_if = "Option::is_none")] - pub exit_code: Option, - /// Terminal/shell output text - pub text: String, - /// Content block type discriminator - pub r#type: ExternalToolTextResultForLlmContentTerminalType, +pub struct 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. + pub command: String, } -/// Plain text content block +/// Indicates whether the command was accepted into the local execution queue. /// ///
/// @@ -4396,14 +4361,12 @@ pub struct ExternalToolTextResultForLlmContentTerminal { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ExternalToolTextResultForLlmContentText { - /// The text content - pub text: String, - /// Content block type discriminator - pub r#type: ExternalToolTextResultForLlmContentTextType, +pub struct 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). + pub queued: bool, } -/// Parameters for cooperatively aborting a factory body. +/// Cursor, batch size, and optional long-poll/filter parameters for reading session events. /// ///
/// @@ -4413,14 +4376,34 @@ pub struct ExternalToolTextResultForLlmContentText { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct FactoryAbortRequest { - /// Target session identifier - pub session_id: SessionId, - /// Factory run identifier. - pub run_id: String, +pub struct EventLogReadRequest { + /// Optional non-empty list of subagent identifiers. When provided, only events owned by one of these agents are returned; ownership recognizes the event envelope's agentId plus legacy data.agentId and data.parentToolCallId markers. This filter takes precedence over agentScope. + #[serde(skip_serializing_if = "Option::is_none")] + pub agent_ids: Option>, + /// Agent-scope filter: 'primary' returns only main-agent events plus events whose type starts with 'subagent.' (matching the typed-subscription default behavior); 'all' returns events from all agents (matching wildcard-subscription behavior). Default is 'all' to preserve wildcard semantics for catch-up callers. + #[serde(skip_serializing_if = "Option::is_none")] + pub agent_scope: Option, + /// Opaque cursor returned by a previous read. Omit on the first call to start from the beginning of the session's persisted history. + #[serde(skip_serializing_if = "Option::is_none")] + pub cursor: Option, + /// Direction to page through the session's persisted event history. 'forward' (default) pages from the cursor toward newer events (or from the start of history when no cursor is given). 'backward' enables tail-first reads: with no cursor it returns the NEWEST `max` events, and the returned cursor pages toward OLDER events on subsequent backward reads. Events within a returned batch are always in chronological (oldest-to-newest) order, even for a backward read. Backward reads cover PERSISTED history only; ephemeral events are never returned by a backward read. `direction` selects the INITIAL read only: the returned cursor is self-describing, so a continuation read pages in the cursor's own direction regardless of the `direction` passed alongside it — a forward cursor always pages forward and a backward cursor always pages backward. Pass the direction that matches the cursor to avoid confusion. + #[serde(skip_serializing_if = "Option::is_none")] + pub direction: Option, + /// When false, skip ephemeral events entirely and return only durable (persisted) events. History-backfill callers that discard ephemerals anyway should set this so the read is bounded by the durable log length instead of racing the ephemeral ring on a busy session. Defaults to true (ephemerals are interleaved with durable events in creation order). Ignored by backward reads, which always cover persisted history only. + #[serde(skip_serializing_if = "Option::is_none")] + pub include_ephemeral: Option, + /// Maximum number of events to return in this batch (1–1000, default 200). + #[serde(skip_serializing_if = "Option::is_none")] + pub max: Option, + /// Either '*' to receive all event types, or a non-empty list of event types to receive + #[serde(skip_serializing_if = "Option::is_none")] + pub types: Option, + /// Milliseconds to wait for new events when the cursor is at the tail of history. 0 (default) returns immediately even if no events are available. Capped at 30000ms. Ephemeral events that arrive during the wait are delivered in this batch but are NOT replayable on a subsequent read (use a non-zero waitMs in your next call to capture future ephemerals as they happen). This applies to forward reads only: a backward read always returns immediately and ignores `waitMs`, because backward paging covers persisted history only while new events append at the tail (the opposite end from a backward page), so no blocking or ephemeral delivery can occur. + #[serde(skip_serializing_if = "Option::is_none")] + pub wait_ms: Option, } -/// Acknowledgement that a factory request was accepted. +/// Indicates whether the operation succeeded. /// ///
/// @@ -4430,9 +4413,12 @@ pub struct FactoryAbortRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct FactoryAckResult {} +pub struct EventLogReleaseInterestResult { + /// Whether the operation succeeded + pub success: bool, +} -/// Options for one factory-scoped subagent call. +/// Snapshot of the current tail cursor without returning any events. Use this when a consumer wants to subscribe to live events going forward without first paginating through the entire persisted history (which would happen if `read` were called without a cursor on a long-lived session). /// ///
/// @@ -4442,28 +4428,12 @@ pub struct FactoryAckResult {} ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct FactoryAgentOptions { - /// Optional custom agent name for the subagent. This field is accepted but not yet honored. - #[serde(skip_serializing_if = "Option::is_none")] - pub agent: Option, - /// Optional context tier for the subagent. This field is accepted but not yet honored. - #[serde(skip_serializing_if = "Option::is_none")] - pub context_tier: Option, - /// Optional label distinguishing otherwise identical memoized agent calls. - #[serde(skip_serializing_if = "Option::is_none")] - pub label: Option, - /// Optional model identifier for the subagent. - #[serde(skip_serializing_if = "Option::is_none")] - pub model: Option, - /// Optional reasoning effort for the subagent. This field is accepted but not yet honored. - #[serde(skip_serializing_if = "Option::is_none")] - pub reasoning_effort: Option, - /// Optional JSON Schema for structured agent output. - #[serde(skip_serializing_if = "Option::is_none")] - pub schema: Option, +pub struct EventLogTailResult { + /// Opaque cursor pointing at the current tail of the session's persisted-events history. Pass back to `read` to receive only events that arrive AFTER this snapshot. When the session has no events, this returns the same sentinel as an unset cursor (i.e. equivalent to omitting the cursor on a first read). + pub cursor: String, } -/// Parameters for one factory-scoped subagent call. +/// Batch of session events returned by a read, with cursor and continuation metadata. /// ///
/// @@ -4473,18 +4443,18 @@ pub struct FactoryAgentOptions { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct FactoryAgentRequest { - /// Opaque token identifying the current factory execution attempt. - pub execution_token: String, - /// Factory run identifier that owns the subagent. - pub factory_run_id: String, - /// Subagent execution options. - pub opts: FactoryAgentOptions, - /// Prompt to send to the subagent. - pub prompt: String, +pub struct 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). + pub cursor: String, + /// 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. + pub cursor_status: EventsCursorStatus, + /// 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. + pub events: Vec, + /// 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. + pub has_more: bool, } -/// Result of one factory-scoped subagent call. +/// Slash command name and argument string to execute synchronously. /// ///
/// @@ -4494,13 +4464,14 @@ pub struct FactoryAgentRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct FactoryAgentResult { - /// Agent result, omitted when the agent produced no result. - #[serde(skip_serializing_if = "Option::is_none")] - pub result: Option, +pub struct ExecuteCommandParams { + /// Argument string to pass to the command (empty string if none). + pub args: String, + /// Name of the slash command to invoke (without the leading '/'). + pub command_name: String, } -/// Prompt-safe durable identity and live status for a direct factory agent. +/// Error message produced while executing the command, if any. /// ///
/// @@ -4510,44 +4481,13 @@ pub struct FactoryAgentResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct FactoryAgentSummary { - /// Accumulated active agent time in milliseconds. - pub active_ms: i64, - /// Prompt-safe live activity text. - #[serde(skip_serializing_if = "Option::is_none")] - pub activity: Option, - /// Stable direct-agent identifier. - pub agent_id: String, - /// Registered agent type. - pub agent_type: String, - /// Epoch milliseconds when the agent completed. - #[serde(skip_serializing_if = "Option::is_none")] - pub completed_at: Option, - /// Friendly, non-unique name intended for display - #[serde(skip_serializing_if = "Option::is_none")] - pub display_name: Option, - /// Friendly, non-unique name intended for display - pub label: String, - /// Phase identifier active when the agent was launched, or null. - pub phase_id: Option, - /// Model requested when the agent was launched. - #[serde(skip_serializing_if = "Option::is_none")] - pub requested_model: Option, - /// Concrete model resolved for the agent. - #[serde(skip_serializing_if = "Option::is_none")] - pub resolved_model: Option, - /// Owning factory run identifier. - pub run_id: String, - /// Epoch milliseconds when the agent started. +pub struct ExecuteCommandResult { + /// Error message produced while executing the command, if any. Omitted when the handler succeeded. #[serde(skip_serializing_if = "Option::is_none")] - pub started_at: Option, - /// Current durable or live agent status. - pub status: String, - /// Tool-call identifier that launched the agent. - pub tool_call_id: String, + pub error: Option, } -/// Parameters for cancelling a factory run. +/// Discovered extension metadata, including source-qualified ID, name, discovery source, status, and optional process ID. /// ///
/// @@ -4557,12 +4497,21 @@ pub struct FactoryAgentSummary { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct FactoryCancelRequest { - /// Factory run identifier. - pub run_id: String, +pub struct Extension { + /// Source-qualified ID (e.g., 'project:my-ext', 'user:auth-helper', 'plugin:my-plugin:my-ext') + pub id: String, + /// Extension name (directory name) + pub name: String, + /// Process ID if the extension is running + #[serde(skip_serializing_if = "Option::is_none")] + pub pid: Option, + /// Discovery source: project (.github/extensions/), user (~/.copilot/extensions/), plugin (installed plugin), or session (session-state//extensions/) + pub source: ExtensionSource, + /// Current status: running, disabled, failed, or starting + pub status: ExtensionStatus, } -/// Current factory phase identity. +/// Slim input shape for extension_context attachments; identity fields are runtime-derived. /// ///
/// @@ -4572,14 +4521,16 @@ pub struct FactoryCancelRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct FactoryCurrentPhase { - /// Current phase identifier. - pub id: String, - /// Zero-based declared phase ordinal, or null for an undeclared phase. - pub ordinal: Option, +pub struct ExtensionContextPushInput { + /// Caller-supplied JSON payload (required, may be null but not undefined) + pub payload: serde_json::Value, + /// Human-readable composer pill label + pub title: String, + /// Attachment type discriminator + pub r#type: ExtensionContextPushInputType, } -/// Declared or approved factory resource ceilings. +/// Opaque integrator-owned process launch profile for one extension entrypoint. /// ///
/// @@ -4589,22 +4540,16 @@ pub struct FactoryCurrentPhase { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct FactoryDeclaredLimits { - /// Maximum AI credits consumed by subagents and descendants. - #[serde(skip_serializing_if = "Option::is_none")] - pub max_ai_credits: Option, - /// Maximum concurrently active subagents. - #[serde(skip_serializing_if = "Option::is_none")] - pub max_concurrent_subagents: Option, - /// Maximum total subagents spawned by the run. - #[serde(skip_serializing_if = "Option::is_none")] - pub max_total_subagents: Option, - /// Maximum accumulated active execution time in seconds. - #[serde(skip_serializing_if = "Option::is_none")] - pub timeout_seconds: Option, +pub struct ExtensionLaunchProfile { + /// Opaque integrator-defined arguments passed to the executable. The runtime does not append the extension entrypoint. + pub args: Vec, + /// Opaque integrator-defined environment variables. Runtime-owned COPILOT_SDK_PATH, SESSION_ID, and COPILOT_EXTENSION_PARENT_PID values take precedence. + pub env: HashMap, + /// Executable used to launch the extension entrypoint. + pub executable: String, } -/// Parameters sent to the owning extension to execute a factory closure. +/// A discovered extension entrypoint that the registered integrator may classify and resolve to an opaque launch profile. /// ///
/// @@ -4614,20 +4559,18 @@ pub struct FactoryDeclaredLimits { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct FactoryExecuteRequest { - /// Target session identifier - pub session_id: SessionId, - /// Registered factory name. +pub struct ExtensionLaunchProviderResolveRequest { + /// Source-qualified extension identifier. + pub id: String, + /// Absolute path to the discovered extension entrypoint. + pub module_path: String, + /// Human-readable extension name. pub name: String, - /// Factory run identifier. - pub run_id: String, - /// Opaque token identifying this factory execution attempt. - pub execution_token: String, - /// Factory input value. - pub args: serde_json::Value, + /// Discovery source for the extension entrypoint. + pub source: ExtensionSource, } -/// Result returned by an extension factory closure. +/// The launch profile for a supported entrypoint. Omit launch when the provider does not support the entrypoint. /// ///
/// @@ -4637,13 +4580,13 @@ pub struct FactoryExecuteRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct FactoryExecuteResult { - /// Factory result value. +pub struct ExtensionLaunchProviderResolveResult { + /// Opaque launch profile, omitted when this provider does not support the entrypoint. #[serde(skip_serializing_if = "Option::is_none")] - pub result: Option, + pub launch: Option, } -/// Parameters for paging factory progress. +/// Extensions discovered for the session, with their current status. /// ///
/// @@ -4653,24 +4596,12 @@ pub struct FactoryExecuteResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct FactoryGetRunProgressRequest { - /// Exclusive forward cursor. - #[serde(skip_serializing_if = "Option::is_none")] - pub after_seq: Option, - /// Exclusive backward cursor. - #[serde(skip_serializing_if = "Option::is_none")] - pub before_seq: Option, - /// Maximum records to return. Defaults to 200 and is capped at 500. - #[serde(skip_serializing_if = "Option::is_none")] - pub limit: Option, - /// Optional phase identifier used to scope records and cursors. - #[serde(skip_serializing_if = "Option::is_none")] - pub phase_id: Option, - /// Factory run identifier. - pub run_id: String, +pub struct ExtensionList { + /// Discovered extensions and their current status + pub extensions: Vec, } -/// Parameters for retrieving a factory run. +/// Source-qualified extension identifier to disable for the session. /// ///
/// @@ -4680,12 +4611,12 @@ pub struct FactoryGetRunProgressRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct FactoryGetRunRequest { - /// Factory run identifier. - pub run_id: String, +pub struct ExtensionsDisableRequest { + /// Source-qualified extension ID to disable + pub id: String, } -/// Parameters for reading a factory journal entry. +/// Source-qualified extension identifier to enable for the session. /// ///
/// @@ -4695,16 +4626,12 @@ pub struct FactoryGetRunRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct FactoryJournalGetRequest { - /// Opaque token identifying the current factory execution attempt. - pub execution_token: String, - /// Namespaced journal key. - pub key: String, - /// Factory run identifier. - pub run_id: String, +pub struct ExtensionsEnableRequest { + /// Source-qualified extension ID to enable + pub id: String, } -/// Result of reading a factory journal entry. +/// Binary result returned by a tool for the model /// ///
/// @@ -4714,36 +4641,22 @@ pub struct FactoryJournalGetRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct FactoryJournalGetResult { - /// Whether the journal contained the requested key. - pub hit: bool, - /// Cached JSON result. The hit field distinguishes a cached JSON null from a miss. +pub struct ExternalToolTextResultForLlmBinaryResultsForLlm { + /// Base64-encoded binary data + pub data: String, + /// Human-readable description of the binary data #[serde(skip_serializing_if = "Option::is_none")] - pub result_json: Option, -} - -/// Parameters for storing a factory journal entry. -/// -///
-/// -/// **Experimental.** This type is part of an experimental wire-protocol surface -/// and may change or be removed in future SDK or CLI releases. -/// -///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct FactoryJournalPutRequest { - /// Opaque token identifying the current factory execution attempt. - pub execution_token: String, - /// Namespaced journal key. - pub key: String, - /// JSON result to memoize. - pub result_json: serde_json::Value, - /// Factory run identifier. - pub run_id: String, + pub description: Option, + /// Optional metadata from the producing tool. + #[serde(skip_serializing_if = "Option::is_none")] + pub metadata: Option>, + /// MIME type of the binary data + pub mime_type: String, + /// Binary result type discriminator. Use "image" for images and "resource" for other binary data. + pub r#type: ExternalToolTextResultForLlmBinaryResultsForLlmType, } -/// Parameters for paging factory runs. +/// Expanded external tool result payload /// ///
/// @@ -4753,19 +4666,33 @@ pub struct FactoryJournalPutRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct FactoryListRunsRequest { - /// Exclusive forward cursor. +pub struct ExternalToolTextResultForLlm { + /// Base64-encoded binary results returned to the model #[serde(skip_serializing_if = "Option::is_none")] - pub after_seq: Option, - /// Exclusive backward cursor. + pub binary_results_for_llm: Option>, + /// Structured content blocks from the tool #[serde(skip_serializing_if = "Option::is_none")] - pub before_seq: Option, - /// Maximum terminal runs to return. Defaults to 200 and is capped at 500. + pub contents: Option>, + /// Optional error message for failed executions #[serde(skip_serializing_if = "Option::is_none")] - pub limit: Option, + pub error: Option, + /// Execution outcome classification. Optional for back-compat; normalized to 'success' (or 'failure' when error is present) when missing or unrecognized. + #[serde(skip_serializing_if = "Option::is_none")] + pub result_type: Option, + /// Detailed log content for timeline display + #[serde(skip_serializing_if = "Option::is_none")] + pub session_log: Option, + /// Text result returned to the model + pub text_result_for_llm: String, + /// Tool references returned by a tool-search override: names of deferred tools to surface to the model. When set, the tool result is materialized as `tool_reference` content blocks (rather than plain text) so the model knows which deferred tools are now available. + #[serde(skip_serializing_if = "Option::is_none")] + pub tool_references: Option>, + /// Optional tool-specific telemetry + #[serde(skip_serializing_if = "Option::is_none")] + pub tool_telemetry: Option>, } -/// Durable factory resource consumption. +/// Audio content block with base64-encoded data /// ///
/// @@ -4775,16 +4702,16 @@ pub struct FactoryListRunsRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct FactoryRunConsumed { - /// Accumulated active execution time in milliseconds. - pub active_ms: i64, - /// AI usage consumed by the run in nano-AIU. - pub nano_aiu: i64, - /// Total subagents spawned by the run. - pub subagents: i64, +pub struct ExternalToolTextResultForLlmContentAudio { + /// Base64-encoded audio data + pub data: String, + /// MIME type of the audio (e.g., audio/wav, audio/mpeg) + pub mime_type: String, + /// Content block type discriminator + pub r#type: ExternalToolTextResultForLlmContentAudioType, } -/// Prompt-safe terminal factory outcome. +/// Image content block with base64-encoded data /// ///
/// @@ -4794,22 +4721,16 @@ pub struct FactoryRunConsumed { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct FactoryRunTerminal { - /// Human-readable terminal error. - #[serde(skip_serializing_if = "Option::is_none")] - pub error: Option, - /// Machine-readable terminal failure. - #[serde(skip_serializing_if = "Option::is_none")] - pub failure: Option, - /// Human-readable terminal reason. - #[serde(skip_serializing_if = "Option::is_none")] - pub reason: Option, - /// Prompt-safe preview of the completed result. - #[serde(skip_serializing_if = "Option::is_none")] - pub result_preview: Option, +pub struct ExternalToolTextResultForLlmContentImage { + /// Base64-encoded image data + pub data: String, + /// MIME type of the image (e.g., image/png, image/jpeg) + pub mime_type: String, + /// Content block type discriminator + pub r#type: ExternalToolTextResultForLlmContentImageType, } -/// Durable factory run summary with read-time live overlays. +/// Embedded resource content block with inline text or binary data /// ///
/// @@ -4819,48 +4740,14 @@ pub struct FactoryRunTerminal { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct FactoryRunSummary { - /// Epoch milliseconds when the current active segment started, or null while inactive. - pub active_segment_started_at: Option, - /// Approved effective resource ceilings, or null until approved. - pub approved: Option, - /// Epoch milliseconds when the run completed, or null while nonterminal. - pub completed_at: Option, - /// Durable resource consumption. - pub consumed: FactoryRunConsumed, - /// Epoch milliseconds when the run was created. - pub created_at: i64, - /// Current phase identity, or null before any phase is entered. - pub current_phase: Option, - /// Resource ceilings declared by the factory. - pub declared_limits: FactoryDeclaredLimits, - /// Number of phases declared by the factory. - pub declared_phase_count: i64, - /// Human-readable factory description. - pub description: String, - /// Registered factory name. - pub factory_name: String, - /// Number of direct factory agents currently live. - pub live_agent_count: i64, - /// Epoch milliseconds when this live-overlay snapshot was observed. - pub observed_at: i64, - /// Monotonic durable run revision. - pub revision: i64, - /// Factory run identifier. - pub run_id: String, - /// Epoch milliseconds when execution first started, or null before start. - pub started_at: Option, - /// Current factory run status. - pub status: FactoryRunStatus, - /// Terminal run outcome, or null while nonterminal. - pub terminal: Option, - /// Total direct factory agents spawned across all attempts. - pub total_spawned_agent_count: i64, - /// Epoch milliseconds when the durable run was last updated. - pub updated_at: i64, +pub struct ExternalToolTextResultForLlmContentResource { + /// The embedded resource contents, either text or base64-encoded binary + pub resource: serde_json::Value, + /// Content block type discriminator + pub r#type: ExternalToolTextResultForLlmContentResourceType, } -/// A page of factory runs in durable creation order. +/// Icon image for a resource /// ///
/// @@ -4870,24 +4757,21 @@ pub struct FactoryRunSummary { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct FactoryListRunsResult { - /// Whether terminal runs newer than this page exist. - #[serde(skip_serializing_if = "Option::is_none")] - pub has_more_newer: Option, - /// Newest terminal-run cursor in this page, or null when the terminal window is empty. +pub struct ExternalToolTextResultForLlmContentResourceLinkIcon { + /// MIME type of the icon image #[serde(skip_serializing_if = "Option::is_none")] - pub newest_seq: Option, - /// Oldest terminal-run cursor in this page, or null when the terminal window is empty. + pub mime_type: Option, + /// Available icon sizes (e.g., ['16x16', '32x32']) #[serde(skip_serializing_if = "Option::is_none")] - pub oldest_seq: Option, - /// Number of terminal runs older than this page. + pub sizes: Option>, + /// URL or path to the icon image + pub src: String, + /// Theme variant this icon is intended for #[serde(skip_serializing_if = "Option::is_none")] - pub omitted_older: Option, - /// Factory run summaries in durable creation order. - pub runs: Vec, + pub theme: Option, } -/// One ordered factory progress line. +/// Resource link content block referencing an external resource /// ///
/// @@ -4897,16 +4781,31 @@ pub struct FactoryListRunsResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct FactoryLogLine { - /// Progress line kind. - pub kind: FactoryLogLineKind, - /// Monotonic sequence number within the factory run. - pub seq: i64, - /// Progress text. - pub text: String, +pub struct ExternalToolTextResultForLlmContentResourceLink { + /// Human-readable description of the resource + #[serde(skip_serializing_if = "Option::is_none")] + pub description: Option, + /// Icons associated with this resource + #[serde(skip_serializing_if = "Option::is_none")] + pub icons: Option>, + /// MIME type of the resource content + #[serde(skip_serializing_if = "Option::is_none")] + pub mime_type: Option, + /// Resource name identifier + pub name: String, + /// Size of the resource in bytes + #[serde(skip_serializing_if = "Option::is_none")] + pub size: Option, + /// Human-readable display title for the resource + #[serde(skip_serializing_if = "Option::is_none")] + pub title: Option, + /// Content block type discriminator + pub r#type: ExternalToolTextResultForLlmContentResourceLinkType, + /// URI identifying the resource + pub uri: String, } -/// Parameters for recording factory progress. +/// Shell command exit metadata with optional output preview /// ///
/// @@ -4916,16 +4815,25 @@ pub struct FactoryLogLine { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct FactoryLogRequest { - /// Opaque token identifying the current factory execution attempt. - pub execution_token: String, - /// Ordered progress lines to append. - pub lines: Vec, - /// Factory run identifier. - pub run_id: String, +pub struct ExternalToolTextResultForLlmContentShellExit { + /// Working directory where the shell command was executed + #[serde(skip_serializing_if = "Option::is_none")] + pub cwd: Option, + /// Exit code from the completed shell command + pub exit_code: i64, + /// Output associated with this shell command, if available. May be partial, truncated, or a preview; not guaranteed to be full output. + #[serde(skip_serializing_if = "Option::is_none")] + pub output_preview: Option, + /// Whether outputPreview is known to be incomplete or truncated + #[serde(skip_serializing_if = "Option::is_none")] + pub output_truncated: Option, + /// Shell id, as assigned by Copilot runtime + pub shell_id: String, + /// Content block type discriminator + pub r#type: ExternalToolTextResultForLlmContentShellExitType, } -/// Durable lifecycle and timing for one factory phase. +/// Terminal/shell output content block with optional exit code and working directory /// ///
/// @@ -4935,39 +4843,20 @@ pub struct FactoryLogRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct FactoryPhaseObservation { - /// Completed active time accumulated by this phase in milliseconds. - pub accumulated_active_ms: i64, - /// Epoch milliseconds when this phase completed; for a skipped phase, the synthetic skip timestamp (equal to `startedAt`). - #[serde(skip_serializing_if = "Option::is_none")] - pub completed_at: Option, - /// Current live active time for this phase in milliseconds. - pub current_active_ms: i64, - /// Optional human-readable phase detail. +pub struct ExternalToolTextResultForLlmContentTerminal { + /// Working directory where the command was executed #[serde(skip_serializing_if = "Option::is_none")] - pub detail: Option, - /// Number of times execution entered this phase. - pub entry_count: i64, - /// Phase identifier. - pub id: String, - /// Most recent run attempt that entered this phase, or `0` if the phase has never been entered. - pub last_entered_run_attempt: i64, - /// Direct agents in this phase that are currently live. - pub live_agent_count: i64, - /// Zero-based declared phase ordinal, or null for an undeclared phase. - pub ordinal: Option, - /// Epoch milliseconds when this phase first started; for a skipped phase, the synthetic skip timestamp (equal to `completedAt`). + pub cwd: Option, + /// Process exit code, if the command has completed #[serde(skip_serializing_if = "Option::is_none")] - pub started_at: Option, - /// Derived lifecycle state of the phase. - pub status: FactoryPhaseStatus, - /// Human-readable phase title. - pub title: String, - /// Total direct agents associated with this phase. - pub total_agent_count: i64, + pub exit_code: Option, + /// Terminal/shell output text + pub text: String, + /// Content block type discriminator + pub r#type: ExternalToolTextResultForLlmContentTerminalType, } -/// One durable factory progress record. +/// Plain text content block /// ///
/// @@ -4977,22 +4866,14 @@ pub struct FactoryPhaseObservation { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct FactoryProgressLine { - /// Resume attempt that emitted this record. - pub attempt: i64, - /// Progress record kind. - pub kind: FactoryLogLineKind, - /// Phase active when the record was emitted, or null before any phase. - pub phase_id: Option, - /// Epoch milliseconds when the record was persisted. - pub recorded_at: i64, - /// Global monotonic sequence number within the run. - pub seq: i64, - /// Prompt-safe progress text. +pub struct ExternalToolTextResultForLlmContentText { + /// The text content pub text: String, + /// Content block type discriminator + pub r#type: ExternalToolTextResultForLlmContentTextType, } -/// A bidirectional page of factory progress. +/// Parameters for cooperatively aborting a factory body. /// ///
/// @@ -5002,22 +4883,14 @@ pub struct FactoryProgressLine { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct FactoryProgressPage { - /// Whether progress records newer than this page exist. - pub has_more_newer: bool, - /// Whether progress records older than this page exist. - pub has_more_older: bool, - /// Newest sequence number in this page, or null when empty. - pub newest_seq: Option, - /// Oldest sequence number in this page, or null when empty. - pub oldest_seq: Option, - /// Progress records in sequence order. - pub records: Vec, - /// Run revision reflected by this page. - pub revision: i64, +pub struct FactoryAbortRequest { + /// Target session identifier + pub session_id: SessionId, + /// Factory run identifier. + pub run_id: String, } -/// Wire-only per-invocation factory resource ceiling overrides. +/// Acknowledgement that a factory request was accepted. /// ///
/// @@ -5027,22 +4900,40 @@ pub struct FactoryProgressPage { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct 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. +pub struct FactoryAckResult {} + +/// Options for one factory-scoped subagent call. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct FactoryAgentOptions { + /// Optional custom agent name for the subagent. This field is accepted but not yet honored. #[serde(skip_serializing_if = "Option::is_none")] - pub max_ai_credits: Option, - /// Maximum number of factory subagents that may run concurrently. + pub agent: Option, + /// Optional context tier for the subagent. This field is accepted but not yet honored. #[serde(skip_serializing_if = "Option::is_none")] - pub max_concurrent_subagents: Option, - /// Maximum total number of factory subagents that may be admitted. + pub context_tier: Option, + /// Optional label distinguishing otherwise identical memoized agent calls. #[serde(skip_serializing_if = "Option::is_none")] - pub max_total_subagents: Option, - /// 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. + pub label: Option, + /// Optional model identifier for the subagent. #[serde(skip_serializing_if = "Option::is_none")] - pub timeout_seconds: Option, + pub model: Option, + /// Optional reasoning effort for the subagent. This field is accepted but not yet honored. + #[serde(skip_serializing_if = "Option::is_none")] + pub reasoning_effort: Option, + /// Optional JSON Schema for structured agent output. + #[serde(skip_serializing_if = "Option::is_none")] + pub schema: Option, } -/// Parameters for resuming a factory run from its persisted identity. +/// Parameters for one factory-scoped subagent call. /// ///
/// @@ -5052,15 +4943,34 @@ pub struct FactoryRunLimits { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct FactoryResumeRequest { - /// Optional per-invocation resource ceiling overrides. +pub struct FactoryAgentRequest { + /// Opaque token identifying the current factory execution attempt. + pub execution_token: String, + /// Factory run identifier that owns the subagent. + pub factory_run_id: String, + /// Subagent execution options. + pub opts: FactoryAgentOptions, + /// Prompt to send to the subagent. + pub prompt: String, +} + +/// Result of one factory-scoped subagent call. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct FactoryAgentResult { + /// Agent result, omitted when the agent produced no result. #[serde(skip_serializing_if = "Option::is_none")] - pub limits: Option, - /// Factory run identifier. - pub run_id: String, + pub result: Option, } -/// Complete current or terminal factory run envelope. +/// Prompt-safe durable identity and live status for a direct factory agent. /// ///
/// @@ -5070,29 +4980,44 @@ pub struct FactoryResumeRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct FactoryRunResult { - /// Error message for an errored run. +pub struct FactoryAgentSummary { + /// Accumulated active agent time in milliseconds. + pub active_ms: i64, + /// Prompt-safe live activity text. #[serde(skip_serializing_if = "Option::is_none")] - pub error: Option, - /// Machine-readable failure details for an errored run. + pub activity: Option, + /// Stable direct-agent identifier. + pub agent_id: String, + /// Registered agent type. + pub agent_type: String, + /// Epoch milliseconds when the agent completed. #[serde(skip_serializing_if = "Option::is_none")] - pub failure: Option, - /// Reason for a halted or cancelled run. + pub completed_at: Option, + /// Friendly, non-unique name intended for display #[serde(skip_serializing_if = "Option::is_none")] - pub reason: Option, - /// Completed factory result. + pub display_name: Option, + /// Friendly, non-unique name intended for display + pub label: String, + /// Phase identifier active when the agent was launched, or null. + pub phase_id: Option, + /// Model requested when the agent was launched. #[serde(skip_serializing_if = "Option::is_none")] - pub result: Option, - /// Factory run identifier. + pub requested_model: Option, + /// Concrete model resolved for the agent. + #[serde(skip_serializing_if = "Option::is_none")] + pub resolved_model: Option, + /// Owning factory run identifier. pub run_id: String, - /// Partial journal and progress snapshot for a halted, cancelled, or errored run. + /// Epoch milliseconds when the agent started. #[serde(skip_serializing_if = "Option::is_none")] - pub snapshot: Option, - /// Current or terminal factory run status. - pub status: FactoryRunStatus, + pub started_at: Option, + /// Current durable or live agent status. + pub status: String, + /// Tool-call identifier that launched the agent. + pub tool_call_id: String, } -/// Resolved persisted factory identity and resumed run envelope. +/// Parameters for cancelling a factory run. /// ///
/// @@ -5102,14 +5027,12 @@ pub struct FactoryRunResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct FactoryResumeResult { - /// Persisted factory name resolved for the resumed run. - pub factory_name: String, - /// Terminal resumed run envelope. - pub run: FactoryRunResult, +pub struct FactoryCancelRequest { + /// Factory run identifier. + pub run_id: String, } -/// Full factory run observability detail. +/// Current factory phase identity. /// ///
/// @@ -5119,54 +5042,14 @@ pub struct FactoryResumeResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct FactoryRunDetail { - /// Epoch milliseconds when the current active segment started, or null while inactive. - pub active_segment_started_at: Option, - /// Durable identities and live statuses for direct factory agents. - pub agents: Vec, - /// Approved effective resource ceilings, or null until approved. - pub approved: Option, - /// Epoch milliseconds when the run completed, or null while nonterminal. - pub completed_at: Option, - /// Durable resource consumption. - pub consumed: FactoryRunConsumed, - /// Epoch milliseconds when the run was created. - pub created_at: i64, - /// Current phase identity, or null before any phase is entered. - pub current_phase: Option, - /// Resource ceilings declared by the factory. - pub declared_limits: FactoryDeclaredLimits, - /// Number of phases declared by the factory. - pub declared_phase_count: i64, - /// Human-readable factory description. - pub description: String, - /// Registered factory name. - pub factory_name: String, - /// Number of direct factory agents currently live. - pub live_agent_count: i64, - /// Epoch milliseconds when this live-overlay snapshot was observed. - pub observed_at: i64, - /// Lifecycle and timing observations for each factory phase. - pub phases: Vec, - /// Bidirectional page of durable factory progress. - pub progress: FactoryProgressPage, - /// Monotonic durable run revision. - pub revision: i64, - /// Factory run identifier. - pub run_id: String, - /// Epoch milliseconds when execution first started, or null before start. - pub started_at: Option, - /// Current factory run status. - pub status: FactoryRunStatus, - /// Terminal run outcome, or null while nonterminal. - pub terminal: Option, - /// Total direct factory agents spawned across all attempts. - pub total_spawned_agent_count: i64, - /// Epoch milliseconds when the durable run was last updated. - pub updated_at: i64, +pub struct FactoryCurrentPhase { + /// Current phase identifier. + pub id: String, + /// Zero-based declared phase ordinal, or null for an undeclared phase. + pub ordinal: Option, } -/// Options controlling factory invocation. +/// Declared or approved factory resource ceilings. /// ///
/// @@ -5176,16 +5059,22 @@ pub struct FactoryRunDetail { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct RunOptions { - /// Per-invocation resource ceiling overrides. +pub struct FactoryDeclaredLimits { + /// Maximum AI credits consumed by subagents and descendants. #[serde(skip_serializing_if = "Option::is_none")] - pub limits: Option, - /// Run identifier whose journal and progress should seed this resumed run. + pub max_ai_credits: Option, + /// Maximum concurrently active subagents. #[serde(skip_serializing_if = "Option::is_none")] - pub resume_from_run_id: Option, + pub max_concurrent_subagents: Option, + /// Maximum total subagents spawned by the run. + #[serde(skip_serializing_if = "Option::is_none")] + pub max_total_subagents: Option, + /// Maximum accumulated active execution time in seconds. + #[serde(skip_serializing_if = "Option::is_none")] + pub timeout_seconds: Option, } -/// Parameters for invoking a registered factory. +/// Parameters sent to the owning extension to execute a factory closure. /// ///
/// @@ -5195,17 +5084,20 @@ pub struct RunOptions { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct FactoryRunRequest { - /// Factory input value. - pub args: serde_json::Value, +pub struct FactoryExecuteRequest { + /// Target session identifier + pub session_id: SessionId, /// Registered factory name. pub name: String, - /// Factory invocation options. - #[serde(skip_serializing_if = "Option::is_none")] - pub options: Option, + /// Factory run identifier. + pub run_id: String, + /// Opaque token identifying this factory execution attempt. + pub execution_token: String, + /// Factory input value. + pub args: serde_json::Value, } -/// Optional user prompt to combine with the fleet orchestration instructions. +/// Result returned by an extension factory closure. /// ///
/// @@ -5215,13 +5107,13 @@ pub struct FactoryRunRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct FleetStartRequest { - /// Optional user prompt to combine with fleet instructions +pub struct FactoryExecuteResult { + /// Factory result value. #[serde(skip_serializing_if = "Option::is_none")] - pub prompt: Option, + pub result: Option, } -/// Indicates whether fleet mode was successfully activated. +/// Parameters for paging factory progress. /// ///
/// @@ -5231,12 +5123,24 @@ pub struct FleetStartRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct FleetStartResult { - /// Whether fleet mode was successfully activated - pub started: bool, +pub struct FactoryGetRunProgressRequest { + /// Exclusive forward cursor. + #[serde(skip_serializing_if = "Option::is_none")] + pub after_seq: Option, + /// Exclusive backward cursor. + #[serde(skip_serializing_if = "Option::is_none")] + pub before_seq: Option, + /// Maximum records to return. Defaults to 200 and is capped at 500. + #[serde(skip_serializing_if = "Option::is_none")] + pub limit: Option, + /// Optional phase identifier used to scope records and cursors. + #[serde(skip_serializing_if = "Option::is_none")] + pub phase_id: Option, + /// Factory run identifier. + pub run_id: String, } -/// Folder path to add to trusted folders. +/// Parameters for retrieving a factory run. /// ///
/// @@ -5246,12 +5150,12 @@ pub struct FleetStartResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct FolderTrustAddParams { - /// Folder path to mark as trusted - pub path: String, +pub struct FactoryGetRunRequest { + /// Factory run identifier. + pub run_id: String, } -/// Folder path to check for trust. +/// Parameters for reading a factory journal entry. /// ///
/// @@ -5261,12 +5165,16 @@ pub struct FolderTrustAddParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct FolderTrustCheckParams { - /// Folder path to check - pub path: String, +pub struct FactoryJournalGetRequest { + /// Opaque token identifying the current factory execution attempt. + pub execution_token: String, + /// Namespaced journal key. + pub key: String, + /// Factory run identifier. + pub run_id: String, } -/// Folder trust check result. +/// Result of reading a factory journal entry. /// ///
/// @@ -5276,12 +5184,15 @@ pub struct FolderTrustCheckParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct FolderTrustCheckResult { - /// Whether the folder is trusted - pub trusted: bool, +pub struct FactoryJournalGetResult { + /// Whether the journal contained the requested key. + pub hit: bool, + /// Cached JSON result. The hit field distinguishes a cached JSON null from a miss. + #[serde(skip_serializing_if = "Option::is_none")] + pub result_json: Option, } -/// Client environment metadata describing the process that produced a telemetry event. +/// Parameters for storing a factory journal entry. /// ///
/// @@ -5291,40 +5202,18 @@ pub struct FolderTrustCheckResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct GitHubTelemetryClientInfo { - /// Copilot CLI version string. - #[serde(rename = "cli_version")] - pub cli_version: String, - /// Name of the client application. - #[serde(rename = "client_name", skip_serializing_if = "Option::is_none")] - pub client_name: Option, - /// Type of client. - #[serde(rename = "client_type", skip_serializing_if = "Option::is_none")] - pub client_type: Option, - /// Copilot subscription plan, when known. - #[serde(rename = "copilot_plan", skip_serializing_if = "Option::is_none")] - pub copilot_plan: Option, - /// Stable machine identifier for the device. - #[serde(rename = "dev_device_id", skip_serializing_if = "Option::is_none")] - pub dev_device_id: Option, - /// Whether the user is a GitHub/Microsoft staff member. - #[serde(rename = "is_staff", skip_serializing_if = "Option::is_none")] - pub is_staff: Option, - /// Node.js runtime version string. - #[serde(rename = "node_version")] - pub node_version: String, - /// Operating system architecture (e.g. arm64, x64). - #[serde(rename = "os_arch")] - pub os_arch: String, - /// Operating system platform (e.g. darwin, linux, win32). - #[serde(rename = "os_platform")] - pub os_platform: String, - /// Operating system version string. - #[serde(rename = "os_version")] - pub os_version: String, +pub struct FactoryJournalPutRequest { + /// Opaque token identifying the current factory execution attempt. + pub execution_token: String, + /// Namespaced journal key. + pub key: String, + /// JSON result to memoize. + pub result_json: serde_json::Value, + /// Factory run identifier. + pub run_id: String, } -/// A single telemetry event in the runtime's native GitHub-shaped telemetry format, forwarded verbatim to opted-in hosts. The `restricted` flag on the enclosing GitHubTelemetryNotification distinguishes standard from restricted events; the payload shape is identical for both. +/// Parameters for paging factory runs. /// ///
/// @@ -5334,43 +5223,19 @@ pub struct GitHubTelemetryClientInfo { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct GitHubTelemetryEvent { - /// Client environment metadata. +pub struct FactoryListRunsRequest { + /// Exclusive forward cursor. #[serde(skip_serializing_if = "Option::is_none")] - pub client: Option, - /// Copilot tracking ID for user-level attribution. - #[serde( - rename = "copilot_tracking_id", - skip_serializing_if = "Option::is_none" - )] - pub copilot_tracking_id: Option, - /// Timestamp when the event was created (ISO 8601 format). - #[serde(rename = "created_at", skip_serializing_if = "Option::is_none")] - pub created_at: Option, - /// Experiment assignment context. - #[serde( - rename = "exp_assignment_context", - skip_serializing_if = "Option::is_none" - )] - pub exp_assignment_context: Option, - /// Feature flags enabled for this session, as a map from flag to value. + pub after_seq: Option, + /// Exclusive backward cursor. #[serde(skip_serializing_if = "Option::is_none")] - pub features: Option>, - /// Event type/kind (e.g. get_completion_with_tools_turn, tool_call_executed). - pub kind: String, - /// Numeric metrics as a map from key to value. - pub metrics: HashMap, - /// Reference to the model call that produced this event. - #[serde(rename = "model_call_id", skip_serializing_if = "Option::is_none")] - pub model_call_id: Option, - /// String-valued properties as a map from key to value. - pub properties: HashMap, - /// Session identifier the event belongs to. - #[serde(rename = "session_id", skip_serializing_if = "Option::is_none")] - pub session_id: Option, + pub before_seq: Option, + /// Maximum terminal runs to return. Defaults to 200 and is capped at 500. + #[serde(skip_serializing_if = "Option::is_none")] + pub limit: Option, } -/// Payload for a `gitHubTelemetry.event` notification: a single GitHub telemetry event the runtime forwards to a host connection that opted into telemetry forwarding during the `server.connect` handshake. +/// Durable factory resource consumption. /// ///
/// @@ -5380,17 +5245,16 @@ pub struct GitHubTelemetryEvent { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct GitHubTelemetryNotification { - /// The telemetry event, in the runtime's native GitHub-shaped telemetry format. - pub event: GitHubTelemetryEvent, - /// Whether this is a restricted telemetry event (cli.restricted_telemetry). Hosts must route restricted events to first-party Microsoft stores only. - pub restricted: bool, - /// Session the telemetry event belongs to, when it is session-scoped. Omitted for sessionless events (for example, `server.sendTelemetry` calls with no session id), which are still forwarded to opted-in connections. - #[serde(skip_serializing_if = "Option::is_none")] - pub session_id: Option, +pub struct FactoryRunConsumed { + /// Accumulated active execution time in milliseconds. + pub active_ms: i64, + /// AI usage consumed by the run in nano-AIU. + pub nano_aiu: i64, + /// Total subagents spawned by the run. + pub subagents: i64, } -/// Pending external tool call request ID, with the tool result or an error describing why it failed. +/// Prompt-safe terminal factory outcome. /// ///
/// @@ -5400,33 +5264,22 @@ pub struct GitHubTelemetryNotification { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct HandlePendingToolCallRequest { - /// Error message if the tool call failed +pub struct FactoryRunTerminal { + /// Human-readable terminal error. #[serde(skip_serializing_if = "Option::is_none")] pub error: Option, - /// Request ID of the pending tool call - pub request_id: RequestId, - /// Tool call result (string or expanded result object) + /// Machine-readable terminal failure. #[serde(skip_serializing_if = "Option::is_none")] - pub result: Option, -} - -/// Indicates whether the external tool call result was handled successfully. -/// -///
-/// -/// **Experimental.** This type is part of an experimental wire-protocol surface -/// and may change or be removed in future SDK or CLI releases. -/// -///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct HandlePendingToolCallResult { - /// Whether the tool call result was handled successfully - pub success: bool, + pub failure: Option, + /// Human-readable terminal reason. + #[serde(skip_serializing_if = "Option::is_none")] + pub reason: Option, + /// Prompt-safe preview of the completed result. + #[serde(skip_serializing_if = "Option::is_none")] + pub result_preview: Option, } -/// Indicates whether an in-progress manual compaction was aborted. +/// Durable factory run summary with read-time live overlays. /// ///
/// @@ -5436,12 +5289,48 @@ pub struct HandlePendingToolCallResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct HistoryAbortManualCompactionResult { - /// Whether an in-progress manual compaction was aborted. False when no manual compaction was running, when its abort controller was already aborted, or when the session is remote. - pub aborted: bool, +pub struct FactoryRunSummary { + /// Epoch milliseconds when the current active segment started, or null while inactive. + pub active_segment_started_at: Option, + /// Approved effective resource ceilings, or null until approved. + pub approved: Option, + /// Epoch milliseconds when the run completed, or null while nonterminal. + pub completed_at: Option, + /// Durable resource consumption. + pub consumed: FactoryRunConsumed, + /// Epoch milliseconds when the run was created. + pub created_at: i64, + /// Current phase identity, or null before any phase is entered. + pub current_phase: Option, + /// Resource ceilings declared by the factory. + pub declared_limits: FactoryDeclaredLimits, + /// Number of phases declared by the factory. + pub declared_phase_count: i64, + /// Human-readable factory description. + pub description: String, + /// Registered factory name. + pub factory_name: String, + /// Number of direct factory agents currently live. + pub live_agent_count: i64, + /// Epoch milliseconds when this live-overlay snapshot was observed. + pub observed_at: i64, + /// Monotonic durable run revision. + pub revision: i64, + /// Factory run identifier. + pub run_id: String, + /// Epoch milliseconds when execution first started, or null before start. + pub started_at: Option, + /// Current factory run status. + pub status: FactoryRunStatus, + /// Terminal run outcome, or null while nonterminal. + pub terminal: Option, + /// Total direct factory agents spawned across all attempts. + pub total_spawned_agent_count: i64, + /// Epoch milliseconds when the durable run was last updated. + pub updated_at: i64, } -/// Indicates whether an in-progress background compaction was cancelled. +/// A page of factory runs in durable creation order. /// ///
/// @@ -5451,12 +5340,24 @@ pub struct HistoryAbortManualCompactionResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct HistoryCancelBackgroundCompactionResult { - /// Whether an in-progress background compaction was cancelled. False when no compaction was running, when the session is remote, or when the underlying processor was unavailable. - pub cancelled: bool, +pub struct FactoryListRunsResult { + /// Whether terminal runs newer than this page exist. + #[serde(skip_serializing_if = "Option::is_none")] + pub has_more_newer: Option, + /// Newest terminal-run cursor in this page, or null when the terminal window is empty. + #[serde(skip_serializing_if = "Option::is_none")] + pub newest_seq: Option, + /// Oldest terminal-run cursor in this page, or null when the terminal window is empty. + #[serde(skip_serializing_if = "Option::is_none")] + pub oldest_seq: Option, + /// Number of terminal runs older than this page. + #[serde(skip_serializing_if = "Option::is_none")] + pub omitted_older: Option, + /// Factory run summaries in durable creation order. + pub runs: Vec, } -/// Parameters for clearing the conversation and seeding the window that replaces it. +/// One ordered factory progress line. /// ///
/// @@ -5466,12 +5367,16 @@ pub struct HistoryCancelBackgroundCompactionResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct HistoryClearContextRequest { - /// First user message of the fresh context window. Required: a cleared window holding only system and developer messages is not a conversation a model can answer, so every clear seeds the window it creates. Delivered by the enclosing turn driver once the agentic loop exits, which is why the call must be made from inside a tool handler. - pub prompt: String, +pub struct FactoryLogLine { + /// Progress line kind. + pub kind: FactoryLogLineKind, + /// Monotonic sequence number within the factory run. + pub seq: i64, + /// Progress text. + pub text: String, } -/// What a successful clear removed. A clear that could not be applied rejects instead of reporting a count. +/// Parameters for recording factory progress. /// ///
/// @@ -5481,12 +5386,16 @@ pub struct HistoryClearContextRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct HistoryClearContextResult { - /// Number of non-system, non-developer messages that were removed from the conversation. Zero only when the window already held no conversation. - pub messages_cleared: i64, +pub struct FactoryLogRequest { + /// Opaque token identifying the current factory execution attempt. + pub execution_token: String, + /// Ordered progress lines to append. + pub lines: Vec, + /// Factory run identifier. + pub run_id: String, } -/// Post-compaction context window usage breakdown +/// Durable lifecycle and timing for one factory phase. /// ///
/// @@ -5496,25 +5405,39 @@ pub struct HistoryClearContextResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct HistoryCompactContextWindow { - /// Token count from non-system messages (user, assistant, tool) +pub struct FactoryPhaseObservation { + /// Completed active time accumulated by this phase in milliseconds. + pub accumulated_active_ms: i64, + /// Epoch milliseconds when this phase completed; for a skipped phase, the synthetic skip timestamp (equal to `startedAt`). #[serde(skip_serializing_if = "Option::is_none")] - pub conversation_tokens: Option, - /// Current total tokens in the context window (system + conversation + tool definitions) - pub current_tokens: i64, - /// Current number of messages in the conversation - pub messages_length: i64, - /// Token count from system message(s) + pub completed_at: Option, + /// Current live active time for this phase in milliseconds. + pub current_active_ms: i64, + /// Optional human-readable phase detail. #[serde(skip_serializing_if = "Option::is_none")] - pub system_tokens: Option, - /// Maximum token count for the model's context window - pub token_limit: i64, - /// Token count from tool definitions + pub detail: Option, + /// Number of times execution entered this phase. + pub entry_count: i64, + /// Phase identifier. + pub id: String, + /// Most recent run attempt that entered this phase, or `0` if the phase has never been entered. + pub last_entered_run_attempt: i64, + /// Direct agents in this phase that are currently live. + pub live_agent_count: i64, + /// Zero-based declared phase ordinal, or null for an undeclared phase. + pub ordinal: Option, + /// Epoch milliseconds when this phase first started; for a skipped phase, the synthetic skip timestamp (equal to `completedAt`). #[serde(skip_serializing_if = "Option::is_none")] - pub tool_definitions_tokens: Option, + pub started_at: Option, + /// Derived lifecycle state of the phase. + pub status: FactoryPhaseStatus, + /// Human-readable phase title. + pub title: String, + /// Total direct agents associated with this phase. + pub total_agent_count: i64, } -/// Optional compaction parameters. +/// One durable factory progress record. /// ///
/// @@ -5524,19 +5447,22 @@ pub struct HistoryCompactContextWindow { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct HistoryCompactRequest { - /// Optional user-provided instructions to focus the compaction summary - #[serde(skip_serializing_if = "Option::is_none")] - pub custom_instructions: Option, - /// Context window token limit this compaction is targeting, recorded as the `tokenLimit` on the persisted `session.compaction_start` / `session.compaction_complete` events. Set it when the compaction targets a window other than the compacting model's own, e.g. switching to a model with a smaller context window: the compaction still runs on the current model, so the limit that motivated it would otherwise be lost. When absent, the events record the compacting model's own resolved limit. Attribution metadata only - it does not change how much the compaction removes. - #[serde(skip_serializing_if = "Option::is_none")] - pub token_limit: Option, - /// What initiated this compaction request, recorded as the `trigger` on the persisted `session.compaction_start` / `session.compaction_complete` events. When absent, the compaction is persisted without trigger attribution (initiator unknown). - #[serde(skip_serializing_if = "Option::is_none")] - pub trigger: Option, +pub struct FactoryProgressLine { + /// Resume attempt that emitted this record. + pub attempt: i64, + /// Progress record kind. + pub kind: FactoryLogLineKind, + /// Phase active when the record was emitted, or null before any phase. + pub phase_id: Option, + /// Epoch milliseconds when the record was persisted. + pub recorded_at: i64, + /// Global monotonic sequence number within the run. + pub seq: i64, + /// Prompt-safe progress text. + pub text: String, } -/// Compaction outcome with the number of tokens and messages removed, summary text, and the resulting context window breakdown. +/// A bidirectional page of factory progress. /// ///
/// @@ -5546,22 +5472,22 @@ pub struct HistoryCompactRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct HistoryCompactResult { - /// Post-compaction context window usage breakdown - #[serde(skip_serializing_if = "Option::is_none")] - pub context_window: Option, - /// Number of messages removed during compaction - pub messages_removed: i64, - /// Whether compaction completed successfully - pub success: bool, - /// Summary text produced by compaction. Omitted when compaction did not produce a summary (e.g. failure path). - #[serde(skip_serializing_if = "Option::is_none")] - pub summary_content: Option, - /// Number of tokens freed by compaction - pub tokens_removed: i64, +pub struct FactoryProgressPage { + /// Whether progress records newer than this page exist. + pub has_more_newer: bool, + /// Whether progress records older than this page exist. + pub has_more_older: bool, + /// Newest sequence number in this page, or null when empty. + pub newest_seq: Option, + /// Oldest sequence number in this page, or null when empty. + pub oldest_seq: Option, + /// Progress records in sequence order. + pub records: Vec, + /// Run revision reflected by this page. + pub revision: i64, } -/// A root user turn that the session can rewind to. +/// Wire-only per-invocation factory resource ceiling overrides. /// ///
/// @@ -5571,28 +5497,22 @@ pub struct HistoryCompactResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct HistoryRewindPoint { - /// Whether at least one file in this turn or a later turn can be restored. - pub can_restore_files: bool, - /// ID of the user.message event that begins the discarded suffix. - pub event_id: String, - /// Number of unique files in this turn and all later turns that have captured changes. - pub file_count: i64, - /// Whether this turn was an automatically injected autopilot continuation. - pub is_autopilot_continuation: bool, - /// Lines added by this turn's captured file changes. - pub lines_added: i64, - /// Lines removed by this turn's captured file changes. - pub lines_removed: i64, - /// ISO timestamp of the user turn. - pub timestamp: String, - /// Whether this turn itself captured any file changes. - pub turn_changed_files: bool, - /// User-visible message text for the turn. - pub user_message: String, +pub struct 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. + #[serde(skip_serializing_if = "Option::is_none")] + pub max_ai_credits: Option, + /// Maximum number of factory subagents that may run concurrently. + #[serde(skip_serializing_if = "Option::is_none")] + pub max_concurrent_subagents: Option, + /// Maximum total number of factory subagents that may be admitted. + #[serde(skip_serializing_if = "Option::is_none")] + pub max_total_subagents: Option, + /// 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. + #[serde(skip_serializing_if = "Option::is_none")] + pub timeout_seconds: Option, } -/// Rewind points and file-change-tracking availability for the session. +/// Parameters for resuming a factory run from its persisted identity. /// ///
/// @@ -5602,17 +5522,15 @@ pub struct HistoryRewindPoint { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct HistoryListRewindPointsResult { - /// Whether this session captured file changes from its first turn. - pub file_change_tracking_enabled: bool, - /// Root user turns in chronological order. Empty when `unavailableReason` is set. - pub points: Vec, - /// Why the listed points could not be produced, when applicable; the points list is empty whenever it is set. `unsupported-remote-session` is permanent for the session and comes with `fileChangeTrackingEnabled: false`. `session-busy` is transient and only ever reported by a session that *is* tracking (`fileChangeTrackingEnabled: true`), because the file-change captures cannot be read while work that may still mutate them is in flight; the same request succeeds once the session settles, so a client that wants points should retry rather than treat it as a failure. It is never `file-change-tracking-disabled`: an untracked local session still lists conversation-only points and reports that through `fileChangeTrackingEnabled: false`. +pub struct FactoryResumeRequest { + /// Optional per-invocation resource ceiling overrides. #[serde(skip_serializing_if = "Option::is_none")] - pub unavailable_reason: Option, + pub limits: Option, + /// Factory run identifier. + pub run_id: String, } -/// Event boundary to preview for conversation-and-files rewind. +/// Complete current or terminal factory run envelope. /// ///
/// @@ -5622,12 +5540,29 @@ pub struct HistoryListRewindPointsResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct HistoryPreviewRewindRequest { - /// ID of the user.message event that begins the discarded suffix. - pub event_id: String, +pub struct FactoryRunResult { + /// Error message for an errored run. + #[serde(skip_serializing_if = "Option::is_none")] + pub error: Option, + /// Machine-readable failure details for an errored run. + #[serde(skip_serializing_if = "Option::is_none")] + pub failure: Option, + /// Reason for a halted or cancelled run. + #[serde(skip_serializing_if = "Option::is_none")] + pub reason: Option, + /// Completed factory result. + #[serde(skip_serializing_if = "Option::is_none")] + pub result: Option, + /// Factory run identifier. + pub run_id: String, + /// Partial journal and progress snapshot for a halted, cancelled, or errored run. + #[serde(skip_serializing_if = "Option::is_none")] + pub snapshot: Option, + /// Current or terminal factory run status. + pub status: FactoryRunStatus, } -/// A file that a conversation-and-files rewind would restore. +/// Resolved persisted factory identity and resumed run envelope. /// ///
/// @@ -5637,18 +5572,14 @@ pub struct HistoryPreviewRewindRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct HistoryRewindFilePreview { - /// Aggregate change made across the discarded turns. - pub change_type: HistoryRewindChangeType, - /// Lines added across the discarded turns. - pub lines_added: i64, - /// Lines removed across the discarded turns. - pub lines_removed: i64, - /// Absolute path of the captured file. - pub path: String, +pub struct FactoryResumeResult { + /// Persisted factory name resolved for the resumed run. + pub factory_name: String, + /// Terminal resumed run envelope. + pub run: FactoryRunResult, } -/// Files and aggregate changes for a prospective rewind. +/// Full factory run observability detail. /// ///
/// @@ -5658,19 +5589,54 @@ pub struct HistoryRewindFilePreview { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct HistoryPreviewRewindResult { - /// Whether file restore is available for this session. This is authoritative: switch on it and read `reason` only when it is false. - pub available: bool, - /// Number of unique files in the preview. - pub file_count: i64, - /// Files ordered by path. - pub files: Vec, - /// Why file restore is unavailable, when applicable. Populated only when `available` is false and never set when `available` is true. - #[serde(skip_serializing_if = "Option::is_none")] - pub reason: Option, +pub struct FactoryRunDetail { + /// Epoch milliseconds when the current active segment started, or null while inactive. + pub active_segment_started_at: Option, + /// Durable identities and live statuses for direct factory agents. + pub agents: Vec, + /// Approved effective resource ceilings, or null until approved. + pub approved: Option, + /// Epoch milliseconds when the run completed, or null while nonterminal. + pub completed_at: Option, + /// Durable resource consumption. + pub consumed: FactoryRunConsumed, + /// Epoch milliseconds when the run was created. + pub created_at: i64, + /// Current phase identity, or null before any phase is entered. + pub current_phase: Option, + /// Resource ceilings declared by the factory. + pub declared_limits: FactoryDeclaredLimits, + /// Number of phases declared by the factory. + pub declared_phase_count: i64, + /// Human-readable factory description. + pub description: String, + /// Registered factory name. + pub factory_name: String, + /// Number of direct factory agents currently live. + pub live_agent_count: i64, + /// Epoch milliseconds when this live-overlay snapshot was observed. + pub observed_at: i64, + /// Lifecycle and timing observations for each factory phase. + pub phases: Vec, + /// Bidirectional page of durable factory progress. + pub progress: FactoryProgressPage, + /// Monotonic durable run revision. + pub revision: i64, + /// Factory run identifier. + pub run_id: String, + /// Epoch milliseconds when execution first started, or null before start. + pub started_at: Option, + /// Current factory run status. + pub status: FactoryRunStatus, + /// Terminal run outcome, or null while nonterminal. + pub terminal: Option, + /// Total direct factory agents spawned across all attempts. + pub total_spawned_agent_count: i64, + /// Epoch milliseconds when the durable run was last updated. + pub updated_at: i64, } -/// Boundary and mode for rewinding session history. +/// Options controlling factory invocation. /// ///
/// @@ -5680,14 +5646,16 @@ pub struct HistoryPreviewRewindResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct HistoryRewindRequest { - /// ID of the user.message event that begins the discarded suffix. - pub event_id: String, - /// Whether to rewind only conversation history or also restore captured files. - pub mode: HistoryRewindMode, +pub struct RunOptions { + /// Per-invocation resource ceiling overrides. + #[serde(skip_serializing_if = "Option::is_none")] + pub limits: Option, + /// Run identifier whose journal and progress should seed this resumed run. + #[serde(skip_serializing_if = "Option::is_none")] + pub resume_from_run_id: Option, } -/// A captured file that rewind intentionally left unchanged. +/// Parameters for invoking a registered factory. /// ///
/// @@ -5697,14 +5665,17 @@ pub struct HistoryRewindRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct HistorySkippedFileRestore { - /// Absolute path of the skipped file. - pub path: String, - /// Reason the file was not restored. - pub reason: HistoryFileRestoreSkipReason, +pub struct FactoryRunRequest { + /// Factory input value. + pub args: serde_json::Value, + /// Registered factory name. + pub name: String, + /// Factory invocation options. + #[serde(skip_serializing_if = "Option::is_none")] + pub options: Option, } -/// Structured outcome of a rewind request. +/// Optional user prompt to combine with the fleet orchestration instructions. /// ///
/// @@ -5714,22 +5685,13 @@ pub struct HistorySkippedFileRestore { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct HistoryRewindResult { - /// Failure detail. Set only for the failure and partial-failure outcomes (`files-rolled-back`, `rollback-incomplete`, `truncation-failed`, `checkpoint-cleanup-failed`, `snapshot-prune-failed`); omitted for `success` and for the unavailable outcomes (`session-busy`, `file-change-tracking-disabled`, `unsupported-remote-session`). - #[serde(skip_serializing_if = "Option::is_none")] - pub error: Option, - /// Number of persisted events removed by conversation truncation. Present only when truncation succeeded (outcomes `success`, `checkpoint-cleanup-failed`, and `snapshot-prune-failed`); omitted for every unavailable outcome (`session-busy`, `file-change-tracking-disabled`, `unsupported-remote-session`) and for `truncation-failed`, `files-rolled-back`, and `rollback-incomplete`. +pub struct FleetStartRequest { + /// Optional user prompt to combine with fleet instructions #[serde(skip_serializing_if = "Option::is_none")] - pub events_removed: Option, - /// Overall rewind outcome. This discriminates the result: it governs which of the remaining fields are populated, so consumers must switch on it before reading `eventsRemoved`, `restoredFiles`, `skippedFiles`, or `error`. See each field for the outcomes that populate it. - pub outcome: HistoryRewindOutcome, - /// Absolute paths restored to their captured preimages. Always empty for conversation-only rewinds and for the unavailable outcomes (`session-busy`, `file-change-tracking-disabled`, `unsupported-remote-session`); only conversation-and-files outcomes that reached the file-restore stage populate it. - pub restored_files: Vec, - /// Captured files intentionally left unchanged. Always empty for conversation-only rewinds and for the unavailable outcomes (`session-busy`, `file-change-tracking-disabled`, `unsupported-remote-session`); only conversation-and-files outcomes that reached the file-restore stage populate it. - pub skipped_files: Vec, + pub prompt: Option, } -/// Markdown summary of the conversation context (empty when not available). +/// Indicates whether fleet mode was successfully activated. /// ///
/// @@ -5739,12 +5701,12 @@ pub struct HistoryRewindResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct HistorySummarizeForHandoffResult { - /// Markdown summary of the conversation context produced by an LLM. Empty string when there are no messages or when the session does not support local summarization. - pub summary: String, +pub struct FleetStartResult { + /// Whether fleet mode was successfully activated + pub started: bool, } -/// Identifier of the event to truncate to; this event and all later events are removed. +/// Folder path to add to trusted folders. /// ///
/// @@ -5754,12 +5716,12 @@ pub struct HistorySummarizeForHandoffResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct HistoryTruncateRequest { - /// Event ID to truncate to. This event and all events after it are removed from the session. - pub event_id: String, +pub struct FolderTrustAddParams { + /// Folder path to mark as trusted + pub path: String, } -/// Number of events that were removed by the truncation. +/// Folder path to check for trust. /// ///
/// @@ -5769,36 +5731,27 @@ pub struct HistoryTruncateRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct HistoryTruncateResult { - /// Failure detail when checkpointCleanupFailed is true. - #[serde(skip_serializing_if = "Option::is_none")] - pub checkpoint_cleanup_error: Option, - /// True when conversation truncation succeeded but post-truncation workspace checkpoint cleanup failed. History is already truncated; callers may still prune snapshots but should report a checkpoint-cleanup rather than a truncation failure. - #[serde(skip_serializing_if = "Option::is_none")] - pub checkpoint_cleanup_failed: Option, - /// Number of events that were removed - pub events_removed: i64, -} - -/// Runtime-owned wire payload for a server-to-client hook callback invocation. -#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub(crate) struct HookInvokeRequest { - #[doc(hidden)] - pub(crate) hook_type: HookType, - pub input: serde_json::Value, - pub session_id: SessionId, +pub struct FolderTrustCheckParams { + /// Folder path to check + pub path: String, } -/// Optional output returned by an SDK callback hook. +/// Folder trust check result. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub(crate) struct HookInvokeResponse { - #[serde(skip_serializing_if = "Option::is_none")] - pub output: Option, +pub struct FolderTrustCheckResult { + /// Whether the folder is trusted + pub trusted: bool, } -/// Installed plugin record from global state, with marketplace, version, install time, enabled state, cache path, and source. +/// Client environment metadata describing the process that produced a telemetry event. /// ///
/// @@ -5808,31 +5761,40 @@ pub(crate) struct HookInvokeResponse { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct InstalledPlugin { - /// Path where the plugin is cached locally - #[serde(rename = "cache_path", skip_serializing_if = "Option::is_none")] - pub cache_path: Option, - /// Whether the plugin is currently enabled - pub enabled: bool, - /// Installation timestamp - #[serde(rename = "installed_at")] - pub installed_at: String, - /// Marketplace the plugin came from (empty string for direct repo installs) - pub marketplace: String, - /// Plugin name - pub name: String, - /// Source for direct repo installs (when marketplace is empty) - #[serde(skip_serializing_if = "Option::is_none")] - pub source: Option, - /// 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. - #[serde(rename = "source_sha", skip_serializing_if = "Option::is_none")] - pub source_sha: Option, - /// Version installed (if available) - #[serde(skip_serializing_if = "Option::is_none")] - pub version: Option, +pub struct GitHubTelemetryClientInfo { + /// Copilot CLI version string. + #[serde(rename = "cli_version")] + pub cli_version: String, + /// Name of the client application. + #[serde(rename = "client_name", skip_serializing_if = "Option::is_none")] + pub client_name: Option, + /// Type of client. + #[serde(rename = "client_type", skip_serializing_if = "Option::is_none")] + pub client_type: Option, + /// Copilot subscription plan, when known. + #[serde(rename = "copilot_plan", skip_serializing_if = "Option::is_none")] + pub copilot_plan: Option, + /// Stable machine identifier for the device. + #[serde(rename = "dev_device_id", skip_serializing_if = "Option::is_none")] + pub dev_device_id: Option, + /// Whether the user is a GitHub/Microsoft staff member. + #[serde(rename = "is_staff", skip_serializing_if = "Option::is_none")] + pub is_staff: Option, + /// Node.js runtime version string. + #[serde(rename = "node_version")] + pub node_version: String, + /// Operating system architecture (e.g. arm64, x64). + #[serde(rename = "os_arch")] + pub os_arch: String, + /// Operating system platform (e.g. darwin, linux, win32). + #[serde(rename = "os_platform")] + pub os_platform: String, + /// Operating system version string. + #[serde(rename = "os_version")] + pub os_version: String, } -/// Information about an installed plugin tracked in global state. +/// A single telemetry event in the runtime's native GitHub-shaped telemetry format, forwarded verbatim to opted-in hosts. The `restricted` flag on the enclosing GitHubTelemetryNotification distinguishes standard from restricted events; the payload shape is identical for both. /// ///
/// @@ -5842,22 +5804,43 @@ pub struct InstalledPlugin { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct 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. - #[serde(skip_serializing_if = "Option::is_none")] - pub direct_source_id: Option, - /// Whether the plugin is currently enabled for new sessions - pub enabled: bool, - /// Marketplace the plugin came from. Empty string ("") for direct repo / URL / local installs. - pub marketplace: String, - /// Plugin name - pub name: String, - /// Installed version (when reported by the plugin manifest) +pub struct GitHubTelemetryEvent { + /// Client environment metadata. #[serde(skip_serializing_if = "Option::is_none")] - pub version: Option, + pub client: Option, + /// Copilot tracking ID for user-level attribution. + #[serde( + rename = "copilot_tracking_id", + skip_serializing_if = "Option::is_none" + )] + pub copilot_tracking_id: Option, + /// Timestamp when the event was created (ISO 8601 format). + #[serde(rename = "created_at", skip_serializing_if = "Option::is_none")] + pub created_at: Option, + /// Experiment assignment context. + #[serde( + rename = "exp_assignment_context", + skip_serializing_if = "Option::is_none" + )] + pub exp_assignment_context: Option, + /// Feature flags enabled for this session, as a map from flag to value. + #[serde(skip_serializing_if = "Option::is_none")] + pub features: Option>, + /// Event type/kind (e.g. get_completion_with_tools_turn, tool_call_executed). + pub kind: String, + /// Numeric metrics as a map from key to value. + pub metrics: HashMap, + /// Reference to the model call that produced this event. + #[serde(rename = "model_call_id", skip_serializing_if = "Option::is_none")] + pub model_call_id: Option, + /// String-valued properties as a map from key to value. + pub properties: HashMap, + /// Session identifier the event belongs to. + #[serde(rename = "session_id", skip_serializing_if = "Option::is_none")] + pub session_id: Option, } -/// Source descriptor for a direct GitHub plugin install, with `owner/repo`, optional ref or full commit SHA, and optional subpath. +/// Payload for a `gitHubTelemetry.event` notification: a single GitHub telemetry event the runtime forwards to a host connection that opted into telemetry forwarding during the `server.connect` handshake. /// ///
/// @@ -5867,23 +5850,38 @@ pub struct InstalledPluginInfo { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct InstalledPluginSourceGitHub { - /// Optional repository-relative path to the plugin. +pub struct GitHubTelemetryNotification { + /// The telemetry event, in the runtime's native GitHub-shaped telemetry format. + pub event: GitHubTelemetryEvent, + /// Whether this is a restricted telemetry event (cli.restricted_telemetry). Hosts must route restricted events to first-party Microsoft stores only. + pub restricted: bool, + /// Session the telemetry event belongs to, when it is session-scoped. Omitted for sessionless events (for example, `server.sendTelemetry` calls with no session id), which are still forwarded to opted-in connections. #[serde(skip_serializing_if = "Option::is_none")] - pub path: Option, - /// Optional Git ref to resolve. + pub session_id: Option, +} + +/// Pending external tool call request ID, with the tool result or an error describing why it failed. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct HandlePendingToolCallRequest { + /// Error message if the tool call failed #[serde(skip_serializing_if = "Option::is_none")] - pub r#ref: Option, - /// GitHub repository in `owner/repo` form. - pub repo: String, - /// Optional full 40-character hexadecimal commit SHA. + pub error: Option, + /// Request ID of the pending tool call + pub request_id: RequestId, + /// Tool call result (string or expanded result object) #[serde(skip_serializing_if = "Option::is_none")] - pub sha: Option, - /// Constant value. Always "github". - pub source: InstalledPluginSourceGitHubSource, + pub result: Option, } -/// Source descriptor for a direct local plugin install, with a local filesystem path. +/// Indicates whether the external tool call result was handled successfully. /// ///
/// @@ -5893,14 +5891,12 @@ pub struct InstalledPluginSourceGitHub { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct InstalledPluginSourceLocal { - /// Local filesystem path to the plugin. - pub path: String, - /// Constant value. Always "local". - pub source: InstalledPluginSourceLocalSource, +pub struct HandlePendingToolCallResult { + /// Whether the tool call result was handled successfully + pub success: bool, } -/// Source descriptor for a direct URL plugin install, with URL, optional ref or full commit SHA, and optional subpath. +/// Indicates whether an in-progress manual compaction was aborted. /// ///
/// @@ -5910,23 +5906,12 @@ pub struct InstalledPluginSourceLocal { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct InstalledPluginSourceUrl { - /// Optional source-relative path to the plugin. - #[serde(skip_serializing_if = "Option::is_none")] - pub path: Option, - /// Optional Git ref to resolve. - #[serde(skip_serializing_if = "Option::is_none")] - pub r#ref: Option, - /// Optional full 40-character hexadecimal commit SHA. - #[serde(skip_serializing_if = "Option::is_none")] - pub sha: Option, - /// Constant value. Always "url". - pub source: InstalledPluginSourceUrlSource, - /// URL of the plugin source. - pub url: String, +pub struct HistoryAbortManualCompactionResult { + /// Whether an in-progress manual compaction was aborted. False when no manual compaction was running, when its abort controller was already aborted, or when the session is remote. + pub aborted: bool, } -/// Canonical file or directory where custom instructions can be discovered or created, with location, kind, preference, and project path. +/// Indicates whether an in-progress background compaction was cancelled. /// ///
/// @@ -5936,21 +5921,12 @@ pub struct InstalledPluginSourceUrl { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct InstructionDiscoveryPath { - /// Whether the target is a single file or a directory of instruction files - pub kind: InstructionDiscoveryPathKind, - /// Which tier this target belongs to - pub location: InstructionDiscoveryPathLocation, - /// Absolute path of the file or directory (may not exist on disk yet) - pub path: String, - /// Whether this is the canonical target to create new instructions in its tier. At most one entry per tier is preferred. - pub preferred_for_creation: bool, - /// The input project path this target was derived from (only for repository targets) - #[serde(skip_serializing_if = "Option::is_none")] - pub project_path: Option, +pub struct HistoryCancelBackgroundCompactionResult { + /// Whether an in-progress background compaction was cancelled. False when no compaction was running, when the session is remote, or when the underlying processor was unavailable. + pub cancelled: bool, } -/// Canonical files and directories where custom instructions can be created so the runtime will recognize them. +/// Parameters for clearing the conversation and seeding the window that replaces it. /// ///
/// @@ -5960,12 +5936,12 @@ pub struct InstructionDiscoveryPath { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct InstructionDiscoveryPathList { - /// Canonical instruction create/discovery files and directories, in priority order - pub paths: Vec, +pub struct HistoryClearContextRequest { + /// First user message of the fresh context window. Required: a cleared window holding only system and developer messages is not a conversation a model can answer, so every clear seeds the window it creates. Delivered by the enclosing turn driver once the agentic loop exits, which is why the call must be made from inside a tool handler. + pub prompt: String, } -/// Optional project paths to include in instruction discovery. +/// What a successful clear removed. A clear that could not be applied rejects instead of reporting a count. /// ///
/// @@ -5975,16 +5951,12 @@ pub struct InstructionDiscoveryPathList { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct 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. - #[serde(skip_serializing_if = "Option::is_none")] - pub exclude_host_instructions: Option, - /// 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). - #[serde(skip_serializing_if = "Option::is_none")] - pub project_paths: Option>, +pub struct HistoryClearContextResult { + /// Number of non-system, non-developer messages that were removed from the conversation. Zero only when the window already held no conversation. + pub messages_cleared: i64, } -/// Optional project paths to include when enumerating instruction discovery targets. +/// Post-compaction context window usage breakdown /// ///
/// @@ -5994,16 +5966,25 @@ pub struct InstructionsDiscoverRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct InstructionsGetDiscoveryPathsRequest { - /// When true, omit the host's user-level instruction targets, leaving only repository targets. For multitenant deployments (mirrors `discover`'s `excludeHostInstructions`). +pub struct HistoryCompactContextWindow { + /// Token count from non-system messages (user, assistant, tool) #[serde(skip_serializing_if = "Option::is_none")] - pub exclude_host_instructions: Option, - /// Optional list of project directory paths. When omitted or empty, only the user-level targets are returned. + pub conversation_tokens: Option, + /// Current total tokens in the context window (system + conversation + tool definitions) + pub current_tokens: i64, + /// Current number of messages in the conversation + pub messages_length: i64, + /// Token count from system message(s) #[serde(skip_serializing_if = "Option::is_none")] - pub project_paths: Option>, + pub system_tokens: Option, + /// Maximum token count for the model's context window + pub token_limit: i64, + /// Token count from tool definitions + #[serde(skip_serializing_if = "Option::is_none")] + pub tool_definitions_tokens: Option, } -/// Loaded instruction source for a session, including path, content, category, location, applicability, and optional description. +/// Optional compaction parameters. /// ///
/// @@ -6013,34 +5994,19 @@ pub struct InstructionsGetDiscoveryPathsRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct InstructionSource { - /// Glob pattern(s) from frontmatter — when set, this instruction applies only to matching files - #[serde(skip_serializing_if = "Option::is_none")] - pub apply_to: Option>, - /// Raw content of the instruction file - pub content: String, - /// When true, this source starts disabled and must be toggled on by the user +pub struct HistoryCompactRequest { + /// Optional user-provided instructions to focus the compaction summary #[serde(skip_serializing_if = "Option::is_none")] - pub default_disabled: Option, - /// Short description (body after frontmatter) for use in instruction tables + pub custom_instructions: Option, + /// Context window token limit this compaction is targeting, recorded as the `tokenLimit` on the persisted `session.compaction_start` / `session.compaction_complete` events. Set it when the compaction targets a window other than the compacting model's own, e.g. switching to a model with a smaller context window: the compaction still runs on the current model, so the limit that motivated it would otherwise be lost. When absent, the events record the compacting model's own resolved limit. Attribution metadata only - it does not change how much the compaction removes. #[serde(skip_serializing_if = "Option::is_none")] - pub description: Option, - /// Unique identifier for this source (used for toggling) - pub id: String, - /// Human-readable label - pub label: String, - /// Where this source lives — used for UI grouping - pub location: InstructionSourceLocation, - /// 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. + pub token_limit: Option, + /// What initiated this compaction request, recorded as the `trigger` on the persisted `session.compaction_start` / `session.compaction_complete` events. When absent, the compaction is persisted without trigger attribution (initiator unknown). #[serde(skip_serializing_if = "Option::is_none")] - pub project_path: Option, - /// File path relative to repo or absolute for home - pub source_path: String, - /// Category of instruction source — used for merge logic - pub r#type: InstructionSourceType, + pub trigger: Option, } -/// Instruction sources loaded for the session, in merge order. +/// Compaction outcome with the number of tokens and messages removed, summary text, and the resulting context window breakdown. /// ///
/// @@ -6050,12 +6016,22 @@ pub struct InstructionSource { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct InstructionsGetSourcesResult { - /// Instruction sources for the session - pub sources: Vec, +pub struct HistoryCompactResult { + /// Post-compaction context window usage breakdown + #[serde(skip_serializing_if = "Option::is_none")] + pub context_window: Option, + /// Number of messages removed during compaction + pub messages_removed: i64, + /// Whether compaction completed successfully + pub success: bool, + /// Summary text produced by compaction. Omitted when compaction did not produce a summary (e.g. failure path). + #[serde(skip_serializing_if = "Option::is_none")] + pub summary_content: Option, + /// Number of tokens freed by compaction + pub tokens_removed: i64, } -/// Parameters for interrupting the main agent turn. +/// A root user turn that the session can rewind to. /// ///
/// @@ -6065,13 +6041,28 @@ pub struct InstructionsGetSourcesResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct 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. - #[serde(skip_serializing_if = "Option::is_none")] - pub flush_queued: Option, +pub struct HistoryRewindPoint { + /// Whether at least one file in this turn or a later turn can be restored. + pub can_restore_files: bool, + /// ID of the user.message event that begins the discarded suffix. + pub event_id: String, + /// Number of unique files in this turn and all later turns that have captured changes. + pub file_count: i64, + /// Whether this turn was an automatically injected autopilot continuation. + pub is_autopilot_continuation: bool, + /// Lines added by this turn's captured file changes. + pub lines_added: i64, + /// Lines removed by this turn's captured file changes. + pub lines_removed: i64, + /// ISO timestamp of the user turn. + pub timestamp: String, + /// Whether this turn itself captured any file changes. + pub turn_changed_files: bool, + /// User-visible message text for the turn. + pub user_message: String, } -/// Result of interrupting the main agent turn. +/// Rewind points and file-change-tracking availability for the session. /// ///
/// @@ -6081,79 +6072,32 @@ pub struct InterruptMainTurnRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct InterruptMainTurnResult { - /// Whether an in-flight main agent turn was interrupted. False when the main loop was not processing. - pub interrupted: bool, +pub struct HistoryListRewindPointsResult { + /// Whether this session captured file changes from its first turn. + pub file_change_tracking_enabled: bool, + /// Root user turns in chronological order. Empty when `unavailableReason` is set. + pub points: Vec, + /// Why the listed points could not be produced, when applicable; the points list is empty whenever it is set. `unsupported-remote-session` is permanent for the session and comes with `fileChangeTrackingEnabled: false`. `session-busy` is transient and only ever reported by a session that *is* tracking (`fileChangeTrackingEnabled: true`), because the file-change captures cannot be read while work that may still mutate them is in flight; the same request succeeds once the session settles, so a client that wants points should retry rather than treat it as a failure. It is never `file-change-tracking-disabled`: an untracked local session still lists conversation-only points and reports that through `fileChangeTrackingEnabled: false`. + #[serde(skip_serializing_if = "Option::is_none")] + pub unavailable_reason: Option, } -/// A request body chunk or cancellation signal. -#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct LlmInferenceHttpRequestChunkRequest { - /// Identity of the agent invocation (one agentic loop) this body chunk belongs to, matching the `agentInvocationId` semantics on httpRequestStart. Carried per chunk so a persistent transport can attribute successive turns correctly: when a WebSocket connection is reused across turns, the httpRequestStart identity reflects only the turn that opened the connection, so each later turn stamps its own invocation id here. Absent when the runtime has no invocation context for the request, or on the plain-HTTP transport where every request has its own httpRequestStart. - #[serde(skip_serializing_if = "Option::is_none")] - pub agent_invocation_id: Option, - /// When true, `data` is base64-encoded bytes. When absent or false, `data` is UTF-8 text. - #[serde(skip_serializing_if = "Option::is_none")] - pub binary: Option, - /// When true, the runtime is cancelling the in-flight request (e.g. upstream consumer aborted). `data` is ignored. Implies end-of-request. - #[serde(skip_serializing_if = "Option::is_none")] - pub cancel: Option, - /// Optional human-readable reason for the cancellation, propagated for logging. - #[serde(skip_serializing_if = "Option::is_none")] - pub cancel_reason: Option, - /// Body byte range. UTF-8 text when `binary` is absent or false; base64-encoded bytes when `binary` is true. May be empty. - pub data: String, - /// When true, this is the final body chunk for the request. The SDK may rely on having received an end-marked chunk before treating the request body as complete. - #[serde(skip_serializing_if = "Option::is_none")] - pub end: Option, - /// Matches the requestId from the originating httpRequestStart frame. - pub request_id: RequestId, -} - -/// Acknowledgement. The SDK is free to ignore the ack and treat chunk delivery as fire-and-forget. -#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct LlmInferenceHttpRequestChunkResult {} - -/// The head of an outbound model-layer HTTP request. +/// Event boundary to preview for conversation-and-files rewind. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct LlmInferenceHttpRequestStartRequest { - /// Stable identity of the agent trajectory that issued this request. Present when the request originates from an agent turn; absent for requests outside any agent context. This is the same identity used by lifecycle and bridged session events and remains constant across turns and retries. - #[serde(skip_serializing_if = "Option::is_none")] - pub agent_id: Option, - /// Identity of the agent invocation (one agentic loop) that issued this request. It remains fixed across physical retries within the invocation and is distinct from the stable trajectory `agentId`. A caller-supplied invocation id always takes precedence (this covers auxiliary calls that have no model call id). Otherwise, first-party CAPI requests fall back to the runtime's agent task id — the same value the runtime emits as the `X-Agent-Task-Id` header — while custom-provider requests fall back to the model call id. - #[serde(skip_serializing_if = "Option::is_none")] - pub agent_invocation_id: Option, - /// HTTP request headers, preserving multiple values per name. - pub headers: HashMap>, - /// Coarse classification of the interaction that produced this request. Open string for forward-compatibility; known values include `conversation-agent`, `conversation-subagent`, `conversation-sampling`, `conversation-background`, `conversation-compaction`, and `conversation-user`. Absent when the runtime did not classify the request. Comes from the runtime's per-request agent context independently of transport; on the CAPI transport the runtime derives the upstream `X-Interaction-Type` header from this same context. - #[serde(skip_serializing_if = "Option::is_none")] - pub interaction_type: Option, - /// HTTP method, e.g. GET, POST. - pub method: String, - /// Stable identity of the immediate parent trajectory. Present for child trajectories such as subagents and conversation-sampling requests; absent for root-agent and non-agent requests. - #[serde(skip_serializing_if = "Option::is_none")] - pub parent_agent_id: Option, - /// Opaque runtime-minted id, unique per in-flight request. The SDK uses this to correlate httpRequestChunk frames and to address its httpResponseStart / httpResponseChunk replies back to the runtime. - pub request_id: RequestId, - /// Id of the runtime session that triggered this request, when one is in scope. Absent for requests issued outside any session (e.g. startup model-catalog or capability resolution). This is a payload field — not a dispatch key — because the client-global API is registered process-wide rather than per session. - #[serde(skip_serializing_if = "Option::is_none")] - pub session_id: Option, - /// Transport the runtime would otherwise use for this request. `http` (the default when absent) covers plain HTTP and SSE responses; `websocket` indicates a full-duplex message channel where each body chunk maps to one WebSocket message and the `binary` flag distinguishes text from binary frames. The SDK consumer uses this to decide whether to service the request with an HTTP client or a WebSocket client. It is the one piece of request metadata the consumer cannot reliably infer from the URL or headers alone. - #[serde(skip_serializing_if = "Option::is_none")] - pub transport: Option, - /// Absolute request URL. - pub url: String, +pub struct HistoryPreviewRewindRequest { + /// ID of the user.message event that begins the discarded suffix. + pub event_id: String, } -/// Acknowledgement. Returning successfully simply means the SDK accepted the start frame; it does not imply the request will succeed. -#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct LlmInferenceHttpRequestStartResult {} - -/// Set to terminate the response with a transport-level failure. Implies end-of-stream; any further chunks for this requestId are ignored. +/// A file that a conversation-and-files rewind would restore. /// ///
/// @@ -6163,15 +6107,18 @@ pub struct LlmInferenceHttpRequestStartResult {} ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct LlmInferenceHttpResponseChunkError { - /// Optional machine-readable error code. - #[serde(skip_serializing_if = "Option::is_none")] - pub code: Option, - /// Human-readable failure description. - pub message: String, +pub struct HistoryRewindFilePreview { + /// Aggregate change made across the discarded turns. + pub change_type: HistoryRewindChangeType, + /// Lines added across the discarded turns. + pub lines_added: i64, + /// Lines removed across the discarded turns. + pub lines_removed: i64, + /// Absolute path of the captured file. + pub path: String, } -/// A response body chunk or terminal error. +/// Files and aggregate changes for a prospective rewind. /// ///
/// @@ -6181,23 +6128,19 @@ pub struct LlmInferenceHttpResponseChunkError { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct LlmInferenceHttpResponseChunkRequest { - /// When true, `data` is base64-encoded bytes. When absent or false, `data` is UTF-8 text. - #[serde(skip_serializing_if = "Option::is_none")] - pub binary: Option, - /// 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). - pub data: String, - /// 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. - #[serde(skip_serializing_if = "Option::is_none")] - pub end: Option, - /// Set to terminate the response with a transport-level failure. Implies end-of-stream; any further chunks for this requestId are ignored. +pub struct HistoryPreviewRewindResult { + /// Whether file restore is available for this session. This is authoritative: switch on it and read `reason` only when it is false. + pub available: bool, + /// Number of unique files in the preview. + pub file_count: i64, + /// Files ordered by path. + pub files: Vec, + /// Why file restore is unavailable, when applicable. Populated only when `available` is false and never set when `available` is true. #[serde(skip_serializing_if = "Option::is_none")] - pub error: Option, - /// Matches the requestId from the originating httpRequestStart frame. - pub request_id: RequestId, + pub reason: Option, } -/// Whether the chunk was accepted. +/// Boundary and mode for rewinding session history. /// ///
/// @@ -6207,12 +6150,14 @@ pub struct LlmInferenceHttpResponseChunkRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct LlmInferenceHttpResponseChunkResult { - /// True when the chunk was matched to a pending request; false when unknown. - pub accepted: bool, +pub struct HistoryRewindRequest { + /// ID of the user.message event that begins the discarded suffix. + pub event_id: String, + /// Whether to rewind only conversation history or also restore captured files. + pub mode: HistoryRewindMode, } -/// Response head. +/// A captured file that rewind intentionally left unchanged. /// ///
/// @@ -6222,19 +6167,14 @@ pub struct LlmInferenceHttpResponseChunkResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct LlmInferenceHttpResponseStartRequest { - /// HTTP response headers, preserving multiple values per name. - pub headers: HashMap>, - /// Matches the requestId from the originating httpRequestStart frame. - pub request_id: RequestId, - /// HTTP status code. - pub status: i64, - /// Optional HTTP status reason phrase. - #[serde(skip_serializing_if = "Option::is_none")] - pub status_text: Option, +pub struct HistorySkippedFileRestore { + /// Absolute path of the skipped file. + pub path: String, + /// Reason the file was not restored. + pub reason: HistoryFileRestoreSkipReason, } -/// Whether the start frame was accepted. +/// Structured outcome of a rewind request. /// ///
/// @@ -6244,12 +6184,22 @@ pub struct LlmInferenceHttpResponseStartRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct LlmInferenceHttpResponseStartResult { - /// True when the response start was matched to a pending request; false when unknown. - pub accepted: bool, +pub struct HistoryRewindResult { + /// Failure detail. Set only for the failure and partial-failure outcomes (`files-rolled-back`, `rollback-incomplete`, `truncation-failed`, `checkpoint-cleanup-failed`, `snapshot-prune-failed`); omitted for `success` and for the unavailable outcomes (`session-busy`, `file-change-tracking-disabled`, `unsupported-remote-session`). + #[serde(skip_serializing_if = "Option::is_none")] + pub error: Option, + /// Number of persisted events removed by conversation truncation. Present only when truncation succeeded (outcomes `success`, `checkpoint-cleanup-failed`, and `snapshot-prune-failed`); omitted for every unavailable outcome (`session-busy`, `file-change-tracking-disabled`, `unsupported-remote-session`) and for `truncation-failed`, `files-rolled-back`, and `rollback-incomplete`. + #[serde(skip_serializing_if = "Option::is_none")] + pub events_removed: Option, + /// Overall rewind outcome. This discriminates the result: it governs which of the remaining fields are populated, so consumers must switch on it before reading `eventsRemoved`, `restoredFiles`, `skippedFiles`, or `error`. See each field for the outcomes that populate it. + pub outcome: HistoryRewindOutcome, + /// Absolute paths restored to their captured preimages. Always empty for conversation-only rewinds and for the unavailable outcomes (`session-busy`, `file-change-tracking-disabled`, `unsupported-remote-session`); only conversation-and-files outcomes that reached the file-restore stage populate it. + pub restored_files: Vec, + /// Captured files intentionally left unchanged. Always empty for conversation-only rewinds and for the unavailable outcomes (`session-busy`, `file-change-tracking-disabled`, `unsupported-remote-session`); only conversation-and-files outcomes that reached the file-restore stage populate it. + pub skipped_files: Vec, } -/// Indicates whether the calling client was registered as the LLM inference provider. +/// Markdown summary of the conversation context (empty when not available). /// ///
/// @@ -6259,12 +6209,12 @@ pub struct LlmInferenceHttpResponseStartResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct LlmInferenceSetProviderResult { - /// Whether the provider was set successfully - pub success: bool, +pub struct HistorySummarizeForHandoffResult { + /// Markdown summary of the conversation context produced by an LLM. Empty string when there are no messages or when the session does not support local summarization. + pub summary: String, } -/// Pre-resolved working-directory context for session startup. +/// Identifier of the event to truncate to; this event and all later events are removed. /// ///
/// @@ -6274,24 +6224,12 @@ pub struct LlmInferenceSetProviderResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionContext { - /// Active git branch - #[serde(skip_serializing_if = "Option::is_none")] - pub branch: Option, - /// Most recent working directory for this session - pub cwd: String, - /// Git repository root, if the cwd was inside a git repo - #[serde(skip_serializing_if = "Option::is_none")] - pub git_root: Option, - /// Repository host type - #[serde(skip_serializing_if = "Option::is_none")] - pub host_type: Option, - /// Repository slug in `owner/name` form, when known - #[serde(skip_serializing_if = "Option::is_none")] - pub repository: Option, +pub struct HistoryTruncateRequest { + /// Event ID to truncate to. This event and all events after it are removed from the session. + pub event_id: String, } -/// Persisted local session metadata, including identifiers, timestamps, summary/name, client, context, detached state, and task ID. +/// Number of events that were removed by the truncation. /// ///
/// @@ -6301,36 +6239,36 @@ pub struct SessionContext { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct LocalSessionMetadataValue { - /// Runtime client name that created/last resumed this session - #[serde(skip_serializing_if = "Option::is_none")] - pub client_name: Option, - /// Pre-resolved working-directory context for session startup. - #[serde(skip_serializing_if = "Option::is_none")] - pub context: Option, - /// True for detached maintenance sessions that should be hidden from normal resume lists. - #[serde(skip_serializing_if = "Option::is_none")] - pub is_detached: Option, - /// Always false for local sessions. - pub is_remote: bool, - /// GitHub task ID, when this local session is bound to one. Only present for local sessions exported to remote control. +pub struct HistoryTruncateResult { + /// Failure detail when checkpointCleanupFailed is true. #[serde(skip_serializing_if = "Option::is_none")] - pub mc_task_id: Option, - /// Last-modified time of the session's persisted state, as ISO 8601 - pub modified_time: String, - /// Optional human-friendly name set via /rename + pub checkpoint_cleanup_error: Option, + /// True when conversation truncation succeeded but post-truncation workspace checkpoint cleanup failed. History is already truncated; callers may still prune snapshots but should report a checkpoint-cleanup rather than a truncation failure. #[serde(skip_serializing_if = "Option::is_none")] - pub name: Option, - /// Stable session identifier + pub checkpoint_cleanup_failed: Option, + /// Number of events that were removed + pub events_removed: i64, +} + +/// Runtime-owned wire payload for a server-to-client hook callback invocation. +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub(crate) struct HookInvokeRequest { + #[doc(hidden)] + pub(crate) hook_type: HookType, + pub input: serde_json::Value, pub session_id: SessionId, - /// Session creation time as an ISO 8601 timestamp - pub start_time: String, - /// Short summary of the session, when one has been derived +} + +/// Optional output returned by an SDK callback hook. +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub(crate) struct HookInvokeResponse { #[serde(skip_serializing_if = "Option::is_none")] - pub summary: Option, + pub output: Option, } -/// Message text, optional severity level, persistence flag, optional follow-up URL, and optional tip. +/// Installed plugin record from global state, with marketplace, version, install time, enabled state, cache path, and source. /// ///
/// @@ -6340,27 +6278,31 @@ pub struct LocalSessionMetadataValue { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct LogRequest { - /// When true, the message is transient and not persisted to the session event log on disk - #[serde(skip_serializing_if = "Option::is_none")] - pub ephemeral: Option, - /// Log severity level. Determines how the message is displayed in the timeline. Defaults to "info". +pub struct InstalledPlugin { + /// Path where the plugin is cached locally + #[serde(rename = "cache_path", skip_serializing_if = "Option::is_none")] + pub cache_path: Option, + /// Whether the plugin is currently enabled + pub enabled: bool, + /// Installation timestamp + #[serde(rename = "installed_at")] + pub installed_at: String, + /// Marketplace the plugin came from (empty string for direct repo installs) + pub marketplace: String, + /// Plugin name + pub name: String, + /// Source for direct repo installs (when marketplace is empty) #[serde(skip_serializing_if = "Option::is_none")] - pub level: Option, - /// Human-readable message - pub message: String, - /// Optional actionable tip displayed alongside the message. Only honored on `level: "info"`. - #[serde(skip_serializing_if = "Option::is_none")] - pub tip: Option, - /// Domain category for this log entry (e.g., "mcp", "subscription", "policy", "model"). Maps to `infoType`/`warningType`/`errorType` on the emitted event. Defaults to "notification". - #[serde(skip_serializing_if = "Option::is_none")] - pub r#type: Option, - /// Optional URL the user can open in their browser for more details + pub source: Option, + /// 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. + #[serde(rename = "source_sha", skip_serializing_if = "Option::is_none")] + pub source_sha: Option, + /// Version installed (if available) #[serde(skip_serializing_if = "Option::is_none")] - pub url: Option, + pub version: Option, } -/// Identifier of the session event that was emitted for the log message. +/// Information about an installed plugin tracked in global state. /// ///
/// @@ -6370,12 +6312,22 @@ pub struct LogRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct LogResult { - /// The unique identifier of the emitted session event - pub event_id: String, +pub struct 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. + #[serde(skip_serializing_if = "Option::is_none")] + pub direct_source_id: Option, + /// Whether the plugin is currently enabled for new sessions + pub enabled: bool, + /// Marketplace the plugin came from. Empty string ("") for direct repo / URL / local installs. + pub marketplace: String, + /// Plugin name + pub name: String, + /// Installed version (when reported by the plugin manifest) + #[serde(skip_serializing_if = "Option::is_none")] + pub version: Option, } -/// Parameters for (re)loading the merged LSP configuration set. +/// Source descriptor for a direct GitHub plugin install, with `owner/repo`, optional ref or full commit SHA, and optional subpath. /// ///
/// @@ -6385,19 +6337,23 @@ pub struct LogResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct LspInitializeRequest { - /// Force re-initialization even when LSP configs were already loaded for the working directory. +pub struct InstalledPluginSourceGitHub { + /// Optional repository-relative path to the plugin. #[serde(skip_serializing_if = "Option::is_none")] - pub force: Option, - /// Git root used as the boundary when traversing for project-level LSP configs (supports monorepos). + pub path: Option, + /// Optional Git ref to resolve. #[serde(skip_serializing_if = "Option::is_none")] - pub git_root: Option, - /// Working directory used to load project-level LSP configs. Defaults to the session working directory when omitted. + pub r#ref: Option, + /// GitHub repository in `owner/repo` form. + pub repo: String, + /// Optional full 40-character hexadecimal commit SHA. #[serde(skip_serializing_if = "Option::is_none")] - pub working_directory: Option, + pub sha: Option, + /// Constant value. Always "github". + pub source: InstalledPluginSourceGitHubSource, } -/// Validated device-managed settings discovered before a session exists. +/// Source descriptor for a direct local plugin install, with a local filesystem path. /// ///
/// @@ -6407,16 +6363,14 @@ pub struct LspInitializeRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ManagedSettingsReadResult { - /// Discovery or validation error text when managed settings could not be read safely. - #[serde(skip_serializing_if = "Option::is_none")] - pub error_message: Option, - /// Validated, canonical managed-settings JSON. Omitted when no managed settings were discovered or when discovered settings failed validation. - #[serde(skip_serializing_if = "Option::is_none")] - pub settings_json: Option, +pub struct InstalledPluginSourceLocal { + /// Local filesystem path to the plugin. + pub path: String, + /// Constant value. Always "local". + pub source: InstalledPluginSourceLocalSource, } -/// Result of registering a new marketplace. +/// Source descriptor for a direct URL plugin install, with URL, optional ref or full commit SHA, and optional subpath. /// ///
/// @@ -6426,12 +6380,23 @@ pub struct ManagedSettingsReadResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct MarketplaceAddResult { - /// Final name of the marketplace as resolved from its manifest - pub name: String, +pub struct InstalledPluginSourceUrl { + /// Optional source-relative path to the plugin. + #[serde(skip_serializing_if = "Option::is_none")] + pub path: Option, + /// Optional Git ref to resolve. + #[serde(skip_serializing_if = "Option::is_none")] + pub r#ref: Option, + /// Optional full 40-character hexadecimal commit SHA. + #[serde(skip_serializing_if = "Option::is_none")] + pub sha: Option, + /// Constant value. Always "url". + pub source: InstalledPluginSourceUrlSource, + /// URL of the plugin source. + pub url: String, } -/// Plugin entry advertised by a marketplace. +/// Canonical file or directory where custom instructions can be discovered or created, with location, kind, preference, and project path. /// ///
/// @@ -6441,15 +6406,21 @@ pub struct MarketplaceAddResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct MarketplacePluginInfo { - /// Short description from the marketplace catalog, when present +pub struct InstructionDiscoveryPath { + /// Whether the target is a single file or a directory of instruction files + pub kind: InstructionDiscoveryPathKind, + /// Which tier this target belongs to + pub location: InstructionDiscoveryPathLocation, + /// Absolute path of the file or directory (may not exist on disk yet) + pub path: String, + /// Whether this is the canonical target to create new instructions in its tier. At most one entry per tier is preferred. + pub preferred_for_creation: bool, + /// The input project path this target was derived from (only for repository targets) #[serde(skip_serializing_if = "Option::is_none")] - pub description: Option, - /// Plugin name as listed in the marketplace catalog - pub name: String, + pub project_path: Option, } -/// Plugins advertised by the marketplace. +/// Canonical files and directories where custom instructions can be created so the runtime will recognize them. /// ///
/// @@ -6459,12 +6430,12 @@ pub struct MarketplacePluginInfo { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct MarketplaceBrowseResult { - /// Plugins advertised by the marketplace - pub plugins: Vec, +pub struct InstructionDiscoveryPathList { + /// Canonical instruction create/discovery files and directories, in priority order + pub paths: Vec, } -/// Registered marketplace summary. +/// Optional project paths to include in instruction discovery. /// ///
/// @@ -6474,17 +6445,16 @@ pub struct MarketplaceBrowseResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct MarketplaceInfo { - /// True when this is a default marketplace shipped with the runtime. Defaults are not removable. +pub struct 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. #[serde(skip_serializing_if = "Option::is_none")] - pub is_default: Option, - /// Marketplace name (matches the @marketplace suffix in plugin specs) - pub name: String, - /// Human-readable description of where the marketplace data is fetched from (e.g. "GitHub: owner/repo"). - pub source: String, + pub exclude_host_instructions: Option, + /// 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). + #[serde(skip_serializing_if = "Option::is_none")] + pub project_paths: Option>, } -/// All registered marketplaces, including built-in defaults. +/// Optional project paths to include when enumerating instruction discovery targets. /// ///
/// @@ -6494,12 +6464,16 @@ pub struct MarketplaceInfo { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct MarketplaceListResult { - /// Registered marketplaces - pub marketplaces: Vec, +pub struct InstructionsGetDiscoveryPathsRequest { + /// When true, omit the host's user-level instruction targets, leaving only repository targets. For multitenant deployments (mirrors `discover`'s `excludeHostInstructions`). + #[serde(skip_serializing_if = "Option::is_none")] + pub exclude_host_instructions: Option, + /// Optional list of project directory paths. When omitted or empty, only the user-level targets are returned. + #[serde(skip_serializing_if = "Option::is_none")] + pub project_paths: Option>, } -/// Per-marketplace refresh result, including marketplace name, success flag, and optional failure error. +/// Loaded instruction source for a session, including path, content, category, location, applicability, and optional description. /// ///
/// @@ -6509,17 +6483,34 @@ pub struct MarketplaceListResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct MarketplaceRefreshEntry { - /// Error message (failure only) +pub struct InstructionSource { + /// Glob pattern(s) from frontmatter — when set, this instruction applies only to matching files #[serde(skip_serializing_if = "Option::is_none")] - pub error: Option, - /// Marketplace name that was refreshed - pub name: String, - /// Whether the refresh succeeded - pub success: bool, + pub apply_to: Option>, + /// Raw content of the instruction file + pub content: String, + /// When true, this source starts disabled and must be toggled on by the user + #[serde(skip_serializing_if = "Option::is_none")] + pub default_disabled: Option, + /// Short description (body after frontmatter) for use in instruction tables + #[serde(skip_serializing_if = "Option::is_none")] + pub description: Option, + /// Unique identifier for this source (used for toggling) + pub id: String, + /// Human-readable label + pub label: String, + /// Where this source lives — used for UI grouping + pub location: InstructionSourceLocation, + /// 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. + #[serde(skip_serializing_if = "Option::is_none")] + pub project_path: Option, + /// File path relative to repo or absolute for home + pub source_path: String, + /// Category of instruction source — used for merge logic + pub r#type: InstructionSourceType, } -/// Result of refreshing one or more marketplace catalogs. +/// Instruction sources loaded for the session, in merge order. /// ///
/// @@ -6529,12 +6520,12 @@ pub struct MarketplaceRefreshEntry { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct MarketplaceRefreshResult { - /// Per-marketplace refresh results in deterministic order. - pub results: Vec, +pub struct InstructionsGetSourcesResult { + /// Instruction sources for the session + pub sources: Vec, } -/// Outcome of the remove attempt, including dependent-plugin info when applicable. +/// Parameters for interrupting the main agent turn. /// ///
/// @@ -6544,15 +6535,13 @@ pub struct MarketplaceRefreshResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct MarketplaceRemoveResult { - /// Names of installed plugins that prevented removal. Populated only when `removed=false`. +pub struct 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. #[serde(skip_serializing_if = "Option::is_none")] - pub dependent_plugins: Option>, - /// True when the marketplace was actually removed. False when removal was skipped because the marketplace has dependent plugins and `force` was not set. - pub removed: bool, + pub flush_queued: Option, } -/// MCP server allowed by policy, with server name and optional PII-free explanatory note. +/// Result of interrupting the main agent turn. /// ///
/// @@ -6562,56 +6551,79 @@ pub struct MarketplaceRemoveResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpAllowedServer { - /// Allowed server name - pub name: String, - /// PII-free note explaining why the server was allowed - #[serde(skip_serializing_if = "Option::is_none")] - pub redacted_note: Option, +pub struct InterruptMainTurnResult { + /// Whether an in-flight main agent turn was interrupted. False when the main loop was not processing. + pub interrupted: bool, } -/// MCP server, tool name, and arguments to invoke from an MCP App view. -/// -///
-/// -/// **Experimental.** This type is part of an experimental wire-protocol surface -/// and may change or be removed in future SDK or CLI releases. -/// -///
+/// A request body chunk or cancellation signal. #[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpAppsCallToolRequest { - /// Tool arguments +pub struct LlmInferenceHttpRequestChunkRequest { + /// Identity of the agent invocation (one agentic loop) this body chunk belongs to, matching the `agentInvocationId` semantics on httpRequestStart. Carried per chunk so a persistent transport can attribute successive turns correctly: when a WebSocket connection is reused across turns, the httpRequestStart identity reflects only the turn that opened the connection, so each later turn stamps its own invocation id here. Absent when the runtime has no invocation context for the request, or on the plain-HTTP transport where every request has its own httpRequestStart. #[serde(skip_serializing_if = "Option::is_none")] - pub arguments: Option>, - /// **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. - pub origin_server_name: String, - /// MCP server hosting the tool - pub server_name: String, - /// MCP tool name - pub tool_name: String, + pub agent_invocation_id: Option, + /// When true, `data` is base64-encoded bytes. When absent or false, `data` is UTF-8 text. + #[serde(skip_serializing_if = "Option::is_none")] + pub binary: Option, + /// When true, the runtime is cancelling the in-flight request (e.g. upstream consumer aborted). `data` is ignored. Implies end-of-request. + #[serde(skip_serializing_if = "Option::is_none")] + pub cancel: Option, + /// Optional human-readable reason for the cancellation, propagated for logging. + #[serde(skip_serializing_if = "Option::is_none")] + pub cancel_reason: Option, + /// Body byte range. UTF-8 text when `binary` is absent or false; base64-encoded bytes when `binary` is true. May be empty. + pub data: String, + /// When true, this is the final body chunk for the request. The SDK may rely on having received an end-marked chunk before treating the request body as complete. + #[serde(skip_serializing_if = "Option::is_none")] + pub end: Option, + /// Matches the requestId from the originating httpRequestStart frame. + pub request_id: RequestId, } -/// Capability negotiation snapshot -/// -///
-/// -/// **Experimental.** This type is part of an experimental wire-protocol surface -/// and may change or be removed in future SDK or CLI releases. -/// -///
+/// Acknowledgement. The SDK is free to ignore the ack and treat chunk delivery as fire-and-forget. #[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpAppsDiagnoseCapability { - /// Whether the runtime advertises `extensions.io.modelcontextprotocol/ui` to MCP servers - pub advertised: bool, - /// Whether the MCP_APPS feature flag (or COPILOT_MCP_APPS env override) is on - pub feature_flag_enabled: bool, - /// Whether the session has the `mcp-apps` capability - pub session_has_mcp_apps: bool, +pub struct LlmInferenceHttpRequestChunkResult {} + +/// The head of an outbound model-layer HTTP request. +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct LlmInferenceHttpRequestStartRequest { + /// Stable identity of the agent trajectory that issued this request. Present when the request originates from an agent turn; absent for requests outside any agent context. This is the same identity used by lifecycle and bridged session events and remains constant across turns and retries. + #[serde(skip_serializing_if = "Option::is_none")] + pub agent_id: Option, + /// Identity of the agent invocation (one agentic loop) that issued this request. It remains fixed across physical retries within the invocation and is distinct from the stable trajectory `agentId`. A caller-supplied invocation id always takes precedence (this covers auxiliary calls that have no model call id). Otherwise, first-party CAPI requests fall back to the runtime's agent task id — the same value the runtime emits as the `X-Agent-Task-Id` header — while custom-provider requests fall back to the model call id. + #[serde(skip_serializing_if = "Option::is_none")] + pub agent_invocation_id: Option, + /// HTTP request headers, preserving multiple values per name. + pub headers: HashMap>, + /// Coarse classification of the interaction that produced this request. Open string for forward-compatibility; known values include `conversation-agent`, `conversation-subagent`, `conversation-sampling`, `conversation-background`, `conversation-compaction`, and `conversation-user`. Absent when the runtime did not classify the request. Comes from the runtime's per-request agent context independently of transport; on the CAPI transport the runtime derives the upstream `X-Interaction-Type` header from this same context. + #[serde(skip_serializing_if = "Option::is_none")] + pub interaction_type: Option, + /// HTTP method, e.g. GET, POST. + pub method: String, + /// Stable identity of the immediate parent trajectory. Present for child trajectories such as subagents and conversation-sampling requests; absent for root-agent and non-agent requests. + #[serde(skip_serializing_if = "Option::is_none")] + pub parent_agent_id: Option, + /// Opaque runtime-minted id, unique per in-flight request. The SDK uses this to correlate httpRequestChunk frames and to address its httpResponseStart / httpResponseChunk replies back to the runtime. + pub request_id: RequestId, + /// Id of the runtime session that triggered this request, when one is in scope. Absent for requests issued outside any session (e.g. startup model-catalog or capability resolution). This is a payload field — not a dispatch key — because the client-global API is registered process-wide rather than per session. + #[serde(skip_serializing_if = "Option::is_none")] + pub session_id: Option, + /// Transport the runtime would otherwise use for this request. `http` (the default when absent) covers plain HTTP and SSE responses; `websocket` indicates a full-duplex message channel where each body chunk maps to one WebSocket message and the `binary` flag distinguishes text from binary frames. The SDK consumer uses this to decide whether to service the request with an HTTP client or a WebSocket client. It is the one piece of request metadata the consumer cannot reliably infer from the URL or headers alone. + #[serde(skip_serializing_if = "Option::is_none")] + pub transport: Option, + /// Absolute request URL. + pub url: String, } -/// MCP server to diagnose MCP Apps wiring for. +/// Acknowledgement. Returning successfully simply means the SDK accepted the start frame; it does not imply the request will succeed. +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct LlmInferenceHttpRequestStartResult {} + +/// Set to terminate the response with a transport-level failure. Implies end-of-stream; any further chunks for this requestId are ignored. /// ///
/// @@ -6621,12 +6633,15 @@ pub struct McpAppsDiagnoseCapability { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpAppsDiagnoseRequest { - /// MCP server to probe - pub server_name: String, +pub struct LlmInferenceHttpResponseChunkError { + /// Optional machine-readable error code. + #[serde(skip_serializing_if = "Option::is_none")] + pub code: Option, + /// Human-readable failure description. + pub message: String, } -/// What the server returned for this session +/// A response body chunk or terminal error. /// ///
/// @@ -6636,18 +6651,23 @@ pub struct McpAppsDiagnoseRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpAppsDiagnoseServer { - /// Whether the named server is currently connected - pub connected: bool, - /// Up to 5 tool names with `_meta.ui` for quick inspection - pub sample_tool_names: Vec, - /// Total tools returned by the server's tools/list - pub tool_count: f64, - /// Tools whose `_meta.ui` is populated (resourceUri and/or visibility set) - pub tools_with_ui_meta: f64, +pub struct LlmInferenceHttpResponseChunkRequest { + /// When true, `data` is base64-encoded bytes. When absent or false, `data` is UTF-8 text. + #[serde(skip_serializing_if = "Option::is_none")] + pub binary: Option, + /// 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). + pub data: String, + /// 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. + #[serde(skip_serializing_if = "Option::is_none")] + pub end: Option, + /// Set to terminate the response with a transport-level failure. Implies end-of-stream; any further chunks for this requestId are ignored. + #[serde(skip_serializing_if = "Option::is_none")] + pub error: Option, + /// Matches the requestId from the originating httpRequestStart frame. + pub request_id: RequestId, } -/// Diagnostic snapshot of MCP Apps wiring for the named server. +/// Whether the chunk was accepted. /// ///
/// @@ -6657,14 +6677,12 @@ pub struct McpAppsDiagnoseServer { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpAppsDiagnoseResult { - /// Capability negotiation snapshot - pub capability: McpAppsDiagnoseCapability, - /// What the server returned for this session - pub server: McpAppsDiagnoseServer, +pub struct LlmInferenceHttpResponseChunkResult { + /// True when the chunk was matched to a pending request; false when unknown. + pub accepted: bool, } -/// Current host context +/// Response head. /// ///
/// @@ -6674,31 +6692,19 @@ pub struct McpAppsDiagnoseResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpAppsHostContextDetails { - /// Display modes the host supports - #[serde(skip_serializing_if = "Option::is_none")] - pub available_display_modes: Option>, - /// Current display mode (SEP-1865) - #[serde(skip_serializing_if = "Option::is_none")] - pub display_mode: Option, - /// BCP-47 locale, e.g. 'en-US' - #[serde(skip_serializing_if = "Option::is_none")] - pub locale: Option, - /// Platform type for responsive design - #[serde(skip_serializing_if = "Option::is_none")] - pub platform: Option, - /// UI theme preference per SEP-1865 - #[serde(skip_serializing_if = "Option::is_none")] - pub theme: Option, - /// IANA timezone, e.g. 'America/New_York' - #[serde(skip_serializing_if = "Option::is_none")] - pub time_zone: Option, - /// Host application identifier +pub struct LlmInferenceHttpResponseStartRequest { + /// HTTP response headers, preserving multiple values per name. + pub headers: HashMap>, + /// Matches the requestId from the originating httpRequestStart frame. + pub request_id: RequestId, + /// HTTP status code. + pub status: i64, + /// Optional HTTP status reason phrase. #[serde(skip_serializing_if = "Option::is_none")] - pub user_agent: Option, + pub status_text: Option, } -/// Current host context advertised to MCP App guests. +/// Whether the start frame was accepted. /// ///
/// @@ -6708,12 +6714,12 @@ pub struct McpAppsHostContextDetails { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpAppsHostContext { - /// Current host context - pub context: McpAppsHostContextDetails, +pub struct LlmInferenceHttpResponseStartResult { + /// True when the response start was matched to a pending request; false when unknown. + pub accepted: bool, } -/// MCP server to list app-callable tools for. +/// Indicates whether the calling client was registered as the LLM inference provider. /// ///
/// @@ -6723,14 +6729,12 @@ pub struct McpAppsHostContext { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct 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. - pub origin_server_name: String, - /// MCP server hosting the app - pub server_name: String, +pub struct LlmInferenceSetProviderResult { + /// Whether the provider was set successfully + pub success: bool, } -/// App-callable tools from the named MCP server. +/// Pre-resolved working-directory context for session startup. /// ///
/// @@ -6740,12 +6744,24 @@ pub struct McpAppsListToolsRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpAppsListToolsResult { - /// App-callable tools from the server - pub tools: Vec>, +pub struct SessionContext { + /// Active git branch + #[serde(skip_serializing_if = "Option::is_none")] + pub branch: Option, + /// Most recent working directory for this session + pub cwd: String, + /// Git repository root, if the cwd was inside a git repo + #[serde(skip_serializing_if = "Option::is_none")] + pub git_root: Option, + /// Repository host type + #[serde(skip_serializing_if = "Option::is_none")] + pub host_type: Option, + /// Repository slug in `owner/name` form, when known + #[serde(skip_serializing_if = "Option::is_none")] + pub repository: Option, } -/// MCP server and resource URI to fetch. +/// Persisted local session metadata, including identifiers, timestamps, summary/name, client, context, detached state, and task ID. /// ///
/// @@ -6755,14 +6771,36 @@ pub struct McpAppsListToolsResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpAppsReadResourceRequest { - /// Name of the MCP server hosting the resource - pub server_name: String, - /// Resource URI (typically ui://...) - pub uri: String, +pub struct LocalSessionMetadataValue { + /// Runtime client name that created/last resumed this session + #[serde(skip_serializing_if = "Option::is_none")] + pub client_name: Option, + /// Pre-resolved working-directory context for session startup. + #[serde(skip_serializing_if = "Option::is_none")] + pub context: Option, + /// True for detached maintenance sessions that should be hidden from normal resume lists. + #[serde(skip_serializing_if = "Option::is_none")] + pub is_detached: Option, + /// Always false for local sessions. + pub is_remote: bool, + /// GitHub task ID, when this local session is bound to one. Only present for local sessions exported to remote control. + #[serde(skip_serializing_if = "Option::is_none")] + pub mc_task_id: Option, + /// Last-modified time of the session's persisted state, as ISO 8601 + pub modified_time: String, + /// Optional human-friendly name set via /rename + #[serde(skip_serializing_if = "Option::is_none")] + pub name: Option, + /// Stable session identifier + pub session_id: SessionId, + /// Session creation time as an ISO 8601 timestamp + pub start_time: String, + /// Short summary of the session, when one has been derived + #[serde(skip_serializing_if = "Option::is_none")] + pub summary: Option, } -/// MCP Apps resource content with URI, optional MIME type, text or base64 blob, and resource metadata. +/// Message text, optional severity level, persistence flag, optional follow-up URL, and optional tip. /// ///
/// @@ -6772,24 +6810,27 @@ pub struct McpAppsReadResourceRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpAppsResourceContent { - /// Resource-level metadata (CSP, permissions, etc.) - #[serde(rename = "_meta", skip_serializing_if = "Option::is_none")] - pub meta: Option>, - /// Base64-encoded binary content +pub struct LogRequest { + /// When true, the message is transient and not persisted to the session event log on disk #[serde(skip_serializing_if = "Option::is_none")] - pub blob: Option, - /// MIME type of the content + pub ephemeral: Option, + /// Log severity level. Determines how the message is displayed in the timeline. Defaults to "info". #[serde(skip_serializing_if = "Option::is_none")] - pub mime_type: Option, - /// Text content (e.g. HTML) + pub level: Option, + /// Human-readable message + pub message: String, + /// Optional actionable tip displayed alongside the message. Only honored on `level: "info"`. #[serde(skip_serializing_if = "Option::is_none")] - pub text: Option, - /// The resource URI (typically ui://...) - pub uri: String, + pub tip: Option, + /// Domain category for this log entry (e.g., "mcp", "subscription", "policy", "model"). Maps to `infoType`/`warningType`/`errorType` on the emitted event. Defaults to "notification". + #[serde(skip_serializing_if = "Option::is_none")] + pub r#type: Option, + /// Optional URL the user can open in their browser for more details + #[serde(skip_serializing_if = "Option::is_none")] + pub url: Option, } -/// Resource contents returned by the MCP server. +/// Identifier of the session event that was emitted for the log message. /// ///
/// @@ -6799,12 +6840,12 @@ pub struct McpAppsResourceContent { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpAppsReadResourceResult { - /// Resource contents returned by the server - pub contents: Vec, +pub struct LogResult { + /// The unique identifier of the emitted session event + pub event_id: String, } -/// Host context advertised to MCP App guests +/// Parameters for (re)loading the merged LSP configuration set. /// ///
/// @@ -6814,31 +6855,19 @@ pub struct McpAppsReadResourceResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpAppsSetHostContextDetails { - /// Display modes the host supports - #[serde(skip_serializing_if = "Option::is_none")] - pub available_display_modes: Option>, - /// Current display mode (SEP-1865) - #[serde(skip_serializing_if = "Option::is_none")] - pub display_mode: Option, - /// BCP-47 locale, e.g. 'en-US' - #[serde(skip_serializing_if = "Option::is_none")] - pub locale: Option, - /// Platform type for responsive design - #[serde(skip_serializing_if = "Option::is_none")] - pub platform: Option, - /// UI theme preference per SEP-1865 +pub struct LspInitializeRequest { + /// Force re-initialization even when LSP configs were already loaded for the working directory. #[serde(skip_serializing_if = "Option::is_none")] - pub theme: Option, - /// IANA timezone, e.g. 'America/New_York' + pub force: Option, + /// Git root used as the boundary when traversing for project-level LSP configs (supports monorepos). #[serde(skip_serializing_if = "Option::is_none")] - pub time_zone: Option, - /// Host application identifier + pub git_root: Option, + /// Working directory used to load project-level LSP configs. Defaults to the session working directory when omitted. #[serde(skip_serializing_if = "Option::is_none")] - pub user_agent: Option, + pub working_directory: Option, } -/// Host context to advertise to MCP App guests. +/// Validated device-managed settings discovered before a session exists. /// ///
/// @@ -6848,12 +6877,16 @@ pub struct McpAppsSetHostContextDetails { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpAppsSetHostContextRequest { - /// Host context advertised to MCP App guests - pub context: McpAppsSetHostContextDetails, +pub struct ManagedSettingsReadResult { + /// Discovery or validation error text when managed settings could not be read safely. + #[serde(skip_serializing_if = "Option::is_none")] + pub error_message: Option, + /// Validated, canonical managed-settings JSON. Omitted when no managed settings were discovered or when discovered settings failed validation. + #[serde(skip_serializing_if = "Option::is_none")] + pub settings_json: Option, } -/// The requestId previously passed to executeSampling that should be cancelled. +/// Result of registering a new marketplace. /// ///
/// @@ -6863,12 +6896,12 @@ pub struct McpAppsSetHostContextRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpCancelSamplingExecutionParams { - /// The requestId previously passed to executeSampling that should be cancelled - pub request_id: RequestId, +pub struct MarketplaceAddResult { + /// Final name of the marketplace as resolved from its manifest + pub name: String, } -/// Indicates whether an in-flight sampling execution with the given requestId was found and cancelled. +/// Plugin entry advertised by a marketplace. /// ///
/// @@ -6878,12 +6911,15 @@ pub struct McpCancelSamplingExecutionParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct 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). - pub cancelled: bool, +pub struct MarketplacePluginInfo { + /// Short description from the marketplace catalog, when present + #[serde(skip_serializing_if = "Option::is_none")] + pub description: Option, + /// Plugin name as listed in the marketplace catalog + pub name: String, } -/// MCP server name and configuration to add to user configuration. +/// Plugins advertised by the marketplace. /// ///
/// @@ -6893,14 +6929,12 @@ pub struct McpCancelSamplingExecutionResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpConfigAddRequest { - /// MCP server configuration (stdio process or remote HTTP/SSE) - pub config: serde_json::Value, - /// Unique name for the MCP server - pub name: String, +pub struct MarketplaceBrowseResult { + /// Plugins advertised by the marketplace + pub plugins: Vec, } -/// MCP server names to disable for new sessions. +/// Registered marketplace summary. /// ///
/// @@ -6910,12 +6944,17 @@ pub struct McpConfigAddRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct 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. - pub names: Vec, +pub struct MarketplaceInfo { + /// True when this is a default marketplace shipped with the runtime. Defaults are not removable. + #[serde(skip_serializing_if = "Option::is_none")] + pub is_default: Option, + /// Marketplace name (matches the @marketplace suffix in plugin specs) + pub name: String, + /// Human-readable description of where the marketplace data is fetched from (e.g. "GitHub: owner/repo"). + pub source: String, } -/// MCP server names to enable for new sessions. +/// All registered marketplaces, including built-in defaults. /// ///
/// @@ -6925,12 +6964,12 @@ pub struct McpConfigDisableRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct 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. - pub names: Vec, +pub struct MarketplaceListResult { + /// Registered marketplaces + pub marketplaces: Vec, } -/// User-configured MCP servers, keyed by server name. +/// Per-marketplace refresh result, including marketplace name, success flag, and optional failure error. /// ///
/// @@ -6940,12 +6979,17 @@ pub struct McpConfigEnableRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpConfigList { - /// All MCP servers from user config, keyed by name - pub servers: HashMap, +pub struct MarketplaceRefreshEntry { + /// Error message (failure only) + #[serde(skip_serializing_if = "Option::is_none")] + pub error: Option, + /// Marketplace name that was refreshed + pub name: String, + /// Whether the refresh succeeded + pub success: bool, } -/// MCP server name to remove from user configuration. +/// Result of refreshing one or more marketplace catalogs. /// ///
/// @@ -6955,12 +6999,12 @@ pub struct McpConfigList { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpConfigRemoveRequest { - /// Name of the MCP server to remove - pub name: String, +pub struct MarketplaceRefreshResult { + /// Per-marketplace refresh results in deterministic order. + pub results: Vec, } -/// MCP server name and replacement configuration to write to user configuration. +/// Outcome of the remove attempt, including dependent-plugin info when applicable. /// ///
/// @@ -6970,14 +7014,15 @@ pub struct McpConfigRemoveRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpConfigUpdateRequest { - /// MCP server configuration (stdio process or remote HTTP/SSE) - pub config: serde_json::Value, - /// Name of the MCP server to update - pub name: String, +pub struct MarketplaceRemoveResult { + /// Names of installed plugins that prevented removal. Populated only when `removed=false`. + #[serde(skip_serializing_if = "Option::is_none")] + pub dependent_plugins: Option>, + /// True when the marketplace was actually removed. False when removal was skipped because the marketplace has dependent plugins and `force` was not set. + pub removed: bool, } -/// Credential-free authentication identity used to configure GitHub MCP. +/// MCP server allowed by policy, with server name and optional PII-free explanatory note. /// ///
/// @@ -6987,13 +7032,15 @@ pub struct McpConfigUpdateRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub(crate) struct McpConfigureGitHubRequest { - /// Opaque runtime auth info for GitHub MCP configuration. Marked internal: an in-process runtime shape (configureGitHubMcp is a no-op over the wire). - #[doc(hidden)] - pub(crate) auth_info: serde_json::Value, +pub struct McpAllowedServer { + /// Allowed server name + pub name: String, + /// PII-free note explaining why the server was allowed + #[serde(skip_serializing_if = "Option::is_none")] + pub redacted_note: Option, } -/// Result of configuring GitHub MCP. +/// MCP server, tool name, and arguments to invoke from an MCP App view. /// ///
/// @@ -7003,12 +7050,19 @@ pub(crate) struct McpConfigureGitHubRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpConfigureGitHubResult { - /// Whether GitHub MCP configuration changed. - pub changed: bool, +pub struct McpAppsCallToolRequest { + /// Tool arguments + #[serde(skip_serializing_if = "Option::is_none")] + pub arguments: Option>, + /// **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. + pub origin_server_name: String, + /// MCP server hosting the tool + pub server_name: String, + /// MCP tool name + pub tool_name: String, } -/// Name of the MCP server to disable for the session. +/// Capability negotiation snapshot /// ///
/// @@ -7018,12 +7072,16 @@ pub struct McpConfigureGitHubResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpDisableRequest { - /// Name of the MCP server to disable - pub server_name: String, +pub struct McpAppsDiagnoseCapability { + /// Whether the runtime advertises `extensions.io.modelcontextprotocol/ui` to MCP servers + pub advertised: bool, + /// Whether the MCP_APPS feature flag (or COPILOT_MCP_APPS env override) is on + pub feature_flag_enabled: bool, + /// Whether the session has the `mcp-apps` capability + pub session_has_mcp_apps: bool, } -/// Optional working directory used as context for MCP server discovery. +/// MCP server to diagnose MCP Apps wiring for. /// ///
/// @@ -7033,13 +7091,12 @@ pub struct McpDisableRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpDiscoverRequest { - /// Working directory used as context for discovery (e.g., plugin resolution) - #[serde(skip_serializing_if = "Option::is_none")] - pub working_directory: Option, +pub struct McpAppsDiagnoseRequest { + /// MCP server to probe + pub server_name: String, } -/// MCP servers discovered from user, workspace, plugin, and built-in sources. +/// What the server returned for this session /// ///
/// @@ -7049,12 +7106,18 @@ pub struct McpDiscoverRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpDiscoverResult { - /// MCP servers discovered from all sources - pub servers: Vec, +pub struct McpAppsDiagnoseServer { + /// Whether the named server is currently connected + pub connected: bool, + /// Up to 5 tool names with `_meta.ui` for quick inspection + pub sample_tool_names: Vec, + /// Total tools returned by the server's tools/list + pub tool_count: f64, + /// Tools whose `_meta.ui` is populated (resourceUri and/or visibility set) + pub tools_with_ui_meta: f64, } -/// Name of the MCP server to enable for the session. +/// Diagnostic snapshot of MCP Apps wiring for the named server. /// ///
/// @@ -7064,12 +7127,14 @@ pub struct McpDiscoverResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpEnableRequest { - /// Name of the MCP server to enable - pub server_name: String, +pub struct McpAppsDiagnoseResult { + /// Capability negotiation snapshot + pub capability: McpAppsDiagnoseCapability, + /// What the server returned for this session + pub server: McpAppsDiagnoseServer, } -/// 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. +/// Current host context /// ///
/// @@ -7079,9 +7144,31 @@ pub struct McpEnableRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpExecuteSamplingRequest {} +pub struct McpAppsHostContextDetails { + /// Display modes the host supports + #[serde(skip_serializing_if = "Option::is_none")] + pub available_display_modes: Option>, + /// Current display mode (SEP-1865) + #[serde(skip_serializing_if = "Option::is_none")] + pub display_mode: Option, + /// BCP-47 locale, e.g. 'en-US' + #[serde(skip_serializing_if = "Option::is_none")] + pub locale: Option, + /// Platform type for responsive design + #[serde(skip_serializing_if = "Option::is_none")] + pub platform: Option, + /// UI theme preference per SEP-1865 + #[serde(skip_serializing_if = "Option::is_none")] + pub theme: Option, + /// IANA timezone, e.g. 'America/New_York' + #[serde(skip_serializing_if = "Option::is_none")] + pub time_zone: Option, + /// Host application identifier + #[serde(skip_serializing_if = "Option::is_none")] + pub user_agent: Option, +} -/// Identifiers and raw MCP CreateMessageRequest params used to run a sampling inference. +/// Current host context advertised to MCP App guests. /// ///
/// @@ -7091,18 +7178,12 @@ pub struct McpExecuteSamplingRequest {} ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct 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). - pub mcp_request_id: serde_json::Value, - /// 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. - pub request: McpExecuteSamplingRequest, - /// 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. - pub request_id: RequestId, - /// Name of the MCP server that initiated the sampling request - pub server_name: String, +pub struct McpAppsHostContext { + /// Current host context + pub context: McpAppsHostContextDetails, } -/// MCP server whose connection attempt failed. +/// MCP server to list app-callable tools for. /// ///
/// @@ -7112,15 +7193,14 @@ pub struct McpExecuteSamplingParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpFailedServer { - /// The captured connection failure detail. - #[serde(skip_serializing_if = "Option::is_none")] - pub error: Option, - /// The config key of the server that failed to connect. - pub name: String, +pub struct 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. + pub origin_server_name: String, + /// MCP server hosting the app + pub server_name: String, } -/// MCP server filtered by policy, with name, reason, and optional redacted reason. +/// App-callable tools from the named MCP server. /// ///
/// @@ -7130,38 +7210,12 @@ pub struct McpFailedServer { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpFilteredServer { - /// Deprecated. This field is no longer populated. - #[doc(hidden)] - #[deprecated] - #[serde(skip_serializing_if = "Option::is_none")] - pub enterprise_name: Option, - /// Filtered server name - pub name: String, - /// Human-readable filter reason - pub reason: String, - /// PII-free filter reason - #[serde(skip_serializing_if = "Option::is_none")] - pub redacted_reason: Option, -} - -#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct McpHeadersHandlePendingHeadersRefreshRequestHeaders { - /// Headers to overlay onto the MCP request. Dynamic headers override static config headers but do not replace SDK-managed request headers. - pub headers: HashMap, - /// Headers-refresh response variant discriminator. - pub kind: McpHeadersHandlePendingHeadersRefreshRequestHeadersKind, -} - -#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct McpHeadersHandlePendingHeadersRefreshRequestNone { - /// Headers-refresh response variant discriminator. - pub kind: McpHeadersHandlePendingHeadersRefreshRequestNoneKind, +pub struct McpAppsListToolsResult { + /// App-callable tools from the server + pub tools: Vec>, } -/// MCP headers refresh request id and the host response. +/// MCP server and resource URI to fetch. /// ///
/// @@ -7169,16 +7223,16 @@ pub struct McpHeadersHandlePendingHeadersRefreshRequestNone { /// and may change or be removed in future SDK or CLI releases. /// ///
-#[derive(Debug, Clone, Serialize, Deserialize)] +#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpHeadersHandlePendingHeadersRefreshRequestRequest { - /// Headers refresh request identifier from mcp.headers_refresh_required - pub request_id: RequestId, - /// Host response: supply dynamic headers or decline this refresh. - pub result: McpHeadersHandlePendingHeadersRefreshRequest, +pub struct McpAppsReadResourceRequest { + /// Name of the MCP server hosting the resource + pub server_name: String, + /// Resource URI (typically ui://...) + pub uri: String, } -/// Indicates whether the pending MCP headers refresh response was accepted. +/// MCP Apps resource content with URI, optional MIME type, text or base64 blob, and resource metadata. /// ///
/// @@ -7188,12 +7242,24 @@ pub struct McpHeadersHandlePendingHeadersRefreshRequestRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpHeadersHandlePendingHeadersRefreshRequestResult { - /// Whether the response was accepted. False if the request was unknown, timed out, or already resolved. - pub success: bool, +pub struct McpAppsResourceContent { + /// Resource-level metadata (CSP, permissions, etc.) + #[serde(rename = "_meta", skip_serializing_if = "Option::is_none")] + pub meta: Option>, + /// Base64-encoded binary content + #[serde(skip_serializing_if = "Option::is_none")] + pub blob: Option, + /// MIME type of the content + #[serde(skip_serializing_if = "Option::is_none")] + pub mime_type: Option, + /// Text content (e.g. HTML) + #[serde(skip_serializing_if = "Option::is_none")] + pub text: Option, + /// The resource URI (typically ui://...) + pub uri: String, } -/// Recorded MCP server connection failure. +/// Resource contents returned by the MCP server. /// ///
/// @@ -7203,14 +7269,12 @@ pub struct McpHeadersHandlePendingHeadersRefreshRequestResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpServerFailureInfo { - /// Failure message produced when the MCP server connection failed. - pub message: String, - /// epoch-ms timestamp at which the failure was recorded. - pub timestamp: i64, +pub struct McpAppsReadResourceResult { + /// Resource contents returned by the server + pub contents: Vec, } -/// Recorded MCP server pending-auth state. +/// Host context advertised to MCP App guests /// ///
/// @@ -7220,12 +7284,31 @@ pub struct McpServerFailureInfo { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpServerNeedsAuthInfo { - /// epoch-ms timestamp at which the server signalled it needs authentication. - pub timestamp: i64, +pub struct McpAppsSetHostContextDetails { + /// Display modes the host supports + #[serde(skip_serializing_if = "Option::is_none")] + pub available_display_modes: Option>, + /// Current display mode (SEP-1865) + #[serde(skip_serializing_if = "Option::is_none")] + pub display_mode: Option, + /// BCP-47 locale, e.g. 'en-US' + #[serde(skip_serializing_if = "Option::is_none")] + pub locale: Option, + /// Platform type for responsive design + #[serde(skip_serializing_if = "Option::is_none")] + pub platform: Option, + /// UI theme preference per SEP-1865 + #[serde(skip_serializing_if = "Option::is_none")] + pub theme: Option, + /// IANA timezone, e.g. 'America/New_York' + #[serde(skip_serializing_if = "Option::is_none")] + pub time_zone: Option, + /// Host application identifier + #[serde(skip_serializing_if = "Option::is_none")] + pub user_agent: Option, } -/// Host-level state, omitted when no MCP host is initialized. +/// Host context to advertise to MCP App guests. /// ///
/// @@ -7235,24 +7318,12 @@ pub struct McpServerNeedsAuthInfo { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpHostState { - /// Names of currently-connected MCP clients. - pub clients: Vec, - /// Configured servers that are explicitly disabled. - pub disabled_servers: Vec, - /// Map of server name to recorded connection failure. - pub failed_servers: HashMap, - /// Configured servers filtered out by MCP server policy. - pub filtered_servers: Vec, - /// Whether third-party MCP servers are policy-enabled for this session. - pub mcp3p_enabled: bool, - /// Map of server name to recorded pending-auth state. - pub needs_auth_servers: HashMap, - /// Names of servers with in-flight connection attempts. - pub pending_connections: Vec, +pub struct McpAppsSetHostContextRequest { + /// Host context advertised to MCP App guests + pub context: McpAppsSetHostContextDetails, } -/// Server name to check running status for. +/// The requestId previously passed to executeSampling that should be cancelled. /// ///
/// @@ -7262,12 +7333,12 @@ pub struct McpHostState { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpIsServerRunningRequest { - /// Name of the MCP server to check - pub server_name: String, +pub struct McpCancelSamplingExecutionParams { + /// The requestId previously passed to executeSampling that should be cancelled + pub request_id: RequestId, } -/// Whether the named MCP server is running. +/// Indicates whether an in-flight sampling execution with the given requestId was found and cancelled. /// ///
/// @@ -7277,12 +7348,12 @@ pub struct McpIsServerRunningRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpIsServerRunningResult { - /// True if the server has an active client and transport. - pub running: bool, +pub struct 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). + pub cancelled: bool, } -/// Server name whose tool list should be returned. +/// MCP server name and configuration to add to user configuration. /// ///
/// @@ -7292,12 +7363,14 @@ pub struct McpIsServerRunningResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpListToolsRequest { - /// Name of the connected MCP server whose tools to list. - pub server_name: String, +pub struct McpConfigAddRequest { + /// MCP server configuration (stdio process or remote HTTP/SSE) + pub config: serde_json::Value, + /// Unique name for the MCP server + pub name: String, } -/// Normalized MCP Apps discovery metadata from a tool's `_meta.ui` block. +/// MCP server names to disable for new sessions. /// ///
/// @@ -7307,16 +7380,12 @@ pub struct McpListToolsRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct 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. - #[serde(skip_serializing_if = "Option::is_none")] - pub resource_uri: Option, - /// Tool visibility advertised by the server. When absent, MCP Apps defaults apply. - #[serde(skip_serializing_if = "Option::is_none")] - pub visibility: Option>, +pub struct 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. + pub names: Vec, } -/// MCP tool metadata with tool name, optional description, and normalized MCP Apps discovery metadata. +/// MCP server names to enable for new sessions. /// ///
/// @@ -7326,18 +7395,12 @@ pub struct McpToolUi { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpTools { - /// Tool description, when provided. - #[serde(skip_serializing_if = "Option::is_none")] - pub description: Option, - /// Tool name. - pub name: String, - /// Normalized MCP Apps discovery metadata. An empty object indicates that a valid `_meta.ui` block was present without recognized fields. - #[serde(skip_serializing_if = "Option::is_none")] - pub ui: Option, +pub struct 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. + pub names: Vec, } -/// Tools exposed by the connected MCP server. Throws when the server is not connected. +/// User-configured MCP servers, keyed by server name. /// ///
/// @@ -7347,12 +7410,12 @@ pub struct McpTools { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpListToolsResult { - /// Tools exposed by the server. - pub tools: Vec, +pub struct McpConfigList { + /// All MCP servers from user config, keyed by name + pub servers: HashMap, } -/// Identifies the MCP server whose persisted OAuth credentials were updated. +/// MCP server name to remove from user configuration. /// ///
/// @@ -7362,38 +7425,45 @@ pub struct McpListToolsResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpOauthAuthenticationStateChangedRequest { - /// Whether the target session must mint a session-scoped access token instead of reusing a shared access token persisted by another session. - #[serde(skip_serializing_if = "Option::is_none")] - pub refresh_session_token: Option, - /// Name of the MCP server whose OAuth credentials were updated. Omit only when the host cannot identify the server. - #[serde(skip_serializing_if = "Option::is_none")] - pub server_name: Option, +pub struct McpConfigRemoveRequest { + /// Name of the MCP server to remove + pub name: String, } +/// MCP server name and replacement configuration to write to user configuration. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpOauthPendingRequestResponseToken { - /// Access token acquired by the SDK host - pub access_token: String, - /// Token lifetime in seconds, if known. - #[serde(skip_serializing_if = "Option::is_none")] - pub expires_in: Option, - /// OAuth response variant discriminator. - pub kind: McpOauthPendingRequestResponseTokenKind, - /// OAuth token type. Defaults to Bearer when omitted. - #[serde(skip_serializing_if = "Option::is_none")] - pub token_type: Option, +pub struct McpConfigUpdateRequest { + /// MCP server configuration (stdio process or remote HTTP/SSE) + pub config: serde_json::Value, + /// Name of the MCP server to update + pub name: String, } +/// Credential-free authentication identity used to configure GitHub MCP. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpOauthPendingRequestResponseCancelled { - /// OAuth response variant discriminator. - pub kind: McpOauthPendingRequestResponseCancelledKind, +pub(crate) struct McpConfigureGitHubRequest { + /// Opaque runtime auth info for GitHub MCP configuration. Marked internal: an in-process runtime shape (configureGitHubMcp is a no-op over the wire). + #[doc(hidden)] + pub(crate) auth_info: serde_json::Value, } -/// Pending MCP OAuth request ID and host-provided token or cancellation response. +/// Result of configuring GitHub MCP. /// ///
/// @@ -7401,16 +7471,14 @@ pub struct McpOauthPendingRequestResponseCancelled { /// and may change or be removed in future SDK or CLI releases. /// ///
-#[derive(Debug, Clone, Serialize, Deserialize)] +#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpOauthHandlePendingRequest { - /// OAuth request identifier from the mcp.oauth_required event - pub request_id: RequestId, - /// Host response to the pending OAuth request. - pub result: McpOauthPendingRequestResponse, +pub struct McpConfigureGitHubResult { + /// Whether GitHub MCP configuration changed. + pub changed: bool, } -/// Indicates whether the pending MCP OAuth response was accepted. +/// Name of the MCP server to disable for the session. /// ///
/// @@ -7420,12 +7488,12 @@ pub struct McpOauthHandlePendingRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpOauthHandlePendingResult { - /// Whether the response was accepted. False if the request was unknown, timed out, or already resolved. - pub success: bool, +pub struct McpDisableRequest { + /// Name of the MCP server to disable + pub server_name: String, } -/// Remote MCP server name and optional overrides controlling reauthentication, OAuth client display name, callback success-page copy, and static OAuth client selection. +/// Optional working directory used as context for MCP server discovery. /// ///
/// @@ -7435,33 +7503,13 @@ pub struct McpOauthHandlePendingResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct 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. - #[serde(skip_serializing_if = "Option::is_none")] - pub callback_success_message: Option, - /// Optional OAuth client ID override for this login. When set, the runtime uses this pre-registered static client instead of dynamic client registration. - #[serde(skip_serializing_if = "Option::is_none")] - pub client_id: Option, - /// 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. - #[serde(skip_serializing_if = "Option::is_none")] - pub client_name: Option, - /// 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. - #[serde(skip_serializing_if = "Option::is_none")] - pub client_secret: Option, - /// 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. - #[serde(skip_serializing_if = "Option::is_none")] - pub force_reauth: Option, - /// Optional OAuth grant type override for this login. Defaults to the server configuration, or authorization_code when no grant type is specified. - #[serde(skip_serializing_if = "Option::is_none")] - pub grant_type: Option, - /// 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. +pub struct McpDiscoverRequest { + /// Working directory used as context for discovery (e.g., plugin resolution) #[serde(skip_serializing_if = "Option::is_none")] - pub public_client: Option, - /// Name of the remote MCP server to authenticate - pub server_name: String, + pub working_directory: Option, } -/// OAuth authorization URL the caller should open, or empty when cached tokens already authenticated the server. +/// MCP servers discovered from user, workspace, plugin, and built-in sources. /// ///
/// @@ -7471,13 +7519,12 @@ pub struct McpOauthLoginRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct 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. - #[serde(skip_serializing_if = "Option::is_none")] - pub authorization_url: Option, +pub struct McpDiscoverResult { + /// MCP servers discovered from all sources + pub servers: Vec, } -/// Remote MCP server name for a passive OAuth status probe. +/// Name of the MCP server to enable for the session. /// ///
/// @@ -7487,56 +7534,104 @@ pub struct McpOauthLoginResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpOauthProbeRequest { - /// Name of the configured remote MCP server to probe. +pub struct McpEnableRequest { + /// Name of the MCP server to enable pub server_name: String, } +/// 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.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpOauthProbeResultNoAuthRequired { - /// HTTP response returned by the server. - pub http_response: McpOauthHttpResponse, - /// Probe outcome variant discriminator. - pub status: McpOauthProbeResultNoAuthRequiredStatus, -} +pub struct McpExecuteSamplingRequest {} +/// Identifiers and raw MCP CreateMessageRequest params used to run a sampling inference. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpOauthProbeResultAuthenticated { - /// HTTP response returned by the server. - pub http_response: McpOauthHttpResponse, - /// Probe outcome variant discriminator. - pub status: McpOauthProbeResultAuthenticatedStatus, +pub struct 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). + pub mcp_request_id: serde_json::Value, + /// 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. + pub request: McpExecuteSamplingRequest, + /// 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. + pub request_id: RequestId, + /// Name of the MCP server that initiated the sampling request + pub server_name: String, } +/// MCP server whose connection attempt failed. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpOauthProbeResultNeedsAuth { - /// HTTP 401 or 403 response returned by the server. - pub http_response: McpOauthHttpResponse, - /// Why authentication is needed. - pub reason: McpOauthProbeNeedsAuthReason, - /// Probe outcome variant discriminator. - pub status: McpOauthProbeResultNeedsAuthStatus, - /// Parsed WWW-Authenticate challenge parameters, when present and parseable. +pub struct McpFailedServer { + /// The captured connection failure detail. #[serde(skip_serializing_if = "Option::is_none")] - pub www_authenticate_params: Option, + pub error: Option, + /// The config key of the server that failed to connect. + pub name: String, } +/// MCP server filtered by policy, with name, reason, and optional redacted reason. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpOauthProbeResultFailed { - /// Human-readable probe failure detail. - pub error: String, - /// HTTP response returned by the server, when the probe reached the server and captured the complete response. +pub struct McpFilteredServer { + /// Deprecated. This field is no longer populated. + #[doc(hidden)] + #[deprecated] #[serde(skip_serializing_if = "Option::is_none")] - pub http_response: Option, - /// Probe outcome variant discriminator. - pub status: McpOauthProbeResultFailedStatus, + pub enterprise_name: Option, + /// Filtered server name + pub name: String, + /// Human-readable filter reason + pub reason: String, + /// PII-free filter reason + #[serde(skip_serializing_if = "Option::is_none")] + pub redacted_reason: Option, } -/// Pending MCP OAuth request id to respond to. +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct McpHeadersHandlePendingHeadersRefreshRequestHeaders { + /// Headers to overlay onto the MCP request. Dynamic headers override static config headers but do not replace SDK-managed request headers. + pub headers: HashMap, + /// Headers-refresh response variant discriminator. + pub kind: McpHeadersHandlePendingHeadersRefreshRequestHeadersKind, +} + +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct McpHeadersHandlePendingHeadersRefreshRequestNone { + /// Headers-refresh response variant discriminator. + pub kind: McpHeadersHandlePendingHeadersRefreshRequestNoneKind, +} + +/// MCP headers refresh request id and the host response. /// ///
/// @@ -7544,14 +7639,16 @@ pub struct McpOauthProbeResultFailed { /// and may change or be removed in future SDK or CLI releases. /// ///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpOauthRespondRequest { - /// OAuth request identifier from the mcp.oauth_required event +pub struct McpHeadersHandlePendingHeadersRefreshRequestRequest { + /// Headers refresh request identifier from mcp.headers_refresh_required pub request_id: RequestId, + /// Host response: supply dynamic headers or decline this refresh. + pub result: McpHeadersHandlePendingHeadersRefreshRequest, } -/// Indicates whether the pending MCP OAuth response was accepted. +/// Indicates whether the pending MCP headers refresh response was accepted. /// ///
/// @@ -7561,12 +7658,12 @@ pub struct McpOauthRespondRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpOauthRespondResult { +pub struct McpHeadersHandlePendingHeadersRefreshRequestResult { /// Whether the response was accepted. False if the request was unknown, timed out, or already resolved. pub success: bool, } -/// Registration parameters for an external MCP client. +/// Recorded MCP server connection failure. /// ///
/// @@ -7576,21 +7673,14 @@ pub struct McpOauthRespondResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub(crate) struct McpRegisterExternalClientRequest { - /// In-process MCP Client instance. Marked internal: cannot be serialized across the JSON-RPC boundary. - #[doc(hidden)] - pub(crate) client: serde_json::Value, - /// In-process server config (MCPServerConfig) paired with the in-process client/transport. Marked internal alongside its companions. - #[doc(hidden)] - pub(crate) config: serde_json::Value, - /// Logical server name for the external client - pub server_name: String, - /// In-process MCP Transport instance. Marked internal: cannot be serialized across the JSON-RPC boundary. - #[doc(hidden)] - pub(crate) transport: serde_json::Value, +pub struct McpServerFailureInfo { + /// Failure message produced when the MCP server connection failed. + pub message: String, + /// epoch-ms timestamp at which the failure was recorded. + pub timestamp: i64, } -/// In-process MCP reload configuration. +/// Recorded MCP server pending-auth state. /// ///
/// @@ -7600,36 +7690,12 @@ pub(crate) struct McpRegisterExternalClientRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub(crate) struct McpReloadConfig { - #[serde(skip_serializing_if = "Option::is_none")] - pub active_git_hub_token: Option, - /// Server names the CLI enabled for this session via `--enable-mcp-server`. - #[serde(skip_serializing_if = "Option::is_none")] - pub cli_enabled_servers: Option>, - #[serde(skip_serializing_if = "Option::is_none")] - pub config_filter: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub disabled_servers: Option>, - #[serde(skip_serializing_if = "Option::is_none")] - pub enabled_servers: Option>, - #[serde(skip_serializing_if = "Option::is_none")] - pub force_restart: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub github_mcp_tool_options: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub github_mcp_user_override: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub include_workspace_sources: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub mcp3p_enabled: Option, - pub mcp_servers: HashMap, - #[serde(skip_serializing_if = "Option::is_none")] - pub secret_store: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub use_cached_tool_snapshots: Option, +pub struct McpServerNeedsAuthInfo { + /// epoch-ms timestamp at which the server signalled it needs authentication. + pub timestamp: i64, } -/// Opaque MCP reload configuration. +/// Host-level state, omitted when no MCP host is initialized. /// ///
/// @@ -7639,13 +7705,24 @@ pub(crate) struct McpReloadConfig { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub(crate) struct McpReloadWithConfigRequest { - /// Opaque runtime MCP reload configuration. Marked internal: an in-process runtime shape (reloadMcpServers throws over the wire). - #[doc(hidden)] - pub(crate) config: serde_json::Value, +pub struct McpHostState { + /// Names of currently-connected MCP clients. + pub clients: Vec, + /// Configured servers that are explicitly disabled. + pub disabled_servers: Vec, + /// Map of server name to recorded connection failure. + pub failed_servers: HashMap, + /// Configured servers filtered out by MCP server policy. + pub filtered_servers: Vec, + /// Whether third-party MCP servers are policy-enabled for this session. + pub mcp3p_enabled: bool, + /// Map of server name to recorded pending-auth state. + pub needs_auth_servers: HashMap, + /// Names of servers with in-flight connection attempts. + pub pending_connections: Vec, } -/// Indicates whether the auto-managed `github` MCP server was removed (false when nothing to remove). +/// One change applying the plan would make, described rather than serialised so the configuration payload stays behind the runtime boundary. /// ///
/// @@ -7655,12 +7732,20 @@ pub(crate) struct McpReloadWithConfigRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct 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). - pub removed: bool, +pub struct McpPlanConfigurationChange { + /// Names of the configuration fields the change would set, without their values. + pub changed_fields: Vec, + /// Configuration key the change applies to. + pub config_key: String, + /// Whether the change would create a new entry or modify an existing one. + pub operation: McpPlanConfigurationOperation, + /// Scope the change would be written to. + pub scope: McpPlanScope, + /// Secret placeholders the written configuration would reference. The constrained placeholder type cannot carry a literal secret value. + pub secret_references: Vec, } -/// Standard MCP resource annotations plus preserved non-standard annotation fields. +/// Normalised identity of the MCP server a plan targets, independent of how the card spelled it. /// ///
/// @@ -7670,22 +7755,20 @@ pub struct McpRemoveGitHubResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpResourceAnnotations { - /// Server-provided non-standard annotation fields preserved from the MCP response - #[serde(skip_serializing_if = "Option::is_none")] - pub additional_properties: Option>, - /// Intended audience roles for this resource - #[serde(skip_serializing_if = "Option::is_none")] - pub audience: Option>, - /// Last-modified timestamp hint +pub struct McpPlanResourceIdentity { + /// Canonical, normalised name of the server, for example `io.github.owner/server`. + pub canonical_name: String, + /// Registry identifier of the server, when it came from a registry. #[serde(skip_serializing_if = "Option::is_none")] - pub last_modified: Option, - /// Priority hint for model/client use + pub registry_id: Option, + /// Local configuration key the server would be recorded under. + pub server_name: String, + /// Version advertised by the card, when it declares one. #[serde(skip_serializing_if = "Option::is_none")] - pub priority: Option, + pub version: Option, } -/// A resource icon descriptor plus preserved non-standard icon fields. +/// Outcome of evaluating the planned server against registry and enterprise policy. Evaluation is read-only. /// ///
/// @@ -7695,24 +7778,17 @@ pub struct McpResourceAnnotations { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpResourceIcon { - /// Server-provided non-standard icon fields preserved from the MCP response - #[serde(skip_serializing_if = "Option::is_none")] - pub additional_properties: Option>, - /// Icon MIME type, when known - #[serde(skip_serializing_if = "Option::is_none")] - pub mime_type: Option, - /// Icon sizes hint - #[serde(skip_serializing_if = "Option::is_none")] - pub sizes: Option, - /// Icon URI - pub src: String, - /// Theme hint for this icon +pub struct McpPlanPolicyResult { + /// What policy decided for this server. + pub decision: McpPlanPolicyDecision, + /// Human-readable explanation, safe to surface. Never contains a query, URL, handle, or secret. #[serde(skip_serializing_if = "Option::is_none")] - pub theme: Option, + pub reason: Option, + /// Which authority produced the decision. + pub source: McpPlanPolicySource, } -/// 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`. +/// Provenance of the exact validated JSON MCP card content bound privately to a completed plan and its opaque handle. /// ///
/// @@ -7722,38 +7798,18 @@ pub struct McpResourceIcon { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpResource { - /// Resource-level metadata - #[serde(rename = "_meta", skip_serializing_if = "Option::is_none")] - pub meta: Option>, - /// Server-provided non-standard descriptor fields preserved from the MCP response - #[serde(skip_serializing_if = "Option::is_none")] - pub additional_properties: Option>, - /// Model/client annotations associated with this resource - #[serde(skip_serializing_if = "Option::is_none")] - pub annotations: Option, - /// Optional description of what this resource represents - #[serde(skip_serializing_if = "Option::is_none")] - pub description: Option, - /// Icons associated with this resource - #[serde(skip_serializing_if = "Option::is_none")] - pub icons: Option>, - /// MIME type of the resource, if known - #[serde(skip_serializing_if = "Option::is_none")] - pub mime_type: Option, - /// The programmatic name of the resource - pub name: String, - /// Resource size in bytes, when known - #[serde(skip_serializing_if = "Option::is_none")] - pub size: Option, - /// Optional human-readable display title - #[serde(skip_serializing_if = "Option::is_none")] - pub title: Option, - /// The resource URI (e.g. ui://... or file:///...) - pub uri: String, +pub struct McpPlanProvenance { + /// Authority associated with the validated card, without path, query, or credentials. Inert untrusted data. + pub authority: String, + /// Semantic digest of the exact validated JSON content bound to the plan handle. + pub card_digest: CardDigest, + /// JSON MCP media type the validated card was interpreted as. + pub media_type: McpServerCardMediaType, + /// ISO 8601 timestamp at which the runtime completed strict parsing and schema validation of the card content. + pub validated_at: String, } -/// MCP resource content with URI, optional MIME type, text or base64 blob, and resource metadata. +/// Where a plan would be written. /// ///
/// @@ -7763,24 +7819,14 @@ pub struct McpResource { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpResourceContent { - /// Resource-level metadata (CSP, permissions, etc.) - #[serde(rename = "_meta", skip_serializing_if = "Option::is_none")] - pub meta: Option>, - /// Base64-encoded binary content - #[serde(skip_serializing_if = "Option::is_none")] - pub blob: Option, - /// MIME type of the content - #[serde(skip_serializing_if = "Option::is_none")] - pub mime_type: Option, - /// Text content (e.g. HTML) - #[serde(skip_serializing_if = "Option::is_none")] - pub text: Option, - /// The resource URI - pub uri: String, +pub struct McpPlanTarget { + /// Configuration key the server would be recorded under within that scope. + pub config_key: String, + /// Configuration scope the plan targets. + pub scope: McpPlanScope, } -/// MCP server whose resources to enumerate. +/// A normalised, inert description of what installing an MCP server would involve. Carries no raw card, no install specification, and no secret value. /// ///
/// @@ -7790,15 +7836,33 @@ pub struct McpResourceContent { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpResourcesListRequest { - /// Opaque MCP pagination cursor from a prior `nextCursor` value +pub struct McpInstallPlan { + /// The configuration changes installing would make, described rather than serialised, so the mutable configuration payload stays behind the runtime boundary. + pub configuration_changes: Vec, + /// Normalised identity of the server the plan would install. + pub identity: McpPlanResourceIdentity, + /// 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. + pub plan_handle: String, + /// 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. + pub plan_handle_expires_at: String, + /// Outcome of evaluating the server against registry and enterprise policy. + pub policy: McpPlanPolicyResult, + /// Origin and semantic digest of the exact validated JSON MCP card content bound to this plan. + pub provenance: McpPlanProvenance, + /// Identifier of the choice the runtime would pick by default. Omitted when there is no eligible transport, or when the runtime expresses no preference. #[serde(skip_serializing_if = "Option::is_none")] - pub cursor: Option, - /// Name of the MCP server whose resources to enumerate - pub server_name: String, + pub recommended_transport_choice_id: Option, + /// Whether applying this plan would require an MCP reload to take effect. Planning itself never reloads. + pub reload_required: bool, + /// Whether the plan cannot be applied without further input, because a required value has no default or a secret must be supplied. + pub requires_interactive_configuration: bool, + /// Configuration scope and key the plan would write to. + pub target: McpPlanTarget, + /// 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. + pub transport_choices: Vec, } -/// One page of resources advertised by the named MCP server. +/// Server name to check running status for. /// ///
/// @@ -7808,15 +7872,12 @@ pub struct McpResourcesListRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpResourcesListResult { - /// Opaque cursor for the next page, if the server has more resources - #[serde(skip_serializing_if = "Option::is_none")] - pub next_cursor: Option, - /// Resources advertised by the server (proxied MCP `resources/list`) - pub resources: Vec, +pub struct McpIsServerRunningRequest { + /// Name of the MCP server to check + pub server_name: String, } -/// MCP server whose resource templates to enumerate. +/// Whether the named MCP server is running. /// ///
/// @@ -7826,15 +7887,12 @@ pub struct McpResourcesListResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpResourcesListTemplatesRequest { - /// Opaque MCP pagination cursor from a prior `nextCursor` value - #[serde(skip_serializing_if = "Option::is_none")] - pub cursor: Option, - /// Name of the MCP server whose resource templates to enumerate - pub server_name: String, +pub struct McpIsServerRunningResult { + /// True if the server has an active client and transport. + pub running: bool, } -/// 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`. +/// Server name whose tool list should be returned. /// ///
/// @@ -7844,35 +7902,12 @@ pub struct McpResourcesListTemplatesRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpResourceTemplate { - /// Resource-template-level metadata - #[serde(rename = "_meta", skip_serializing_if = "Option::is_none")] - pub meta: Option>, - /// Server-provided non-standard descriptor fields preserved from the MCP response - #[serde(skip_serializing_if = "Option::is_none")] - pub additional_properties: Option>, - /// Model/client annotations associated with this template - #[serde(skip_serializing_if = "Option::is_none")] - pub annotations: Option, - /// Optional description of what this template is for - #[serde(skip_serializing_if = "Option::is_none")] - pub description: Option, - /// Icons associated with resources matching this template - #[serde(skip_serializing_if = "Option::is_none")] - pub icons: Option>, - /// MIME type for resources matching this template, if uniform - #[serde(skip_serializing_if = "Option::is_none")] - pub mime_type: Option, - /// The programmatic name of the resource template - pub name: String, - /// Optional human-readable display title - #[serde(skip_serializing_if = "Option::is_none")] - pub title: Option, - /// An RFC 6570 URI template for constructing resource URIs - pub uri_template: String, +pub struct McpListToolsRequest { + /// Name of the connected MCP server whose tools to list. + pub server_name: String, } -/// One page of resource templates advertised by the named MCP server. +/// Normalized MCP Apps discovery metadata from a tool's `_meta.ui` block. /// ///
/// @@ -7882,15 +7917,16 @@ pub struct McpResourceTemplate { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpResourcesListTemplatesResult { - /// Opaque cursor for the next page, if the server has more resource templates +pub struct 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. #[serde(skip_serializing_if = "Option::is_none")] - pub next_cursor: Option, - /// Resource templates advertised by the server (proxied MCP `resources/templates/list`) - pub resource_templates: Vec, + pub resource_uri: Option, + /// Tool visibility advertised by the server. When absent, MCP Apps defaults apply. + #[serde(skip_serializing_if = "Option::is_none")] + pub visibility: Option>, } -/// MCP server and resource URI to fetch. +/// MCP tool metadata with tool name, optional description, and normalized MCP Apps discovery metadata. /// ///
/// @@ -7900,14 +7936,18 @@ pub struct McpResourcesListTemplatesResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpResourcesReadRequest { - /// Name of the MCP server hosting the resource - pub server_name: String, - /// Resource URI - pub uri: String, +pub struct McpTools { + /// Tool description, when provided. + #[serde(skip_serializing_if = "Option::is_none")] + pub description: Option, + /// Tool name. + pub name: String, + /// Normalized MCP Apps discovery metadata. An empty object indicates that a valid `_meta.ui` block was present without recognized fields. + #[serde(skip_serializing_if = "Option::is_none")] + pub ui: Option, } -/// Resource contents returned by the MCP server. +/// Tools exposed by the connected MCP server. Throws when the server is not connected. /// ///
/// @@ -7917,12 +7957,12 @@ pub struct McpResourcesReadRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpResourcesReadResult { - /// Resource contents returned by the server - pub contents: Vec, +pub struct McpListToolsResult { + /// Tools exposed by the server. + pub tools: Vec, } -/// 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. +/// Identifies the MCP server whose persisted OAuth credentials were updated. /// ///
/// @@ -7932,15 +7972,38 @@ pub struct McpResourcesReadResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct 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). +pub struct McpOauthAuthenticationStateChangedRequest { + /// Whether the target session must mint a session-scoped access token instead of reusing a shared access token persisted by another session. #[serde(skip_serializing_if = "Option::is_none")] - pub config: Option, - /// Name of the MCP server to restart - pub server_name: String, + pub refresh_session_token: Option, + /// Name of the MCP server whose OAuth credentials were updated. Omit only when the host cannot identify the server. + #[serde(skip_serializing_if = "Option::is_none")] + pub server_name: Option, } -/// Per-field MCP telemetry-obfuscation policy. +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct McpOauthPendingRequestResponseToken { + /// Access token acquired by the SDK host + pub access_token: String, + /// Token lifetime in seconds, if known. + #[serde(skip_serializing_if = "Option::is_none")] + pub expires_in: Option, + /// OAuth response variant discriminator. + pub kind: McpOauthPendingRequestResponseTokenKind, + /// OAuth token type. Defaults to Bearer when omitted. + #[serde(skip_serializing_if = "Option::is_none")] + pub token_type: Option, +} + +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct McpOauthPendingRequestResponseCancelled { + /// OAuth response variant discriminator. + pub kind: McpOauthPendingRequestResponseCancelledKind, +} + +/// Pending MCP OAuth request ID and host-provided token or cancellation response. /// ///
/// @@ -7948,16 +8011,16 @@ pub struct McpRestartServerRequest { /// and may change or be removed in future SDK or CLI releases. /// ///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpSafeForTelemetryFields { - /// Whether MCP tool input names may be included in telemetry without obfuscation. - pub inputs_names: bool, - /// Whether the MCP tool name may be included in telemetry without obfuscation. - pub name: bool, +pub struct McpOauthHandlePendingRequest { + /// OAuth request identifier from the mcp.oauth_required event + pub request_id: RequestId, + /// Host response to the pending OAuth request. + pub result: McpOauthPendingRequestResponse, } -/// Outcome of an MCP sampling execution: success result, failure error, or cancellation. +/// Indicates whether the pending MCP OAuth response was accepted. /// ///
/// @@ -7967,18 +8030,12 @@ pub struct McpSafeForTelemetryFields { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct 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. - pub action: McpSamplingExecutionAction, - /// Error description, present when action='failure'. - #[serde(skip_serializing_if = "Option::is_none")] - pub error: Option, - /// 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. - #[serde(skip_serializing_if = "Option::is_none")] - pub result: Option, +pub struct McpOauthHandlePendingResult { + /// Whether the response was accepted. False if the request was unknown, timed out, or already resolved. + pub success: bool, } -/// MCP server status entry, including config source/plugin source and any connection error. +/// Remote MCP server name and optional overrides controlling reauthentication, OAuth client display name, callback success-page copy, and static OAuth client selection. /// ///
/// @@ -7988,26 +8045,33 @@ pub struct McpSamplingExecutionResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpServer { - /// Error message if the server failed to connect +pub struct 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. #[serde(skip_serializing_if = "Option::is_none")] - pub error: Option, - /// Server name (config key) - pub name: String, - /// Configuration source: user, workspace, plugin, or builtin + pub callback_success_message: Option, + /// Optional OAuth client ID override for this login. When set, the runtime uses this pre-registered static client instead of dynamic client registration. #[serde(skip_serializing_if = "Option::is_none")] - pub source: Option, - /// Plugin name that provided this server, when source is plugin. + pub client_id: Option, + /// 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. #[serde(skip_serializing_if = "Option::is_none")] - pub source_plugin: Option, - /// Plugin version that provided this server, when source is plugin. + pub client_name: Option, + /// 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. #[serde(skip_serializing_if = "Option::is_none")] - pub source_plugin_version: Option, - /// Connection status: connected, failed, needs-auth, pending, disabled, stopped, or not_configured - pub status: McpServerStatus, + pub client_secret: Option, + /// 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. + #[serde(skip_serializing_if = "Option::is_none")] + pub force_reauth: Option, + /// Optional OAuth grant type override for this login. Defaults to the server configuration, or authorization_code when no grant type is specified. + #[serde(skip_serializing_if = "Option::is_none")] + pub grant_type: Option, + /// 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. + #[serde(skip_serializing_if = "Option::is_none")] + pub public_client: Option, + /// Name of the remote MCP server to authenticate + pub server_name: String, } -/// Authentication settings with optional redirect port configuration. +/// OAuth authorization URL the caller should open, or empty when cached tokens already authenticated the server. /// ///
/// @@ -8017,13 +8081,13 @@ pub struct McpServer { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpServerAuthConfigRedirectPort { - /// Fixed port for the OAuth redirect callback server. +pub struct 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. #[serde(skip_serializing_if = "Option::is_none")] - pub redirect_port: Option, + pub authorization_url: Option, } -/// Remote MCP server configuration accessed over HTTP or SSE. +/// Remote MCP server name for a passive OAuth status probe. /// ///
/// @@ -8033,90 +8097,56 @@ pub struct McpServerAuthConfigRedirectPort { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpServerConfigHttp { - /// Set to `true` to use defaults, or provide an object with additional auth or OIDC settings. +pub struct McpOauthProbeRequest { + /// Name of the configured remote MCP server to probe. + pub server_name: String, +} + +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct McpOauthProbeResultNoAuthRequired { + /// HTTP response returned by the server. + pub http_response: McpOauthHttpResponse, + /// Probe outcome variant discriminator. + pub status: McpOauthProbeResultNoAuthRequiredStatus, +} + +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct McpOauthProbeResultAuthenticated { + /// HTTP response returned by the server. + pub http_response: McpOauthHttpResponse, + /// Probe outcome variant discriminator. + pub status: McpOauthProbeResultAuthenticatedStatus, +} + +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct McpOauthProbeResultNeedsAuth { + /// HTTP 401 or 403 response returned by the server. + pub http_response: McpOauthHttpResponse, + /// Why authentication is needed. + pub reason: McpOauthProbeNeedsAuthReason, + /// Probe outcome variant discriminator. + pub status: McpOauthProbeResultNeedsAuthStatus, + /// Parsed WWW-Authenticate challenge parameters, when present and parseable. #[serde(skip_serializing_if = "Option::is_none")] - pub auth: Option, - /// Configuration warnings recorded while loading the server. - #[serde(skip_serializing_if = "Option::is_none")] - pub config_warnings: Option>, - /// Controls if tools provided by this server can be loaded on demand via tool search (auto) or always included in the initial tool list (never) - #[serde(skip_serializing_if = "Option::is_none")] - pub defer_tools: Option, - /// Whether secret masking is disabled for calls to this server. - #[serde(skip_serializing_if = "Option::is_none")] - pub disable_secret_masking: Option, - /// Set to true to disable persisted MCP tool snapshots for this server. Live tool discovery is unaffected. - #[serde(skip_serializing_if = "Option::is_none")] - pub disable_tool_cache: Option, - /// Optional human-readable server name. - #[serde(skip_serializing_if = "Option::is_none")] - pub display_name: Option, - /// Event types this server receives as Copilot notifications. - #[serde(skip_serializing_if = "Option::is_none")] - pub events: Option>, - /// Tool names excluded after the include filter is applied. - #[serde(skip_serializing_if = "Option::is_none")] - pub exclude_tools: Option>, - /// Content filtering mode to apply to all tools, or a map of tool name to content filtering mode. - #[serde(skip_serializing_if = "Option::is_none")] - pub filter_mapping: Option, - /// HTTP headers to include in requests to the remote MCP server. - #[serde(skip_serializing_if = "Option::is_none")] - pub headers: Option>, - /// Dynamic-header refresh cache lifetime in milliseconds. - #[serde(skip_serializing_if = "Option::is_none")] - pub headers_refresh_ttl_ms: Option, - /// Whether this server is a built-in fallback used when the user has not configured their own server. - #[serde(skip_serializing_if = "Option::is_none")] - pub is_default_server: Option, - /// Copilot notification types this server may send to the host. - #[serde(skip_serializing_if = "Option::is_none")] - pub notifications: Option>, - /// OAuth client ID for a pre-registered remote MCP OAuth client. - #[serde(skip_serializing_if = "Option::is_none")] - pub oauth_client_id: Option, - /// OAuth grant type to use when authenticating to the remote MCP server. - #[serde(skip_serializing_if = "Option::is_none")] - pub oauth_grant_type: Option, - /// Whether the configured OAuth client is public and does not require a client secret. - #[serde(skip_serializing_if = "Option::is_none")] - pub oauth_public_client: Option, - /// Set to `true` to use defaults, or provide an object with additional auth or OIDC settings. - #[serde(skip_serializing_if = "Option::is_none")] - pub oidc: Option, - /// Telemetry-obfuscation policy for this server's tools. - #[serde(skip_serializing_if = "Option::is_none")] - pub safe_for_telemetry: Option, - /// The origin of this server configuration. - #[serde(skip_serializing_if = "Option::is_none")] - pub source: Option, - /// Source file path recorded while loading the config. - #[serde(skip_serializing_if = "Option::is_none")] - pub source_path: Option, - /// Plugin that provided this server. - #[serde(skip_serializing_if = "Option::is_none")] - pub source_plugin: Option, - /// Whether the providing plugin uses the Open Plugin Spec. - #[serde(skip_serializing_if = "Option::is_none")] - pub source_plugin_spec: Option, - /// Version of the plugin that provided this server. - #[serde(skip_serializing_if = "Option::is_none")] - pub source_plugin_version: Option, - /// Timeout in milliseconds for tool discovery and tool calls. - #[serde(skip_serializing_if = "Option::is_none")] - pub timeout: Option, - /// Tools to include. Defaults to all tools if not specified. - #[serde(skip_serializing_if = "Option::is_none")] - pub tools: Option>, - /// Remote transport type. Defaults to "http" when omitted. + pub www_authenticate_params: Option, +} + +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct McpOauthProbeResultFailed { + /// Human-readable probe failure detail. + pub error: String, + /// HTTP response returned by the server, when the probe reached the server and captured the complete response. #[serde(skip_serializing_if = "Option::is_none")] - pub r#type: Option, - /// URL of the remote MCP server endpoint. - pub url: String, + pub http_response: Option, + /// Probe outcome variant discriminator. + pub status: McpOauthProbeResultFailedStatus, } -/// In-process MCP server configuration used by embedded SDK clients. +/// Pending MCP OAuth request id to respond to. /// ///
/// @@ -8126,72 +8156,12 @@ pub struct McpServerConfigHttp { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub(crate) struct McpServerConfigMemory { - /// Configuration warnings recorded while loading the server. - #[serde(skip_serializing_if = "Option::is_none")] - pub config_warnings: Option>, - /// Controls whether tools can be loaded on demand. - #[serde(skip_serializing_if = "Option::is_none")] - pub defer_tools: Option, - /// Whether secret masking is disabled for calls to this server. - #[serde(skip_serializing_if = "Option::is_none")] - pub disable_secret_masking: Option, - /// Whether persisted tool snapshots are disabled. - #[serde(skip_serializing_if = "Option::is_none")] - pub disable_tool_cache: Option, - /// Optional human-readable server name. - #[serde(skip_serializing_if = "Option::is_none")] - pub display_name: Option, - /// Event types this server receives as Copilot notifications. - #[serde(skip_serializing_if = "Option::is_none")] - pub events: Option>, - /// Tool names excluded after the include filter is applied. - #[serde(skip_serializing_if = "Option::is_none")] - pub exclude_tools: Option>, - /// Content filtering mode to apply to this server's tools. - #[serde(skip_serializing_if = "Option::is_none")] - pub filter_mapping: Option, - /// Whether this server is a built-in fallback. - #[serde(skip_serializing_if = "Option::is_none")] - pub is_default_server: Option, - /// Copilot notification types this server may send to the host. - #[serde(skip_serializing_if = "Option::is_none")] - pub notifications: Option>, - /// Set to `true` to use default OIDC settings. - #[serde(skip_serializing_if = "Option::is_none")] - pub oidc: Option, - /// Telemetry-obfuscation policy for this server's tools. - #[serde(skip_serializing_if = "Option::is_none")] - pub safe_for_telemetry: Option, - /// In-process MCP server instance. This value cannot cross a JSON-RPC boundary. - #[doc(hidden)] - pub(crate) server_instance: serde_json::Value, - /// The origin of this server configuration. - #[serde(skip_serializing_if = "Option::is_none")] - pub source: Option, - /// Source file path recorded while loading the config. - #[serde(skip_serializing_if = "Option::is_none")] - pub source_path: Option, - /// Plugin that provided this server. - #[serde(skip_serializing_if = "Option::is_none")] - pub source_plugin: Option, - /// Whether the providing plugin uses the Open Plugin Spec. - #[serde(skip_serializing_if = "Option::is_none")] - pub source_plugin_spec: Option, - /// Version of the plugin that provided this server. - #[serde(skip_serializing_if = "Option::is_none")] - pub source_plugin_version: Option, - /// Timeout in milliseconds for tool discovery and tool calls. - #[serde(skip_serializing_if = "Option::is_none")] - pub timeout: Option, - /// Tools to include. Defaults to all tools if not specified. - #[serde(skip_serializing_if = "Option::is_none")] - pub tools: Option>, - #[doc(hidden)] - pub(crate) r#type: McpServerConfigMemoryType, +pub struct McpOauthRespondRequest { + /// OAuth request identifier from the mcp.oauth_required event + pub request_id: RequestId, } -/// Stdio MCP server configuration launched as a child process. +/// Indicates whether the pending MCP OAuth response was accepted. /// ///
/// @@ -8201,84 +8171,12 @@ pub(crate) struct McpServerConfigMemory { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpServerConfigStdio { - /// Command-line arguments passed to the Stdio MCP server process. - #[serde(skip_serializing_if = "Option::is_none")] - pub args: Option>, - /// Set to `true` to use defaults, or provide an object with additional auth or OIDC settings. - #[serde(skip_serializing_if = "Option::is_none")] - pub auth: Option, - /// Executable command used to start the Stdio MCP server process. - pub command: String, - /// Configuration warnings recorded while loading the server. - #[serde(skip_serializing_if = "Option::is_none")] - pub config_warnings: Option>, - /// Working directory for the Stdio MCP server process. - #[serde(skip_serializing_if = "Option::is_none")] - pub cwd: Option, - /// Controls if tools provided by this server can be loaded on demand via tool search (auto) or always included in the initial tool list (never) - #[serde(skip_serializing_if = "Option::is_none")] - pub defer_tools: Option, - /// Whether secret masking is disabled for calls to this server. - #[serde(skip_serializing_if = "Option::is_none")] - pub disable_secret_masking: Option, - /// Set to true to disable persisted MCP tool snapshots for this server. Live tool discovery is unaffected. - #[serde(skip_serializing_if = "Option::is_none")] - pub disable_tool_cache: Option, - /// Optional human-readable server name. - #[serde(skip_serializing_if = "Option::is_none")] - pub display_name: Option, - /// Environment variables to pass to the Stdio MCP server process. - #[serde(skip_serializing_if = "Option::is_none")] - pub env: Option>, - /// Event types this server receives as Copilot notifications. - #[serde(skip_serializing_if = "Option::is_none")] - pub events: Option>, - /// Tool names excluded after the include filter is applied. - #[serde(skip_serializing_if = "Option::is_none")] - pub exclude_tools: Option>, - /// Content filtering mode to apply to all tools, or a map of tool name to content filtering mode. - #[serde(skip_serializing_if = "Option::is_none")] - pub filter_mapping: Option, - /// Whether this server is a built-in fallback used when the user has not configured their own server. - #[serde(skip_serializing_if = "Option::is_none")] - pub is_default_server: Option, - /// Copilot notification types this server may send to the host. - #[serde(skip_serializing_if = "Option::is_none")] - pub notifications: Option>, - /// Set to `true` to use defaults, or provide an object with additional auth or OIDC settings. - #[serde(skip_serializing_if = "Option::is_none")] - pub oidc: Option, - /// Telemetry-obfuscation policy for this server's tools. - #[serde(skip_serializing_if = "Option::is_none")] - pub safe_for_telemetry: Option, - /// The origin of this server configuration. - #[serde(skip_serializing_if = "Option::is_none")] - pub source: Option, - /// Source file path recorded while loading the config. - #[serde(skip_serializing_if = "Option::is_none")] - pub source_path: Option, - /// Plugin that provided this server. - #[serde(skip_serializing_if = "Option::is_none")] - pub source_plugin: Option, - /// Whether the providing plugin uses the Open Plugin Spec. - #[serde(skip_serializing_if = "Option::is_none")] - pub source_plugin_spec: Option, - /// Version of the plugin that provided this server. - #[serde(skip_serializing_if = "Option::is_none")] - pub source_plugin_version: Option, - /// Timeout in milliseconds for tool discovery and tool calls. - #[serde(skip_serializing_if = "Option::is_none")] - pub timeout: Option, - /// Tools to include. Defaults to all tools if not specified. - #[serde(skip_serializing_if = "Option::is_none")] - pub tools: Option>, - /// Local transport type. Defaults to stdio when omitted. - #[serde(skip_serializing_if = "Option::is_none")] - pub r#type: Option, +pub struct McpOauthRespondResult { + /// Whether the response was accepted. False if the request was unknown, timed out, or already resolved. + pub success: bool, } -/// MCP servers configured for the session, with their connection status and host-level state. +/// 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. /// ///
/// @@ -8288,15 +8186,16 @@ pub struct McpServerConfigStdio { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpServerList { - /// Host-level state, omitted when no MCP host is initialized. - #[serde(skip_serializing_if = "Option::is_none")] - pub host: Option, - /// Configured MCP servers - pub servers: Vec, +pub struct McpPlanInstallPlanned { + /// Discriminator: a plan was computed and nothing was changed + pub kind: McpPlanInstallPlannedKind, + /// Protocol version and capabilities the runtime honoured. + pub negotiated: CatalogNegotiatedContract, + /// The normalised plan. + pub plan: McpInstallPlan, } -/// Mode controlling how MCP server env values are resolved (`direct` or `indirect`). +/// Plan from a candidate returned by a previous catalog search. /// ///
/// @@ -8306,12 +8205,16 @@ pub struct McpServerList { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct 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". - pub mode: McpSetEnvValueModeDetails, +pub struct McpPlanInstallSourceCandidate { + /// Single-use candidate handle. Consumed by this call, so a replay of the same handle is rejected. + pub candidate_handle: String, + /// Discriminator: plan from a previously returned candidate + pub kind: McpPlanInstallSourceCandidateKind, + /// 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. + pub search_id: String, } -/// Env-value mode recorded on the session after the update. +/// An MCP server card to be retrieved from a URL through the runtime's hardened fetch boundary. /// ///
/// @@ -8321,12 +8224,16 @@ pub struct McpSetEnvValueModeParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpSetEnvValueModeResult { - /// Mode recorded on the session after the update - pub mode: McpSetEnvValueModeDetails, +pub struct McpServerCardUrl { + /// Discriminator: the card is URL-backed, and carries no embedded data + pub kind: McpServerCardUrlKind, + /// Media type the card is expected to conform to. + pub media_type: McpServerCardMediaType, + /// Card URL. Retrieved only through the runtime's hardened boundary, with scheme, credential, address-range, redirect, timeout, and response-size controls applied. Never logged. + pub url: String, } -/// 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. +/// An MCP server card supplied inline as an inert document. /// ///
/// @@ -8336,15 +8243,16 @@ pub struct McpSetEnvValueModeResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct 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). - #[serde(skip_serializing_if = "Option::is_none")] - pub config: Option, - /// Name of the MCP server to start - pub server_name: String, +pub struct McpServerCardEmbedded { + /// 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. + pub data: String, + /// Discriminator: the card is embedded, and carries no URL + pub kind: McpServerCardEmbeddedKind, + /// Media type the card is expected to conform to. + pub media_type: McpServerCardMediaType, } -/// MCP server startup filtering result. +/// Plan from a card supplied directly by the caller, without a preceding search. /// ///
/// @@ -8352,20 +8260,16 @@ pub struct McpStartServerRequest { /// and may change or be removed in future SDK or CLI releases. /// ///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpStartServersResult { - /// Non-default servers allowed by policy - #[serde(skip_serializing_if = "Option::is_none")] - pub allowed_servers: Option>, - /// Servers whose connection attempt failed. - #[serde(skip_serializing_if = "Option::is_none")] - pub failed_servers: Option>, - /// Servers filtered out before startup - pub filtered_servers: Vec, +pub struct McpPlanInstallSourceCard { + /// The card to plan from: exactly one of a URL or embedded data. + pub card: McpServerCardReference, + /// Discriminator: plan from a caller-supplied card + pub kind: McpPlanInstallSourceCardKind, } -/// Server name for an individual MCP server stop. +/// A side-effect-free request for an MCP install plan. Computing a plan never writes configuration, stores a secret, or reloads MCP servers. /// ///
/// @@ -8373,14 +8277,19 @@ pub struct McpStartServersResult { /// and may change or be removed in future SDK or CLI releases. /// ///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpStopServerRequest { - /// Name of the MCP server to stop - pub server_name: String, +pub struct McpPlanInstallRequest { + /// Protocol version and capabilities the caller requires. + pub contract: CatalogClientContract, + /// Configuration scope the plan targets. Defaults to user scope when omitted. + #[serde(skip_serializing_if = "Option::is_none")] + pub scope: Option, + /// What to plan: either a candidate handle from a previous search, or a card supplied directly. + pub source: McpPlanInstallSource, } -/// Metadata controlling an MCP task's lifetime. +/// One non-secret scalar value a transport choice needs before it can be applied. /// ///
/// @@ -8390,13 +8299,31 @@ pub struct McpStopServerRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpTaskMetadata { - /// Task time-to-live. +pub struct McpPlanRequiredValueScalar { + /// Where the value is applied when the server is launched. + pub category: McpPlanValueCategory, + /// 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. #[serde(skip_serializing_if = "Option::is_none")] - pub ttl: Option, + pub default_value: Option, + /// Human-readable explanation from the card. Inert untrusted text. + #[serde(skip_serializing_if = "Option::is_none")] + pub description: Option, + /// Whether the value may be supplied more than once. + pub is_repeated: bool, + /// Key the value is supplied under. Inert untrusted data. + pub key: String, + /// Discriminator: this required value uses a scalar type. + pub kind: McpPlanRequiredValueScalarKind, + /// Whether the value must be present for the plan to be applicable. + pub required: bool, + /// Human-readable label from the card. Inert untrusted text. + #[serde(skip_serializing_if = "Option::is_none")] + pub title: Option, + /// Scalar type the value must conform to. + pub value_type: McpPlanScalarValueType, } -/// Server name identifying the external client to remove. +/// One enumerated non-secret value a transport choice needs before it can be applied. The permitted values are structurally required. /// ///
/// @@ -8406,12 +8333,33 @@ pub struct McpTaskMetadata { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub(crate) struct McpUnregisterExternalClientRequest { - /// Server name of the external client to unregister - pub server_name: String, +pub struct McpPlanRequiredValueEnum { + /// Where the value is applied when the server is launched. + pub category: McpPlanValueCategory, + /// 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. + #[serde(skip_serializing_if = "Option::is_none")] + pub default_value: Option, + /// Human-readable explanation from the card. Inert untrusted text. + #[serde(skip_serializing_if = "Option::is_none")] + pub description: Option, + /// Non-empty permitted value set. Inert untrusted data. + pub enum_values: Vec, + /// Whether the value may be supplied more than once. + pub is_repeated: bool, + /// Key the value is supplied under. Inert untrusted data. + pub key: String, + /// Discriminator: this required value uses a fixed enumeration. + pub kind: McpPlanRequiredValueEnumKind, + /// Whether the value must be present for the plan to be applicable. + pub required: bool, + /// Human-readable label from the card. Inert untrusted text. + #[serde(skip_serializing_if = "Option::is_none")] + pub title: Option, + /// Discriminator: the value must be one of `enumValues`. + pub value_type: McpPlanEnumValueType, } -/// Memory configuration for this session. +/// 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. /// ///
/// @@ -8421,85 +8369,17 @@ pub(crate) struct McpUnregisterExternalClientRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct MemoryConfiguration { - /// Whether memory is enabled for the session. - pub enabled: bool, -} - -/// The six normalized `/context` header buckets, computed from the same tokenization as `entries` so the two never disagree. Convenience rollups: `freeSpace` and `buffer` describe window capacity rather than occupied context, so the values do not sum to `totalTokens`. -#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct MetadataContextAttributionResultContextAttributionCategories { - /// Output reserve plus post-blocking-threshold buffer. - pub buffer: i64, - /// Custom-instructions tokens (0 when none are configured). - pub custom_instructions: i64, - /// Remaining unused window capacity (clamped at 0). - pub free_space: i64, - /// MCP tool-definition tokens. - pub mcp_tools: i64, - /// Conversation (user/assistant/tool) message tokens. - pub messages: i64, - /// System prompt tokens, excluding custom instructions. - pub system_prompt: i64, - /// Non-MCP tool-definition tokens. - pub system_tools: i64, -} - -/// Successful compaction history for the session. -#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct MetadataContextAttributionResultContextAttributionCompactions { - /// Number of successful compactions in this session. - pub count: i64, -} - -#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct MetadataContextAttributionResultContextAttributionEntriesItem { - /// Supplementary per-entry metadata (e.g. `messageCount`, `role`, `evictable`, `pluginSource`). Values are stringified; parse as needed and ignore unrecognized keys. - #[serde(skip_serializing_if = "Option::is_none")] - pub attributes: Option>, - /// Identifier for this entry, formed by joining its `kind` and source name (e.g. `tool:bash`, `skill:tmux`, `toolDefinition:bash`); unique within the snapshot. Use it to match the same entry across snapshots, to correlate with other APIs (skill/agent/MCP registries), and as the `parentId` target for nesting. Distinct from the human-facing `label`. - pub id: String, - /// Source category for this entry. Not a closed set — tolerate unknown values. Known values today: `skill`, `subagent`, `mcpServer`, `tool`, `system`, `toolDefinition`, `plugin`. - pub kind: String, - /// Human-readable display label, e.g. `bash` or `skill: tmux`. Presentation-only; may be localized/reformatted without notice — do not key off it. - pub label: String, - /// Optional `id` of the parent entry: e.g. a `plugin` entry parenting its `skill`/`mcpServer` entries, or the `system` entry parenting `toolDefinition` entries. Omitted for top-level entries. +pub struct McpPlanSecretPlaceholder { + /// Key the secret is supplied under. Inert untrusted data. + pub key: String, + /// The runtime-assigned `${secret:}` placeholder written into configuration in place of the value. + pub placeholder: String, + /// Human-readable label from the card. Inert untrusted text. #[serde(skip_serializing_if = "Option::is_none")] - pub parent_id: Option, - /// Token count currently in context attributable to this entry. - pub tokens: i64, -} - -/// Per-source token attribution snapshot for the current context window. The heaviest individual messages are available separately via `metadata.getContextHeaviestMessages`. -#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct MetadataContextAttributionResultContextAttribution { - /// Output reserve plus the tokens past the buffer-exhaustion blocking threshold. Mirrors `SessionContextInfo.bufferTokens`. - pub buffer_tokens: i64, - /// The six normalized `/context` header buckets, computed from the same tokenization as `entries` so the two never disagree. Convenience rollups: `freeSpace` and `buffer` describe window capacity rather than occupied context, so the values do not sum to `totalTokens`. - pub categories: MetadataContextAttributionResultContextAttributionCategories, - /// Successful compaction history for the session. - pub compactions: MetadataContextAttributionResultContextAttributionCompactions, - /// Token count at which background compaction starts. Mirrors `SessionContextInfo.compactionThreshold`. - pub compaction_threshold: i64, - /// Flat list of per-source attribution entries. Group by `kind` and render unrecognized kinds generically. Nesting and rollups are expressed via `parentId`. - pub entries: Vec, - /// Prompt limit plus the model's output reserve: the full context window `categories.freeSpace` and `categories.buffer` are measured against. Mirrors `SessionContextInfo.limit`. - pub limit: i64, - /// The concrete model id the entire breakdown was tokenized against (feeds the per-model token multiplier). Under `Auto` (Free/Student) this is the resolved model, not the literal `auto` sentinel, so totals are not undercounted. A single-model approximation of a potentially multi-model Auto session. - pub model_id: String, - /// How `modelId` was chosen. Not a closed set — tolerate unknown values. Known values today: `autoResolved` (the model Auto resolved to), `selected` (the user's explicitly selected model), `default` (a fallback before any model is known). - pub model_source: String, - /// Maximum prompt tokens the resolved model accepts — the denominator for a `##k/###k` context-usage display. Mirrors `SessionContextInfo.promptTokenLimit`. - pub prompt_token_limit: i64, - /// Total token count of the current context window the entries are measured against (system message + conversation messages + tool definitions — the same total reported by /context). Divide an entry's `tokens` by this to derive its share. - pub total_tokens: i64, + pub title: Option, } -/// Per-source attribution breakdown for the session's current context window, or null if uninitialized. +/// An eligible local-package transport choice. Package identity is required and a remote endpoint cannot be represented. /// ///
/// @@ -8509,12 +8389,24 @@ pub struct MetadataContextAttributionResultContextAttribution { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct MetadataContextAttributionResult { - /// Per-source context-window attribution, or null if the session has not yet been initialized (no system prompt or tool metadata cached). - pub context_attribution: Option, +pub struct McpPlanTransportChoicePackage { + /// Stable identifier for this choice within the plan, used to select it when the plan is applied. + pub choice_id: String, + /// Discriminator: this choice runs a local package + pub install_method: McpPlanPackageInstallMethod, + /// Package identifier. Inert untrusted data. + pub package_identifier: String, + /// Packaging ecosystem, for example `oci` or `npm`. + pub package_type: String, + /// Typed values this choice requires, excluding secrets. + pub required_values: Vec, + /// Secrets this choice requires, referenced by placeholder only. + pub secret_placeholders: Vec, + /// Local process transport this package choice would use. + pub transport: McpPlanPackageTransport, } -/// Parameters for the heaviest-messages query. +/// An eligible remote-endpoint transport choice. The endpoint is required and package identity cannot be represented. /// ///
/// @@ -8524,13 +8416,22 @@ pub struct MetadataContextAttributionResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct MetadataContextHeaviestMessagesRequest { - /// Maximum number of messages to return, most-expensive first. Omit for the server default. - #[serde(skip_serializing_if = "Option::is_none")] - pub limit: Option, +pub struct McpPlanTransportChoiceRemote { + /// Stable identifier for this choice within the plan, used to select it when the plan is applied. + pub choice_id: String, + /// Endpoint URL. Inert untrusted data. + pub endpoint: String, + /// Discriminator: this choice connects to a remote endpoint + pub install_method: McpPlanRemoteInstallMethod, + /// Typed values this choice requires, excluding secrets. + pub required_values: Vec, + /// Secrets this choice requires, referenced by placeholder only. + pub secret_placeholders: Vec, + /// Endpoint transport this remote choice would use. + pub transport: McpPlanRemoteTransport, } -/// The heaviest individual messages in the session's context window, most-expensive first. +/// Registration parameters for an external MCP client. /// ///
/// @@ -8540,14 +8441,21 @@ pub struct MetadataContextHeaviestMessagesRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct MetadataContextHeaviestMessagesResult { - /// Heaviest messages, most-expensive first. - pub messages: Vec, - /// Total token count of the current context window, so callers can compute each message's share without a second call. - pub total_tokens: i64, +pub(crate) struct McpRegisterExternalClientRequest { + /// In-process MCP Client instance. Marked internal: cannot be serialized across the JSON-RPC boundary. + #[doc(hidden)] + pub(crate) client: serde_json::Value, + /// In-process server config (MCPServerConfig) paired with the in-process client/transport. Marked internal alongside its companions. + #[doc(hidden)] + pub(crate) config: serde_json::Value, + /// Logical server name for the external client + pub server_name: String, + /// In-process MCP Transport instance. Marked internal: cannot be serialized across the JSON-RPC boundary. + #[doc(hidden)] + pub(crate) transport: serde_json::Value, } -/// Model identifier and token limits used to compute the context-info breakdown. +/// In-process MCP reload configuration. /// ///
/// @@ -8557,43 +8465,36 @@ pub struct MetadataContextHeaviestMessagesResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct MetadataContextInfoRequest { - /// Maximum output tokens allowed by the target model. Pass 0 if unknown. - pub output_token_limit: i64, - /// Maximum prompt tokens allowed by the target model. Pass 0 to use the runtime default. - pub prompt_token_limit: i64, - /// Model identifier used for tokenization. Omit to use the session default. Used both for token counting and to compute display values. +pub(crate) struct McpReloadConfig { #[serde(skip_serializing_if = "Option::is_none")] - pub selected_model: Option, -} - -/// Token-usage breakdown for the session's current context window -#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct MetadataContextInfoResultContextInfo { - /// Output reserve plus tokens after the buffer-exhaustion blocking threshold (default 95%) - pub buffer_tokens: i64, - /// Token count at which background compaction starts (configurable percentage of promptTokenLimit) - pub compaction_threshold: i64, - /// Tokens consumed by user/assistant/tool messages - pub conversation_tokens: i64, - /// Prompt token limit plus the model's full output token limit. - pub limit: i64, - /// Tokens consumed by MCP tool definitions (subset of toolDefinitionsTokens, excludes deferred tools) - pub mcp_tools_tokens: i64, - /// The model used for token counting - pub model_name: String, - /// Maximum prompt tokens allowed by the model (or DEFAULT_TOKEN_LIMIT if unspecified) - pub prompt_token_limit: i64, - /// Tokens consumed by the system prompt - pub system_tokens: i64, - /// Tokens consumed by tool definitions sent to the model (excludes deferred tools) - pub tool_definitions_tokens: i64, - /// Sum of system, conversation and tool-definition tokens - pub total_tokens: i64, + pub active_git_hub_token: Option, + /// Server names the CLI enabled for this session via `--enable-mcp-server`. + #[serde(skip_serializing_if = "Option::is_none")] + pub cli_enabled_servers: Option>, + #[serde(skip_serializing_if = "Option::is_none")] + pub config_filter: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub disabled_servers: Option>, + #[serde(skip_serializing_if = "Option::is_none")] + pub enabled_servers: Option>, + #[serde(skip_serializing_if = "Option::is_none")] + pub force_restart: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub github_mcp_tool_options: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub github_mcp_user_override: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub include_workspace_sources: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub mcp3p_enabled: Option, + pub mcp_servers: HashMap, + #[serde(skip_serializing_if = "Option::is_none")] + pub secret_store: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub use_cached_tool_snapshots: Option, } -/// Token breakdown for the session's current context window, or null if uninitialized. +/// Opaque MCP reload configuration. /// ///
/// @@ -8603,12 +8504,13 @@ pub struct MetadataContextInfoResultContextInfo { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct MetadataContextInfoResult { - /// Token breakdown for the current context window, or null if the session has not yet been initialized (no system prompt or tool metadata cached). - pub context_info: Option, +pub(crate) struct McpReloadWithConfigRequest { + /// Opaque runtime MCP reload configuration. Marked internal: an in-process runtime shape (reloadMcpServers throws over the wire). + #[doc(hidden)] + pub(crate) config: serde_json::Value, } -/// Indicates whether the local session is currently processing a turn or background continuation. +/// Indicates whether the auto-managed `github` MCP server was removed (false when nothing to remove). /// ///
/// @@ -8618,12 +8520,12 @@ pub struct MetadataContextInfoResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct MetadataIsProcessingResult { - /// Whether the session is currently processing user/agent messages. False for non-local sessions (which don't run a local agentic loop). Reflects an in-flight turn or background continuation. - pub processing: bool, +pub struct 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). + pub removed: bool, } -/// Model identifier to use when re-tokenizing the session's existing messages. +/// Standard MCP resource annotations plus preserved non-standard annotation fields. /// ///
/// @@ -8633,12 +8535,22 @@ pub struct MetadataIsProcessingResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct MetadataRecomputeContextTokensRequest { - /// Model identifier used for tokenization. The runtime token-counts both chat-context and system-context messages against this model. - pub model_id: String, +pub struct McpResourceAnnotations { + /// Server-provided non-standard annotation fields preserved from the MCP response + #[serde(skip_serializing_if = "Option::is_none")] + pub additional_properties: Option>, + /// Intended audience roles for this resource + #[serde(skip_serializing_if = "Option::is_none")] + pub audience: Option>, + /// Last-modified timestamp hint + #[serde(skip_serializing_if = "Option::is_none")] + pub last_modified: Option, + /// Priority hint for model/client use + #[serde(skip_serializing_if = "Option::is_none")] + pub priority: Option, } -/// Re-tokenize the session's existing messages against `modelId` and return the token totals. Useful for hosts that want an initial estimate of context usage on session resume, before the next agent turn fires `session.context_info_changed` events. Returns zeros for an empty session. +/// A resource icon descriptor plus preserved non-standard icon fields. /// ///
/// @@ -8648,16 +8560,24 @@ pub struct MetadataRecomputeContextTokensRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct MetadataRecomputeContextTokensResult { - /// Tokens contributed by user/assistant/tool messages (excludes system/developer prompts). - pub messages_token_count: i64, - /// Tokens contributed by system/developer prompt snapshots. - pub system_token_count: i64, - /// Sum of tokens across chat-context and system-context messages currently held by the session. - pub total_tokens: i64, -} +pub struct McpResourceIcon { + /// Server-provided non-standard icon fields preserved from the MCP response + #[serde(skip_serializing_if = "Option::is_none")] + pub additional_properties: Option>, + /// Icon MIME type, when known + #[serde(skip_serializing_if = "Option::is_none")] + pub mime_type: Option, + /// Icon sizes hint + #[serde(skip_serializing_if = "Option::is_none")] + pub sizes: Option, + /// Icon URI + pub src: String, + /// Theme hint for this icon + #[serde(skip_serializing_if = "Option::is_none")] + pub theme: Option, +} -/// Updated working directory and git context. Emitted as the new payload of `session.context_changed`. +/// 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`. /// ///
/// @@ -8667,33 +8587,38 @@ pub struct MetadataRecomputeContextTokensResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionWorkingDirectoryContext { - /// Merge-base commit SHA (fork point from the remote default branch) +pub struct McpResource { + /// Resource-level metadata + #[serde(rename = "_meta", skip_serializing_if = "Option::is_none")] + pub meta: Option>, + /// Server-provided non-standard descriptor fields preserved from the MCP response #[serde(skip_serializing_if = "Option::is_none")] - pub base_commit: Option, - /// Current git branch name + pub additional_properties: Option>, + /// Model/client annotations associated with this resource #[serde(skip_serializing_if = "Option::is_none")] - pub branch: Option, - /// Current working directory path - pub cwd: String, - /// Root directory of the git repository, resolved via git rev-parse + pub annotations: Option, + /// Optional description of what this resource represents #[serde(skip_serializing_if = "Option::is_none")] - pub git_root: Option, - /// Head commit of the current git branch + pub description: Option, + /// Icons associated with this resource #[serde(skip_serializing_if = "Option::is_none")] - pub head_commit: Option, - /// Hosting platform type of the repository + pub icons: Option>, + /// MIME type of the resource, if known #[serde(skip_serializing_if = "Option::is_none")] - pub host_type: Option, - /// Repository identifier derived from the git remote URL ("owner/name" for GitHub, "org/project/repo" for Azure DevOps) + pub mime_type: Option, + /// The programmatic name of the resource + pub name: String, + /// Resource size in bytes, when known #[serde(skip_serializing_if = "Option::is_none")] - pub repository: Option, - /// Raw host string from the git remote URL (e.g. "github.com", "dev.azure.com") + pub size: Option, + /// Optional human-readable display title #[serde(skip_serializing_if = "Option::is_none")] - pub repository_host: Option, + pub title: Option, + /// The resource URI (e.g. ui://... or file:///...) + pub uri: String, } -/// Updated working-directory/git context to record on the session. +/// MCP resource content with URI, optional MIME type, text or base64 blob, and resource metadata. /// ///
/// @@ -8703,12 +8628,24 @@ pub struct SessionWorkingDirectoryContext { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct MetadataRecordContextChangeRequest { - /// Updated working directory and git context. Emitted as the new payload of `session.context_changed`. - pub context: SessionWorkingDirectoryContext, +pub struct McpResourceContent { + /// Resource-level metadata (CSP, permissions, etc.) + #[serde(rename = "_meta", skip_serializing_if = "Option::is_none")] + pub meta: Option>, + /// Base64-encoded binary content + #[serde(skip_serializing_if = "Option::is_none")] + pub blob: Option, + /// MIME type of the content + #[serde(skip_serializing_if = "Option::is_none")] + pub mime_type: Option, + /// Text content (e.g. HTML) + #[serde(skip_serializing_if = "Option::is_none")] + pub text: Option, + /// The resource URI + pub uri: String, } -/// Notify the session that its working directory context has changed. Emits a `session.context_changed` event so consumers (telemetry, OTel tracker, ACP, the timeline UI) can react. Use this when the host has detected a cwd/branch/repo change outside the session's normal lifecycle (e.g., after a shell command in interactive mode). For a local session, a report whose `cwd` diverges from the session's current working directory is ignored (the call still succeeds but records nothing and emits no event); move a local session's working directory via `metadata.setWorkingDirectory` instead. +/// MCP server whose resources to enumerate. /// ///
/// @@ -8718,9 +8655,15 @@ pub struct MetadataRecordContextChangeRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct MetadataRecordContextChangeResult {} +pub struct McpResourcesListRequest { + /// Opaque MCP pagination cursor from a prior `nextCursor` value + #[serde(skip_serializing_if = "Option::is_none")] + pub cursor: Option, + /// Name of the MCP server whose resources to enumerate + pub server_name: String, +} -/// Absolute path to set as the session's new working directory. For local sessions the path must be absolute and exist on disk: it is validated before any session state changes, and a failing validation rejects the call with nothing mutated, persisted, or emitted. Remote sessions record the path as-is. +/// One page of resources advertised by the named MCP server. /// ///
/// @@ -8730,12 +8673,15 @@ pub struct MetadataRecordContextChangeResult {} ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct MetadataSetWorkingDirectoryRequest { - /// Absolute path to set as the session's working directory. The runtime updates the session's recorded cwd so subsequent operations (shell tools, file lookups, telemetry) anchor to it. - pub working_directory: String, +pub struct McpResourcesListResult { + /// Opaque cursor for the next page, if the server has more resources + #[serde(skip_serializing_if = "Option::is_none")] + pub next_cursor: Option, + /// Resources advertised by the server (proxied MCP `resources/list`) + pub resources: Vec, } -/// Update the session's working directory. Used by the host when the user explicitly changes cwd (e.g., the `/cd` slash command). The host is responsible for any related side-effects (file index, etc.); it does NOT change the process working directory (a session's cwd is per-session, not process-global). For local sessions the runtime validates the target first (an absolute path that exists on disk) and re-bases the permission primary directory; a rejected validation fails the call before anything is mutated, persisted, or emitted. Location-scoped permission rules are then re-keyed to the new directory (best-effort). Remote sessions only record the path. +/// MCP server whose resource templates to enumerate. /// ///
/// @@ -8745,12 +8691,15 @@ pub struct MetadataSetWorkingDirectoryRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct MetadataSetWorkingDirectoryResult { - /// Working directory after the update - pub working_directory: String, +pub struct McpResourcesListTemplatesRequest { + /// Opaque MCP pagination cursor from a prior `nextCursor` value + #[serde(skip_serializing_if = "Option::is_none")] + pub cursor: Option, + /// Name of the MCP server whose resource templates to enumerate + pub server_name: String, } -/// The repository the remote session targets. +/// 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`. /// ///
/// @@ -8760,16 +8709,35 @@ pub struct MetadataSetWorkingDirectoryResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct MetadataSnapshotRemoteMetadataRepository { - /// The branch the remote session is operating on. - pub branch: String, - /// The GitHub repository name (without owner). +pub struct McpResourceTemplate { + /// Resource-template-level metadata + #[serde(rename = "_meta", skip_serializing_if = "Option::is_none")] + pub meta: Option>, + /// Server-provided non-standard descriptor fields preserved from the MCP response + #[serde(skip_serializing_if = "Option::is_none")] + pub additional_properties: Option>, + /// Model/client annotations associated with this template + #[serde(skip_serializing_if = "Option::is_none")] + pub annotations: Option, + /// Optional description of what this template is for + #[serde(skip_serializing_if = "Option::is_none")] + pub description: Option, + /// Icons associated with resources matching this template + #[serde(skip_serializing_if = "Option::is_none")] + pub icons: Option>, + /// MIME type for resources matching this template, if uniform + #[serde(skip_serializing_if = "Option::is_none")] + pub mime_type: Option, + /// The programmatic name of the resource template pub name: String, - /// The GitHub owner (user or organization) of the target repository. - pub owner: String, + /// Optional human-readable display title + #[serde(skip_serializing_if = "Option::is_none")] + pub title: Option, + /// An RFC 6570 URI template for constructing resource URIs + pub uri_template: String, } -/// Remote-session-specific metadata. Populated only when `isRemote` is true. Fields are immutable for the lifetime of the session. +/// One page of resource templates advertised by the named MCP server. /// ///
/// @@ -8779,21 +8747,15 @@ pub struct MetadataSnapshotRemoteMetadataRepository { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct MetadataSnapshotRemoteMetadata { - /// The pull request number the remote session is associated with, if any. - #[serde(skip_serializing_if = "Option::is_none")] - pub pull_request_number: Option, - /// The repository the remote session targets. - pub repository: MetadataSnapshotRemoteMetadataRepository, - /// The original resource identifier (task ID or PR node ID), preserved across event-replay reconstructions. Falls back to `sessionId` when absent. - #[serde(skip_serializing_if = "Option::is_none")] - pub resource_id: Option, - /// Whether the remote task originated from Copilot Coding Agent (cca) or a CLI `--remote` invocation. +pub struct McpResourcesListTemplatesResult { + /// Opaque cursor for the next page, if the server has more resource templates #[serde(skip_serializing_if = "Option::is_none")] - pub task_type: Option, + pub next_cursor: Option, + /// Resource templates advertised by the server (proxied MCP `resources/templates/list`) + pub resource_templates: Vec, } -/// Active server-driven promotion for a model, including its discount and optional expiry. +/// MCP server and resource URI to fetch. /// ///
/// @@ -8803,22 +8765,14 @@ pub struct MetadataSnapshotRemoteMetadata { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ModelBillingPromo { - /// Percentage discount (0-100) applied while the promotion is active. May be fractional. - #[serde(skip_serializing_if = "Option::is_none")] - pub discount_percent: Option, - /// 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. - #[serde(skip_serializing_if = "Option::is_none")] - pub ends_at: Option, - /// Stable identifier for the promotion campaign. - #[serde(skip_serializing_if = "Option::is_none")] - pub id: Option, - /// Human-readable promotion message. Does not include the expiry timestamp; consumers may format endsAt and append it when present. - #[serde(skip_serializing_if = "Option::is_none")] - pub message: Option, +pub struct McpResourcesReadRequest { + /// Name of the MCP server hosting the resource + pub server_name: String, + /// Resource URI + pub uri: String, } -/// Long context tier pricing (available for models with extended context windows) +/// Resource contents returned by the MCP server. /// ///
/// @@ -8828,38 +8782,12 @@ pub struct ModelBillingPromo { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ModelBillingTokenPricesLongContext { - /// Use cacheReadPrice instead. AI Credits cost per billing batch of cached tokens - #[doc(hidden)] - #[deprecated] - #[serde(skip_serializing_if = "Option::is_none")] - pub cache_price: Option, - /// AI Credits cost per billing batch of cached (read) tokens - #[serde(skip_serializing_if = "Option::is_none")] - pub cache_read_price: Option, - /// AI Credits cost per billing batch of 1-hour cache-write (cache creation) tokens. - #[serde(skip_serializing_if = "Option::is_none")] - pub cache_write1h_price: Option, - /// AI Credits cost per billing batch of cache-write (cache creation) tokens. - #[serde(skip_serializing_if = "Option::is_none")] - pub cache_write_price: Option, - /// 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. - #[doc(hidden)] - #[deprecated] - #[serde(skip_serializing_if = "Option::is_none")] - pub context_max: Option, - /// AI Credits cost per billing batch of input tokens - #[serde(skip_serializing_if = "Option::is_none")] - pub input_price: Option, - /// Prompt token budget for the long context tier. The total context window is this value plus the model's max_output_tokens. - #[serde(skip_serializing_if = "Option::is_none")] - pub max_prompt_tokens: Option, - /// AI Credits cost per billing batch of output tokens - #[serde(skip_serializing_if = "Option::is_none")] - pub output_price: Option, +pub struct McpResourcesReadResult { + /// Resource contents returned by the server + pub contents: Vec, } -/// Token-level pricing information for this model +/// 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. /// ///
/// @@ -8869,69 +8797,15 @@ pub struct ModelBillingTokenPricesLongContext { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ModelBillingTokenPrices { - /// Number of tokens per standard billing batch - #[serde(skip_serializing_if = "Option::is_none")] - pub batch_size: Option, - /// Use cacheReadPrice instead. AI Credits cost per billing batch of cached tokens - #[doc(hidden)] - #[deprecated] - #[serde(skip_serializing_if = "Option::is_none")] - pub cache_price: Option, - /// AI Credits cost per billing batch of cached (read) tokens - #[serde(skip_serializing_if = "Option::is_none")] - pub cache_read_price: Option, - /// AI Credits cost per billing batch of 1-hour cache-write (cache creation) tokens. - #[serde(skip_serializing_if = "Option::is_none")] - pub cache_write1h_price: Option, - /// AI Credits cost per billing batch of cache-write (cache creation) tokens. - #[serde(skip_serializing_if = "Option::is_none")] - pub cache_write_price: Option, - /// Use maxPromptTokens instead. Prompt token budget for the default tier. The total context window is this value plus the model's max_output_tokens. - #[doc(hidden)] - #[deprecated] - #[serde(skip_serializing_if = "Option::is_none")] - pub context_max: Option, - /// AI Credits cost per billing batch of input tokens - #[serde(skip_serializing_if = "Option::is_none")] - pub input_price: Option, - /// Long context tier pricing (available for models with extended context windows) - #[serde(skip_serializing_if = "Option::is_none")] - pub long_context: Option, - /// Prompt token budget for the default tier. The total context window is this value plus the model's max_output_tokens. - #[serde(skip_serializing_if = "Option::is_none")] - pub max_prompt_tokens: Option, - /// AI Credits cost per billing batch of output tokens +pub struct 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). #[serde(skip_serializing_if = "Option::is_none")] - pub output_price: Option, + pub config: Option, + /// Name of the MCP server to restart + pub server_name: String, } -/// Billing information -/// -///
-/// -/// **Experimental.** This type is part of an experimental wire-protocol surface -/// and may change or be removed in future SDK or CLI releases. -/// -///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct 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. - #[serde(skip_serializing_if = "Option::is_none")] - pub discount_percent: Option, - /// Billing cost multiplier relative to the base rate - #[serde(skip_serializing_if = "Option::is_none")] - pub multiplier: Option, - /// 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. - #[serde(skip_serializing_if = "Option::is_none")] - pub promo: Option, - /// Token-level pricing information for this model - #[serde(skip_serializing_if = "Option::is_none")] - pub token_prices: Option, -} - -/// Vision-specific limits +/// Per-field MCP telemetry-obfuscation policy. /// ///
/// @@ -8941,19 +8815,14 @@ pub struct ModelBilling { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ModelCapabilitiesLimitsVision { - /// Maximum image size in bytes - #[serde(rename = "max_prompt_image_size")] - pub max_prompt_image_size: i64, - /// Maximum number of images per prompt - #[serde(rename = "max_prompt_images")] - pub max_prompt_images: i64, - /// MIME types the model accepts - #[serde(rename = "supported_media_types")] - pub supported_media_types: Vec, +pub struct McpSafeForTelemetryFields { + /// Whether MCP tool input names may be included in telemetry without obfuscation. + pub inputs_names: bool, + /// Whether the MCP tool name may be included in telemetry without obfuscation. + pub name: bool, } -/// Token limits for prompts, outputs, and context window +/// Outcome of an MCP sampling execution: success result, failure error, or cancellation. /// ///
/// @@ -8963,25 +8832,18 @@ pub struct ModelCapabilitiesLimitsVision { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ModelCapabilitiesLimits { - /// Maximum total context window size in tokens - #[serde( - rename = "max_context_window_tokens", - skip_serializing_if = "Option::is_none" - )] - pub max_context_window_tokens: Option, - /// Maximum number of output/completion tokens - #[serde(rename = "max_output_tokens", skip_serializing_if = "Option::is_none")] - pub max_output_tokens: Option, - /// Maximum number of prompt/input tokens - #[serde(rename = "max_prompt_tokens", skip_serializing_if = "Option::is_none")] - pub max_prompt_tokens: Option, - /// Vision-specific limits +pub struct 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. + pub action: McpSamplingExecutionAction, + /// Error description, present when action='failure'. #[serde(skip_serializing_if = "Option::is_none")] - pub vision: Option, + pub error: Option, + /// 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. + #[serde(skip_serializing_if = "Option::is_none")] + pub result: Option, } -/// Feature flags indicating what the model supports +/// MCP server status entry, including config source/plugin source and any connection error. /// ///
/// @@ -8991,38 +8853,26 @@ pub struct ModelCapabilitiesLimits { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct 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). - #[serde(rename = "adaptive_thinking", skip_serializing_if = "Option::is_none")] - pub adaptive_thinking: Option, - /// Whether this model supports reasoning effort configuration +pub struct McpServer { + /// Error message if the server failed to connect #[serde(skip_serializing_if = "Option::is_none")] - pub reasoning_effort: Option, - /// Whether this model supports vision/image input + pub error: Option, + /// Server name (config key) + pub name: String, + /// Configuration source: user, workspace, plugin, or builtin #[serde(skip_serializing_if = "Option::is_none")] - pub vision: Option, -} - -/// Model capabilities and limits -/// -///
-/// -/// **Experimental.** This type is part of an experimental wire-protocol surface -/// and may change or be removed in future SDK or CLI releases. -/// -///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct ModelCapabilities { - /// Token limits for prompts, outputs, and context window + pub source: Option, + /// Plugin name that provided this server, when source is plugin. #[serde(skip_serializing_if = "Option::is_none")] - pub limits: Option, - /// Feature flags indicating what the model supports + pub source_plugin: Option, + /// Plugin version that provided this server, when source is plugin. #[serde(skip_serializing_if = "Option::is_none")] - pub supports: Option, + pub source_plugin_version: Option, + /// Connection status: connected, failed, needs-auth, pending, disabled, stopped, or not_configured + pub status: McpServerStatus, } -/// Policy state (if applicable) +/// Authentication settings with optional redirect port configuration. /// ///
/// @@ -9032,15 +8882,13 @@ pub struct ModelCapabilities { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ModelPolicy { - /// Current policy state for this model - pub state: ModelPolicyState, - /// Usage terms or conditions for this model +pub struct McpServerAuthConfigRedirectPort { + /// Fixed port for the OAuth redirect callback server. #[serde(skip_serializing_if = "Option::is_none")] - pub terms: Option, + pub redirect_port: Option, } -/// Copilot model metadata, including identifier, display name, capabilities, policy, billing, reasoning efforts, and picker categories. +/// Remote MCP server configuration accessed over HTTP or SSE. /// ///
/// @@ -9050,71 +8898,90 @@ pub struct ModelPolicy { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct Model { - /// Billing information +pub struct McpServerConfigHttp { + /// Set to `true` to use defaults, or provide an object with additional auth or OIDC settings. #[serde(skip_serializing_if = "Option::is_none")] - pub billing: Option, - /// Model capabilities and limits - pub capabilities: ModelCapabilities, - /// Default reasoning effort level (only present if model supports reasoning effort) + pub auth: Option, + /// Configuration warnings recorded while loading the server. #[serde(skip_serializing_if = "Option::is_none")] - pub default_reasoning_effort: Option, - /// Model identifier (e.g., "claude-sonnet-4.5") - pub id: String, - /// Model capability category for grouping in the model picker + pub config_warnings: Option>, + /// Controls if tools provided by this server can be loaded on demand via tool search (auto) or always included in the initial tool list (never) #[serde(skip_serializing_if = "Option::is_none")] - pub model_picker_category: Option, - /// Relative cost tier for token-based billing users + pub defer_tools: Option, + /// Whether secret masking is disabled for calls to this server. #[serde(skip_serializing_if = "Option::is_none")] - pub model_picker_price_category: Option, - /// Display name - pub name: String, - /// Policy state (if applicable) + pub disable_secret_masking: Option, + /// Set to true to disable persisted MCP tool snapshots for this server. Live tool discovery is unaffected. #[serde(skip_serializing_if = "Option::is_none")] - pub policy: Option, - /// 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. + pub disable_tool_cache: Option, + /// Optional human-readable server name. #[serde(skip_serializing_if = "Option::is_none")] - pub supported_context_tiers: Option>, - /// Supported reasoning effort levels (only present if model supports reasoning effort) + pub display_name: Option, + /// Event types this server receives as Copilot notifications. #[serde(skip_serializing_if = "Option::is_none")] - pub supported_reasoning_efforts: Option>, -} - -/// Managed, repository, and CLI model overrides to overlay onto the session at startup. -/// -///
-/// -/// **Experimental.** This type is part of an experimental wire-protocol surface -/// and may change or be removed in future SDK or CLI releases. -/// -///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct ModelApplyStartupOverlayRequest { - /// Model explicitly selected by the CLI, when provided. + pub events: Option>, + /// Tool names excluded after the include filter is applied. #[serde(skip_serializing_if = "Option::is_none")] - pub cli_model: Option, - /// Whether the overlay is being applied while resuming a deferred session. + pub exclude_tools: Option>, + /// Content filtering mode to apply to all tools, or a map of tool name to content filtering mode. #[serde(skip_serializing_if = "Option::is_none")] - pub deferred_resume: Option, - /// Model required by device-managed policy, when configured. + pub filter_mapping: Option, + /// HTTP headers to include in requests to the remote MCP server. #[serde(skip_serializing_if = "Option::is_none")] - pub device_managed_model: Option, - /// Context tier selected by repository settings, when configured. + pub headers: Option>, + /// Dynamic-header refresh cache lifetime in milliseconds. #[serde(skip_serializing_if = "Option::is_none")] - pub repo_context_tier: Option, - /// Model selected by repository settings, when configured. + pub headers_refresh_ttl_ms: Option, + /// Whether this server is a built-in fallback used when the user has not configured their own server. #[serde(skip_serializing_if = "Option::is_none")] - pub repo_model: Option, - /// Reasoning effort selected by repository settings, when configured. + pub is_default_server: Option, + /// Copilot notification types this server may send to the host. #[serde(skip_serializing_if = "Option::is_none")] - pub repo_reasoning_effort: Option, - /// Model required by server-managed policy, when configured. + pub notifications: Option>, + /// OAuth client ID for a pre-registered remote MCP OAuth client. #[serde(skip_serializing_if = "Option::is_none")] - pub server_managed_model: Option, + pub oauth_client_id: Option, + /// OAuth grant type to use when authenticating to the remote MCP server. + #[serde(skip_serializing_if = "Option::is_none")] + pub oauth_grant_type: Option, + /// Whether the configured OAuth client is public and does not require a client secret. + #[serde(skip_serializing_if = "Option::is_none")] + pub oauth_public_client: Option, + /// Set to `true` to use defaults, or provide an object with additional auth or OIDC settings. + #[serde(skip_serializing_if = "Option::is_none")] + pub oidc: Option, + /// Telemetry-obfuscation policy for this server's tools. + #[serde(skip_serializing_if = "Option::is_none")] + pub safe_for_telemetry: Option, + /// The origin of this server configuration. + #[serde(skip_serializing_if = "Option::is_none")] + pub source: Option, + /// Source file path recorded while loading the config. + #[serde(skip_serializing_if = "Option::is_none")] + pub source_path: Option, + /// Plugin that provided this server. + #[serde(skip_serializing_if = "Option::is_none")] + pub source_plugin: Option, + /// Whether the providing plugin uses the Open Plugin Spec. + #[serde(skip_serializing_if = "Option::is_none")] + pub source_plugin_spec: Option, + /// Version of the plugin that provided this server. + #[serde(skip_serializing_if = "Option::is_none")] + pub source_plugin_version: Option, + /// Timeout in milliseconds for tool discovery and tool calls. + #[serde(skip_serializing_if = "Option::is_none")] + pub timeout: Option, + /// Tools to include. Defaults to all tools if not specified. + #[serde(skip_serializing_if = "Option::is_none")] + pub tools: Option>, + /// Remote transport type. Defaults to "http" when omitted. + #[serde(skip_serializing_if = "Option::is_none")] + pub r#type: Option, + /// URL of the remote MCP server endpoint. + pub url: String, } -/// Vision-specific limits +/// In-process MCP server configuration used by embedded SDK clients. /// ///
/// @@ -9124,53 +8991,72 @@ pub struct ModelApplyStartupOverlayRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ModelCapabilitiesOverrideLimitsVision { - /// Maximum image size in bytes - #[serde( - rename = "max_prompt_image_size", - skip_serializing_if = "Option::is_none" - )] - pub max_prompt_image_size: Option, - /// Maximum number of images per prompt - #[serde(rename = "max_prompt_images", skip_serializing_if = "Option::is_none")] - pub max_prompt_images: Option, - /// MIME types the model accepts - #[serde( - rename = "supported_media_types", - skip_serializing_if = "Option::is_none" - )] - pub supported_media_types: Option>, -} - -/// Token limits for prompts, outputs, and context window -/// -///
-/// -/// **Experimental.** This type is part of an experimental wire-protocol surface -/// and may change or be removed in future SDK or CLI releases. -/// -///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct ModelCapabilitiesOverrideLimits { - /// Maximum total context window size in tokens - #[serde( - rename = "max_context_window_tokens", - skip_serializing_if = "Option::is_none" - )] - pub max_context_window_tokens: Option, - /// Maximum number of output/completion tokens - #[serde(rename = "max_output_tokens", skip_serializing_if = "Option::is_none")] - pub max_output_tokens: Option, - /// Maximum number of prompt/input tokens - #[serde(rename = "max_prompt_tokens", skip_serializing_if = "Option::is_none")] - pub max_prompt_tokens: Option, - /// Vision-specific limits +pub(crate) struct McpServerConfigMemory { + /// Configuration warnings recorded while loading the server. #[serde(skip_serializing_if = "Option::is_none")] - pub vision: Option, + pub config_warnings: Option>, + /// Controls whether tools can be loaded on demand. + #[serde(skip_serializing_if = "Option::is_none")] + pub defer_tools: Option, + /// Whether secret masking is disabled for calls to this server. + #[serde(skip_serializing_if = "Option::is_none")] + pub disable_secret_masking: Option, + /// Whether persisted tool snapshots are disabled. + #[serde(skip_serializing_if = "Option::is_none")] + pub disable_tool_cache: Option, + /// Optional human-readable server name. + #[serde(skip_serializing_if = "Option::is_none")] + pub display_name: Option, + /// Event types this server receives as Copilot notifications. + #[serde(skip_serializing_if = "Option::is_none")] + pub events: Option>, + /// Tool names excluded after the include filter is applied. + #[serde(skip_serializing_if = "Option::is_none")] + pub exclude_tools: Option>, + /// Content filtering mode to apply to this server's tools. + #[serde(skip_serializing_if = "Option::is_none")] + pub filter_mapping: Option, + /// Whether this server is a built-in fallback. + #[serde(skip_serializing_if = "Option::is_none")] + pub is_default_server: Option, + /// Copilot notification types this server may send to the host. + #[serde(skip_serializing_if = "Option::is_none")] + pub notifications: Option>, + /// Set to `true` to use default OIDC settings. + #[serde(skip_serializing_if = "Option::is_none")] + pub oidc: Option, + /// Telemetry-obfuscation policy for this server's tools. + #[serde(skip_serializing_if = "Option::is_none")] + pub safe_for_telemetry: Option, + /// In-process MCP server instance. This value cannot cross a JSON-RPC boundary. + #[doc(hidden)] + pub(crate) server_instance: serde_json::Value, + /// The origin of this server configuration. + #[serde(skip_serializing_if = "Option::is_none")] + pub source: Option, + /// Source file path recorded while loading the config. + #[serde(skip_serializing_if = "Option::is_none")] + pub source_path: Option, + /// Plugin that provided this server. + #[serde(skip_serializing_if = "Option::is_none")] + pub source_plugin: Option, + /// Whether the providing plugin uses the Open Plugin Spec. + #[serde(skip_serializing_if = "Option::is_none")] + pub source_plugin_spec: Option, + /// Version of the plugin that provided this server. + #[serde(skip_serializing_if = "Option::is_none")] + pub source_plugin_version: Option, + /// Timeout in milliseconds for tool discovery and tool calls. + #[serde(skip_serializing_if = "Option::is_none")] + pub timeout: Option, + /// Tools to include. Defaults to all tools if not specified. + #[serde(skip_serializing_if = "Option::is_none")] + pub tools: Option>, + #[doc(hidden)] + pub(crate) r#type: McpServerConfigMemoryType, } -/// Feature flags indicating what the model supports +/// Stdio MCP server configuration launched as a child process. /// ///
/// @@ -9180,19 +9066,84 @@ pub struct ModelCapabilitiesOverrideLimits { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct 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). - #[serde(rename = "adaptive_thinking", skip_serializing_if = "Option::is_none")] - pub adaptive_thinking: Option, - /// Whether this model supports reasoning effort configuration +pub struct McpServerConfigStdio { + /// Command-line arguments passed to the Stdio MCP server process. #[serde(skip_serializing_if = "Option::is_none")] - pub reasoning_effort: Option, - /// Whether this model supports vision/image input + pub args: Option>, + /// Set to `true` to use defaults, or provide an object with additional auth or OIDC settings. #[serde(skip_serializing_if = "Option::is_none")] - pub vision: Option, + pub auth: Option, + /// Executable command used to start the Stdio MCP server process. + pub command: String, + /// Configuration warnings recorded while loading the server. + #[serde(skip_serializing_if = "Option::is_none")] + pub config_warnings: Option>, + /// Working directory for the Stdio MCP server process. + #[serde(skip_serializing_if = "Option::is_none")] + pub cwd: Option, + /// Controls if tools provided by this server can be loaded on demand via tool search (auto) or always included in the initial tool list (never) + #[serde(skip_serializing_if = "Option::is_none")] + pub defer_tools: Option, + /// Whether secret masking is disabled for calls to this server. + #[serde(skip_serializing_if = "Option::is_none")] + pub disable_secret_masking: Option, + /// Set to true to disable persisted MCP tool snapshots for this server. Live tool discovery is unaffected. + #[serde(skip_serializing_if = "Option::is_none")] + pub disable_tool_cache: Option, + /// Optional human-readable server name. + #[serde(skip_serializing_if = "Option::is_none")] + pub display_name: Option, + /// Environment variables to pass to the Stdio MCP server process. + #[serde(skip_serializing_if = "Option::is_none")] + pub env: Option>, + /// Event types this server receives as Copilot notifications. + #[serde(skip_serializing_if = "Option::is_none")] + pub events: Option>, + /// Tool names excluded after the include filter is applied. + #[serde(skip_serializing_if = "Option::is_none")] + pub exclude_tools: Option>, + /// Content filtering mode to apply to all tools, or a map of tool name to content filtering mode. + #[serde(skip_serializing_if = "Option::is_none")] + pub filter_mapping: Option, + /// Whether this server is a built-in fallback used when the user has not configured their own server. + #[serde(skip_serializing_if = "Option::is_none")] + pub is_default_server: Option, + /// Copilot notification types this server may send to the host. + #[serde(skip_serializing_if = "Option::is_none")] + pub notifications: Option>, + /// Set to `true` to use defaults, or provide an object with additional auth or OIDC settings. + #[serde(skip_serializing_if = "Option::is_none")] + pub oidc: Option, + /// Telemetry-obfuscation policy for this server's tools. + #[serde(skip_serializing_if = "Option::is_none")] + pub safe_for_telemetry: Option, + /// The origin of this server configuration. + #[serde(skip_serializing_if = "Option::is_none")] + pub source: Option, + /// Source file path recorded while loading the config. + #[serde(skip_serializing_if = "Option::is_none")] + pub source_path: Option, + /// Plugin that provided this server. + #[serde(skip_serializing_if = "Option::is_none")] + pub source_plugin: Option, + /// Whether the providing plugin uses the Open Plugin Spec. + #[serde(skip_serializing_if = "Option::is_none")] + pub source_plugin_spec: Option, + /// Version of the plugin that provided this server. + #[serde(skip_serializing_if = "Option::is_none")] + pub source_plugin_version: Option, + /// Timeout in milliseconds for tool discovery and tool calls. + #[serde(skip_serializing_if = "Option::is_none")] + pub timeout: Option, + /// Tools to include. Defaults to all tools if not specified. + #[serde(skip_serializing_if = "Option::is_none")] + pub tools: Option>, + /// Local transport type. Defaults to stdio when omitted. + #[serde(skip_serializing_if = "Option::is_none")] + pub r#type: Option, } -/// Optional capability overrides (vision, tool_calls, reasoning, etc.). +/// MCP servers configured for the session, with their connection status and host-level state. /// ///
/// @@ -9202,16 +9153,15 @@ pub struct ModelCapabilitiesOverrideSupports { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ModelCapabilitiesOverride { - /// Token limits for prompts, outputs, and context window - #[serde(skip_serializing_if = "Option::is_none")] - pub limits: Option, - /// Feature flags indicating what the model supports +pub struct McpServerList { + /// Host-level state, omitted when no MCP host is initialized. #[serde(skip_serializing_if = "Option::is_none")] - pub supports: Option, + pub host: Option, + /// Configured MCP servers + pub servers: Vec, } -/// List of Copilot models available to the resolved user, including capabilities and billing metadata. +/// Mode controlling how MCP server env values are resolved (`direct` or `indirect`). /// ///
/// @@ -9221,12 +9171,12 @@ pub struct ModelCapabilitiesOverride { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ModelList { - /// List of available models with full metadata - pub models: Vec, +pub struct 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". + pub mode: McpSetEnvValueModeDetails, } -/// Optional listing options. +/// Env-value mode recorded on the session after the update. /// ///
/// @@ -9236,13 +9186,12 @@ pub struct ModelList { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ModelListRequest { - /// If true, bypasses the per-session model list cache and re-fetches from CAPI. - #[serde(skip_serializing_if = "Option::is_none")] - pub skip_cache: Option, +pub struct McpSetEnvValueModeResult { + /// Mode recorded on the session after the update + pub mode: McpSetEnvValueModeDetails, } -/// Filesystem and environment context used to resolve model-picker settings. +/// 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. /// ///
/// @@ -9252,16 +9201,15 @@ pub struct ModelListRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ModelPickerSettingsContext { - /// Optional Copilot configuration directory containing persisted settings. +pub struct 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). #[serde(skip_serializing_if = "Option::is_none")] - pub config_dir: Option, - /// Environment variables consulted while resolving model-picker settings. - pub environment: serde_json::Value, - /// User home directory used when resolving persisted settings. - pub home_directory: String, + pub config: Option, + /// Name of the MCP server to start + pub server_name: String, } +/// MCP server startup filtering result. /// ///
/// @@ -9271,18 +9219,18 @@ pub struct ModelPickerSettingsContext { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ModelPickerPersistenceRequest { - /// Whether context tier was explicitly selected and should be persisted. +pub struct McpStartServersResult { + /// Non-default servers allowed by policy #[serde(skip_serializing_if = "Option::is_none")] - pub context_tier_explicit: Option, - /// Whether reasoning effort was explicitly selected and should be persisted. + pub allowed_servers: Option>, + /// Servers whose connection attempt failed. #[serde(skip_serializing_if = "Option::is_none")] - pub reasoning_effort_explicit: Option, - /// Filesystem and environment context used to resolve settings persistence. - pub settings_context: ModelPickerSettingsContext, + pub failed_servers: Option>, + /// Servers filtered out before startup + pub filtered_servers: Vec, } -/// Reasoning effort level to apply to the currently selected model. +/// Server name for an individual MCP server stop. /// ///
/// @@ -9292,12 +9240,12 @@ pub struct ModelPickerPersistenceRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct 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. - pub reasoning_effort: String, +pub struct McpStopServerRequest { + /// Name of the MCP server to stop + pub server_name: String, } -/// 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. +/// Metadata controlling an MCP task's lifetime. /// ///
/// @@ -9307,12 +9255,13 @@ pub struct ModelSetReasoningEffortRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ModelSetReasoningEffortResult { - /// Reasoning effort level recorded on the session after the update - pub reasoning_effort: String, +pub struct McpTaskMetadata { + /// Task time-to-live. + #[serde(skip_serializing_if = "Option::is_none")] + pub ttl: Option, } -/// Optional opaque account selection or compatibility GitHub token used to list models. +/// Server name identifying the external client to remove. /// ///
/// @@ -9322,15 +9271,12 @@ pub struct ModelSetReasoningEffortResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ModelsListRequest { - /// GitHub token accepted for compatibility with existing SDK clients. When provided, resolves this token instead of using the current account. - #[serde(skip_serializing_if = "Option::is_none")] - pub git_hub_token: Option, - /// Opaque account identifier returned by `account.getAllUsers`. When omitted, the current account is used. - #[serde(skip_serializing_if = "Option::is_none")] - pub selection_id: Option, +pub(crate) struct McpUnregisterExternalClientRequest { + /// Server name of the external client to unregister + pub server_name: String, } +/// Memory configuration for this session. /// ///
/// @@ -9340,70 +9286,85 @@ pub struct ModelsListRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ModelSwitchConfirmation { - /// Current conversation token count before switching models. - pub current_tokens: f64, - /// Target model token limit used by the compaction preflight. - pub target_limit: f64, - /// Display name of the model that requires compaction confirmation. - pub target_model_display_name: String, +pub struct MemoryConfiguration { + /// Whether memory is enabled for the session. + pub enabled: bool, } -/// Target model identifier and optional reasoning effort, summary, capability overrides, and context tier. -/// -///
-/// -/// **Experimental.** This type is part of an experimental wire-protocol surface -/// and may change or be removed in future SDK or CLI releases. -/// -///
+/// The six normalized `/context` header buckets, computed from the same tokenization as `entries` so the two never disagree. Convenience rollups: `freeSpace` and `buffer` describe window capacity rather than occupied context, so the values do not sum to `totalTokens`. #[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ModelSwitchToRequest { - /// Explicit response to a model-switch compaction preflight. Omit to request a confirmation projection when compaction is necessary. - #[serde(skip_serializing_if = "Option::is_none")] - pub compaction_decision: Option, - /// 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. - #[serde(skip_serializing_if = "Option::is_none")] - pub context_tier: Option, - /// 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). - #[serde(skip_serializing_if = "Option::is_none")] - pub defer_if_model_change_queued: Option, - /// Override individual model capabilities resolved by the runtime +pub struct MetadataContextAttributionResultContextAttributionCategories { + /// Output reserve plus post-blocking-threshold buffer. + pub buffer: i64, + /// Custom-instructions tokens (0 when none are configured). + pub custom_instructions: i64, + /// Remaining unused window capacity (clamped at 0). + pub free_space: i64, + /// MCP tool-definition tokens. + pub mcp_tools: i64, + /// Conversation (user/assistant/tool) message tokens. + pub messages: i64, + /// System prompt tokens, excluding custom instructions. + pub system_prompt: i64, + /// Non-MCP tool-definition tokens. + pub system_tools: i64, +} + +/// Successful compaction history for the session. +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct MetadataContextAttributionResultContextAttributionCompactions { + /// Number of successful compactions in this session. + pub count: i64, +} + +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct MetadataContextAttributionResultContextAttributionEntriesItem { + /// Supplementary per-entry metadata (e.g. `messageCount`, `role`, `evictable`, `pluginSource`). Values are stringified; parse as needed and ignore unrecognized keys. #[serde(skip_serializing_if = "Option::is_none")] - pub model_capabilities: Option, - /// Settings scope used when persisting the selected model. + pub attributes: Option>, + /// Identifier for this entry, formed by joining its `kind` and source name (e.g. `tool:bash`, `skill:tmux`, `toolDefinition:bash`); unique within the snapshot. Use it to match the same entry across snapshots, to correlate with other APIs (skill/agent/MCP registries), and as the `parentId` target for nesting. Distinct from the human-facing `label`. + pub id: String, + /// Source category for this entry. Not a closed set — tolerate unknown values. Known values today: `skill`, `subagent`, `mcpServer`, `tool`, `system`, `toolDefinition`, `plugin`. + pub kind: String, + /// Human-readable display label, e.g. `bash` or `skill: tmux`. Presentation-only; may be localized/reformatted without notice — do not key off it. + pub label: String, + /// Optional `id` of the parent entry: e.g. a `plugin` entry parenting its `skill`/`mcpServer` entries, or the `system` entry parenting `toolDefinition` entries. Omitted for top-level entries. #[serde(skip_serializing_if = "Option::is_none")] - pub model_change_scope: Option, - /// 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. + pub parent_id: Option, + /// Token count currently in context attributable to this entry. + pub tokens: i64, +} + +/// Per-source token attribution snapshot for the current context window. The heaviest individual messages are available separately via `metadata.getContextHeaviestMessages`. +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct MetadataContextAttributionResultContextAttribution { + /// Output reserve plus the tokens past the buffer-exhaustion blocking threshold. Mirrors `SessionContextInfo.bufferTokens`. + pub buffer_tokens: i64, + /// The six normalized `/context` header buckets, computed from the same tokenization as `entries` so the two never disagree. Convenience rollups: `freeSpace` and `buffer` describe window capacity rather than occupied context, so the values do not sum to `totalTokens`. + pub categories: MetadataContextAttributionResultContextAttributionCategories, + /// Successful compaction history for the session. + pub compactions: MetadataContextAttributionResultContextAttributionCompactions, + /// Token count at which background compaction starts. Mirrors `SessionContextInfo.compactionThreshold`. + pub compaction_threshold: i64, + /// Flat list of per-source attribution entries. Group by `kind` and render unrecognized kinds generically. Nesting and rollups are expressed via `parentId`. + pub entries: Vec, + /// Prompt limit plus the model's output reserve: the full context window `categories.freeSpace` and `categories.buffer` are measured against. Mirrors `SessionContextInfo.limit`. + pub limit: i64, + /// The concrete model id the entire breakdown was tokenized against (feeds the per-model token multiplier). Under `Auto` (Free/Student) this is the resolved model, not the literal `auto` sentinel, so totals are not undercounted. A single-model approximation of a potentially multi-model Auto session. pub model_id: String, - /// Optional settings context and explicit-override flags used to persist a picker selection. - #[serde(skip_serializing_if = "Option::is_none")] - pub picker_persistence: Option, - /// 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. - #[serde(skip_serializing_if = "Option::is_none")] - pub reasoning_effort: Option, - /// Reasoning summary mode to request for supported model clients - #[serde(skip_serializing_if = "Option::is_none")] - pub reasoning_summary: Option, - /// Optional repository settings scope to persist after the switch commits. - #[serde(skip_serializing_if = "Option::is_none")] - pub repo_scope: Option, - /// Require the target to be currently available and enabled before applying the switch. - #[serde(skip_serializing_if = "Option::is_none")] - pub require_available: Option, - /// When true, evaluate context-window compaction policy before applying the switch. - #[serde(skip_serializing_if = "Option::is_none")] - pub run_compaction_preflight: Option, - /// Origin to record on the effective `session.model_change` event. Defaults to `sdk` when omitted. - #[serde(skip_serializing_if = "Option::is_none")] - pub source: Option, - /// Output verbosity level to request for supported models - #[serde(skip_serializing_if = "Option::is_none")] - pub verbosity: Option, + /// How `modelId` was chosen. Not a closed set — tolerate unknown values. Known values today: `autoResolved` (the model Auto resolved to), `selected` (the user's explicitly selected model), `default` (a fallback before any model is known). + pub model_source: String, + /// Maximum prompt tokens the resolved model accepts — the denominator for a `##k/###k` context-usage display. Mirrors `SessionContextInfo.promptTokenLimit`. + pub prompt_token_limit: i64, + /// Total token count of the current context window the entries are measured against (system message + conversation messages + tool definitions — the same total reported by /context). Divide an entry's `tokens` by this to derive its share. + pub total_tokens: i64, } -/// The model identifier active on the session after the switch. +/// Per-source attribution breakdown for the session's current context window, or null if uninitialized. /// ///
/// @@ -9413,34 +9374,12 @@ pub struct ModelSwitchToRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ModelSwitchToResult { - /// Compaction confirmation projection when status is confirmation_required - #[serde(skip_serializing_if = "Option::is_none")] - pub confirmation: Option, - /// 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. - #[serde(skip_serializing_if = "Option::is_none")] - pub deferred: Option, - /// Deprecation warnings associated with the selected model or options. - #[serde(skip_serializing_if = "Option::is_none")] - pub deprecation_warnings: Option>, - /// User-facing outcome message for the model switch. - #[serde(skip_serializing_if = "Option::is_none")] - pub message: Option, - /// Currently active model identifier after the switch - #[serde(skip_serializing_if = "Option::is_none")] - pub model_id: Option, - /// Persistence failure encountered after applying the model switch. - #[serde(skip_serializing_if = "Option::is_none")] - pub persistence_error: Option, - /// Lifecycle result for the requested switch - #[serde(skip_serializing_if = "Option::is_none")] - pub status: Option, - /// User-facing warning produced while applying the model switch. - #[serde(skip_serializing_if = "Option::is_none")] - pub warning: Option, +pub struct MetadataContextAttributionResult { + /// Per-source context-window attribution, or null if the session has not yet been initialized (no system prompt or tool metadata cached). + pub context_attribution: Option, } -/// Agent interaction mode to apply to the session. +/// Parameters for the heaviest-messages query. /// ///
/// @@ -9450,42 +9389,13 @@ pub struct ModelSwitchToResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ModeSetRequest { - /// Explicit response to a model-switch compaction preflight. - #[serde(skip_serializing_if = "Option::is_none")] - pub compaction_decision: Option, - /// Session whose plan-mode base state should be inherited. - #[serde(skip_serializing_if = "Option::is_none")] - pub inherit_plan_base_from_session_id: Option, - /// The session mode the agent is operating in - pub mode: SessionMode, - /// Whether the selected plan model should be persisted. - #[serde(skip_serializing_if = "Option::is_none")] - pub persist_plan_selection: Option, - /// Settings context used when persisting the selected plan model. - #[serde(skip_serializing_if = "Option::is_none")] - pub picker_settings_context: Option, - /// Context tier to use with the dedicated plan model. - #[serde(skip_serializing_if = "Option::is_none")] - pub plan_context_tier: Option, - /// Action to perform when leaving plan mode. - #[serde(skip_serializing_if = "Option::is_none")] - pub plan_exit_action: Option, - /// Dedicated model to use in plan mode, when configured. - #[serde(skip_serializing_if = "Option::is_none")] - pub plan_model: Option, - /// Whether a dedicated plan model is configured. - #[serde(skip_serializing_if = "Option::is_none")] - pub plan_model_configured: Option, - /// Reasoning effort to use with the dedicated plan model. - #[serde(skip_serializing_if = "Option::is_none")] - pub plan_reasoning_effort: Option, - /// Whether leaving plan mode should restore the session's previous model. +pub struct MetadataContextHeaviestMessagesRequest { + /// Maximum number of messages to return, most-expensive first. Omit for the server default. #[serde(skip_serializing_if = "Option::is_none")] - pub restore_plan_model: Option, + pub limit: Option, } -/// Outcome of a session mode change, including any model switch it triggered and follow-up the host must perform. +/// The heaviest individual messages in the session's context window, most-expensive first. /// ///
/// @@ -9495,32 +9405,14 @@ pub struct ModeSetRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ModeSetResult { - /// Whether the host should arm an interactive continuation after the mode change. - #[serde(skip_serializing_if = "Option::is_none")] - pub arm_interactive_continuation: Option, - /// Compaction confirmation required before the mode change can complete. - #[serde(skip_serializing_if = "Option::is_none")] - pub confirmation: Option, - /// Whether the host must defer implementing the requested mode change. - #[serde(skip_serializing_if = "Option::is_none")] - pub defer_implementation: Option, - /// Deprecation warnings associated with the model selected by the mode change. - #[serde(skip_serializing_if = "Option::is_none")] - pub deprecation_warnings: Option>, - /// User-facing outcome message for the model switch triggered by the mode change. - #[serde(skip_serializing_if = "Option::is_none")] - pub message: Option, - /// Whether applying the mode changed the active model. - pub model_changed: bool, - /// Lifecycle status of the requested mode change. - pub status: String, - /// User-facing warning produced while applying the mode change. - #[serde(skip_serializing_if = "Option::is_none")] - pub warning: Option, +pub struct MetadataContextHeaviestMessagesResult { + /// Heaviest messages, most-expensive first. + pub messages: Vec, + /// Total token count of the current context window, so callers can compute each message's share without a second call. + pub total_tokens: i64, } -/// Azure-specific provider options. +/// Model identifier and token limits used to compute the context-info breakdown. /// ///
/// @@ -9530,69 +9422,43 @@ pub struct ModeSetResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ProviderConfigAzure { - /// API version. When set, uses the versioned deployment route. When omitted, uses the GA versionless v1 route. +pub struct MetadataContextInfoRequest { + /// Maximum output tokens allowed by the target model. Pass 0 if unknown. + pub output_token_limit: i64, + /// Maximum prompt tokens allowed by the target model. Pass 0 to use the runtime default. + pub prompt_token_limit: i64, + /// Model identifier used for tokenization. Omit to use the session default. Used both for token counting and to compute display values. #[serde(skip_serializing_if = "Option::is_none")] - pub api_version: Option, + pub selected_model: Option, } -/// External SDK input for a named custom model provider. Ingested by the native protocol boundary before host dispatch. -/// -///
-/// -/// **Experimental.** This type is part of an experimental wire-protocol surface -/// and may change or be removed in future SDK or CLI releases. -/// -///
+/// Token-usage breakdown for the session's current context window #[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct NamedProviderConfig { - /// Static API key used to authenticate provider requests. - #[serde(skip_serializing_if = "Option::is_none")] - pub api_key: Option, - /// Azure authentication configuration for the provider. - #[serde(skip_serializing_if = "Option::is_none")] - pub azure: Option, - /// Base URL for provider API requests. - pub base_url: String, - /// Static bearer token used to authenticate provider requests. - #[serde(skip_serializing_if = "Option::is_none")] - pub bearer_token: Option, - /// Whether the host supplies bearer tokens dynamically. - #[serde(skip_serializing_if = "Option::is_none")] - pub has_bearer_token_provider: Option, - /// Additional HTTP headers included with provider requests. - #[serde(skip_serializing_if = "Option::is_none")] - pub headers: Option>, - /// Unique provider name used to qualify model selection IDs. - pub name: String, - /// Transport used to communicate with the provider. - #[serde(skip_serializing_if = "Option::is_none")] - pub transport: Option, - /// Provider protocol family. - #[serde(skip_serializing_if = "Option::is_none")] - pub r#type: Option, - /// Wire API used to communicate with the provider. - #[serde(skip_serializing_if = "Option::is_none")] - pub wire_api: Option, -} - -/// The session's friendly name, or null when not yet set. -/// -///
-/// -/// **Experimental.** This type is part of an experimental wire-protocol surface -/// and may change or be removed in future SDK or CLI releases. -/// -///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct NameGetResult { - /// The session name (user-set or auto-generated), or null if not yet set - pub name: Option, +pub struct MetadataContextInfoResultContextInfo { + /// Output reserve plus tokens after the buffer-exhaustion blocking threshold (default 95%) + pub buffer_tokens: i64, + /// Token count at which background compaction starts (configurable percentage of promptTokenLimit) + pub compaction_threshold: i64, + /// Tokens consumed by user/assistant/tool messages + pub conversation_tokens: i64, + /// Prompt token limit plus the model's full output token limit. + pub limit: i64, + /// Tokens consumed by MCP tool definitions (subset of toolDefinitionsTokens, excludes deferred tools) + pub mcp_tools_tokens: i64, + /// The model used for token counting + pub model_name: String, + /// Maximum prompt tokens allowed by the model (or DEFAULT_TOKEN_LIMIT if unspecified) + pub prompt_token_limit: i64, + /// Tokens consumed by the system prompt + pub system_tokens: i64, + /// Tokens consumed by tool definitions sent to the model (excludes deferred tools) + pub tool_definitions_tokens: i64, + /// Sum of system, conversation and tool-definition tokens + pub total_tokens: i64, } -/// Auto-generated session summary to apply as the session's name when no user-set name exists. +/// Token breakdown for the session's current context window, or null if uninitialized. /// ///
/// @@ -9602,12 +9468,12 @@ pub struct NameGetResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct NameSetAutoRequest { - /// Auto-generated session summary. Empty/whitespace-only values are ignored; values are trimmed before persisting. - pub summary: String, +pub struct MetadataContextInfoResult { + /// Token breakdown for the current context window, or null if the session has not yet been initialized (no system prompt or tool metadata cached). + pub context_info: Option, } -/// Indicates whether the auto-generated summary was applied as the session's name. +/// Indicates whether the local session is currently processing a turn or background continuation. /// ///
/// @@ -9617,12 +9483,12 @@ pub struct NameSetAutoRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct 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. - pub applied: bool, +pub struct MetadataIsProcessingResult { + /// Whether the session is currently processing user/agent messages. False for non-local sessions (which don't run a local agentic loop). Reflects an in-flight turn or background continuation. + pub processing: bool, } -/// New friendly name to apply to the session. +/// Model identifier to use when re-tokenizing the session's existing messages. /// ///
/// @@ -9632,12 +9498,12 @@ pub struct NameSetAutoResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct NameSetRequest { - /// New session name (1–100 characters, trimmed of leading/trailing whitespace) - pub name: String, +pub struct MetadataRecomputeContextTokensRequest { + /// Model identifier used for tokenization. The runtime token-counts both chat-context and system-context messages against this model. + pub model_id: String, } -/// Source descriptor for a `session.options.update` content-exclusion rule, with source name and type. +/// Re-tokenize the session's existing messages against `modelId` and return the token totals. Useful for hosts that want an initial estimate of context usage on session resume, before the next agent turn fires `session.context_info_changed` events. Returns zeros for an empty session. /// ///
/// @@ -9647,14 +9513,16 @@ pub struct NameSetRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct OptionsUpdateAdditionalContentExclusionPolicyRuleSource { - /// Name of the policy source. - pub name: String, - /// Type of the policy source. - pub r#type: String, +pub struct MetadataRecomputeContextTokensResult { + /// Tokens contributed by user/assistant/tool messages (excludes system/developer prompts). + pub messages_token_count: i64, + /// Tokens contributed by system/developer prompt snapshots. + pub system_token_count: i64, + /// Sum of tokens across chat-context and system-context messages currently held by the session. + pub total_tokens: i64, } -/// Single content-exclusion rule supplied to `session.options.update`, with paths, match conditions, and source. +/// Updated working directory and git context. Emitted as the new payload of `session.context_changed`. /// ///
/// @@ -9664,20 +9532,33 @@ pub struct OptionsUpdateAdditionalContentExclusionPolicyRuleSource { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct OptionsUpdateAdditionalContentExclusionPolicyRule { - /// Conditions of which at least one must match. +pub struct SessionWorkingDirectoryContext { + /// Merge-base commit SHA (fork point from the remote default branch) #[serde(skip_serializing_if = "Option::is_none")] - pub if_any_match: Option>, - /// Conditions none of which may match. + pub base_commit: Option, + /// Current git branch name #[serde(skip_serializing_if = "Option::is_none")] - pub if_none_match: Option>, - /// Path patterns covered by this rule. - pub paths: Vec, - /// Source descriptor for a `session.options.update` content-exclusion rule, with source name and type. - pub source: OptionsUpdateAdditionalContentExclusionPolicyRuleSource, + pub branch: Option, + /// Current working directory path + pub cwd: String, + /// Root directory of the git repository, resolved via git rev-parse + #[serde(skip_serializing_if = "Option::is_none")] + pub git_root: Option, + /// Head commit of the current git branch + #[serde(skip_serializing_if = "Option::is_none")] + pub head_commit: Option, + /// Hosting platform type of the repository + #[serde(skip_serializing_if = "Option::is_none")] + pub host_type: Option, + /// Repository identifier derived from the git remote URL ("owner/name" for GitHub, "org/project/repo" for Azure DevOps) + #[serde(skip_serializing_if = "Option::is_none")] + pub repository: Option, + /// Raw host string from the git remote URL (e.g. "github.com", "dev.azure.com") + #[serde(skip_serializing_if = "Option::is_none")] + pub repository_host: Option, } -/// Content-exclusion policy supplied to `session.options.update`, with rules, last-updated data, and scope. +/// Updated working-directory/git context to record on the session. /// ///
/// @@ -9687,17 +9568,12 @@ pub struct OptionsUpdateAdditionalContentExclusionPolicyRule { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct OptionsUpdateAdditionalContentExclusionPolicy { - /// Opaque policy update timestamp supplied by the host. - #[serde(rename = "last_updated_at")] - pub last_updated_at: serde_json::Value, - /// Content-exclusion rules to apply. - pub rules: Vec, - /// Allowed values for the `OptionsUpdateAdditionalContentExclusionPolicyScope` enumeration. - pub scope: OptionsUpdateAdditionalContentExclusionPolicyScope, +pub struct MetadataRecordContextChangeRequest { + /// Updated working directory and git context. Emitted as the new payload of `session.context_changed`. + pub context: SessionWorkingDirectoryContext, } -/// Pending permission prompt reconstructed from event history, with request ID and user-facing prompt details. +/// Notify the session that its working directory context has changed. Emits a `session.context_changed` event so consumers (telemetry, OTel tracker, ACP, the timeline UI) can react. Use this when the host has detected a cwd/branch/repo change outside the session's normal lifecycle (e.g., after a shell command in interactive mode). For a local session, a report whose `cwd` diverges from the session's current working directory is ignored (the call still succeeds but records nothing and emits no event); move a local session's working directory via `metadata.setWorkingDirectory` instead. /// ///
/// @@ -9705,16 +9581,11 @@ pub struct OptionsUpdateAdditionalContentExclusionPolicy { /// and may change or be removed in future SDK or CLI releases. /// ///
-#[derive(Debug, Clone, Serialize, Deserialize)] +#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PendingPermissionRequest { - /// The user-facing permission prompt details (commands, write, read, mcp, url, memory, custom-tool, path, hook) - pub request: PermissionPromptRequest, - /// Unique identifier for the pending permission request - pub request_id: RequestId, -} +pub struct MetadataRecordContextChangeResult {} -/// List of pending permission requests reconstructed from event history. +/// Absolute path to set as the session's new working directory. For local sessions the path must be absolute and exist on disk: it is validated before any session state changes, and a failing validation rejects the call with nothing mutated, persisted, or emitted. Remote sessions record the path as-is. /// ///
/// @@ -9724,12 +9595,12 @@ pub struct PendingPermissionRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PendingPermissionRequestList { - /// Pending permission prompts reconstructed from the session's event history. Equivalent to the set of `permission.requested` events that have not yet been followed by a matching `permission.completed` event. Used by clients (e.g. the CLI) to hydrate UI for prompts that were emitted before the client attached to the session. - pub items: Vec, +pub struct MetadataSetWorkingDirectoryRequest { + /// Absolute path to set as the session's working directory. The runtime updates the session's recorded cwd so subsequent operations (shell tools, file lookups, telemetry) anchor to it. + pub working_directory: String, } -/// Permission-decision request variant to approve only the current permission request. +/// Update the session's working directory. Used by the host when the user explicitly changes cwd (e.g., the `/cd` slash command). The host is responsible for any related side-effects (file index, etc.); it does NOT change the process working directory (a session's cwd is per-session, not process-global). For local sessions the runtime validates the target first (an absolute path that exists on disk) and re-bases the permission primary directory; a rejected validation fails the call before anything is mutated, persisted, or emitted. Location-scoped permission rules are then re-keyed to the new directory (best-effort). Remote sessions only record the path. /// ///
/// @@ -9739,15 +9610,12 @@ pub struct PendingPermissionRequestList { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionDecisionApproveOnce { - /// True only when a host surfaced this request to a user who approved it. - #[serde(skip_serializing_if = "Option::is_none")] - pub approved_interactively: Option, - /// Approve this single request only - pub kind: PermissionDecisionApproveOnceKind, +pub struct MetadataSetWorkingDirectoryResult { + /// Working directory after the update + pub working_directory: String, } -/// Session-scoped approval details for specific command identifiers. +/// The repository the remote session targets. /// ///
/// @@ -9757,14 +9625,16 @@ pub struct PermissionDecisionApproveOnce { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionDecisionApproveForSessionApprovalCommands { - /// Command identifiers covered by this approval. - pub command_identifiers: Vec, - /// Approval scoped to specific command identifiers. - pub kind: PermissionDecisionApproveForSessionApprovalCommandsKind, +pub struct MetadataSnapshotRemoteMetadataRepository { + /// The branch the remote session is operating on. + pub branch: String, + /// The GitHub repository name (without owner). + pub name: String, + /// The GitHub owner (user or organization) of the target repository. + pub owner: String, } -/// Session-scoped approval details for read-only filesystem operations. +/// Remote-session-specific metadata. Populated only when `isRemote` is true. Fields are immutable for the lifetime of the session. /// ///
/// @@ -9774,12 +9644,21 @@ pub struct PermissionDecisionApproveForSessionApprovalCommands { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionDecisionApproveForSessionApprovalRead { - /// Approval covering read-only filesystem operations. - pub kind: PermissionDecisionApproveForSessionApprovalReadKind, +pub struct MetadataSnapshotRemoteMetadata { + /// The pull request number the remote session is associated with, if any. + #[serde(skip_serializing_if = "Option::is_none")] + pub pull_request_number: Option, + /// The repository the remote session targets. + pub repository: MetadataSnapshotRemoteMetadataRepository, + /// The original resource identifier (task ID or PR node ID), preserved across event-replay reconstructions. Falls back to `sessionId` when absent. + #[serde(skip_serializing_if = "Option::is_none")] + pub resource_id: Option, + /// Whether the remote task originated from Copilot Coding Agent (cca) or a CLI `--remote` invocation. + #[serde(skip_serializing_if = "Option::is_none")] + pub task_type: Option, } -/// Session-scoped approval details for filesystem write operations. +/// Active server-driven promotion for a model, including its discount and optional expiry. /// ///
/// @@ -9789,12 +9668,22 @@ pub struct PermissionDecisionApproveForSessionApprovalRead { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionDecisionApproveForSessionApprovalWrite { - /// Approval covering filesystem write operations. - pub kind: PermissionDecisionApproveForSessionApprovalWriteKind, +pub struct ModelBillingPromo { + /// Percentage discount (0-100) applied while the promotion is active. May be fractional. + #[serde(skip_serializing_if = "Option::is_none")] + pub discount_percent: Option, + /// 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. + #[serde(skip_serializing_if = "Option::is_none")] + pub ends_at: Option, + /// Stable identifier for the promotion campaign. + #[serde(skip_serializing_if = "Option::is_none")] + pub id: Option, + /// Human-readable promotion message. Does not include the expiry timestamp; consumers may format endsAt and append it when present. + #[serde(skip_serializing_if = "Option::is_none")] + pub message: Option, } -/// Session-scoped approval details for an MCP server tool, or all tools on the server when `toolName` is null. +/// Long context tier pricing (available for models with extended context windows) /// ///
/// @@ -9804,16 +9693,38 @@ pub struct PermissionDecisionApproveForSessionApprovalWrite { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionDecisionApproveForSessionApprovalMcp { - /// Approval covering an MCP tool. - pub kind: PermissionDecisionApproveForSessionApprovalMcpKind, - /// MCP server name. - pub server_name: String, - /// MCP tool name, or null to cover every tool on the server. - pub tool_name: Option, +pub struct ModelBillingTokenPricesLongContext { + /// Use cacheReadPrice instead. AI Credits cost per billing batch of cached tokens + #[doc(hidden)] + #[deprecated] + #[serde(skip_serializing_if = "Option::is_none")] + pub cache_price: Option, + /// AI Credits cost per billing batch of cached (read) tokens + #[serde(skip_serializing_if = "Option::is_none")] + pub cache_read_price: Option, + /// AI Credits cost per billing batch of 1-hour cache-write (cache creation) tokens. + #[serde(skip_serializing_if = "Option::is_none")] + pub cache_write1h_price: Option, + /// AI Credits cost per billing batch of cache-write (cache creation) tokens. + #[serde(skip_serializing_if = "Option::is_none")] + pub cache_write_price: Option, + /// 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. + #[doc(hidden)] + #[deprecated] + #[serde(skip_serializing_if = "Option::is_none")] + pub context_max: Option, + /// AI Credits cost per billing batch of input tokens + #[serde(skip_serializing_if = "Option::is_none")] + pub input_price: Option, + /// Prompt token budget for the long context tier. The total context window is this value plus the model's max_output_tokens. + #[serde(skip_serializing_if = "Option::is_none")] + pub max_prompt_tokens: Option, + /// AI Credits cost per billing batch of output tokens + #[serde(skip_serializing_if = "Option::is_none")] + pub output_price: Option, } -/// Session-scoped approval details for MCP sampling requests from a server. +/// Token-level pricing information for this model /// ///
/// @@ -9823,14 +9734,44 @@ pub struct PermissionDecisionApproveForSessionApprovalMcp { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionDecisionApproveForSessionApprovalMcpSampling { - /// Approval covering MCP sampling requests for a server. - pub kind: PermissionDecisionApproveForSessionApprovalMcpSamplingKind, - /// MCP server name. - pub server_name: String, +pub struct ModelBillingTokenPrices { + /// Number of tokens per standard billing batch + #[serde(skip_serializing_if = "Option::is_none")] + pub batch_size: Option, + /// Use cacheReadPrice instead. AI Credits cost per billing batch of cached tokens + #[doc(hidden)] + #[deprecated] + #[serde(skip_serializing_if = "Option::is_none")] + pub cache_price: Option, + /// AI Credits cost per billing batch of cached (read) tokens + #[serde(skip_serializing_if = "Option::is_none")] + pub cache_read_price: Option, + /// AI Credits cost per billing batch of 1-hour cache-write (cache creation) tokens. + #[serde(skip_serializing_if = "Option::is_none")] + pub cache_write1h_price: Option, + /// AI Credits cost per billing batch of cache-write (cache creation) tokens. + #[serde(skip_serializing_if = "Option::is_none")] + pub cache_write_price: Option, + /// Use maxPromptTokens instead. Prompt token budget for the default tier. The total context window is this value plus the model's max_output_tokens. + #[doc(hidden)] + #[deprecated] + #[serde(skip_serializing_if = "Option::is_none")] + pub context_max: Option, + /// AI Credits cost per billing batch of input tokens + #[serde(skip_serializing_if = "Option::is_none")] + pub input_price: Option, + /// Long context tier pricing (available for models with extended context windows) + #[serde(skip_serializing_if = "Option::is_none")] + pub long_context: Option, + /// Prompt token budget for the default tier. The total context window is this value plus the model's max_output_tokens. + #[serde(skip_serializing_if = "Option::is_none")] + pub max_prompt_tokens: Option, + /// AI Credits cost per billing batch of output tokens + #[serde(skip_serializing_if = "Option::is_none")] + pub output_price: Option, } -/// Session-scoped approval details for writes to long-term memory. +/// Billing information /// ///
/// @@ -9840,12 +9781,22 @@ pub struct PermissionDecisionApproveForSessionApprovalMcpSampling { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionDecisionApproveForSessionApprovalMemory { - /// Approval covering writes to long-term memory. - pub kind: PermissionDecisionApproveForSessionApprovalMemoryKind, +pub struct 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. + #[serde(skip_serializing_if = "Option::is_none")] + pub discount_percent: Option, + /// Billing cost multiplier relative to the base rate + #[serde(skip_serializing_if = "Option::is_none")] + pub multiplier: Option, + /// 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. + #[serde(skip_serializing_if = "Option::is_none")] + pub promo: Option, + /// Token-level pricing information for this model + #[serde(skip_serializing_if = "Option::is_none")] + pub token_prices: Option, } -/// Session-scoped approval details for a custom tool, keyed by tool name. +/// Vision-specific limits /// ///
/// @@ -9855,14 +9806,19 @@ pub struct PermissionDecisionApproveForSessionApprovalMemory { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionDecisionApproveForSessionApprovalCustomTool { - /// Approval covering a custom tool. - pub kind: PermissionDecisionApproveForSessionApprovalCustomToolKind, - /// Custom tool name. - pub tool_name: String, +pub struct ModelCapabilitiesLimitsVision { + /// Maximum image size in bytes + #[serde(rename = "max_prompt_image_size")] + pub max_prompt_image_size: i64, + /// Maximum number of images per prompt + #[serde(rename = "max_prompt_images")] + pub max_prompt_images: i64, + /// MIME types the model accepts + #[serde(rename = "supported_media_types")] + pub supported_media_types: Vec, } -/// Session-scoped approval details for extension-management operations, optionally narrowed by operation. +/// Token limits for prompts, outputs, and context window /// ///
/// @@ -9872,15 +9828,25 @@ pub struct PermissionDecisionApproveForSessionApprovalCustomTool { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionDecisionApproveForSessionApprovalExtensionManagement { - /// Approval covering extension lifecycle operations such as enable, disable, or reload. - pub kind: PermissionDecisionApproveForSessionApprovalExtensionManagementKind, - /// Optional operation identifier; when omitted, the approval covers all extension management operations. +pub struct ModelCapabilitiesLimits { + /// Maximum total context window size in tokens + #[serde( + rename = "max_context_window_tokens", + skip_serializing_if = "Option::is_none" + )] + pub max_context_window_tokens: Option, + /// Maximum number of output/completion tokens + #[serde(rename = "max_output_tokens", skip_serializing_if = "Option::is_none")] + pub max_output_tokens: Option, + /// Maximum number of prompt/input tokens + #[serde(rename = "max_prompt_tokens", skip_serializing_if = "Option::is_none")] + pub max_prompt_tokens: Option, + /// Vision-specific limits #[serde(skip_serializing_if = "Option::is_none")] - pub operation: Option, + pub vision: Option, } -/// Session-scoped factory approval, optionally narrowed by approval key. +/// Feature flags indicating what the model supports /// ///
/// @@ -9890,15 +9856,19 @@ pub struct PermissionDecisionApproveForSessionApprovalExtensionManagement { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionDecisionApproveForSessionApprovalFactory { - /// Optional factory operation name or canonical approval key; when omitted, the approval covers all factory operations. +pub struct 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). + #[serde(rename = "adaptive_thinking", skip_serializing_if = "Option::is_none")] + pub adaptive_thinking: Option, + /// Whether this model supports reasoning effort configuration #[serde(skip_serializing_if = "Option::is_none")] - pub approval_key: Option, - /// Approval covering factory operations. - pub kind: PermissionDecisionApproveForSessionApprovalFactoryKind, + pub reasoning_effort: Option, + /// Whether this model supports vision/image input + #[serde(skip_serializing_if = "Option::is_none")] + pub vision: Option, } -/// Session-scoped approval details for an extension's permission-gated capability access, keyed by extension name. +/// Model capabilities and limits /// ///
/// @@ -9908,14 +9878,16 @@ pub struct PermissionDecisionApproveForSessionApprovalFactory { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionDecisionApproveForSessionApprovalExtensionPermissionAccess { - /// Extension name. - pub extension_name: String, - /// Approval covering an extension's request to access a permission-gated capability. - pub kind: PermissionDecisionApproveForSessionApprovalExtensionPermissionAccessKind, +pub struct ModelCapabilities { + /// Token limits for prompts, outputs, and context window + #[serde(skip_serializing_if = "Option::is_none")] + pub limits: Option, + /// Feature flags indicating what the model supports + #[serde(skip_serializing_if = "Option::is_none")] + pub supports: Option, } -/// Session-scoped approval details for an extension's access to sensitive environment variables, keyed by extension name and the exact set of variable names. +/// Policy state (if applicable) /// ///
/// @@ -9925,16 +9897,15 @@ pub struct PermissionDecisionApproveForSessionApprovalExtensionPermissionAccess ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionDecisionApproveForSessionApprovalExtensionEnvAccess { - /// Names of the sensitive environment variables this approval covers. Values are never persisted. - pub environment_variables: Vec, - /// Extension name. - pub extension_name: String, - /// Approval covering an extension's request to read sensitive environment variables. - pub kind: PermissionDecisionApproveForSessionApprovalExtensionEnvAccessKind, +pub struct ModelPolicy { + /// Current policy state for this model + pub state: ModelPolicyState, + /// Usage terms or conditions for this model + #[serde(skip_serializing_if = "Option::is_none")] + pub terms: Option, } -/// Permission-decision request variant to approve for the rest of the session, with optional tool approval or URL domain. +/// Copilot model metadata, including identifier, display name, capabilities, policy, billing, reasoning efforts, and picker categories. /// ///
/// @@ -9944,18 +9915,37 @@ pub struct PermissionDecisionApproveForSessionApprovalExtensionEnvAccess { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionDecisionApproveForSession { - /// Session-scoped approval to remember (tool prompts only; omitted for path/url prompts) +pub struct Model { + /// Billing information #[serde(skip_serializing_if = "Option::is_none")] - pub approval: Option, - /// URL domain to approve for the rest of the session (URL prompts only) + pub billing: Option, + /// Model capabilities and limits + pub capabilities: ModelCapabilities, + /// Default reasoning effort level (only present if model supports reasoning effort) #[serde(skip_serializing_if = "Option::is_none")] - pub domain: Option, - /// Approve and remember for the rest of the session - pub kind: PermissionDecisionApproveForSessionKind, + pub default_reasoning_effort: Option, + /// Model identifier (e.g., "claude-sonnet-4.5") + pub id: String, + /// Model capability category for grouping in the model picker + #[serde(skip_serializing_if = "Option::is_none")] + pub model_picker_category: Option, + /// Relative cost tier for token-based billing users + #[serde(skip_serializing_if = "Option::is_none")] + pub model_picker_price_category: Option, + /// Display name + pub name: String, + /// Policy state (if applicable) + #[serde(skip_serializing_if = "Option::is_none")] + pub policy: Option, + /// 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. + #[serde(skip_serializing_if = "Option::is_none")] + pub supported_context_tiers: Option>, + /// Supported reasoning effort levels (only present if model supports reasoning effort) + #[serde(skip_serializing_if = "Option::is_none")] + pub supported_reasoning_efforts: Option>, } -/// Location-scoped approval details for specific command identifiers. +/// Managed, repository, and CLI model overrides to overlay onto the session at startup. /// ///
/// @@ -9965,14 +9955,31 @@ pub struct PermissionDecisionApproveForSession { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionDecisionApproveForLocationApprovalCommands { - /// Command identifiers covered by this approval. - pub command_identifiers: Vec, - /// Approval scoped to specific command identifiers. - pub kind: PermissionDecisionApproveForLocationApprovalCommandsKind, +pub struct ModelApplyStartupOverlayRequest { + /// Model explicitly selected by the CLI, when provided. + #[serde(skip_serializing_if = "Option::is_none")] + pub cli_model: Option, + /// Whether the overlay is being applied while resuming a deferred session. + #[serde(skip_serializing_if = "Option::is_none")] + pub deferred_resume: Option, + /// Model required by device-managed policy, when configured. + #[serde(skip_serializing_if = "Option::is_none")] + pub device_managed_model: Option, + /// Context tier selected by repository settings, when configured. + #[serde(skip_serializing_if = "Option::is_none")] + pub repo_context_tier: Option, + /// Model selected by repository settings, when configured. + #[serde(skip_serializing_if = "Option::is_none")] + pub repo_model: Option, + /// Reasoning effort selected by repository settings, when configured. + #[serde(skip_serializing_if = "Option::is_none")] + pub repo_reasoning_effort: Option, + /// Model required by server-managed policy, when configured. + #[serde(skip_serializing_if = "Option::is_none")] + pub server_managed_model: Option, } -/// Location-scoped approval details for read-only filesystem operations. +/// Vision-specific limits /// ///
/// @@ -9982,12 +9989,25 @@ pub struct PermissionDecisionApproveForLocationApprovalCommands { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionDecisionApproveForLocationApprovalRead { - /// Approval covering read-only filesystem operations. - pub kind: PermissionDecisionApproveForLocationApprovalReadKind, +pub struct ModelCapabilitiesOverrideLimitsVision { + /// Maximum image size in bytes + #[serde( + rename = "max_prompt_image_size", + skip_serializing_if = "Option::is_none" + )] + pub max_prompt_image_size: Option, + /// Maximum number of images per prompt + #[serde(rename = "max_prompt_images", skip_serializing_if = "Option::is_none")] + pub max_prompt_images: Option, + /// MIME types the model accepts + #[serde( + rename = "supported_media_types", + skip_serializing_if = "Option::is_none" + )] + pub supported_media_types: Option>, } -/// Location-scoped approval details for filesystem write operations. +/// Token limits for prompts, outputs, and context window /// ///
/// @@ -9997,12 +10017,25 @@ pub struct PermissionDecisionApproveForLocationApprovalRead { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionDecisionApproveForLocationApprovalWrite { - /// Approval covering filesystem write operations. - pub kind: PermissionDecisionApproveForLocationApprovalWriteKind, +pub struct ModelCapabilitiesOverrideLimits { + /// Maximum total context window size in tokens + #[serde( + rename = "max_context_window_tokens", + skip_serializing_if = "Option::is_none" + )] + pub max_context_window_tokens: Option, + /// Maximum number of output/completion tokens + #[serde(rename = "max_output_tokens", skip_serializing_if = "Option::is_none")] + pub max_output_tokens: Option, + /// Maximum number of prompt/input tokens + #[serde(rename = "max_prompt_tokens", skip_serializing_if = "Option::is_none")] + pub max_prompt_tokens: Option, + /// Vision-specific limits + #[serde(skip_serializing_if = "Option::is_none")] + pub vision: Option, } -/// Location-scoped approval details for an MCP server tool, or all tools on the server when `toolName` is null. +/// Feature flags indicating what the model supports /// ///
/// @@ -10012,16 +10045,19 @@ pub struct PermissionDecisionApproveForLocationApprovalWrite { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionDecisionApproveForLocationApprovalMcp { - /// Approval covering an MCP tool. - pub kind: PermissionDecisionApproveForLocationApprovalMcpKind, - /// MCP server name. - pub server_name: String, - /// MCP tool name, or null to cover every tool on the server. - pub tool_name: Option, -} - -/// Location-scoped approval details for MCP sampling requests from a server. +pub struct 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). + #[serde(rename = "adaptive_thinking", skip_serializing_if = "Option::is_none")] + pub adaptive_thinking: Option, + /// Whether this model supports reasoning effort configuration + #[serde(skip_serializing_if = "Option::is_none")] + pub reasoning_effort: Option, + /// Whether this model supports vision/image input + #[serde(skip_serializing_if = "Option::is_none")] + pub vision: Option, +} + +/// Optional capability overrides (vision, tool_calls, reasoning, etc.). /// ///
/// @@ -10031,14 +10067,16 @@ pub struct PermissionDecisionApproveForLocationApprovalMcp { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionDecisionApproveForLocationApprovalMcpSampling { - /// Approval covering MCP sampling requests for a server. - pub kind: PermissionDecisionApproveForLocationApprovalMcpSamplingKind, - /// MCP server name. - pub server_name: String, +pub struct ModelCapabilitiesOverride { + /// Token limits for prompts, outputs, and context window + #[serde(skip_serializing_if = "Option::is_none")] + pub limits: Option, + /// Feature flags indicating what the model supports + #[serde(skip_serializing_if = "Option::is_none")] + pub supports: Option, } -/// Location-scoped approval details for writes to long-term memory. +/// List of Copilot models available to the resolved user, including capabilities and billing metadata. /// ///
/// @@ -10048,12 +10086,12 @@ pub struct PermissionDecisionApproveForLocationApprovalMcpSampling { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionDecisionApproveForLocationApprovalMemory { - /// Approval covering writes to long-term memory. - pub kind: PermissionDecisionApproveForLocationApprovalMemoryKind, +pub struct ModelList { + /// List of available models with full metadata + pub models: Vec, } -/// Location-scoped approval details for a custom tool, keyed by tool name. +/// Optional listing options. /// ///
/// @@ -10063,14 +10101,13 @@ pub struct PermissionDecisionApproveForLocationApprovalMemory { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionDecisionApproveForLocationApprovalCustomTool { - /// Approval covering a custom tool. - pub kind: PermissionDecisionApproveForLocationApprovalCustomToolKind, - /// Custom tool name. - pub tool_name: String, +pub struct ModelListRequest { + /// If true, bypasses the per-session model list cache and re-fetches from CAPI. + #[serde(skip_serializing_if = "Option::is_none")] + pub skip_cache: Option, } -/// Location-scoped approval details for extension-management operations, optionally narrowed by operation. +/// Filesystem and environment context used to resolve model-picker settings. /// ///
/// @@ -10080,15 +10117,16 @@ pub struct PermissionDecisionApproveForLocationApprovalCustomTool { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionDecisionApproveForLocationApprovalExtensionManagement { - /// Approval covering extension lifecycle operations such as enable, disable, or reload. - pub kind: PermissionDecisionApproveForLocationApprovalExtensionManagementKind, - /// Optional operation identifier; when omitted, the approval covers all extension management operations. +pub struct ModelPickerSettingsContext { + /// Optional Copilot configuration directory containing persisted settings. #[serde(skip_serializing_if = "Option::is_none")] - pub operation: Option, + pub config_dir: Option, + /// Environment variables consulted while resolving model-picker settings. + pub environment: serde_json::Value, + /// User home directory used when resolving persisted settings. + pub home_directory: String, } -/// Location-scoped factory approval, optionally narrowed by approval key. /// ///
/// @@ -10098,15 +10136,18 @@ pub struct PermissionDecisionApproveForLocationApprovalExtensionManagement { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionDecisionApproveForLocationApprovalFactory { - /// Optional factory operation name or canonical approval key; when omitted, the approval covers all factory operations. +pub struct ModelPickerPersistenceRequest { + /// Whether context tier was explicitly selected and should be persisted. #[serde(skip_serializing_if = "Option::is_none")] - pub approval_key: Option, - /// Approval covering factory operations. - pub kind: PermissionDecisionApproveForLocationApprovalFactoryKind, + pub context_tier_explicit: Option, + /// Whether reasoning effort was explicitly selected and should be persisted. + #[serde(skip_serializing_if = "Option::is_none")] + pub reasoning_effort_explicit: Option, + /// Filesystem and environment context used to resolve settings persistence. + pub settings_context: ModelPickerSettingsContext, } -/// Location-scoped approval details for an extension's permission-gated capability access, keyed by extension name. +/// Reasoning effort level to apply to the currently selected model. /// ///
/// @@ -10116,14 +10157,12 @@ pub struct PermissionDecisionApproveForLocationApprovalFactory { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionDecisionApproveForLocationApprovalExtensionPermissionAccess { - /// Extension name. - pub extension_name: String, - /// Approval covering an extension's request to access a permission-gated capability. - pub kind: PermissionDecisionApproveForLocationApprovalExtensionPermissionAccessKind, +pub struct 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. + pub reasoning_effort: String, } -/// Location-scoped approval details for an extension's access to sensitive environment variables, keyed by extension name and the exact set of variable names. +/// 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. /// ///
/// @@ -10133,16 +10172,12 @@ pub struct PermissionDecisionApproveForLocationApprovalExtensionPermissionAccess ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionDecisionApproveForLocationApprovalExtensionEnvAccess { - /// Names of the sensitive environment variables this approval covers. Values are never persisted. - pub environment_variables: Vec, - /// Extension name. - pub extension_name: String, - /// Approval covering an extension's request to read sensitive environment variables. - pub kind: PermissionDecisionApproveForLocationApprovalExtensionEnvAccessKind, +pub struct ModelSetReasoningEffortResult { + /// Reasoning effort level recorded on the session after the update + pub reasoning_effort: String, } -/// Permission-decision request variant to approve and persist a permission for a project location, with approval details and location key. +/// Optional opaque account selection or compatibility GitHub token used to list models. /// ///
/// @@ -10150,18 +10185,17 @@ pub struct PermissionDecisionApproveForLocationApprovalExtensionEnvAccess { /// and may change or be removed in future SDK or CLI releases. /// ///
-#[derive(Debug, Clone, Serialize, Deserialize)] +#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionDecisionApproveForLocation { - /// Approval to persist for this location - pub approval: PermissionDecisionApproveForLocationApproval, - /// Approve and persist for this project location - pub kind: PermissionDecisionApproveForLocationKind, - /// Location key (git root or cwd) to persist the approval to - pub location_key: String, +pub struct ModelsListRequest { + /// GitHub token accepted for compatibility with existing SDK clients. When provided, resolves this token instead of using the current account. + #[serde(skip_serializing_if = "Option::is_none")] + pub git_hub_token: Option, + /// Opaque account identifier returned by `account.getAllUsers`. When omitted, the current account is used. + #[serde(skip_serializing_if = "Option::is_none")] + pub selection_id: Option, } -/// Permission-decision request variant to permanently approve a URL domain across sessions. /// ///
/// @@ -10171,14 +10205,16 @@ pub struct PermissionDecisionApproveForLocation { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionDecisionApprovePermanently { - /// URL domain to approve permanently - pub domain: String, - /// Approve and persist across sessions (URL prompts only) - pub kind: PermissionDecisionApprovePermanentlyKind, +pub struct ModelSwitchConfirmation { + /// Current conversation token count before switching models. + pub current_tokens: f64, + /// Target model token limit used by the compaction preflight. + pub target_limit: f64, + /// Display name of the model that requires compaction confirmation. + pub target_model_display_name: String, } -/// Permission-decision request variant to reject a pending permission request, with optional feedback. +/// Target model identifier and optional reasoning effort, summary, capability overrides, and context tier. /// ///
/// @@ -10188,15 +10224,51 @@ pub struct PermissionDecisionApprovePermanently { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionDecisionReject { - /// Optional feedback explaining the rejection +pub struct ModelSwitchToRequest { + /// Explicit response to a model-switch compaction preflight. Omit to request a confirmation projection when compaction is necessary. #[serde(skip_serializing_if = "Option::is_none")] - pub feedback: Option, - /// Reject the request - pub kind: PermissionDecisionRejectKind, + pub compaction_decision: Option, + /// 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. + #[serde(skip_serializing_if = "Option::is_none")] + pub context_tier: Option, + /// 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). + #[serde(skip_serializing_if = "Option::is_none")] + pub defer_if_model_change_queued: Option, + /// Override individual model capabilities resolved by the runtime + #[serde(skip_serializing_if = "Option::is_none")] + pub model_capabilities: Option, + /// Settings scope used when persisting the selected model. + #[serde(skip_serializing_if = "Option::is_none")] + pub model_change_scope: Option, + /// 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. + pub model_id: String, + /// Optional settings context and explicit-override flags used to persist a picker selection. + #[serde(skip_serializing_if = "Option::is_none")] + pub picker_persistence: Option, + /// 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. + #[serde(skip_serializing_if = "Option::is_none")] + pub reasoning_effort: Option, + /// Reasoning summary mode to request for supported model clients + #[serde(skip_serializing_if = "Option::is_none")] + pub reasoning_summary: Option, + /// Optional repository settings scope to persist after the switch commits. + #[serde(skip_serializing_if = "Option::is_none")] + pub repo_scope: Option, + /// Require the target to be currently available and enabled before applying the switch. + #[serde(skip_serializing_if = "Option::is_none")] + pub require_available: Option, + /// When true, evaluate context-window compaction policy before applying the switch. + #[serde(skip_serializing_if = "Option::is_none")] + pub run_compaction_preflight: Option, + /// Origin to record on the effective `session.model_change` event. Defaults to `sdk` when omitted. + #[serde(skip_serializing_if = "Option::is_none")] + pub source: Option, + /// Output verbosity level to request for supported models + #[serde(skip_serializing_if = "Option::is_none")] + pub verbosity: Option, } -/// Permission-decision variant indicating no user was available to confirm the request. +/// The model identifier active on the session after the switch. /// ///
/// @@ -10206,12 +10278,34 @@ pub struct PermissionDecisionReject { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionDecisionUserNotAvailable { - /// No user is available to confirm the request - pub kind: PermissionDecisionUserNotAvailableKind, +pub struct ModelSwitchToResult { + /// Compaction confirmation projection when status is confirmation_required + #[serde(skip_serializing_if = "Option::is_none")] + pub confirmation: Option, + /// 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. + #[serde(skip_serializing_if = "Option::is_none")] + pub deferred: Option, + /// Deprecation warnings associated with the selected model or options. + #[serde(skip_serializing_if = "Option::is_none")] + pub deprecation_warnings: Option>, + /// User-facing outcome message for the model switch. + #[serde(skip_serializing_if = "Option::is_none")] + pub message: Option, + /// Currently active model identifier after the switch + #[serde(skip_serializing_if = "Option::is_none")] + pub model_id: Option, + /// Persistence failure encountered after applying the model switch. + #[serde(skip_serializing_if = "Option::is_none")] + pub persistence_error: Option, + /// Lifecycle result for the requested switch + #[serde(skip_serializing_if = "Option::is_none")] + pub status: Option, + /// User-facing warning produced while applying the model switch. + #[serde(skip_serializing_if = "Option::is_none")] + pub warning: Option, } -/// Permission-decision variant indicating the request was approved. +/// Agent interaction mode to apply to the session. /// ///
/// @@ -10221,12 +10315,42 @@ pub struct PermissionDecisionUserNotAvailable { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionDecisionApproved { - /// The permission request was approved - pub kind: PermissionDecisionApprovedKind, +pub struct ModeSetRequest { + /// Explicit response to a model-switch compaction preflight. + #[serde(skip_serializing_if = "Option::is_none")] + pub compaction_decision: Option, + /// Session whose plan-mode base state should be inherited. + #[serde(skip_serializing_if = "Option::is_none")] + pub inherit_plan_base_from_session_id: Option, + /// The session mode the agent is operating in + pub mode: SessionMode, + /// Whether the selected plan model should be persisted. + #[serde(skip_serializing_if = "Option::is_none")] + pub persist_plan_selection: Option, + /// Settings context used when persisting the selected plan model. + #[serde(skip_serializing_if = "Option::is_none")] + pub picker_settings_context: Option, + /// Context tier to use with the dedicated plan model. + #[serde(skip_serializing_if = "Option::is_none")] + pub plan_context_tier: Option, + /// Action to perform when leaving plan mode. + #[serde(skip_serializing_if = "Option::is_none")] + pub plan_exit_action: Option, + /// Dedicated model to use in plan mode, when configured. + #[serde(skip_serializing_if = "Option::is_none")] + pub plan_model: Option, + /// Whether a dedicated plan model is configured. + #[serde(skip_serializing_if = "Option::is_none")] + pub plan_model_configured: Option, + /// Reasoning effort to use with the dedicated plan model. + #[serde(skip_serializing_if = "Option::is_none")] + pub plan_reasoning_effort: Option, + /// Whether leaving plan mode should restore the session's previous model. + #[serde(skip_serializing_if = "Option::is_none")] + pub restore_plan_model: Option, } -/// Permission-decision variant indicating approval was remembered for the session, with approval details. +/// Outcome of a session mode change, including any model switch it triggered and follow-up the host must perform. /// ///
/// @@ -10234,35 +10358,49 @@ pub struct PermissionDecisionApproved { /// and may change or be removed in future SDK or CLI releases. /// ///
-#[derive(Debug, Clone, Serialize, Deserialize)] +#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionDecisionApprovedForSession { - /// The approval to add as a session-scoped rule - pub approval: UserToolSessionApproval, - /// Approved and remembered for the rest of the session - pub kind: PermissionDecisionApprovedForSessionKind, -} - -/// Permission-decision variant indicating approval was persisted for a project location, with approval details and location key. -/// -///
+pub struct ModeSetResult { + /// Whether the host should arm an interactive continuation after the mode change. + #[serde(skip_serializing_if = "Option::is_none")] + pub arm_interactive_continuation: Option, + /// Compaction confirmation required before the mode change can complete. + #[serde(skip_serializing_if = "Option::is_none")] + pub confirmation: Option, + /// Whether the host must defer implementing the requested mode change. + #[serde(skip_serializing_if = "Option::is_none")] + pub defer_implementation: Option, + /// Deprecation warnings associated with the model selected by the mode change. + #[serde(skip_serializing_if = "Option::is_none")] + pub deprecation_warnings: Option>, + /// User-facing outcome message for the model switch triggered by the mode change. + #[serde(skip_serializing_if = "Option::is_none")] + pub message: Option, + /// Whether applying the mode changed the active model. + pub model_changed: bool, + /// Lifecycle status of the requested mode change. + pub status: String, + /// User-facing warning produced while applying the mode change. + #[serde(skip_serializing_if = "Option::is_none")] + pub warning: Option, +} + +/// Result of moving in-flight MCP loading to the background. +/// +///
/// /// **Experimental.** This type is part of an experimental wire-protocol surface /// and may change or be removed in future SDK or CLI releases. /// ///
-#[derive(Debug, Clone, Serialize, Deserialize)] +#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionDecisionApprovedForLocation { - /// The approval to persist for this location - pub approval: UserToolSessionApproval, - /// Approved and persisted for this project location - pub kind: PermissionDecisionApprovedForLocationKind, - /// The location key (git root or cwd) to persist the approval to - pub location_key: String, +pub struct 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. + pub moved_to_background: bool, } -/// Permission-decision variant indicating the request was cancelled before use, with an optional reason. +/// Azure-specific provider options. /// ///
/// @@ -10272,15 +10410,13 @@ pub struct PermissionDecisionApprovedForLocation { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionDecisionCancelled { - /// The permission request was cancelled before a response was used - pub kind: PermissionDecisionCancelledKind, - /// Optional explanation of why the request was cancelled +pub struct ProviderConfigAzure { + /// API version. When set, uses the versioned deployment route. When omitted, uses the GA versionless v1 route. #[serde(skip_serializing_if = "Option::is_none")] - pub reason: Option, + pub api_version: Option, } -/// Permission-decision variant indicating explicit denial by permission rules, with the matching rules. +/// External SDK input for a named custom model provider. Ingested by the native protocol boundary before host dispatch. /// ///
/// @@ -10290,14 +10426,38 @@ pub struct PermissionDecisionCancelled { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionDecisionDeniedByRules { - /// Denied because approval rules explicitly blocked it - pub kind: PermissionDecisionDeniedByRulesKind, - /// Rules that denied the request - pub rules: Vec, +pub struct NamedProviderConfig { + /// Static API key used to authenticate provider requests. + #[serde(skip_serializing_if = "Option::is_none")] + pub api_key: Option, + /// Azure authentication configuration for the provider. + #[serde(skip_serializing_if = "Option::is_none")] + pub azure: Option, + /// Base URL for provider API requests. + pub base_url: String, + /// Static bearer token used to authenticate provider requests. + #[serde(skip_serializing_if = "Option::is_none")] + pub bearer_token: Option, + /// Whether the host supplies bearer tokens dynamically. + #[serde(skip_serializing_if = "Option::is_none")] + pub has_bearer_token_provider: Option, + /// Additional HTTP headers included with provider requests. + #[serde(skip_serializing_if = "Option::is_none")] + pub headers: Option>, + /// Unique provider name used to qualify model selection IDs. + pub name: String, + /// Transport used to communicate with the provider. + #[serde(skip_serializing_if = "Option::is_none")] + pub transport: Option, + /// Provider protocol family. + #[serde(skip_serializing_if = "Option::is_none")] + pub r#type: Option, + /// Wire API used to communicate with the provider. + #[serde(skip_serializing_if = "Option::is_none")] + pub wire_api: Option, } -/// Permission-decision variant indicating no approval rule matched and user confirmation was unavailable. +/// The session's friendly name, or null when not yet set. /// ///
/// @@ -10307,12 +10467,12 @@ pub struct PermissionDecisionDeniedByRules { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUser { - /// Denied because no approval rule matched and user confirmation was unavailable - pub kind: PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUserKind, +pub struct NameGetResult { + /// The session name (user-set or auto-generated), or null if not yet set + pub name: Option, } -/// Permission-decision variant indicating the user denied an interactive prompt, with optional feedback and force-reject flag. +/// Auto-generated session summary to apply as the session's name when no user-set name exists. /// ///
/// @@ -10322,18 +10482,12 @@ pub struct PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUser { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionDecisionDeniedInteractivelyByUser { - /// Optional feedback from the user explaining the denial - #[serde(skip_serializing_if = "Option::is_none")] - pub feedback: Option, - /// Whether to force-reject the current agent turn - #[serde(skip_serializing_if = "Option::is_none")] - pub force_reject: Option, - /// Denied by the user during an interactive prompt - pub kind: PermissionDecisionDeniedInteractivelyByUserKind, +pub struct NameSetAutoRequest { + /// Auto-generated session summary. Empty/whitespace-only values are ignored; values are trimmed before persisting. + pub summary: String, } -/// Permission-decision variant indicating denial by content-exclusion policy, with path and message. +/// Indicates whether the auto-generated summary was applied as the session's name. /// ///
/// @@ -10343,16 +10497,12 @@ pub struct PermissionDecisionDeniedInteractivelyByUser { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionDecisionDeniedByContentExclusionPolicy { - /// Denied by the organization's content exclusion policy - pub kind: PermissionDecisionDeniedByContentExclusionPolicyKind, - /// Human-readable explanation of why the path was excluded - pub message: String, - /// File path that triggered the exclusion - pub path: String, +pub struct 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. + pub applied: bool, } -/// Permission-decision variant indicating denial by a permission request hook, with optional message and interrupt flag. +/// New friendly name to apply to the session. /// ///
/// @@ -10362,18 +10512,12 @@ pub struct PermissionDecisionDeniedByContentExclusionPolicy { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionDecisionDeniedByPermissionRequestHook { - /// Whether to interrupt the current agent turn - #[serde(skip_serializing_if = "Option::is_none")] - pub interrupt: Option, - /// Denied by a permission request hook registered by an extension or plugin - pub kind: PermissionDecisionDeniedByPermissionRequestHookKind, - /// Optional message from the hook explaining the denial - #[serde(skip_serializing_if = "Option::is_none")] - pub message: Option, +pub struct NameSetRequest { + /// New session name (1–100 characters, trimmed of leading/trailing whitespace) + pub name: String, } -/// Optional informational context describing how and where the permission decision was made. This does not affect permission behavior. +/// Source descriptor for a `session.options.update` content-exclusion rule, with source name and type. /// ///
/// @@ -10383,16 +10527,14 @@ pub struct PermissionDecisionDeniedByPermissionRequestHook { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionDecisionContext { - /// Disposition of the permission request as observed by the responding client. - pub outcome: PermissionDecisionOutcome, - /// Controlled reason or actor responsible for the response. - pub source: PermissionDecisionSource, - /// Client surface that submitted the response. - pub surface: PermissionDecisionSurface, +pub struct OptionsUpdateAdditionalContentExclusionPolicyRuleSource { + /// Name of the policy source. + pub name: String, + /// Type of the policy source. + pub r#type: String, } -/// Pending permission request ID and the decision to apply (approve/reject and scope). +/// Single content-exclusion rule supplied to `session.options.update`, with paths, match conditions, and source. /// ///
/// @@ -10400,19 +10542,22 @@ pub struct PermissionDecisionContext { /// and may change or be removed in future SDK or CLI releases. /// ///
-#[derive(Debug, Clone, Serialize, Deserialize)] +#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionDecisionRequest { - /// Optional informational context describing how and where this response was made. Omit it to preserve legacy behavior without attributing an origin. +pub struct OptionsUpdateAdditionalContentExclusionPolicyRule { + /// Conditions of which at least one must match. #[serde(skip_serializing_if = "Option::is_none")] - pub decision_context: Option, - /// Request ID of the pending permission request - pub request_id: RequestId, - /// The client's response to the pending permission prompt - pub result: PermissionDecision, + pub if_any_match: Option>, + /// Conditions none of which may match. + #[serde(skip_serializing_if = "Option::is_none")] + pub if_none_match: Option>, + /// Path patterns covered by this rule. + pub paths: Vec, + /// Source descriptor for a `session.options.update` content-exclusion rule, with source name and type. + pub source: OptionsUpdateAdditionalContentExclusionPolicyRuleSource, } -/// Location-persisted tool approval details for specific command identifiers. +/// Content-exclusion policy supplied to `session.options.update`, with rules, last-updated data, and scope. /// ///
/// @@ -10422,14 +10567,17 @@ pub struct PermissionDecisionRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionsLocationsAddToolApprovalDetailsCommands { - /// Command identifiers covered by this approval. - pub command_identifiers: Vec, - /// Approval scoped to specific command identifiers. - pub kind: PermissionsLocationsAddToolApprovalDetailsCommandsKind, +pub struct OptionsUpdateAdditionalContentExclusionPolicy { + /// Opaque policy update timestamp supplied by the host. + #[serde(rename = "last_updated_at")] + pub last_updated_at: serde_json::Value, + /// Content-exclusion rules to apply. + pub rules: Vec, + /// Allowed values for the `OptionsUpdateAdditionalContentExclusionPolicyScope` enumeration. + pub scope: OptionsUpdateAdditionalContentExclusionPolicyScope, } -/// Location-persisted tool approval details for read-only filesystem operations. +/// Pending permission prompt reconstructed from event history, with request ID and user-facing prompt details. /// ///
/// @@ -10437,14 +10585,16 @@ pub struct PermissionsLocationsAddToolApprovalDetailsCommands { /// and may change or be removed in future SDK or CLI releases. /// ///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionsLocationsAddToolApprovalDetailsRead { - /// Approval covering read-only filesystem operations. - pub kind: PermissionsLocationsAddToolApprovalDetailsReadKind, +pub struct PendingPermissionRequest { + /// The user-facing permission prompt details (commands, write, read, mcp, url, memory, custom-tool, path, hook) + pub request: PermissionPromptRequest, + /// Unique identifier for the pending permission request + pub request_id: RequestId, } -/// Location-persisted tool approval details for filesystem write operations. +/// List of pending permission requests reconstructed from event history. /// ///
/// @@ -10454,12 +10604,12 @@ pub struct PermissionsLocationsAddToolApprovalDetailsRead { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionsLocationsAddToolApprovalDetailsWrite { - /// Approval covering filesystem write operations. - pub kind: PermissionsLocationsAddToolApprovalDetailsWriteKind, +pub struct PendingPermissionRequestList { + /// Pending permission prompts reconstructed from the session's event history. Equivalent to the set of `permission.requested` events that have not yet been followed by a matching `permission.completed` event. Used by clients (e.g. the CLI) to hydrate UI for prompts that were emitted before the client attached to the session. + pub items: Vec, } -/// Location-persisted tool approval details for an MCP server tool, or all tools when `toolName` is null. +/// Permission-decision request variant to approve only the current permission request. /// ///
/// @@ -10469,16 +10619,15 @@ pub struct PermissionsLocationsAddToolApprovalDetailsWrite { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionsLocationsAddToolApprovalDetailsMcp { - /// Approval covering an MCP tool. - pub kind: PermissionsLocationsAddToolApprovalDetailsMcpKind, - /// MCP server name. - pub server_name: String, - /// MCP tool name, or null to cover every tool on the server. - pub tool_name: Option, +pub struct PermissionDecisionApproveOnce { + /// True only when a host surfaced this request to a user who approved it. + #[serde(skip_serializing_if = "Option::is_none")] + pub approved_interactively: Option, + /// Approve this single request only + pub kind: PermissionDecisionApproveOnceKind, } -/// Location-persisted tool approval details for MCP sampling requests from a server. +/// Session-scoped approval details for specific command identifiers. /// ///
/// @@ -10488,14 +10637,14 @@ pub struct PermissionsLocationsAddToolApprovalDetailsMcp { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionsLocationsAddToolApprovalDetailsMcpSampling { - /// Approval covering MCP sampling requests for a server. - pub kind: PermissionsLocationsAddToolApprovalDetailsMcpSamplingKind, - /// MCP server name. - pub server_name: String, +pub struct PermissionDecisionApproveForSessionApprovalCommands { + /// Command identifiers covered by this approval. + pub command_identifiers: Vec, + /// Approval scoped to specific command identifiers. + pub kind: PermissionDecisionApproveForSessionApprovalCommandsKind, } -/// Location-persisted tool approval details for writes to long-term memory. +/// Session-scoped approval details for read-only filesystem operations. /// ///
/// @@ -10505,12 +10654,12 @@ pub struct PermissionsLocationsAddToolApprovalDetailsMcpSampling { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionsLocationsAddToolApprovalDetailsMemory { - /// Approval covering writes to long-term memory. - pub kind: PermissionsLocationsAddToolApprovalDetailsMemoryKind, +pub struct PermissionDecisionApproveForSessionApprovalRead { + /// Approval covering read-only filesystem operations. + pub kind: PermissionDecisionApproveForSessionApprovalReadKind, } -/// Location-persisted tool approval details for a custom tool, keyed by tool name. +/// Session-scoped approval details for filesystem write operations. /// ///
/// @@ -10520,14 +10669,12 @@ pub struct PermissionsLocationsAddToolApprovalDetailsMemory { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionsLocationsAddToolApprovalDetailsCustomTool { - /// Approval covering a custom tool. - pub kind: PermissionsLocationsAddToolApprovalDetailsCustomToolKind, - /// Custom tool name. - pub tool_name: String, +pub struct PermissionDecisionApproveForSessionApprovalWrite { + /// Approval covering filesystem write operations. + pub kind: PermissionDecisionApproveForSessionApprovalWriteKind, } -/// Location-persisted tool approval details for extension-management operations, optionally narrowed by operation. +/// Session-scoped approval details for an MCP server tool, or all tools on the server when `toolName` is null. /// ///
/// @@ -10537,15 +10684,16 @@ pub struct PermissionsLocationsAddToolApprovalDetailsCustomTool { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionsLocationsAddToolApprovalDetailsExtensionManagement { - /// Approval covering extension lifecycle operations such as enable, disable, or reload. - pub kind: PermissionsLocationsAddToolApprovalDetailsExtensionManagementKind, - /// Optional operation identifier; when omitted, the approval covers all extension management operations. - #[serde(skip_serializing_if = "Option::is_none")] - pub operation: Option, -} - -/// Location-persisted factory approval, optionally narrowed by approval key. +pub struct PermissionDecisionApproveForSessionApprovalMcp { + /// Approval covering an MCP tool. + pub kind: PermissionDecisionApproveForSessionApprovalMcpKind, + /// MCP server name. + pub server_name: String, + /// MCP tool name, or null to cover every tool on the server. + pub tool_name: Option, +} + +/// Session-scoped approval details for MCP sampling requests from a server. /// ///
/// @@ -10555,15 +10703,14 @@ pub struct PermissionsLocationsAddToolApprovalDetailsExtensionManagement { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionsLocationsAddToolApprovalDetailsFactory { - /// Optional factory operation name or canonical approval key; when omitted, the approval covers all factory operations. - #[serde(skip_serializing_if = "Option::is_none")] - pub approval_key: Option, - /// Approval covering factory operations. - pub kind: PermissionsLocationsAddToolApprovalDetailsFactoryKind, +pub struct PermissionDecisionApproveForSessionApprovalMcpSampling { + /// Approval covering MCP sampling requests for a server. + pub kind: PermissionDecisionApproveForSessionApprovalMcpSamplingKind, + /// MCP server name. + pub server_name: String, } -/// Location-persisted tool approval details for an extension's permission-gated capability access, keyed by extension name. +/// Session-scoped approval details for writes to long-term memory. /// ///
/// @@ -10573,14 +10720,12 @@ pub struct PermissionsLocationsAddToolApprovalDetailsFactory { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionsLocationsAddToolApprovalDetailsExtensionPermissionAccess { - /// Extension name. - pub extension_name: String, - /// Approval covering an extension's request to access a permission-gated capability. - pub kind: PermissionsLocationsAddToolApprovalDetailsExtensionPermissionAccessKind, +pub struct PermissionDecisionApproveForSessionApprovalMemory { + /// Approval covering writes to long-term memory. + pub kind: PermissionDecisionApproveForSessionApprovalMemoryKind, } -/// Location-persisted tool approval details for an extension's access to sensitive environment variables, keyed by extension name and the exact set of variable names. +/// Session-scoped approval details for a custom tool, keyed by tool name. /// ///
/// @@ -10590,16 +10735,14 @@ pub struct PermissionsLocationsAddToolApprovalDetailsExtensionPermissionAccess { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionsLocationsAddToolApprovalDetailsExtensionEnvAccess { - /// Names of the sensitive environment variables this approval covers. Values are never persisted. - pub environment_variables: Vec, - /// Extension name. - pub extension_name: String, - /// Approval covering an extension's request to read sensitive environment variables. - pub kind: PermissionsLocationsAddToolApprovalDetailsExtensionEnvAccessKind, +pub struct PermissionDecisionApproveForSessionApprovalCustomTool { + /// Approval covering a custom tool. + pub kind: PermissionDecisionApproveForSessionApprovalCustomToolKind, + /// Custom tool name. + pub tool_name: String, } -/// Location-scoped tool approval to persist. +/// Session-scoped approval details for extension-management operations, optionally narrowed by operation. /// ///
/// @@ -10607,16 +10750,17 @@ pub struct PermissionsLocationsAddToolApprovalDetailsExtensionEnvAccess { /// and may change or be removed in future SDK or CLI releases. /// ///
-#[derive(Debug, Clone, Serialize, Deserialize)] +#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionLocationAddToolApprovalParams { - /// Tool approval to persist and apply - pub approval: PermissionsLocationsAddToolApprovalDetails, - /// Location key (git root or cwd) to persist the approval to - pub location_key: String, +pub struct PermissionDecisionApproveForSessionApprovalExtensionManagement { + /// Approval covering extension lifecycle operations such as enable, disable, or reload. + pub kind: PermissionDecisionApproveForSessionApprovalExtensionManagementKind, + /// Optional operation identifier; when omitted, the approval covers all extension management operations. + #[serde(skip_serializing_if = "Option::is_none")] + pub operation: Option, } -/// Working directory to load persisted location permissions for. +/// Session-scoped factory approval, optionally narrowed by approval key. /// ///
/// @@ -10626,12 +10770,15 @@ pub struct PermissionLocationAddToolApprovalParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionLocationApplyParams { - /// Working directory whose persisted location permissions should be applied - pub working_directory: String, +pub struct PermissionDecisionApproveForSessionApprovalFactory { + /// Optional factory operation name or canonical approval key; when omitted, the approval covers all factory operations. + #[serde(skip_serializing_if = "Option::is_none")] + pub approval_key: Option, + /// Approval covering factory operations. + pub kind: PermissionDecisionApproveForSessionApprovalFactoryKind, } -/// Summary of persisted location permissions applied to the session. +/// Session-scoped approval details for an extension's permission-gated capability access, keyed by extension name. /// ///
/// @@ -10641,22 +10788,14 @@ pub struct PermissionLocationApplyParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionLocationApplyResult { - /// Number of persisted allowed directories added to the live path manager - pub applied_directory_count: i64, - /// Number of location-scoped rules added to the live permission service - pub applied_rule_count: i64, - /// Location-scoped rules applied to the live permission service - pub applied_rules: Vec, - /// Whether a different location was applied since the previous apply call - pub changed: bool, - /// Location key used in the location-permissions store - pub location_key: String, - /// Whether the location is a git repo or directory - pub location_type: PermissionLocationType, +pub struct PermissionDecisionApproveForSessionApprovalExtensionPermissionAccess { + /// Extension name. + pub extension_name: String, + /// Approval covering an extension's request to access a permission-gated capability. + pub kind: PermissionDecisionApproveForSessionApprovalExtensionPermissionAccessKind, } -/// Working directory to resolve into a location-permissions key. +/// Session-scoped approval details for an extension's access to sensitive environment variables, keyed by extension name and the exact set of variable names. /// ///
/// @@ -10666,12 +10805,16 @@ pub struct PermissionLocationApplyResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionLocationResolveParams { - /// Working directory whose permission location should be resolved - pub working_directory: String, +pub struct PermissionDecisionApproveForSessionApprovalExtensionEnvAccess { + /// Names of the sensitive environment variables this approval covers. Values are never persisted. + pub environment_variables: Vec, + /// Extension name. + pub extension_name: String, + /// Approval covering an extension's request to read sensitive environment variables. + pub kind: PermissionDecisionApproveForSessionApprovalExtensionEnvAccessKind, } -/// Resolved location-permissions key and type. +/// Permission-decision request variant to approve for the rest of the session, with optional tool approval or URL domain. /// ///
/// @@ -10681,14 +10824,18 @@ pub struct PermissionLocationResolveParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionLocationResolveResult { - /// Location key used in the location-permissions store - pub location_key: String, - /// Whether the location is a git repo or directory - pub location_type: PermissionLocationType, +pub struct PermissionDecisionApproveForSession { + /// Session-scoped approval to remember (tool prompts only; omitted for path/url prompts) + #[serde(skip_serializing_if = "Option::is_none")] + pub approval: Option, + /// URL domain to approve for the rest of the session (URL prompts only) + #[serde(skip_serializing_if = "Option::is_none")] + pub domain: Option, + /// Approve and remember for the rest of the session + pub kind: PermissionDecisionApproveForSessionKind, } -/// Directory path to add to the session's allowed directories. +/// Location-scoped approval details for specific command identifiers. /// ///
/// @@ -10698,12 +10845,14 @@ pub struct PermissionLocationResolveResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionPathsAddParams { - /// Directory to add to the allow-list. The runtime resolves and validates the path before adding. - pub path: String, +pub struct PermissionDecisionApproveForLocationApprovalCommands { + /// Command identifiers covered by this approval. + pub command_identifiers: Vec, + /// Approval scoped to specific command identifiers. + pub kind: PermissionDecisionApproveForLocationApprovalCommandsKind, } -/// Path to evaluate against the session's allowed directories. +/// Location-scoped approval details for read-only filesystem operations. /// ///
/// @@ -10713,12 +10862,12 @@ pub struct PermissionPathsAddParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionPathsAllowedCheckParams { - /// Path to check against the session's allowed directories - pub path: String, +pub struct PermissionDecisionApproveForLocationApprovalRead { + /// Approval covering read-only filesystem operations. + pub kind: PermissionDecisionApproveForLocationApprovalReadKind, } -/// Indicates whether the supplied path is within the session's allowed directories. +/// Location-scoped approval details for filesystem write operations. /// ///
/// @@ -10728,12 +10877,12 @@ pub struct PermissionPathsAllowedCheckParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionPathsAllowedCheckResult { - /// Whether the path is within the session's allowed directories - pub allowed: bool, +pub struct PermissionDecisionApproveForLocationApprovalWrite { + /// Approval covering filesystem write operations. + pub kind: PermissionDecisionApproveForLocationApprovalWriteKind, } -/// If specified, replaces the session's path-permission policy. The runtime constructs the appropriate PathManager based on these inputs (rooted at the session's working directory). Omit to leave the current path policy unchanged. +/// Location-scoped approval details for an MCP server tool, or all tools on the server when `toolName` is null. /// ///
/// @@ -10743,22 +10892,16 @@ pub struct PermissionPathsAllowedCheckResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionPathsConfig { - /// Additional directories to allow tool access to (in addition to the session's working directory). When `unrestricted` is true, these are still pre-populated on the UnrestrictedPathManager so they remain visible via getDirectories() (e.g. for @-mention completion). - #[serde(skip_serializing_if = "Option::is_none")] - pub additional_directories: Option>, - /// Whether to include the system temp directory in the allowed list (defaults to true). Ignored when `unrestricted` is true. - #[serde(skip_serializing_if = "Option::is_none")] - pub include_temp_directory: Option, - /// If true, the runtime allows access to all paths without prompting. Equivalent to constructing an UnrestrictedPathManager. - #[serde(skip_serializing_if = "Option::is_none")] - pub unrestricted: Option, - /// Workspace root path (special-cased to be allowed even before the directory exists). Ignored when `unrestricted` is true. - #[serde(skip_serializing_if = "Option::is_none")] - pub workspace_path: Option, +pub struct PermissionDecisionApproveForLocationApprovalMcp { + /// Approval covering an MCP tool. + pub kind: PermissionDecisionApproveForLocationApprovalMcpKind, + /// MCP server name. + pub server_name: String, + /// MCP tool name, or null to cover every tool on the server. + pub tool_name: Option, } -/// Snapshot of the session's allow-listed directories and primary working directory. +/// Location-scoped approval details for MCP sampling requests from a server. /// ///
/// @@ -10768,14 +10911,14 @@ pub struct PermissionPathsConfig { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionPathsList { - /// All directories currently allowed for tool access on this session. - pub directories: Vec, - /// The primary working directory for this session. - pub primary: String, +pub struct PermissionDecisionApproveForLocationApprovalMcpSampling { + /// Approval covering MCP sampling requests for a server. + pub kind: PermissionDecisionApproveForLocationApprovalMcpSamplingKind, + /// MCP server name. + pub server_name: String, } -/// Directory path to set as the session's new primary working directory. +/// Location-scoped approval details for writes to long-term memory. /// ///
/// @@ -10785,12 +10928,12 @@ pub struct PermissionPathsList { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionPathsUpdatePrimaryParams { - /// Directory to set as the new primary working directory for the session's permission policy. - pub path: String, +pub struct PermissionDecisionApproveForLocationApprovalMemory { + /// Approval covering writes to long-term memory. + pub kind: PermissionDecisionApproveForLocationApprovalMemoryKind, } -/// Path to evaluate against the session's workspace (primary) directory. +/// Location-scoped approval details for a custom tool, keyed by tool name. /// ///
/// @@ -10800,12 +10943,14 @@ pub struct PermissionPathsUpdatePrimaryParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionPathsWorkspaceCheckParams { - /// Path to check against the session workspace directory - pub path: String, +pub struct PermissionDecisionApproveForLocationApprovalCustomTool { + /// Approval covering a custom tool. + pub kind: PermissionDecisionApproveForLocationApprovalCustomToolKind, + /// Custom tool name. + pub tool_name: String, } -/// Indicates whether the supplied path is within the session's workspace directory. +/// Location-scoped approval details for extension-management operations, optionally narrowed by operation. /// ///
/// @@ -10815,12 +10960,15 @@ pub struct PermissionPathsWorkspaceCheckParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionPathsWorkspaceCheckResult { - /// Whether the path is within the session workspace directory - pub allowed: bool, +pub struct PermissionDecisionApproveForLocationApprovalExtensionManagement { + /// Approval covering extension lifecycle operations such as enable, disable, or reload. + pub kind: PermissionDecisionApproveForLocationApprovalExtensionManagementKind, + /// Optional operation identifier; when omitted, the approval covers all extension management operations. + #[serde(skip_serializing_if = "Option::is_none")] + pub operation: Option, } -/// Notification payload describing the permission prompt that the client just rendered. +/// Location-scoped factory approval, optionally narrowed by approval key. /// ///
/// @@ -10830,12 +10978,15 @@ pub struct PermissionPathsWorkspaceCheckResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionPromptShownNotification { - /// Human-readable description of the prompt the user is being asked to approve. Used by the runtime to fire the registered `permission_prompt` notification hook (e.g. terminal bell, desktop notification). - pub message: String, +pub struct PermissionDecisionApproveForLocationApprovalFactory { + /// Optional factory operation name or canonical approval key; when omitted, the approval covers all factory operations. + #[serde(skip_serializing_if = "Option::is_none")] + pub approval_key: Option, + /// Approval covering factory operations. + pub kind: PermissionDecisionApproveForLocationApprovalFactoryKind, } -/// Indicates whether the permission decision was applied; false when the request was already resolved. +/// Location-scoped approval details for an extension's permission-gated capability access, keyed by extension name. /// ///
/// @@ -10845,12 +10996,14 @@ pub struct PermissionPromptShownNotification { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionRequestResult { - /// Whether the permission request was handled successfully - pub success: bool, +pub struct PermissionDecisionApproveForLocationApprovalExtensionPermissionAccess { + /// Extension name. + pub extension_name: String, + /// Approval covering an extension's request to access a permission-gated capability. + pub kind: PermissionDecisionApproveForLocationApprovalExtensionPermissionAccessKind, } -/// If specified, replaces the session's approved/denied permission rules. Omit to leave the current rules unchanged. +/// Location-scoped approval details for an extension's access to sensitive environment variables, keyed by extension name and the exact set of variable names. /// ///
/// @@ -10860,14 +11013,16 @@ pub struct PermissionRequestResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionRulesSet { - /// Rules that auto-approve matching requests - pub approved: Vec, - /// Rules that auto-deny matching requests - pub denied: Vec, +pub struct PermissionDecisionApproveForLocationApprovalExtensionEnvAccess { + /// Names of the sensitive environment variables this approval covers. Values are never persisted. + pub environment_variables: Vec, + /// Extension name. + pub extension_name: String, + /// Approval covering an extension's request to read sensitive environment variables. + pub kind: PermissionDecisionApproveForLocationApprovalExtensionEnvAccessKind, } -/// Source descriptor for a `session.permissions.configure` content-exclusion rule, with source name and type. +/// Permission-decision request variant to approve and persist a permission for a project location, with approval details and location key. /// ///
/// @@ -10875,17 +11030,19 @@ pub struct PermissionRulesSet { /// and may change or be removed in future SDK or CLI releases. /// ///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionsConfigureAdditionalContentExclusionPolicyRuleSource { - /// Name of the policy source. - pub name: String, - /// Type of the policy source. - pub r#type: String, -} - -/// Single content-exclusion rule supplied to `session.permissions.configure`, with paths, match conditions, and source. -/// +pub struct PermissionDecisionApproveForLocation { + /// Approval to persist for this location + pub approval: PermissionDecisionApproveForLocationApproval, + /// Approve and persist for this project location + pub kind: PermissionDecisionApproveForLocationKind, + /// Location key (git root or cwd) to persist the approval to + pub location_key: String, +} + +/// Permission-decision request variant to permanently approve a URL domain across sessions. +/// ///
/// /// **Experimental.** This type is part of an experimental wire-protocol surface @@ -10894,20 +11051,14 @@ pub struct PermissionsConfigureAdditionalContentExclusionPolicyRuleSource { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionsConfigureAdditionalContentExclusionPolicyRule { - /// Conditions of which at least one must match. - #[serde(skip_serializing_if = "Option::is_none")] - pub if_any_match: Option>, - /// Conditions none of which may match. - #[serde(skip_serializing_if = "Option::is_none")] - pub if_none_match: Option>, - /// Path patterns covered by this rule. - pub paths: Vec, - /// Source descriptor for a `session.permissions.configure` content-exclusion rule, with source name and type. - pub source: PermissionsConfigureAdditionalContentExclusionPolicyRuleSource, +pub struct PermissionDecisionApprovePermanently { + /// URL domain to approve permanently + pub domain: String, + /// Approve and persist across sessions (URL prompts only) + pub kind: PermissionDecisionApprovePermanentlyKind, } -/// Content-exclusion policy supplied to `session.permissions.configure`, with rules, last-updated data, and scope. +/// Permission-decision request variant to reject a pending permission request, with optional feedback. /// ///
/// @@ -10917,17 +11068,15 @@ pub struct PermissionsConfigureAdditionalContentExclusionPolicyRule { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionsConfigureAdditionalContentExclusionPolicy { - /// Opaque policy update timestamp supplied by the host. - #[serde(rename = "last_updated_at")] - pub last_updated_at: serde_json::Value, - /// Content-exclusion rules to apply. - pub rules: Vec, - /// Allowed values for the `PermissionsConfigureAdditionalContentExclusionPolicyScope` enumeration. - pub scope: PermissionsConfigureAdditionalContentExclusionPolicyScope, +pub struct PermissionDecisionReject { + /// Optional feedback explaining the rejection + #[serde(skip_serializing_if = "Option::is_none")] + pub feedback: Option, + /// Reject the request + pub kind: PermissionDecisionRejectKind, } -/// If specified, replaces the session's URL-permission policy. The runtime constructs a fresh DefaultUrlManager based on these inputs. Omit to leave the current URL policy unchanged. +/// Permission-decision variant indicating no user was available to confirm the request. /// ///
/// @@ -10937,16 +11086,12 @@ pub struct PermissionsConfigureAdditionalContentExclusionPolicy { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionUrlsConfig { - /// Initial list of allowed URL/domain patterns. Patterns may include path components. Ignored when `unrestricted` is true. - #[serde(skip_serializing_if = "Option::is_none")] - pub initial_allowed: Option>, - /// If true, the runtime allows access to all URLs without prompting. Initial allow-list is ignored when this is true. - #[serde(skip_serializing_if = "Option::is_none")] - pub unrestricted: Option, +pub struct PermissionDecisionUserNotAvailable { + /// No user is available to confirm the request + pub kind: PermissionDecisionUserNotAvailableKind, } -/// Patch of permission policy fields to apply (omit a field to leave it unchanged). +/// Permission-decision variant indicating the request was approved. /// ///
/// @@ -10956,29 +11101,12 @@ pub struct PermissionUrlsConfig { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionsConfigureParams { - /// If specified, replaces the host-supplied GitHub Content Exclusion policies on the session (combined with natively-discovered policies when evaluating tool/file access). Omit to leave the current policies unchanged. - #[serde(skip_serializing_if = "Option::is_none")] - pub additional_content_exclusion_policies: - Option>, - /// If specified, sets whether path/URL read permission requests are auto-approved. Omit to leave the current value unchanged. - #[serde(skip_serializing_if = "Option::is_none")] - pub approve_all_read_permission_requests: Option, - /// If specified, sets whether tool permission requests are auto-approved without prompting. Omit to leave the current value unchanged. - #[serde(skip_serializing_if = "Option::is_none")] - pub approve_all_tool_permission_requests: Option, - /// If specified, replaces the session's path-permission policy. The runtime constructs the appropriate PathManager based on these inputs (rooted at the session's working directory). Omit to leave the current path policy unchanged. - #[serde(skip_serializing_if = "Option::is_none")] - pub paths: Option, - /// If specified, replaces the session's approved/denied permission rules. Omit to leave the current rules unchanged. - #[serde(skip_serializing_if = "Option::is_none")] - pub rules: Option, - /// If specified, replaces the session's URL-permission policy. The runtime constructs a fresh DefaultUrlManager based on these inputs. Omit to leave the current URL policy unchanged. - #[serde(skip_serializing_if = "Option::is_none")] - pub urls: Option, +pub struct PermissionDecisionApproved { + /// The permission request was approved + pub kind: PermissionDecisionApprovedKind, } -/// Indicates whether the operation succeeded. +/// Permission-decision variant indicating approval was remembered for the session, with approval details. /// ///
/// @@ -10986,14 +11114,16 @@ pub struct PermissionsConfigureParams { /// and may change or be removed in future SDK or CLI releases. /// ///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionsConfigureResult { - /// Whether the operation succeeded - pub success: bool, +pub struct PermissionDecisionApprovedForSession { + /// The approval to add as a session-scoped rule + pub approval: UserToolSessionApproval, + /// Approved and remembered for the rest of the session + pub kind: PermissionDecisionApprovedForSessionKind, } -/// Indicates whether the operation succeeded. +/// Permission-decision variant indicating approval was persisted for a project location, with approval details and location key. /// ///
/// @@ -11001,14 +11131,18 @@ pub struct PermissionsConfigureResult { /// and may change or be removed in future SDK or CLI releases. /// ///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionsFolderTrustAddTrustedResult { - /// Whether the operation succeeded - pub success: bool, +pub struct PermissionDecisionApprovedForLocation { + /// The approval to persist for this location + pub approval: UserToolSessionApproval, + /// Approved and persisted for this project location + pub kind: PermissionDecisionApprovedForLocationKind, + /// The location key (git root or cwd) to persist the approval to + pub location_key: String, } -/// No parameters. +/// Permission-decision variant indicating the request was cancelled before use, with an optional reason. /// ///
/// @@ -11018,9 +11152,15 @@ pub struct PermissionsFolderTrustAddTrustedResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionsGetAllowAllRequest {} +pub struct PermissionDecisionCancelled { + /// The permission request was cancelled before a response was used + pub kind: PermissionDecisionCancelledKind, + /// Optional explanation of why the request was cancelled + #[serde(skip_serializing_if = "Option::is_none")] + pub reason: Option, +} -/// Indicates whether the operation succeeded. +/// Permission-decision variant indicating explicit denial by permission rules, with the matching rules. /// ///
/// @@ -11030,12 +11170,14 @@ pub struct PermissionsGetAllowAllRequest {} ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionsLocationsAddToolApprovalResult { - /// Whether the operation succeeded - pub success: bool, +pub struct PermissionDecisionDeniedByRules { + /// Denied because approval rules explicitly blocked it + pub kind: PermissionDecisionDeniedByRulesKind, + /// Rules that denied the request + pub rules: Vec, } -/// Scope and add/remove instructions for modifying session- or location-scoped permission rules. +/// Permission-decision variant indicating no approval rule matched and user confirmation was unavailable. /// ///
/// @@ -11045,21 +11187,12 @@ pub struct PermissionsLocationsAddToolApprovalResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionsModifyRulesParams { - /// Rules to add to the scope. Applied before `remove`/`removeAll`. - #[serde(skip_serializing_if = "Option::is_none")] - pub add: Option>, - /// Specific rules to remove from the scope. Ignored when `removeAll` is true. - #[serde(skip_serializing_if = "Option::is_none")] - pub remove: Option>, - /// When true, removes every rule currently in the scope (after any `add` is applied). Useful for clearing the location scope wholesale. - #[serde(skip_serializing_if = "Option::is_none")] - pub remove_all: Option, - /// Whether the change applies to ephemeral session-scoped rules (cleared at session end) or to location-scoped rules persisted via the location-permissions config file. - pub scope: PermissionsModifyRulesScope, +pub struct PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUser { + /// Denied because no approval rule matched and user confirmation was unavailable + pub kind: PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUserKind, } -/// Indicates whether the operation succeeded. +/// Permission-decision variant indicating the user denied an interactive prompt, with optional feedback and force-reject flag. /// ///
/// @@ -11069,12 +11202,18 @@ pub struct PermissionsModifyRulesParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionsModifyRulesResult { - /// Whether the operation succeeded - pub success: bool, +pub struct PermissionDecisionDeniedInteractivelyByUser { + /// Optional feedback from the user explaining the denial + #[serde(skip_serializing_if = "Option::is_none")] + pub feedback: Option, + /// Whether to force-reject the current agent turn + #[serde(skip_serializing_if = "Option::is_none")] + pub force_reject: Option, + /// Denied by the user during an interactive prompt + pub kind: PermissionDecisionDeniedInteractivelyByUserKind, } -/// Indicates whether the operation succeeded. +/// Permission-decision variant indicating denial by content-exclusion policy, with path and message. /// ///
/// @@ -11084,12 +11223,16 @@ pub struct PermissionsModifyRulesResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionsNotifyPromptShownResult { - /// Whether the operation succeeded - pub success: bool, +pub struct PermissionDecisionDeniedByContentExclusionPolicy { + /// Denied by the organization's content exclusion policy + pub kind: PermissionDecisionDeniedByContentExclusionPolicyKind, + /// Human-readable explanation of why the path was excluded + pub message: String, + /// File path that triggered the exclusion + pub path: String, } -/// Indicates whether the operation succeeded. +/// Permission-decision variant indicating denial by a permission request hook, with optional message and interrupt flag. /// ///
/// @@ -11099,12 +11242,18 @@ pub struct PermissionsNotifyPromptShownResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionsPathsAddResult { - /// Whether the operation succeeded - pub success: bool, +pub struct PermissionDecisionDeniedByPermissionRequestHook { + /// Whether to interrupt the current agent turn + #[serde(skip_serializing_if = "Option::is_none")] + pub interrupt: Option, + /// Denied by a permission request hook registered by an extension or plugin + pub kind: PermissionDecisionDeniedByPermissionRequestHookKind, + /// Optional message from the hook explaining the denial + #[serde(skip_serializing_if = "Option::is_none")] + pub message: Option, } -/// No parameters; returns the session's allow-listed directories. +/// Optional informational context describing how and where the permission decision was made. This does not affect permission behavior. /// ///
/// @@ -11114,9 +11263,16 @@ pub struct PermissionsPathsAddResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionsPathsListRequest {} +pub struct PermissionDecisionContext { + /// Disposition of the permission request as observed by the responding client. + pub outcome: PermissionDecisionOutcome, + /// Controlled reason or actor responsible for the response. + pub source: PermissionDecisionSource, + /// Client surface that submitted the response. + pub surface: PermissionDecisionSurface, +} -/// Indicates whether the operation succeeded. +/// Pending permission request ID and the decision to apply (approve/reject and scope). /// ///
/// @@ -11124,14 +11280,19 @@ pub struct PermissionsPathsListRequest {} /// and may change or be removed in future SDK or CLI releases. /// ///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionsPathsUpdatePrimaryResult { - /// Whether the operation succeeded - pub success: bool, +pub struct PermissionDecisionRequest { + /// Optional informational context describing how and where this response was made. Omit it to preserve legacy behavior without attributing an origin. + #[serde(skip_serializing_if = "Option::is_none")] + pub decision_context: Option, + /// Request ID of the pending permission request + pub request_id: RequestId, + /// The client's response to the pending permission prompt + pub result: PermissionDecision, } -/// No parameters; returns currently-pending permission requests for the session. +/// Location-persisted tool approval details for specific command identifiers. /// ///
/// @@ -11141,9 +11302,14 @@ pub struct PermissionsPathsUpdatePrimaryResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionsPendingRequestsRequest {} +pub struct PermissionsLocationsAddToolApprovalDetailsCommands { + /// Command identifiers covered by this approval. + pub command_identifiers: Vec, + /// Approval scoped to specific command identifiers. + pub kind: PermissionsLocationsAddToolApprovalDetailsCommandsKind, +} -/// Clears session-scoped tool permission approvals, and optionally the location-scoped ones. +/// Location-persisted tool approval details for read-only filesystem operations. /// ///
/// @@ -11153,13 +11319,12 @@ pub struct PermissionsPendingRequestsRequest {} ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionsResetSessionApprovalsRequest { - /// Whether location-scoped approvals are cleared too. Defaults to `true`. - #[serde(skip_serializing_if = "Option::is_none")] - pub include_location: Option, +pub struct PermissionsLocationsAddToolApprovalDetailsRead { + /// Approval covering read-only filesystem operations. + pub kind: PermissionsLocationsAddToolApprovalDetailsReadKind, } -/// Indicates whether the operation succeeded. +/// Location-persisted tool approval details for filesystem write operations. /// ///
/// @@ -11169,12 +11334,12 @@ pub struct PermissionsResetSessionApprovalsRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionsResetSessionApprovalsResult { - /// Whether the operation succeeded - pub success: bool, +pub struct PermissionsLocationsAddToolApprovalDetailsWrite { + /// Approval covering filesystem write operations. + pub kind: PermissionsLocationsAddToolApprovalDetailsWriteKind, } -/// Allow-all mode to apply for the session. +/// Location-persisted tool approval details for an MCP server tool, or all tools when `toolName` is null. /// ///
/// @@ -11184,22 +11349,16 @@ pub struct PermissionsResetSessionApprovalsResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionsSetAllowAllRequest { - /// Legacy full allow-all toggle. Prefer `mode`; when `mode` is omitted, `enabled: true` is treated as `mode: "on"` and any other value is treated as `mode: "off"`. - #[serde(skip_serializing_if = "Option::is_none")] - pub enabled: Option, - /// Allow-all mode to apply. `on` enables full allow-all; `auto` enables advisory LLM auto-approval; `off` disables both. - #[serde(skip_serializing_if = "Option::is_none")] - pub mode: Option, - /// Optional model id for the `auto` mode auto-approval LLM judging. Only meaningful when `mode` is `auto`; ignored otherwise. When omitted, the session resolves a default judge model: `gpt-5.5` for CAPI sessions and the session's active model for BYOK sessions. - #[serde(skip_serializing_if = "Option::is_none")] - pub model: Option, - /// Optional source for allow-all telemetry. Defaults to `rpc` when omitted for SDK callers. - #[serde(skip_serializing_if = "Option::is_none")] - pub source: Option, +pub struct PermissionsLocationsAddToolApprovalDetailsMcp { + /// Approval covering an MCP tool. + pub kind: PermissionsLocationsAddToolApprovalDetailsMcpKind, + /// MCP server name. + pub server_name: String, + /// MCP tool name, or null to cover every tool on the server. + pub tool_name: Option, } -/// Allow-all toggle for tool permission requests, with an optional telemetry source. +/// Location-persisted tool approval details for MCP sampling requests from a server. /// ///
/// @@ -11209,15 +11368,14 @@ pub struct PermissionsSetAllowAllRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionsSetApproveAllRequest { - /// Whether to auto-approve all tool permission requests - pub enabled: bool, - /// Optional source for allow-all telemetry. Defaults to `rpc` when omitted for SDK callers. - #[serde(skip_serializing_if = "Option::is_none")] - pub source: Option, +pub struct PermissionsLocationsAddToolApprovalDetailsMcpSampling { + /// Approval covering MCP sampling requests for a server. + pub kind: PermissionsLocationsAddToolApprovalDetailsMcpSamplingKind, + /// MCP server name. + pub server_name: String, } -/// Indicates whether the operation succeeded. +/// Location-persisted tool approval details for writes to long-term memory. /// ///
/// @@ -11227,12 +11385,12 @@ pub struct PermissionsSetApproveAllRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionsSetApproveAllResult { - /// Whether the operation succeeded - pub success: bool, +pub struct PermissionsLocationsAddToolApprovalDetailsMemory { + /// Approval covering writes to long-term memory. + pub kind: PermissionsLocationsAddToolApprovalDetailsMemoryKind, } -/// Toggles whether permission prompts should be bridged into session events for this client. +/// Location-persisted tool approval details for a custom tool, keyed by tool name. /// ///
/// @@ -11242,12 +11400,14 @@ pub struct PermissionsSetApproveAllResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionsSetRequiredRequest { - /// Whether the client wants `permission.requested` events bridged from the session-owned permission service. CLI clients that render prompt UI set this to `true` for as long as their listener is mounted; headless callers leave it unset (the default is `false`). - pub required: bool, +pub struct PermissionsLocationsAddToolApprovalDetailsCustomTool { + /// Approval covering a custom tool. + pub kind: PermissionsLocationsAddToolApprovalDetailsCustomToolKind, + /// Custom tool name. + pub tool_name: String, } -/// Indicates whether the operation succeeded. +/// Location-persisted tool approval details for extension-management operations, optionally narrowed by operation. /// ///
/// @@ -11257,12 +11417,15 @@ pub struct PermissionsSetRequiredRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionsSetRequiredResult { - /// Whether the operation succeeded - pub success: bool, +pub struct PermissionsLocationsAddToolApprovalDetailsExtensionManagement { + /// Approval covering extension lifecycle operations such as enable, disable, or reload. + pub kind: PermissionsLocationsAddToolApprovalDetailsExtensionManagementKind, + /// Optional operation identifier; when omitted, the approval covers all extension management operations. + #[serde(skip_serializing_if = "Option::is_none")] + pub operation: Option, } -/// Indicates whether the operation succeeded. +/// Location-persisted factory approval, optionally narrowed by approval key. /// ///
/// @@ -11272,12 +11435,15 @@ pub struct PermissionsSetRequiredResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionsUrlsSetUnrestrictedModeResult { - /// Whether the operation succeeded - pub success: bool, +pub struct PermissionsLocationsAddToolApprovalDetailsFactory { + /// Optional factory operation name or canonical approval key; when omitted, the approval covers all factory operations. + #[serde(skip_serializing_if = "Option::is_none")] + pub approval_key: Option, + /// Approval covering factory operations. + pub kind: PermissionsLocationsAddToolApprovalDetailsFactoryKind, } -/// Whether the URL-permission policy should run in unrestricted mode. +/// Location-persisted tool approval details for an extension's permission-gated capability access, keyed by extension name. /// ///
/// @@ -11287,12 +11453,14 @@ pub struct PermissionsUrlsSetUnrestrictedModeResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionUrlsSetUnrestrictedModeParams { - /// Whether to allow access to all URLs without prompting. Toggles the runtime's URL-permission policy in place. - pub enabled: bool, +pub struct PermissionsLocationsAddToolApprovalDetailsExtensionPermissionAccess { + /// Extension name. + pub extension_name: String, + /// Approval covering an extension's request to access a permission-gated capability. + pub kind: PermissionsLocationsAddToolApprovalDetailsExtensionPermissionAccessKind, } -/// Optional message to echo back to the caller. +/// Location-persisted tool approval details for an extension's access to sensitive environment variables, keyed by extension name and the exact set of variable names. /// ///
/// @@ -11302,13 +11470,16 @@ pub struct PermissionUrlsSetUnrestrictedModeParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PingRequest { - /// Optional message to echo back - #[serde(skip_serializing_if = "Option::is_none")] - pub message: Option, +pub struct PermissionsLocationsAddToolApprovalDetailsExtensionEnvAccess { + /// Names of the sensitive environment variables this approval covers. Values are never persisted. + pub environment_variables: Vec, + /// Extension name. + pub extension_name: String, + /// Approval covering an extension's request to read sensitive environment variables. + pub kind: PermissionsLocationsAddToolApprovalDetailsExtensionEnvAccessKind, } -/// Server liveness response, including the echoed message, current server timestamp, and protocol version. +/// Location-scoped tool approval to persist. /// ///
/// @@ -11316,18 +11487,16 @@ pub struct PingRequest { /// and may change or be removed in future SDK or CLI releases. /// ///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PingResult { - /// Echoed message (or default greeting) - pub message: String, - /// Server protocol version number - pub protocol_version: i64, - /// ISO 8601 timestamp when the server handled the ping - pub timestamp: String, +pub struct PermissionLocationAddToolApprovalParams { + /// Tool approval to persist and apply + pub approval: PermissionsLocationsAddToolApprovalDetails, + /// Location key (git root or cwd) to persist the approval to + pub location_key: String, } -/// Existence, contents, and resolved path of the session plan file. +/// Working directory to load persisted location permissions for. /// ///
/// @@ -11337,16 +11506,12 @@ pub struct PingResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PlanReadResult { - /// The content of the plan file, or null if it does not exist - pub content: Option, - /// Whether the plan file exists in the workspace - pub exists: bool, - /// Absolute file path of the plan file, or null if workspace is not enabled - pub path: Option, +pub struct PermissionLocationApplyParams { + /// Working directory whose persisted location permissions should be applied + pub working_directory: String, } -/// 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. +/// Summary of persisted location permissions applied to the session. /// ///
/// @@ -11356,22 +11521,22 @@ pub struct PlanReadResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PlanSqlTodosRow { - /// Todo description. - #[serde(skip_serializing_if = "Option::is_none")] - pub description: Option, - /// Todo identifier. - #[serde(skip_serializing_if = "Option::is_none")] - pub id: Option, - /// Todo status. - #[serde(skip_serializing_if = "Option::is_none")] - pub status: Option, - /// Todo title. - #[serde(skip_serializing_if = "Option::is_none")] - pub title: Option, +pub struct PermissionLocationApplyResult { + /// Number of persisted allowed directories added to the live path manager + pub applied_directory_count: i64, + /// Number of location-scoped rules added to the live permission service + pub applied_rule_count: i64, + /// Location-scoped rules applied to the live permission service + pub applied_rules: Vec, + /// Whether a different location was applied since the previous apply call + pub changed: bool, + /// Location key used in the location-permissions store + pub location_key: String, + /// Whether the location is a git repo or directory + pub location_type: PermissionLocationType, } -/// Todo rows read from the session SQL database. Empty when no session database is available. +/// Working directory to resolve into a location-permissions key. /// ///
/// @@ -11381,12 +11546,12 @@ pub struct PlanSqlTodosRow { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct 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. - pub rows: Vec, +pub struct PermissionLocationResolveParams { + /// Working directory whose permission location should be resolved + pub working_directory: String, } -/// A single dependency edge read from the session SQL `todo_deps` table, indicating that one todo must complete before another. +/// Resolved location-permissions key and type. /// ///
/// @@ -11396,14 +11561,14 @@ pub struct PlanReadSqlTodosResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PlanSqlTodoDependency { - /// ID of the todo it depends on. - pub depends_on: String, - /// ID of the todo that has the dependency. - pub todo_id: String, +pub struct PermissionLocationResolveResult { + /// Location key used in the location-permissions store + pub location_key: String, + /// Whether the location is a git repo or directory + pub location_type: PermissionLocationType, } -/// Todo rows + dependency edges read from the session SQL database. +/// Directory path to add to the session's allowed directories. /// ///
/// @@ -11413,14 +11578,12 @@ pub struct PlanSqlTodoDependency { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct 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. - pub dependencies: Vec, - /// 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. - pub rows: Vec, +pub struct PermissionPathsAddParams { + /// Directory to add to the allow-list. The runtime resolves and validates the path before adding. + pub path: String, } -/// Replacement contents to write to the session plan file. +/// Path to evaluate against the session's allowed directories. /// ///
/// @@ -11430,12 +11593,12 @@ pub struct PlanReadSqlTodosWithDependenciesResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PlanUpdateRequest { - /// The new content for the plan file - pub content: String, +pub struct PermissionPathsAllowedCheckParams { + /// Path to check against the session's allowed directories + pub path: String, } -/// Session plugin metadata, with name, marketplace, optional version, and enabled state. +/// Indicates whether the supplied path is within the session's allowed directories. /// ///
/// @@ -11445,19 +11608,12 @@ pub struct PlanUpdateRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct Plugin { - /// Whether the plugin is currently enabled - pub enabled: bool, - /// Marketplace the plugin came from - pub marketplace: String, - /// Plugin name - pub name: String, - /// Installed version - #[serde(skip_serializing_if = "Option::is_none")] - pub version: Option, +pub struct PermissionPathsAllowedCheckResult { + /// Whether the path is within the session's allowed directories + pub allowed: bool, } -/// Result of installing a plugin. +/// If specified, replaces the session's path-permission policy. The runtime constructs the appropriate PathManager based on these inputs (rooted at the session's working directory). Omit to leave the current path policy unchanged. /// ///
/// @@ -11467,20 +11623,22 @@ pub struct Plugin { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PluginInstallResult { - /// Set when the install path is deprecated (e.g. direct repo / URL / local installs). Callers should surface this to end users. +pub struct PermissionPathsConfig { + /// Additional directories to allow tool access to (in addition to the session's working directory). When `unrestricted` is true, these are still pre-populated on the UnrestrictedPathManager so they remain visible via getDirectories() (e.g. for @-mention completion). #[serde(skip_serializing_if = "Option::is_none")] - pub deprecation_warning: Option, - /// The newly installed plugin's metadata - pub plugin: InstalledPluginInfo, - /// Optional post-install message provided by the plugin (e.g. setup instructions) + pub additional_directories: Option>, + /// Whether to include the system temp directory in the allowed list (defaults to true). Ignored when `unrestricted` is true. #[serde(skip_serializing_if = "Option::is_none")] - pub post_install_message: Option, - /// Number of skills discovered and installed from the plugin - pub skills_installed: i64, + pub include_temp_directory: Option, + /// If true, the runtime allows access to all paths without prompting. Equivalent to constructing an UnrestrictedPathManager. + #[serde(skip_serializing_if = "Option::is_none")] + pub unrestricted: Option, + /// Workspace root path (special-cased to be allowed even before the directory exists). Ignored when `unrestricted` is true. + #[serde(skip_serializing_if = "Option::is_none")] + pub workspace_path: Option, } -/// Plugins installed for the session, with their enabled state and version metadata. +/// Snapshot of the session's allow-listed directories and primary working directory. /// ///
/// @@ -11490,12 +11648,14 @@ pub struct PluginInstallResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PluginList { - /// Installed plugins - pub plugins: Vec, +pub struct PermissionPathsList { + /// All directories currently allowed for tool access on this session. + pub directories: Vec, + /// The primary working directory for this session. + pub primary: String, } -/// Plugins installed in user/global state. +/// Directory path to set as the session's new primary working directory. /// ///
/// @@ -11505,12 +11665,12 @@ pub struct PluginList { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PluginListResult { - /// Installed plugins - pub plugins: Vec, +pub struct PermissionPathsUpdatePrimaryParams { + /// Directory to set as the new primary working directory for the session's permission policy. + pub path: String, } -/// Trusted built-in plugin directories to use for this runtime process. +/// Path to evaluate against the session's workspace (primary) directory. /// ///
/// @@ -11520,12 +11680,12 @@ pub struct PluginListResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PluginsBuiltinSetRequest { - /// Complete replacement set of trusted built-in plugin directories. Every entry must be an absolute local filesystem path no longer than 4096 characters. - pub paths: Vec, +pub struct PermissionPathsWorkspaceCheckParams { + /// Path to check against the session workspace directory + pub path: String, } -/// Plugin names (or specs) to disable. +/// Indicates whether the supplied path is within the session's workspace directory. /// ///
/// @@ -11535,12 +11695,12 @@ pub struct PluginsBuiltinSetRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct 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. - pub names: Vec, +pub struct PermissionPathsWorkspaceCheckResult { + /// Whether the path is within the session workspace directory + pub allowed: bool, } -/// Plugin names (or specs) to enable. +/// Notification payload describing the permission prompt that the client just rendered. /// ///
/// @@ -11550,12 +11710,12 @@ pub struct PluginsDisableRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct 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. - pub names: Vec, +pub struct PermissionPromptShownNotification { + /// Human-readable description of the prompt the user is being asked to approve. Used by the runtime to fire the registered `permission_prompt` notification hook (e.g. terminal bell, desktop notification). + pub message: String, } -/// Plugin source and optional working directory for relative-path resolution. +/// Indicates whether the permission decision was applied; false when the request was already resolved. /// ///
/// @@ -11565,15 +11725,12 @@ pub struct PluginsEnableRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct 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. - pub source: String, - /// Working directory used to resolve relative local paths in `source`. Defaults to the server's current working directory. - #[serde(skip_serializing_if = "Option::is_none")] - pub working_directory: Option, +pub struct PermissionRequestResult { + /// Whether the permission request was handled successfully + pub success: bool, } -/// Marketplace source and optional working directory for relative-path resolution. +/// If specified, replaces the session's approved/denied permission rules. Omit to leave the current rules unchanged. /// ///
/// @@ -11583,15 +11740,14 @@ pub struct PluginsInstallRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct 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. - pub source: String, - /// Working directory used to resolve relative local paths in `source`. Defaults to the server's current working directory. - #[serde(skip_serializing_if = "Option::is_none")] - pub working_directory: Option, +pub struct PermissionRulesSet { + /// Rules that auto-approve matching requests + pub approved: Vec, + /// Rules that auto-deny matching requests + pub denied: Vec, } -/// Name of the marketplace whose plugin catalog to fetch. +/// Source descriptor for a `session.permissions.configure` content-exclusion rule, with source name and type. /// ///
/// @@ -11601,12 +11757,14 @@ pub struct PluginsMarketplacesAddRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PluginsMarketplacesBrowseRequest { - /// Marketplace name to browse +pub struct PermissionsConfigureAdditionalContentExclusionPolicyRuleSource { + /// Name of the policy source. pub name: String, + /// Type of the policy source. + pub r#type: String, } -/// Optional marketplace name; omit to refresh all. +/// Single content-exclusion rule supplied to `session.permissions.configure`, with paths, match conditions, and source. /// ///
/// @@ -11616,13 +11774,20 @@ pub struct PluginsMarketplacesBrowseRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PluginsMarketplacesRefreshRequest { - /// Marketplace name to refresh. When omitted, every registered marketplace is refreshed. +pub struct PermissionsConfigureAdditionalContentExclusionPolicyRule { + /// Conditions of which at least one must match. #[serde(skip_serializing_if = "Option::is_none")] - pub name: Option, + pub if_any_match: Option>, + /// Conditions none of which may match. + #[serde(skip_serializing_if = "Option::is_none")] + pub if_none_match: Option>, + /// Path patterns covered by this rule. + pub paths: Vec, + /// Source descriptor for a `session.permissions.configure` content-exclusion rule, with source name and type. + pub source: PermissionsConfigureAdditionalContentExclusionPolicyRuleSource, } -/// Name of the marketplace to remove and an optional force flag. +/// Content-exclusion policy supplied to `session.permissions.configure`, with rules, last-updated data, and scope. /// ///
/// @@ -11632,15 +11797,36 @@ pub struct PluginsMarketplacesRefreshRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct 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. +pub struct PermissionsConfigureAdditionalContentExclusionPolicy { + /// Opaque policy update timestamp supplied by the host. + #[serde(rename = "last_updated_at")] + pub last_updated_at: serde_json::Value, + /// Content-exclusion rules to apply. + pub rules: Vec, + /// Allowed values for the `PermissionsConfigureAdditionalContentExclusionPolicyScope` enumeration. + pub scope: PermissionsConfigureAdditionalContentExclusionPolicyScope, +} + +/// If specified, replaces the session's URL-permission policy. The runtime constructs a fresh DefaultUrlManager based on these inputs. Omit to leave the current URL policy unchanged. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct PermissionUrlsConfig { + /// Initial list of allowed URL/domain patterns. Patterns may include path components. Ignored when `unrestricted` is true. #[serde(skip_serializing_if = "Option::is_none")] - pub force: Option, - /// Marketplace name to remove - pub name: String, + pub initial_allowed: Option>, + /// If true, the runtime allows access to all URLs without prompting. Initial allow-list is ignored when this is true. + #[serde(skip_serializing_if = "Option::is_none")] + pub unrestricted: Option, } -/// Optional flags controlling which side effects the reload performs. +/// Patch of permission policy fields to apply (omit a field to leave it unchanged). /// ///
/// @@ -11650,25 +11836,29 @@ pub struct PluginsMarketplacesRemoveRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PluginsReloadRequest { - /// When true, skip repo-level hooks during the hook reload. Use before folder trust is confirmed; load them post-trust via `sessions.loadDeferredRepoHooks`. +pub struct PermissionsConfigureParams { + /// If specified, replaces the host-supplied GitHub Content Exclusion policies on the session (combined with natively-discovered policies when evaluating tool/file access). Omit to leave the current policies unchanged. #[serde(skip_serializing_if = "Option::is_none")] - pub defer_repo_hooks: Option, - /// Re-run custom-agent discovery after refreshing plugins. Defaults to true. + pub additional_content_exclusion_policies: + Option>, + /// If specified, sets whether path/URL read permission requests are auto-approved. Omit to leave the current value unchanged. #[serde(skip_serializing_if = "Option::is_none")] - pub reload_custom_agents: Option, - /// 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). + pub approve_all_read_permission_requests: Option, + /// If specified, sets whether tool permission requests are auto-approved without prompting. Omit to leave the current value unchanged. #[serde(skip_serializing_if = "Option::is_none")] - pub reload_extensions: Option, - /// 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). + pub approve_all_tool_permission_requests: Option, + /// If specified, replaces the session's path-permission policy. The runtime constructs the appropriate PathManager based on these inputs (rooted at the session's working directory). Omit to leave the current path policy unchanged. #[serde(skip_serializing_if = "Option::is_none")] - pub reload_hooks: Option, - /// Reload MCP server connections after refreshing plugins. Defaults to true. + pub paths: Option, + /// If specified, replaces the session's approved/denied permission rules. Omit to leave the current rules unchanged. #[serde(skip_serializing_if = "Option::is_none")] - pub reload_mcp: Option, + pub rules: Option, + /// If specified, replaces the session's URL-permission policy. The runtime constructs a fresh DefaultUrlManager based on these inputs. Omit to leave the current URL policy unchanged. + #[serde(skip_serializing_if = "Option::is_none")] + pub urls: Option, } -/// Name (or spec) of the plugin to uninstall. +/// Indicates whether the operation succeeded. /// ///
/// @@ -11678,15 +11868,12 @@ pub struct PluginsReloadRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PluginsUninstallRequest { - /// Stable source identity for a direct (non-marketplace) install. Disambiguates uninstall when multiple installed plugins share the same name. - #[serde(skip_serializing_if = "Option::is_none")] - pub direct_source_id: Option, - /// Plugin name or "plugin@marketplace" spec to uninstall. When ambiguous, prefer the fully-qualified spec. - pub name: String, +pub struct PermissionsConfigureResult { + /// Whether the operation succeeded + pub success: bool, } -/// Name (or spec) of the plugin to update. +/// Indicates whether the operation succeeded. /// ///
/// @@ -11696,12 +11883,12 @@ pub struct PluginsUninstallRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PluginsUpdateRequest { - /// Plugin name or "plugin@marketplace" spec to update. - pub name: String, +pub struct PermissionsFolderTrustAddTrustedResult { + /// Whether the operation succeeded + pub success: bool, } -/// Per-plugin result from updating all plugins, with versions, skills installed, success flag, and optional error. +/// No parameters. /// ///
/// @@ -11711,28 +11898,9 @@ pub struct PluginsUpdateRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PluginUpdateAllEntry { - /// Error message (failure only) - #[serde(skip_serializing_if = "Option::is_none")] - pub error: Option, - /// Marketplace the plugin came from. Empty string ("") for direct installs. - pub marketplace: String, - /// Plugin name that was updated - pub name: String, - /// Version after the update, when available - #[serde(skip_serializing_if = "Option::is_none")] - pub new_version: Option, - /// Previously installed version, when available - #[serde(skip_serializing_if = "Option::is_none")] - pub previous_version: Option, - /// Number of skills installed after the update (success only) - #[serde(skip_serializing_if = "Option::is_none")] - pub skills_installed: Option, - /// Whether the update succeeded for this plugin - pub success: bool, -} +pub struct PermissionsGetModeRequest {} -/// Result of updating all installed plugins. +/// Current permission mode. /// ///
/// @@ -11742,12 +11910,12 @@ pub struct PluginUpdateAllEntry { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PluginUpdateAllResult { - /// Per-plugin update results in deterministic order. - pub results: Vec, +pub struct PermissionsGetModeResult { + /// Current permission mode + pub mode: PermissionMode, } -/// Result of updating a single plugin. +/// Indicates whether the operation succeeded. /// ///
/// @@ -11757,18 +11925,12 @@ pub struct PluginUpdateAllResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PluginUpdateResult { - /// Version after the update, when reported by the plugin manifest - #[serde(skip_serializing_if = "Option::is_none")] - pub new_version: Option, - /// Version that was previously installed, when available - #[serde(skip_serializing_if = "Option::is_none")] - pub previous_version: Option, - /// Number of skills discovered and installed after the update - pub skills_installed: i64, +pub struct PermissionsLocationsAddToolApprovalResult { + /// Whether the operation succeeded + pub success: bool, } -/// Serializable definition of a caller-implemented tool whose execution is handled over the SDK connection. +/// Scope and add/remove instructions for modifying session- or location-scoped permission rules. /// ///
/// @@ -11778,35 +11940,21 @@ pub struct PluginUpdateResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ProtocolExternalToolDefinition { - /// Tool-loading deferral policy. - #[serde(skip_serializing_if = "Option::is_none")] - pub defer: Option, - /// Model-visible explanation of what the tool does. - pub description: String, - /// Whether the tool executes commands in a terminal. - #[serde(skip_serializing_if = "Option::is_none")] - pub is_terminal: Option, - /// Optional caller-defined metadata associated with the tool. - #[serde(skip_serializing_if = "Option::is_none")] - pub metadata: Option>, - /// Unique model-visible tool name. - pub name: String, - /// Whether this definition replaces a built-in tool with the same name. - #[serde(skip_serializing_if = "Option::is_none")] - pub overrides_built_in_tool: Option, - /// JSON Schema describing the tool's input arguments. +pub struct PermissionsModifyRulesParams { + /// Rules to add to the scope. Applied before `remove`/`removeAll`. #[serde(skip_serializing_if = "Option::is_none")] - pub parameters: Option>, - /// Whether execution bypasses the normal tool permission prompt. + pub add: Option>, + /// Specific rules to remove from the scope. Ignored when `removeAll` is true. #[serde(skip_serializing_if = "Option::is_none")] - pub skip_permission: Option, - /// Optional human-readable display title. + pub remove: Option>, + /// When true, removes every rule currently in the scope (after any `add` is applied). Useful for clearing the location scope wholesale. #[serde(skip_serializing_if = "Option::is_none")] - pub title: Option, + pub remove_all: Option, + /// Whether the change applies to ephemeral session-scoped rules (cleared at session end) or to location-scoped rules persisted via the location-permissions config file. + pub scope: PermissionsModifyRulesScope, } -/// A BYOK model definition referencing a named provider. +/// Indicates whether the operation succeeded. /// ///
/// @@ -11816,35 +11964,12 @@ pub struct ProtocolExternalToolDefinition { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ProviderModelConfig { - /// Optional capability overrides (vision, tool_calls, reasoning, etc.). - #[serde(skip_serializing_if = "Option::is_none")] - pub capabilities: Option, - /// 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`. - pub id: String, - /// Maximum context window tokens for the model. - #[serde(skip_serializing_if = "Option::is_none")] - pub max_context_window_tokens: Option, - /// Maximum output tokens for the model. - #[serde(skip_serializing_if = "Option::is_none")] - pub max_output_tokens: Option, - /// Maximum prompt/input tokens for the model. - #[serde(skip_serializing_if = "Option::is_none")] - pub max_prompt_tokens: Option, - /// Well-known base model id used for behavior/capability/config lookup. Defaults to `id`. - #[serde(skip_serializing_if = "Option::is_none")] - pub model_id: Option, - /// Display name for model pickers. Defaults to the provider-qualified selection id (`provider/id`). - #[serde(skip_serializing_if = "Option::is_none")] - pub name: Option, - /// Name of the configured provider that serves this model. - pub provider: String, - /// The model name sent to the provider API for inference. Defaults to `id`. - #[serde(skip_serializing_if = "Option::is_none")] - pub wire_model: Option, +pub struct PermissionsModifyRulesResult { + /// Whether the operation succeeded + pub success: bool, } -/// BYOK providers and/or models to add to the session's registry at runtime. Both fields are optional; provide providers, models, or both. +/// Indicates whether the operation succeeded. /// ///
/// @@ -11854,16 +11979,12 @@ pub struct ProviderModelConfig { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct 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. - #[serde(skip_serializing_if = "Option::is_none")] - pub models: Option>, - /// 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 '/'. - #[serde(skip_serializing_if = "Option::is_none")] - pub providers: Option>, +pub struct PermissionsNotifyPromptShownResult { + /// Whether the operation succeeded + pub success: bool, } -/// The selectable model entries synthesized for the models added by this call. +/// Indicates whether the operation succeeded. /// ///
/// @@ -11873,12 +11994,12 @@ pub struct ProviderAddRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct 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. - pub models: Vec, +pub struct PermissionsPathsAddResult { + /// Whether the operation succeeded + pub success: bool, } -/// Custom model-provider configuration (BYOK). +/// No parameters; returns the session's allow-listed directories. /// ///
/// @@ -11888,57 +12009,9 @@ pub struct ProviderAddResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ProviderConfig { - /// API key. Optional for local providers like Ollama. - #[serde(skip_serializing_if = "Option::is_none")] - pub api_key: Option, - /// Azure-specific provider options. - #[serde(skip_serializing_if = "Option::is_none")] - pub azure: Option, - /// API endpoint URL. - pub base_url: String, - /// Bearer token for authentication. Sets the Authorization header directly. Takes precedence over apiKey when both are set. - #[serde(skip_serializing_if = "Option::is_none")] - pub bearer_token: Option, - /// 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 ` 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. - #[serde(skip_serializing_if = "Option::is_none")] - pub has_bearer_token_provider: Option, - /// Custom HTTP headers to include in all outbound requests to the provider. - #[serde(skip_serializing_if = "Option::is_none")] - pub headers: Option>, - /// Maximum context window tokens for the model. - #[serde(skip_serializing_if = "Option::is_none")] - pub max_context_window_tokens: Option, - /// Maximum output tokens for the model. - #[serde(skip_serializing_if = "Option::is_none")] - pub max_output_tokens: Option, - /// Maximum prompt/input tokens for the model. - #[serde(skip_serializing_if = "Option::is_none")] - pub max_prompt_tokens: Option, - /// Overrides for model capabilities when they cannot be inferred from modelId. - #[serde(skip_serializing_if = "Option::is_none")] - pub model_capabilities: Option, - /// Well-known model ID used for capability lookup. When set, agent behavior config and token limits are inferred from this model. - #[serde(skip_serializing_if = "Option::is_none")] - pub model_id: Option, - /// Provider name used for model and telemetry attribution. - #[serde(skip_serializing_if = "Option::is_none")] - pub provider_name: Option, - /// Provider transport. Defaults to "http". - #[serde(skip_serializing_if = "Option::is_none")] - pub transport: Option, - /// Provider type. Defaults to "openai" for generic OpenAI-compatible APIs. - #[serde(skip_serializing_if = "Option::is_none")] - pub r#type: Option, - /// Wire API format (openai/azure only). Defaults to "completions". - #[serde(skip_serializing_if = "Option::is_none")] - pub wire_api: Option, - /// The model identifier sent to the provider API for inference (the "wire" model), as opposed to modelId which is the well-known base. - #[serde(skip_serializing_if = "Option::is_none")] - pub wire_model: Option, -} +pub struct PermissionsPathsListRequest {} -/// 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. +/// Indicates whether the operation succeeded. /// ///
/// @@ -11948,20 +12021,12 @@ pub struct ProviderConfig { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct 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`. - #[serde(skip_serializing_if = "Option::is_none")] - pub expires_at: Option, - /// HTTP header name the token must be sent under. - pub header: String, - /// The model the token is bound to, when applicable. When set, the token is only valid for requests against this model. - #[serde(skip_serializing_if = "Option::is_none")] - pub model: Option, - /// The short-lived token value. - pub token: String, +pub struct PermissionsPathsUpdatePrimaryResult { + /// Whether the operation succeeded + pub success: bool, } -/// A snapshot of the provider endpoint the session is currently configured to talk to. +/// No parameters; returns currently-pending permission requests for the session. /// ///
/// @@ -11971,28 +12036,9 @@ pub struct ProviderSessionToken { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ProviderEndpoint { - /// A credential the caller should use with this endpoint. Omitted only when the endpoint accepts unauthenticated requests. - #[serde(skip_serializing_if = "Option::is_none")] - pub api_key: Option, - /// Base URL to pass to the LLM client library. - pub base_url: String, - /// HTTP headers the caller must include on every outbound request. - pub headers: HashMap, - /// 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. - #[serde(skip_serializing_if = "Option::is_none")] - pub session_token: Option, - /// Transport to be used for provider requests. - #[serde(skip_serializing_if = "Option::is_none")] - pub transport: Option, - /// Provider family. Matches the `type` field of a BYOK provider config. - pub r#type: ProviderEndpointType, - /// Wire API to be used, when required for the provider type. - #[serde(skip_serializing_if = "Option::is_none")] - pub wire_api: Option, -} +pub struct PermissionsPendingRequestsRequest {} -/// Optional model identifier to scope the endpoint snapshot to. +/// Clears session-scoped tool permission approvals, and optionally the location-scoped ones. /// ///
/// @@ -12002,13 +12048,13 @@ pub struct ProviderEndpoint { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ProviderGetEndpointRequest { - /// 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. +pub struct PermissionsResetSessionApprovalsRequest { + /// Whether location-scoped approvals are cleared too. Defaults to `true`. #[serde(skip_serializing_if = "Option::is_none")] - pub model_id: Option, + pub include_location: Option, } -/// Asks the SDK client to acquire a bearer token for a BYOK provider whose config set `hasBearerTokenProvider: true`. Issued by the runtime before each outbound model request; the runtime does no caching, so this is sent once per request. +/// Indicates whether the operation succeeded. /// ///
/// @@ -12018,14 +12064,12 @@ pub struct ProviderGetEndpointRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ProviderTokenAcquireRequest { - /// Target session identifier - pub session_id: SessionId, - /// Name of the BYOK provider needing a token. For the legacy whole-session provider this is the implicit provider name; for named providers it is the configured provider name. - pub provider_name: String, +pub struct PermissionsResetSessionApprovalsResult { + /// Whether the operation succeeded + pub success: bool, } -/// A bearer token supplied by the SDK client for a BYOK provider. The runtime sets it as `Authorization: Bearer ` on the outbound request and does no caching; the SDK consumer owns token caching and refresh. +/// Allow-all toggle for tool permission requests, with an optional telemetry source. /// ///
/// @@ -12035,12 +12079,15 @@ pub struct ProviderTokenAcquireRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ProviderTokenAcquireResult { - /// The bearer token value (without the `Bearer ` prefix). - pub token: String, +pub struct PermissionsSetApproveAllRequest { + /// Whether to auto-approve all tool permission requests + pub enabled: bool, + /// Optional source for allow-all telemetry. Defaults to `rpc` when omitted for SDK callers. + #[serde(skip_serializing_if = "Option::is_none")] + pub source: Option, } -/// Blob attachment with inline base64-encoded data +/// Indicates whether the operation succeeded. /// ///
/// @@ -12050,19 +12097,12 @@ pub struct ProviderTokenAcquireResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PushAttachmentBlob { - /// Base64-encoded content - pub data: String, - /// User-facing display name for the attachment - #[serde(skip_serializing_if = "Option::is_none")] - pub display_name: Option, - /// MIME type of the inline data - pub mime_type: String, - /// Attachment type discriminator - pub r#type: PushAttachmentBlobType, +pub struct PermissionsSetApproveAllResult { + /// Whether the operation succeeded + pub success: bool, } -/// Directory attachment +/// Permission mode to apply for the session. /// ///
/// @@ -12072,16 +12112,18 @@ pub struct PushAttachmentBlob { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PushAttachmentDirectory { - /// User-facing display name for the attachment - pub display_name: String, - /// Absolute directory path - pub path: String, - /// Attachment type discriminator - pub r#type: PushAttachmentDirectoryType, +pub struct PermissionsSetModeRequest { + /// Optional judge model id for assisted mode. When omitted, the session resolves the provider default: `gpt-5.5` for CAPI sessions and the active session model for BYOK sessions. + #[serde(skip_serializing_if = "Option::is_none")] + pub assisted_approval_model: Option, + /// Permission mode to apply + pub mode: PermissionMode, + /// Optional source for permission-mode telemetry. Defaults to `rpc` when omitted for SDK callers. + #[serde(skip_serializing_if = "Option::is_none")] + pub source: Option, } -/// Optional line range to scope the attachment to a specific section of the file +/// Indicates whether the requested permission mode was applied and reports the authoritative post-mutation mode. /// ///
/// @@ -12091,14 +12133,14 @@ pub struct PushAttachmentDirectory { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PushAttachmentFileLineRange { - /// End line number (1-based, inclusive) - pub end: i64, - /// Start line number (1-based) - pub start: i64, +pub struct PermissionsSetModeResult { + /// Authoritative permission mode after the mutation + pub mode: PermissionMode, + /// Whether the operation succeeded + pub success: bool, } -/// File attachment +/// Toggles whether permission prompts should be bridged into session events for this client. /// ///
/// @@ -12108,19 +12150,12 @@ pub struct PushAttachmentFileLineRange { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PushAttachmentFile { - /// User-facing display name for the attachment - pub display_name: String, - /// Optional line range to scope the attachment to a specific section of the file - #[serde(skip_serializing_if = "Option::is_none")] - pub line_range: Option, - /// Absolute file path - pub path: String, - /// Attachment type discriminator - pub r#type: PushAttachmentFileType, +pub struct PermissionsSetRequiredRequest { + /// Whether the client wants `permission.requested` events bridged from the session-owned permission service. CLI clients that render prompt UI set this to `true` for as long as their listener is mounted; headless callers leave it unset (the default is `false`). + pub required: bool, } -/// Pointer to a GitHub repository. +/// Indicates whether the operation succeeded. /// ///
/// @@ -12130,17 +12165,12 @@ pub struct PushAttachmentFile { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PushGitHubRepoRef { - /// Numeric GitHub repository id - #[serde(skip_serializing_if = "Option::is_none")] - pub id: Option, - /// Repository name (without owner) - pub name: String, - /// Repository owner login (user or organization) - pub owner: String, +pub struct PermissionsSetRequiredResult { + /// Whether the operation succeeded + pub success: bool, } -/// Pointer to a GitHub Actions job. +/// Indicates whether the operation succeeded. /// ///
/// @@ -12150,25 +12180,12 @@ pub struct PushGitHubRepoRef { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PushAttachmentGitHubActionsJob { - /// Terminal conclusion of the job when finished (e.g., success, failure, cancelled). Absent for in-progress jobs. - #[serde(skip_serializing_if = "Option::is_none")] - pub conclusion: Option, - /// Job id within the workflow run - pub job_id: i64, - /// Display name of the job - pub job_name: String, - /// Repository the workflow run belongs to - pub repo: PushGitHubRepoRef, - /// Attachment type discriminator - pub r#type: PushAttachmentGitHubActionsJobType, - /// URL to the job on GitHub - pub url: String, - /// Display name of the workflow the job ran in - pub workflow_name: String, +pub struct PermissionsUrlsSetUnrestrictedModeResult { + /// Whether the operation succeeded + pub success: bool, } -/// Pointer to a GitHub commit. +/// Whether the URL-permission policy should run in unrestricted mode. /// ///
/// @@ -12178,20 +12195,12 @@ pub struct PushAttachmentGitHubActionsJob { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PushAttachmentGitHubCommit { - /// First line of the commit message - pub message: String, - /// Full commit SHA - pub oid: String, - /// Repository the commit belongs to - pub repo: PushGitHubRepoRef, - /// Attachment type discriminator - pub r#type: PushAttachmentGitHubCommitType, - /// URL to the commit on GitHub - pub url: String, +pub struct PermissionUrlsSetUnrestrictedModeParams { + /// Whether to allow access to all URLs without prompting. Toggles the runtime's URL-permission policy in place. + pub enabled: bool, } -/// Pointer to a file in a GitHub repository at a specific ref. +/// Optional message to echo back to the caller. /// ///
/// @@ -12201,20 +12210,13 @@ pub struct PushAttachmentGitHubCommit { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PushAttachmentGitHubFile { - /// Repository-relative path to the file - pub path: String, - /// Git ref the file is read at (branch, tag, or commit SHA) - pub r#ref: String, - /// Repository the file lives in - pub repo: PushGitHubRepoRef, - /// Attachment type discriminator - pub r#type: PushAttachmentGitHubFileType, - /// URL to the file on GitHub - pub url: String, +pub struct PingRequest { + /// Optional message to echo back + #[serde(skip_serializing_if = "Option::is_none")] + pub message: Option, } -/// One side of a file diff (head or base) +/// Server liveness response, including the echoed message, current server timestamp, and protocol version. /// ///
/// @@ -12224,16 +12226,16 @@ pub struct PushAttachmentGitHubFile { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PushAttachmentGitHubFileDiffSide { - /// Repository-relative path to the file - pub path: String, - /// Git ref (branch, tag, or commit SHA) the file is read at - pub r#ref: String, - /// Repository the file lives in - pub repo: PushGitHubRepoRef, +pub struct PingResult { + /// Echoed message (or default greeting) + pub message: String, + /// Server protocol version number + pub protocol_version: i64, + /// ISO 8601 timestamp when the server handled the ping + pub timestamp: String, } -/// Pointer to a single-file diff. At least one of `head` and `base` must be present. +/// Existence, contents, and resolved path of the session plan file. /// ///
/// @@ -12243,20 +12245,16 @@ pub struct PushAttachmentGitHubFileDiffSide { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PushAttachmentGitHubFileDiff { - /// File location on the base side of the diff. Absent for additions. - #[serde(skip_serializing_if = "Option::is_none")] - pub base: Option, - /// File location on the head side of the diff. Absent for deletions. - #[serde(skip_serializing_if = "Option::is_none")] - pub head: Option, - /// Attachment type discriminator - pub r#type: PushAttachmentGitHubFileDiffType, - /// URL to the diff on GitHub (e.g., a commit, compare, or PR-file URL) - pub url: String, +pub struct PlanReadResult { + /// The content of the plan file, or null if it does not exist + pub content: Option, + /// Whether the plan file exists in the workspace + pub exists: bool, + /// Absolute file path of the plan file, or null if workspace is not enabled + pub path: Option, } -/// GitHub issue, pull request, or discussion reference +/// 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. /// ///
/// @@ -12266,45 +12264,25 @@ pub struct PushAttachmentGitHubFileDiff { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PushAttachmentGitHubReference { - /// Issue, pull request, or discussion number - pub number: i64, - /// Type of GitHub reference - pub reference_type: PushAttachmentGitHubReferenceType, - /// Current state of the referenced item (e.g., open, closed, merged) - pub state: String, - /// Title of the referenced item - pub title: String, - /// Attachment type discriminator - pub r#type: PushAttachmentGitHubReferenceType, - /// URL to the referenced item on GitHub - pub url: String, -} - -/// Pointer to a GitHub release. -/// -///
-/// -/// **Experimental.** This type is part of an experimental wire-protocol surface -/// and may change or be removed in future SDK or CLI releases. -/// -///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct PushAttachmentGitHubRelease { - /// Human-readable release name - pub name: String, - /// Repository the release belongs to - pub repo: PushGitHubRepoRef, - /// Git tag the release is anchored to - pub tag_name: String, - /// Attachment type discriminator - pub r#type: PushAttachmentGitHubReleaseType, - /// URL to the release on GitHub - pub url: String, +pub struct 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. + #[serde(skip_serializing_if = "Option::is_none")] + pub created_at: Option, + /// Todo description. + #[serde(skip_serializing_if = "Option::is_none")] + pub description: Option, + /// Todo identifier. + #[serde(skip_serializing_if = "Option::is_none")] + pub id: Option, + /// Todo status. + #[serde(skip_serializing_if = "Option::is_none")] + pub status: Option, + /// Todo title. + #[serde(skip_serializing_if = "Option::is_none")] + pub title: Option, } -/// Pointer to a GitHub repository. +/// Todo rows read from the session SQL database. Empty when no session database is available. /// ///
/// @@ -12314,22 +12292,12 @@ pub struct PushAttachmentGitHubRelease { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PushAttachmentGitHubRepository { - /// Short description of the repository - #[serde(skip_serializing_if = "Option::is_none")] - pub description: Option, - /// Git ref this attachment is anchored at (branch, tag, or commit). When absent the default branch is implied. - #[serde(skip_serializing_if = "Option::is_none")] - pub r#ref: Option, - /// Repository pointer - pub repo: PushGitHubRepoRef, - /// Attachment type discriminator - pub r#type: PushAttachmentGitHubRepositoryType, - /// URL to the repository on GitHub - pub url: String, +pub struct 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. + pub rows: Vec, } -/// Pointer to a line range inside a file in a GitHub repository. +/// A single dependency edge read from the session SQL `todo_deps` table, indicating that one todo must complete before another. /// ///
/// @@ -12339,22 +12307,14 @@ pub struct PushAttachmentGitHubRepository { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PushAttachmentGitHubSnippet { - /// Line range the snippet covers - pub line_range: PushAttachmentFileLineRange, - /// Repository-relative path to the file - pub path: String, - /// Git ref the file is read at (branch, tag, or commit SHA) - pub r#ref: String, - /// Repository the file lives in - pub repo: PushGitHubRepoRef, - /// Attachment type discriminator - pub r#type: PushAttachmentGitHubSnippetType, - /// URL to the snippet on GitHub (with line anchor) - pub url: String, +pub struct PlanSqlTodoDependency { + /// ID of the todo it depends on. + pub depends_on: String, + /// ID of the todo that has the dependency. + pub todo_id: String, } -/// One side of a tree comparison (head or base) +/// Todo rows + dependency edges read from the session SQL database. /// ///
/// @@ -12364,14 +12324,14 @@ pub struct PushAttachmentGitHubSnippet { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PushAttachmentGitHubTreeComparisonSide { - /// Repository the revision belongs to - pub repo: PushGitHubRepoRef, - /// Git revision (branch, tag, or commit SHA) - pub revision: String, +pub struct 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. + pub dependencies: Vec, + /// 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. + pub rows: Vec, } -/// Pointer to a comparison between two git revisions. +/// Replacement contents to write to the session plan file. /// ///
/// @@ -12381,18 +12341,12 @@ pub struct PushAttachmentGitHubTreeComparisonSide { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PushAttachmentGitHubTreeComparison { - /// Base side of the comparison - pub base: PushAttachmentGitHubTreeComparisonSide, - /// Head side of the comparison - pub head: PushAttachmentGitHubTreeComparisonSide, - /// Attachment type discriminator - pub r#type: PushAttachmentGitHubTreeComparisonType, - /// URL to the comparison on GitHub - pub url: String, +pub struct PlanUpdateRequest { + /// The new content for the plan file + pub content: String, } -/// Generic GitHub URL reference. +/// Session plugin metadata, with name, marketplace, optional version, and enabled state. /// ///
/// @@ -12402,14 +12356,19 @@ pub struct PushAttachmentGitHubTreeComparison { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PushAttachmentGitHubUrl { - /// Attachment type discriminator - pub r#type: PushAttachmentGitHubUrlType, - /// URL to the GitHub resource - pub url: String, +pub struct Plugin { + /// Whether the plugin is currently enabled + pub enabled: bool, + /// Marketplace the plugin came from + pub marketplace: String, + /// Plugin name + pub name: String, + /// Installed version + #[serde(skip_serializing_if = "Option::is_none")] + pub version: Option, } -/// End position of the selection +/// Result of installing a plugin. /// ///
/// @@ -12419,14 +12378,20 @@ pub struct PushAttachmentGitHubUrl { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PushAttachmentSelectionDetailsEnd { - /// End character offset within the line (0-based) - pub character: i64, - /// End line number (0-based) - pub line: i64, +pub struct PluginInstallResult { + /// Set when the install path is deprecated (e.g. direct repo / URL / local installs). Callers should surface this to end users. + #[serde(skip_serializing_if = "Option::is_none")] + pub deprecation_warning: Option, + /// The newly installed plugin's metadata + pub plugin: InstalledPluginInfo, + /// Optional post-install message provided by the plugin (e.g. setup instructions) + #[serde(skip_serializing_if = "Option::is_none")] + pub post_install_message: Option, + /// Number of skills discovered and installed from the plugin + pub skills_installed: i64, } -/// Start position of the selection +/// Plugins installed for the session, with their enabled state and version metadata. /// ///
/// @@ -12436,14 +12401,12 @@ pub struct PushAttachmentSelectionDetailsEnd { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PushAttachmentSelectionDetailsStart { - /// Start character offset within the line (0-based) - pub character: i64, - /// Start line number (0-based) - pub line: i64, +pub struct PluginList { + /// Installed plugins + pub plugins: Vec, } -/// Position range of the selection within the file +/// Plugins installed in user/global state. /// ///
/// @@ -12453,14 +12416,12 @@ pub struct PushAttachmentSelectionDetailsStart { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PushAttachmentSelectionDetails { - /// End position of the selection - pub end: PushAttachmentSelectionDetailsEnd, - /// Start position of the selection - pub start: PushAttachmentSelectionDetailsStart, +pub struct PluginListResult { + /// Installed plugins + pub plugins: Vec, } -/// Code selection attachment from an editor +/// Trusted built-in plugin directories to use for this runtime process. /// ///
/// @@ -12470,20 +12431,12 @@ pub struct PushAttachmentSelectionDetails { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PushAttachmentSelection { - /// User-facing display name for the selection - pub display_name: String, - /// Absolute path to the file containing the selection - pub file_path: String, - /// Position range of the selection within the file - pub selection: PushAttachmentSelectionDetails, - /// The selected text content - pub text: String, - /// Attachment type discriminator - pub r#type: PushAttachmentSelectionType, +pub struct PluginsBuiltinSetRequest { + /// Complete replacement set of trusted built-in plugin directories. Every entry must be an absolute local filesystem path no longer than 4096 characters. + pub paths: Vec, } -/// Inputs for starting a deferred-idle drain. +/// Plugin names (or specs) to disable. /// ///
/// @@ -12493,12 +12446,12 @@ pub struct PushAttachmentSelection { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct QueueBeginDeferredIdleDrainRequest { - /// Whether the host still has active background work. - pub active_background_work: bool, +pub struct 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. + pub names: Vec, } -/// Whether a deferred-idle drain should run. +/// Plugin names (or specs) to enable. /// ///
/// @@ -12508,12 +12461,12 @@ pub struct QueueBeginDeferredIdleDrainRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct QueueBeginDeferredIdleDrainResult { - /// True when the host should run finishDeferredIdleDrain asynchronously. - pub should_drain: bool, +pub struct 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. + pub names: Vec, } -/// Internal filter for consuming queued system notifications. +/// Plugin source and optional working directory for relative-path resolution. /// ///
/// @@ -12523,12 +12476,15 @@ pub struct QueueBeginDeferredIdleDrainResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct QueueConsumeSystemNotificationsRequest { - /// Opaque runtime-owned filter object. - pub filter: serde_json::Value, +pub struct 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. + pub source: String, + /// Working directory used to resolve relative local paths in `source`. Defaults to the server's current working directory. + #[serde(skip_serializing_if = "Option::is_none")] + pub working_directory: Option, } -/// Queued-command response indicating the host executed the command, with an optional flag to stop queue processing. +/// Marketplace source and optional working directory for relative-path resolution. /// ///
/// @@ -12538,15 +12494,15 @@ pub struct QueueConsumeSystemNotificationsRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct QueuedCommandHandled { - /// The host actually executed the queued command. - pub handled: bool, - /// When true, the runtime will not process subsequent queued commands until a new request comes in. +pub struct 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. + pub source: String, + /// Working directory used to resolve relative local paths in `source`. Defaults to the server's current working directory. #[serde(skip_serializing_if = "Option::is_none")] - pub stop_processing_queue: Option, + pub working_directory: Option, } -/// Queued-command response indicating the host did not execute the command and the queue may continue. +/// Name of the marketplace whose plugin catalog to fetch. /// ///
/// @@ -12556,12 +12512,12 @@ pub struct QueuedCommandHandled { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct QueuedCommandNotHandled { - /// The host did not execute the queued command. Unblocks the queue without claiming the command was processed (e.g. when the handler threw before completing). - pub handled: bool, +pub struct PluginsMarketplacesBrowseRequest { + /// Marketplace name to browse + pub name: String, } -/// Inputs for marking session.idle deferred in native state. +/// Optional marketplace name; omit to refresh all. /// ///
/// @@ -12571,12 +12527,13 @@ pub struct QueuedCommandNotHandled { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct QueueDeferSessionIdleRequest { - /// Whether the deferred idle was caused by an aborted foreground turn. - pub aborted: bool, +pub struct PluginsMarketplacesRefreshRequest { + /// Marketplace name to refresh. When omitted, every registered marketplace is refreshed. + #[serde(skip_serializing_if = "Option::is_none")] + pub name: Option, } -/// Parameters for duplicating a queued item. +/// Name of the marketplace to remove and an optional force flag. /// ///
/// @@ -12586,12 +12543,15 @@ pub struct QueueDeferSessionIdleRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct QueueDuplicateAtRequest { - /// Stable opaque ID of the queued item to duplicate. - pub id: String, +pub struct 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. + #[serde(skip_serializing_if = "Option::is_none")] + pub force: Option, + /// Marketplace name to remove + pub name: String, } -/// Result of duplicating a queued item. +/// Optional flags controlling which side effects the reload performs. /// ///
/// @@ -12601,12 +12561,25 @@ pub struct QueueDuplicateAtRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct QueueDuplicateAtResult { - /// Fresh stable opaque id assigned to the duplicate. - pub id: String, +pub struct PluginsReloadRequest { + /// When true, skip repo-level hooks during the hook reload. Use before folder trust is confirmed; load them post-trust via `sessions.loadDeferredRepoHooks`. + #[serde(skip_serializing_if = "Option::is_none")] + pub defer_repo_hooks: Option, + /// Re-run custom-agent discovery after refreshing plugins. Defaults to true. + #[serde(skip_serializing_if = "Option::is_none")] + pub reload_custom_agents: Option, + /// 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). + #[serde(skip_serializing_if = "Option::is_none")] + pub reload_extensions: Option, + /// 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). + #[serde(skip_serializing_if = "Option::is_none")] + pub reload_hooks: Option, + /// Reload MCP server connections after refreshing plugins. Defaults to true. + #[serde(skip_serializing_if = "Option::is_none")] + pub reload_mcp: Option, } -/// Result of enqueueing the resume-pending wake item. +/// Name (or spec) of the plugin to uninstall. /// ///
/// @@ -12616,12 +12589,15 @@ pub struct QueueDuplicateAtResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct QueueEnqueueResumePendingResult { - /// True when a wake item was newly queued. - pub queued: bool, +pub struct PluginsUninstallRequest { + /// Stable source identity for a direct (non-marketplace) install. Disambiguates uninstall when multiple installed plugins share the same name. + #[serde(skip_serializing_if = "Option::is_none")] + pub direct_source_id: Option, + /// Plugin name or "plugin@marketplace" spec to uninstall. When ambiguous, prefer the fully-qualified spec. + pub name: String, } -/// Inputs for completing a deferred-idle drain. +/// Name (or spec) of the plugin to update. /// ///
/// @@ -12631,14 +12607,12 @@ pub struct QueueEnqueueResumePendingResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct QueueFinishDeferredIdleDrainRequest { - /// Whether the host still has active background work. - pub active_background_work: bool, - /// Whether native queued work remains. - pub has_pending: bool, +pub struct PluginsUpdateRequest { + /// Plugin name or "plugin@marketplace" spec to update. + pub name: String, } -/// Action selected by the native deferred-idle drain. +/// Per-plugin result from updating all plugins, with versions, skills installed, success flag, and optional error. /// ///
/// @@ -12648,14 +12622,28 @@ pub struct QueueFinishDeferredIdleDrainRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct QueueFinishDeferredIdleDrainResult { - /// Whether the deferred idle was caused by an aborted foreground turn. - pub aborted: bool, - /// One of none, processQueue, or emitSessionIdle. - pub action: String, +pub struct PluginUpdateAllEntry { + /// Error message (failure only) + #[serde(skip_serializing_if = "Option::is_none")] + pub error: Option, + /// Marketplace the plugin came from. Empty string ("") for direct installs. + pub marketplace: String, + /// Plugin name that was updated + pub name: String, + /// Version after the update, when available + #[serde(skip_serializing_if = "Option::is_none")] + pub new_version: Option, + /// Previously installed version, when available + #[serde(skip_serializing_if = "Option::is_none")] + pub previous_version: Option, + /// Number of skills installed after the update (success only) + #[serde(skip_serializing_if = "Option::is_none")] + pub skills_installed: Option, + /// Whether the update succeeded for this plugin + pub success: bool, } -/// Whether the native queue has pending work. +/// Result of updating all installed plugins. /// ///
/// @@ -12665,12 +12653,12 @@ pub struct QueueFinishDeferredIdleDrainResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct QueueHasPendingResult { - /// True when queued or immediate native work is pending. - pub has_pending: bool, +pub struct PluginUpdateAllResult { + /// Per-plugin update results in deterministic order. + pub results: Vec, } -/// Serializable message fields accepted by queue.insertAt. +/// Result of updating a single plugin. /// ///
/// @@ -12680,45 +12668,56 @@ pub struct QueueHasPendingResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct QueueInsertMessage { - /// Optional explicit agent mode. When omitted, the session's current mode is assigned. - #[serde(skip_serializing_if = "Option::is_none")] - pub agent_mode: Option, - /// Optional attachments for the message. - #[serde(skip_serializing_if = "Option::is_none")] - pub attachments: Option>, - /// Whether the message is billable. +pub struct PluginUpdateResult { + /// Version after the update, when reported by the plugin manifest #[serde(skip_serializing_if = "Option::is_none")] - pub billable: Option, - /// Accepted for internal SendOptions compatibility but ignored; delivery is derived from current session activity. + pub new_version: Option, + /// Version that was previously installed, when available #[serde(skip_serializing_if = "Option::is_none")] - pub delivery: Option, - /// Optional user-facing display text. + pub previous_version: Option, + /// Number of skills discovered and installed after the update + pub skills_installed: i64, +} + +/// Serializable definition of a caller-implemented tool whose execution is handled over the SDK connection. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct ProtocolExternalToolDefinition { + /// Tool-loading deferral policy. #[serde(skip_serializing_if = "Option::is_none")] - pub display_prompt: Option, - /// Accepted for SendOptions compatibility but ignored; inserted items always use queued delivery semantics. + pub defer: Option, + /// Model-visible explanation of what the tool does. + pub description: String, + /// Whether the tool executes commands in a terminal. #[serde(skip_serializing_if = "Option::is_none")] - pub mode: Option, - /// Accepted for SendOptions compatibility but ignored; the requested public position controls placement. + pub is_terminal: Option, + /// Optional caller-defined metadata associated with the tool. #[serde(skip_serializing_if = "Option::is_none")] - pub prepend: Option, - /// The user message text. - pub prompt: String, - /// Per-turn request headers. + pub metadata: Option>, + /// Unique model-visible tool name. + pub name: String, + /// Whether this definition replaces a built-in tool with the same name. #[serde(skip_serializing_if = "Option::is_none")] - pub request_headers: Option>, - /// Required tool name for the turn, when any. + pub overrides_built_in_tool: Option, + /// JSON Schema describing the tool's input arguments. #[serde(skip_serializing_if = "Option::is_none")] - pub required_tool: Option, - /// Optional provenance source. `system` is rejected: it would hide the inserted row from `pendingItems` and make it unaddressable while still executing, so inserted items must stay visible. + pub parameters: Option>, + /// Whether execution bypasses the normal tool permission prompt. #[serde(skip_serializing_if = "Option::is_none")] - pub source: Option, - /// Accepted for SendOptions compatibility but ignored; insertion scheduling is controlled by the queue drain state. + pub skip_permission: Option, + /// Optional human-readable display title. #[serde(skip_serializing_if = "Option::is_none")] - pub wait: Option, + pub title: Option, } -/// Parameters for inserting a queued message at a public visible position. +/// A BYOK model definition referencing a named provider. /// ///
/// @@ -12728,14 +12727,35 @@ pub struct QueueInsertMessage { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct QueueInsertAtRequest { - /// Queued message contents and delivery metadata. - pub message: QueueInsertMessage, - /// Zero-based position in the public visible queue. Values outside the queue clamp to an end. - pub position: i64, +pub struct ProviderModelConfig { + /// Optional capability overrides (vision, tool_calls, reasoning, etc.). + #[serde(skip_serializing_if = "Option::is_none")] + pub capabilities: Option, + /// 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`. + pub id: String, + /// Maximum context window tokens for the model. + #[serde(skip_serializing_if = "Option::is_none")] + pub max_context_window_tokens: Option, + /// Maximum output tokens for the model. + #[serde(skip_serializing_if = "Option::is_none")] + pub max_output_tokens: Option, + /// Maximum prompt/input tokens for the model. + #[serde(skip_serializing_if = "Option::is_none")] + pub max_prompt_tokens: Option, + /// Well-known base model id used for behavior/capability/config lookup. Defaults to `id`. + #[serde(skip_serializing_if = "Option::is_none")] + pub model_id: Option, + /// Display name for model pickers. Defaults to the provider-qualified selection id (`provider/id`). + #[serde(skip_serializing_if = "Option::is_none")] + pub name: Option, + /// Name of the configured provider that serves this model. + pub provider: String, + /// The model name sent to the provider API for inference. Defaults to `id`. + #[serde(skip_serializing_if = "Option::is_none")] + pub wire_model: Option, } -/// Result of inserting a queued message. +/// BYOK providers and/or models to add to the session's registry at runtime. Both fields are optional; provide providers, models, or both. /// ///
/// @@ -12745,12 +12765,16 @@ pub struct QueueInsertAtRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct QueueInsertAtResult { - /// Fresh stable opaque id assigned to the inserted item. - pub id: String, +pub struct 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. + #[serde(skip_serializing_if = "Option::is_none")] + pub models: Option>, + /// 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 '/'. + #[serde(skip_serializing_if = "Option::is_none")] + pub providers: Option>, } -/// Parameters for moving a queued item by stable id. +/// The selectable model entries synthesized for the models added by this call. /// ///
/// @@ -12760,14 +12784,12 @@ pub struct QueueInsertAtResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct QueueMoveItemRequest { - /// Stable opaque queued-item id. - pub id: String, - /// Zero-based target position in the public visible queue. Values outside the queue clamp to an end. - pub to_position: i64, +pub struct 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. + pub models: Vec, } -/// Result of moving a queued item. +/// Custom model-provider configuration (BYOK). /// ///
/// @@ -12777,12 +12799,57 @@ pub struct QueueMoveItemRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct QueueMoveItemResult { - /// True when the item changed position; false when it was already at the requested position. - pub changed: bool, +pub struct ProviderConfig { + /// API key. Optional for local providers like Ollama. + #[serde(skip_serializing_if = "Option::is_none")] + pub api_key: Option, + /// Azure-specific provider options. + #[serde(skip_serializing_if = "Option::is_none")] + pub azure: Option, + /// API endpoint URL. + pub base_url: String, + /// Bearer token for authentication. Sets the Authorization header directly. Takes precedence over apiKey when both are set. + #[serde(skip_serializing_if = "Option::is_none")] + pub bearer_token: Option, + /// 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 ` 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. + #[serde(skip_serializing_if = "Option::is_none")] + pub has_bearer_token_provider: Option, + /// Custom HTTP headers to include in all outbound requests to the provider. + #[serde(skip_serializing_if = "Option::is_none")] + pub headers: Option>, + /// Maximum context window tokens for the model. + #[serde(skip_serializing_if = "Option::is_none")] + pub max_context_window_tokens: Option, + /// Maximum output tokens for the model. + #[serde(skip_serializing_if = "Option::is_none")] + pub max_output_tokens: Option, + /// Maximum prompt/input tokens for the model. + #[serde(skip_serializing_if = "Option::is_none")] + pub max_prompt_tokens: Option, + /// Overrides for model capabilities when they cannot be inferred from modelId. + #[serde(skip_serializing_if = "Option::is_none")] + pub model_capabilities: Option, + /// Well-known model ID used for capability lookup. When set, agent behavior config and token limits are inferred from this model. + #[serde(skip_serializing_if = "Option::is_none")] + pub model_id: Option, + /// Provider name used for model and telemetry attribution. + #[serde(skip_serializing_if = "Option::is_none")] + pub provider_name: Option, + /// Provider transport. Defaults to "http". + #[serde(skip_serializing_if = "Option::is_none")] + pub transport: Option, + /// Provider type. Defaults to "openai" for generic OpenAI-compatible APIs. + #[serde(skip_serializing_if = "Option::is_none")] + pub r#type: Option, + /// Wire API format (openai/azure only). Defaults to "completions". + #[serde(skip_serializing_if = "Option::is_none")] + pub wire_api: Option, + /// The model identifier sent to the provider API for inference (the "wire" model), as opposed to modelId which is the well-known base. + #[serde(skip_serializing_if = "Option::is_none")] + pub wire_model: Option, } -/// User-facing pending queue entry, with kind and display text for a queued message, slash command, or model change. +/// 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. /// ///
/// @@ -12792,18 +12859,20 @@ pub struct QueueMoveItemResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct QueuePendingItems { - /// Agent mode stored on this queued entry, as stamped when it was enqueued. Items without an explicit mode report interactive. This is not necessarily the mode that will constrain the turn: a plan or autopilot session applies its own write gate, continuation loop and permission posture to every drained item regardless of the mode stored here. - pub agent_mode: SendAgentMode, - /// Human-readable text to display for this queue entry in the UI - pub display_text: String, - /// Stable opaque id for the canonical queued item. Batch rows share one id. - pub id: String, - /// Whether this item is a queued user message or a queued slash command / model change - pub kind: QueuePendingItemsKind, +pub struct 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`. + #[serde(skip_serializing_if = "Option::is_none")] + pub expires_at: Option, + /// HTTP header name the token must be sent under. + pub header: String, + /// The model the token is bound to, when applicable. When set, the token is only valid for requests against this model. + #[serde(skip_serializing_if = "Option::is_none")] + pub model: Option, + /// The short-lived token value. + pub token: String, } -/// Snapshot of the session's pending queued items and immediate-steering messages. +/// A snapshot of the provider endpoint the session is currently configured to talk to. /// ///
/// @@ -12813,14 +12882,28 @@ pub struct QueuePendingItems { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct QueuePendingItemsResult { - /// Pending queued items in submission order. Includes user messages, queued slash commands, and queued model changes; omits internal system items. - pub items: Vec, - /// Display text for messages currently in the immediate steering queue (interjections sent during a running turn). - pub steering_messages: Vec, +pub struct ProviderEndpoint { + /// A credential the caller should use with this endpoint. Omitted only when the endpoint accepts unauthenticated requests. + #[serde(skip_serializing_if = "Option::is_none")] + pub api_key: Option, + /// Base URL to pass to the LLM client library. + pub base_url: String, + /// HTTP headers the caller must include on every outbound request. + pub headers: HashMap, + /// 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. + #[serde(skip_serializing_if = "Option::is_none")] + pub session_token: Option, + /// Transport to be used for provider requests. + #[serde(skip_serializing_if = "Option::is_none")] + pub transport: Option, + /// Provider family. Matches the `type` field of a BYOK provider config. + pub r#type: ProviderEndpointType, + /// Wire API to be used, when required for the provider type. + #[serde(skip_serializing_if = "Option::is_none")] + pub wire_api: Option, } -/// Parameters for removing a queued item by stable id. +/// Optional model identifier to scope the endpoint snapshot to. /// ///
/// @@ -12830,12 +12913,13 @@ pub struct QueuePendingItemsResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct QueueRemoveAtRequest { - /// Stable opaque ID of the queued item to remove. - pub id: String, +pub struct ProviderGetEndpointRequest { + /// 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. + #[serde(skip_serializing_if = "Option::is_none")] + pub model_id: Option, } -/// Result of removing a queued item. +/// Asks the SDK client to acquire a bearer token for a BYOK provider whose config set `hasBearerTokenProvider: true`. Issued by the runtime before each outbound model request; the runtime does no caching, so this is sent once per request. /// ///
/// @@ -12845,12 +12929,14 @@ pub struct QueueRemoveAtRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct QueueRemoveAtResult { - /// True when the addressed item was removed. - pub removed: bool, +pub struct ProviderTokenAcquireRequest { + /// Target session identifier + pub session_id: SessionId, + /// Name of the BYOK provider needing a token. For the legacy whole-session provider this is the implicit provider name; for named providers it is the configured provider name. + pub provider_name: String, } -/// Indicates whether a user-facing pending item was removed. +/// A bearer token supplied by the SDK client for a BYOK provider. The runtime sets it as `Authorization: Bearer ` on the outbound request and does no caching; the SDK consumer owns token caching and refresh. /// ///
/// @@ -12860,12 +12946,12 @@ pub struct QueueRemoveAtResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct QueueRemoveMostRecentResult { - /// True if a user-facing pending item was removed (LIFO across both queues); false when no removable items remained. - pub removed: bool, +pub struct ProviderTokenAcquireResult { + /// The bearer token value (without the `Bearer ` prefix). + pub token: String, } -/// Parameters for steering a queued message into a live turn. +/// Blob attachment with inline base64-encoded data /// ///
/// @@ -12875,12 +12961,19 @@ pub struct QueueRemoveMostRecentResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct QueueSendNowRequest { - /// Stable opaque ID of the queued item to steer into the live turn. - pub id: String, +pub struct PushAttachmentBlob { + /// Base64-encoded content + pub data: String, + /// User-facing display name for the attachment + #[serde(skip_serializing_if = "Option::is_none")] + pub display_name: Option, + /// MIME type of the inline data + pub mime_type: String, + /// Attachment type discriminator + pub r#type: PushAttachmentBlobType, } -/// Result of trying to steer a queued message into a live turn. +/// Directory attachment /// ///
/// @@ -12890,12 +12983,16 @@ pub struct QueueSendNowRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct QueueSendNowResult { - /// True when the item was accepted into the steering lane; false when no main turn was live. - pub steered: bool, +pub struct PushAttachmentDirectory { + /// User-facing display name for the attachment + pub display_name: String, + /// Absolute directory path + pub path: String, + /// Attachment type discriminator + pub r#type: PushAttachmentDirectoryType, } -/// Parameters for acquiring or releasing the queued-lane drain pause. Acquisition is exclusive and non-idempotent: `paused: true` against an already-paused session fails with `queue_already_paused`. The pause is never released automatically — it is not tied to the caller's lifetime, so a client that exits without sending `paused: false` leaves the lane frozen. Release is unowned: `paused: false` clears the pause for any caller, including one that never acquired it. +/// Optional line range to scope the attachment to a specific section of the file /// ///
/// @@ -12905,12 +13002,14 @@ pub struct QueueSendNowResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct QueueSetDrainPausedRequest { - /// Whether queued-lane draining should be paused. - pub paused: bool, +pub struct PushAttachmentFileLineRange { + /// End line number (1-based, inclusive) + pub end: i64, + /// Start line number (1-based) + pub start: i64, } -/// Internal snapshot of native queue state for local session orchestration. +/// File attachment /// ///
/// @@ -12920,20 +13019,19 @@ pub struct QueueSetDrainPausedRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct QueueSnapshotResult { - /// Insertion orders for queued items, aligned with `items`. - #[serde(skip_serializing_if = "Option::is_none")] - pub item_orders: Option>, - /// User-facing pending items in FIFO order. - pub items: Vec, - /// Insertion orders for immediate steering messages, aligned with `steeringMessages`. +pub struct PushAttachmentFile { + /// User-facing display name for the attachment + pub display_name: String, + /// Optional line range to scope the attachment to a specific section of the file #[serde(skip_serializing_if = "Option::is_none")] - pub steering_message_orders: Option>, - /// Immediate steering messages waiting for an active turn. - pub steering_messages: Vec, + pub line_range: Option, + /// Absolute file path + pub path: String, + /// Attachment type discriminator + pub r#type: PushAttachmentFileType, } -/// Parameters for editing a single queued message. +/// Pointer to a GitHub repository. /// ///
/// @@ -12943,17 +13041,17 @@ pub struct QueueSnapshotResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct QueueUpdateTextRequest { - /// Optional replacement prompt displayed to the user. +pub struct PushGitHubRepoRef { + /// Numeric GitHub repository id #[serde(skip_serializing_if = "Option::is_none")] - pub display_prompt: Option, - /// Stable opaque ID of the queued item to edit. - pub id: String, - /// Replacement prompt sent to the model. - pub prompt: String, + pub id: Option, + /// Repository name (without owner) + pub name: String, + /// Repository owner login (user or organization) + pub owner: String, } -/// Result of editing a queued message. +/// Pointer to a GitHub Actions job. /// ///
/// @@ -12963,12 +13061,25 @@ pub struct QueueUpdateTextRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct QueueUpdateTextResult { - /// True when the stored text changed. - pub updated: bool, +pub struct PushAttachmentGitHubActionsJob { + /// Terminal conclusion of the job when finished (e.g., success, failure, cancelled). Absent for in-progress jobs. + #[serde(skip_serializing_if = "Option::is_none")] + pub conclusion: Option, + /// Job id within the workflow run + pub job_id: i64, + /// Display name of the job + pub job_name: String, + /// Repository the workflow run belongs to + pub repo: PushGitHubRepoRef, + /// Attachment type discriminator + pub r#type: PushAttachmentGitHubActionsJobType, + /// URL to the job on GitHub + pub url: String, + /// Display name of the workflow the job ran in + pub workflow_name: String, } -/// Event type to register consumer interest for, used by runtime gating logic. +/// Pointer to a GitHub commit. /// ///
/// @@ -12978,12 +13089,20 @@ pub struct QueueUpdateTextResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct RegisterEventInterestParams { - /// The event type the consumer wants the runtime to treat as 'observed' for behavior-switching gating. Some runtime code paths inspect whether any consumer is interested in a specific event type and choose a different implementation accordingly (e.g. `mcp.oauth_required`: when interest is registered the runtime delegates interactive OAuth token acquisition to the consumer via `mcp.oauth_required` events; when no interest is registered the runtime still attempts non-interactive reconnect from cached or refreshable tokens, and only marks the server `needs-auth` if usable credentials are unavailable — it does not open a browser or start interactive OAuth without a consumer). SDK clients that long-poll events do NOT automatically appear as listeners to these gating checks — they must explicitly call `registerInterest` for each event type they want the runtime to count as having a consumer. Multiple registrations for the same event type from the same or different consumers are tracked independently and must each be released. See: `mcp.oauth_required`, `sampling.requested`, `auto_mode_switch.requested`, `session_limits_exhausted.requested`, `user_input.requested`, `elicitation.requested`, `command.queued`, `exit_plan_mode.requested`. - pub event_type: String, +pub struct PushAttachmentGitHubCommit { + /// First line of the commit message + pub message: String, + /// Full commit SHA + pub oid: String, + /// Repository the commit belongs to + pub repo: PushGitHubRepoRef, + /// Attachment type discriminator + pub r#type: PushAttachmentGitHubCommitType, + /// URL to the commit on GitHub + pub url: String, } -/// Opaque handle representing an event-type interest registration. +/// Pointer to a file in a GitHub repository at a specific ref. /// ///
/// @@ -12993,12 +13112,20 @@ pub struct RegisterEventInterestParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct RegisterEventInterestResult { - /// Opaque handle for this registration. Pass to releaseInterest to release. Each call to registerInterest produces a fresh handle, even when the same eventType is registered multiple times. - pub handle: String, +pub struct PushAttachmentGitHubFile { + /// Repository-relative path to the file + pub path: String, + /// Git ref the file is read at (branch, tag, or commit SHA) + pub r#ref: String, + /// Repository the file lives in + pub repo: PushGitHubRepoRef, + /// Attachment type discriminator + pub r#type: PushAttachmentGitHubFileType, + /// URL to the file on GitHub + pub url: String, } -/// Optional registration options. +/// One side of a file diff (head or base) /// ///
/// @@ -13008,14 +13135,16 @@ pub struct RegisterEventInterestResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionsRegisterExtensionToolsOnSessionOptions { - /// In-process `() => boolean` gating callback (CLI-only optimization). Marked internal: replaced by runtime-side enable/disable RPCs in the SDK migration. - #[doc(hidden)] - #[serde(skip_serializing_if = "Option::is_none")] - pub(crate) enabled: Option, +pub struct PushAttachmentGitHubFileDiffSide { + /// Repository-relative path to the file + pub path: String, + /// Git ref (branch, tag, or commit SHA) the file is read at + pub r#ref: String, + /// Repository the file lives in + pub repo: PushGitHubRepoRef, } -/// Params to attach an extension loader's tools to a session. +/// Pointer to a single-file diff. At least one of `head` and `base` must be present. /// ///
/// @@ -13025,18 +13154,20 @@ pub struct SessionsRegisterExtensionToolsOnSessionOptions { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub(crate) struct RegisterExtensionToolsParams { - /// In-process ExtensionLoader handle (CLI-only optimization). Marked internal: this field is excluded from the public SDK surface. When the CLI migrates to a process-separated SDK, extension discovery/launch moves entirely into the runtime — the CLI passes pure config (search paths, disabled ids) via SessionOptions instead. - #[doc(hidden)] - pub(crate) loader: serde_json::Value, - /// Optional registration options. +pub struct PushAttachmentGitHubFileDiff { + /// File location on the base side of the diff. Absent for additions. #[serde(skip_serializing_if = "Option::is_none")] - pub options: Option, - /// Session to register extension tools on. - pub session_id: SessionId, + pub base: Option, + /// File location on the head side of the diff. Absent for deletions. + #[serde(skip_serializing_if = "Option::is_none")] + pub head: Option, + /// Attachment type discriminator + pub r#type: PushAttachmentGitHubFileDiffType, + /// URL to the diff on GitHub (e.g., a commit, compare, or PR-file URL) + pub url: String, } -/// Handle for releasing the extension tool registration. +/// GitHub issue, pull request, or discussion reference /// ///
/// @@ -13046,13 +13177,22 @@ pub(crate) struct RegisterExtensionToolsParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub(crate) struct RegisterExtensionToolsResult { - /// In-process unsubscribe function (CLI-only optimization). Marked internal: replaced by an explicit `extensions.unregister` RPC in the SDK migration. - #[doc(hidden)] - pub(crate) unsubscribe: serde_json::Value, +pub struct PushAttachmentGitHubReference { + /// Issue, pull request, or discussion number + pub number: i64, + /// Type of GitHub reference + pub reference_type: PushAttachmentGitHubReferenceType, + /// Current state of the referenced item (e.g., open, closed, merged) + pub state: String, + /// Title of the referenced item + pub title: String, + /// Attachment type discriminator + pub r#type: PushAttachmentGitHubReferenceType, + /// URL to the referenced item on GitHub + pub url: String, } -/// Opaque handle previously returned by `registerInterest` to release. +/// Pointer to a GitHub release. /// ///
/// @@ -13062,29 +13202,45 @@ pub(crate) struct RegisterExtensionToolsResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ReleaseEventInterestParams { - /// Handle returned by a previous `registerInterest` call. Idempotent: releasing an unknown or already-released handle is a no-op (returns success). When the last outstanding handle for an event type is released, the runtime reverts to its 'no consumer' code path for that event type. - pub handle: String, -} - -/// Reattach to an existing MC session without creating a new one. -/// -///
-/// +pub struct PushAttachmentGitHubRelease { + /// Human-readable release name + pub name: String, + /// Repository the release belongs to + pub repo: PushGitHubRepoRef, + /// Git tag the release is anchored to + pub tag_name: String, + /// Attachment type discriminator + pub r#type: PushAttachmentGitHubReleaseType, + /// URL to the release on GitHub + pub url: String, +} + +/// Pointer to a GitHub repository. +/// +///
+/// /// **Experimental.** This type is part of an experimental wire-protocol surface /// and may change or be removed in future SDK or CLI releases. /// ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct RemoteControlConfigExistingMcSession { - /// Existing MC session ID to reattach to. - pub mc_session_id: String, - /// Existing MC task ID for the reattached session. - pub mc_task_id: String, +pub struct PushAttachmentGitHubRepository { + /// Short description of the repository + #[serde(skip_serializing_if = "Option::is_none")] + pub description: Option, + /// Git ref this attachment is anchored at (branch, tag, or commit). When absent the default branch is implied. + #[serde(skip_serializing_if = "Option::is_none")] + pub r#ref: Option, + /// Repository pointer + pub repo: PushGitHubRepoRef, + /// Attachment type discriminator + pub r#type: PushAttachmentGitHubRepositoryType, + /// URL to the repository on GitHub + pub url: String, } -/// Configuration for the runtime-managed remote-control singleton. +/// Pointer to a line range inside a file in a GitHub repository. /// ///
/// @@ -13094,24 +13250,22 @@ pub struct RemoteControlConfigExistingMcSession { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct RemoteControlConfig { - /// Reattach to an existing MC session without creating a new one. - #[serde(skip_serializing_if = "Option::is_none")] - pub existing_mc_session: Option, - /// Whether the user explicitly requested remote (vs. implicit session-sync). Controls warning surfacing for missing-repo cases. - pub explicit: bool, - /// Whether remote export should be enabled. - pub remote: bool, - /// When true, suppresses timeline messages on successful setup. - pub silent: bool, - /// Whether the MC session may steer the local session (write mode). - pub steerable: bool, - /// Existing Mission Control task ID to attach the exported session to. - #[serde(skip_serializing_if = "Option::is_none")] - pub task_id: Option, +pub struct PushAttachmentGitHubSnippet { + /// Line range the snippet covers + pub line_range: PushAttachmentFileLineRange, + /// Repository-relative path to the file + pub path: String, + /// Git ref the file is read at (branch, tag, or commit SHA) + pub r#ref: String, + /// Repository the file lives in + pub repo: PushGitHubRepoRef, + /// Attachment type discriminator + pub r#type: PushAttachmentGitHubSnippetType, + /// URL to the snippet on GitHub (with line anchor) + pub url: String, } -/// Remote control is connected to a local session. +/// One side of a tree comparison (head or base) /// ///
/// @@ -13121,27 +13275,14 @@ pub struct RemoteControlConfig { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct RemoteControlStatusActive { - /// Session id remote control is pointed at. - pub attached_session_id: String, - /// 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. - #[doc(hidden)] - #[serde(skip_serializing_if = "Option::is_none")] - pub(crate) awaiting_first_message: Option, - /// MC frontend URL for this session, when known. - #[serde(skip_serializing_if = "Option::is_none")] - pub frontend_url: Option, - /// Whether the MC session may steer this session. - pub is_steerable: bool, - /// In-process prompt-manager handle (CLI-only optimization). Marked internal: this field is excluded from the public SDK surface. Retained as an optional compatibility field; native remote control does not populate or consume it. - #[doc(hidden)] - #[serde(skip_serializing_if = "Option::is_none")] - pub(crate) prompt_manager: Option, - /// Remote control state tag: active. - pub state: RemoteControlStatusActiveState, +pub struct PushAttachmentGitHubTreeComparisonSide { + /// Repository the revision belongs to + pub repo: PushGitHubRepoRef, + /// Git revision (branch, tag, or commit SHA) + pub revision: String, } -/// Remote control is in the middle of initial setup. +/// Pointer to a comparison between two git revisions. /// ///
/// @@ -13151,14 +13292,18 @@ pub struct RemoteControlStatusActive { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct RemoteControlStatusConnecting { - /// Session id the connection is attaching to. - pub attached_session_id: String, - /// Remote control state tag: connecting. - pub state: RemoteControlStatusConnectingState, +pub struct PushAttachmentGitHubTreeComparison { + /// Base side of the comparison + pub base: PushAttachmentGitHubTreeComparisonSide, + /// Head side of the comparison + pub head: PushAttachmentGitHubTreeComparisonSide, + /// Attachment type discriminator + pub r#type: PushAttachmentGitHubTreeComparisonType, + /// URL to the comparison on GitHub + pub url: String, } -/// The last setup attempt failed. The singleton is otherwise off. +/// Generic GitHub URL reference. /// ///
/// @@ -13168,17 +13313,14 @@ pub struct RemoteControlStatusConnecting { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct RemoteControlStatusError { - /// Session id the failing setup attempt targeted, when known. - #[serde(skip_serializing_if = "Option::is_none")] - pub attached_session_id: Option, - /// Human-readable error message from the last setup attempt. - pub error: String, - /// Remote control state tag: setup failed. - pub state: RemoteControlStatusErrorState, +pub struct PushAttachmentGitHubUrl { + /// Attachment type discriminator + pub r#type: PushAttachmentGitHubUrlType, + /// URL to the GitHub resource + pub url: String, } -/// Remote control is not connected. +/// End position of the selection /// ///
/// @@ -13188,12 +13330,14 @@ pub struct RemoteControlStatusError { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct RemoteControlStatusOff { - /// Remote control state tag: not connected. - pub state: RemoteControlStatusOffState, +pub struct PushAttachmentSelectionDetailsEnd { + /// End character offset within the line (0-based) + pub character: i64, + /// End line number (0-based) + pub line: i64, } -/// Wrapper for the singleton's current status. +/// Start position of the selection /// ///
/// @@ -13203,12 +13347,14 @@ pub struct RemoteControlStatusOff { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct RemoteControlStatusResult { - /// State of the runtime-managed remote-control singleton. - pub status: serde_json::Value, +pub struct PushAttachmentSelectionDetailsStart { + /// Start character offset within the line (0-based) + pub character: i64, + /// Start line number (0-based) + pub line: i64, } -/// Outcome of a stopRemoteControl call. +/// Position range of the selection within the file /// ///
/// @@ -13218,14 +13364,14 @@ pub struct RemoteControlStatusResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct RemoteControlStopResult { - /// State of the runtime-managed remote-control singleton. - pub status: serde_json::Value, - /// Whether the singleton was actually torn down by this call. - pub stopped: bool, +pub struct PushAttachmentSelectionDetails { + /// End position of the selection + pub end: PushAttachmentSelectionDetailsEnd, + /// Start position of the selection + pub start: PushAttachmentSelectionDetailsStart, } -/// Outcome of a transferRemoteControl call. +/// Code selection attachment from an editor /// ///
/// @@ -13235,14 +13381,20 @@ pub struct RemoteControlStopResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct RemoteControlTransferResult { - /// State of the runtime-managed remote-control singleton. - pub status: serde_json::Value, - /// Whether the rebinding actually happened. - pub transferred: bool, +pub struct PushAttachmentSelection { + /// User-facing display name for the selection + pub display_name: String, + /// Absolute path to the file containing the selection + pub file_path: String, + /// Position range of the selection within the file + pub selection: PushAttachmentSelectionDetails, + /// The selected text content + pub text: String, + /// Attachment type discriminator + pub r#type: PushAttachmentSelectionType, } -/// Optional remote session mode ("off", "export", or "on"); defaults to enabling both export and remote steering. +/// Inputs for starting a deferred-idle drain. /// ///
/// @@ -13252,13 +13404,12 @@ pub struct RemoteControlTransferResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct RemoteEnableRequest { - /// Per-session remote mode. "off" disables remote, "export" exports session events to GitHub without enabling remote steering, "on" enables both export and remote steering. - #[serde(skip_serializing_if = "Option::is_none")] - pub mode: Option, +pub struct QueueBeginDeferredIdleDrainRequest { + /// Whether the host still has active background work. + pub active_background_work: bool, } -/// GitHub URL for the session and a flag indicating whether remote steering is enabled. +/// Whether a deferred-idle drain should run. /// ///
/// @@ -13268,15 +13419,12 @@ pub struct RemoteEnableRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct RemoteEnableResult { - /// Whether remote steering is enabled - pub remote_steerable: bool, - /// GitHub frontend URL for this session - #[serde(skip_serializing_if = "Option::is_none")] - pub url: Option, +pub struct QueueBeginDeferredIdleDrainResult { + /// True when the host should run finishDeferredIdleDrain asynchronously. + pub should_drain: bool, } -/// New remote-steerability state to persist as a `session.remote_steerable_changed` event. +/// Internal filter for consuming queued system notifications. /// ///
/// @@ -13286,12 +13434,12 @@ pub struct RemoteEnableResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct RemoteNotifySteerableChangedRequest { - /// Whether the session now supports remote steering via GitHub. The runtime persists this as a `session.remote_steerable_changed` event so resume/replay sees the up-to-date capability. - pub remote_steerable: bool, +pub struct QueueConsumeSystemNotificationsRequest { + /// Opaque runtime-owned filter object. + pub filter: serde_json::Value, } -/// Persist a steerability change as a `session.remote_steerable_changed` event. Used by the host (CLI / SDK consumer) when it has just finished enabling or disabling steering on a remote exporter that the runtime does not directly own. +/// Queued-command response indicating the host executed the command, with an optional flag to stop queue processing. /// ///
/// @@ -13301,9 +13449,15 @@ pub struct RemoteNotifySteerableChangedRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct RemoteNotifySteerableChangedResult {} +pub struct QueuedCommandHandled { + /// The host actually executed the queued command. + pub handled: bool, + /// When true, the runtime will not process subsequent queued commands until a new request comes in. + #[serde(skip_serializing_if = "Option::is_none")] + pub stop_processing_queue: Option, +} -/// Remote session connection result. +/// Queued-command response indicating the host did not execute the command and the queue may continue. /// ///
/// @@ -13313,14 +13467,12 @@ pub struct RemoteNotifySteerableChangedResult {} ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct RemoteSessionConnectionResult { - /// Metadata for a connected remote session. - pub metadata: ConnectedRemoteSessionMetadata, - /// SDK session ID for the connected remote session. - pub session_id: SessionId, +pub struct QueuedCommandNotHandled { + /// The host did not execute the queued command. Unblocks the queue without claiming the command was processed (e.g. when the handler threw before completing). + pub handled: bool, } -/// GitHub repository the remote session belongs to. +/// Inputs for marking session.idle deferred in native state. /// ///
/// @@ -13330,16 +13482,12 @@ pub struct RemoteSessionConnectionResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct RemoteSessionMetadataRepository { - /// Branch associated with the remote session. - pub branch: String, - /// Repository name. - pub name: String, - /// Repository owner. - pub owner: String, +pub struct QueueDeferSessionIdleRequest { + /// Whether the deferred idle was caused by an aborted foreground turn. + pub aborted: bool, } -/// Remote session metadata for the session to hand off (typically obtained from `sessions.list` with `source: "remote"`). +/// Parameters for duplicating a queued item. /// ///
/// @@ -13349,52 +13497,12 @@ pub struct RemoteSessionMetadataRepository { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct RemoteSessionMetadataValue { - /// Most recent working directory context. - #[serde(skip_serializing_if = "Option::is_none")] - pub context: Option, - /// 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. - #[serde(skip_serializing_if = "Option::is_none")] - pub host_activity: Option, - /// 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. - #[serde(skip_serializing_if = "Option::is_none")] - pub host_status: Option, - /// Always true for remote sessions. - pub is_remote: bool, - /// Last-modified time as an ISO 8601 timestamp. - pub modified_time: String, - /// Optional human-friendly name set via /rename. - #[serde(skip_serializing_if = "Option::is_none")] - pub name: Option, - /// Pull request number associated with the session. - #[serde(skip_serializing_if = "Option::is_none")] - pub pull_request_number: Option, - /// Backing remote session IDs (most recent first). - pub remote_session_ids: Vec, - /// GitHub repository the remote session belongs to. - pub repository: RemoteSessionMetadataRepository, - /// Original remote resource identifier (task ID or PR node ID). - #[serde(skip_serializing_if = "Option::is_none")] - pub resource_id: Option, - /// Stable session identifier. - pub session_id: SessionId, - /// Deadline (ISO 8601) at which a CLI remote session becomes stale without further heartbeats. - #[serde(skip_serializing_if = "Option::is_none")] - pub stale_at: Option, - /// Session creation time as an ISO 8601 timestamp. - pub start_time: String, - /// Server-side task state returned by GitHub. - #[serde(skip_serializing_if = "Option::is_none")] - pub state: Option, - /// Short summary of the session, when one has been derived. - #[serde(skip_serializing_if = "Option::is_none")] - pub summary: Option, - /// Whether the remote task originated from CCA or CLI `--remote`. - #[serde(skip_serializing_if = "Option::is_none")] - pub task_type: Option, +pub struct QueueDuplicateAtRequest { + /// Stable opaque ID of the queued item to duplicate. + pub id: String, } -/// Repository context for the remote session. +/// Result of duplicating a queued item. /// ///
/// @@ -13404,17 +13512,12 @@ pub struct RemoteSessionMetadataValue { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct RemoteSessionRepository { - /// Optional branch associated with the remote session. - #[serde(skip_serializing_if = "Option::is_none")] - pub branch: Option, - /// Repository name. - pub name: String, - /// Repository owner or organization login. - pub owner: String, +pub struct QueueDuplicateAtResult { + /// Fresh stable opaque id assigned to the duplicate. + pub id: String, } -/// 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. +/// Result of enqueueing the resume-pending wake item. /// ///
/// @@ -13424,16 +13527,12 @@ pub struct RemoteSessionRepository { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct 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). - #[serde(skip_serializing_if = "Option::is_none")] - pub gh: Option, - /// Whether to inject git credentials as an `http..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). - #[serde(skip_serializing_if = "Option::is_none")] - pub git: Option, +pub struct QueueEnqueueResumePendingResult { + /// True when a wake item was newly queued. + pub queued: bool, } -/// macOS seatbelt experimental options. +/// Inputs for completing a deferred-idle drain. /// ///
/// @@ -13443,13 +13542,14 @@ pub struct SandboxConfigAuth { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SandboxConfigUserPolicyExperimentalSeatbelt { - /// Whether the macOS seatbelt profile may access the keychain. - #[serde(skip_serializing_if = "Option::is_none")] - pub keychain_access: Option, +pub struct QueueFinishDeferredIdleDrainRequest { + /// Whether the host still has active background work. + pub active_background_work: bool, + /// Whether native queued work remains. + pub has_pending: bool, } -/// Platform-specific experimental policy fields. +/// Action selected by the native deferred-idle drain. /// ///
/// @@ -13459,13 +13559,14 @@ pub struct SandboxConfigUserPolicyExperimentalSeatbelt { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SandboxConfigUserPolicyExperimental { - /// macOS seatbelt experimental options. - #[serde(skip_serializing_if = "Option::is_none")] - pub seatbelt: Option, +pub struct QueueFinishDeferredIdleDrainResult { + /// Whether the deferred idle was caused by an aborted foreground turn. + pub aborted: bool, + /// One of none, processQueue, or emitSessionIdle. + pub action: String, } -/// Filesystem rules to merge into the base policy. +/// Whether the native queue has pending work. /// ///
/// @@ -13475,22 +13576,12 @@ pub struct SandboxConfigUserPolicyExperimental { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SandboxConfigUserPolicyFilesystem { - /// Whether to clear the policy when the session exits. - #[serde(skip_serializing_if = "Option::is_none")] - pub clear_policy_on_exit: Option, - /// Paths explicitly denied. - #[serde(skip_serializing_if = "Option::is_none")] - pub denied_paths: Option>, - /// Paths granted read-only access. - #[serde(skip_serializing_if = "Option::is_none")] - pub readonly_paths: Option>, - /// Paths granted read/write access. - #[serde(skip_serializing_if = "Option::is_none")] - pub readwrite_paths: Option>, +pub struct QueueHasPendingResult { + /// True when queued or immediate native work is pending. + pub has_pending: bool, } -/// HTTP proxy configuration for sandboxed traffic. +/// Serializable message fields accepted by queue.insertAt. /// ///
/// @@ -13500,18 +13591,45 @@ pub struct SandboxConfigUserPolicyFilesystem { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct 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. +pub struct QueueInsertMessage { + /// Optional explicit agent mode. When omitted, the session's current mode is assigned. #[serde(skip_serializing_if = "Option::is_none")] - pub password: Option, - /// Proxy URL (e.g. http://proxy.example.com:8080). The port is optional and defaults to the scheme's standard port when omitted. 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 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. - pub url: String, - /// Optional username for proxy authentication. Combined with the URL (and `password`) into `user:pass@host` when the sandboxed process routes through the proxy. + pub agent_mode: Option, + /// Optional attachments for the message. #[serde(skip_serializing_if = "Option::is_none")] - pub username: Option, + pub attachments: Option>, + /// Whether the message is billable. + #[serde(skip_serializing_if = "Option::is_none")] + pub billable: Option, + /// Accepted for internal SendOptions compatibility but ignored; delivery is derived from current session activity. + #[serde(skip_serializing_if = "Option::is_none")] + pub delivery: Option, + /// Optional user-facing display text. + #[serde(skip_serializing_if = "Option::is_none")] + pub display_prompt: Option, + /// Accepted for SendOptions compatibility but ignored; inserted items always use queued delivery semantics. + #[serde(skip_serializing_if = "Option::is_none")] + pub mode: Option, + /// Accepted for SendOptions compatibility but ignored; the requested public position controls placement. + #[serde(skip_serializing_if = "Option::is_none")] + pub prepend: Option, + /// The user message text. + pub prompt: String, + /// Per-turn request headers. + #[serde(skip_serializing_if = "Option::is_none")] + pub request_headers: Option>, + /// Required tool name for the turn, when any. + #[serde(skip_serializing_if = "Option::is_none")] + pub required_tool: Option, + /// Optional provenance source. `system` is rejected: it would hide the inserted row from `pendingItems` and make it unaddressable while still executing, so inserted items must stay visible. + #[serde(skip_serializing_if = "Option::is_none")] + pub source: Option, + /// Accepted for SendOptions compatibility but ignored; insertion scheduling is controlled by the queue drain state. + #[serde(skip_serializing_if = "Option::is_none")] + pub wait: Option, } -/// Network rules to merge into the base policy. +/// Parameters for inserting a queued message at a public visible position. /// ///
/// @@ -13521,19 +13639,14 @@ pub struct SandboxConfigUserPolicyNetworkProxy { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SandboxConfigUserPolicyNetwork { - /// Whether traffic to local/loopback addresses is allowed. - #[serde(skip_serializing_if = "Option::is_none")] - pub allow_local_network: Option, - /// Whether outbound network traffic is allowed at all. - #[serde(skip_serializing_if = "Option::is_none")] - pub allow_outbound: Option, - /// HTTP proxy the sandboxed process routes traffic through. Enforced on Windows and cooperative (honored by well-behaved tools, not strictly enforced) on Linux and macOS. Credentials go in the separate `username`/`password` fields. A credential-free http:// loopback proxy URL is routed through the localhost proxy automatically; an https:// or authenticated loopback URL is used as-is. - #[serde(skip_serializing_if = "Option::is_none")] - pub proxy: Option, +pub struct QueueInsertAtRequest { + /// Queued message contents and delivery metadata. + pub message: QueueInsertMessage, + /// Zero-based position in the public visible queue. Values outside the queue clamp to an end. + pub position: i64, } -/// macOS seatbelt-specific options. +/// Result of inserting a queued message. /// ///
/// @@ -13543,13 +13656,12 @@ pub struct SandboxConfigUserPolicyNetwork { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SandboxConfigUserPolicySeatbelt { - /// Whether the macOS seatbelt profile may access the keychain. - #[serde(skip_serializing_if = "Option::is_none")] - pub keychain_access: Option, +pub struct QueueInsertAtResult { + /// Fresh stable opaque id assigned to the inserted item. + pub id: String, } -/// User-managed sandbox policy fragment merged into the auto-discovered base policy. +/// Parameters for moving a queued item by stable id. /// ///
/// @@ -13559,22 +13671,14 @@ pub struct SandboxConfigUserPolicySeatbelt { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SandboxConfigUserPolicy { - /// Deprecated legacy location for `seatbelt`; read only when the top-level `seatbelt` is absent. - #[serde(skip_serializing_if = "Option::is_none")] - pub experimental: Option, - /// Filesystem rules to merge into the base policy. - #[serde(skip_serializing_if = "Option::is_none")] - pub filesystem: Option, - /// Network rules to merge into the base policy. - #[serde(skip_serializing_if = "Option::is_none")] - pub network: Option, - /// macOS seatbelt options to merge into the base policy. - #[serde(skip_serializing_if = "Option::is_none")] - pub seatbelt: Option, +pub struct QueueMoveItemRequest { + /// Stable opaque queued-item id. + pub id: String, + /// Zero-based target position in the public visible queue. Values outside the queue clamp to an end. + pub to_position: i64, } -/// Resolved sandbox configuration. +/// Result of moving a queued item. /// ///
/// @@ -13584,24 +13688,12 @@ pub struct SandboxConfigUserPolicy { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SandboxConfig { - /// Whether to auto-add the current working directory to readwritePaths. Default: true. - #[serde(skip_serializing_if = "Option::is_none")] - pub add_current_working_directory: Option, - /// Whether to auto-grant read access to the tool directories discovered on PATH and in toolchain environment variables (GOROOT, CARGO_HOME, JAVA_HOME, VIRTUAL_ENV, and similar), and to common developer-tool caches, registries, and toolchains in their default home locations (cargo, go, npm, Maven, and more), plus read-write access to (and, on Unix, up-front creation of) the scratch caches builds write on every run (go-build, ccache, sccache, Gradle caches, Cargo lock/tracker files), so builds work without extra configuration; a relocated CARGO_HOME additionally gets its Cargo lock files granted read-write. Set to false to disable every grant listed above: user-installed toolchains (rustup, nvm, pyenv, conda, pipx) then need explicit userPolicy.filesystem entries — readonlyPaths to read them, plus readwriteFiles for a relocated CARGO_HOME's .package-cache and .global-cache, which Cargo locks on every build. Only these developer-tool grants are affected: the working directory (see addCurrentWorkingDirectory), temporary storage, session log paths, and system locations follow their own rules and stay granted, so commands still run. Default: true (enabled by default; set to false to opt out). - #[serde(skip_serializing_if = "Option::is_none")] - pub allow_dev_tool_access: Option, - /// Credential-injection capability flags. - #[serde(skip_serializing_if = "Option::is_none")] - pub auth: Option, - /// Whether sandboxing is enabled for the session. - pub enabled: bool, - /// User-managed sandbox policy fragment merged into the auto-discovered base policy. - #[serde(skip_serializing_if = "Option::is_none")] - pub user_policy: Option, +pub struct QueueMoveItemResult { + /// True when the item changed position; false when it was already at the requested position. + pub changed: bool, } -/// Register an absolute-time scheduled prompt. +/// User-facing pending queue entry, with kind and display text for a queued message, slash command, or model change. /// ///
/// @@ -13611,20 +13703,18 @@ pub struct SandboxConfig { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ScheduleAddAtRequest { - /// Epoch milliseconds when the prompt should fire. - pub at: i64, - /// Optional display-only prompt label. - #[serde(skip_serializing_if = "Option::is_none")] - pub display_prompt: Option, - /// Prompt text to enqueue when the schedule fires. - pub prompt: String, - /// Whether the schedule should re-arm after each tick. Defaults to false. - #[serde(skip_serializing_if = "Option::is_none")] - pub recurring: Option, +pub struct QueuePendingItems { + /// Agent mode stored on this queued entry, as stamped when it was enqueued. Items without an explicit mode report interactive. This is not necessarily the mode that will constrain the turn: a plan or autopilot session applies its own write gate, continuation loop and permission posture to every drained item regardless of the mode stored here. + pub agent_mode: SendAgentMode, + /// Human-readable text to display for this queue entry in the UI + pub display_text: String, + /// Stable opaque id for the canonical queued item. Batch rows share one id. + pub id: String, + /// Whether this item is a queued user message or a queued slash command / model change + pub kind: QueuePendingItemsKind, } -/// Register a cron scheduled prompt. +/// Snapshot of the session's pending queued items and immediate-steering messages. /// ///
/// @@ -13634,23 +13724,14 @@ pub struct ScheduleAddAtRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ScheduleAddCronRequest { - /// 5-field cron expression. - pub cron: String, - /// Optional display-only prompt label. - #[serde(skip_serializing_if = "Option::is_none")] - pub display_prompt: Option, - /// Prompt text to enqueue when the schedule fires. - pub prompt: String, - /// Whether the schedule should re-arm after each tick. Defaults to true. - #[serde(skip_serializing_if = "Option::is_none")] - pub recurring: Option, - /// IANA timezone for evaluating the cron expression. - #[serde(skip_serializing_if = "Option::is_none")] - pub tz: Option, +pub struct QueuePendingItemsResult { + /// Pending queued items in submission order. Includes user messages, queued slash commands, and queued model changes; omits internal system items. + pub items: Vec, + /// Display text for messages currently in the immediate steering queue (interjections sent during a running turn). + pub steering_messages: Vec, } -/// Register a relative-interval scheduled prompt. +/// Parameters for removing a queued item by stable id. /// ///
/// @@ -13660,20 +13741,12 @@ pub struct ScheduleAddCronRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ScheduleAddRequest { - /// Optional display-only prompt label. - #[serde(skip_serializing_if = "Option::is_none")] - pub display_prompt: Option, - /// Human-readable interval such as `30s`, `5m`, or `2h`. - pub interval: String, - /// Prompt text to enqueue when the schedule fires. - pub prompt: String, - /// Whether the schedule should re-arm after each tick. Defaults to true. - #[serde(skip_serializing_if = "Option::is_none")] - pub recurring: Option, +pub struct QueueRemoveAtRequest { + /// Stable opaque ID of the queued item to remove. + pub id: String, } -/// Scheduled prompt entry with ID, timing (`intervalMs`, `cron`, or `at`), prompt text, recurrence, and next run time. +/// Result of removing a queued item. /// ///
/// @@ -13683,36 +13756,12 @@ pub struct ScheduleAddRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ScheduleEntry { - /// Absolute fire time (epoch milliseconds) for a one-shot calendar schedule. - #[serde(skip_serializing_if = "Option::is_none")] - pub at: Option, - /// 5-field cron expression for a recurring calendar schedule, evaluated in `tz`. - #[serde(skip_serializing_if = "Option::is_none")] - pub cron: Option, - /// Display-only label for the prompt as shown in the UI (e.g. `/skill-name` for a skill-invocation schedule). The actual enqueued prompt is `prompt`. - #[serde(skip_serializing_if = "Option::is_none")] - pub display_prompt: Option, - /// Sequential id assigned by the runtime within the session. Stable across resumes (rebuilt from the event log). - pub id: i64, - /// Interval between scheduled ticks, in milliseconds (relative-interval schedules). - #[serde(skip_serializing_if = "Option::is_none")] - pub interval_ms: Option, - /// ISO 8601 timestamp when the next tick is scheduled to fire. - pub next_run_at: String, - /// Prompt text that gets enqueued on every tick. - pub prompt: String, - /// Whether the schedule re-arms after each tick (`/every`) or fires once (`/after`). - pub recurring: bool, - /// True for a self-paced (`dynamic`) schedule: no fixed cadence; the model arms each next run via the `manage_schedule` `wakeup` action. `nextRunAt` is model-controlled. - #[serde(skip_serializing_if = "Option::is_none")] - pub self_paced: Option, - /// IANA timezone the `cron` expression is evaluated in. - #[serde(skip_serializing_if = "Option::is_none")] - pub tz: Option, +pub struct QueueRemoveAtResult { + /// True when the addressed item was removed. + pub removed: bool, } -/// Result of registering or re-arming a scheduled prompt. +/// Indicates whether a user-facing pending item was removed. /// ///
/// @@ -13722,16 +13771,12 @@ pub struct ScheduleEntry { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ScheduleAddResult { - /// The registered or updated schedule entry. - #[serde(skip_serializing_if = "Option::is_none")] - pub entry: Option, - /// User-facing validation error, when registration failed. - #[serde(skip_serializing_if = "Option::is_none")] - pub error: Option, +pub struct QueueRemoveMostRecentResult { + /// True if a user-facing pending item was removed (LIFO across both queues); false when no removable items remained. + pub removed: bool, } -/// Register a self-paced scheduled prompt. +/// Parameters for steering a queued message into a live turn. /// ///
/// @@ -13741,15 +13786,12 @@ pub struct ScheduleAddResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ScheduleAddSelfPacedRequest { - /// Optional display-only prompt label. - #[serde(skip_serializing_if = "Option::is_none")] - pub display_prompt: Option, - /// Prompt text to enqueue when the schedule fires. - pub prompt: String, +pub struct QueueSendNowRequest { + /// Stable opaque ID of the queued item to steer into the live turn. + pub id: String, } -/// Whether the session currently has an active self-paced schedule. +/// Result of trying to steer a queued message into a live turn. /// ///
/// @@ -13759,12 +13801,12 @@ pub struct ScheduleAddSelfPacedRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ScheduleHasSelfPacedResult { - /// True when at least one active schedule is self-paced. - pub has_self_paced: bool, +pub struct QueueSendNowResult { + /// True when the item was accepted into the steering lane; false when no main turn was live. + pub steered: bool, } -/// Snapshot of the currently active recurring prompts for this session. +/// Parameters for acquiring or releasing the queued-lane drain pause. Acquisition is exclusive and non-idempotent: `paused: true` against an already-paused session fails with `queue_already_paused`. The pause is never released automatically — it is not tied to the caller's lifetime, so a client that exits without sending `paused: false` leaves the lane frozen. Release is unowned: `paused: false` clears the pause for any caller, including one that never acquired it. /// ///
/// @@ -13774,12 +13816,12 @@ pub struct ScheduleHasSelfPacedResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ScheduleList { - /// Active scheduled prompts, ordered by id. - pub entries: Vec, +pub struct QueueSetDrainPausedRequest { + /// Whether queued-lane draining should be paused. + pub paused: bool, } -/// Re-arm a self-paced scheduled prompt. +/// Internal snapshot of native queue state for local session orchestration. /// ///
/// @@ -13789,14 +13831,20 @@ pub struct ScheduleList { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ScheduleRearmSelfPacedRequest { - /// Epoch milliseconds when the prompt should next fire. - pub at: i64, - /// Id of the self-paced scheduled prompt. - pub id: i64, +pub struct QueueSnapshotResult { + /// Insertion orders for queued items, aligned with `items`. + #[serde(skip_serializing_if = "Option::is_none")] + pub item_orders: Option>, + /// User-facing pending items in FIFO order. + pub items: Vec, + /// Insertion orders for immediate steering messages, aligned with `steeringMessages`. + #[serde(skip_serializing_if = "Option::is_none")] + pub steering_message_orders: Option>, + /// Immediate steering messages waiting for an active turn. + pub steering_messages: Vec, } -/// Identifier of the scheduled prompt to remove. +/// Parameters for editing a single queued message. /// ///
/// @@ -13806,12 +13854,17 @@ pub struct ScheduleRearmSelfPacedRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ScheduleStopRequest { - /// Id of the scheduled prompt to remove. - pub id: i64, +pub struct QueueUpdateTextRequest { + /// Optional replacement prompt displayed to the user. + #[serde(skip_serializing_if = "Option::is_none")] + pub display_prompt: Option, + /// Stable opaque ID of the queued item to edit. + pub id: String, + /// Replacement prompt sent to the model. + pub prompt: String, } -/// Remove a scheduled prompt by id. The result entry is omitted if the id was unknown. +/// Result of editing a queued message. /// ///
/// @@ -13821,13 +13874,12 @@ pub struct ScheduleStopRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ScheduleStopResult { - /// The removed entry, or omitted if no entry matched. - #[serde(skip_serializing_if = "Option::is_none")] - pub entry: Option, +pub struct QueueUpdateTextResult { + /// True when the stored text changed. + pub updated: bool, } -/// Secret values to add to the redaction filter. +/// Event type to register consumer interest for, used by runtime gating logic. /// ///
/// @@ -13837,12 +13889,12 @@ pub struct ScheduleStopResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SecretsAddFilterValuesRequest { - /// Raw secret values to register for redaction - pub values: Vec, +pub struct RegisterEventInterestParams { + /// The event type the consumer wants the runtime to treat as 'observed' for behavior-switching gating. Some runtime code paths inspect whether any consumer is interested in a specific event type and choose a different implementation accordingly (e.g. `mcp.oauth_required`: when interest is registered the runtime delegates interactive OAuth token acquisition to the consumer via `mcp.oauth_required` events; when no interest is registered the runtime still attempts non-interactive reconnect from cached or refreshable tokens, and only marks the server `needs-auth` if usable credentials are unavailable — it does not open a browser or start interactive OAuth without a consumer). SDK clients that long-poll events do NOT automatically appear as listeners to these gating checks — they must explicitly call `registerInterest` for each event type they want the runtime to count as having a consumer. Multiple registrations for the same event type from the same or different consumers are tracked independently and must each be released. See: `mcp.oauth_required`, `sampling.requested`, `auto_mode_switch.requested`, `session_limits_exhausted.requested`, `user_input.requested`, `elicitation.requested`, `command.queued`, `exit_plan_mode.requested`. + pub event_type: String, } -/// Confirmation that the secret values were registered. +/// Opaque handle representing an event-type interest registration. /// ///
/// @@ -13852,12 +13904,12 @@ pub struct SecretsAddFilterValuesRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SecretsAddFilterValuesResult { - /// Whether the values were successfully registered - pub ok: bool, +pub struct RegisterEventInterestResult { + /// Opaque handle for this registration. Pass to releaseInterest to release. Each call to registerInterest produces a fresh handle, even when the same eventType is registered multiple times. + pub handle: String, } -/// Parameters for session.extensions.sendAttachmentsToMessage. +/// Optional registration options. /// ///
/// @@ -13867,15 +13919,14 @@ pub struct SecretsAddFilterValuesResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SendAttachmentsToMessageParams { - /// Attachments to push into the next user-message turn. extension_context entries take the slim shape; standard variants take their full AttachmentSchema shape. - pub attachments: Vec, - /// 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. +pub struct SessionsRegisterExtensionToolsOnSessionOptions { + /// In-process `() => boolean` gating callback (CLI-only optimization). Marked internal: replaced by runtime-side enable/disable RPCs in the SDK migration. + #[doc(hidden)] #[serde(skip_serializing_if = "Option::is_none")] - pub instance_id: Option, + pub(crate) enabled: Option, } -/// A single user message to append to the session as part of a `session.sendMessages` turn +/// Params to attach an extension loader's tools to a session. /// ///
/// @@ -13885,29 +13936,18 @@ pub struct SendAttachmentsToMessageParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SendMessageItem { - /// Optional attachments (files, directories, selections, blobs, GitHub references) to include with this message - #[serde(skip_serializing_if = "Option::is_none")] - pub attachments: Option>, - /// If false, this message will not trigger a Premium Request Unit charge. User messages default to billable. - #[doc(hidden)] - #[serde(skip_serializing_if = "Option::is_none")] - pub(crate) billable: Option, - /// If provided, this is shown in the timeline instead of `prompt` - #[serde(skip_serializing_if = "Option::is_none")] - pub display_prompt: Option, - /// The user message text - pub prompt: String, - /// 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 - #[serde(skip_serializing_if = "Option::is_none")] - pub required_tool: Option, - /// Optional provenance tag copied to the resulting user.message event. Must be `user`, `system`, `command-` for command-originated messages, `schedule-` for scheduled prompts, or `agent-` for prompts sent by another agent. +pub(crate) struct RegisterExtensionToolsParams { + /// In-process ExtensionLoader handle (CLI-only optimization). Marked internal: this field is excluded from the public SDK surface. When the CLI migrates to a process-separated SDK, extension discovery/launch moves entirely into the runtime — the CLI passes pure config (search paths, disabled ids) via SessionOptions instead. #[doc(hidden)] + pub(crate) loader: serde_json::Value, + /// Optional registration options. #[serde(skip_serializing_if = "Option::is_none")] - pub(crate) source: Option, + pub options: Option, + /// Session to register extension tools on. + pub session_id: SessionId, } -/// 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. +/// Handle for releasing the extension tool registration. /// ///
/// @@ -13917,33 +13957,13 @@ pub struct SendMessageItem { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SendMessagesRequest { - /// The UI mode the agent was in when these messages were sent. Defaults to the session's current mode. - #[serde(skip_serializing_if = "Option::is_none")] - pub agent_mode: Option, - /// 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. - pub messages: Vec, - /// How to deliver the messages. `enqueue` (default) appends to the message queue. `immediate` interjects during an in-progress turn. - #[serde(skip_serializing_if = "Option::is_none")] - pub mode: Option, - /// If true, adds the messages to the front of the queue instead of the end - #[serde(skip_serializing_if = "Option::is_none")] - pub prepend: Option, - /// 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. - #[serde(skip_serializing_if = "Option::is_none")] - pub request_headers: Option>, - /// W3C Trace Context traceparent header for distributed tracing of this agent turn - #[serde(skip_serializing_if = "Option::is_none")] - pub traceparent: Option, - /// W3C Trace Context tracestate header for distributed tracing - #[serde(skip_serializing_if = "Option::is_none")] - pub tracestate: Option, - /// 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. - #[serde(skip_serializing_if = "Option::is_none")] - pub wait: Option, +pub(crate) struct RegisterExtensionToolsResult { + /// In-process unsubscribe function (CLI-only optimization). Marked internal: replaced by an explicit `extensions.unregister` RPC in the SDK migration. + #[doc(hidden)] + pub(crate) unsubscribe: serde_json::Value, } -/// Result of sending zero or more user messages +/// Opaque handle previously returned by `registerInterest` to release. /// ///
/// @@ -13953,12 +13973,12 @@ pub struct SendMessagesRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SendMessagesResult { - /// Unique identifiers assigned to the messages, one per provided message in order. Empty when no messages were provided. - pub message_ids: Vec, +pub struct ReleaseEventInterestParams { + /// Handle returned by a previous `registerInterest` call. Idempotent: releasing an unknown or already-released handle is a no-op (returns success). When the last outstanding handle for an event type is released, the runtime reverts to its 'no consumer' code path for that event type. + pub handle: String, } -/// Parameters for sending a user message to the session +/// Reattach to an existing MC session without creating a new one. /// ///
/// @@ -13968,49 +13988,14 @@ pub struct SendMessagesResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SendRequest { - /// The UI mode the agent was in when this message was sent. Defaults to the session's current mode. - #[serde(skip_serializing_if = "Option::is_none")] - pub agent_mode: Option, - /// Optional attachments (files, directories, selections, blobs, GitHub references) to include with the message - #[serde(skip_serializing_if = "Option::is_none")] - pub attachments: Option>, - /// If false, this message will not trigger a Premium Request Unit charge. User messages default to billable. - #[serde(skip_serializing_if = "Option::is_none")] - pub billable: Option, - /// If provided, this is shown in the timeline instead of `prompt` - #[serde(skip_serializing_if = "Option::is_none")] - pub display_prompt: Option, - /// How to deliver the message. `enqueue` (default) appends to the message queue. `immediate` interjects during an in-progress turn. - #[serde(skip_serializing_if = "Option::is_none")] - pub mode: Option, - /// If true, adds the message to the front of the queue instead of the end - #[serde(skip_serializing_if = "Option::is_none")] - pub prepend: Option, - /// The user message text - pub prompt: String, - /// 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. - #[serde(skip_serializing_if = "Option::is_none")] - pub request_headers: Option>, - /// 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 - #[serde(skip_serializing_if = "Option::is_none")] - pub required_tool: Option, - /// Optional provenance tag copied to the resulting user.message event. Must be `user`, `system`, `command-` for command-originated messages, `schedule-` for scheduled prompts, or `agent-` for prompts sent by another agent. - #[doc(hidden)] - #[serde(skip_serializing_if = "Option::is_none")] - pub(crate) source: Option, - /// W3C Trace Context traceparent header for distributed tracing of this agent turn - #[serde(skip_serializing_if = "Option::is_none")] - pub traceparent: Option, - /// W3C Trace Context tracestate header for distributed tracing - #[serde(skip_serializing_if = "Option::is_none")] - pub tracestate: Option, - /// 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. - #[serde(skip_serializing_if = "Option::is_none")] - pub wait: Option, +pub struct RemoteControlConfigExistingMcSession { + /// Existing MC session ID to reattach to. + pub mc_session_id: String, + /// Existing MC task ID for the reattached session. + pub mc_task_id: String, } -/// Result of sending a user message +/// Configuration for the runtime-managed remote-control singleton. /// ///
/// @@ -14020,12 +14005,24 @@ pub struct SendRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SendResult { - /// Unique identifier assigned to the message - pub message_id: String, -} +pub struct RemoteControlConfig { + /// Reattach to an existing MC session without creating a new one. + #[serde(skip_serializing_if = "Option::is_none")] + pub existing_mc_session: Option, + /// Whether the user explicitly requested remote (vs. implicit session-sync). Controls warning surfacing for missing-repo cases. + pub explicit: bool, + /// Whether remote export should be enabled. + pub remote: bool, + /// When true, suppresses timeline messages on successful setup. + pub silent: bool, + /// Whether the MC session may steer the local session (write mode). + pub steerable: bool, + /// Existing Mission Control task ID to attach the exported session to. + #[serde(skip_serializing_if = "Option::is_none")] + pub task_id: Option, +} -/// Internal request for sending a system notification. +/// Remote control is connected to a local session. /// ///
/// @@ -14035,18 +14032,27 @@ pub struct SendResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SendSystemNotificationRequest { - /// Optional structured notification kind. +pub struct RemoteControlStatusActive { + /// Session id remote control is pointed at. + pub attached_session_id: String, + /// 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. + #[doc(hidden)] #[serde(skip_serializing_if = "Option::is_none")] - pub kind: Option, - /// Notification text to deliver to the model. - pub message: String, - /// Internal delivery options, including passive policy. + pub(crate) awaiting_first_message: Option, + /// MC frontend URL for this session, when known. #[serde(skip_serializing_if = "Option::is_none")] - pub options: Option, + pub frontend_url: Option, + /// Whether the MC session may steer this session. + pub is_steerable: bool, + /// In-process prompt-manager handle (CLI-only optimization). Marked internal: this field is excluded from the public SDK surface. Retained as an optional compatibility field; native remote control does not populate or consume it. + #[doc(hidden)] + #[serde(skip_serializing_if = "Option::is_none")] + pub(crate) prompt_manager: Option, + /// Remote control state tag: active. + pub state: RemoteControlStatusActiveState, } -/// Agents discovered across user, project, plugin, and remote sources. +/// Remote control is in the middle of initial setup. /// ///
/// @@ -14056,12 +14062,14 @@ pub struct SendSystemNotificationRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ServerAgentList { - /// All discovered agents across all sources - pub agents: Vec, +pub struct RemoteControlStatusConnecting { + /// Session id the connection is attaching to. + pub attached_session_id: String, + /// Remote control state tag: connecting. + pub state: RemoteControlStatusConnectingState, } -/// Instruction sources discovered across user, repository, and plugin sources. +/// The last setup attempt failed. The singleton is otherwise off. /// ///
/// @@ -14071,12 +14079,17 @@ pub struct ServerAgentList { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ServerInstructionSourceList { - /// All discovered instruction sources - pub sources: Vec, +pub struct RemoteControlStatusError { + /// Session id the failing setup attempt targeted, when known. + #[serde(skip_serializing_if = "Option::is_none")] + pub attached_session_id: Option, + /// Human-readable error message from the last setup attempt. + pub error: String, + /// Remote control state tag: setup failed. + pub state: RemoteControlStatusErrorState, } -/// Server-side skill metadata, including name, description, source, enabled/invocable state, path, project path, and argument hint. +/// Remote control is not connected. /// ///
/// @@ -14086,32 +14099,12 @@ pub struct ServerInstructionSourceList { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ServerSkill { - /// Optional freeform hint describing the skill's expected arguments, from the `argument-hint` frontmatter field - #[serde(skip_serializing_if = "Option::is_none")] - pub argument_hint: Option, - /// Canonical slash command name used to invoke the skill, without the leading '/' - #[serde(skip_serializing_if = "Option::is_none")] - pub command_name: Option, - /// Description of what the skill does - pub description: String, - /// Whether the skill is currently enabled (based on global config) - pub enabled: bool, - /// Unique identifier for the skill - pub name: String, - /// Absolute path to the skill file - #[serde(skip_serializing_if = "Option::is_none")] - pub path: Option, - /// The project path this skill belongs to (only for project/inherited skills) - #[serde(skip_serializing_if = "Option::is_none")] - pub project_path: Option, - /// Source location type (e.g., project, personal-copilot, plugin, builtin) - pub source: SkillSource, - /// Whether the skill can be invoked by the user as a slash command - pub user_invocable: bool, +pub struct RemoteControlStatusOff { + /// Remote control state tag: not connected. + pub state: RemoteControlStatusOffState, } -/// Skills discovered across global and project sources. +/// Wrapper for the singleton's current status. /// ///
/// @@ -14121,15 +14114,12 @@ pub struct ServerSkill { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct 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. - #[serde(skip_serializing_if = "Option::is_none")] - pub errors: Option>, - /// All discovered skills across all sources - pub skills: Vec, +pub struct RemoteControlStatusResult { + /// State of the runtime-managed remote-control singleton. + pub status: serde_json::Value, } -/// Current activity flags for the session. +/// Outcome of a stopRemoteControl call. /// ///
/// @@ -14139,14 +14129,14 @@ pub struct ServerSkillList { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionActivity { - /// Whether an in-flight operation can currently be aborted. - pub abortable: bool, - /// Whether the session currently has active work, including running turns or tasks. - pub has_active_work: bool, +pub struct RemoteControlStopResult { + /// State of the runtime-managed remote-control singleton. + pub status: serde_json::Value, + /// Whether the singleton was actually torn down by this call. + pub stopped: bool, } -/// Current authentication information, or null when no authentication is active. +/// Outcome of a transferRemoteControl call. /// ///
/// @@ -14156,23 +14146,14 @@ pub struct SessionActivity { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionAuthInfoResult { - /// Snapshot of the authenticated user's Copilot subscription info, if known - #[serde(skip_serializing_if = "Option::is_none")] - pub copilot_user: Option, - /// Name of the environment variable that supplied the credential, when applicable - #[serde(skip_serializing_if = "Option::is_none")] - pub env_var: Option, - /// Authentication host - pub host: String, - /// Authenticated login, when available - #[serde(skip_serializing_if = "Option::is_none")] - pub login: Option, - /// Authentication type - pub r#type: AuthInfoType, +pub struct RemoteControlTransferResult { + /// State of the runtime-managed remote-control singleton. + pub status: serde_json::Value, + /// Whether the rebinding actually happened. + pub transferred: bool, } -/// Internal GitHub login parameters. +/// Optional remote session mode ("off", "export", or "on"); defaults to enabling both export and remote steering. /// ///
/// @@ -14182,19 +14163,13 @@ pub struct SessionAuthInfoResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionAuthLoginRequest { - /// GitHub host URL - pub host: String, - /// GitHub login - pub login: String, - /// Whether to persist the token after login +pub struct RemoteEnableRequest { + /// Per-session remote mode. "off" disables remote, "export" exports session events to GitHub without enabling remote steering, "on" enables both export and remote steering. #[serde(skip_serializing_if = "Option::is_none")] - pub persist: Option, - /// GitHub authentication token - pub token: String, + pub mode: Option, } -/// Parameters identifying a GitHub authentication to log out. +/// GitHub URL for the session and a flag indicating whether remote steering is enabled. /// ///
/// @@ -14202,14 +14177,17 @@ pub struct SessionAuthLoginRequest { /// and may change or be removed in future SDK or CLI releases. /// ///
-#[derive(Debug, Clone, Serialize, Deserialize)] +#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionAuthLogoutUserRequest { - /// Authentication information to log out - pub auth_info: AuthInfo, +pub struct RemoteEnableResult { + /// Whether remote steering is enabled + pub remote_steerable: bool, + /// GitHub frontend URL for this session + #[serde(skip_serializing_if = "Option::is_none")] + pub url: Option, } -/// Authentication status and account metadata for the session. +/// New remote-steerability state to persist as a `session.remote_steerable_changed` event. /// ///
/// @@ -14219,27 +14197,12 @@ pub struct SessionAuthLogoutUserRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionAuthStatus { - /// Authentication type - #[serde(skip_serializing_if = "Option::is_none")] - pub auth_type: Option, - /// Copilot plan tier (e.g., individual_pro, business) - #[serde(skip_serializing_if = "Option::is_none")] - pub copilot_plan: Option, - /// Authentication host URL - #[serde(skip_serializing_if = "Option::is_none")] - pub host: Option, - /// Whether the session has resolved authentication - pub is_authenticated: bool, - /// Authenticated login/username, if available - #[serde(skip_serializing_if = "Option::is_none")] - pub login: Option, - /// Human-readable authentication status description - #[serde(skip_serializing_if = "Option::is_none")] - pub status_message: Option, +pub struct RemoteNotifySteerableChangedRequest { + /// Whether the session now supports remote steering via GitHub. The runtime persists this as a `session.remote_steerable_changed` event so resume/replay sees the up-to-date capability. + pub remote_steerable: bool, } -/// Parameters for switching the session's active authentication. +/// Persist a steerability change as a `session.remote_steerable_changed` event. Used by the host (CLI / SDK consumer) when it has just finished enabling or disabling steering on a remote exporter that the runtime does not directly own. /// ///
/// @@ -14247,17 +14210,11 @@ pub struct SessionAuthStatus { /// and may change or be removed in future SDK or CLI releases. /// ///
-#[derive(Debug, Clone, Serialize, Deserialize)] +#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionAuthSwitchRequest { - /// Authentication information to activate - pub auth_info: AuthInfo, - /// Optional token paired with the authentication information - #[serde(skip_serializing_if = "Option::is_none")] - pub token: Option, -} +pub struct RemoteNotifySteerableChangedResult {} -/// Map of sessionId -> bytes freed by removing the session's workspace directory. +/// Remote session connection result. /// ///
/// @@ -14267,59 +14224,88 @@ pub struct SessionAuthSwitchRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct 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). - pub freed_bytes: HashMap, -} - -/// The six normalized `/context` header buckets, computed from the same tokenization as `entries` so the two never disagree. Convenience rollups: `freeSpace` and `buffer` describe window capacity rather than occupied context, so the values do not sum to `totalTokens`. -#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct SessionContextAttributionCategories { - /// Output reserve plus post-blocking-threshold buffer. - pub buffer: i64, - /// Custom-instructions tokens (0 when none are configured). - pub custom_instructions: i64, - /// Remaining unused window capacity (clamped at 0). - pub free_space: i64, - /// MCP tool-definition tokens. - pub mcp_tools: i64, - /// Conversation (user/assistant/tool) message tokens. - pub messages: i64, - /// System prompt tokens, excluding custom instructions. - pub system_prompt: i64, - /// Non-MCP tool-definition tokens. - pub system_tools: i64, +pub struct RemoteSessionConnectionResult { + /// Metadata for a connected remote session. + pub metadata: ConnectedRemoteSessionMetadata, + /// SDK session ID for the connected remote session. + pub session_id: SessionId, } -/// Successful compaction history for the session. +/// GitHub repository the remote session belongs to. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionContextAttributionCompactions { - /// Number of successful compactions in this session. - pub count: i64, +pub struct RemoteSessionMetadataRepository { + /// Branch associated with the remote session. + pub branch: String, + /// Repository name. + pub name: String, + /// Repository owner. + pub owner: String, } +/// Remote session metadata for the session to hand off (typically obtained from `sessions.list` with `source: "remote"`). +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionContextAttributionEntriesItem { - /// Supplementary per-entry metadata (e.g. `messageCount`, `role`, `evictable`, `pluginSource`). Values are stringified; parse as needed and ignore unrecognized keys. +pub struct RemoteSessionMetadataValue { + /// Most recent working directory context. #[serde(skip_serializing_if = "Option::is_none")] - pub attributes: Option>, - /// Identifier for this entry, formed by joining its `kind` and source name (e.g. `tool:bash`, `skill:tmux`, `toolDefinition:bash`); unique within the snapshot. Use it to match the same entry across snapshots, to correlate with other APIs (skill/agent/MCP registries), and as the `parentId` target for nesting. Distinct from the human-facing `label`. - pub id: String, - /// Source category for this entry. Not a closed set — tolerate unknown values. Known values today: `skill`, `subagent`, `mcpServer`, `tool`, `system`, `toolDefinition`, `plugin`. - pub kind: String, - /// Human-readable display label, e.g. `bash` or `skill: tmux`. Presentation-only; may be localized/reformatted without notice — do not key off it. - pub label: String, - /// Optional `id` of the parent entry: e.g. a `plugin` entry parenting its `skill`/`mcpServer` entries, or the `system` entry parenting `toolDefinition` entries. Omitted for top-level entries. + pub context: Option, + /// 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. #[serde(skip_serializing_if = "Option::is_none")] - pub parent_id: Option, - /// Token count currently in context attributable to this entry. - pub tokens: i64, + pub host_activity: Option, + /// 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. + #[serde(skip_serializing_if = "Option::is_none")] + pub host_status: Option, + /// Always true for remote sessions. + pub is_remote: bool, + /// Last-modified time as an ISO 8601 timestamp. + pub modified_time: String, + /// Optional human-friendly name set via /rename. + #[serde(skip_serializing_if = "Option::is_none")] + pub name: Option, + /// Pull request number associated with the session. + #[serde(skip_serializing_if = "Option::is_none")] + pub pull_request_number: Option, + /// Backing remote session IDs (most recent first). + pub remote_session_ids: Vec, + /// GitHub repository the remote session belongs to. + pub repository: RemoteSessionMetadataRepository, + /// Original remote resource identifier (task ID or PR node ID). + #[serde(skip_serializing_if = "Option::is_none")] + pub resource_id: Option, + /// Stable session identifier. + pub session_id: SessionId, + /// Deadline (ISO 8601) at which a CLI remote session becomes stale without further heartbeats. + #[serde(skip_serializing_if = "Option::is_none")] + pub stale_at: Option, + /// Session creation time as an ISO 8601 timestamp. + pub start_time: String, + /// Server-side task state returned by GitHub. + #[serde(skip_serializing_if = "Option::is_none")] + pub state: Option, + /// Short summary of the session, when one has been derived. + #[serde(skip_serializing_if = "Option::is_none")] + pub summary: Option, + /// Whether the remote task originated from CCA or CLI `--remote`. + #[serde(skip_serializing_if = "Option::is_none")] + pub task_type: Option, } -/// Per-source context-window attribution, or null if the session has not yet been initialized (no system prompt or tool metadata cached). +/// Repository context for the remote session. /// ///
/// @@ -14329,30 +14315,17 @@ pub struct SessionContextAttributionEntriesItem { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionContextAttribution { - /// Output reserve plus the tokens past the buffer-exhaustion blocking threshold. Mirrors `SessionContextInfo.bufferTokens`. - pub buffer_tokens: i64, - /// The six normalized `/context` header buckets, computed from the same tokenization as `entries` so the two never disagree. Convenience rollups: `freeSpace` and `buffer` describe window capacity rather than occupied context, so the values do not sum to `totalTokens`. - pub categories: SessionContextAttributionCategories, - /// Successful compaction history for the session. - pub compactions: SessionContextAttributionCompactions, - /// Token count at which background compaction starts. Mirrors `SessionContextInfo.compactionThreshold`. - pub compaction_threshold: i64, - /// Flat list of per-source attribution entries. Group by `kind` and render unrecognized kinds generically. Nesting and rollups are expressed via `parentId`. - pub entries: Vec, - /// Prompt limit plus the model's output reserve: the full context window `categories.freeSpace` and `categories.buffer` are measured against. Mirrors `SessionContextInfo.limit`. - pub limit: i64, - /// The concrete model id the entire breakdown was tokenized against (feeds the per-model token multiplier). Under `Auto` (Free/Student) this is the resolved model, not the literal `auto` sentinel, so totals are not undercounted. A single-model approximation of a potentially multi-model Auto session. - pub model_id: String, - /// How `modelId` was chosen. Not a closed set — tolerate unknown values. Known values today: `autoResolved` (the model Auto resolved to), `selected` (the user's explicitly selected model), `default` (a fallback before any model is known). - pub model_source: String, - /// Maximum prompt tokens the resolved model accepts — the denominator for a `##k/###k` context-usage display. Mirrors `SessionContextInfo.promptTokenLimit`. - pub prompt_token_limit: i64, - /// Total token count of the current context window the entries are measured against (system message + conversation messages + tool definitions — the same total reported by /context). Divide an entry's `tokens` by this to derive its share. - pub total_tokens: i64, +pub struct RemoteSessionRepository { + /// Optional branch associated with the remote session. + #[serde(skip_serializing_if = "Option::is_none")] + pub branch: Option, + /// Repository name. + pub name: String, + /// Repository owner or organization login. + pub owner: String, } -/// Token breakdown for the current context window, or null if the session has not yet been initialized (no system prompt or tool metadata cached). +/// 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. /// ///
/// @@ -14362,30 +14335,16 @@ pub struct SessionContextAttribution { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionContextInfo { - /// Output reserve plus tokens after the buffer-exhaustion blocking threshold (default 95%) - pub buffer_tokens: i64, - /// Token count at which background compaction starts (configurable percentage of promptTokenLimit) - pub compaction_threshold: i64, - /// Tokens consumed by user/assistant/tool messages - pub conversation_tokens: i64, - /// Prompt token limit plus the model's full output token limit. - pub limit: i64, - /// Tokens consumed by MCP tool definitions (subset of toolDefinitionsTokens, excludes deferred tools) - pub mcp_tools_tokens: i64, - /// The model used for token counting - pub model_name: String, - /// Maximum prompt tokens allowed by the model (or DEFAULT_TOKEN_LIMIT if unspecified) - pub prompt_token_limit: i64, - /// Tokens consumed by the system prompt - pub system_tokens: i64, - /// Tokens consumed by tool definitions sent to the model (excludes deferred tools) - pub tool_definitions_tokens: i64, - /// Sum of system, conversation and tool-definition tokens - pub total_tokens: i64, +pub struct 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). + #[serde(skip_serializing_if = "Option::is_none")] + pub gh: Option, + /// Whether to inject git credentials as an `http..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). + #[serde(skip_serializing_if = "Option::is_none")] + pub git: Option, } -/// The enriched metadata records, with summary and context fields backfilled where available. Sessions confirmed empty and unnamed are omitted. +/// macOS seatbelt experimental options. /// ///
/// @@ -14395,12 +14354,13 @@ pub struct SessionContextInfo { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionEnrichMetadataResult { - /// Enriched records, with summary and context backfilled. Sessions confirmed empty and unnamed may be omitted. - pub sessions: Vec, +pub struct SandboxConfigUserPolicyExperimentalSeatbelt { + /// Whether the macOS seatbelt profile may access the keychain. + #[serde(skip_serializing_if = "Option::is_none")] + pub keychain_access: Option, } -/// File path, content to append, and optional mode for the client-provided session filesystem. +/// Platform-specific experimental policy fields. /// ///
/// @@ -14410,19 +14370,13 @@ pub struct SessionEnrichMetadataResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionFsAppendFileRequest { - /// Target session identifier - pub session_id: SessionId, - /// Path using SessionFs conventions - pub path: String, - /// Content to append - pub content: String, - /// Optional POSIX-style mode for newly created files +pub struct SandboxConfigUserPolicyExperimental { + /// macOS seatbelt experimental options. #[serde(skip_serializing_if = "Option::is_none")] - pub mode: Option, + pub seatbelt: Option, } -/// Describes a filesystem error. +/// Filesystem rules to merge into the base policy. /// ///
/// @@ -14432,15 +14386,22 @@ pub struct SessionFsAppendFileRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionFsError { - /// Error classification - pub code: SessionFsErrorCode, - /// Free-form detail about the error, for logging/diagnostics +pub struct SandboxConfigUserPolicyFilesystem { + /// Whether to clear the policy when the session exits. #[serde(skip_serializing_if = "Option::is_none")] - pub message: Option, + pub clear_policy_on_exit: Option, + /// Paths explicitly denied. + #[serde(skip_serializing_if = "Option::is_none")] + pub denied_paths: Option>, + /// Paths granted read-only access. + #[serde(skip_serializing_if = "Option::is_none")] + pub readonly_paths: Option>, + /// Paths granted read/write access. + #[serde(skip_serializing_if = "Option::is_none")] + pub readwrite_paths: Option>, } -/// Path to test for existence in the client-provided session filesystem. +/// HTTP proxy configuration for sandboxed traffic. /// ///
/// @@ -14450,14 +14411,18 @@ pub struct SessionFsError { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionFsExistsRequest { - /// Target session identifier - pub session_id: SessionId, - /// Path using SessionFs conventions - pub path: String, +pub struct 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. + #[serde(skip_serializing_if = "Option::is_none")] + pub password: Option, + /// Proxy URL (e.g. http://proxy.example.com:8080). The port is optional and defaults to the scheme's standard port when omitted. 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 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. + pub url: String, + /// Optional username for proxy authentication. Combined with the URL (and `password`) into `user:pass@host` when the sandboxed process routes through the proxy. + #[serde(skip_serializing_if = "Option::is_none")] + pub username: Option, } -/// Indicates whether the requested path exists in the client-provided session filesystem. +/// Network rules to merge into the base policy. /// ///
/// @@ -14467,12 +14432,19 @@ pub struct SessionFsExistsRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionFsExistsResult { - /// Whether the path exists - pub exists: bool, +pub struct SandboxConfigUserPolicyNetwork { + /// Whether traffic to local/loopback addresses is allowed. + #[serde(skip_serializing_if = "Option::is_none")] + pub allow_local_network: Option, + /// Whether outbound network traffic is allowed at all. + #[serde(skip_serializing_if = "Option::is_none")] + pub allow_outbound: Option, + /// HTTP proxy the sandboxed process routes traffic through. Enforced on Windows and cooperative (honored by well-behaved tools, not strictly enforced) on Linux and macOS. Credentials go in the separate `username`/`password` fields. A credential-free http:// loopback proxy URL is routed through the localhost proxy automatically; an https:// or authenticated loopback URL is used as-is. + #[serde(skip_serializing_if = "Option::is_none")] + pub proxy: Option, } -/// Directory path to create in the client-provided session filesystem, with options for recursive creation and POSIX mode. +/// macOS seatbelt-specific options. /// ///
/// @@ -14482,20 +14454,13 @@ pub struct SessionFsExistsResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionFsMkdirRequest { - /// Target session identifier - pub session_id: SessionId, - /// Path using SessionFs conventions - pub path: String, - /// Create parent directories as needed - #[serde(skip_serializing_if = "Option::is_none")] - pub recursive: Option, - /// Optional POSIX-style mode for newly created directories +pub struct SandboxConfigUserPolicySeatbelt { + /// Whether the macOS seatbelt profile may access the keychain. #[serde(skip_serializing_if = "Option::is_none")] - pub mode: Option, + pub keychain_access: Option, } -/// Directory path whose entries should be listed from the client-provided session filesystem. +/// User-managed sandbox policy fragment merged into the auto-discovered base policy. /// ///
/// @@ -14505,14 +14470,22 @@ pub struct SessionFsMkdirRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionFsReaddirRequest { - /// Target session identifier - pub session_id: SessionId, - /// Path using SessionFs conventions - pub path: String, +pub struct SandboxConfigUserPolicy { + /// Deprecated legacy location for `seatbelt`; read only when the top-level `seatbelt` is absent. + #[serde(skip_serializing_if = "Option::is_none")] + pub experimental: Option, + /// Filesystem rules to merge into the base policy. + #[serde(skip_serializing_if = "Option::is_none")] + pub filesystem: Option, + /// Network rules to merge into the base policy. + #[serde(skip_serializing_if = "Option::is_none")] + pub network: Option, + /// macOS seatbelt options to merge into the base policy. + #[serde(skip_serializing_if = "Option::is_none")] + pub seatbelt: Option, } -/// Names of entries in the requested directory, or a filesystem error if the read failed. +/// Resolved sandbox configuration. /// ///
/// @@ -14522,15 +14495,24 @@ pub struct SessionFsReaddirRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionFsReaddirResult { - /// Entry names in the directory - pub entries: Vec, - /// Describes a filesystem error. +pub struct SandboxConfig { + /// Whether to auto-add the current working directory to readwritePaths. Default: true. #[serde(skip_serializing_if = "Option::is_none")] - pub error: Option, + pub add_current_working_directory: Option, + /// Whether to auto-grant read access to the tool directories discovered on PATH and in toolchain environment variables (GOROOT, CARGO_HOME, JAVA_HOME, VIRTUAL_ENV, and similar), and to common developer-tool caches, registries, and toolchains in their default home locations (cargo, go, npm, Maven, and more), plus read-write access to (and, on Unix, up-front creation of) the scratch caches builds write on every run (go-build, ccache, sccache, Gradle caches, Cargo lock/tracker files), so builds work without extra configuration; a relocated CARGO_HOME additionally gets its Cargo lock files granted read-write. Set to false to disable every grant listed above: user-installed toolchains (rustup, nvm, pyenv, conda, pipx) then need explicit userPolicy.filesystem entries — readonlyPaths to read them, plus readwriteFiles for a relocated CARGO_HOME's .package-cache and .global-cache, which Cargo locks on every build. Only these developer-tool grants are affected: the working directory (see addCurrentWorkingDirectory), temporary storage, session log paths, and system locations follow their own rules and stay granted, so commands still run. Default: true (enabled by default; set to false to opt out). + #[serde(skip_serializing_if = "Option::is_none")] + pub allow_dev_tool_access: Option, + /// Credential-injection capability flags. + #[serde(skip_serializing_if = "Option::is_none")] + pub auth: Option, + /// Whether sandboxing is enabled for the session. + pub enabled: bool, + /// User-managed sandbox policy fragment merged into the auto-discovered base policy. + #[serde(skip_serializing_if = "Option::is_none")] + pub user_policy: Option, } -/// Directory entry returned by session filesystem `readdirWithTypes`, with name and entry type. +/// Register an absolute-time scheduled prompt. /// ///
/// @@ -14540,31 +14522,20 @@ pub struct SessionFsReaddirResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionFsReaddirWithTypesEntry { - /// Entry name - pub name: String, - /// Entry type - pub r#type: SessionFsReaddirWithTypesEntryType, -} - -/// Directory path whose entries (with type information) should be listed from the client-provided session filesystem. -/// -///
-/// -/// **Experimental.** This type is part of an experimental wire-protocol surface -/// and may change or be removed in future SDK or CLI releases. -/// -///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct SessionFsReaddirWithTypesRequest { - /// Target session identifier - pub session_id: SessionId, - /// Path using SessionFs conventions - pub path: String, +pub struct ScheduleAddAtRequest { + /// Epoch milliseconds when the prompt should fire. + pub at: i64, + /// Optional display-only prompt label. + #[serde(skip_serializing_if = "Option::is_none")] + pub display_prompt: Option, + /// Prompt text to enqueue when the schedule fires. + pub prompt: String, + /// Whether the schedule should re-arm after each tick. Defaults to false. + #[serde(skip_serializing_if = "Option::is_none")] + pub recurring: Option, } -/// Entries in the requested directory paired with file/directory type information, or a filesystem error if the read failed. +/// Register a cron scheduled prompt. /// ///
/// @@ -14574,15 +14545,23 @@ pub struct SessionFsReaddirWithTypesRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionFsReaddirWithTypesResult { - /// Directory entries with type information - pub entries: Vec, - /// Describes a filesystem error. +pub struct ScheduleAddCronRequest { + /// 5-field cron expression. + pub cron: String, + /// Optional display-only prompt label. #[serde(skip_serializing_if = "Option::is_none")] - pub error: Option, + pub display_prompt: Option, + /// Prompt text to enqueue when the schedule fires. + pub prompt: String, + /// Whether the schedule should re-arm after each tick. Defaults to true. + #[serde(skip_serializing_if = "Option::is_none")] + pub recurring: Option, + /// IANA timezone for evaluating the cron expression. + #[serde(skip_serializing_if = "Option::is_none")] + pub tz: Option, } -/// Path of the file to read from the client-provided session filesystem. +/// Register a relative-interval scheduled prompt. /// ///
/// @@ -14592,14 +14571,20 @@ pub struct SessionFsReaddirWithTypesResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionFsReadFileRequest { - /// Target session identifier - pub session_id: SessionId, - /// Path using SessionFs conventions - pub path: String, +pub struct ScheduleAddRequest { + /// Optional display-only prompt label. + #[serde(skip_serializing_if = "Option::is_none")] + pub display_prompt: Option, + /// Human-readable interval such as `30s`, `5m`, or `2h`. + pub interval: String, + /// Prompt text to enqueue when the schedule fires. + pub prompt: String, + /// Whether the schedule should re-arm after each tick. Defaults to true. + #[serde(skip_serializing_if = "Option::is_none")] + pub recurring: Option, } -/// File content as a UTF-8 string, or a filesystem error if the read failed. +/// Scheduled prompt entry with ID, timing (`intervalMs`, `cron`, or `at`), prompt text, recurrence, and next run time. /// ///
/// @@ -14609,15 +14594,36 @@ pub struct SessionFsReadFileRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionFsReadFileResult { - /// File content as UTF-8 string - pub content: String, - /// Describes a filesystem error. +pub struct ScheduleEntry { + /// Absolute fire time (epoch milliseconds) for a one-shot calendar schedule. #[serde(skip_serializing_if = "Option::is_none")] - pub error: Option, + pub at: Option, + /// 5-field cron expression for a recurring calendar schedule, evaluated in `tz`. + #[serde(skip_serializing_if = "Option::is_none")] + pub cron: Option, + /// Display-only label for the prompt as shown in the UI (e.g. `/skill-name` for a skill-invocation schedule). The actual enqueued prompt is `prompt`. + #[serde(skip_serializing_if = "Option::is_none")] + pub display_prompt: Option, + /// Sequential id assigned by the runtime within the session. Stable across resumes (rebuilt from the event log). + pub id: i64, + /// Interval between scheduled ticks, in milliseconds (relative-interval schedules). + #[serde(skip_serializing_if = "Option::is_none")] + pub interval_ms: Option, + /// ISO 8601 timestamp when the next tick is scheduled to fire. + pub next_run_at: String, + /// Prompt text that gets enqueued on every tick. + pub prompt: String, + /// Whether the schedule re-arms after each tick (`/every`) or fires once (`/after`). + pub recurring: bool, + /// True for a self-paced (`dynamic`) schedule: no fixed cadence; the model arms each next run via the `manage_schedule` `wakeup` action. `nextRunAt` is model-controlled. + #[serde(skip_serializing_if = "Option::is_none")] + pub self_paced: Option, + /// IANA timezone the `cron` expression is evaluated in. + #[serde(skip_serializing_if = "Option::is_none")] + pub tz: Option, } -/// Source and destination paths for renaming or moving an entry in the client-provided session filesystem. +/// Result of registering or re-arming a scheduled prompt. /// ///
/// @@ -14627,16 +14633,16 @@ pub struct SessionFsReadFileResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionFsRenameRequest { - /// Target session identifier - pub session_id: SessionId, - /// Source path using SessionFs conventions - pub src: String, - /// Destination path using SessionFs conventions - pub dest: String, +pub struct ScheduleAddResult { + /// The registered or updated schedule entry. + #[serde(skip_serializing_if = "Option::is_none")] + pub entry: Option, + /// User-facing validation error, when registration failed. + #[serde(skip_serializing_if = "Option::is_none")] + pub error: Option, } -/// Path to remove from the client-provided session filesystem, with options for recursive removal and force. +/// Register a self-paced scheduled prompt. /// ///
/// @@ -14646,20 +14652,15 @@ pub struct SessionFsRenameRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionFsRmRequest { - /// Target session identifier - pub session_id: SessionId, - /// Path using SessionFs conventions - pub path: String, - /// Remove directories and their contents recursively - #[serde(skip_serializing_if = "Option::is_none")] - pub recursive: Option, - /// Ignore errors if the path does not exist +pub struct ScheduleAddSelfPacedRequest { + /// Optional display-only prompt label. #[serde(skip_serializing_if = "Option::is_none")] - pub force: Option, + pub display_prompt: Option, + /// Prompt text to enqueue when the schedule fires. + pub prompt: String, } -/// Optional capabilities declared by the provider +/// Whether the session currently has an active self-paced schedule. /// ///
/// @@ -14669,13 +14670,12 @@ pub struct SessionFsRmRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionFsSetProviderCapabilities { - /// Whether the provider supports SQLite query/exists operations - #[serde(skip_serializing_if = "Option::is_none")] - pub sqlite: Option, +pub struct ScheduleHasSelfPacedResult { + /// True when at least one active schedule is self-paced. + pub has_self_paced: bool, } -/// Initial working directory, session-state path layout, and path conventions used to register the calling SDK client as the session filesystem provider. +/// Snapshot of the currently active recurring prompts for this session. /// ///
/// @@ -14685,19 +14685,12 @@ pub struct SessionFsSetProviderCapabilities { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionFsSetProviderRequest { - /// Optional capabilities declared by the provider - #[serde(skip_serializing_if = "Option::is_none")] - pub capabilities: Option, - /// Path conventions used by this filesystem - pub conventions: SessionFsSetProviderConventions, - /// Initial working directory for sessions - pub initial_cwd: String, - /// Path within each session's SessionFs where the runtime stores files for that session - pub session_state_path: String, +pub struct ScheduleList { + /// Active scheduled prompts, ordered by id. + pub entries: Vec, } -/// Indicates whether the calling client was registered as the session filesystem provider. +/// Re-arm a self-paced scheduled prompt. /// ///
/// @@ -14707,12 +14700,14 @@ pub struct SessionFsSetProviderRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionFsSetProviderResult { - /// Whether the provider was set successfully - pub success: bool, +pub struct ScheduleRearmSelfPacedRequest { + /// Epoch milliseconds when the prompt should next fire. + pub at: i64, + /// Id of the self-paced scheduled prompt. + pub id: i64, } -/// Indicates whether the per-session SQLite database already exists. +/// Identifier of the scheduled prompt to remove. /// ///
/// @@ -14722,12 +14717,12 @@ pub struct SessionFsSetProviderResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionFsSqliteExistsResult { - /// Whether the session database already exists - pub exists: bool, +pub struct ScheduleStopRequest { + /// Id of the scheduled prompt to remove. + pub id: i64, } -/// SQL query, query type, and optional bind parameters for executing a SQLite query against the per-session database. The provider applies its SQLite busy timeout for every call. +/// Remove a scheduled prompt by id. The result entry is omitted if the id was unknown. /// ///
/// @@ -14737,19 +14732,13 @@ pub struct SessionFsSqliteExistsResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionFsSqliteQueryRequest { - /// Target session identifier - pub session_id: SessionId, - /// SQL query to execute - pub query: String, - /// How to execute the query: 'exec' for DDL/multi-statement (no results), 'query' for SELECT (returns rows), 'run' for INSERT/UPDATE/DELETE (returns rowsAffected) - pub query_type: SessionFsSqliteQueryType, - /// Optional named bind parameters +pub struct ScheduleStopResult { + /// The removed entry, or omitted if no entry matched. #[serde(skip_serializing_if = "Option::is_none")] - pub params: Option>, + pub entry: Option, } -/// Query results including rows, columns, and rows affected, or a filesystem error if execution failed. +/// Secret values to add to the redaction filter. /// ///
/// @@ -14759,22 +14748,12 @@ pub struct SessionFsSqliteQueryRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionFsSqliteQueryResult { - /// Column names from the result set - pub columns: Vec, - /// Describes a filesystem error. - #[serde(skip_serializing_if = "Option::is_none")] - pub error: Option, - /// SQLite last_insert_rowid() value for INSERT. - #[serde(skip_serializing_if = "Option::is_none")] - pub last_insert_rowid: Option, - /// For SELECT: array of row objects. For others: empty array. - pub rows: Vec>, - /// Number of rows affected (for INSERT/UPDATE/DELETE) - pub rows_affected: i64, +pub struct SecretsAddFilterValuesRequest { + /// Raw secret values to register for redaction + pub values: Vec, } -/// Classified SQLite transaction failure. busyOrLocked guarantees rollback; postCommitAmbiguous must never be retried. +/// Confirmation that the secret values were registered. /// ///
/// @@ -14784,14 +14763,12 @@ pub struct SessionFsSqliteQueryResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionFsSqliteTransactionError { - /// Machine-readable classification of the transaction failure. - pub error_class: SessionFsSqliteTransactionErrorClass, - /// Human-readable transaction failure message. - pub message: String, +pub struct SecretsAddFilterValuesResult { + /// Whether the values were successfully registered + pub ok: bool, } -/// One statement in an atomic SQLite transaction. +/// Parameters for session.extensions.sendAttachmentsToMessage. /// ///
/// @@ -14801,17 +14778,15 @@ pub struct SessionFsSqliteTransactionError { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionFsSqliteTransactionStatement { - /// Optional named bind parameters. +pub struct SendAttachmentsToMessageParams { + /// Attachments to push into the next user-message turn. extension_context entries take the slim shape; standard variants take their full AttachmentSchema shape. + pub attachments: Vec, + /// 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. #[serde(skip_serializing_if = "Option::is_none")] - pub params: Option>, - /// SQL statement to execute. - pub query: String, - /// How to execute the statement. - pub query_type: SessionFsSqliteQueryType, + pub instance_id: Option, } -/// Statements to execute atomically. Providers apply busy handling for every call. +/// A single user message to append to the session as part of a `session.sendMessages` turn /// ///
/// @@ -14821,14 +14796,29 @@ pub struct SessionFsSqliteTransactionStatement { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionFsSqliteTransactionRequest { - /// Target session identifier - pub session_id: SessionId, - /// Ordered SQL statements to execute in one transaction. - pub statements: Vec, +pub struct SendMessageItem { + /// Optional attachments (files, directories, selections, blobs, GitHub references) to include with this message + #[serde(skip_serializing_if = "Option::is_none")] + pub attachments: Option>, + /// If false, this message will not trigger a Premium Request Unit charge. User messages default to billable. + #[doc(hidden)] + #[serde(skip_serializing_if = "Option::is_none")] + pub(crate) billable: Option, + /// If provided, this is shown in the timeline instead of `prompt` + #[serde(skip_serializing_if = "Option::is_none")] + pub display_prompt: Option, + /// The user message text + pub prompt: String, + /// 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 + #[serde(skip_serializing_if = "Option::is_none")] + pub required_tool: Option, + /// Optional provenance tag copied to the resulting user.message event. Must be `user`, `system`, `command-` for command-originated messages, `schedule-` for scheduled prompts, or `agent-` for prompts sent by another agent. + #[doc(hidden)] + #[serde(skip_serializing_if = "Option::is_none")] + pub(crate) source: Option, } -/// Per-statement results, or a classified transaction error. +/// 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. /// ///
/// @@ -14838,15 +14828,33 @@ pub struct SessionFsSqliteTransactionRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionFsSqliteTransactionResult { - /// Classified transaction failure, when execution did not succeed. - #[serde(skip_serializing_if = "Option::is_none")] - pub error: Option, - /// Per-statement query results in input order. - pub results: Vec, +pub struct SendMessagesRequest { + /// The UI mode the agent was in when these messages were sent. Defaults to the session's current mode. + #[serde(skip_serializing_if = "Option::is_none")] + pub agent_mode: Option, + /// 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. + pub messages: Vec, + /// How to deliver the messages. `enqueue` (default) appends to the message queue. `immediate` interjects during an in-progress turn. + #[serde(skip_serializing_if = "Option::is_none")] + pub mode: Option, + /// If true, adds the messages to the front of the queue instead of the end + #[serde(skip_serializing_if = "Option::is_none")] + pub prepend: Option, + /// 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. + #[serde(skip_serializing_if = "Option::is_none")] + pub request_headers: Option>, + /// W3C Trace Context traceparent header for distributed tracing of this agent turn + #[serde(skip_serializing_if = "Option::is_none")] + pub traceparent: Option, + /// W3C Trace Context tracestate header for distributed tracing + #[serde(skip_serializing_if = "Option::is_none")] + pub tracestate: Option, + /// 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. + #[serde(skip_serializing_if = "Option::is_none")] + pub wait: Option, } -/// Path whose metadata should be returned from the client-provided session filesystem. +/// Result of sending zero or more user messages /// ///
/// @@ -14856,14 +14864,12 @@ pub struct SessionFsSqliteTransactionResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionFsStatRequest { - /// Target session identifier - pub session_id: SessionId, - /// Path using SessionFs conventions - pub path: String, +pub struct SendMessagesResult { + /// Unique identifiers assigned to the messages, one per provided message in order. Empty when no messages were provided. + pub message_ids: Vec, } -/// Filesystem metadata for the requested path, or a filesystem error if the stat failed. +/// Parameters for sending a user message to the session /// ///
/// @@ -14873,23 +14879,49 @@ pub struct SessionFsStatRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionFsStatResult { - /// ISO 8601 timestamp of creation - pub birthtime: String, - /// Describes a filesystem error. +pub struct SendRequest { + /// The UI mode the agent was in when this message was sent. Defaults to the session's current mode. #[serde(skip_serializing_if = "Option::is_none")] - pub error: Option, - /// Whether the path is a directory - pub is_directory: bool, - /// Whether the path is a file - pub is_file: bool, - /// ISO 8601 timestamp of last modification - pub mtime: String, - /// File size in bytes - pub size: i64, + pub agent_mode: Option, + /// Optional attachments (files, directories, selections, blobs, GitHub references) to include with the message + #[serde(skip_serializing_if = "Option::is_none")] + pub attachments: Option>, + /// If false, this message will not trigger a Premium Request Unit charge. User messages default to billable. + #[serde(skip_serializing_if = "Option::is_none")] + pub billable: Option, + /// If provided, this is shown in the timeline instead of `prompt` + #[serde(skip_serializing_if = "Option::is_none")] + pub display_prompt: Option, + /// How to deliver the message. `enqueue` (default) appends to the message queue. `immediate` interjects during an in-progress turn. + #[serde(skip_serializing_if = "Option::is_none")] + pub mode: Option, + /// If true, adds the message to the front of the queue instead of the end + #[serde(skip_serializing_if = "Option::is_none")] + pub prepend: Option, + /// The user message text + pub prompt: String, + /// 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. + #[serde(skip_serializing_if = "Option::is_none")] + pub request_headers: Option>, + /// 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 + #[serde(skip_serializing_if = "Option::is_none")] + pub required_tool: Option, + /// Optional provenance tag copied to the resulting user.message event. Must be `user`, `system`, `command-` for command-originated messages, `schedule-` for scheduled prompts, or `agent-` for prompts sent by another agent. + #[doc(hidden)] + #[serde(skip_serializing_if = "Option::is_none")] + pub(crate) source: Option, + /// W3C Trace Context traceparent header for distributed tracing of this agent turn + #[serde(skip_serializing_if = "Option::is_none")] + pub traceparent: Option, + /// W3C Trace Context tracestate header for distributed tracing + #[serde(skip_serializing_if = "Option::is_none")] + pub tracestate: Option, + /// 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. + #[serde(skip_serializing_if = "Option::is_none")] + pub wait: Option, } -/// File path, content to write, and optional mode for the client-provided session filesystem. +/// Result of sending a user message /// ///
/// @@ -14899,19 +14931,12 @@ pub struct SessionFsStatResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionFsWriteFileRequest { - /// Target session identifier - pub session_id: SessionId, - /// Path using SessionFs conventions - pub path: String, - /// Content to write - pub content: String, - /// Optional POSIX-style mode for newly created files - #[serde(skip_serializing_if = "Option::is_none")] - pub mode: Option, +pub struct SendResult { + /// Unique identifier assigned to the message + pub message_id: String, } -/// Installed plugin record for a session, with marketplace, version, install time, enabled state, cache path, and source. +/// Internal request for sending a system notification. /// ///
/// @@ -14921,31 +14946,18 @@ pub struct SessionFsWriteFileRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionInstalledPlugin { - /// Path where the plugin is cached locally - #[serde(rename = "cache_path", skip_serializing_if = "Option::is_none")] - pub cache_path: Option, - /// Whether the plugin is currently enabled - pub enabled: bool, - /// Installation timestamp (ISO-8601) - #[serde(rename = "installed_at")] - pub installed_at: String, - /// Marketplace the plugin came from (empty string for direct repo installs) - pub marketplace: String, - /// Plugin name - pub name: String, - /// Source descriptor for direct repo installs (when marketplace is empty) +pub struct SendSystemNotificationRequest { + /// Optional structured notification kind. #[serde(skip_serializing_if = "Option::is_none")] - pub source: Option, - /// 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. - #[serde(rename = "source_sha", skip_serializing_if = "Option::is_none")] - pub source_sha: Option, - /// Installed version, if known + pub kind: Option, + /// Notification text to deliver to the model. + pub message: String, + /// Internal delivery options, including passive policy. #[serde(skip_serializing_if = "Option::is_none")] - pub version: Option, + pub options: Option, } -/// Source descriptor for a direct GitHub plugin install, with `owner/repo`, optional ref or full commit SHA, and optional subpath. +/// Agents discovered across user, project, plugin, and remote sources. /// ///
/// @@ -14955,23 +14967,12 @@ pub struct SessionInstalledPlugin { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionInstalledPluginSourceGitHub { - /// Optional repository-relative path to the plugin. - #[serde(skip_serializing_if = "Option::is_none")] - pub path: Option, - /// Optional Git ref to resolve. - #[serde(skip_serializing_if = "Option::is_none")] - pub r#ref: Option, - /// GitHub repository in `owner/repo` form. - pub repo: String, - /// Optional full 40-character hexadecimal commit SHA. - #[serde(skip_serializing_if = "Option::is_none")] - pub sha: Option, - /// Constant value. Always "github". - pub source: SessionInstalledPluginSourceGitHubSource, +pub struct ServerAgentList { + /// All discovered agents across all sources + pub agents: Vec, } -/// Source descriptor for a direct local plugin install, with a local filesystem path. +/// Instruction sources discovered across user, repository, and plugin sources. /// ///
/// @@ -14981,14 +14982,12 @@ pub struct SessionInstalledPluginSourceGitHub { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionInstalledPluginSourceLocal { - /// Local filesystem path to the plugin. - pub path: String, - /// Constant value. Always "local". - pub source: SessionInstalledPluginSourceLocalSource, +pub struct ServerInstructionSourceList { + /// All discovered instruction sources + pub sources: Vec, } -/// Source descriptor for a direct URL plugin install, with URL, optional ref or full commit SHA, and optional subpath. +/// Server-side skill metadata, including name, description, source, enabled/invocable state, path, project path, and argument hint. /// ///
/// @@ -14998,23 +14997,32 @@ pub struct SessionInstalledPluginSourceLocal { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionInstalledPluginSourceUrl { - /// Optional source-relative path to the plugin. +pub struct ServerSkill { + /// Optional freeform hint describing the skill's expected arguments, from the `argument-hint` frontmatter field #[serde(skip_serializing_if = "Option::is_none")] - pub path: Option, - /// Optional Git ref to resolve. + pub argument_hint: Option, + /// Canonical slash command name used to invoke the skill, without the leading '/' #[serde(skip_serializing_if = "Option::is_none")] - pub r#ref: Option, - /// Optional full 40-character hexadecimal commit SHA. + pub command_name: Option, + /// Description of what the skill does + pub description: String, + /// Whether the skill is currently enabled (based on global config) + pub enabled: bool, + /// Unique identifier for the skill + pub name: String, + /// Absolute path to the skill file #[serde(skip_serializing_if = "Option::is_none")] - pub sha: Option, - /// Constant value. Always "url". - pub source: SessionInstalledPluginSourceUrlSource, - /// URL of the plugin source. - pub url: String, + pub path: Option, + /// The project path this skill belongs to (only for project/inherited skills) + #[serde(skip_serializing_if = "Option::is_none")] + pub project_path: Option, + /// Source location type (e.g., project, personal-copilot, plugin, builtin) + pub source: SkillSource, + /// Whether the skill can be invoked by the user as a slash command + pub user_invocable: bool, } -/// Baseline data provenance for a prediction. +/// Skills discovered across global and project sources. /// ///
/// @@ -15024,14 +15032,15 @@ pub struct SessionInstalledPluginSourceUrl { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionLimitPredictionBaselineData { - /// End of the baseline data slice. - pub window_end: String, - /// Start of the baseline data slice. - pub window_start: String, +pub struct 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. + #[serde(skip_serializing_if = "Option::is_none")] + pub errors: Option>, + /// All discovered skills across all sources + pub skills: Vec, } -/// Semantic usage tier and its AI-credit cap. +/// Current activity flags for the session. /// ///
/// @@ -15041,14 +15050,14 @@ pub struct SessionLimitPredictionBaselineData { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionLimitPredictionTierOption { - /// AI-credit cap for this tier. - pub cap: f64, - /// Semantic usage tier. - pub tier: SessionLimitPredictionTier, +pub struct SessionActivity { + /// Whether an in-flight operation can currently be aborted. + pub abortable: bool, + /// Whether the session currently has active work, including running turns or tasks. + pub has_active_work: bool, } -/// Explainable AI-credit session-limit prediction. +/// Current authentication information, or null when no authentication is active. /// ///
/// @@ -15058,29 +15067,23 @@ pub struct SessionLimitPredictionTierOption { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionLimitPredictionDetails { - /// Baseline data provenance. - pub baseline_data: SessionLimitPredictionBaselineData, - /// Client population used for the prediction. - pub client_type: SessionLimitPredictionClientType, - /// Resolved model family when known. +pub struct SessionAuthInfoResult { + /// Snapshot of the authenticated user's Copilot subscription info, if known #[serde(skip_serializing_if = "Option::is_none")] - pub family: Option, - /// Model identifier used for lookup. - pub model_id: String, - /// Recommended maximum AI credits for this session. - pub recommended_cap: f64, - /// Tier chosen as the recommended cap. - pub recommended_tier: SessionLimitPredictionTier, - /// Baseline fallback level used to create the prediction. - pub source: SessionLimitPredictionSource, - /// Key matched at the source level, such as a model id, family id, or `global`. - pub source_key: String, - /// Ordered usage tiers and their AI-credit caps. - pub tiers: Vec, + pub copilot_user: Option, + /// Name of the environment variable that supplied the credential, when applicable + #[serde(skip_serializing_if = "Option::is_none")] + pub env_var: Option, + /// Authentication host + pub host: String, + /// Authenticated login, when available + #[serde(skip_serializing_if = "Option::is_none")] + pub login: Option, + /// Authentication type + pub r#type: AuthInfoType, } -/// Parameters for predicting an AI-credit session limit. Omitting `modelId` uses the session's currently selected model. +/// Internal GitHub login parameters. /// ///
/// @@ -15090,34 +15093,19 @@ pub struct SessionLimitPredictionDetails { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionLimitPredictionRequest { - /// Client type to size for. Defaults to `cli-interactive`. - #[serde(skip_serializing_if = "Option::is_none")] - pub client_type: Option, - /// Optional model identifier override. If omitted, the session's current model is used. +pub struct SessionAuthLoginRequest { + /// GitHub host URL + pub host: String, + /// GitHub login + pub login: String, + /// Whether to persist the token after login #[serde(skip_serializing_if = "Option::is_none")] - pub model_id: Option, -} - -#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct SessionLimitPredictionResultAvailable { - /// Prediction result variant discriminator. - pub kind: SessionLimitPredictionResultAvailableKind, - /// Predicted session limit details. - pub prediction: SessionLimitPredictionDetails, -} - -#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct SessionLimitPredictionResultUnavailable { - /// Prediction result variant discriminator. - pub kind: SessionLimitPredictionResultUnavailableKind, - /// Reason no prediction is available. - pub reason: SessionLimitPredictionUnavailableReason, + pub persist: Option, + /// GitHub authentication token + pub token: String, } -/// Sessions matching the filter, ordered most-recently-modified first. +/// Parameters identifying a GitHub authentication to log out. /// ///
/// @@ -15125,14 +15113,14 @@ pub struct SessionLimitPredictionResultUnavailable { /// and may change or be removed in future SDK or CLI releases. /// ///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionList { - /// Sessions ordered most-recently-modified first. Discriminated by `isRemote`. - pub sessions: Vec, +pub struct SessionAuthLogoutUserRequest { + /// Authentication information to log out + pub auth_info: AuthInfo, } -/// Optional filter applied to the returned sessions +/// Authentication status and account metadata for the session. /// ///
/// @@ -15142,22 +15130,27 @@ pub struct SessionList { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionListFilter { - /// Match sessions whose context.branch equals this value +pub struct SessionAuthStatus { + /// Authentication type #[serde(skip_serializing_if = "Option::is_none")] - pub branch: Option, - /// Match sessions whose context.cwd equals this value + pub auth_type: Option, + /// Copilot plan tier (e.g., individual_pro, business) #[serde(skip_serializing_if = "Option::is_none")] - pub cwd: Option, - /// Match sessions whose context.gitRoot equals this value + pub copilot_plan: Option, + /// Authentication host URL #[serde(skip_serializing_if = "Option::is_none")] - pub git_root: Option, - /// Match sessions whose context.repository equals this value + pub host: Option, + /// Whether the session has resolved authentication + pub is_authenticated: bool, + /// Authenticated login/username, if available #[serde(skip_serializing_if = "Option::is_none")] - pub repository: Option, + pub login: Option, + /// Human-readable authentication status description + #[serde(skip_serializing_if = "Option::is_none")] + pub status_message: Option, } -/// Queued repo-level startup prompts and the total hook command count after loading. +/// Parameters for switching the session's active authentication. /// ///
/// @@ -15165,16 +15158,17 @@ pub struct SessionListFilter { /// and may change or be removed in future SDK or CLI releases. /// ///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct 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. - pub hook_count: i64, - /// Repo-level startup prompts queued from repo hook configs. Empty on resume, when no repo configs were pending, or when disableAllHooks is set. - pub startup_prompts: Vec, +pub struct SessionAuthSwitchRequest { + /// Authentication information to activate + pub auth_info: AuthInfo, + /// Optional token paired with the authentication information + #[serde(skip_serializing_if = "Option::is_none")] + pub token: Option, } -/// Enterprise permission policy expressed with the runtime's managed permission-rule syntax. +/// Map of sessionId -> bytes freed by removing the session's workspace directory. /// ///
/// @@ -15184,121 +15178,59 @@ pub struct SessionLoadDeferredRepoHooksResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionManagedPermissions { - /// Permission rules that allow matching operations unless another managed source, deny, or ask rule restricts them. - #[serde(skip_serializing_if = "Option::is_none")] - pub allow: Option>, - /// Permission rules that require explicit human approval. - #[serde(skip_serializing_if = "Option::is_none")] - pub ask: Option>, - /// Permission rules that block matching operations. Deny has highest precedence. - #[serde(skip_serializing_if = "Option::is_none")] - pub deny: Option>, - /// When set to `disable`, prevents bypass/allow-all permission modes. - #[serde(skip_serializing_if = "Option::is_none")] - pub disable_bypass_permissions_mode: Option, +pub struct 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). + pub freed_bytes: HashMap, } -/// Managed settings an SDK host may inject at session startup. Only permissions are accepted in this initial contract. -/// -///
-/// -/// **Experimental.** This type is part of an experimental wire-protocol surface -/// and may change or be removed in future SDK or CLI releases. -/// -///
+/// The six normalized `/context` header buckets, computed from the same tokenization as `entries` so the two never disagree. Convenience rollups: `freeSpace` and `buffer` describe window capacity rather than occupied context, so the values do not sum to `totalTokens`. #[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionManagedSettings { - /// Managed permission policy injected by the SDK host. - #[serde(skip_serializing_if = "Option::is_none")] - pub permissions: Option, +pub struct SessionContextAttributionCategories { + /// Output reserve plus post-blocking-threshold buffer. + pub buffer: i64, + /// Custom-instructions tokens (0 when none are configured). + pub custom_instructions: i64, + /// Remaining unused window capacity (clamped at 0). + pub free_space: i64, + /// MCP tool-definition tokens. + pub mcp_tools: i64, + /// Conversation (user/assistant/tool) message tokens. + pub messages: i64, + /// System prompt tokens, excluding custom instructions. + pub system_prompt: i64, + /// Non-MCP tool-definition tokens. + pub system_tools: i64, } -/// Public-facing projection of workspace metadata for SDK / TUI consumers +/// Successful compaction history for the session. #[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionMetadataSnapshotWorkspace { - /// Branch checked out at session start, if any - #[serde(skip_serializing_if = "Option::is_none")] - pub branch: Option, - /// ISO 8601 timestamp when the workspace was created - #[serde(rename = "created_at", skip_serializing_if = "Option::is_none")] - pub created_at: Option, - /// Current working directory at session start - #[serde(skip_serializing_if = "Option::is_none")] - pub cwd: Option, - /// Resolved git root for cwd, if any - #[serde(rename = "git_root", skip_serializing_if = "Option::is_none")] - pub git_root: Option, - /// Repository host type, if known - #[serde(rename = "host_type", skip_serializing_if = "Option::is_none")] - pub host_type: Option, - /// Workspace identifier (1:1 with sessionId) - pub id: String, - /// Display name for the session, if set - #[serde(skip_serializing_if = "Option::is_none")] - pub name: Option, - /// Repository identifier in 'owner/repo' or 'org/project/repo' format, if any - #[serde(skip_serializing_if = "Option::is_none")] - pub repository: Option, - /// ISO 8601 timestamp when the workspace was last updated - #[serde(rename = "updated_at", skip_serializing_if = "Option::is_none")] - pub updated_at: Option, - /// Whether the display name was explicitly set by the user - #[serde(rename = "user_named", skip_serializing_if = "Option::is_none")] - pub user_named: Option, +pub struct SessionContextAttributionCompactions { + /// Number of successful compactions in this session. + pub count: i64, } -/// Point-in-time snapshot of slow-changing session identifier and state fields -/// -///
-/// -/// **Experimental.** This type is part of an experimental wire-protocol surface -/// and may change or be removed in future SDK or CLI releases. -/// -///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionMetadataSnapshot { - /// True when the session was detected to be in use by another process at construction time. Local consumers may surface a confirmation prompt before fully attaching. Always false for new sessions. - pub already_in_use: bool, - /// Runtime client name associated with the session (telemetry identifier). - #[serde(skip_serializing_if = "Option::is_none")] - pub client_name: Option, - /// The current agent mode for this session (e.g., 'interactive', 'plan', 'autopilot') - pub current_mode: MetadataSnapshotCurrentMode, - /// User-provided name supplied at session construction (via `--name`), if any. Immutable after construction. - #[serde(skip_serializing_if = "Option::is_none")] - pub initial_name: Option, - /// Whether this is a remote session (i.e., one whose runtime executes elsewhere and is steered through this process) - pub is_remote: bool, - /// ISO 8601 timestamp of when the session's persisted state was last modified on disk. For new sessions, equals startTime. For resumed sessions, reflects the previous modification time at construction. - pub modified_time: String, - /// Remote-session-specific metadata. Populated only when `isRemote` is true. Fields are immutable for the lifetime of the session. - #[serde(skip_serializing_if = "Option::is_none")] - pub remote_metadata: Option, - /// Currently selected model identifier, if any +pub struct SessionContextAttributionEntriesItem { + /// Supplementary per-entry metadata (e.g. `messageCount`, `role`, `evictable`, `pluginSource`). Values are stringified; parse as needed and ignore unrecognized keys. #[serde(skip_serializing_if = "Option::is_none")] - pub selected_model: Option, - /// The unique identifier of the session - pub session_id: SessionId, - /// Current session limits, or null when no limits are active - pub session_limits: Option, - /// ISO 8601 timestamp of when the session started - pub start_time: String, - /// Short human-readable summary of the session, if known. Omitted when no summary has been generated. + pub attributes: Option>, + /// Identifier for this entry, formed by joining its `kind` and source name (e.g. `tool:bash`, `skill:tmux`, `toolDefinition:bash`); unique within the snapshot. Use it to match the same entry across snapshots, to correlate with other APIs (skill/agent/MCP registries), and as the `parentId` target for nesting. Distinct from the human-facing `label`. + pub id: String, + /// Source category for this entry. Not a closed set — tolerate unknown values. Known values today: `skill`, `subagent`, `mcpServer`, `tool`, `system`, `toolDefinition`, `plugin`. + pub kind: String, + /// Human-readable display label, e.g. `bash` or `skill: tmux`. Presentation-only; may be localized/reformatted without notice — do not key off it. + pub label: String, + /// Optional `id` of the parent entry: e.g. a `plugin` entry parenting its `skill`/`mcpServer` entries, or the `system` entry parenting `toolDefinition` entries. Omitted for top-level entries. #[serde(skip_serializing_if = "Option::is_none")] - pub summary: Option, - /// Absolute path to the session's current working directory - pub working_directory: String, - /// Public-facing workspace metadata for this session, or null if the session has no associated workspace. Excludes runtime-internal fields (GitHub IDs, summary count, internal flags). - pub workspace: Option, - /// Absolute path to the session's workspace directory on disk, or null if the session has no associated workspace - pub workspace_path: Option, + pub parent_id: Option, + /// Token count currently in context attributable to this entry. + pub tokens: i64, } -/// Cost-category metadata for a CAPI model. +/// Per-source context-window attribution, or null if the session has not yet been initialized (no system prompt or tool metadata cached). /// ///
/// @@ -15308,14 +15240,30 @@ pub struct SessionMetadataSnapshot { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionModelPriceCategory { - /// CAPI model identifier. - pub id: String, - /// Cost category assigned to the model. - pub price_category: ModelPickerPriceCategory, +pub struct SessionContextAttribution { + /// Output reserve plus the tokens past the buffer-exhaustion blocking threshold. Mirrors `SessionContextInfo.bufferTokens`. + pub buffer_tokens: i64, + /// The six normalized `/context` header buckets, computed from the same tokenization as `entries` so the two never disagree. Convenience rollups: `freeSpace` and `buffer` describe window capacity rather than occupied context, so the values do not sum to `totalTokens`. + pub categories: SessionContextAttributionCategories, + /// Successful compaction history for the session. + pub compactions: SessionContextAttributionCompactions, + /// Token count at which background compaction starts. Mirrors `SessionContextInfo.compactionThreshold`. + pub compaction_threshold: i64, + /// Flat list of per-source attribution entries. Group by `kind` and render unrecognized kinds generically. Nesting and rollups are expressed via `parentId`. + pub entries: Vec, + /// Prompt limit plus the model's output reserve: the full context window `categories.freeSpace` and `categories.buffer` are measured against. Mirrors `SessionContextInfo.limit`. + pub limit: i64, + /// The concrete model id the entire breakdown was tokenized against (feeds the per-model token multiplier). Under `Auto` (Free/Student) this is the resolved model, not the literal `auto` sentinel, so totals are not undercounted. A single-model approximation of a potentially multi-model Auto session. + pub model_id: String, + /// How `modelId` was chosen. Not a closed set — tolerate unknown values. Known values today: `autoResolved` (the model Auto resolved to), `selected` (the user's explicitly selected model), `default` (a fallback before any model is known). + pub model_source: String, + /// Maximum prompt tokens the resolved model accepts — the denominator for a `##k/###k` context-usage display. Mirrors `SessionContextInfo.promptTokenLimit`. + pub prompt_token_limit: i64, + /// Total token count of the current context window the entries are measured against (system message + conversation messages + tool definitions — the same total reported by /context). Divide an entry's `tokens` by this to derive its share. + pub total_tokens: i64, } -/// The list of models available to this session. +/// Token breakdown for the current context window, or null if the session has not yet been initialized (no system prompt or tool metadata cached). /// ///
/// @@ -15325,18 +15273,30 @@ pub struct SessionModelPriceCategory { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct 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`). - pub list: Vec, - /// 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. - #[serde(skip_serializing_if = "Option::is_none")] - pub model_price_categories: Option>, - /// Per-quota snapshots returned alongside the model list, keyed by quota type. - #[serde(skip_serializing_if = "Option::is_none")] - pub quota_snapshots: Option>, +pub struct SessionContextInfo { + /// Output reserve plus tokens after the buffer-exhaustion blocking threshold (default 95%) + pub buffer_tokens: i64, + /// Token count at which background compaction starts (configurable percentage of promptTokenLimit) + pub compaction_threshold: i64, + /// Tokens consumed by user/assistant/tool messages + pub conversation_tokens: i64, + /// Prompt token limit plus the model's full output token limit. + pub limit: i64, + /// Tokens consumed by MCP tool definitions (subset of toolDefinitionsTokens, excludes deferred tools) + pub mcp_tools_tokens: i64, + /// The model used for token counting + pub model_name: String, + /// Maximum prompt tokens allowed by the model (or DEFAULT_TOKEN_LIMIT if unspecified) + pub prompt_token_limit: i64, + /// Tokens consumed by the system prompt + pub system_tokens: i64, + /// Tokens consumed by tool definitions sent to the model (excludes deferred tools) + pub tool_definitions_tokens: i64, + /// Sum of system, conversation and tool-definition tokens + pub total_tokens: i64, } -/// Source descriptor for a `sessions.open` content-exclusion rule, with source name and type. +/// The enriched metadata records, with summary and context fields backfilled where available. Sessions confirmed empty and unnamed are omitted. /// ///
/// @@ -15346,14 +15306,12 @@ pub struct SessionModelList { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionOpenOptionsAdditionalContentExclusionPolicyRuleSource { - /// Name of the policy source. - pub name: String, - /// Type of the policy source. - pub r#type: String, +pub struct SessionEnrichMetadataResult { + /// Enriched records, with summary and context backfilled. Sessions confirmed empty and unnamed may be omitted. + pub sessions: Vec, } -/// Single content-exclusion rule supplied to `sessions.open` options, with paths, match conditions, and source. +/// File path, content to append, and optional mode for the client-provided session filesystem. /// ///
/// @@ -15363,20 +15321,37 @@ pub struct SessionOpenOptionsAdditionalContentExclusionPolicyRuleSource { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionOpenOptionsAdditionalContentExclusionPolicyRule { - /// Conditions of which at least one must match. +pub struct SessionFsAppendFileRequest { + /// Target session identifier + pub session_id: SessionId, + /// Path using SessionFs conventions + pub path: String, + /// Content to append + pub content: String, + /// Optional POSIX-style mode for newly created files #[serde(skip_serializing_if = "Option::is_none")] - pub if_any_match: Option>, - /// Conditions none of which may match. + pub mode: Option, +} + +/// Describes a filesystem error. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionFsError { + /// Error classification + pub code: SessionFsErrorCode, + /// Free-form detail about the error, for logging/diagnostics #[serde(skip_serializing_if = "Option::is_none")] - pub if_none_match: Option>, - /// Path patterns covered by this rule. - pub paths: Vec, - /// Source descriptor for a `sessions.open` content-exclusion rule, with source name and type. - pub source: SessionOpenOptionsAdditionalContentExclusionPolicyRuleSource, + pub message: Option, } -/// Content-exclusion policy supplied to `sessions.open` options, with rules, last-updated data, and scope. +/// Path to test for existence in the client-provided session filesystem. /// ///
/// @@ -15386,33 +15361,29 @@ pub struct SessionOpenOptionsAdditionalContentExclusionPolicyRule { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionOpenOptionsAdditionalContentExclusionPolicy { - /// Opaque policy update timestamp supplied by the host. - #[serde(rename = "last_updated_at")] - pub last_updated_at: serde_json::Value, - /// Content-exclusion rules to apply. - pub rules: Vec, - /// Allowed values for the `SessionOpenOptionsAdditionalContentExclusionPolicyScope` enumeration. - pub scope: SessionOpenOptionsAdditionalContentExclusionPolicyScope, +pub struct SessionFsExistsRequest { + /// Target session identifier + pub session_id: SessionId, + /// Path using SessionFs conventions + pub path: String, } -/// Command-scoped GitHub credential injection for the shell commands an agent runs. +/// Indicates whether the requested path exists in the client-provided session filesystem. /// -/// 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. +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. /// -/// 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. +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionFsExistsResult { + /// Whether the path exists + pub exists: bool, +} + +/// Directory path to create in the client-provided session filesystem, with options for recursive creation and POSIX mode. /// ///
/// @@ -15422,28 +15393,20 @@ pub struct SessionOpenOptionsAdditionalContentExclusionPolicy { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct 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..extraheader` is scoped - /// to one host by construction. Default: false (opt-in). +pub struct SessionFsMkdirRequest { + /// Target session identifier + pub session_id: SessionId, + /// Path using SessionFs conventions + pub path: String, + /// Create parent directories as needed #[serde(skip_serializing_if = "Option::is_none")] - pub gh: Option, - /// Whether to authenticate the agent's `git` commands as the session's GitHub credential, by - /// injecting an `http..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). + pub recursive: Option, + /// Optional POSIX-style mode for newly created directories #[serde(skip_serializing_if = "Option::is_none")] - pub git: Option, + pub mode: Option, } -/// A host-provided script sourced before each built-in shell command when its shell target matches the active shell. +/// Directory path whose entries should be listed from the client-provided session filesystem. /// ///
/// @@ -15453,14 +15416,14 @@ pub struct ShellCredentials { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ShellInitScript { - /// Path to the script to source. +pub struct SessionFsReaddirRequest { + /// Target session identifier + pub session_id: SessionId, + /// Path using SessionFs conventions pub path: String, - /// Built-in shell that may source this script. - pub shell: ShellInitScriptShell, } -/// Per-session settings for built-in shell tools. +/// Names of entries in the requested directory, or a filesystem error if the read failed. /// ///
/// @@ -15470,32 +15433,15 @@ pub struct ShellInitScript { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ShellOptions { - /// Command-scoped GitHub credential injection for shell commands. - #[serde(skip_serializing_if = "Option::is_none")] - pub credentials: Option, - /// Controls automatic non-interactive profile loading where supported. Explicit initScripts are unaffected. - #[serde(skip_serializing_if = "Option::is_none")] - pub init_profile: Option, - /// 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. - #[serde(skip_serializing_if = "Option::is_none")] - pub init_scripts: Option>, - /// 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`. +pub struct SessionFsReaddirResult { + /// Entry names in the directory + pub entries: Vec, + /// Describes a filesystem error. #[serde(skip_serializing_if = "Option::is_none")] - pub process_flags: Option>, + pub error: Option, } -/// Session construction options. +/// Directory entry returned by session filesystem `readdirWithTypes`, with name and entry type. /// ///
/// @@ -15505,43 +15451,1008 @@ pub struct ShellOptions { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionOpenOptions { - /// Additional content-exclusion policies to merge into the session policy set. - /// - ///
- /// - /// **Experimental.** This type is part of an experimental wire-protocol surface - /// and may change or be removed in future SDK or CLI releases. - /// - ///
- #[serde(skip_serializing_if = "Option::is_none")] - pub additional_content_exclusion_policies: - Option>, - /// Additional directories the agent may access beyond the working directory. Each entry is granted to the session's file-access allow-list and surfaced to the model (system prompt context and `@`-mention completion). Absolute paths are recommended; a relative path is resolved against the session's working directory. Nonexistent or unresolvable entries are skipped with a warning. This is applied on both session creation and resume, and is not persisted: a resumed session that omits this option does not retain previously supplied directories (re-supply them, exactly as the CLI re-passes `--add-dir`). - #[serde(skip_serializing_if = "Option::is_none")] - pub additional_directories: Option>, - /// Runtime context discriminator for agent filtering. - #[serde(skip_serializing_if = "Option::is_none")] - pub agent_context: Option, - /// Whether to include instructions from every MCP server in the system prompt instead of only allowlisted servers. - #[serde(skip_serializing_if = "Option::is_none")] - pub allow_all_mcp_server_instructions: Option, - /// Whether ask_user is explicitly disabled. - #[serde(skip_serializing_if = "Option::is_none")] - pub ask_user_disabled: Option, - /// Initial authentication info for the session. - #[serde(skip_serializing_if = "Option::is_none")] - pub auth_info: Option, - /// Allowlist of available tool names. - #[serde(skip_serializing_if = "Option::is_none")] - pub available_tools: Option>, - /// Options scoped to the built-in CAPI (Copilot API) provider. - #[serde(skip_serializing_if = "Option::is_none")] - pub capi: Option, - /// Structured client kind used for runtime behavior gates. - #[serde(skip_serializing_if = "Option::is_none")] - pub client_kind: Option, - /// Identifier of the client driving the session. +pub struct SessionFsReaddirWithTypesEntry { + /// Entry name + pub name: String, + /// Entry type + pub r#type: SessionFsReaddirWithTypesEntryType, +} + +/// Directory path whose entries (with type information) should be listed from the client-provided session filesystem. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionFsReaddirWithTypesRequest { + /// Target session identifier + pub session_id: SessionId, + /// Path using SessionFs conventions + pub path: String, +} + +/// Entries in the requested directory paired with file/directory type information, or a filesystem error if the read failed. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionFsReaddirWithTypesResult { + /// Directory entries with type information + pub entries: Vec, + /// Describes a filesystem error. + #[serde(skip_serializing_if = "Option::is_none")] + pub error: Option, +} + +/// Path of the file to read from the client-provided session filesystem. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionFsReadFileRequest { + /// Target session identifier + pub session_id: SessionId, + /// Path using SessionFs conventions + pub path: String, +} + +/// File content as a UTF-8 string, or a filesystem error if the read failed. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionFsReadFileResult { + /// File content as UTF-8 string + pub content: String, + /// Describes a filesystem error. + #[serde(skip_serializing_if = "Option::is_none")] + pub error: Option, +} + +/// Source and destination paths for renaming or moving an entry in the client-provided session filesystem. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionFsRenameRequest { + /// Target session identifier + pub session_id: SessionId, + /// Source path using SessionFs conventions + pub src: String, + /// Destination path using SessionFs conventions + pub dest: String, +} + +/// Path to remove from the client-provided session filesystem, with options for recursive removal and force. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionFsRmRequest { + /// Target session identifier + pub session_id: SessionId, + /// Path using SessionFs conventions + pub path: String, + /// Remove directories and their contents recursively + #[serde(skip_serializing_if = "Option::is_none")] + pub recursive: Option, + /// Ignore errors if the path does not exist + #[serde(skip_serializing_if = "Option::is_none")] + pub force: Option, +} + +/// Optional capabilities declared by the provider +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionFsSetProviderCapabilities { + /// Whether the provider supports SQLite query/exists operations + #[serde(skip_serializing_if = "Option::is_none")] + pub sqlite: Option, +} + +/// Initial working directory, session-state path layout, and path conventions used to register the calling SDK client as the session filesystem provider. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionFsSetProviderRequest { + /// Optional capabilities declared by the provider + #[serde(skip_serializing_if = "Option::is_none")] + pub capabilities: Option, + /// Path conventions used by this filesystem + pub conventions: SessionFsSetProviderConventions, + /// Initial working directory for sessions + pub initial_cwd: String, + /// Path within each session's SessionFs where the runtime stores files for that session + pub session_state_path: String, +} + +/// Indicates whether the calling client was registered as the session filesystem provider. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionFsSetProviderResult { + /// Whether the provider was set successfully + pub success: bool, +} + +/// Indicates whether the per-session SQLite database already exists. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionFsSqliteExistsResult { + /// Whether the session database already exists + pub exists: bool, +} + +/// SQL query, query type, and optional bind parameters for executing a SQLite query against the per-session database. The provider applies its SQLite busy timeout for every call. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionFsSqliteQueryRequest { + /// Target session identifier + pub session_id: SessionId, + /// SQL query to execute + pub query: String, + /// How to execute the query: 'exec' for DDL/multi-statement (no results), 'query' for SELECT (returns rows), 'run' for INSERT/UPDATE/DELETE (returns rowsAffected) + pub query_type: SessionFsSqliteQueryType, + /// Optional named bind parameters + #[serde(skip_serializing_if = "Option::is_none")] + pub params: Option>, +} + +/// Query results including rows, columns, and rows affected, or a filesystem error if execution failed. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionFsSqliteQueryResult { + /// Column names from the result set + pub columns: Vec, + /// Describes a filesystem error. + #[serde(skip_serializing_if = "Option::is_none")] + pub error: Option, + /// SQLite last_insert_rowid() value for INSERT. + #[serde(skip_serializing_if = "Option::is_none")] + pub last_insert_rowid: Option, + /// For SELECT: array of row objects. For others: empty array. + pub rows: Vec>, + /// Number of rows affected (for INSERT/UPDATE/DELETE) + pub rows_affected: i64, +} + +/// Classified SQLite transaction failure. busyOrLocked guarantees rollback; postCommitAmbiguous must never be retried. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionFsSqliteTransactionError { + /// Machine-readable classification of the transaction failure. + pub error_class: SessionFsSqliteTransactionErrorClass, + /// Human-readable transaction failure message. + pub message: String, +} + +/// One statement in an atomic SQLite transaction. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionFsSqliteTransactionStatement { + /// Optional named bind parameters. + #[serde(skip_serializing_if = "Option::is_none")] + pub params: Option>, + /// SQL statement to execute. + pub query: String, + /// How to execute the statement. + pub query_type: SessionFsSqliteQueryType, +} + +/// Statements to execute atomically. Providers apply busy handling for every call. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionFsSqliteTransactionRequest { + /// Target session identifier + pub session_id: SessionId, + /// Ordered SQL statements to execute in one transaction. + pub statements: Vec, +} + +/// Per-statement results, or a classified transaction error. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionFsSqliteTransactionResult { + /// Classified transaction failure, when execution did not succeed. + #[serde(skip_serializing_if = "Option::is_none")] + pub error: Option, + /// Per-statement query results in input order. + pub results: Vec, +} + +/// Path whose metadata should be returned from the client-provided session filesystem. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionFsStatRequest { + /// Target session identifier + pub session_id: SessionId, + /// Path using SessionFs conventions + pub path: String, +} + +/// Filesystem metadata for the requested path, or a filesystem error if the stat failed. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionFsStatResult { + /// ISO 8601 timestamp of creation + pub birthtime: String, + /// Describes a filesystem error. + #[serde(skip_serializing_if = "Option::is_none")] + pub error: Option, + /// Whether the path is a directory + pub is_directory: bool, + /// Whether the path is a file + pub is_file: bool, + /// ISO 8601 timestamp of last modification + pub mtime: String, + /// File size in bytes + pub size: i64, +} + +/// File path, content to write, and optional mode for the client-provided session filesystem. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionFsWriteFileRequest { + /// Target session identifier + pub session_id: SessionId, + /// Path using SessionFs conventions + pub path: String, + /// Content to write + pub content: String, + /// Optional POSIX-style mode for newly created files + #[serde(skip_serializing_if = "Option::is_none")] + pub mode: Option, +} + +/// Installed plugin record for a session, with marketplace, version, install time, enabled state, cache path, and source. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionInstalledPlugin { + /// Path where the plugin is cached locally + #[serde(rename = "cache_path", skip_serializing_if = "Option::is_none")] + pub cache_path: Option, + /// Whether the plugin is currently enabled + pub enabled: bool, + /// Installation timestamp (ISO-8601) + #[serde(rename = "installed_at")] + pub installed_at: String, + /// Marketplace the plugin came from (empty string for direct repo installs) + pub marketplace: String, + /// Plugin name + pub name: String, + /// Source descriptor for direct repo installs (when marketplace is empty) + #[serde(skip_serializing_if = "Option::is_none")] + pub source: Option, + /// 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. + #[serde(rename = "source_sha", skip_serializing_if = "Option::is_none")] + pub source_sha: Option, + /// Installed version, if known + #[serde(skip_serializing_if = "Option::is_none")] + pub version: Option, +} + +/// Source descriptor for a direct GitHub plugin install, with `owner/repo`, optional ref or full commit SHA, and optional subpath. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionInstalledPluginSourceGitHub { + /// Optional repository-relative path to the plugin. + #[serde(skip_serializing_if = "Option::is_none")] + pub path: Option, + /// Optional Git ref to resolve. + #[serde(skip_serializing_if = "Option::is_none")] + pub r#ref: Option, + /// GitHub repository in `owner/repo` form. + pub repo: String, + /// Optional full 40-character hexadecimal commit SHA. + #[serde(skip_serializing_if = "Option::is_none")] + pub sha: Option, + /// Constant value. Always "github". + pub source: SessionInstalledPluginSourceGitHubSource, +} + +/// Source descriptor for a direct local plugin install, with a local filesystem path. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionInstalledPluginSourceLocal { + /// Local filesystem path to the plugin. + pub path: String, + /// Constant value. Always "local". + pub source: SessionInstalledPluginSourceLocalSource, +} + +/// Source descriptor for a direct URL plugin install, with URL, optional ref or full commit SHA, and optional subpath. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionInstalledPluginSourceUrl { + /// Optional source-relative path to the plugin. + #[serde(skip_serializing_if = "Option::is_none")] + pub path: Option, + /// Optional Git ref to resolve. + #[serde(skip_serializing_if = "Option::is_none")] + pub r#ref: Option, + /// Optional full 40-character hexadecimal commit SHA. + #[serde(skip_serializing_if = "Option::is_none")] + pub sha: Option, + /// Constant value. Always "url". + pub source: SessionInstalledPluginSourceUrlSource, + /// URL of the plugin source. + pub url: String, +} + +/// Baseline data provenance for a prediction. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionLimitPredictionBaselineData { + /// End of the baseline data slice. + pub window_end: String, + /// Start of the baseline data slice. + pub window_start: String, +} + +/// Semantic usage tier and its AI-credit cap. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionLimitPredictionTierOption { + /// AI-credit cap for this tier. + pub cap: f64, + /// Semantic usage tier. + pub tier: SessionLimitPredictionTier, +} + +/// Explainable AI-credit session-limit prediction. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionLimitPredictionDetails { + /// Baseline data provenance. + pub baseline_data: SessionLimitPredictionBaselineData, + /// Client population used for the prediction. + pub client_type: SessionLimitPredictionClientType, + /// Resolved model family when known. + #[serde(skip_serializing_if = "Option::is_none")] + pub family: Option, + /// Model identifier used for lookup. + pub model_id: String, + /// Recommended maximum AI credits for this session. + pub recommended_cap: f64, + /// Tier chosen as the recommended cap. + pub recommended_tier: SessionLimitPredictionTier, + /// Baseline fallback level used to create the prediction. + pub source: SessionLimitPredictionSource, + /// Key matched at the source level, such as a model id, family id, or `global`. + pub source_key: String, + /// Ordered usage tiers and their AI-credit caps. + pub tiers: Vec, +} + +/// Parameters for predicting an AI-credit session limit. Omitting `modelId` uses the session's currently selected model. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionLimitPredictionRequest { + /// Client type to size for. Defaults to `cli-interactive`. + #[serde(skip_serializing_if = "Option::is_none")] + pub client_type: Option, + /// Optional model identifier override. If omitted, the session's current model is used. + #[serde(skip_serializing_if = "Option::is_none")] + pub model_id: Option, +} + +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionLimitPredictionResultAvailable { + /// Prediction result variant discriminator. + pub kind: SessionLimitPredictionResultAvailableKind, + /// Predicted session limit details. + pub prediction: SessionLimitPredictionDetails, +} + +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionLimitPredictionResultUnavailable { + /// Prediction result variant discriminator. + pub kind: SessionLimitPredictionResultUnavailableKind, + /// Reason no prediction is available. + pub reason: SessionLimitPredictionUnavailableReason, +} + +/// Sessions matching the filter, ordered most-recently-modified first. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionList { + /// Sessions ordered most-recently-modified first. Discriminated by `isRemote`. + pub sessions: Vec, +} + +/// Optional filter applied to the returned sessions +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionListFilter { + /// Match sessions whose context.branch equals this value + #[serde(skip_serializing_if = "Option::is_none")] + pub branch: Option, + /// Match sessions whose context.cwd equals this value + #[serde(skip_serializing_if = "Option::is_none")] + pub cwd: Option, + /// Match sessions whose context.gitRoot equals this value + #[serde(skip_serializing_if = "Option::is_none")] + pub git_root: Option, + /// Match sessions whose context.repository equals this value + #[serde(skip_serializing_if = "Option::is_none")] + pub repository: Option, +} + +/// Queued repo-level startup prompts and the total hook command count after loading. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct 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. + pub hook_count: i64, + /// Repo-level startup prompts queued from repo hook configs. Empty on resume, when no repo configs were pending, or when disableAllHooks is set. + pub startup_prompts: Vec, +} + +/// Enterprise permission policy expressed with the runtime's managed permission-rule syntax. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionManagedPermissions { + /// Permission rules that allow matching operations unless another managed source, deny, or ask rule restricts them. + #[serde(skip_serializing_if = "Option::is_none")] + pub allow: Option>, + /// Permission rules that require explicit human approval. + #[serde(skip_serializing_if = "Option::is_none")] + pub ask: Option>, + /// Permission rules that block matching operations. Deny has highest precedence. + #[serde(skip_serializing_if = "Option::is_none")] + pub deny: Option>, + /// When set to `disable`, prevents bypass/allow-all permission modes. + #[serde(skip_serializing_if = "Option::is_none")] + pub disable_bypass_permissions_mode: Option, +} + +/// Managed settings an SDK host may inject at session startup. Only permissions are accepted in this initial contract. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionManagedSettings { + /// Managed permission policy injected by the SDK host. + #[serde(skip_serializing_if = "Option::is_none")] + pub permissions: Option, +} + +/// Public-facing projection of workspace metadata for SDK / TUI consumers +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionMetadataSnapshotWorkspace { + /// Branch checked out at session start, if any + #[serde(skip_serializing_if = "Option::is_none")] + pub branch: Option, + /// ISO 8601 timestamp when the workspace was created + #[serde(rename = "created_at", skip_serializing_if = "Option::is_none")] + pub created_at: Option, + /// Current working directory at session start + #[serde(skip_serializing_if = "Option::is_none")] + pub cwd: Option, + /// Resolved git root for cwd, if any + #[serde(rename = "git_root", skip_serializing_if = "Option::is_none")] + pub git_root: Option, + /// Repository host type, if known + #[serde(rename = "host_type", skip_serializing_if = "Option::is_none")] + pub host_type: Option, + /// Workspace identifier (1:1 with sessionId) + pub id: String, + /// Display name for the session, if set + #[serde(skip_serializing_if = "Option::is_none")] + pub name: Option, + /// Repository identifier in 'owner/repo' or 'org/project/repo' format, if any + #[serde(skip_serializing_if = "Option::is_none")] + pub repository: Option, + /// ISO 8601 timestamp when the workspace was last updated + #[serde(rename = "updated_at", skip_serializing_if = "Option::is_none")] + pub updated_at: Option, + /// Whether the display name was explicitly set by the user + #[serde(rename = "user_named", skip_serializing_if = "Option::is_none")] + pub user_named: Option, +} + +/// Point-in-time snapshot of slow-changing session identifier and state fields +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionMetadataSnapshot { + /// True when the session was detected to be in use by another process at construction time. Local consumers may surface a confirmation prompt before fully attaching. Always false for new sessions. + pub already_in_use: bool, + /// Runtime client name associated with the session (telemetry identifier). + #[serde(skip_serializing_if = "Option::is_none")] + pub client_name: Option, + /// The current agent mode for this session (e.g., 'interactive', 'plan', 'autopilot') + pub current_mode: MetadataSnapshotCurrentMode, + /// User-provided name supplied at session construction (via `--name`), if any. Immutable after construction. + #[serde(skip_serializing_if = "Option::is_none")] + pub initial_name: Option, + /// Whether this is a remote session (i.e., one whose runtime executes elsewhere and is steered through this process) + pub is_remote: bool, + /// ISO 8601 timestamp of when the session's persisted state was last modified on disk. For new sessions, equals startTime. For resumed sessions, reflects the previous modification time at construction. + pub modified_time: String, + /// Remote-session-specific metadata. Populated only when `isRemote` is true. Fields are immutable for the lifetime of the session. + #[serde(skip_serializing_if = "Option::is_none")] + pub remote_metadata: Option, + /// Currently selected model identifier, if any + #[serde(skip_serializing_if = "Option::is_none")] + pub selected_model: Option, + /// The unique identifier of the session + pub session_id: SessionId, + /// Current session limits, or null when no limits are active + pub session_limits: Option, + /// ISO 8601 timestamp of when the session started + pub start_time: String, + /// Short human-readable summary of the session, if known. Omitted when no summary has been generated. + #[serde(skip_serializing_if = "Option::is_none")] + pub summary: Option, + /// Absolute path to the session's current working directory + pub working_directory: String, + /// Public-facing workspace metadata for this session, or null if the session has no associated workspace. Excludes runtime-internal fields (GitHub IDs, summary count, internal flags). + pub workspace: Option, + /// Absolute path to the session's workspace directory on disk, or null if the session has no associated workspace + pub workspace_path: Option, +} + +/// Cost-category metadata for a CAPI model. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionModelPriceCategory { + /// CAPI model identifier. + pub id: String, + /// Cost category assigned to the model. + pub price_category: ModelPickerPriceCategory, +} + +/// The list of models available to this session. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct 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`). + pub list: Vec, + /// 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. + #[serde(skip_serializing_if = "Option::is_none")] + pub model_price_categories: Option>, + /// Per-quota snapshots returned alongside the model list, keyed by quota type. + #[serde(skip_serializing_if = "Option::is_none")] + pub quota_snapshots: Option>, +} + +/// Source descriptor for a `sessions.open` content-exclusion rule, with source name and type. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionOpenOptionsAdditionalContentExclusionPolicyRuleSource { + /// Name of the policy source. + pub name: String, + /// Type of the policy source. + pub r#type: String, +} + +/// Single content-exclusion rule supplied to `sessions.open` options, with paths, match conditions, and source. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionOpenOptionsAdditionalContentExclusionPolicyRule { + /// Conditions of which at least one must match. + #[serde(skip_serializing_if = "Option::is_none")] + pub if_any_match: Option>, + /// Conditions none of which may match. + #[serde(skip_serializing_if = "Option::is_none")] + pub if_none_match: Option>, + /// Path patterns covered by this rule. + pub paths: Vec, + /// Source descriptor for a `sessions.open` content-exclusion rule, with source name and type. + pub source: SessionOpenOptionsAdditionalContentExclusionPolicyRuleSource, +} + +/// Content-exclusion policy supplied to `sessions.open` options, with rules, last-updated data, and scope. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionOpenOptionsAdditionalContentExclusionPolicy { + /// Opaque policy update timestamp supplied by the host. + #[serde(rename = "last_updated_at")] + pub last_updated_at: serde_json::Value, + /// Content-exclusion rules to apply. + pub rules: Vec, + /// Allowed values for the `SessionOpenOptionsAdditionalContentExclusionPolicyScope` enumeration. + pub scope: SessionOpenOptionsAdditionalContentExclusionPolicyScope, +} + +/// 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.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct 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..extraheader` is scoped + /// to one host by construction. Default: false (opt-in). + #[serde(skip_serializing_if = "Option::is_none")] + pub gh: Option, + /// Whether to authenticate the agent's `git` commands as the session's GitHub credential, by + /// injecting an `http..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). + #[serde(skip_serializing_if = "Option::is_none")] + pub git: Option, +} + +/// A host-provided script sourced before each built-in shell command when its shell target matches the active shell. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct ShellInitScript { + /// Path to the script to source. + pub path: String, + /// Built-in shell that may source this script. + pub shell: ShellInitScriptShell, +} + +/// Per-session settings for built-in shell tools. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct ShellOptions { + /// Command-scoped GitHub credential injection for shell commands. + #[serde(skip_serializing_if = "Option::is_none")] + pub credentials: Option, + /// Controls automatic non-interactive profile loading where supported. Explicit initScripts are unaffected. + #[serde(skip_serializing_if = "Option::is_none")] + pub init_profile: Option, + /// 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. + #[serde(skip_serializing_if = "Option::is_none")] + pub init_scripts: Option>, + /// 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`. + #[serde(skip_serializing_if = "Option::is_none")] + pub process_flags: Option>, +} + +/// Session construction options. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionOpenOptions { + /// Additional content-exclusion policies to merge into the session policy set. + /// + ///
+ /// + /// **Experimental.** This type is part of an experimental wire-protocol surface + /// and may change or be removed in future SDK or CLI releases. + /// + ///
+ #[serde(skip_serializing_if = "Option::is_none")] + pub additional_content_exclusion_policies: + Option>, + /// Additional directories the agent may access beyond the working directory. Each entry is granted to the session's file-access allow-list and surfaced to the model (system prompt context and `@`-mention completion). Absolute paths are recommended; a relative path is resolved against the session's working directory. Nonexistent or unresolvable entries are skipped with a warning. This is applied on both session creation and resume, and is not persisted: a resumed session that omits this option does not retain previously supplied directories (re-supply them, exactly as the CLI re-passes `--add-dir`). + #[serde(skip_serializing_if = "Option::is_none")] + pub additional_directories: Option>, + /// Runtime context discriminator for agent filtering. + #[serde(skip_serializing_if = "Option::is_none")] + pub agent_context: Option, + /// Whether to include instructions from every MCP server in the system prompt instead of only allowlisted servers. + #[serde(skip_serializing_if = "Option::is_none")] + pub allow_all_mcp_server_instructions: Option, + /// Whether ask_user is explicitly disabled. + #[serde(skip_serializing_if = "Option::is_none")] + pub ask_user_disabled: Option, + /// Initial authentication info for the session. + #[serde(skip_serializing_if = "Option::is_none")] + pub auth_info: Option, + /// Allowlist of available tool names. + #[serde(skip_serializing_if = "Option::is_none")] + pub available_tools: Option>, + /// Options scoped to the built-in CAPI (Copilot API) provider. + #[serde(skip_serializing_if = "Option::is_none")] + pub capi: Option, + /// Structured client kind used for runtime behavior gates. + #[serde(skip_serializing_if = "Option::is_none")] + pub client_kind: Option, + /// Identifier of the client driving the session. #[serde(skip_serializing_if = "Option::is_none")] pub client_name: Option, /// Whether commit-message coauthor trailers are enabled. @@ -15617,131 +16528,635 @@ pub struct SessionOpenOptions { /// ExP assignment ('flight') data injected by an SDK integrator, in the same JSON shape the Copilot CLI fetches from the experimentation service (CopilotExpAssignmentResponse). When supplied this is fed into the FeatureFlagService exactly like CLI-fetched assignments and ExP-backed flags wait for it. When absent the session does not block on ExP. #[doc(hidden)] #[serde(skip_serializing_if = "Option::is_none")] - pub(crate) exp_assignments: Option, - /// Feature-flag values resolved by the host. + pub(crate) exp_assignments: Option, + /// Feature-flag values resolved by the host. + #[serde(skip_serializing_if = "Option::is_none")] + pub feature_flags: Option>, + /// 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. + #[serde(skip_serializing_if = "Option::is_none")] + pub included_builtin_agents: Option>, + /// Installed plugins visible to the session. + #[serde(skip_serializing_if = "Option::is_none")] + pub installed_plugins: Option>, + /// Stable integration identifier for analytics. + #[serde(skip_serializing_if = "Option::is_none")] + pub integration_id: Option, + /// Whether experimental behavior is enabled. + #[serde(skip_serializing_if = "Option::is_none")] + pub is_experimental_mode: Option, + /// Whether interactive shell sessions are logged. + #[serde(skip_serializing_if = "Option::is_none")] + pub log_interactive_shells: Option, + /// Identifier sent to LSP-style integrations. + #[serde(skip_serializing_if = "Option::is_none")] + pub lsp_client_name: Option, + /// Permissions-only enterprise policy injected by the SDK host at session create or resume. Composes restrictively with self-fetched and device policy and is not persisted. + #[serde(skip_serializing_if = "Option::is_none")] + pub managed_settings: Option, + /// Maximum decoded byte size of a single inline model-facing binary tool result persisted in session events (default 10 MB). + #[serde(skip_serializing_if = "Option::is_none")] + pub max_inline_binary_bytes: Option, + /// Memory configuration for this session. + #[serde(skip_serializing_if = "Option::is_none")] + pub memory: Option, + /// Initial model identifier. + #[serde(skip_serializing_if = "Option::is_none")] + pub model: Option, + /// Initial model capability overrides. + #[serde(skip_serializing_if = "Option::is_none")] + pub model_capabilities_overrides: Option, + /// BYOK model definitions added to the selectable model list, each referencing a provider name. + /// + ///
+ /// + /// **Experimental.** This type is part of an experimental wire-protocol surface + /// and may change or be removed in future SDK or CLI releases. + /// + ///
+ #[serde(skip_serializing_if = "Option::is_none")] + pub models: Option>, + /// Optional human-friendly session name. + #[serde(skip_serializing_if = "Option::is_none")] + pub name: Option, + /// Custom model-provider configuration (BYOK). + #[serde(skip_serializing_if = "Option::is_none")] + pub provider: Option, + /// Named BYOK provider connections, additive to CAPI auth. Combining with `provider` is rejected. + /// + ///
+ /// + /// **Experimental.** This type is part of an experimental wire-protocol surface + /// and may change or be removed in future SDK or CLI releases. + /// + ///
+ #[serde(skip_serializing_if = "Option::is_none")] + pub providers: Option>, + /// Initial reasoning effort level. CAPI values are model-defined and validated against the selected model; BYOK providers may define additional values. When omitted, no effort override is applied. + #[serde(skip_serializing_if = "Option::is_none")] + pub reasoning_effort: Option, + /// Initial reasoning summary mode for supported model clients. + #[serde(skip_serializing_if = "Option::is_none")] + pub reasoning_summary: Option, + /// Telemetry-only remote-defaulted flag. + #[serde(skip_serializing_if = "Option::is_none")] + pub remote_defaulted_on: Option, + /// Telemetry-only remote exporting flag. + #[serde(skip_serializing_if = "Option::is_none")] + pub remote_exporting: Option, + /// Whether this session supports remote steering. + #[serde(skip_serializing_if = "Option::is_none")] + pub remote_steerable: Option, + /// Whether the host is an interactive UI. + #[serde(skip_serializing_if = "Option::is_none")] + pub running_in_interactive_mode: Option, + /// Resolved sandbox configuration. + #[serde(skip_serializing_if = "Option::is_none")] + pub sandbox_config: Option, + /// Capabilities enabled for this session. + #[serde(skip_serializing_if = "Option::is_none")] + pub session_capabilities: Option>, + /// Optional stable session identifier to use for a new session. + #[serde(skip_serializing_if = "Option::is_none")] + pub session_id: Option, + /// Initial session limits. + #[serde(skip_serializing_if = "Option::is_none")] + pub session_limits: Option, + /// Per-session settings for built-in shell tools. + #[serde(skip_serializing_if = "Option::is_none")] + pub shell: Option, + /// Use shell.initProfile instead. Shell init profile. + #[doc(hidden)] + #[deprecated] + #[serde(skip_serializing_if = "Option::is_none")] + pub shell_init_profile: Option, + /// PowerShell process flags applied to built-in and user-requested shell commands. + #[serde(skip_serializing_if = "Option::is_none")] + pub shell_process_flags: Option>, + /// Additional directories to search for skills. + #[serde(skip_serializing_if = "Option::is_none")] + pub skill_directories: Option>, + /// Whether to skip custom instruction sources. + #[serde(skip_serializing_if = "Option::is_none")] + pub skip_custom_instructions: Option, + /// Optional trajectory output file path. + #[serde(skip_serializing_if = "Option::is_none")] + pub trajectory_file: Option, + /// Initial output verbosity level for supported models. + #[serde(skip_serializing_if = "Option::is_none")] + pub verbosity: Option, + /// Working directory to anchor the session. + #[serde(skip_serializing_if = "Option::is_none")] + pub working_directory: Option, + /// Pre-resolved working-directory context for session startup. + #[serde(skip_serializing_if = "Option::is_none")] + pub working_directory_context: Option, +} + +/// Parameters for creating a new local session. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionsOpenCreate { + /// Whether to emit session.start during creation. Defaults to true. + #[serde(skip_serializing_if = "Option::is_none")] + pub emit_start: Option, + /// Create a new local session. + pub kind: SessionsOpenCreateKind, + /// Session construction options. + #[serde(skip_serializing_if = "Option::is_none")] + pub options: Option, +} + +/// Parameters for resuming a specific local session. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionsOpenResume { + /// Resume a specific local session by ID or prefix. + pub kind: SessionsOpenResumeKind, + /// Session resume options. + #[serde(skip_serializing_if = "Option::is_none")] + pub options: Option, + /// Whether to emit session.resume after loading. Defaults to true. + #[serde(skip_serializing_if = "Option::is_none")] + pub resume: Option, + /// Session ID or unique prefix to resume. + pub session_id: SessionId, + /// Suppress workspace.yaml metadata writeback when resuming from an incidental cwd. + #[serde(skip_serializing_if = "Option::is_none")] + pub suppress_resume_workspace_metadata_writeback: Option, +} + +/// Parameters for resuming the most relevant local session. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionsOpenResumeLast { + /// Working-directory context used to choose the most relevant session. #[serde(skip_serializing_if = "Option::is_none")] - pub feature_flags: Option>, - /// 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. + pub context: Option, + /// Resume the most relevant existing local session. + pub kind: SessionsOpenResumeLastKind, + /// Session resume options. #[serde(skip_serializing_if = "Option::is_none")] - pub included_builtin_agents: Option>, - /// Installed plugins visible to the session. + pub options: Option, + /// Suppress workspace.yaml metadata writeback when resuming from an incidental cwd. #[serde(skip_serializing_if = "Option::is_none")] - pub installed_plugins: Option>, - /// Stable integration identifier for analytics. + pub suppress_resume_workspace_metadata_writeback: Option, +} + +/// Parameters for attaching to an already-active session by ID. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionsOpenAttach { + /// Attach to an already-active in-process session by ID. Unlike `resume`, this does NOT re-load from disk; the session must already be loaded by an earlier `create`/`resume` call. Returns `status: 'not_found'` when no active session matches the id. Useful for in-process consumers that need a fresh API handle to a session opened elsewhere (e.g., a peer foreground-session switch). + pub kind: SessionsOpenAttachKind, + /// Session ID to attach to. + pub session_id: SessionId, +} + +/// Parameters for connecting to a live remote session. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionsOpenRemote { + /// Connect to a live remote session. + pub kind: SessionsOpenRemoteKind, + /// Session options for the connection. #[serde(skip_serializing_if = "Option::is_none")] - pub integration_id: Option, - /// Whether experimental behavior is enabled. + pub options: Option, + /// Remote session identifier to connect to. + pub remote_session_id: SessionId, + /// Repository context for the remote session. #[serde(skip_serializing_if = "Option::is_none")] - pub is_experimental_mode: Option, - /// Whether interactive shell sessions are logged. + pub repository: Option, +} + +/// Parameters for creating a new cloud session. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionsOpenCloud { + /// Create a new cloud (coding-agent) session. + pub kind: SessionsOpenCloudKind, + /// In-process callback invoked when the cloud task is created (before connection). Marked internal because a function reference cannot cross the JSON-RPC boundary. Disappears in the SDK migration: the field is purely cosmetic (it flips a single CLI phase label from 'creating' to 'connecting') and the wire-clean version just drops the intermediate phase. + #[doc(hidden)] #[serde(skip_serializing_if = "Option::is_none")] - pub log_interactive_shells: Option, - /// Identifier sent to LSP-style integrations. + pub(crate) on_task_created: Option, + /// Session options for cloud session creation. #[serde(skip_serializing_if = "Option::is_none")] - pub lsp_client_name: Option, - /// Permissions-only enterprise policy injected by the SDK host at session create or resume. Composes restrictively with self-fetched and device policy and is not persisted. + pub options: Option, + /// Optional owner (user or organization login) to associate with the cloud session when no repository is provided. Ignored when `repository` is set (the repo's owner takes precedence). #[serde(skip_serializing_if = "Option::is_none")] - pub managed_settings: Option, - /// Maximum decoded byte size of a single inline model-facing binary tool result persisted in session events (default 10 MB). + pub owner: Option, + /// Repository for the cloud session. #[serde(skip_serializing_if = "Option::is_none")] - pub max_inline_binary_bytes: Option, - /// Memory configuration for this session. + pub repository: Option, +} + +/// Parameters for fetching a remote session and handing it off to a new local session. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionsOpenHandoff { + /// Fetch a remote session and hand it off to a new local session. + pub kind: SessionsOpenHandoffKind, + /// Remote session metadata for the session to hand off (typically obtained from `sessions.list` with `source: "remote"`). + pub metadata: RemoteSessionMetadataValue, + /// In-process confirmation callback `(request) => boolean | Promise` invoked when the handoff needs the caller to confirm a non-fatal blocker (e.g. a repository mismatch between the current working directory and the remote session). Returning `true` proceeds with the handoff; returning `false` (or omitting the callback) aborts it. Marked internal because a function reference cannot cross the JSON-RPC boundary, for the same reasons as `onProgress`. + #[doc(hidden)] #[serde(skip_serializing_if = "Option::is_none")] - pub memory: Option, - /// Initial model identifier. + pub(crate) on_confirm: Option, + /// In-process progress callback `(update) => void` invoked for each handoff step. Marked internal because a function reference cannot cross the JSON-RPC boundary. The host-side `handoffSession` is already declared as `AsyncGenerator`; the schema layer flattens it because it does not yet support streaming methods. The wire-clean replacement is to expose the AsyncGenerator directly (or use vscode-jsonrpc `$/progress` notifications) once the schema/transport layer supports it. + #[doc(hidden)] #[serde(skip_serializing_if = "Option::is_none")] - pub model: Option, - /// Initial model capability overrides. + pub(crate) on_progress: Option, + /// Session construction options for the new local session. #[serde(skip_serializing_if = "Option::is_none")] - pub model_capabilities_overrides: Option, - /// BYOK model definitions added to the selectable model list, each referencing a provider name. - /// - ///
- /// - /// **Experimental.** This type is part of an experimental wire-protocol surface - /// and may change or be removed in future SDK or CLI releases. - /// - ///
+ pub options: Option, + /// Task type determines the handoff strategy (CCA fetches events; CLI prepares a transient session). #[serde(skip_serializing_if = "Option::is_none")] - pub models: Option>, - /// Optional human-friendly session name. + pub task_type: Option, +} + +/// `sessions.open` handoff progress update with step, status, and optional message. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionsOpenProgress { + /// Optional step message. #[serde(skip_serializing_if = "Option::is_none")] - pub name: Option, - /// Custom model-provider configuration (BYOK). + pub message: Option, + /// Step status. + pub status: SessionsOpenProgressStatus, + /// Handoff step. + pub step: SessionsOpenProgressStep, +} + +/// Result of opening a session. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionOpenResult { + /// Remote session metadata, present when status is `connected`. #[serde(skip_serializing_if = "Option::is_none")] - pub provider: Option, - /// Named BYOK provider connections, additive to CAPI auth. Combining with `provider` is rejected. - /// - ///
- /// - /// **Experimental.** This type is part of an experimental wire-protocol surface - /// and may change or be removed in future SDK or CLI releases. - /// - ///
+ pub metadata: Option, + /// Handoff progress steps, present when status is `handed_off`. #[serde(skip_serializing_if = "Option::is_none")] - pub providers: Option>, - /// Initial reasoning effort level. CAPI values are model-defined and validated against the selected model; BYOK providers may define additional values. When omitted, no effort override is applied. + pub progress: Option>, + /// Remote session ID, present when status is `connected`. #[serde(skip_serializing_if = "Option::is_none")] - pub reasoning_effort: Option, - /// Initial reasoning summary mode for supported model clients. + pub remote_session_id: Option, + /// In-process SessionClientApi handle for the opened session, returned to CLI callers as a transitional shortcut. Marked internal so the public SDK surface does not expose it; SDK consumers should construct per-session clients from `sessionId` instead. + #[doc(hidden)] #[serde(skip_serializing_if = "Option::is_none")] - pub reasoning_summary: Option, - /// Telemetry-only remote-defaulted flag. + pub(crate) session_api: Option, + /// Opened session ID. Omitted when status is `not_found`. #[serde(skip_serializing_if = "Option::is_none")] - pub remote_defaulted_on: Option, - /// Telemetry-only remote exporting flag. + pub session_id: Option, + /// Startup prompts queued by user-level hook configs at session creation. Only populated when status is `created`; resumed sessions return an empty array. #[serde(skip_serializing_if = "Option::is_none")] - pub remote_exporting: Option, - /// Whether this session supports remote steering. + pub startup_prompts: Option>, + /// Outcome of the open request. + pub status: SessionsOpenStatus, +} + +/// Outcome of the prune operation: deleted IDs, dry-run candidates, skipped IDs, total bytes freed, and the dry-run flag. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionPruneResult { + /// Session IDs that would be deleted in dry-run mode (always empty otherwise) + pub candidates: Vec, + /// Session IDs that were deleted (always empty in dry-run mode) + pub deleted: Vec, + /// True when no deletions were actually performed + pub dry_run: bool, + /// Total bytes freed (actual when not dry-run, projected when dry-run) + pub freed_bytes: i64, + /// Session IDs that were skipped (e.g., named sessions) + pub skipped: Vec, +} + +/// Session IDs to close, deactivate, and delete from disk. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionsBulkDeleteRequest { + /// Session IDs to close, deactivate, and delete from disk + pub session_ids: Vec, +} + +/// Session IDs to test for live in-use locks. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionsCheckInUseRequest { + /// Session IDs to test for live in-use locks + pub session_ids: Vec, +} + +/// Session IDs from the input set that are currently in use by another process. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionsCheckInUseResult { + /// Session IDs from the input set that are currently held by another running process via an alive lock file + pub in_use: Vec, +} + +/// Session ID to close. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionsCloseRequest { + /// Session ID to close + pub session_id: SessionId, +} + +/// 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.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionsCloseResult {} + +/// Session ID to delete from disk. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionsDeleteRequest { + /// Session ID to delete + pub session_id: SessionId, + /// Internal resolved session directory path to delete #[serde(skip_serializing_if = "Option::is_none")] - pub remote_steerable: Option, - /// Whether the host is an interactive UI. + pub session_path: Option, +} + +/// Session metadata records to enrich with summary and context information. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionsEnrichMetadataRequest { + /// Session metadata records to enrich. Records that already have summary and context are returned unchanged. + pub sessions: Vec, +} + +/// New auth credentials to install on the session. Omit to leave credentials unchanged. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct 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. #[serde(skip_serializing_if = "Option::is_none")] - pub running_in_interactive_mode: Option, - /// Resolved sandbox configuration. + pub credentials: Option, +} + +/// Indicates whether the credential update succeeded. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct 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). #[serde(skip_serializing_if = "Option::is_none")] - pub sandbox_config: Option, - /// Capabilities enabled for this session. + pub copilot_user_resolved: Option, + /// Whether the operation succeeded + pub success: bool, +} + +/// Availability of built-in job tools surfaced to boundary consumers. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionSettingsBuiltInToolAvailabilitySnapshot { + /// Whether the create-pull-request tool is available. #[serde(skip_serializing_if = "Option::is_none")] - pub session_capabilities: Option>, - /// Optional stable session identifier to use for a new session. + pub create_pull_request: Option, + /// Whether the report-progress tool is available. #[serde(skip_serializing_if = "Option::is_none")] - pub session_id: Option, - /// Initial session limits. + pub report_progress: Option, +} + +/// Named Rust-owned settings predicate to evaluate for this session. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionSettingsEvaluatePredicateRequest { + /// Predicate name. The runtime owns the raw feature-flag names and composition logic. + pub name: SessionSettingsPredicateName, + /// Tool name for tool-scoped predicates such as trivial-change handling. #[serde(skip_serializing_if = "Option::is_none")] - pub session_limits: Option, - /// Per-session settings for built-in shell tools. + pub tool_name: Option, +} + +/// Result of evaluating a Rust-owned settings predicate. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionSettingsEvaluatePredicateResult { + /// Whether the named settings predicate evaluated to enabled. + pub enabled: bool, +} + +/// Redacted job settings for a session. The job nonce is excluded. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionSettingsJobSnapshot { + /// Availability of job-specific built-in tools. #[serde(skip_serializing_if = "Option::is_none")] - pub shell: Option, - /// Use shell.initProfile instead. Shell init profile. - #[doc(hidden)] - #[deprecated] + pub built_in_tool_availability: Option, + /// GitHub Actions event type for the job. #[serde(skip_serializing_if = "Option::is_none")] - pub shell_init_profile: Option, - /// PowerShell process flags applied to built-in and user-requested shell commands. + pub event_type: Option, + /// Whether this is the workflow's trigger job. #[serde(skip_serializing_if = "Option::is_none")] - pub shell_process_flags: Option>, - /// Additional directories to search for skills. + pub is_trigger_job: Option, +} + +/// Redacted model routing settings for a session. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionSettingsModelSnapshot { + /// Agent service callback URL for job and progress updates. #[serde(skip_serializing_if = "Option::is_none")] - pub skill_directories: Option>, - /// Whether to skip custom instruction sources. + pub callback_url: Option, + /// Default reasoning effort for the selected model. #[serde(skip_serializing_if = "Option::is_none")] - pub skip_custom_instructions: Option, - /// Optional trajectory output file path. + pub default_reasoning_effort: Option, + /// Agent job identifier for the session. #[serde(skip_serializing_if = "Option::is_none")] - pub trajectory_file: Option, - /// Initial output verbosity level for supported models. + pub instance_id: Option, + /// Selected model identifier. #[serde(skip_serializing_if = "Option::is_none")] - pub verbosity: Option, - /// Working directory to anchor the session. + pub model: Option, +} + +/// Online-evaluation settings safe to expose across the SDK boundary. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionSettingsOnlineEvaluationSnapshot { + /// Whether online evaluation is disabled. #[serde(skip_serializing_if = "Option::is_none")] - pub working_directory: Option, - /// Pre-resolved working-directory context for session startup. + pub disable_online_evaluation: Option, + /// Whether online-evaluation output-file generation is enabled. #[serde(skip_serializing_if = "Option::is_none")] - pub working_directory_context: Option, + pub enable_online_evaluation_output_file: Option, } -/// Parameters for creating a new local session. +/// Redacted repository and GitHub host settings for a session. /// ///
/// @@ -15751,18 +17166,46 @@ pub struct SessionOpenOptions { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionsOpenCreate { - /// Whether to emit session.start during creation. Defaults to true. +pub struct SessionSettingsRepoSnapshot { + /// Checked-out repository branch. #[serde(skip_serializing_if = "Option::is_none")] - pub emit_start: Option, - /// Create a new local session. - pub kind: SessionsOpenCreateKind, - /// Session construction options. + pub branch: Option, + /// Checked-out commit SHA. #[serde(skip_serializing_if = "Option::is_none")] - pub options: Option, + pub commit: Option, + /// GitHub server host name. + #[serde(skip_serializing_if = "Option::is_none")] + pub host: Option, + /// Protocol used to access the GitHub host. + #[serde(skip_serializing_if = "Option::is_none")] + pub host_protocol: Option, + /// GitHub repository database ID. + #[serde(skip_serializing_if = "Option::is_none")] + pub id: Option, + /// Repository name. + #[serde(skip_serializing_if = "Option::is_none")] + pub name: Option, + /// GitHub repository owner database ID. + #[serde(skip_serializing_if = "Option::is_none")] + pub owner_id: Option, + /// Repository owner login. + #[serde(skip_serializing_if = "Option::is_none")] + pub owner_name: Option, + /// Number of commits in the pull request. + #[serde(skip_serializing_if = "Option::is_none")] + pub pr_commit_count: Option, + /// Whether the repository is writable. + #[serde(skip_serializing_if = "Option::is_none")] + pub read_write: Option, + /// GitHub secret-scanning service URL. + #[serde(skip_serializing_if = "Option::is_none")] + pub secret_scanning_url: Option, + /// GitHub server base URL. + #[serde(skip_serializing_if = "Option::is_none")] + pub server_url: Option, } -/// Parameters for resuming a specific local session. +/// Redacted validation and memory-tool settings for a session. /// ///
/// @@ -15772,23 +17215,37 @@ pub struct SessionsOpenCreate { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionsOpenResume { - /// Resume a specific local session by ID or prefix. - pub kind: SessionsOpenResumeKind, - /// Session resume options. +pub struct SessionSettingsValidationSnapshot { + /// Whether advisory validation is enabled. #[serde(skip_serializing_if = "Option::is_none")] - pub options: Option, - /// Whether to emit session.resume after loading. Defaults to true. + pub advisory_enabled: Option, + /// Whether CodeQL validation is enabled. #[serde(skip_serializing_if = "Option::is_none")] - pub resume: Option, - /// Session ID or unique prefix to resume. - pub session_id: SessionId, - /// Suppress workspace.yaml metadata writeback when resuming from an incidental cwd. + pub codeql_enabled: Option, + /// Whether code-review validation is enabled. #[serde(skip_serializing_if = "Option::is_none")] - pub suppress_resume_workspace_metadata_writeback: Option, + pub code_review_enabled: Option, + /// Model used for code-review validation. + #[serde(skip_serializing_if = "Option::is_none")] + pub code_review_model: Option, + /// Dependabot validation timeout budget in seconds. + #[serde(skip_serializing_if = "Option::is_none")] + pub dependabot_timeout: Option, + /// Whether the memory-store tool is enabled. + #[serde(skip_serializing_if = "Option::is_none")] + pub memory_store_enabled: Option, + /// Whether the memory-vote tool is enabled. + #[serde(skip_serializing_if = "Option::is_none")] + pub memory_vote_enabled: Option, + /// Whether secret-scanning validation is enabled. + #[serde(skip_serializing_if = "Option::is_none")] + pub secret_scanning_enabled: Option, + /// General validation timeout budget in seconds. + #[serde(skip_serializing_if = "Option::is_none")] + pub timeout: Option, } -/// Parameters for resuming the most relevant local session. +/// Redacted, serializable view of session runtime settings for SDK boundary consumers. Secrets and raw feature flags are intentionally excluded. /// ///
/// @@ -15798,21 +17255,32 @@ pub struct SessionsOpenResume { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionsOpenResumeLast { - /// Working-directory context used to choose the most relevant session. +pub struct SessionSettingsSnapshot { + /// Name of the SDK client that created the session. #[serde(skip_serializing_if = "Option::is_none")] - pub context: Option, - /// Resume the most relevant existing local session. - pub kind: SessionsOpenResumeLastKind, - /// Session resume options. + pub client_name: Option, + /// Redacted job settings. + pub job: SessionSettingsJobSnapshot, + /// Redacted model routing settings. + pub model: SessionSettingsModelSnapshot, + /// Online-evaluation settings safe for SDK consumers. + pub online_evaluation: SessionSettingsOnlineEvaluationSnapshot, + /// Redacted repository and host settings. + pub repo: SessionSettingsRepoSnapshot, + /// Session start time as Unix epoch milliseconds. #[serde(skip_serializing_if = "Option::is_none")] - pub options: Option, - /// Suppress workspace.yaml metadata writeback when resuming from an incidental cwd. + pub start_time_ms: Option, + /// Session timeout in milliseconds. #[serde(skip_serializing_if = "Option::is_none")] - pub suppress_resume_workspace_metadata_writeback: Option, + pub timeout_ms: Option, + /// Redacted validation and memory-tool settings. + pub validation: SessionSettingsValidationSnapshot, + /// Agent runtime version selector copied from the session settings, such as `latest` or a runtime release identifier. + #[serde(skip_serializing_if = "Option::is_none")] + pub version: Option, } -/// Parameters for attaching to an already-active session by ID. +/// UUID prefix to resolve to a unique session ID. /// ///
/// @@ -15822,14 +17290,12 @@ pub struct SessionsOpenResumeLast { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionsOpenAttach { - /// Attach to an already-active in-process session by ID. Unlike `resume`, this does NOT re-load from disk; the session must already be loaded by an earlier `create`/`resume` call. Returns `status: 'not_found'` when no active session matches the id. Useful for in-process consumers that need a fresh API handle to a session opened elsewhere (e.g., a peer foreground-session switch). - pub kind: SessionsOpenAttachKind, - /// Session ID to attach to. - pub session_id: SessionId, +pub struct 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. + pub prefix: String, } -/// Parameters for connecting to a live remote session. +/// Session ID matching the prefix, omitted when no unique match exists. /// ///
/// @@ -15839,20 +17305,13 @@ pub struct SessionsOpenAttach { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionsOpenRemote { - /// Connect to a live remote session. - pub kind: SessionsOpenRemoteKind, - /// Session options for the connection. - #[serde(skip_serializing_if = "Option::is_none")] - pub options: Option, - /// Remote session identifier to connect to. - pub remote_session_id: SessionId, - /// Repository context for the remote session. +pub struct SessionsFindByPrefixResult { + /// Omitted when no unique session matches the prefix (no match or ambiguous) #[serde(skip_serializing_if = "Option::is_none")] - pub repository: Option, + pub session_id: Option, } -/// Parameters for creating a new cloud session. +/// GitHub task ID to look up. /// ///
/// @@ -15862,25 +17321,12 @@ pub struct SessionsOpenRemote { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionsOpenCloud { - /// Create a new cloud (coding-agent) session. - pub kind: SessionsOpenCloudKind, - /// In-process callback invoked when the cloud task is created (before connection). Marked internal because a function reference cannot cross the JSON-RPC boundary. Disappears in the SDK migration: the field is purely cosmetic (it flips a single CLI phase label from 'creating' to 'connecting') and the wire-clean version just drops the intermediate phase. - #[doc(hidden)] - #[serde(skip_serializing_if = "Option::is_none")] - pub(crate) on_task_created: Option, - /// Session options for cloud session creation. - #[serde(skip_serializing_if = "Option::is_none")] - pub options: Option, - /// Optional owner (user or organization login) to associate with the cloud session when no repository is provided. Ignored when `repository` is set (the repo's owner takes precedence). - #[serde(skip_serializing_if = "Option::is_none")] - pub owner: Option, - /// Repository for the cloud session. - #[serde(skip_serializing_if = "Option::is_none")] - pub repository: Option, +pub struct SessionsFindByTaskIDRequest { + /// GitHub task ID to look up + pub task_id: String, } -/// Parameters for fetching a remote session and handing it off to a new local session. +/// ID of the local session bound to the given GitHub task, or omitted when none. /// ///
/// @@ -15890,28 +17336,13 @@ pub struct SessionsOpenCloud { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionsOpenHandoff { - /// Fetch a remote session and hand it off to a new local session. - pub kind: SessionsOpenHandoffKind, - /// Remote session metadata for the session to hand off (typically obtained from `sessions.list` with `source: "remote"`). - pub metadata: RemoteSessionMetadataValue, - /// In-process confirmation callback `(request) => boolean | Promise` invoked when the handoff needs the caller to confirm a non-fatal blocker (e.g. a repository mismatch between the current working directory and the remote session). Returning `true` proceeds with the handoff; returning `false` (or omitting the callback) aborts it. Marked internal because a function reference cannot cross the JSON-RPC boundary, for the same reasons as `onProgress`. - #[doc(hidden)] - #[serde(skip_serializing_if = "Option::is_none")] - pub(crate) on_confirm: Option, - /// In-process progress callback `(update) => void` invoked for each handoff step. Marked internal because a function reference cannot cross the JSON-RPC boundary. The host-side `handoffSession` is already declared as `AsyncGenerator`; the schema layer flattens it because it does not yet support streaming methods. The wire-clean replacement is to expose the AsyncGenerator directly (or use vscode-jsonrpc `$/progress` notifications) once the schema/transport layer supports it. - #[doc(hidden)] - #[serde(skip_serializing_if = "Option::is_none")] - pub(crate) on_progress: Option, - /// Session construction options for the new local session. - #[serde(skip_serializing_if = "Option::is_none")] - pub options: Option, - /// Task type determines the handoff strategy (CCA fetches events; CLI prepares a transient session). +pub struct SessionsFindByTaskIDResult { + /// Omitted when no local session is bound to that GitHub task #[serde(skip_serializing_if = "Option::is_none")] - pub task_type: Option, + pub session_id: Option, } -/// `sessions.open` handoff progress update with step, status, and optional message. +/// Source session identifier to fork from, optional event-ID boundary, and optional friendly name for the new session. /// ///
/// @@ -15921,17 +17352,18 @@ pub struct SessionsOpenHandoff { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionsOpenProgress { - /// Optional step message. +pub struct SessionsForkRequest { + /// Optional friendly name to assign to the forked session. #[serde(skip_serializing_if = "Option::is_none")] - pub message: Option, - /// Step status. - pub status: SessionsOpenProgressStatus, - /// Handoff step. - pub step: SessionsOpenProgressStep, + pub name: Option, + /// Source session ID to fork from + pub session_id: SessionId, + /// Optional event ID boundary. When provided, the fork includes only events before this ID (exclusive). When omitted, all events are included. + #[serde(skip_serializing_if = "Option::is_none")] + pub to_event_id: Option, } -/// Result of opening a session. +/// Identifier and optional friendly name assigned to the newly forked session. /// ///
/// @@ -15941,31 +17373,15 @@ pub struct SessionsOpenProgress { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionOpenResult { - /// Remote session metadata, present when status is `connected`. - #[serde(skip_serializing_if = "Option::is_none")] - pub metadata: Option, - /// Handoff progress steps, present when status is `handed_off`. - #[serde(skip_serializing_if = "Option::is_none")] - pub progress: Option>, - /// Remote session ID, present when status is `connected`. - #[serde(skip_serializing_if = "Option::is_none")] - pub remote_session_id: Option, - /// In-process SessionClientApi handle for the opened session, returned to CLI callers as a transitional shortcut. Marked internal so the public SDK surface does not expose it; SDK consumers should construct per-session clients from `sessionId` instead. - #[doc(hidden)] - #[serde(skip_serializing_if = "Option::is_none")] - pub(crate) session_api: Option, - /// Opened session ID. Omitted when status is `not_found`. - #[serde(skip_serializing_if = "Option::is_none")] - pub session_id: Option, - /// Startup prompts queued by user-level hook configs at session creation. Only populated when status is `created`; resumed sessions return an empty array. +pub struct SessionsForkResult { + /// Friendly name assigned to the forked session, if any. #[serde(skip_serializing_if = "Option::is_none")] - pub startup_prompts: Option>, - /// Outcome of the open request. - pub status: SessionsOpenStatus, + pub name: Option, + /// The new forked session's ID + pub session_id: SessionId, } -/// Outcome of the prune operation: deleted IDs, dry-run candidates, skipped IDs, total bytes freed, and the dry-run flag. +/// Session ID whose board entry count should be returned. /// ///
/// @@ -15975,20 +17391,12 @@ pub struct SessionOpenResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionPruneResult { - /// Session IDs that would be deleted in dry-run mode (always empty otherwise) - pub candidates: Vec, - /// Session IDs that were deleted (always empty in dry-run mode) - pub deleted: Vec, - /// True when no deletions were actually performed - pub dry_run: bool, - /// Total bytes freed (actual when not dry-run, projected when dry-run) - pub freed_bytes: i64, - /// Session IDs that were skipped (e.g., named sessions) - pub skipped: Vec, +pub struct SessionsGetBoardEntryCountRequest { + /// Session ID whose board entry count should be returned. + pub session_id: SessionId, } -/// Session IDs to close, deactivate, and delete from disk. +/// Dynamic-context board entry count, when available. /// ///
/// @@ -15998,12 +17406,13 @@ pub struct SessionPruneResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionsBulkDeleteRequest { - /// Session IDs to close, deactivate, and delete from disk - pub session_ids: Vec, +pub struct SessionsGetBoardEntryCountResult { + /// Board entry count, when available. + #[serde(skip_serializing_if = "Option::is_none")] + pub count: Option, } -/// Session IDs to test for live in-use locks. +/// Session ID whose event-log file path to compute. /// ///
/// @@ -16013,12 +17422,12 @@ pub struct SessionsBulkDeleteRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionsCheckInUseRequest { - /// Session IDs to test for live in-use locks - pub session_ids: Vec, +pub struct SessionsGetEventFilePathRequest { + /// Session ID whose event-log file path to compute + pub session_id: SessionId, } -/// Session IDs from the input set that are currently in use by another process. +/// Absolute path to the session's events.jsonl file on disk. /// ///
/// @@ -16028,12 +17437,12 @@ pub struct SessionsCheckInUseRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionsCheckInUseResult { - /// Session IDs from the input set that are currently held by another running process via an alive lock file - pub in_use: Vec, +pub struct SessionsGetEventFilePathResult { + /// Absolute path to the session's events.jsonl file + pub file_path: String, } -/// Session ID to close. +/// Optional working-directory context used to score session relevance. /// ///
/// @@ -16043,12 +17452,13 @@ pub struct SessionsCheckInUseResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionsCloseRequest { - /// Session ID to close - pub session_id: SessionId, +pub struct SessionsGetLastForContextRequest { + /// Optional working-directory context used to score session relevance. When omitted the most-recently-modified session wins. + #[serde(skip_serializing_if = "Option::is_none")] + pub context: Option, } -/// 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. +/// Most-relevant session ID for the supplied context, or omitted when no sessions exist. /// ///
/// @@ -16058,9 +17468,13 @@ pub struct SessionsCloseRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionsCloseResult {} +pub struct SessionsGetLastForContextResult { + /// Most-relevant session ID for the supplied context, or omitted when no sessions exist + #[serde(skip_serializing_if = "Option::is_none")] + pub session_id: Option, +} -/// Session ID to delete from disk. +/// Session ID whose persisted metadata should be read. /// ///
/// @@ -16070,15 +17484,12 @@ pub struct SessionsCloseResult {} ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionsDeleteRequest { - /// Session ID to delete +pub struct SessionsGetMetadataRequest { + /// Session ID to inspect pub session_id: SessionId, - /// Internal resolved session directory path to delete - #[serde(skip_serializing_if = "Option::is_none")] - pub session_path: Option, } -/// Session metadata records to enrich with summary and context information. +/// Persisted local session metadata when the session exists. /// ///
/// @@ -16088,12 +17499,13 @@ pub struct SessionsDeleteRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionsEnrichMetadataRequest { - /// Session metadata records to enrich. Records that already have summary and context are returned unchanged. - pub sessions: Vec, +pub struct SessionsGetMetadataResult { + /// Local session metadata, omitted when the session does not exist. + #[serde(skip_serializing_if = "Option::is_none")] + pub session: Option, } -/// New auth credentials to install on the session. Omit to leave credentials unchanged. +/// Session ID to look up the persisted remote-steerable flag for. /// ///
/// @@ -16103,13 +17515,12 @@ pub struct SessionsEnrichMetadataRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct 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. - #[serde(skip_serializing_if = "Option::is_none")] - pub credentials: Option, +pub struct SessionsGetPersistedRemoteSteerableRequest { + /// Session ID to look up the persisted remote-steerable flag for + pub session_id: SessionId, } -/// Indicates whether the credential update succeeded. +/// The session's persisted remote-steerable flag, or omitted when no value has been persisted. /// ///
/// @@ -16119,15 +17530,13 @@ pub struct SessionSetCredentialsParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct 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). +pub struct SessionsGetPersistedRemoteSteerableResult { + /// The session's persisted remote-steerable flag if recorded; omitted when no value has been persisted #[serde(skip_serializing_if = "Option::is_none")] - pub copilot_user_resolved: Option, - /// Whether the operation succeeded - pub success: bool, + pub remote_steerable: Option, } -/// Availability of built-in job tools surfaced to boundary consumers. +/// Map of sessionId -> on-disk size in bytes for each session's workspace directory. /// ///
/// @@ -16137,16 +17546,12 @@ pub struct SessionSetCredentialsResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionSettingsBuiltInToolAvailabilitySnapshot { - /// Whether the create-pull-request tool is available. - #[serde(skip_serializing_if = "Option::is_none")] - pub create_pull_request: Option, - /// Whether the report-progress tool is available. - #[serde(skip_serializing_if = "Option::is_none")] - pub report_progress: Option, +pub struct SessionSizes { + /// Map of sessionId -> on-disk size in bytes for the session's workspace directory + pub sizes: HashMap, } -/// Named Rust-owned settings predicate to evaluate for this session. +/// Limit for non-empty local session IDs. /// ///
/// @@ -16156,15 +17561,13 @@ pub struct SessionSettingsBuiltInToolAvailabilitySnapshot { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionSettingsEvaluatePredicateRequest { - /// Predicate name. The runtime owns the raw feature-flag names and composition logic. - pub name: SessionSettingsPredicateName, - /// Tool name for tool-scoped predicates such as trivial-change handling. +pub struct SessionsListNonEmptySessionIdsRequest { + /// Maximum number of session IDs to return. #[serde(skip_serializing_if = "Option::is_none")] - pub tool_name: Option, + pub limit: Option, } -/// Result of evaluating a Rust-owned settings predicate. +/// Recent local session IDs that contain user-visible history. /// ///
/// @@ -16174,12 +17577,12 @@ pub struct SessionSettingsEvaluatePredicateRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionSettingsEvaluatePredicateResult { - /// Whether the named settings predicate evaluated to enabled. - pub enabled: bool, +pub struct SessionsListNonEmptySessionIdsResult { + /// Session IDs ordered newest-first. + pub session_ids: Vec, } -/// Redacted job settings for a session. The job nonce is excluded. +/// Optional source filter, metadata-load limit, and context filter applied to the returned sessions. /// ///
/// @@ -16189,19 +17592,25 @@ pub struct SessionSettingsEvaluatePredicateResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionSettingsJobSnapshot { - /// Availability of job-specific built-in tools. +pub struct SessionsListRequest { + /// Optional filter applied to the returned sessions #[serde(skip_serializing_if = "Option::is_none")] - pub built_in_tool_availability: Option, - /// GitHub Actions event type for the job. + pub filter: Option, + /// When true, include detached maintenance sessions. Defaults to false for user-facing session lists. #[serde(skip_serializing_if = "Option::is_none")] - pub event_type: Option, - /// Whether this is the workflow's trigger job. + pub include_detached: Option, + /// 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). #[serde(skip_serializing_if = "Option::is_none")] - pub is_trigger_job: Option, + pub metadata_limit: Option, + /// Which session sources to include. Defaults to `local` for backward compatibility. + #[serde(skip_serializing_if = "Option::is_none")] + pub source: Option, + /// 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. + #[serde(skip_serializing_if = "Option::is_none")] + pub throw_on_error: Option, } -/// Redacted model routing settings for a session. +/// Active session ID whose deferred repo-level hooks should be loaded. /// ///
/// @@ -16211,22 +17620,12 @@ pub struct SessionSettingsJobSnapshot { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionSettingsModelSnapshot { - /// Agent service callback URL for job and progress updates. - #[serde(skip_serializing_if = "Option::is_none")] - pub callback_url: Option, - /// Default reasoning effort for the selected model. - #[serde(skip_serializing_if = "Option::is_none")] - pub default_reasoning_effort: Option, - /// Agent job identifier for the session. - #[serde(skip_serializing_if = "Option::is_none")] - pub instance_id: Option, - /// Selected model identifier. - #[serde(skip_serializing_if = "Option::is_none")] - pub model: Option, +pub struct SessionsLoadDeferredRepoHooksRequest { + /// Active session ID whose deferred repo-level hooks should be loaded + pub session_id: SessionId, } -/// Online-evaluation settings safe to expose across the SDK boundary. +/// Age threshold and optional flags controlling which old sessions are pruned (or simulated when dryRun is true). /// ///
/// @@ -16236,16 +17635,21 @@ pub struct SessionSettingsModelSnapshot { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionSettingsOnlineEvaluationSnapshot { - /// Whether online evaluation is disabled. +pub struct SessionsPruneOldRequest { + /// When true, only report what would be deleted without performing any deletion #[serde(skip_serializing_if = "Option::is_none")] - pub disable_online_evaluation: Option, - /// Whether online-evaluation output-file generation is enabled. + pub dry_run: Option, + /// Session IDs that should never be considered for pruning #[serde(skip_serializing_if = "Option::is_none")] - pub enable_online_evaluation_output_file: Option, + pub exclude_session_ids: Option>, + /// When true, named sessions (set via /rename) are also eligible for pruning + #[serde(skip_serializing_if = "Option::is_none")] + pub include_named: Option, + /// Delete sessions whose modifiedTime is at least this many days old + pub older_than_days: i64, } -/// Redacted repository and GitHub host settings for a session. +/// Session ID whose in-use lock should be released. /// ///
/// @@ -16255,46 +17659,12 @@ pub struct SessionSettingsOnlineEvaluationSnapshot { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionSettingsRepoSnapshot { - /// Checked-out repository branch. - #[serde(skip_serializing_if = "Option::is_none")] - pub branch: Option, - /// Checked-out commit SHA. - #[serde(skip_serializing_if = "Option::is_none")] - pub commit: Option, - /// GitHub server host name. - #[serde(skip_serializing_if = "Option::is_none")] - pub host: Option, - /// Protocol used to access the GitHub host. - #[serde(skip_serializing_if = "Option::is_none")] - pub host_protocol: Option, - /// GitHub repository database ID. - #[serde(skip_serializing_if = "Option::is_none")] - pub id: Option, - /// Repository name. - #[serde(skip_serializing_if = "Option::is_none")] - pub name: Option, - /// GitHub repository owner database ID. - #[serde(skip_serializing_if = "Option::is_none")] - pub owner_id: Option, - /// Repository owner login. - #[serde(skip_serializing_if = "Option::is_none")] - pub owner_name: Option, - /// Number of commits in the pull request. - #[serde(skip_serializing_if = "Option::is_none")] - pub pr_commit_count: Option, - /// Whether the repository is writable. - #[serde(skip_serializing_if = "Option::is_none")] - pub read_write: Option, - /// GitHub secret-scanning service URL. - #[serde(skip_serializing_if = "Option::is_none")] - pub secret_scanning_url: Option, - /// GitHub server base URL. - #[serde(skip_serializing_if = "Option::is_none")] - pub server_url: Option, +pub struct SessionsReleaseLockRequest { + /// Session ID whose in-use lock should be released + pub session_id: SessionId, } -/// Redacted validation and memory-tool settings for a session. +/// 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. /// ///
/// @@ -16304,37 +17674,9 @@ pub struct SessionSettingsRepoSnapshot { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionSettingsValidationSnapshot { - /// Whether advisory validation is enabled. - #[serde(skip_serializing_if = "Option::is_none")] - pub advisory_enabled: Option, - /// Whether CodeQL validation is enabled. - #[serde(skip_serializing_if = "Option::is_none")] - pub codeql_enabled: Option, - /// Whether code-review validation is enabled. - #[serde(skip_serializing_if = "Option::is_none")] - pub code_review_enabled: Option, - /// Model used for code-review validation. - #[serde(skip_serializing_if = "Option::is_none")] - pub code_review_model: Option, - /// Dependabot validation timeout budget in seconds. - #[serde(skip_serializing_if = "Option::is_none")] - pub dependabot_timeout: Option, - /// Whether the memory-store tool is enabled. - #[serde(skip_serializing_if = "Option::is_none")] - pub memory_store_enabled: Option, - /// Whether the memory-vote tool is enabled. - #[serde(skip_serializing_if = "Option::is_none")] - pub memory_vote_enabled: Option, - /// Whether secret-scanning validation is enabled. - #[serde(skip_serializing_if = "Option::is_none")] - pub secret_scanning_enabled: Option, - /// General validation timeout budget in seconds. - #[serde(skip_serializing_if = "Option::is_none")] - pub timeout: Option, -} +pub struct SessionsReleaseLockResult {} -/// Redacted, serializable view of session runtime settings for SDK boundary consumers. Secrets and raw feature flags are intentionally excluded. +/// Active session ID and an optional flag for deferring repo-level hooks until folder trust. /// ///
/// @@ -16344,32 +17686,15 @@ pub struct SessionSettingsValidationSnapshot { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionSettingsSnapshot { - /// Name of the SDK client that created the session. - #[serde(skip_serializing_if = "Option::is_none")] - pub client_name: Option, - /// Redacted job settings. - pub job: SessionSettingsJobSnapshot, - /// Redacted model routing settings. - pub model: SessionSettingsModelSnapshot, - /// Online-evaluation settings safe for SDK consumers. - pub online_evaluation: SessionSettingsOnlineEvaluationSnapshot, - /// Redacted repository and host settings. - pub repo: SessionSettingsRepoSnapshot, - /// Session start time as Unix epoch milliseconds. - #[serde(skip_serializing_if = "Option::is_none")] - pub start_time_ms: Option, - /// Session timeout in milliseconds. - #[serde(skip_serializing_if = "Option::is_none")] - pub timeout_ms: Option, - /// Redacted validation and memory-tool settings. - pub validation: SessionSettingsValidationSnapshot, - /// Agent runtime version selector copied from the session settings, such as `latest` or a runtime release identifier. +pub struct SessionsReloadPluginHooksRequest { + /// When true, skip repo-level hooks. Use before folder trust is confirmed; loadDeferredRepoHooks loads them post-trust. #[serde(skip_serializing_if = "Option::is_none")] - pub version: Option, + pub defer_repo_hooks: Option, + /// Active session ID to reload hooks for + pub session_id: SessionId, } -/// UUID prefix to resolve to a unique session ID. +/// 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. /// ///
/// @@ -16379,12 +17704,9 @@ pub struct SessionSettingsSnapshot { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct 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. - pub prefix: String, -} +pub struct SessionsReloadPluginHooksResult {} -/// Session ID matching the prefix, omitted when no unique match exists. +/// Session ID whose pending events should be flushed to disk. /// ///
/// @@ -16394,13 +17716,12 @@ pub struct SessionsFindByPrefixRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionsFindByPrefixResult { - /// Omitted when no unique session matches the prefix (no match or ambiguous) - #[serde(skip_serializing_if = "Option::is_none")] - pub session_id: Option, +pub struct SessionsSaveRequest { + /// Session ID whose pending events should be flushed to disk + pub session_id: SessionId, } -/// GitHub task ID to look up. +/// Flush a session's pending events to disk. No-op when no writer exists for the session (e.g., already closed). /// ///
/// @@ -16410,12 +17731,9 @@ pub struct SessionsFindByPrefixResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionsFindByTaskIDRequest { - /// GitHub task ID to look up - pub task_id: String, -} +pub struct SessionsSaveResult {} -/// ID of the local session bound to the given GitHub task, or omitted when none. +/// Manager-wide additional plugins to register; replaces any previously-configured set. /// ///
/// @@ -16425,13 +17743,12 @@ pub struct SessionsFindByTaskIDRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionsFindByTaskIDResult { - /// Omitted when no local session is bound to that GitHub task - #[serde(skip_serializing_if = "Option::is_none")] - pub session_id: Option, +pub struct SessionsSetAdditionalPluginsRequest { + /// Manager-wide additional plugins to register. Replaces any previously-configured set. Pass an empty array to clear. + pub plugins: Vec, } -/// Source session identifier to fork from, optional event-ID boundary, and optional friendly name for the new session. +/// 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. /// ///
/// @@ -16441,18 +17758,9 @@ pub struct SessionsFindByTaskIDResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionsForkRequest { - /// Optional friendly name to assign to the forked session. - #[serde(skip_serializing_if = "Option::is_none")] - pub name: Option, - /// Source session ID to fork from - pub session_id: SessionId, - /// Optional event ID boundary. When provided, the fork includes only events before this ID (exclusive). When omitted, all events are included. - #[serde(skip_serializing_if = "Option::is_none")] - pub to_event_id: Option, -} +pub struct SessionsSetAdditionalPluginsResult {} -/// Identifier and optional friendly name assigned to the newly forked session. +/// Patch for the singleton's steering state. /// ///
/// @@ -16462,15 +17770,12 @@ pub struct SessionsForkRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionsForkResult { - /// Friendly name assigned to the forked session, if any. - #[serde(skip_serializing_if = "Option::is_none")] - pub name: Option, - /// The new forked session's ID - pub session_id: SessionId, +pub struct SessionsSetRemoteControlSteeringRequest { + /// Target steering state. Today only `true` is actionable on the underlying exporter; `false` is reserved for future use. + pub enabled: bool, } -/// Session ID whose board entry count should be returned. +/// Parameters for attaching the remote-control singleton to a session. /// ///
/// @@ -16480,12 +17785,14 @@ pub struct SessionsForkResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionsGetBoardEntryCountRequest { - /// Session ID whose board entry count should be returned. +pub struct SessionsStartRemoteControlRequest { + /// Configuration for the runtime-managed remote-control singleton. + pub config: RemoteControlConfig, + /// Local session id to attach remote control to. pub session_id: SessionId, } -/// Dynamic-context board entry count, when available. +/// Parameters for stopping the remote-control singleton. /// ///
/// @@ -16495,13 +17802,16 @@ pub struct SessionsGetBoardEntryCountRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionsGetBoardEntryCountResult { - /// Board entry count, when available. +pub struct SessionsStopRemoteControlRequest { + /// When provided, the stop is rejected unless the singleton currently points at this session id (compare-and-swap semantics). #[serde(skip_serializing_if = "Option::is_none")] - pub count: Option, + pub expected_session_id: Option, + /// When true, the singleton is unconditionally torn down regardless of `expectedSessionId`. Use during shutdown or explicit `/remote off`. + #[serde(skip_serializing_if = "Option::is_none")] + pub force: Option, } -/// Session ID whose event-log file path to compute. +/// Parameters for atomically rebinding the remote-control singleton. /// ///
/// @@ -16511,12 +17821,15 @@ pub struct SessionsGetBoardEntryCountResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionsGetEventFilePathRequest { - /// Session ID whose event-log file path to compute - pub session_id: SessionId, +pub struct 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). + #[serde(skip_serializing_if = "Option::is_none")] + pub expected_from_session_id: Option, + /// Local session id to point remote control at. + pub to_session_id: String, } -/// Absolute path to the session's events.jsonl file on disk. +/// Telemetry engagement ID for the session, when available. /// ///
/// @@ -16526,12 +17839,13 @@ pub struct SessionsGetEventFilePathRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionsGetEventFilePathResult { - /// Absolute path to the session's events.jsonl file - pub file_path: String, +pub struct SessionTelemetryEngagement { + /// Current telemetry engagement ID, when available. + #[serde(skip_serializing_if = "Option::is_none")] + pub engagement_id: Option, } -/// Optional working-directory context used to score session relevance. +/// Patch of mutable session options to apply to the running session. /// ///
/// @@ -16541,13 +17855,191 @@ pub struct SessionsGetEventFilePathResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionsGetLastForContextRequest { - /// Optional working-directory context used to score session relevance. When omitted the most-recently-modified session wins. +pub struct SessionUpdateOptionsParams { + /// Additional content-exclusion policies to merge into the session's policy set. + /// + ///
+ /// + /// **Experimental.** This type is part of an experimental wire-protocol surface + /// and may change or be removed in future SDK or CLI releases. + /// + ///
+ #[serde(skip_serializing_if = "Option::is_none")] + pub additional_content_exclusion_policies: + Option>, + /// Runtime context discriminator (e.g., `cli`, `actions`). + #[serde(skip_serializing_if = "Option::is_none")] + pub agent_context: Option, + /// Whether to include instructions from every MCP server in the system prompt instead of only allowlisted servers. + #[serde(skip_serializing_if = "Option::is_none")] + pub allow_all_mcp_server_instructions: Option, + /// Whether to disable the `ask_user` tool (encourages autonomous behavior). + #[serde(skip_serializing_if = "Option::is_none")] + pub ask_user_disabled: Option, + /// Allowlist of tool names available to this session. + #[serde(skip_serializing_if = "Option::is_none")] + pub available_tools: Option>, + /// Options scoped to the built-in CAPI (Copilot API) provider. + #[serde(skip_serializing_if = "Option::is_none")] + pub capi: Option, + /// Identifier of the client driving the session. + #[serde(skip_serializing_if = "Option::is_none")] + pub client_name: Option, + /// Whether to include the `Co-authored-by` trailer in commit messages. + #[serde(skip_serializing_if = "Option::is_none")] + pub coauthor_enabled: Option, + /// 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. + #[serde(skip_serializing_if = "Option::is_none")] + pub context_tier: Option, + /// Whether to allow auto-mode continuation across turns. + #[serde(skip_serializing_if = "Option::is_none")] + pub continue_on_auto_mode: Option, + /// Override URL for the Copilot API endpoint. + #[serde(skip_serializing_if = "Option::is_none")] + pub copilot_url: Option, + /// Whether to default custom agents to local-only execution. + #[serde(skip_serializing_if = "Option::is_none")] + pub custom_agents_local_only: Option, + /// Instruction source IDs to exclude from the system prompt. + #[serde(skip_serializing_if = "Option::is_none")] + pub disabled_instruction_sources: Option>, + /// Skill IDs that should be excluded from this session. + #[serde(skip_serializing_if = "Option::is_none")] + pub disabled_skills: Option>, + /// Whether to enable loading of `.github/hooks/` filesystem hooks. Separate from the SDK callback hook mechanism. + #[serde(skip_serializing_if = "Option::is_none")] + pub enable_file_hooks: Option, + /// Whether to enable host git operations (context resolution, child repo scanning, git info in system prompt). + #[serde(skip_serializing_if = "Option::is_none")] + pub enable_host_git_operations: Option, + /// Whether to discover custom instructions on demand after successful file views (AGENTS.md / CLAUDE.md / .github/copilot-instructions.md surfacing). Combined with `skipCustomInstructions`. + #[serde(skip_serializing_if = "Option::is_none")] + pub enable_on_demand_instruction_discovery: Option, + /// Whether to surface reasoning-summary events from the model. + #[serde(skip_serializing_if = "Option::is_none")] + pub enable_reasoning_summaries: Option, + /// Whether shell-script safety heuristics are enabled. + #[serde(skip_serializing_if = "Option::is_none")] + pub enable_script_safety: Option, + /// Whether to enable cross-session store writes and reads. + #[serde(skip_serializing_if = "Option::is_none")] + pub enable_session_store: Option, + /// Whether to enable skill directory scanning and loading. Falls back to enableConfigDiscovery when unset. + #[serde(skip_serializing_if = "Option::is_none")] + pub enable_skills: Option, + /// Whether to stream model responses. + #[serde(skip_serializing_if = "Option::is_none")] + pub enable_streaming: Option, + /// How env values are passed to MCP servers (`direct` inlines literal values; `indirect` resolves at launch). + #[serde(skip_serializing_if = "Option::is_none")] + pub env_value_mode: Option, + /// Override directory for the session-events log. When unset, the runtime's default events log directory is used. + #[serde(skip_serializing_if = "Option::is_none")] + pub events_log_directory: Option, + /// Whether subagent callback events should be forwarded into the session event log sink. + #[serde(skip_serializing_if = "Option::is_none")] + pub events_log_includes_subagents: Option, + /// 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. + #[serde(skip_serializing_if = "Option::is_none")] + pub excluded_builtin_agents: Option>, + /// Denylist of tool names for this session. + #[serde(skip_serializing_if = "Option::is_none")] + pub excluded_tools: Option>, + /// Map of feature-flag IDs to their boolean enabled state. + #[serde(skip_serializing_if = "Option::is_none")] + pub feature_flags: Option>, + /// 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. + #[serde(skip_serializing_if = "Option::is_none")] + pub included_builtin_agents: Option>, + /// Full set of installed plugins for the session. Replaces the existing list; the runtime invalidates the skills cache only when the list materially changes. + #[serde(skip_serializing_if = "Option::is_none")] + pub installed_plugins: Option>, + /// Stable integration identifier used for analytics and rate-limit attribution. + #[serde(skip_serializing_if = "Option::is_none")] + pub integration_id: Option, + /// Whether experimental capabilities are enabled. + #[serde(skip_serializing_if = "Option::is_none")] + pub is_experimental_mode: Option, + /// Whether interactive shell sessions are logged. + #[serde(skip_serializing_if = "Option::is_none")] + pub log_interactive_shells: Option, + /// Identifier sent to LSP-style integrations. + #[serde(skip_serializing_if = "Option::is_none")] + pub lsp_client_name: Option, + /// 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). + #[serde(skip_serializing_if = "Option::is_none")] + pub manage_schedule_enabled: Option, + /// 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. + #[serde(skip_serializing_if = "Option::is_none")] + pub max_inline_binary_bytes: Option, + /// The model ID to use for assistant turns. + #[serde(skip_serializing_if = "Option::is_none")] + pub model: Option, + /// Per-property model capability overrides for the selected model. + #[serde(skip_serializing_if = "Option::is_none")] + pub model_capabilities_overrides: Option, + /// Organization-level custom instructions to inject into the system prompt. + #[serde(skip_serializing_if = "Option::is_none")] + pub organization_custom_instructions: Option, + /// Custom model-provider configuration (BYOK). + #[serde(skip_serializing_if = "Option::is_none")] + pub provider: Option, + /// 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. + #[serde(skip_serializing_if = "Option::is_none")] + pub reasoning_effort: Option, + /// Reasoning summary mode for supported model clients. + #[serde(skip_serializing_if = "Option::is_none")] + pub reasoning_summary: Option, + /// Whether the session is running in an interactive UI. + #[serde(skip_serializing_if = "Option::is_none")] + pub running_in_interactive_mode: Option, + /// Resolved sandbox configuration. + #[serde(skip_serializing_if = "Option::is_none")] + pub sandbox_config: Option, + /// 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. + #[serde(skip_serializing_if = "Option::is_none")] + pub session_capabilities: Option>, + /// Optional session limits. Pass null to clear the session limits. + #[serde(skip_serializing_if = "Option::is_none")] + pub session_limits: Option, + /// Per-session settings for built-in shell tools. + #[serde(skip_serializing_if = "Option::is_none")] + pub shell: Option, + /// Use shell.initProfile instead. Shell init profile (`None` or `NonInteractive`). + #[doc(hidden)] + #[deprecated] + #[serde(skip_serializing_if = "Option::is_none")] + pub shell_init_profile: Option, + /// PowerShell process flags applied to built-in and user-requested shell commands. + #[serde(skip_serializing_if = "Option::is_none")] + pub shell_process_flags: Option>, + /// Additional directories to search for skills. #[serde(skip_serializing_if = "Option::is_none")] - pub context: Option, + pub skill_directories: Option>, + /// Whether to skip loading custom instruction sources. + #[serde(skip_serializing_if = "Option::is_none")] + pub skip_custom_instructions: Option, + /// Whether to skip embedding retrieval pipeline initialization and execution. + #[serde(skip_serializing_if = "Option::is_none")] + pub skip_embedding_retrieval: Option, + /// 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. + #[serde(skip_serializing_if = "Option::is_none")] + pub suppress_custom_agent_prompt: Option, + /// Controls how availableTools (allowlist) and excludedTools (denylist) combine when both are set. + #[serde(skip_serializing_if = "Option::is_none")] + pub tool_filter_precedence: Option, + /// Optional path for trajectory output. + #[serde(skip_serializing_if = "Option::is_none")] + pub trajectory_file: Option, + /// Output verbosity level for supported models. + #[serde(skip_serializing_if = "Option::is_none")] + pub verbosity: Option, + /// Absolute working-directory path for shell tools. + #[serde(skip_serializing_if = "Option::is_none")] + pub working_directory: Option, } -/// Most-relevant session ID for the supplied context, or omitted when no sessions exist. +/// Indicates whether the session options patch was applied successfully. /// ///
/// @@ -16557,13 +18049,15 @@ pub struct SessionsGetLastForContextRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionsGetLastForContextResult { - /// Most-relevant session ID for the supplied context, or omitted when no sessions exist +pub struct SessionUpdateOptionsResult { + /// Number of hooks loaded from installed plugins, returned when installedPlugins is updated #[serde(skip_serializing_if = "Option::is_none")] - pub session_id: Option, + pub plugin_hook_count: Option, + /// Whether the operation succeeded + pub success: bool, } -/// Session ID whose persisted metadata should be read. +/// User-requested shell execution cancellation handle. /// ///
/// @@ -16573,12 +18067,12 @@ pub struct SessionsGetLastForContextResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionsGetMetadataRequest { - /// Session ID to inspect - pub session_id: SessionId, +pub struct ShellCancelUserRequestedRequest { + /// Request ID previously passed to executeUserRequested + pub request_id: RequestId, } -/// Persisted local session metadata when the session exists. +/// Shell command to run, with optional working directory and timeout in milliseconds. /// ///
/// @@ -16588,28 +18082,18 @@ pub struct SessionsGetMetadataRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionsGetMetadataResult { - /// Local session metadata, omitted when the session does not exist. +pub struct ShellExecRequest { + /// Shell command to execute + pub command: String, + /// Working directory (defaults to session working directory) #[serde(skip_serializing_if = "Option::is_none")] - pub session: Option, -} - -/// Session ID to look up the persisted remote-steerable flag for. -/// -///
-/// -/// **Experimental.** This type is part of an experimental wire-protocol surface -/// and may change or be removed in future SDK or CLI releases. -/// -///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct SessionsGetPersistedRemoteSteerableRequest { - /// Session ID to look up the persisted remote-steerable flag for - pub session_id: SessionId, + pub cwd: Option, + /// Timeout in milliseconds (default: 30000) + #[serde(skip_serializing_if = "Option::is_none")] + pub timeout: Option, } -/// The session's persisted remote-steerable flag, or omitted when no value has been persisted. +/// Identifier of the spawned process, used to correlate streamed output and exit notifications. /// ///
/// @@ -16619,13 +18103,12 @@ pub struct SessionsGetPersistedRemoteSteerableRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionsGetPersistedRemoteSteerableResult { - /// The session's persisted remote-steerable flag if recorded; omitted when no value has been persisted - #[serde(skip_serializing_if = "Option::is_none")] - pub remote_steerable: Option, +pub struct ShellExecResult { + /// Unique identifier for tracking streamed output + pub process_id: String, } -/// Map of sessionId -> on-disk size in bytes for each session's workspace directory. +/// User-requested shell command and cancellation handle. /// ///
/// @@ -16635,12 +18118,14 @@ pub struct SessionsGetPersistedRemoteSteerableResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionSizes { - /// Map of sessionId -> on-disk size in bytes for the session's workspace directory - pub sizes: HashMap, +pub struct ShellExecuteUserRequestedRequest { + /// Shell command to execute + pub command: String, + /// Caller-provided cancellation handle for this execution + pub request_id: RequestId, } -/// Limit for non-empty local session IDs. +/// Identifier of a process previously returned by "shell.exec" and the signal to send. /// ///
/// @@ -16650,13 +18135,15 @@ pub struct SessionSizes { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionsListNonEmptySessionIdsRequest { - /// Maximum number of session IDs to return. +pub struct ShellKillRequest { + /// Process identifier returned by shell.exec + pub process_id: String, + /// Signal to send (default: SIGTERM) #[serde(skip_serializing_if = "Option::is_none")] - pub limit: Option, + pub signal: Option, } -/// Recent local session IDs that contain user-visible history. +/// Indicates whether the signal was delivered; false if the process was unknown or already exited. /// ///
/// @@ -16666,12 +18153,12 @@ pub struct SessionsListNonEmptySessionIdsRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionsListNonEmptySessionIdsResult { - /// Session IDs ordered newest-first. - pub session_ids: Vec, +pub struct ShellKillResult { + /// Whether the signal was sent successfully + pub killed: bool, } -/// Optional source filter, metadata-load limit, and context filter applied to the returned sessions. +/// Parameters for shutting down the session /// ///
/// @@ -16681,40 +18168,16 @@ pub struct SessionsListNonEmptySessionIdsResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionsListRequest { - /// Optional filter applied to the returned sessions - #[serde(skip_serializing_if = "Option::is_none")] - pub filter: Option, - /// When true, include detached maintenance sessions. Defaults to false for user-facing session lists. - #[serde(skip_serializing_if = "Option::is_none")] - pub include_detached: Option, - /// 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). - #[serde(skip_serializing_if = "Option::is_none")] - pub metadata_limit: Option, - /// Which session sources to include. Defaults to `local` for backward compatibility. +pub struct ShutdownRequest { + /// Optional human-readable reason. Typically the message of the error that triggered shutdown when type is 'error'. #[serde(skip_serializing_if = "Option::is_none")] - pub source: Option, - /// 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. + pub reason: Option, + /// Why the session is being shut down. Defaults to "routine" when omitted. #[serde(skip_serializing_if = "Option::is_none")] - pub throw_on_error: Option, -} - -/// Active session ID whose deferred repo-level hooks should be loaded. -/// -///
-/// -/// **Experimental.** This type is part of an experimental wire-protocol surface -/// and may change or be removed in future SDK or CLI releases. -/// -///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct SessionsLoadDeferredRepoHooksRequest { - /// Active session ID whose deferred repo-level hooks should be loaded - pub session_id: SessionId, + pub r#type: Option, } -/// Age threshold and optional flags controlling which old sessions are pruned (or simulated when dryRun is true). +/// Skill metadata available to a session, with name, description, source, enabled/invocable state, path, plugin, and argument hint. /// ///
/// @@ -16724,48 +18187,32 @@ pub struct SessionsLoadDeferredRepoHooksRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionsPruneOldRequest { - /// When true, only report what would be deleted without performing any deletion +pub struct Skill { + /// Optional freeform hint describing the skill's expected arguments, from the `argument-hint` frontmatter field #[serde(skip_serializing_if = "Option::is_none")] - pub dry_run: Option, - /// Session IDs that should never be considered for pruning + pub argument_hint: Option, + /// Canonical slash command name used to invoke the skill, without the leading '/' #[serde(skip_serializing_if = "Option::is_none")] - pub exclude_session_ids: Option>, - /// When true, named sessions (set via /rename) are also eligible for pruning + pub command_name: Option, + /// Description of what the skill does + pub description: String, + /// Whether the skill is currently enabled + pub enabled: bool, + /// Unique identifier for the skill + pub name: String, + /// Absolute path to the skill file #[serde(skip_serializing_if = "Option::is_none")] - pub include_named: Option, - /// Delete sessions whose modifiedTime is at least this many days old - pub older_than_days: i64, -} - -/// Session ID whose in-use lock should be released. -/// -///
-/// -/// **Experimental.** This type is part of an experimental wire-protocol surface -/// and may change or be removed in future SDK or CLI releases. -/// -///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct SessionsReleaseLockRequest { - /// Session ID whose in-use lock should be released - pub session_id: SessionId, + pub path: Option, + /// Name of the plugin that provides the skill, when source is 'plugin' + #[serde(skip_serializing_if = "Option::is_none")] + pub plugin_name: Option, + /// Source location type (e.g., project, personal-copilot, plugin, builtin) + pub source: SkillSource, + /// Whether the skill can be invoked by the user as a slash command + pub user_invocable: bool, } -/// 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.** This type is part of an experimental wire-protocol surface -/// and may change or be removed in future SDK or CLI releases. -/// -///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct SessionsReleaseLockResult {} - -/// Active session ID and an optional flag for deferring repo-level hooks until folder trust. +/// Canonical directory where skills can be discovered or created, with scope, preference, and optional project path. /// ///
/// @@ -16775,27 +18222,19 @@ pub struct SessionsReleaseLockResult {} ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionsReloadPluginHooksRequest { - /// When true, skip repo-level hooks. Use before folder trust is confirmed; loadDeferredRepoHooks loads them post-trust. +pub struct SkillDiscoveryPath { + /// Absolute path of the create/discovery target (may not exist on disk yet) + pub path: String, + /// 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. + pub preferred_for_creation: bool, + /// The input project path this directory was derived from (only for project scope) #[serde(skip_serializing_if = "Option::is_none")] - pub defer_repo_hooks: Option, - /// Active session ID to reload hooks for - pub session_id: SessionId, + pub project_path: Option, + /// Which tier this directory belongs to + pub scope: SkillDiscoveryScope, } -/// 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.** This type is part of an experimental wire-protocol surface -/// and may change or be removed in future SDK or CLI releases. -/// -///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct SessionsReloadPluginHooksResult {} - -/// Session ID whose pending events should be flushed to disk. +/// Canonical locations where skills can be created so the runtime will recognize them. /// ///
/// @@ -16805,12 +18244,12 @@ pub struct SessionsReloadPluginHooksResult {} ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionsSaveRequest { - /// Session ID whose pending events should be flushed to disk - pub session_id: SessionId, +pub struct SkillDiscoveryPathList { + /// Canonical skill create/discovery directories, in priority order + pub paths: Vec, } -/// Flush a session's pending events to disk. No-op when no writer exists for the session (e.g., already closed). +/// Skills available to the session, with their enabled state. /// ///
/// @@ -16820,9 +18259,12 @@ pub struct SessionsSaveRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionsSaveResult {} +pub struct SkillList { + /// Available skills + pub skills: Vec, +} -/// Manager-wide additional plugins to register; replaces any previously-configured set. +/// Skill names to mark as disabled in global configuration, replacing any previous list. /// ///
/// @@ -16832,12 +18274,12 @@ pub struct SessionsSaveResult {} ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionsSetAdditionalPluginsRequest { - /// Manager-wide additional plugins to register. Replaces any previously-configured set. Pass an empty array to clear. - pub plugins: Vec, +pub struct SkillsConfigSetDisabledSkillsRequest { + /// List of skill names to disable + pub disabled_skills: Vec, } -/// 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. +/// Adds or removes a single skill from the global disabled list, leaving every other entry untouched. /// ///
/// @@ -16847,9 +18289,14 @@ pub struct SessionsSetAdditionalPluginsRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionsSetAdditionalPluginsResult {} +pub struct SkillsConfigSetSkillDisabledRequest { + /// True to disable the skill, false to enable it + pub disabled: bool, + /// Name of the skill to add to or remove from the disabled list + pub name: String, +} -/// Patch for the singleton's steering state. +/// Name of the skill to disable for the session. /// ///
/// @@ -16859,12 +18306,12 @@ pub struct SessionsSetAdditionalPluginsResult {} ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionsSetRemoteControlSteeringRequest { - /// Target steering state. Today only `true` is actionable on the underlying exporter; `false` is reserved for future use. - pub enabled: bool, +pub struct SkillsDisableRequest { + /// Name of the skill to disable + pub name: String, } -/// Parameters for attaching the remote-control singleton to a session. +/// Optional project paths and additional skill directories to include in discovery. /// ///
/// @@ -16874,14 +18321,19 @@ pub struct SessionsSetRemoteControlSteeringRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionsStartRemoteControlRequest { - /// Configuration for the runtime-managed remote-control singleton. - pub config: RemoteControlConfig, - /// Local session id to attach remote control to. - pub session_id: SessionId, +pub struct 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. + #[serde(skip_serializing_if = "Option::is_none")] + pub exclude_host_skills: Option, + /// Optional list of project directory paths to scan for project-scoped skills + #[serde(skip_serializing_if = "Option::is_none")] + pub project_paths: Option>, + /// Optional list of additional skill directory paths to include + #[serde(skip_serializing_if = "Option::is_none")] + pub skill_directories: Option>, } -/// Parameters for stopping the remote-control singleton. +/// Name of the skill to enable for the session. /// ///
/// @@ -16891,16 +18343,12 @@ pub struct SessionsStartRemoteControlRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionsStopRemoteControlRequest { - /// When provided, the stop is rejected unless the singleton currently points at this session id (compare-and-swap semantics). - #[serde(skip_serializing_if = "Option::is_none")] - pub expected_session_id: Option, - /// When true, the singleton is unconditionally torn down regardless of `expectedSessionId`. Use during shutdown or explicit `/remote off`. - #[serde(skip_serializing_if = "Option::is_none")] - pub force: Option, +pub struct SkillsEnableRequest { + /// Name of the skill to enable + pub name: String, } -/// Parameters for atomically rebinding the remote-control singleton. +/// Optional project paths to enumerate. /// ///
/// @@ -16910,15 +18358,16 @@ pub struct SessionsStopRemoteControlRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct 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). +pub struct SkillsGetDiscoveryPathsRequest { + /// When true, omit the host's personal and custom skill directories, leaving only project directories. For multitenant deployments. #[serde(skip_serializing_if = "Option::is_none")] - pub expected_from_session_id: Option, - /// Local session id to point remote control at. - pub to_session_id: String, + pub exclude_host_skills: Option, + /// Optional list of project directory paths. When omitted or empty, only personal and custom directories are returned. + #[serde(skip_serializing_if = "Option::is_none")] + pub project_paths: Option>, } -/// Telemetry engagement ID for the session, when available. +/// Skill invocation record with name, path, content, allowed tools, and turn number. /// ///
/// @@ -16928,13 +18377,21 @@ pub struct SessionsTransferRemoteControlRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionTelemetryEngagement { - /// Current telemetry engagement ID, when available. +pub struct SkillsInvokedSkill { + /// Tools that should be auto-approved when this skill is active, captured at invocation time #[serde(skip_serializing_if = "Option::is_none")] - pub engagement_id: Option, + pub allowed_tools: Option>, + /// Full content of the skill file + pub content: String, + /// Turn number when the skill was invoked + pub invoked_at_turn: i64, + /// Unique identifier for the skill + pub name: String, + /// Path to the SKILL.md file + pub path: String, } -/// Patch of mutable session options to apply to the running session. +/// Skills invoked during this session, ordered by invocation time (most recent last). /// ///
/// @@ -16944,191 +18401,12 @@ pub struct SessionTelemetryEngagement { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionUpdateOptionsParams { - /// Additional content-exclusion policies to merge into the session's policy set. - /// - ///
- /// - /// **Experimental.** This type is part of an experimental wire-protocol surface - /// and may change or be removed in future SDK or CLI releases. - /// - ///
- #[serde(skip_serializing_if = "Option::is_none")] - pub additional_content_exclusion_policies: - Option>, - /// Runtime context discriminator (e.g., `cli`, `actions`). - #[serde(skip_serializing_if = "Option::is_none")] - pub agent_context: Option, - /// Whether to include instructions from every MCP server in the system prompt instead of only allowlisted servers. - #[serde(skip_serializing_if = "Option::is_none")] - pub allow_all_mcp_server_instructions: Option, - /// Whether to disable the `ask_user` tool (encourages autonomous behavior). - #[serde(skip_serializing_if = "Option::is_none")] - pub ask_user_disabled: Option, - /// Allowlist of tool names available to this session. - #[serde(skip_serializing_if = "Option::is_none")] - pub available_tools: Option>, - /// Options scoped to the built-in CAPI (Copilot API) provider. - #[serde(skip_serializing_if = "Option::is_none")] - pub capi: Option, - /// Identifier of the client driving the session. - #[serde(skip_serializing_if = "Option::is_none")] - pub client_name: Option, - /// Whether to include the `Co-authored-by` trailer in commit messages. - #[serde(skip_serializing_if = "Option::is_none")] - pub coauthor_enabled: Option, - /// 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. - #[serde(skip_serializing_if = "Option::is_none")] - pub context_tier: Option, - /// Whether to allow auto-mode continuation across turns. - #[serde(skip_serializing_if = "Option::is_none")] - pub continue_on_auto_mode: Option, - /// Override URL for the Copilot API endpoint. - #[serde(skip_serializing_if = "Option::is_none")] - pub copilot_url: Option, - /// Whether to default custom agents to local-only execution. - #[serde(skip_serializing_if = "Option::is_none")] - pub custom_agents_local_only: Option, - /// Instruction source IDs to exclude from the system prompt. - #[serde(skip_serializing_if = "Option::is_none")] - pub disabled_instruction_sources: Option>, - /// Skill IDs that should be excluded from this session. - #[serde(skip_serializing_if = "Option::is_none")] - pub disabled_skills: Option>, - /// Whether to enable loading of `.github/hooks/` filesystem hooks. Separate from the SDK callback hook mechanism. - #[serde(skip_serializing_if = "Option::is_none")] - pub enable_file_hooks: Option, - /// Whether to enable host git operations (context resolution, child repo scanning, git info in system prompt). - #[serde(skip_serializing_if = "Option::is_none")] - pub enable_host_git_operations: Option, - /// Whether to discover custom instructions on demand after successful file views (AGENTS.md / CLAUDE.md / .github/copilot-instructions.md surfacing). Combined with `skipCustomInstructions`. - #[serde(skip_serializing_if = "Option::is_none")] - pub enable_on_demand_instruction_discovery: Option, - /// Whether to surface reasoning-summary events from the model. - #[serde(skip_serializing_if = "Option::is_none")] - pub enable_reasoning_summaries: Option, - /// Whether shell-script safety heuristics are enabled. - #[serde(skip_serializing_if = "Option::is_none")] - pub enable_script_safety: Option, - /// Whether to enable cross-session store writes and reads. - #[serde(skip_serializing_if = "Option::is_none")] - pub enable_session_store: Option, - /// Whether to enable skill directory scanning and loading. Falls back to enableConfigDiscovery when unset. - #[serde(skip_serializing_if = "Option::is_none")] - pub enable_skills: Option, - /// Whether to stream model responses. - #[serde(skip_serializing_if = "Option::is_none")] - pub enable_streaming: Option, - /// How env values are passed to MCP servers (`direct` inlines literal values; `indirect` resolves at launch). - #[serde(skip_serializing_if = "Option::is_none")] - pub env_value_mode: Option, - /// Override directory for the session-events log. When unset, the runtime's default events log directory is used. - #[serde(skip_serializing_if = "Option::is_none")] - pub events_log_directory: Option, - /// Whether subagent callback events should be forwarded into the session event log sink. - #[serde(skip_serializing_if = "Option::is_none")] - pub events_log_includes_subagents: Option, - /// 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. - #[serde(skip_serializing_if = "Option::is_none")] - pub excluded_builtin_agents: Option>, - /// Denylist of tool names for this session. - #[serde(skip_serializing_if = "Option::is_none")] - pub excluded_tools: Option>, - /// Map of feature-flag IDs to their boolean enabled state. - #[serde(skip_serializing_if = "Option::is_none")] - pub feature_flags: Option>, - /// 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. - #[serde(skip_serializing_if = "Option::is_none")] - pub included_builtin_agents: Option>, - /// Full set of installed plugins for the session. Replaces the existing list; the runtime invalidates the skills cache only when the list materially changes. - #[serde(skip_serializing_if = "Option::is_none")] - pub installed_plugins: Option>, - /// Stable integration identifier used for analytics and rate-limit attribution. - #[serde(skip_serializing_if = "Option::is_none")] - pub integration_id: Option, - /// Whether experimental capabilities are enabled. - #[serde(skip_serializing_if = "Option::is_none")] - pub is_experimental_mode: Option, - /// Whether interactive shell sessions are logged. - #[serde(skip_serializing_if = "Option::is_none")] - pub log_interactive_shells: Option, - /// Identifier sent to LSP-style integrations. - #[serde(skip_serializing_if = "Option::is_none")] - pub lsp_client_name: Option, - /// 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). - #[serde(skip_serializing_if = "Option::is_none")] - pub manage_schedule_enabled: Option, - /// 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. - #[serde(skip_serializing_if = "Option::is_none")] - pub max_inline_binary_bytes: Option, - /// The model ID to use for assistant turns. - #[serde(skip_serializing_if = "Option::is_none")] - pub model: Option, - /// Per-property model capability overrides for the selected model. - #[serde(skip_serializing_if = "Option::is_none")] - pub model_capabilities_overrides: Option, - /// Organization-level custom instructions to inject into the system prompt. - #[serde(skip_serializing_if = "Option::is_none")] - pub organization_custom_instructions: Option, - /// Custom model-provider configuration (BYOK). - #[serde(skip_serializing_if = "Option::is_none")] - pub provider: Option, - /// 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. - #[serde(skip_serializing_if = "Option::is_none")] - pub reasoning_effort: Option, - /// Reasoning summary mode for supported model clients. - #[serde(skip_serializing_if = "Option::is_none")] - pub reasoning_summary: Option, - /// Whether the session is running in an interactive UI. - #[serde(skip_serializing_if = "Option::is_none")] - pub running_in_interactive_mode: Option, - /// Resolved sandbox configuration. - #[serde(skip_serializing_if = "Option::is_none")] - pub sandbox_config: Option, - /// 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. - #[serde(skip_serializing_if = "Option::is_none")] - pub session_capabilities: Option>, - /// Optional session limits. Pass null to clear the session limits. - #[serde(skip_serializing_if = "Option::is_none")] - pub session_limits: Option, - /// Per-session settings for built-in shell tools. - #[serde(skip_serializing_if = "Option::is_none")] - pub shell: Option, - /// Use shell.initProfile instead. Shell init profile (`None` or `NonInteractive`). - #[doc(hidden)] - #[deprecated] - #[serde(skip_serializing_if = "Option::is_none")] - pub shell_init_profile: Option, - /// PowerShell process flags applied to built-in and user-requested shell commands. - #[serde(skip_serializing_if = "Option::is_none")] - pub shell_process_flags: Option>, - /// Additional directories to search for skills. - #[serde(skip_serializing_if = "Option::is_none")] - pub skill_directories: Option>, - /// Whether to skip loading custom instruction sources. - #[serde(skip_serializing_if = "Option::is_none")] - pub skip_custom_instructions: Option, - /// Whether to skip embedding retrieval pipeline initialization and execution. - #[serde(skip_serializing_if = "Option::is_none")] - pub skip_embedding_retrieval: Option, - /// 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. - #[serde(skip_serializing_if = "Option::is_none")] - pub suppress_custom_agent_prompt: Option, - /// Controls how availableTools (allowlist) and excludedTools (denylist) combine when both are set. - #[serde(skip_serializing_if = "Option::is_none")] - pub tool_filter_precedence: Option, - /// Optional path for trajectory output. - #[serde(skip_serializing_if = "Option::is_none")] - pub trajectory_file: Option, - /// Output verbosity level for supported models. - #[serde(skip_serializing_if = "Option::is_none")] - pub verbosity: Option, - /// Absolute working-directory path for shell tools. - #[serde(skip_serializing_if = "Option::is_none")] - pub working_directory: Option, +pub struct SkillsGetInvokedResult { + /// Skills invoked during this session, ordered by invocation time (most recent last) + pub skills: Vec, } -/// Indicates whether the session options patch was applied successfully. +/// Diagnostics from reloading skill definitions, with warnings and errors as separate lists. /// ///
/// @@ -17138,15 +18416,13 @@ pub struct SessionUpdateOptionsParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionUpdateOptionsResult { - /// Number of hooks loaded from installed plugins, returned when installedPlugins is updated - #[serde(skip_serializing_if = "Option::is_none")] - pub plugin_hook_count: Option, - /// Whether the operation succeeded - pub success: bool, +pub struct SkillsLoadDiagnostics { + /// Errors emitted while loading skills (e.g. skills that failed to load entirely) + pub errors: Vec, + /// Warnings emitted while loading skills (e.g. skills that loaded but had issues) + pub warnings: Vec, } -/// User-requested shell execution cancellation handle. /// ///
/// @@ -17156,12 +18432,16 @@ pub struct SessionUpdateOptionsResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ShellCancelUserRequestedRequest { - /// Request ID previously passed to executeUserRequested - pub request_id: RequestId, +pub struct SlashCommandTimelineEntry { + /// Text displayed for the timeline entry. + pub text: String, + /// Timeline entry presentation type. + pub r#type: String, + /// Optional URL associated with the timeline entry. + #[serde(skip_serializing_if = "Option::is_none")] + pub url: Option, } -/// Shell command to run, with optional working directory and timeout in milliseconds. /// ///
/// @@ -17171,18 +18451,20 @@ pub struct ShellCancelUserRequestedRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ShellExecRequest { - /// Shell command to execute - pub command: String, - /// Working directory (defaults to session working directory) +pub struct SlashCommandAddTimelineEntryResult { + /// Timeline entry the host should append. + pub entry: SlashCommandTimelineEntry, + /// Discriminator for an add-timeline-entry result. + pub kind: SlashCommandAddTimelineEntryResultKind, + /// Optional text the host should prefill into the input editor. #[serde(skip_serializing_if = "Option::is_none")] - pub cwd: Option, - /// Timeout in milliseconds (default: 30000) + pub prefill_input: Option, + /// Whether command execution changed persisted runtime settings. #[serde(skip_serializing_if = "Option::is_none")] - pub timeout: Option, + pub runtime_settings_changed: Option, } -/// Identifier of the spawned process, used to correlate streamed output and exit notifications. +/// Slash-command invocation result that submits an agent prompt, with display prompt, optional mode, optional user-facing notice, and settings-change flag. /// ///
/// @@ -17192,12 +18474,25 @@ pub struct ShellExecRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ShellExecResult { - /// Unique identifier for tracking streamed output - pub process_id: String, +pub struct SlashCommandAgentPromptResult { + /// Prompt text to display to the user + pub display_prompt: String, + /// Agent prompt result discriminator + pub kind: SlashCommandAgentPromptResultKind, + /// Optional target session mode for the agent prompt + #[serde(skip_serializing_if = "Option::is_none")] + pub mode: Option, + /// Optional user-facing notice to show before the prompt is submitted + #[serde(skip_serializing_if = "Option::is_none")] + pub notice: Option, + /// Prompt to submit to the agent + pub prompt: String, + /// True when the invocation mutated user runtime settings; consumers caching settings should refresh + #[serde(skip_serializing_if = "Option::is_none")] + pub runtime_settings_changed: Option, } -/// User-requested shell command and cancellation handle. +/// Slash-command invocation result indicating completion, with optional message and settings-change flag. /// ///
/// @@ -17207,14 +18502,18 @@ pub struct ShellExecResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ShellExecuteUserRequestedRequest { - /// Shell command to execute - pub command: String, - /// Caller-provided cancellation handle for this execution - pub request_id: RequestId, +pub struct SlashCommandCompletedResult { + /// Completed result discriminator + pub kind: SlashCommandCompletedResultKind, + /// Optional user-facing message describing the completed command + #[serde(skip_serializing_if = "Option::is_none")] + pub message: Option, + /// True when the invocation mutated user runtime settings; consumers caching settings should refresh + #[serde(skip_serializing_if = "Option::is_none")] + pub runtime_settings_changed: Option, } -/// Identifier of a process previously returned by "shell.exec" and the signal to send. +/// Slash-command invocation result containing text output plus Markdown/ANSI rendering flags. /// ///
/// @@ -17224,15 +18523,23 @@ pub struct ShellExecuteUserRequestedRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ShellKillRequest { - /// Process identifier returned by shell.exec - pub process_id: String, - /// Signal to send (default: SIGTERM) +pub struct SlashCommandTextResult { + /// Text result discriminator + pub kind: SlashCommandTextResultKind, + /// Whether text contains Markdown #[serde(skip_serializing_if = "Option::is_none")] - pub signal: Option, + pub markdown: Option, + /// Whether ANSI sequences should be preserved + #[serde(skip_serializing_if = "Option::is_none")] + pub preserve_ansi: Option, + /// True when the invocation mutated user runtime settings; consumers caching settings should refresh + #[serde(skip_serializing_if = "Option::is_none")] + pub runtime_settings_changed: Option, + /// Text output for the client to render + pub text: String, } -/// Indicates whether the signal was delivered; false if the process was unknown or already exited. +/// Selectable slash-command subcommand option with name, description, and optional group label. /// ///
/// @@ -17242,12 +18549,17 @@ pub struct ShellKillRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ShellKillResult { - /// Whether the signal was sent successfully - pub killed: bool, +pub struct SlashCommandSelectSubcommandOption { + /// Human-readable description of the subcommand + pub description: String, + /// Optional group label for organizing options + #[serde(skip_serializing_if = "Option::is_none")] + pub group: Option, + /// Subcommand name to invoke + pub name: String, } -/// Parameters for shutting down the session +/// Slash-command invocation result asking the client to present subcommand options for a parent command. /// ///
/// @@ -17257,16 +18569,20 @@ pub struct ShellKillResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ShutdownRequest { - /// Optional human-readable reason. Typically the message of the error that triggered shutdown when type is 'error'. - #[serde(skip_serializing_if = "Option::is_none")] - pub reason: Option, - /// Why the session is being shut down. Defaults to "routine" when omitted. +pub struct SlashCommandSelectSubcommandResult { + /// Parent command name that requires subcommand selection + pub command: String, + /// Select subcommand result discriminator + pub kind: SlashCommandSelectSubcommandResultKind, + /// Available subcommand options for the client to present + pub options: Vec, + /// True when the invocation mutated user runtime settings; consumers caching settings should refresh #[serde(skip_serializing_if = "Option::is_none")] - pub r#type: Option, + pub runtime_settings_changed: Option, + /// Human-readable title for the selection UI + pub title: String, } -/// Skill metadata available to a session, with name, description, source, enabled/invocable state, path, plugin, and argument hint. /// ///
/// @@ -17276,32 +18592,39 @@ pub struct ShutdownRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct Skill { - /// Optional freeform hint describing the skill's expected arguments, from the `argument-hint` frontmatter field +pub struct SlashCommandModelPickerDialog { + /// Discriminator for a model-picker dialog. + pub kind: SlashCommandModelPickerDialogKind, + /// Model that should be enabled before it can be selected. #[serde(skip_serializing_if = "Option::is_none")] - pub argument_hint: Option, - /// Canonical slash command name used to invoke the skill, without the leading '/' + pub model_to_enable: Option, + /// Settings scope the picker should modify. #[serde(skip_serializing_if = "Option::is_none")] - pub command_name: Option, - /// Description of what the skill does - pub description: String, - /// Whether the skill is currently enabled - pub enabled: bool, - /// Unique identifier for the skill - pub name: String, - /// Absolute path to the skill file + pub scope: Option, + /// Model-selection target represented by the picker. #[serde(skip_serializing_if = "Option::is_none")] - pub path: Option, - /// Name of the plugin that provides the skill, when source is 'plugin' + pub target: Option, +} + +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SlashCommandShowDialogResult { + /// Dialog the host should display. + pub dialog: SlashCommandModelPickerDialog, + /// Discriminator for a show-dialog result. + pub kind: SlashCommandShowDialogResultKind, + /// Whether command execution changed persisted runtime settings. #[serde(skip_serializing_if = "Option::is_none")] - pub plugin_name: Option, - /// Source location type (e.g., project, personal-copilot, plugin, builtin) - pub source: SkillSource, - /// Whether the skill can be invoked by the user as a slash command - pub user_invocable: bool, + pub runtime_settings_changed: Option, } -/// Canonical directory where skills can be discovered or created, with scope, preference, and optional project path. /// ///
/// @@ -17311,19 +18634,31 @@ pub struct Skill { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SkillDiscoveryPath { - /// Absolute path of the create/discovery target (may not exist on disk yet) - pub path: String, - /// 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. - pub preferred_for_creation: bool, - /// The input project path this directory was derived from (only for project scope) +pub struct SlashCommandSetModelResult { + /// Discriminator for a set-model result. + pub kind: SlashCommandSetModelResultKind, + /// Model selected by the command. + pub model: String, + /// Reasoning effort selected for the model. #[serde(skip_serializing_if = "Option::is_none")] - pub project_path: Option, - /// Which tier this directory belongs to - pub scope: SkillDiscoveryScope, + pub reasoning_effort: Option, + /// Repository settings scope modified by the command. + #[serde(skip_serializing_if = "Option::is_none")] + pub repo_scope: Option, + /// User-settings snapshot to restore if the host cancels the model switch. + #[serde(skip_serializing_if = "Option::is_none")] + pub revert_on_cancel: Option, + /// Whether command execution changed persisted runtime settings. + #[serde(skip_serializing_if = "Option::is_none")] + pub runtime_settings_changed: Option, + /// Settings scope modified by the command. + #[serde(skip_serializing_if = "Option::is_none")] + pub scope: Option, + /// User-facing warning produced while selecting the model. + #[serde(skip_serializing_if = "Option::is_none")] + pub warning: Option, } -/// Canonical locations where skills can be created so the runtime will recognize them. /// ///
/// @@ -17333,12 +18668,20 @@ pub struct SkillDiscoveryPath { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SkillDiscoveryPathList { - /// Canonical skill create/discovery directories, in priority order - pub paths: Vec, +pub struct SlashCommandSetPlanModelResult { + /// Discriminator for a set-plan-model result. + pub kind: SlashCommandSetPlanModelResultKind, + /// User-facing confirmation message for the plan-model selection. + pub message: String, + /// Dedicated model selected for plan mode. + #[serde(skip_serializing_if = "Option::is_none")] + pub plan_model: Option, + /// Whether command execution changed persisted runtime settings. + #[serde(skip_serializing_if = "Option::is_none")] + pub runtime_settings_changed: Option, } -/// Skills available to the session, with their enabled state. +/// Subagent model, reasoning effort, and context tier settings /// ///
/// @@ -17348,12 +18691,19 @@ pub struct SkillDiscoveryPathList { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SkillList { - /// Available skills - pub skills: Vec, +pub struct SubagentSettingsEntry { + /// Context tier override for matching subagents + #[serde(skip_serializing_if = "Option::is_none")] + pub context_tier: Option, + /// Reasoning effort override for matching subagents + #[serde(skip_serializing_if = "Option::is_none")] + pub effort_level: Option, + /// Model override for matching subagents + #[serde(skip_serializing_if = "Option::is_none")] + pub model: Option, } -/// Skill names to mark as disabled in global configuration, replacing any previous list. +/// Subagent settings to apply, or null to clear the live session override /// ///
/// @@ -17363,12 +18713,22 @@ pub struct SkillList { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SkillsConfigSetDisabledSkillsRequest { - /// List of skill names to disable - pub disabled_skills: Vec, +pub struct SubagentSettings { + /// Per-agent settings keyed by subagent agent_type + #[serde(skip_serializing_if = "Option::is_none")] + pub agents: Option>, + /// Names of subagents the user has turned off; they cannot be dispatched + #[serde(skip_serializing_if = "Option::is_none")] + pub disabled_subagents: Option>, + /// Maximum number of subagents that can run concurrently; applies to usage-based billing users only + #[serde(skip_serializing_if = "Option::is_none")] + pub max_concurrency: Option, + /// Maximum subagent nesting depth; applies to usage-based billing users only + #[serde(skip_serializing_if = "Option::is_none")] + pub max_depth: Option, } -/// Adds or removes a single skill from the global disabled list, leaving every other entry untouched. +/// Tracked background agent task metadata, including IDs, status, timing, agent type, prompt, model, result, and latest response. /// ///
/// @@ -17378,14 +18738,62 @@ pub struct SkillsConfigSetDisabledSkillsRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SkillsConfigSetSkillDisabledRequest { - /// True to disable the skill, false to enable it - pub disabled: bool, - /// Name of the skill to add to or remove from the disabled list - pub name: String, +pub struct TaskAgentInfo { + /// ISO 8601 timestamp when the current active period began + #[serde(skip_serializing_if = "Option::is_none")] + pub active_started_at: Option, + /// Accumulated active execution time in milliseconds + #[serde(skip_serializing_if = "Option::is_none")] + pub active_time_ms: Option, + /// Type of agent running this task + pub agent_type: String, + /// 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. + #[serde(skip_serializing_if = "Option::is_none")] + pub can_promote_to_background: Option, + /// ISO 8601 timestamp when the task finished + #[serde(skip_serializing_if = "Option::is_none")] + pub completed_at: Option, + /// Short description of the task + pub description: String, + /// Friendly, non-unique name intended for display + #[serde(skip_serializing_if = "Option::is_none")] + pub display_name: Option, + /// Error message when the task failed + #[serde(skip_serializing_if = "Option::is_none")] + pub error: Option, + /// Whether task execution is synchronously awaited or managed in the background + #[serde(skip_serializing_if = "Option::is_none")] + pub execution_mode: Option, + /// Unique task identifier + pub id: String, + /// ISO 8601 timestamp when the agent entered idle state + #[serde(skip_serializing_if = "Option::is_none")] + pub idle_since: Option, + /// Most recent response text from the agent + #[serde(skip_serializing_if = "Option::is_none")] + pub latest_response: Option, + /// Requested model override for the task when specified + #[serde(skip_serializing_if = "Option::is_none")] + pub model: Option, + /// Most recent prompt delivered to the agent. Updated whenever the agent receives a follow-up message. + pub prompt: String, + /// Runtime model resolved for the task when available + #[serde(skip_serializing_if = "Option::is_none")] + pub resolved_model: Option, + /// Result text from the task when available + #[serde(skip_serializing_if = "Option::is_none")] + pub result: Option, + /// ISO 8601 timestamp when the task was started + pub started_at: String, + /// Current lifecycle status of the task + pub status: TaskStatus, + /// Tool call ID associated with this agent task + pub tool_call_id: String, + /// Task kind + pub r#type: TaskAgentInfoType, } -/// Name of the skill to disable for the session. +/// Timestamped display line for task progress output or recent agent activity. /// ///
/// @@ -17395,12 +18803,14 @@ pub struct SkillsConfigSetSkillDisabledRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SkillsDisableRequest { - /// Name of the skill to disable - pub name: String, +pub struct TaskProgressLine { + /// Display message, e.g., "▸ bash", "✓ edit src/foo.ts" + pub message: String, + /// ISO 8601 timestamp when this event occurred + pub timestamp: String, } -/// Optional project paths and additional skill directories to include in discovery. +/// Progress snapshot for an agent task, with recent activity lines and optional latest intent. /// ///
/// @@ -17410,19 +18820,17 @@ pub struct SkillsDisableRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct 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. - #[serde(skip_serializing_if = "Option::is_none")] - pub exclude_host_skills: Option, - /// Optional list of project directory paths to scan for project-scoped skills - #[serde(skip_serializing_if = "Option::is_none")] - pub project_paths: Option>, - /// Optional list of additional skill directory paths to include +pub struct TaskAgentProgress { + /// The most recent intent reported by the agent #[serde(skip_serializing_if = "Option::is_none")] - pub skill_directories: Option>, + pub latest_intent: Option, + /// Recent tool execution events converted to display lines + pub recent_activity: Vec, + /// Progress kind + pub r#type: TaskAgentProgressType, } -/// Name of the skill to enable for the session. +/// Task completion notification with summary from the agent /// ///
/// @@ -17432,12 +18840,24 @@ pub struct SkillsDiscoverRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SkillsEnableRequest { - /// Name of the skill to enable - pub name: String, +pub struct TaskCompleteData { + /// Active autopilot objective ID evaluated by the completion reviewer + #[serde(skip_serializing_if = "Option::is_none")] + pub objective_id: Option, + /// Semantic completion decision. Absent on legacy events and invalid tool calls + #[serde(skip_serializing_if = "Option::is_none")] + pub outcome: Option, + /// 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 + #[serde(skip_serializing_if = "Option::is_none")] + pub reason: Option, + /// Whether the task was accepted as complete. False when validation failed or completion was rejected or blocked by the reviewer + #[serde(skip_serializing_if = "Option::is_none")] + pub success: Option, + /// Summary of the completed task, provided by the agent + #[serde(skip_serializing_if = "Option::is_none")] + pub summary: Option, } -/// Optional project paths to enumerate. /// ///
/// @@ -17447,16 +18867,30 @@ pub struct SkillsEnableRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SkillsGetDiscoveryPathsRequest { - /// When true, omit the host's personal and custom skill directories, leaving only project directories. For multitenant deployments. +pub struct TaskCompletionDecision { + /// Objective eligibility token captured when the decision was evaluated. #[serde(skip_serializing_if = "Option::is_none")] - pub exclude_host_skills: Option, - /// Optional list of project directory paths. When omitted or empty, only personal and custom directories are returned. + pub completion_eligibility_token: Option, + /// Whether completion was accepted after the reviewer-rejection budget was exhausted. #[serde(skip_serializing_if = "Option::is_none")] - pub project_paths: Option>, + pub completion_rejection_budget_exhausted: Option, + /// Active autopilot objective evaluated by the completion reviewer. + #[serde(skip_serializing_if = "Option::is_none")] + pub objective_id: Option, + /// Semantic result of evaluating the task completion request. + pub outcome: TaskCompletionOutcome, + /// Rationale for the completion decision, when one is available. + #[serde(skip_serializing_if = "Option::is_none")] + pub reason: Option, + /// Whether the rationale was derived from completion-reviewer output. + #[serde(skip_serializing_if = "Option::is_none")] + pub reviewer_derived: Option, + /// Information-flow metadata captured from the completion reviewer. + #[serde(skip_serializing_if = "Option::is_none")] + pub reviewer_result_meta: Option, } -/// Skill invocation record with name, path, content, allowed tools, and turn number. +/// Background tasks currently tracked by the session. /// ///
/// @@ -17466,21 +18900,12 @@ pub struct SkillsGetDiscoveryPathsRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SkillsInvokedSkill { - /// Tools that should be auto-approved when this skill is active, captured at invocation time - #[serde(skip_serializing_if = "Option::is_none")] - pub allowed_tools: Option>, - /// Full content of the skill file - pub content: String, - /// Turn number when the skill was invoked - pub invoked_at_turn: i64, - /// Unique identifier for the skill - pub name: String, - /// Path to the SKILL.md file - pub path: String, +pub struct TaskList { + /// Currently tracked tasks + pub tasks: Vec, } -/// Skills invoked during this session, ordered by invocation time (most recent last). +/// Identifier of the background task to cancel. /// ///
/// @@ -17490,12 +18915,12 @@ pub struct SkillsInvokedSkill { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SkillsGetInvokedResult { - /// Skills invoked during this session, ordered by invocation time (most recent last) - pub skills: Vec, +pub struct TasksCancelRequest { + /// Task identifier + pub id: String, } -/// Diagnostics from reloading skill definitions, with warnings and errors as separate lists. +/// Indicates whether the background task was successfully cancelled. /// ///
/// @@ -17505,13 +18930,12 @@ pub struct SkillsGetInvokedResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SkillsLoadDiagnostics { - /// Errors emitted while loading skills (e.g. skills that failed to load entirely) - pub errors: Vec, - /// Warnings emitted while loading skills (e.g. skills that loaded but had issues) - pub warnings: Vec, +pub struct TasksCancelResult { + /// Whether the task was successfully cancelled + pub cancelled: bool, } +/// The first sync-waiting task that can currently be promoted to background mode. /// ///
/// @@ -17521,16 +18945,13 @@ pub struct SkillsLoadDiagnostics { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SlashCommandTimelineEntry { - /// Text displayed for the timeline entry. - pub text: String, - /// Timeline entry presentation type. - pub r#type: String, - /// Optional URL associated with the timeline entry. +pub struct 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. #[serde(skip_serializing_if = "Option::is_none")] - pub url: Option, + pub task: Option, } +/// Identifier of the background task to fetch progress for. /// ///
/// @@ -17540,20 +18961,12 @@ pub struct SlashCommandTimelineEntry { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SlashCommandAddTimelineEntryResult { - /// Timeline entry the host should append. - pub entry: SlashCommandTimelineEntry, - /// Discriminator for an add-timeline-entry result. - pub kind: SlashCommandAddTimelineEntryResultKind, - /// Optional text the host should prefill into the input editor. - #[serde(skip_serializing_if = "Option::is_none")] - pub prefill_input: Option, - /// Whether command execution changed persisted runtime settings. - #[serde(skip_serializing_if = "Option::is_none")] - pub runtime_settings_changed: Option, +pub struct TasksGetProgressRequest { + /// Task identifier (agent ID or shell ID) + pub id: String, } -/// Slash-command invocation result that submits an agent prompt, with display prompt, optional mode, optional user-facing notice, and settings-change flag. +/// Progress information for the task, or null when no task with that ID is tracked. /// ///
/// @@ -17563,25 +18976,12 @@ pub struct SlashCommandAddTimelineEntryResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SlashCommandAgentPromptResult { - /// Prompt text to display to the user - pub display_prompt: String, - /// Agent prompt result discriminator - pub kind: SlashCommandAgentPromptResultKind, - /// Optional target session mode for the agent prompt - #[serde(skip_serializing_if = "Option::is_none")] - pub mode: Option, - /// Optional user-facing notice to show before the prompt is submitted - #[serde(skip_serializing_if = "Option::is_none")] - pub notice: Option, - /// Prompt to submit to the agent - pub prompt: String, - /// True when the invocation mutated user runtime settings; consumers caching settings should refresh - #[serde(skip_serializing_if = "Option::is_none")] - pub runtime_settings_changed: Option, +pub struct TasksGetProgressResult { + /// Progress information for the task, discriminated by type. Returns null when no task with this ID is currently tracked. + pub progress: Option, } -/// Slash-command invocation result indicating completion, with optional message and settings-change flag. +/// Tracked shell task metadata, including ID, command, status, timing, attachment/execution mode, log path, and PID. /// ///
/// @@ -17591,18 +18991,39 @@ pub struct SlashCommandAgentPromptResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SlashCommandCompletedResult { - /// Completed result discriminator - pub kind: SlashCommandCompletedResultKind, - /// Optional user-facing message describing the completed command +pub struct TaskShellInfo { + /// Whether the shell runs inside a managed PTY session or as an independent background process + pub attachment_mode: TaskShellInfoAttachmentMode, + /// Whether this shell task can be promoted to background mode #[serde(skip_serializing_if = "Option::is_none")] - pub message: Option, - /// True when the invocation mutated user runtime settings; consumers caching settings should refresh + pub can_promote_to_background: Option, + /// Command being executed + pub command: String, + /// ISO 8601 timestamp when the task finished #[serde(skip_serializing_if = "Option::is_none")] - pub runtime_settings_changed: Option, + pub completed_at: Option, + /// Short description of the task + pub description: String, + /// Whether task execution is synchronously awaited or managed in the background + #[serde(skip_serializing_if = "Option::is_none")] + pub execution_mode: Option, + /// Unique task identifier + pub id: String, + /// Path to the detached shell log, when available + #[serde(skip_serializing_if = "Option::is_none")] + pub log_path: Option, + /// Process ID when available + #[serde(skip_serializing_if = "Option::is_none")] + pub pid: Option, + /// ISO 8601 timestamp when the task was started + pub started_at: String, + /// Current lifecycle status of the task + pub status: TaskStatus, + /// Task kind + pub r#type: TaskShellInfoType, } -/// Slash-command invocation result containing text output plus Markdown/ANSI rendering flags. +/// Progress snapshot for a shell task, with recent stdout/stderr output and optional process ID. /// ///
/// @@ -17612,23 +19033,17 @@ pub struct SlashCommandCompletedResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SlashCommandTextResult { - /// Text result discriminator - pub kind: SlashCommandTextResultKind, - /// Whether text contains Markdown - #[serde(skip_serializing_if = "Option::is_none")] - pub markdown: Option, - /// Whether ANSI sequences should be preserved - #[serde(skip_serializing_if = "Option::is_none")] - pub preserve_ansi: Option, - /// True when the invocation mutated user runtime settings; consumers caching settings should refresh +pub struct TaskShellProgress { + /// Process ID when available #[serde(skip_serializing_if = "Option::is_none")] - pub runtime_settings_changed: Option, - /// Text output for the client to render - pub text: String, + pub pid: Option, + /// Recent stdout/stderr lines from the running shell command + pub recent_output: String, + /// Progress kind + pub r#type: TaskShellProgressType, } -/// Selectable slash-command subcommand option with name, description, and optional group label. +/// The promoted task as it now exists in background mode, omitted if no promotable task was waiting. /// ///
/// @@ -17638,17 +19053,13 @@ pub struct SlashCommandTextResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SlashCommandSelectSubcommandOption { - /// Human-readable description of the subcommand - pub description: String, - /// Optional group label for organizing options +pub struct 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. #[serde(skip_serializing_if = "Option::is_none")] - pub group: Option, - /// Subcommand name to invoke - pub name: String, + pub task: Option, } -/// Slash-command invocation result asking the client to present subcommand options for a parent command. +/// Identifier of the task to promote to background mode. /// ///
/// @@ -17658,20 +19069,12 @@ pub struct SlashCommandSelectSubcommandOption { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SlashCommandSelectSubcommandResult { - /// Parent command name that requires subcommand selection - pub command: String, - /// Select subcommand result discriminator - pub kind: SlashCommandSelectSubcommandResultKind, - /// Available subcommand options for the client to present - pub options: Vec, - /// True when the invocation mutated user runtime settings; consumers caching settings should refresh - #[serde(skip_serializing_if = "Option::is_none")] - pub runtime_settings_changed: Option, - /// Human-readable title for the selection UI - pub title: String, +pub struct TasksPromoteToBackgroundRequest { + /// Task identifier + pub id: String, } +/// Indicates whether the task was successfully promoted to background mode. /// ///
/// @@ -17681,20 +19084,12 @@ pub struct SlashCommandSelectSubcommandResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SlashCommandModelPickerDialog { - /// Discriminator for a model-picker dialog. - pub kind: SlashCommandModelPickerDialogKind, - /// Model that should be enabled before it can be selected. - #[serde(skip_serializing_if = "Option::is_none")] - pub model_to_enable: Option, - /// Settings scope the picker should modify. - #[serde(skip_serializing_if = "Option::is_none")] - pub scope: Option, - /// Model-selection target represented by the picker. - #[serde(skip_serializing_if = "Option::is_none")] - pub target: Option, +pub struct TasksPromoteToBackgroundResult { + /// Whether the task was successfully promoted to background mode + pub promoted: bool, } +/// 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. /// ///
/// @@ -17704,16 +19099,9 @@ pub struct SlashCommandModelPickerDialog { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SlashCommandShowDialogResult { - /// Dialog the host should display. - pub dialog: SlashCommandModelPickerDialog, - /// Discriminator for a show-dialog result. - pub kind: SlashCommandShowDialogResultKind, - /// Whether command execution changed persisted runtime settings. - #[serde(skip_serializing_if = "Option::is_none")] - pub runtime_settings_changed: Option, -} +pub struct TasksRefreshResult {} +/// Identifier of the completed or cancelled task to remove from tracking. /// ///
/// @@ -17723,31 +19111,12 @@ pub struct SlashCommandShowDialogResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SlashCommandSetModelResult { - /// Discriminator for a set-model result. - pub kind: SlashCommandSetModelResultKind, - /// Model selected by the command. - pub model: String, - /// Reasoning effort selected for the model. - #[serde(skip_serializing_if = "Option::is_none")] - pub reasoning_effort: Option, - /// Repository settings scope modified by the command. - #[serde(skip_serializing_if = "Option::is_none")] - pub repo_scope: Option, - /// User-settings snapshot to restore if the host cancels the model switch. - #[serde(skip_serializing_if = "Option::is_none")] - pub revert_on_cancel: Option, - /// Whether command execution changed persisted runtime settings. - #[serde(skip_serializing_if = "Option::is_none")] - pub runtime_settings_changed: Option, - /// Settings scope modified by the command. - #[serde(skip_serializing_if = "Option::is_none")] - pub scope: Option, - /// User-facing warning produced while selecting the model. - #[serde(skip_serializing_if = "Option::is_none")] - pub warning: Option, +pub struct TasksRemoveRequest { + /// Task identifier + pub id: String, } +/// Indicates whether the task was removed. False when the task does not exist or is still running/idle. /// ///
/// @@ -17757,20 +19126,12 @@ pub struct SlashCommandSetModelResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SlashCommandSetPlanModelResult { - /// Discriminator for a set-plan-model result. - pub kind: SlashCommandSetPlanModelResultKind, - /// User-facing confirmation message for the plan-model selection. - pub message: String, - /// Dedicated model selected for plan mode. - #[serde(skip_serializing_if = "Option::is_none")] - pub plan_model: Option, - /// Whether command execution changed persisted runtime settings. - #[serde(skip_serializing_if = "Option::is_none")] - pub runtime_settings_changed: Option, +pub struct TasksRemoveResult { + /// Whether the task was removed. Returns false if the task does not exist or is still running/idle (cancel it first). + pub removed: bool, } -/// Subagent model, reasoning effort, and context tier settings +/// Identifier of the target agent task, message content, and optional sender agent ID. /// ///
/// @@ -17780,19 +19141,17 @@ pub struct SlashCommandSetPlanModelResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SubagentSettingsEntry { - /// Context tier override for matching subagents - #[serde(skip_serializing_if = "Option::is_none")] - pub context_tier: Option, - /// Reasoning effort override for matching subagents - #[serde(skip_serializing_if = "Option::is_none")] - pub effort_level: Option, - /// Model override for matching subagents +pub struct TasksSendMessageRequest { + /// Agent ID of the sender, if sent on behalf of another agent #[serde(skip_serializing_if = "Option::is_none")] - pub model: Option, + pub from_agent_id: Option, + /// Agent task identifier + pub id: String, + /// Message content to send to the agent + pub message: String, } -/// Subagent settings to apply, or null to clear the live session override +/// Indicates whether the message was delivered, with an error message when delivery failed. /// ///
/// @@ -17802,22 +19161,15 @@ pub struct SubagentSettingsEntry { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SubagentSettings { - /// Per-agent settings keyed by subagent agent_type - #[serde(skip_serializing_if = "Option::is_none")] - pub agents: Option>, - /// Names of subagents the user has turned off; they cannot be dispatched - #[serde(skip_serializing_if = "Option::is_none")] - pub disabled_subagents: Option>, - /// Maximum number of subagents that can run concurrently; applies to usage-based billing users only - #[serde(skip_serializing_if = "Option::is_none")] - pub max_concurrency: Option, - /// Maximum subagent nesting depth; applies to usage-based billing users only +pub struct TasksSendMessageResult { + /// Error message if delivery failed #[serde(skip_serializing_if = "Option::is_none")] - pub max_depth: Option, + pub error: Option, + /// Whether the message was successfully delivered or steered + pub sent: bool, } -/// Tracked background agent task metadata, including IDs, status, timing, agent type, prompt, model, result, and latest response. +/// Agent type, prompt, name, and optional description and model override for the new task. /// ///
/// @@ -17827,62 +19179,22 @@ pub struct SubagentSettings { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct TaskAgentInfo { - /// ISO 8601 timestamp when the current active period began - #[serde(skip_serializing_if = "Option::is_none")] - pub active_started_at: Option, - /// Accumulated active execution time in milliseconds - #[serde(skip_serializing_if = "Option::is_none")] - pub active_time_ms: Option, - /// Type of agent running this task +pub struct TasksStartAgentRequest { + /// Type of agent to start (e.g., 'explore', 'task', 'general-purpose') pub agent_type: String, - /// 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. - #[serde(skip_serializing_if = "Option::is_none")] - pub can_promote_to_background: Option, - /// ISO 8601 timestamp when the task finished - #[serde(skip_serializing_if = "Option::is_none")] - pub completed_at: Option, /// Short description of the task - pub description: String, - /// Friendly, non-unique name intended for display - #[serde(skip_serializing_if = "Option::is_none")] - pub display_name: Option, - /// Error message when the task failed - #[serde(skip_serializing_if = "Option::is_none")] - pub error: Option, - /// Whether task execution is synchronously awaited or managed in the background - #[serde(skip_serializing_if = "Option::is_none")] - pub execution_mode: Option, - /// Unique task identifier - pub id: String, - /// ISO 8601 timestamp when the agent entered idle state - #[serde(skip_serializing_if = "Option::is_none")] - pub idle_since: Option, - /// Most recent response text from the agent #[serde(skip_serializing_if = "Option::is_none")] - pub latest_response: Option, - /// Requested model override for the task when specified + pub description: Option, + /// Optional model override #[serde(skip_serializing_if = "Option::is_none")] pub model: Option, - /// Most recent prompt delivered to the agent. Updated whenever the agent receives a follow-up message. + /// Friendly, non-unique name used when displaying the agent + pub name: String, + /// Task prompt for the agent pub prompt: String, - /// Runtime model resolved for the task when available - #[serde(skip_serializing_if = "Option::is_none")] - pub resolved_model: Option, - /// Result text from the task when available - #[serde(skip_serializing_if = "Option::is_none")] - pub result: Option, - /// ISO 8601 timestamp when the task was started - pub started_at: String, - /// Current lifecycle status of the task - pub status: TaskStatus, - /// Tool call ID associated with this agent task - pub tool_call_id: String, - /// Task kind - pub r#type: TaskAgentInfoType, } -/// Timestamped display line for task progress output or recent agent activity. +/// Identifier assigned to the newly started background agent task. /// ///
/// @@ -17892,14 +19204,12 @@ pub struct TaskAgentInfo { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct TaskProgressLine { - /// Display message, e.g., "▸ bash", "✓ edit src/foo.ts" - pub message: String, - /// ISO 8601 timestamp when this event occurred - pub timestamp: String, +pub struct TasksStartAgentResult { + /// Generated agent ID for the background task + pub agent_id: String, } -/// Progress snapshot for an agent task, with recent activity lines and optional latest intent. +/// 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). /// ///
/// @@ -17909,17 +19219,9 @@ pub struct TaskProgressLine { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct TaskAgentProgress { - /// The most recent intent reported by the agent - #[serde(skip_serializing_if = "Option::is_none")] - pub latest_intent: Option, - /// Recent tool execution events converted to display lines - pub recent_activity: Vec, - /// Progress kind - pub r#type: TaskAgentProgressType, -} +pub struct TasksWaitForPendingResult {} -/// Task completion notification with summary from the agent +/// Feature override key/value pairs to attach to subsequent telemetry events from this session. /// ///
/// @@ -17929,24 +19231,12 @@ pub struct TaskAgentProgress { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct TaskCompleteData { - /// Active autopilot objective ID evaluated by the completion reviewer - #[serde(skip_serializing_if = "Option::is_none")] - pub objective_id: Option, - /// Semantic completion decision. Absent on legacy events and invalid tool calls - #[serde(skip_serializing_if = "Option::is_none")] - pub outcome: Option, - /// 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 - #[serde(skip_serializing_if = "Option::is_none")] - pub reason: Option, - /// Whether the task was accepted as complete. False when validation failed or completion was rejected or blocked by the reviewer - #[serde(skip_serializing_if = "Option::is_none")] - pub success: Option, - /// Summary of the completed task, provided by the agent - #[serde(skip_serializing_if = "Option::is_none")] - pub summary: Option, +pub struct TelemetrySetFeatureOverridesRequest { + /// Override key/value pairs to attach to subsequent telemetry events from this session. Replaces any previously-set overrides. + pub features: HashMap, } +/// Built-in tool metadata with identifier, optional namespaced name, description, input-parameter schema, and usage instructions. /// ///
/// @@ -17956,30 +19246,23 @@ pub struct TaskCompleteData { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct TaskCompletionDecision { - /// Objective eligibility token captured when the decision was evaluated. - #[serde(skip_serializing_if = "Option::is_none")] - pub completion_eligibility_token: Option, - /// Whether completion was accepted after the reviewer-rejection budget was exhausted. - #[serde(skip_serializing_if = "Option::is_none")] - pub completion_rejection_budget_exhausted: Option, - /// Active autopilot objective evaluated by the completion reviewer. - #[serde(skip_serializing_if = "Option::is_none")] - pub objective_id: Option, - /// Semantic result of evaluating the task completion request. - pub outcome: TaskCompletionOutcome, - /// Rationale for the completion decision, when one is available. +pub struct Tool { + /// Description of what the tool does + pub description: String, + /// Optional instructions for how to use this tool effectively #[serde(skip_serializing_if = "Option::is_none")] - pub reason: Option, - /// Whether the rationale was derived from completion-reviewer output. + pub instructions: Option, + /// Tool identifier (e.g., "bash", "grep", "str_replace_editor") + pub name: String, + /// Optional namespaced name for declarative filtering (e.g., "playwright/navigate" for MCP tools) #[serde(skip_serializing_if = "Option::is_none")] - pub reviewer_derived: Option, - /// Information-flow metadata captured from the completion reviewer. + pub namespaced_name: Option, + /// JSON Schema for the tool's input parameters #[serde(skip_serializing_if = "Option::is_none")] - pub reviewer_result_meta: Option, + pub parameters: Option>, } -/// Background tasks currently tracked by the session. +/// Built-in tools available for the requested model, with their parameters and instructions. /// ///
/// @@ -17989,12 +19272,12 @@ pub struct TaskCompletionDecision { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct TaskList { - /// Currently tracked tasks - pub tasks: Vec, +pub struct ToolList { + /// List of available built-in tools with metadata + pub tools: Vec, } -/// Identifier of the background task to cancel. +/// A message injected by a tool result. /// ///
/// @@ -18004,12 +19287,14 @@ pub struct TaskList { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct TasksCancelRequest { - /// Task identifier - pub id: String, +pub struct ToolResultNewMessage { + /// Message content to inject after the tool result. + pub content: String, + /// Source attributed to the injected message. + pub source: String, } -/// Indicates whether the background task was successfully cancelled. +/// Expanded canonical result returned by a session tool. /// ///
/// @@ -18019,12 +19304,59 @@ pub struct TasksCancelRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct TasksCancelResult { - /// Whether the task was successfully cancelled - pub cancelled: bool, +pub struct ToolResultExpanded { + /// Base64-encoded binary results returned to the model. + #[serde(skip_serializing_if = "Option::is_none")] + pub binary_results_for_llm: Option>, + /// Sources returned by the tool that the model may cite. + #[serde(skip_serializing_if = "Option::is_none")] + pub citable_sources: Option>, + /// Structured content blocks returned to the model. + #[serde(skip_serializing_if = "Option::is_none")] + pub contents: Option>, + /// Error message for an unsuccessful execution. + #[serde(skip_serializing_if = "Option::is_none")] + pub error: Option, + /// Metadata propagated with the tool result, including information-flow labels. + #[serde(skip_serializing_if = "Option::is_none")] + pub mcp_meta: Option>, + /// Messages to inject after the tool result. + #[serde(skip_serializing_if = "Option::is_none")] + pub new_messages: Option>, + /// Whether post-tool-use failure hooks have already processed this result. + #[serde(skip_serializing_if = "Option::is_none")] + pub post_tool_use_failure_hooks_processed: Option, + /// Execution outcome classification. + pub result_type: ToolResultType, + /// Detailed log content available for session display. + #[serde(skip_serializing_if = "Option::is_none")] + pub session_log: Option, + /// Skill invocation metadata produced by the tool. + #[serde(skip_serializing_if = "Option::is_none")] + pub skill_invocation: Option, + /// Whether large-output post-processing should be skipped. + #[serde(skip_serializing_if = "Option::is_none")] + pub skip_large_output_processing: Option, + /// Structured result content in addition to the model-facing text. + #[serde(skip_serializing_if = "Option::is_none")] + pub structured_content: Option, + /// Completion-review decision produced by the task-completion tool. + #[serde(skip_serializing_if = "Option::is_none")] + pub task_completion_decision: Option, + /// Text result returned to the model. + pub text_result_for_llm: String, + /// Deferred tool names made available by this result. + #[serde(skip_serializing_if = "Option::is_none")] + pub tool_references: Option>, + /// Tool-specific telemetry payload. + #[serde(skip_serializing_if = "Option::is_none")] + pub tool_telemetry: Option, + /// Optional UI resource produced by the tool. + #[serde(skip_serializing_if = "Option::is_none")] + pub ui_resource: Option, } -/// The first sync-waiting task that can currently be promoted to background mode. +/// A tool name and arguments to execute through the session's native invocation pipeline. /// ///
/// @@ -18034,13 +19366,17 @@ pub struct TasksCancelResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct 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. +pub struct ToolsExecuteRequest { + /// Arguments supplied to the tool. + pub arguments: serde_json::Value, + /// Name of the currently offered tool to execute. + pub name: String, + /// Optional identifier used to correlate this invocation with its tool call. #[serde(skip_serializing_if = "Option::is_none")] - pub task: Option, + pub tool_call_id: Option, } -/// Identifier of the background task to fetch progress for. +/// Shell-specific names and description lines used to materialize built-in shell tool descriptors. /// ///
/// @@ -18050,12 +19386,24 @@ pub struct TasksGetCurrentPromotableResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct TasksGetProgressRequest { - /// Task identifier (agent ID or shell ID) - pub id: String, +pub struct ToolsShellDescriptorConfig { + /// Additional model-facing shell description lines. + pub description_lines: Vec, + /// Human-readable shell name. + pub display_name: String, + /// Tool name used to list active shells. + pub list_shells_tool_name: String, + /// Tool name used to read shell output. + pub read_shell_tool_name: String, + /// Tool name used to start shell commands. + pub shell_tool_name: String, + /// Stable shell type identifier. + pub shell_type: String, + /// Tool name used to stop shell commands. + pub stop_shell_tool_name: String, } -/// Progress information for the task, or null when no task with that ID is tracked. +/// Options controlling how Rust-owned built-in tool descriptors are materialized. /// ///
/// @@ -18065,12 +19413,37 @@ pub struct TasksGetProgressRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct TasksGetProgressResult { - /// Progress information for the task, discriminated by type. Returns null when no task with this ID is currently tracked. - pub progress: Option, +pub struct ToolsGetBuiltinDescriptorsRequest { + /// Whether background task completion notifications are enabled. + #[serde(skip_serializing_if = "Option::is_none")] + pub background_task_notifications_enabled: Option, + /// Whether tool descriptors should include authoring metadata. + #[serde(skip_serializing_if = "Option::is_none")] + pub include_author: Option, + /// Whether line numbers should be omitted from the view tool descriptor. + #[serde(skip_serializing_if = "Option::is_none")] + pub no_view_line_numbers: Option, + /// Whether descriptors should favor fewer user-intervention prompts. + #[serde(skip_serializing_if = "Option::is_none")] + pub reduce_user_intervention: Option, + /// Whether shell commands may only run asynchronously. + #[serde(skip_serializing_if = "Option::is_none")] + pub shell_async_only_enabled: Option, + /// Shell-specific names and description lines for shell tools. + #[serde(skip_serializing_if = "Option::is_none")] + pub shell_config: Option, + /// Whether the configured shell supports PowerShell 7 syntax. + #[serde(skip_serializing_if = "Option::is_none")] + pub shell_supports_power_shell7_syntax: Option, + /// Default shell timeout in milliseconds. + #[serde(skip_serializing_if = "Option::is_none")] + pub shell_timeout_ms: Option, + /// Whether semantic skill lookup is available. + #[serde(skip_serializing_if = "Option::is_none")] + pub skill_embedding_enabled: Option, } -/// Tracked shell task metadata, including ID, command, status, timing, attachment/execution mode, log path, and PID. +/// Rust-owned built-in tool descriptors for the session. /// ///
/// @@ -18080,39 +19453,12 @@ pub struct TasksGetProgressResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct TaskShellInfo { - /// Whether the shell runs inside a managed PTY session or as an independent background process - pub attachment_mode: TaskShellInfoAttachmentMode, - /// Whether this shell task can be promoted to background mode - #[serde(skip_serializing_if = "Option::is_none")] - pub can_promote_to_background: Option, - /// Command being executed - pub command: String, - /// ISO 8601 timestamp when the task finished - #[serde(skip_serializing_if = "Option::is_none")] - pub completed_at: Option, - /// Short description of the task - pub description: String, - /// Whether task execution is synchronously awaited or managed in the background - #[serde(skip_serializing_if = "Option::is_none")] - pub execution_mode: Option, - /// Unique task identifier - pub id: String, - /// Path to the detached shell log, when available - #[serde(skip_serializing_if = "Option::is_none")] - pub log_path: Option, - /// Process ID when available - #[serde(skip_serializing_if = "Option::is_none")] - pub pid: Option, - /// ISO 8601 timestamp when the task was started - pub started_at: String, - /// Current lifecycle status of the task - pub status: TaskStatus, - /// Task kind - pub r#type: TaskShellInfoType, +pub struct ToolsGetBuiltinDescriptorsResult { + /// Built-in tool descriptors materialized for the session. + pub tools: Vec, } -/// Progress snapshot for a shell task, with recent stdout/stderr output and optional process ID. +/// Current lightweight tool metadata snapshot for the session. /// ///
/// @@ -18122,17 +19468,12 @@ pub struct TaskShellInfo { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct TaskShellProgress { - /// Process ID when available - #[serde(skip_serializing_if = "Option::is_none")] - pub pid: Option, - /// Recent stdout/stderr lines from the running shell command - pub recent_output: String, - /// Progress kind - pub r#type: TaskShellProgressType, +pub struct ToolsGetCurrentMetadataResult { + /// Current tool metadata, or null when tools have not been initialized yet + pub tools: Option>, } -/// The promoted task as it now exists in background mode, omitted if no promotable task was waiting. +/// 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. /// ///
/// @@ -18142,13 +19483,9 @@ pub struct TaskShellProgress { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct 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. - #[serde(skip_serializing_if = "Option::is_none")] - pub task: Option, -} +pub struct ToolsInitializeAndValidateResult {} -/// Identifier of the task to promote to background mode. +/// Optional model identifier whose tool overrides should be applied to the listing. /// ///
/// @@ -18158,12 +19495,13 @@ pub struct TasksPromoteCurrentToBackgroundResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct TasksPromoteToBackgroundRequest { - /// Task identifier - pub id: String, +pub struct ToolsListRequest { + /// Optional model ID — when provided, the returned tool list reflects model-specific overrides + #[serde(skip_serializing_if = "Option::is_none")] + pub model: Option, } -/// Indicates whether the task was successfully promoted to background mode. +/// Complete externally implemented tool list for the calling connection. An empty list removes every tool previously supplied by that connection. /// ///
/// @@ -18173,12 +19511,12 @@ pub struct TasksPromoteToBackgroundRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct TasksPromoteToBackgroundResult { - /// Whether the task was successfully promoted to background mode - pub promoted: bool, +pub struct ToolsSetRequest { + /// Complete replacement list for the calling connection. + pub tools: Vec, } -/// 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. +/// Empty result after replacing the calling connection's externally implemented tools. /// ///
/// @@ -18188,9 +19526,9 @@ pub struct TasksPromoteToBackgroundResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct TasksRefreshResult {} +pub struct ToolsSetResult {} -/// Identifier of the completed or cancelled task to remove from tracking. +/// Task-completion tool arguments and final result used to build a label-safe session event payload. /// ///
/// @@ -18200,12 +19538,14 @@ pub struct TasksRefreshResult {} ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct TasksRemoveRequest { - /// Task identifier - pub id: String, +pub struct ToolsTaskCompleteEventDataRequest { + /// Final expanded result returned by the task_complete tool. + pub final_result: ToolResultExpanded, + /// Arguments supplied to the completed task_complete tool call. + pub tool_args: serde_json::Value, } -/// Indicates whether the task was removed. False when the task does not exist or is still running/idle. +/// Empty result after applying subagent settings /// ///
/// @@ -18215,12 +19555,9 @@ pub struct TasksRemoveRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct TasksRemoveResult { - /// Whether the task was removed. Returns false if the task does not exist or is still running/idle (cancel it first). - pub removed: bool, -} +pub struct ToolsUpdateSubagentSettingsResult {} -/// Identifier of the target agent task, message content, and optional sender agent ID. +/// Selectable option for a UI elicitation multi-select array item, with submitted value and display label. /// ///
/// @@ -18230,17 +19567,14 @@ pub struct TasksRemoveResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct TasksSendMessageRequest { - /// Agent ID of the sender, if sent on behalf of another agent - #[serde(skip_serializing_if = "Option::is_none")] - pub from_agent_id: Option, - /// Agent task identifier - pub id: String, - /// Message content to send to the agent - pub message: String, +pub struct UIElicitationArrayAnyOfFieldItemsAnyOf { + /// Value submitted when this option is selected. + pub r#const: String, + /// Display label for this option. + pub title: String, } -/// Indicates whether the message was delivered, with an error message when delivery failed. +/// Schema applied to each item in the array. /// ///
/// @@ -18250,15 +19584,12 @@ pub struct TasksSendMessageRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct TasksSendMessageResult { - /// Error message if delivery failed - #[serde(skip_serializing_if = "Option::is_none")] - pub error: Option, - /// Whether the message was successfully delivered or steered - pub sent: bool, +pub struct UIElicitationArrayAnyOfFieldItems { + /// Selectable options, each with a value and a display label. + pub any_of: Vec, } -/// Agent type, prompt, name, and optional description and model override for the new task. +/// Multi-select string field where each option pairs a value with a display label. /// ///
/// @@ -18268,22 +19599,29 @@ pub struct TasksSendMessageResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct TasksStartAgentRequest { - /// Type of agent to start (e.g., 'explore', 'task', 'general-purpose') - pub agent_type: String, - /// Short description of the task +pub struct UIElicitationArrayAnyOfField { + /// Default values selected when the form is first shown. + #[serde(skip_serializing_if = "Option::is_none")] + pub default: Option>, + /// Help text describing the field. #[serde(skip_serializing_if = "Option::is_none")] pub description: Option, - /// Optional model override + /// Schema applied to each item in the array. + pub items: UIElicitationArrayAnyOfFieldItems, + /// Maximum number of items the user may select. #[serde(skip_serializing_if = "Option::is_none")] - pub model: Option, - /// Friendly, non-unique name used when displaying the agent - pub name: String, - /// Task prompt for the agent - pub prompt: String, + pub max_items: Option, + /// Minimum number of items the user must select. + #[serde(skip_serializing_if = "Option::is_none")] + pub min_items: Option, + /// Human-readable label for the field. + #[serde(skip_serializing_if = "Option::is_none")] + pub title: Option, + /// Type discriminator. Always "array". + pub r#type: UIElicitationArrayAnyOfFieldType, } -/// Identifier assigned to the newly started background agent task. +/// Schema applied to each item in the array. /// ///
/// @@ -18293,12 +19631,14 @@ pub struct TasksStartAgentRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct TasksStartAgentResult { - /// Generated agent ID for the background task - pub agent_id: String, +pub struct UIElicitationArrayEnumFieldItems { + /// Allowed string values for each selected item. + pub r#enum: Vec, + /// Type discriminator. Always "string". + pub r#type: UIElicitationArrayEnumFieldItemsType, } -/// 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). +/// Multi-select string field whose allowed values are defined inline. /// ///
/// @@ -18308,9 +19648,29 @@ pub struct TasksStartAgentResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct TasksWaitForPendingResult {} +pub struct UIElicitationArrayEnumField { + /// Default values selected when the form is first shown. + #[serde(skip_serializing_if = "Option::is_none")] + pub default: Option>, + /// Help text describing the field. + #[serde(skip_serializing_if = "Option::is_none")] + pub description: Option, + /// Schema applied to each item in the array. + pub items: UIElicitationArrayEnumFieldItems, + /// Maximum number of items the user may select. + #[serde(skip_serializing_if = "Option::is_none")] + pub max_items: Option, + /// Minimum number of items the user must select. + #[serde(skip_serializing_if = "Option::is_none")] + pub min_items: Option, + /// Human-readable label for the field. + #[serde(skip_serializing_if = "Option::is_none")] + pub title: Option, + /// Type discriminator. Always "array". + pub r#type: UIElicitationArrayEnumFieldType, +} -/// Feature override key/value pairs to attach to subsequent telemetry events from this session. +/// JSON Schema describing the form fields to present to the user /// ///
/// @@ -18320,12 +19680,17 @@ pub struct TasksWaitForPendingResult {} ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct TelemetrySetFeatureOverridesRequest { - /// Override key/value pairs to attach to subsequent telemetry events from this session. Replaces any previously-set overrides. - pub features: HashMap, +pub struct UIElicitationSchema { + /// Form field definitions, keyed by field name + pub properties: HashMap, + /// List of required field names + #[serde(skip_serializing_if = "Option::is_none")] + pub required: Option>, + /// Schema type indicator (always 'object') + pub r#type: UIElicitationSchemaType, } -/// Built-in tool metadata with identifier, optional namespaced name, description, input-parameter schema, and usage instructions. +/// Prompt message and JSON schema describing the form fields to elicit from the user. /// ///
/// @@ -18335,23 +19700,23 @@ pub struct TelemetrySetFeatureOverridesRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct Tool { - /// Description of what the tool does - pub description: String, - /// Optional instructions for how to use this tool effectively - #[serde(skip_serializing_if = "Option::is_none")] - pub instructions: Option, - /// Tool identifier (e.g., "bash", "grep", "str_replace_editor") - pub name: String, - /// Optional namespaced name for declarative filtering (e.g., "playwright/navigate" for MCP tools) +pub struct UIElicitationRequest { + /// MCP request metadata. + #[serde(rename = "_meta", skip_serializing_if = "Option::is_none")] + pub meta: Option>, + /// Message describing what information is needed from the user + pub message: String, + /// Elicitation mode. Omitted and form are equivalent for structured elicitation. #[serde(skip_serializing_if = "Option::is_none")] - pub namespaced_name: Option, - /// JSON Schema for the tool's input parameters + pub mode: Option, + /// JSON Schema describing the form fields to present to the user + pub requested_schema: UIElicitationSchema, + /// MCP task metadata. #[serde(skip_serializing_if = "Option::is_none")] - pub parameters: Option>, + pub task: Option, } -/// Built-in tools available for the requested model, with their parameters and instructions. +/// The elicitation response (accept with form values, decline, or cancel) /// ///
/// @@ -18361,12 +19726,18 @@ pub struct Tool { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ToolList { - /// List of available built-in tools with metadata - pub tools: Vec, +pub struct UIElicitationResponse { + /// MCP response metadata. + #[serde(rename = "_meta", skip_serializing_if = "Option::is_none")] + pub meta: Option>, + /// The user's response: accept (submitted), decline (rejected), or cancel (dismissed) + pub action: UIElicitationResponseAction, + /// The form values submitted by the user (present when action is 'accept') + #[serde(skip_serializing_if = "Option::is_none")] + pub content: Option>, } -/// A message injected by a tool result. +/// Indicates whether the elicitation response was accepted; false if it was already resolved by another client. /// ///
/// @@ -18376,14 +19747,12 @@ pub struct ToolList { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ToolResultNewMessage { - /// Message content to inject after the tool result. - pub content: String, - /// Source attributed to the injected message. - pub source: String, +pub struct UIElicitationResult { + /// Whether the response was accepted. False if the request was already resolved by another client. + pub success: bool, } -/// Expanded canonical result returned by a session tool. +/// Boolean field rendered as a yes/no toggle. /// ///
/// @@ -18393,79 +19762,21 @@ pub struct ToolResultNewMessage { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ToolResultExpanded { - /// Base64-encoded binary results returned to the model. - #[serde(skip_serializing_if = "Option::is_none")] - pub binary_results_for_llm: Option>, - /// Sources returned by the tool that the model may cite. - #[serde(skip_serializing_if = "Option::is_none")] - pub citable_sources: Option>, - /// Structured content blocks returned to the model. - #[serde(skip_serializing_if = "Option::is_none")] - pub contents: Option>, - /// Error message for an unsuccessful execution. - #[serde(skip_serializing_if = "Option::is_none")] - pub error: Option, - /// Metadata propagated with the tool result, including information-flow labels. - #[serde(skip_serializing_if = "Option::is_none")] - pub mcp_meta: Option>, - /// Messages to inject after the tool result. - #[serde(skip_serializing_if = "Option::is_none")] - pub new_messages: Option>, - /// Whether post-tool-use failure hooks have already processed this result. - #[serde(skip_serializing_if = "Option::is_none")] - pub post_tool_use_failure_hooks_processed: Option, - /// Execution outcome classification. - pub result_type: ToolResultType, - /// Detailed log content available for session display. - #[serde(skip_serializing_if = "Option::is_none")] - pub session_log: Option, - /// Skill invocation metadata produced by the tool. - #[serde(skip_serializing_if = "Option::is_none")] - pub skill_invocation: Option, - /// Whether large-output post-processing should be skipped. - #[serde(skip_serializing_if = "Option::is_none")] - pub skip_large_output_processing: Option, - /// Structured result content in addition to the model-facing text. - #[serde(skip_serializing_if = "Option::is_none")] - pub structured_content: Option, - /// Completion-review decision produced by the task-completion tool. - #[serde(skip_serializing_if = "Option::is_none")] - pub task_completion_decision: Option, - /// Text result returned to the model. - pub text_result_for_llm: String, - /// Deferred tool names made available by this result. - #[serde(skip_serializing_if = "Option::is_none")] - pub tool_references: Option>, - /// Tool-specific telemetry payload. +pub struct UIElicitationSchemaPropertyBoolean { + /// Default value selected when the form is first shown. #[serde(skip_serializing_if = "Option::is_none")] - pub tool_telemetry: Option, - /// Optional UI resource produced by the tool. + pub default: Option, + /// Help text describing the field. #[serde(skip_serializing_if = "Option::is_none")] - pub ui_resource: Option, -} - -/// A tool name and arguments to execute through the session's native invocation pipeline. -/// -///
-/// -/// **Experimental.** This type is part of an experimental wire-protocol surface -/// and may change or be removed in future SDK or CLI releases. -/// -///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct ToolsExecuteRequest { - /// Arguments supplied to the tool. - pub arguments: serde_json::Value, - /// Name of the currently offered tool to execute. - pub name: String, - /// Optional identifier used to correlate this invocation with its tool call. + pub description: Option, + /// Human-readable label for the field. #[serde(skip_serializing_if = "Option::is_none")] - pub tool_call_id: Option, + pub title: Option, + /// Type discriminator. Always "boolean". + pub r#type: UIElicitationSchemaPropertyBooleanType, } -/// Shell-specific names and description lines used to materialize built-in shell tool descriptors. +/// Numeric field accepting either a number or an integer. /// ///
/// @@ -18475,24 +19786,27 @@ pub struct ToolsExecuteRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ToolsShellDescriptorConfig { - /// Additional model-facing shell description lines. - pub description_lines: Vec, - /// Human-readable shell name. - pub display_name: String, - /// Tool name used to list active shells. - pub list_shells_tool_name: String, - /// Tool name used to read shell output. - pub read_shell_tool_name: String, - /// Tool name used to start shell commands. - pub shell_tool_name: String, - /// Stable shell type identifier. - pub shell_type: String, - /// Tool name used to stop shell commands. - pub stop_shell_tool_name: String, +pub struct UIElicitationSchemaPropertyNumber { + /// Default value populated in the input when the form is first shown. + #[serde(skip_serializing_if = "Option::is_none")] + pub default: Option, + /// Help text describing the field. + #[serde(skip_serializing_if = "Option::is_none")] + pub description: Option, + /// Maximum allowed value (inclusive). + #[serde(skip_serializing_if = "Option::is_none")] + pub maximum: Option, + /// Minimum allowed value (inclusive). + #[serde(skip_serializing_if = "Option::is_none")] + pub minimum: Option, + /// Human-readable label for the field. + #[serde(skip_serializing_if = "Option::is_none")] + pub title: Option, + /// Numeric type accepted by the field. + pub r#type: UIElicitationSchemaPropertyNumberType, } -/// Options controlling how Rust-owned built-in tool descriptors are materialized. +/// Free-text string field with optional length and format constraints. /// ///
/// @@ -18502,37 +19816,30 @@ pub struct ToolsShellDescriptorConfig { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ToolsGetBuiltinDescriptorsRequest { - /// Whether background task completion notifications are enabled. - #[serde(skip_serializing_if = "Option::is_none")] - pub background_task_notifications_enabled: Option, - /// Whether tool descriptors should include authoring metadata. - #[serde(skip_serializing_if = "Option::is_none")] - pub include_author: Option, - /// Whether line numbers should be omitted from the view tool descriptor. - #[serde(skip_serializing_if = "Option::is_none")] - pub no_view_line_numbers: Option, - /// Whether descriptors should favor fewer user-intervention prompts. +pub struct UIElicitationSchemaPropertyString { + /// Default value populated in the input when the form is first shown. #[serde(skip_serializing_if = "Option::is_none")] - pub reduce_user_intervention: Option, - /// Whether shell commands may only run asynchronously. + pub default: Option, + /// Help text describing the field. #[serde(skip_serializing_if = "Option::is_none")] - pub shell_async_only_enabled: Option, - /// Shell-specific names and description lines for shell tools. + pub description: Option, + /// Optional format hint that constrains the accepted input. #[serde(skip_serializing_if = "Option::is_none")] - pub shell_config: Option, - /// Whether the configured shell supports PowerShell 7 syntax. + pub format: Option, + /// Maximum number of characters allowed. #[serde(skip_serializing_if = "Option::is_none")] - pub shell_supports_power_shell7_syntax: Option, - /// Default shell timeout in milliseconds. + pub max_length: Option, + /// Minimum number of characters required. #[serde(skip_serializing_if = "Option::is_none")] - pub shell_timeout_ms: Option, - /// Whether semantic skill lookup is available. + pub min_length: Option, + /// Human-readable label for the field. #[serde(skip_serializing_if = "Option::is_none")] - pub skill_embedding_enabled: Option, + pub title: Option, + /// Type discriminator. Always "string". + pub r#type: UIElicitationSchemaPropertyStringType, } -/// Rust-owned built-in tool descriptors for the session. +/// Single-select string field whose allowed values are defined inline. /// ///
/// @@ -18542,12 +19849,26 @@ pub struct ToolsGetBuiltinDescriptorsRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ToolsGetBuiltinDescriptorsResult { - /// Built-in tool descriptors materialized for the session. - pub tools: Vec, +pub struct UIElicitationStringEnumField { + /// Default value selected when the form is first shown. + #[serde(skip_serializing_if = "Option::is_none")] + pub default: Option, + /// Help text describing the field. + #[serde(skip_serializing_if = "Option::is_none")] + pub description: Option, + /// Allowed string values. + pub r#enum: Vec, + /// Optional display labels for each enum value, in the same order as `enum`. + #[serde(skip_serializing_if = "Option::is_none")] + pub enum_names: Option>, + /// Human-readable label for the field. + #[serde(skip_serializing_if = "Option::is_none")] + pub title: Option, + /// Type discriminator. Always "string". + pub r#type: UIElicitationStringEnumFieldType, } -/// Current lightweight tool metadata snapshot for the session. +/// Selectable option for a UI elicitation single-select string field, with submitted value and display label. /// ///
/// @@ -18557,12 +19878,14 @@ pub struct ToolsGetBuiltinDescriptorsResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ToolsGetCurrentMetadataResult { - /// Current tool metadata, or null when tools have not been initialized yet - pub tools: Option>, +pub struct UIElicitationStringOneOfFieldOneOf { + /// Value submitted when this option is selected. + pub r#const: String, + /// Display label for this option. + pub title: String, } -/// 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. +/// Single-select string field where each option pairs a value with a display label. /// ///
/// @@ -18572,9 +19895,23 @@ pub struct ToolsGetCurrentMetadataResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ToolsInitializeAndValidateResult {} +pub struct UIElicitationStringOneOfField { + /// Default value selected when the form is first shown. + #[serde(skip_serializing_if = "Option::is_none")] + pub default: Option, + /// Help text describing the field. + #[serde(skip_serializing_if = "Option::is_none")] + pub description: Option, + /// Selectable options, each with a value and a display label. + pub one_of: Vec, + /// Human-readable label for the field. + #[serde(skip_serializing_if = "Option::is_none")] + pub title: Option, + /// Type discriminator. Always "string". + pub r#type: UIElicitationStringOneOfFieldType, +} -/// Optional model identifier whose tool overrides should be applied to the listing. +/// Transient question to answer without adding it to conversation history. /// ///
/// @@ -18584,13 +19921,20 @@ pub struct ToolsInitializeAndValidateResult {} ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ToolsListRequest { - /// Optional model ID — when provided, the returned tool list reflects model-specific overrides +pub struct UIEphemeralQueryRequest { + /// In-process `AbortSignal` forwarded to the model client to cancel an in-flight request. Marked internal: excluded from the public SDK surface. Replaced by an explicit cancellation token + cancel RPC in the SDK migration. + #[doc(hidden)] #[serde(skip_serializing_if = "Option::is_none")] - pub model: Option, + pub(crate) abort_signal: Option, + /// In-process streaming callback `(text) => void` invoked with each token as the model emits it. Marked internal: excluded from the public SDK surface. In a process-separated SDK this is replaced by a streaming RPC that yields chunks and a final answer. + #[doc(hidden)] + #[serde(skip_serializing_if = "Option::is_none")] + pub(crate) on_chunk: Option, + /// Question to answer from the current conversation context. + pub question: String, } -/// Complete externally implemented tool list for the calling connection. An empty list removes every tool previously supplied by that connection. +/// Completed transient query. Ordered chunks and the terminal outcome are also delivered through `ui.ephemeral_query` session events while it runs. /// ///
/// @@ -18600,12 +19944,12 @@ pub struct ToolsListRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ToolsSetRequest { - /// Complete replacement list for the calling connection. - pub tools: Vec, +pub struct UIEphemeralQueryResult { + /// Answer returned by the model + pub answer: String, } -/// Empty result after replacing the calling connection's externally implemented tools. +/// User response for a pending exit-plan-mode request, with approval state, selected action, auto-approve flag, and feedback. /// ///
/// @@ -18615,9 +19959,24 @@ pub struct ToolsSetRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ToolsSetResult {} +pub struct UIExitPlanModeResponse { + /// Whether the plan was approved. + pub approved: bool, + /// Whether subsequent edits should be auto-approved without confirmation. + #[serde(skip_serializing_if = "Option::is_none")] + pub auto_approve_edits: Option, + /// 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. + #[serde(skip_serializing_if = "Option::is_none")] + pub defer_implementation: Option, + /// Feedback from the user when they declined the plan or requested changes. + #[serde(skip_serializing_if = "Option::is_none")] + pub feedback: Option, + /// The action the user selected. Defaults to 'autopilot' when autoApproveEdits is true, otherwise 'interactive'. + #[serde(skip_serializing_if = "Option::is_none")] + pub selected_action: Option, +} -/// Task-completion tool arguments and final result used to build a label-safe session event payload. +/// Request ID of a pending `auto_mode_switch.requested` event and the user's response. /// ///
/// @@ -18627,14 +19986,14 @@ pub struct ToolsSetResult {} ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ToolsTaskCompleteEventDataRequest { - /// Final expanded result returned by the task_complete tool. - pub final_result: ToolResultExpanded, - /// Arguments supplied to the completed task_complete tool call. - pub tool_args: serde_json::Value, +pub struct UIHandlePendingAutoModeSwitchRequest { + /// The unique request ID from the auto_mode_switch.requested event + pub request_id: RequestId, + /// User's choice for auto-mode switching: yes (allow this turn), yes_always (allow + persist as setting), or no (decline). + pub response: UIAutoModeSwitchResponse, } -/// Empty result after applying subagent settings +/// Pending elicitation request ID and the user's response (accept/decline/cancel + form values). /// ///
/// @@ -18644,9 +20003,14 @@ pub struct ToolsTaskCompleteEventDataRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ToolsUpdateSubagentSettingsResult {} +pub struct UIHandlePendingElicitationRequest { + /// The unique request ID from the elicitation.requested event + pub request_id: RequestId, + /// The elicitation response (accept with form values, decline, or cancel) + pub result: UIElicitationResponse, +} -/// Selectable option for a UI elicitation multi-select array item, with submitted value and display label. +/// Request ID of a pending `exit_plan_mode.requested` event and the user's response. /// ///
/// @@ -18656,14 +20020,14 @@ pub struct ToolsUpdateSubagentSettingsResult {} ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct UIElicitationArrayAnyOfFieldItemsAnyOf { - /// Value submitted when this option is selected. - pub r#const: String, - /// Display label for this option. - pub title: String, +pub struct UIHandlePendingExitPlanModeRequest { + /// The unique request ID from the exit_plan_mode.requested event + pub request_id: RequestId, + /// User response for a pending exit-plan-mode request, with approval state, selected action, auto-approve flag, and feedback. + pub response: UIExitPlanModeResponse, } -/// Schema applied to each item in the array. +/// Indicates whether the pending UI request was resolved by this call. /// ///
/// @@ -18673,12 +20037,12 @@ pub struct UIElicitationArrayAnyOfFieldItemsAnyOf { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct UIElicitationArrayAnyOfFieldItems { - /// Selectable options, each with a value and a display label. - pub any_of: Vec, +pub struct 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. + pub success: bool, } -/// Multi-select string field where each option pairs a value with a display label. +/// Optional sampling result payload. Omit to reject/cancel the sampling request without providing a result. /// ///
/// @@ -18688,29 +20052,9 @@ pub struct UIElicitationArrayAnyOfFieldItems { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct UIElicitationArrayAnyOfField { - /// Default values selected when the form is first shown. - #[serde(skip_serializing_if = "Option::is_none")] - pub default: Option>, - /// Help text describing the field. - #[serde(skip_serializing_if = "Option::is_none")] - pub description: Option, - /// Schema applied to each item in the array. - pub items: UIElicitationArrayAnyOfFieldItems, - /// Maximum number of items the user may select. - #[serde(skip_serializing_if = "Option::is_none")] - pub max_items: Option, - /// Minimum number of items the user must select. - #[serde(skip_serializing_if = "Option::is_none")] - pub min_items: Option, - /// Human-readable label for the field. - #[serde(skip_serializing_if = "Option::is_none")] - pub title: Option, - /// Type discriminator. Always "array". - pub r#type: UIElicitationArrayAnyOfFieldType, -} +pub struct UIHandlePendingSamplingResponse {} -/// Schema applied to each item in the array. +/// Request ID of a pending `sampling.requested` event and an optional sampling result payload (omit to reject). /// ///
/// @@ -18720,14 +20064,15 @@ pub struct UIElicitationArrayAnyOfField { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct UIElicitationArrayEnumFieldItems { - /// Allowed string values for each selected item. - pub r#enum: Vec, - /// Type discriminator. Always "string". - pub r#type: UIElicitationArrayEnumFieldItemsType, +pub struct UIHandlePendingSamplingRequest { + /// The unique request ID from the sampling.requested event + pub request_id: RequestId, + /// Optional sampling result payload. Omit to reject/cancel the sampling request without providing a result. + #[serde(skip_serializing_if = "Option::is_none")] + pub response: Option, } -/// Multi-select string field whose allowed values are defined inline. +/// The user's selected action for an exhausted session limit. /// ///
/// @@ -18737,29 +20082,35 @@ pub struct UIElicitationArrayEnumFieldItems { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct UIElicitationArrayEnumField { - /// Default values selected when the form is first shown. - #[serde(skip_serializing_if = "Option::is_none")] - pub default: Option>, - /// Help text describing the field. - #[serde(skip_serializing_if = "Option::is_none")] - pub description: Option, - /// Schema applied to each item in the array. - pub items: UIElicitationArrayEnumFieldItems, - /// Maximum number of items the user may select. - #[serde(skip_serializing_if = "Option::is_none")] - pub max_items: Option, - /// Minimum number of items the user must select. +pub struct UISessionLimitsExhaustedResponse { + /// Action selected by the user. + pub action: UISessionLimitsExhaustedResponseAction, + /// AI Credits to add to the current max when action is 'add'. #[serde(skip_serializing_if = "Option::is_none")] - pub min_items: Option, - /// Human-readable label for the field. + pub additional_ai_credits: Option, + /// New absolute max AI Credits when action is 'set'. #[serde(skip_serializing_if = "Option::is_none")] - pub title: Option, - /// Type discriminator. Always "array". - pub r#type: UIElicitationArrayEnumFieldType, + pub max_ai_credits: Option, +} + +/// Request ID of a pending `session_limits_exhausted.requested` event and the user's selected limit action. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct UIHandlePendingSessionLimitsExhaustedRequest { + /// The unique request ID from the session_limits_exhausted.requested event + pub request_id: RequestId, + /// The selected session-limit action. + pub response: UISessionLimitsExhaustedResponse, } -/// JSON Schema describing the form fields to present to the user +/// User response for a pending user-input request, with answer text and whether it was typed freeform. /// ///
/// @@ -18769,17 +20120,14 @@ pub struct UIElicitationArrayEnumField { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct UIElicitationSchema { - /// Form field definitions, keyed by field name - pub properties: HashMap, - /// List of required field names - #[serde(skip_serializing_if = "Option::is_none")] - pub required: Option>, - /// Schema type indicator (always 'object') - pub r#type: UIElicitationSchemaType, +pub struct UIUserInputResponse { + /// The user's answer text + pub answer: String, + /// 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. + pub was_freeform: bool, } -/// Prompt message and JSON schema describing the form fields to elicit from the user. +/// Request ID of a pending `user_input.requested` event and the user's response. /// ///
/// @@ -18789,23 +20137,14 @@ pub struct UIElicitationSchema { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct UIElicitationRequest { - /// MCP request metadata. - #[serde(rename = "_meta", skip_serializing_if = "Option::is_none")] - pub meta: Option>, - /// Message describing what information is needed from the user - pub message: String, - /// Elicitation mode. Omitted and form are equivalent for structured elicitation. - #[serde(skip_serializing_if = "Option::is_none")] - pub mode: Option, - /// JSON Schema describing the form fields to present to the user - pub requested_schema: UIElicitationSchema, - /// MCP task metadata. - #[serde(skip_serializing_if = "Option::is_none")] - pub task: Option, +pub struct UIHandlePendingUserInputRequest { + /// The unique request ID from the user_input.requested event + pub request_id: RequestId, + /// User response for a pending user-input request, with answer text and whether it was typed freeform. + pub response: UIUserInputResponse, } -/// The elicitation response (accept with form values, decline, or cancel) +/// 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). /// ///
/// @@ -18815,18 +20154,12 @@ pub struct UIElicitationRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct UIElicitationResponse { - /// MCP response metadata. - #[serde(rename = "_meta", skip_serializing_if = "Option::is_none")] - pub meta: Option>, - /// The user's response: accept (submitted), decline (rejected), or cancel (dismissed) - pub action: UIElicitationResponseAction, - /// The form values submitted by the user (present when action is 'accept') - #[serde(skip_serializing_if = "Option::is_none")] - pub content: Option>, +pub struct 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. + pub handle: String, } -/// Indicates whether the elicitation response was accepted; false if it was already resolved by another client. +/// Opaque handle previously returned by `registerDirectAutoModeSwitchHandler` to release. /// ///
/// @@ -18836,12 +20169,12 @@ pub struct UIElicitationResponse { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct UIElicitationResult { - /// Whether the response was accepted. False if the request was already resolved by another client. - pub success: bool, +pub struct UIUnregisterDirectAutoModeSwitchHandlerRequest { + /// Handle previously returned by `registerDirectAutoModeSwitchHandler` + pub handle: String, } -/// Boolean field rendered as a yes/no toggle. +/// Indicates whether the handle was active and the registration count was decremented. /// ///
/// @@ -18851,21 +20184,30 @@ pub struct UIElicitationResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct UIElicitationSchemaPropertyBoolean { - /// Default value selected when the form is first shown. +pub struct UIUnregisterDirectAutoModeSwitchHandlerResult { + /// True if the handle was active and decremented the counter; false if the handle was unknown. + pub unregistered: bool, +} + +/// Configured per-agent subagent overrides +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct UpdateSubagentSettingsRequestSubagents { + /// Per-agent settings keyed by subagent agent_type #[serde(skip_serializing_if = "Option::is_none")] - pub default: Option, - /// Help text describing the field. + pub agents: Option>, + /// Names of subagents the user has turned off; they cannot be dispatched #[serde(skip_serializing_if = "Option::is_none")] - pub description: Option, - /// Human-readable label for the field. + pub disabled_subagents: Option>, + /// Maximum number of subagents that can run concurrently; applies to usage-based billing users only #[serde(skip_serializing_if = "Option::is_none")] - pub title: Option, - /// Type discriminator. Always "boolean". - pub r#type: UIElicitationSchemaPropertyBooleanType, + pub max_concurrency: Option, + /// Maximum subagent nesting depth; applies to usage-based billing users only + #[serde(skip_serializing_if = "Option::is_none")] + pub max_depth: Option, } -/// Numeric field accepting either a number or an integer. +/// Subagent settings to apply to the current session /// ///
/// @@ -18875,27 +20217,12 @@ pub struct UIElicitationSchemaPropertyBoolean { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct UIElicitationSchemaPropertyNumber { - /// Default value populated in the input when the form is first shown. - #[serde(skip_serializing_if = "Option::is_none")] - pub default: Option, - /// Help text describing the field. - #[serde(skip_serializing_if = "Option::is_none")] - pub description: Option, - /// Maximum allowed value (inclusive). - #[serde(skip_serializing_if = "Option::is_none")] - pub maximum: Option, - /// Minimum allowed value (inclusive). - #[serde(skip_serializing_if = "Option::is_none")] - pub minimum: Option, - /// Human-readable label for the field. - #[serde(skip_serializing_if = "Option::is_none")] - pub title: Option, - /// Numeric type accepted by the field. - pub r#type: UIElicitationSchemaPropertyNumberType, +pub struct UpdateSubagentSettingsRequest { + /// Subagent settings to apply, or null to clear the live session override + pub subagents: Option, } -/// Free-text string field with optional length and format constraints. +/// Request count and cost metrics for this model /// ///
/// @@ -18905,30 +20232,14 @@ pub struct UIElicitationSchemaPropertyNumber { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct UIElicitationSchemaPropertyString { - /// Default value populated in the input when the form is first shown. - #[serde(skip_serializing_if = "Option::is_none")] - pub default: Option, - /// Help text describing the field. - #[serde(skip_serializing_if = "Option::is_none")] - pub description: Option, - /// Optional format hint that constrains the accepted input. - #[serde(skip_serializing_if = "Option::is_none")] - pub format: Option, - /// Maximum number of characters allowed. - #[serde(skip_serializing_if = "Option::is_none")] - pub max_length: Option, - /// Minimum number of characters required. - #[serde(skip_serializing_if = "Option::is_none")] - pub min_length: Option, - /// Human-readable label for the field. - #[serde(skip_serializing_if = "Option::is_none")] - pub title: Option, - /// Type discriminator. Always "string". - pub r#type: UIElicitationSchemaPropertyStringType, +pub struct UsageMetricsModelMetricRequests { + /// User-initiated premium request cost (with multiplier applied) + pub cost: f64, + /// Number of API requests made with this model + pub count: i64, } -/// Single-select string field whose allowed values are defined inline. +/// Per-model token-detail entry containing the accumulated token count for one token type. /// ///
/// @@ -18938,26 +20249,12 @@ pub struct UIElicitationSchemaPropertyString { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct UIElicitationStringEnumField { - /// Default value selected when the form is first shown. - #[serde(skip_serializing_if = "Option::is_none")] - pub default: Option, - /// Help text describing the field. - #[serde(skip_serializing_if = "Option::is_none")] - pub description: Option, - /// Allowed string values. - pub r#enum: Vec, - /// Optional display labels for each enum value, in the same order as `enum`. - #[serde(skip_serializing_if = "Option::is_none")] - pub enum_names: Option>, - /// Human-readable label for the field. - #[serde(skip_serializing_if = "Option::is_none")] - pub title: Option, - /// Type discriminator. Always "string". - pub r#type: UIElicitationStringEnumFieldType, +pub struct UsageMetricsModelMetricTokenDetail { + /// Accumulated token count for this token type + pub token_count: i64, } -/// Selectable option for a UI elicitation single-select string field, with submitted value and display label. +/// Token usage metrics for this model /// ///
/// @@ -18967,14 +20264,21 @@ pub struct UIElicitationStringEnumField { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct UIElicitationStringOneOfFieldOneOf { - /// Value submitted when this option is selected. - pub r#const: String, - /// Display label for this option. - pub title: String, +pub struct UsageMetricsModelMetricUsage { + /// Total tokens read from prompt cache + pub cache_read_tokens: i64, + /// Total tokens written to prompt cache + pub cache_write_tokens: i64, + /// Total input tokens consumed + pub input_tokens: i64, + /// Total output tokens produced + pub output_tokens: i64, + /// Total output tokens used for reasoning + #[serde(skip_serializing_if = "Option::is_none")] + pub reasoning_tokens: Option, } -/// Single-select string field where each option pairs a value with a display label. +/// Per-model usage metrics, including request counts/costs, token usage, nano-AI units, and per-token-type details. /// ///
/// @@ -18984,23 +20288,23 @@ pub struct UIElicitationStringOneOfFieldOneOf { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct UIElicitationStringOneOfField { - /// Default value selected when the form is first shown. +pub struct UsageMetricsModelMetric { + /// Latest known prompt-cache expiration for this model. A timestamp in the past indicates that the observed cache has expired. #[serde(skip_serializing_if = "Option::is_none")] - pub default: Option, - /// Help text describing the field. + pub cache_expires_at: Option, + /// Request count and cost metrics for this model + pub requests: UsageMetricsModelMetricRequests, + /// Token count details per type #[serde(skip_serializing_if = "Option::is_none")] - pub description: Option, - /// Selectable options, each with a value and a display label. - pub one_of: Vec, - /// Human-readable label for the field. + pub token_details: Option>, + /// Accumulated nano-AI units cost for this model #[serde(skip_serializing_if = "Option::is_none")] - pub title: Option, - /// Type discriminator. Always "string". - pub r#type: UIElicitationStringOneOfFieldType, + pub total_nano_aiu: Option, + /// Token usage metrics for this model + pub usage: UsageMetricsModelMetricUsage, } -/// Transient question to answer without adding it to conversation history. +/// Usage attributed to one agent instance, including its identity, API duration, AI units, and per-model breakdown. /// ///
/// @@ -19010,20 +20314,43 @@ pub struct UIElicitationStringOneOfField { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct UIEphemeralQueryRequest { - /// In-process `AbortSignal` forwarded to the model client to cancel an in-flight request. Marked internal: excluded from the public SDK surface. Replaced by an explicit cancellation token + cancel RPC in the SDK migration. - #[doc(hidden)] +pub struct UsageMetricsAgentMetric { + /// Human-readable label for this subagent invocation, copied from the originating `subagent.started` event. For task-tool subagents this is the invocation's task description rather than the agent's configured display name, so group by `agentName` for stable per-agent labels. #[serde(skip_serializing_if = "Option::is_none")] - pub(crate) abort_signal: Option, - /// In-process streaming callback `(text) => void` invoked with each token as the model emits it. Marked internal: excluded from the public SDK surface. In a process-separated SDK this is replaced by a streaming RPC that yields chunks and a final answer. - #[doc(hidden)] + pub agent_display_name: Option, + /// Configured agent name, when this is a subagent #[serde(skip_serializing_if = "Option::is_none")] - pub(crate) on_chunk: Option, - /// Question to answer from the current conversation context. - pub question: String, + pub agent_name: Option, + /// Per-model usage for this agent, keyed by model identifier + pub model_metrics: HashMap, + /// Time spent in model API calls by this agent, in milliseconds + pub total_api_duration_ms: i64, + /// Accumulated nano-AI units cost for this agent + pub total_nano_aiu: f64, +} + +/// Aggregated code change metrics +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct UsageMetricsCodeChanges { + /// Distinct file paths modified during the session + pub files_modified: Vec, + /// Number of distinct files modified + pub files_modified_count: i64, + /// Total lines of code added + pub lines_added: i64, + /// Total lines of code removed + pub lines_removed: i64, } -/// Completed transient query. Ordered chunks and the terminal outcome are also delivered through `ui.ephemeral_query` session events while it runs. +/// Session-wide token-detail entry containing the accumulated token count for one token type. /// ///
/// @@ -19033,12 +20360,12 @@ pub struct UIEphemeralQueryRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct UIEphemeralQueryResult { - /// Answer returned by the model - pub answer: String, +pub struct UsageMetricsTokenDetail { + /// Accumulated token count for this token type + pub token_count: i64, } -/// User response for a pending exit-plan-mode request, with approval state, selected action, auto-approve flag, and feedback. +/// Accumulated session usage metrics, including premium request cost, token counts, model breakdown, and code-change totals. /// ///
/// @@ -19048,24 +20375,38 @@ pub struct UIEphemeralQueryResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct UIExitPlanModeResponse { - /// Whether the plan was approved. - pub approved: bool, - /// Whether subsequent edits should be auto-approved without confirmation. +pub struct UsageGetMetricsResult { + /// Per-agent usage metrics, keyed by agent instance identifier. The main conversation uses the stable key `main`. #[serde(skip_serializing_if = "Option::is_none")] - pub auto_approve_edits: Option, - /// 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. + pub agent_metrics: Option>, + /// Aggregated code change metrics + pub code_changes: UsageMetricsCodeChanges, + /// Currently active model identifier #[serde(skip_serializing_if = "Option::is_none")] - pub defer_implementation: Option, - /// Feedback from the user when they declined the plan or requested changes. + pub current_model: Option, + /// Input tokens from the most recent main-agent API call + pub last_call_input_tokens: i64, + /// Output tokens from the most recent main-agent API call + pub last_call_output_tokens: i64, + /// Per-model token and request metrics, keyed by model identifier + pub model_metrics: HashMap, + /// ISO 8601 timestamp when the session started + pub session_start_time: String, + /// Session-wide per-token-type accumulated token counts #[serde(skip_serializing_if = "Option::is_none")] - pub feedback: Option, - /// The action the user selected. Defaults to 'autopilot' when autoApproveEdits is true, otherwise 'interactive'. + pub token_details: Option>, + /// Total time spent in model API calls (milliseconds) + pub total_api_duration_ms: i64, + /// Session-wide accumulated nano-AI units cost #[serde(skip_serializing_if = "Option::is_none")] - pub selected_action: Option, + pub total_nano_aiu: Option, + /// Total user-initiated premium request cost across all models (may be fractional due to multipliers) + pub total_premium_request_cost: f64, + /// Raw count of user-initiated API requests + pub total_user_requests: i64, } -/// Request ID of a pending `auto_mode_switch.requested` event and the user's response. +/// Result of a user-requested shell command. /// ///
/// @@ -19075,14 +20416,22 @@ pub struct UIExitPlanModeResponse { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct UIHandlePendingAutoModeSwitchRequest { - /// The unique request ID from the auto_mode_switch.requested event - pub request_id: RequestId, - /// User's choice for auto-mode switching: yes (allow this turn), yes_always (allow + persist as setting), or no (decline). - pub response: UIAutoModeSwitchResponse, +pub struct UserRequestedShellCommandResult { + /// Error output when the execution failed + #[serde(skip_serializing_if = "Option::is_none")] + pub error: Option, + /// Process exit code, when available + #[serde(skip_serializing_if = "Option::is_none")] + pub exit_code: Option, + /// Captured command output + pub output: String, + /// Whether the command completed successfully + pub success: bool, + /// Tool call id emitted for the shell execution + pub tool_call_id: String, } -/// Pending elicitation request ID and the user's response (accept/decline/cancel + form values). +/// A single user setting's effective value alongside its default, so consumers can render settings left at their default. /// ///
/// @@ -19092,14 +20441,16 @@ pub struct UIHandlePendingAutoModeSwitchRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct UIHandlePendingElicitationRequest { - /// The unique request ID from the elicitation.requested event - pub request_id: RequestId, - /// The elicitation response (accept with form values, decline, or cancel) - pub result: UIElicitationResponse, +pub struct UserSettingMetadata { + /// The centrally-known default for this setting (null when no default is registered). + pub default: serde_json::Value, + /// 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. + pub is_default: bool, + /// The effective value: the user's value if set, otherwise the default. + pub value: serde_json::Value, } -/// Request ID of a pending `exit_plan_mode.requested` event and the user's response. +/// 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. /// ///
/// @@ -19109,14 +20460,12 @@ pub struct UIHandlePendingElicitationRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct UIHandlePendingExitPlanModeRequest { - /// The unique request ID from the exit_plan_mode.requested event - pub request_id: RequestId, - /// User response for a pending exit-plan-mode request, with approval state, selected action, auto-approve flag, and feedback. - pub response: UIExitPlanModeResponse, +pub struct UserSettingsGetResult { + /// Every known user setting keyed by setting name, each with its effective value, default, and whether it is at the default. + pub settings: HashMap, } -/// Indicates whether the pending UI request was resolved by this call. +/// 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. /// ///
/// @@ -19126,12 +20475,12 @@ pub struct UIHandlePendingExitPlanModeRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct 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. - pub success: bool, +pub struct UserSettingsSetRequest { + /// Partial user settings to write, as a free-form object keyed by setting name + pub settings: serde_json::Value, } -/// Optional sampling result payload. Omit to reject/cancel the sampling request without providing a result. +/// Outcome of writing user settings. /// ///
/// @@ -19141,9 +20490,12 @@ pub struct UIHandlePendingResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct UIHandlePendingSamplingResponse {} +pub struct 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. + pub shadowed_keys: Vec, +} -/// Request ID of a pending `sampling.requested` event and an optional sampling result payload (omit to reject). +/// Current sharing status and shareable GitHub URL for a session. /// ///
/// @@ -19153,15 +20505,18 @@ pub struct UIHandlePendingSamplingResponse {} ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct UIHandlePendingSamplingRequest { - /// The unique request ID from the sampling.requested event - pub request_id: RequestId, - /// Optional sampling result payload. Omit to reject/cancel the sampling request without providing a result. +pub struct VisibilityGetResult { + /// Shareable GitHub URL for the session. Present when the session is synced and the URL can be resolved. #[serde(skip_serializing_if = "Option::is_none")] - pub response: Option, + pub share_url: Option, + /// Current sharing status. Absent when the session is not synced or the status could not be retrieved (e.g. the user is not authenticated). + #[serde(skip_serializing_if = "Option::is_none")] + pub status: Option, + /// Whether the session has been synced to Mission Control (i.e. has a GitHub task). When false, the session cannot be shared and `status`/`shareUrl` are absent. + pub synced: bool, } -/// The user's selected action for an exhausted session limit. +/// Desired sharing status for the session. /// ///
/// @@ -19171,18 +20526,12 @@ pub struct UIHandlePendingSamplingRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct UISessionLimitsExhaustedResponse { - /// Action selected by the user. - pub action: UISessionLimitsExhaustedResponseAction, - /// AI Credits to add to the current max when action is 'add'. - #[serde(skip_serializing_if = "Option::is_none")] - pub additional_ai_credits: Option, - /// New absolute max AI Credits when action is 'set'. - #[serde(skip_serializing_if = "Option::is_none")] - pub max_ai_credits: Option, +pub struct VisibilitySetRequest { + /// Sharing status to apply. "repo" makes the session visible to repository readers; "unshared" restricts it to the creator and collaborators. + pub status: SessionVisibilityStatus, } -/// Request ID of a pending `session_limits_exhausted.requested` event and the user's selected limit action. +/// Effective sharing status and shareable GitHub URL after updating session visibility. /// ///
/// @@ -19192,14 +20541,18 @@ pub struct UISessionLimitsExhaustedResponse { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct UIHandlePendingSessionLimitsExhaustedRequest { - /// The unique request ID from the session_limits_exhausted.requested event - pub request_id: RequestId, - /// The selected session-limit action. - pub response: UISessionLimitsExhaustedResponse, +pub struct VisibilitySetResult { + /// Shareable GitHub URL for the session. Present when the session is synced and the URL can be resolved. + #[serde(skip_serializing_if = "Option::is_none")] + pub share_url: Option, + /// Effective sharing status after the update. May differ from the requested status for task types that are already visible to repository readers by default. Absent when the update could not be applied (e.g. the session is not synced or the user is not authenticated). + #[serde(skip_serializing_if = "Option::is_none")] + pub status: Option, + /// Whether the session has been synced to Mission Control (i.e. has a GitHub task). When false, the visibility change could not be applied and `status`/`shareUrl` are absent. + pub synced: bool, } -/// User response for a pending user-input request, with answer text and whether it was typed freeform. +/// A single changed file and its unified diff. /// ///
/// @@ -19209,14 +20562,22 @@ pub struct UIHandlePendingSessionLimitsExhaustedRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct UIUserInputResponse { - /// The user's answer text - pub answer: String, - /// 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. - pub was_freeform: bool, +pub struct WorkspaceDiffFileChange { + /// Type of change represented by this file diff. + pub change_type: WorkspaceDiffFileChangeType, + /// Unified diff content for the file. Empty when the diff was truncated. + pub diff: String, + /// Whether the diff content was omitted because it exceeded the per-file size limit. + #[serde(skip_serializing_if = "Option::is_none")] + pub is_truncated: Option, + /// Original file path for renamed files. + #[serde(skip_serializing_if = "Option::is_none")] + pub old_path: Option, + /// 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). + pub path: String, } -/// Request ID of a pending `user_input.requested` event and the user's response. +/// Workspace diff result for the requested mode. /// ///
/// @@ -19226,14 +20587,24 @@ pub struct UIUserInputResponse { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct UIHandlePendingUserInputRequest { - /// The unique request ID from the user_input.requested event - pub request_id: RequestId, - /// User response for a pending user-input request, with answer text and whether it was typed freeform. - pub response: UIUserInputResponse, +pub struct WorkspaceDiffResult { + /// Default branch used for a branch diff, when branch mode was requested. + #[serde(skip_serializing_if = "Option::is_none")] + pub base_branch: Option, + /// Changed files and their unified diffs. + pub changes: Vec, + /// Whether the requested diff fell back to unstaged changes, either because branch diff failed or session diff was unavailable. + pub is_fallback: bool, + /// Effective mode used for the returned changes. + pub mode: WorkspaceDiffMode, + /// Diff mode requested by the client. + pub requested_mode: WorkspaceDiffMode, + /// 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. + #[serde(skip_serializing_if = "Option::is_none")] + pub unavailable_reason: Option, } -/// 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). +/// Compaction summary checkpoint to persist. /// ///
/// @@ -19243,12 +20614,14 @@ pub struct UIHandlePendingUserInputRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct 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. - pub handle: String, +pub struct WorkspacesAddSummaryRequest { + /// Markdown summary content to persist. + pub content: String, + /// Summary title shown in checkpoint listings. + pub title: String, } -/// Opaque handle previously returned by `registerDirectAutoModeSwitchHandler` to release. +/// Persisted summary metadata and refreshed workspace metadata. /// ///
/// @@ -19258,12 +20631,16 @@ pub struct UIRegisterDirectAutoModeSwitchHandlerResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct UIUnregisterDirectAutoModeSwitchHandlerRequest { - /// Handle previously returned by `registerDirectAutoModeSwitchHandler` - pub handle: String, +pub struct WorkspacesAddSummaryResult { + /// Metadata for the persisted summary. + #[serde(skip_serializing_if = "Option::is_none")] + pub summary: Option, + /// Refreshed metadata for the containing workspace. + #[serde(skip_serializing_if = "Option::is_none")] + pub workspace: Option, } -/// Indicates whether the handle was active and the registration count was decremented. +/// Whether the autopilot objective file exists. /// ///
/// @@ -19273,30 +20650,31 @@ pub struct UIUnregisterDirectAutoModeSwitchHandlerRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct UIUnregisterDirectAutoModeSwitchHandlerResult { - /// True if the handle was active and decremented the counter; false if the handle was unknown. - pub unregistered: bool, +pub struct WorkspacesAutopilotObjectiveExistsResult { + /// True when the objective file exists. + pub exists: bool, } -/// Configured per-agent subagent overrides +/// Workspace checkpoint metadata with assigned number, human-readable title, and checkpoint filename. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct UpdateSubagentSettingsRequestSubagents { - /// Per-agent settings keyed by subagent agent_type - #[serde(skip_serializing_if = "Option::is_none")] - pub agents: Option>, - /// Names of subagents the user has turned off; they cannot be dispatched - #[serde(skip_serializing_if = "Option::is_none")] - pub disabled_subagents: Option>, - /// Maximum number of subagents that can run concurrently; applies to usage-based billing users only - #[serde(skip_serializing_if = "Option::is_none")] - pub max_concurrency: Option, - /// Maximum subagent nesting depth; applies to usage-based billing users only - #[serde(skip_serializing_if = "Option::is_none")] - pub max_depth: Option, +pub struct WorkspacesCheckpoints { + /// Filename of the checkpoint within the workspace checkpoints directory + pub filename: String, + /// Checkpoint number assigned by the workspace manager + pub number: i64, + /// Human-readable checkpoint title + pub title: String, } -/// Subagent settings to apply to the current session +/// Relative path and UTF-8 content for the workspace file to create or overwrite. /// ///
/// @@ -19306,12 +20684,14 @@ pub struct UpdateSubagentSettingsRequestSubagents { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct UpdateSubagentSettingsRequest { - /// Subagent settings to apply, or null to clear the live session override - pub subagents: Option, +pub struct WorkspacesCreateFileRequest { + /// File content to write as a UTF-8 string + pub content: String, + /// Relative path within the workspace files directory + pub path: String, } -/// Request count and cost metrics for this model +/// Result of deleting the autopilot objective file. /// ///
/// @@ -19321,14 +20701,12 @@ pub struct UpdateSubagentSettingsRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct UsageMetricsModelMetricRequests { - /// User-initiated premium request cost (with multiplier applied) - pub cost: f64, - /// Number of API requests made with this model - pub count: i64, +pub struct WorkspacesDeleteAutopilotObjectiveResult { + /// True when a file was deleted. + pub deleted: bool, } -/// Per-model token-detail entry containing the accumulated token count for one token type. +/// Parameters for computing a workspace diff. /// ///
/// @@ -19338,12 +20716,15 @@ pub struct UsageMetricsModelMetricRequests { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct UsageMetricsModelMetricTokenDetail { - /// Accumulated token count for this token type - pub token_count: i64, +pub struct WorkspacesDiffRequest { + /// When true, ignore whitespace-only changes (git `--ignore-all-space`). Defaults to false. + #[serde(skip_serializing_if = "Option::is_none")] + pub ignore_whitespace: Option, + /// Diff mode requested by the client. + pub mode: WorkspaceDiffMode, } -/// Token usage metrics for this model +/// Optional session context used when creating a local workspace. /// ///
/// @@ -19353,21 +20734,71 @@ pub struct UsageMetricsModelMetricTokenDetail { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct UsageMetricsModelMetricUsage { - /// Total tokens read from prompt cache - pub cache_read_tokens: i64, - /// Total tokens written to prompt cache - pub cache_write_tokens: i64, - /// Total input tokens consumed - pub input_tokens: i64, - /// Total output tokens produced - pub output_tokens: i64, - /// Total output tokens used for reasoning +pub struct WorkspacesEnsureRequest { + /// Opaque workspace context supplied by the session host. #[serde(skip_serializing_if = "Option::is_none")] - pub reasoning_tokens: Option, + pub context: Option, } -/// Per-model usage metrics, including request counts/costs, token usage, nano-AI units, and per-token-type details. +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct WorkspacesGetWorkspaceResultWorkspace { + /// Current Git branch. + #[serde(skip_serializing_if = "Option::is_none")] + pub branch: Option, + /// Whether the per-session Chronicle upgrade prompt was dismissed for the workspace. + #[serde( + rename = "chronicle_sync_dismissed", + skip_serializing_if = "Option::is_none" + )] + pub chronicle_sync_dismissed: Option, + /// Name of the client that created the workspace. + #[serde(rename = "client_name", skip_serializing_if = "Option::is_none")] + pub client_name: Option, + /// Timestamp when the workspace was created. + #[serde(rename = "created_at", skip_serializing_if = "Option::is_none")] + pub created_at: Option, + /// Current working directory associated with the workspace. + #[serde(skip_serializing_if = "Option::is_none")] + pub cwd: Option, + /// Git repository root associated with the workspace. + #[serde(rename = "git_root", skip_serializing_if = "Option::is_none")] + pub git_root: Option, + /// Allowed values for the `WorkspacesWorkspaceDetailsHostType` enumeration. + #[serde(rename = "host_type", skip_serializing_if = "Option::is_none")] + pub host_type: Option, + /// Stable workspace identifier. + pub id: String, + /// Most recent Mission Control event identifier observed for the workspace. + #[serde(rename = "mc_last_event_id", skip_serializing_if = "Option::is_none")] + pub mc_last_event_id: Option, + /// Mission Control session identifier associated with the workspace. + #[serde(rename = "mc_session_id", skip_serializing_if = "Option::is_none")] + pub mc_session_id: Option, + /// Mission Control task identifier associated with the workspace. + #[serde(rename = "mc_task_id", skip_serializing_if = "Option::is_none")] + pub mc_task_id: Option, + /// Workspace display name. + #[serde(skip_serializing_if = "Option::is_none")] + pub name: Option, + /// Whether the workspace session can be steered remotely. + #[serde(rename = "remote_steerable", skip_serializing_if = "Option::is_none")] + pub remote_steerable: Option, + /// Repository identifier associated with the workspace. + #[serde(skip_serializing_if = "Option::is_none")] + pub repository: Option, + /// Number of persisted summaries in the workspace. + #[serde(rename = "summary_count", skip_serializing_if = "Option::is_none")] + pub summary_count: Option, + /// Timestamp when the workspace was last updated. + #[serde(rename = "updated_at", skip_serializing_if = "Option::is_none")] + pub updated_at: Option, + /// Whether the workspace name was explicitly chosen by the user. + #[serde(rename = "user_named", skip_serializing_if = "Option::is_none")] + pub user_named: Option, +} + +/// Current workspace metadata for the session, including its absolute filesystem path when available. /// ///
/// @@ -19377,23 +20808,15 @@ pub struct UsageMetricsModelMetricUsage { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct UsageMetricsModelMetric { - /// Latest known prompt-cache expiration for this model. A timestamp in the past indicates that the observed cache has expired. - #[serde(skip_serializing_if = "Option::is_none")] - pub cache_expires_at: Option, - /// Request count and cost metrics for this model - pub requests: UsageMetricsModelMetricRequests, - /// Token count details per type - #[serde(skip_serializing_if = "Option::is_none")] - pub token_details: Option>, - /// Accumulated nano-AI units cost for this model +pub struct WorkspacesGetWorkspaceResult { + /// Absolute filesystem path to the workspace directory. Omitted when the session has no workspace (e.g. remote sessions). #[serde(skip_serializing_if = "Option::is_none")] - pub total_nano_aiu: Option, - /// Token usage metrics for this model - pub usage: UsageMetricsModelMetricUsage, + pub path: Option, + /// Current workspace metadata, or null if not available + pub workspace: Option, } -/// Usage attributed to one agent instance, including its identity, API duration, AI units, and per-model breakdown. +/// Workspace checkpoints in chronological order; empty when the workspace is not enabled. /// ///
/// @@ -19403,22 +20826,12 @@ pub struct UsageMetricsModelMetric { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct UsageMetricsAgentMetric { - /// Human-readable label for this subagent invocation, copied from the originating `subagent.started` event. For task-tool subagents this is the invocation's task description rather than the agent's configured display name, so group by `agentName` for stable per-agent labels. - #[serde(skip_serializing_if = "Option::is_none")] - pub agent_display_name: Option, - /// Configured agent name, when this is a subagent - #[serde(skip_serializing_if = "Option::is_none")] - pub agent_name: Option, - /// Per-model usage for this agent, keyed by model identifier - pub model_metrics: HashMap, - /// Time spent in model API calls by this agent, in milliseconds - pub total_api_duration_ms: i64, - /// Accumulated nano-AI units cost for this agent - pub total_nano_aiu: f64, +pub struct WorkspacesListCheckpointsResult { + /// Workspace checkpoints in chronological order. Empty when workspace is not enabled. + pub checkpoints: Vec, } -/// Aggregated code change metrics +/// Relative paths of files stored in the session workspace files directory. /// ///
/// @@ -19428,18 +20841,12 @@ pub struct UsageMetricsAgentMetric { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct UsageMetricsCodeChanges { - /// Distinct file paths modified during the session - pub files_modified: Vec, - /// Number of distinct files modified - pub files_modified_count: i64, - /// Total lines of code added - pub lines_added: i64, - /// Total lines of code removed - pub lines_removed: i64, +pub struct WorkspacesListFilesResult { + /// Relative file paths in the workspace files directory + pub files: Vec, } -/// Session-wide token-detail entry containing the accumulated token count for one token type. +/// Autopilot objective file content, or null when missing. /// ///
/// @@ -19449,12 +20856,12 @@ pub struct UsageMetricsCodeChanges { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct UsageMetricsTokenDetail { - /// Accumulated token count for this token type - pub token_count: i64, +pub struct WorkspacesReadAutopilotObjectiveResult { + /// Autopilot objective file content, or null when missing. + pub content: Option, } -/// Accumulated session usage metrics, including premium request cost, token counts, model breakdown, and code-change totals. +/// Checkpoint number to read. /// ///
/// @@ -19464,38 +20871,12 @@ pub struct UsageMetricsTokenDetail { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct UsageGetMetricsResult { - /// Per-agent usage metrics, keyed by agent instance identifier. The main conversation uses the stable key `main`. - #[serde(skip_serializing_if = "Option::is_none")] - pub agent_metrics: Option>, - /// Aggregated code change metrics - pub code_changes: UsageMetricsCodeChanges, - /// Currently active model identifier - #[serde(skip_serializing_if = "Option::is_none")] - pub current_model: Option, - /// Input tokens from the most recent main-agent API call - pub last_call_input_tokens: i64, - /// Output tokens from the most recent main-agent API call - pub last_call_output_tokens: i64, - /// Per-model token and request metrics, keyed by model identifier - pub model_metrics: HashMap, - /// ISO 8601 timestamp when the session started - pub session_start_time: String, - /// Session-wide per-token-type accumulated token counts - #[serde(skip_serializing_if = "Option::is_none")] - pub token_details: Option>, - /// Total time spent in model API calls (milliseconds) - pub total_api_duration_ms: i64, - /// Session-wide accumulated nano-AI units cost - #[serde(skip_serializing_if = "Option::is_none")] - pub total_nano_aiu: Option, - /// Total user-initiated premium request cost across all models (may be fractional due to multipliers) - pub total_premium_request_cost: f64, - /// Raw count of user-initiated API requests - pub total_user_requests: i64, +pub struct WorkspacesReadCheckpointRequest { + /// Checkpoint number to read + pub number: i64, } -/// Result of a user-requested shell command. +/// Checkpoint content as a UTF-8 string, or null when the checkpoint or workspace is missing. /// ///
/// @@ -19505,22 +20886,12 @@ pub struct UsageGetMetricsResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct UserRequestedShellCommandResult { - /// Error output when the execution failed - #[serde(skip_serializing_if = "Option::is_none")] - pub error: Option, - /// Process exit code, when available - #[serde(skip_serializing_if = "Option::is_none")] - pub exit_code: Option, - /// Captured command output - pub output: String, - /// Whether the command completed successfully - pub success: bool, - /// Tool call id emitted for the shell execution - pub tool_call_id: String, +pub struct WorkspacesReadCheckpointResult { + /// Checkpoint content as a UTF-8 string, or null when the checkpoint or workspace is missing + pub content: Option, } -/// A single user setting's effective value alongside its default, so consumers can render settings left at their default. +/// Relative path of the workspace file to read. /// ///
/// @@ -19530,16 +20901,12 @@ pub struct UserRequestedShellCommandResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct UserSettingMetadata { - /// The centrally-known default for this setting (null when no default is registered). - pub default: serde_json::Value, - /// 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. - pub is_default: bool, - /// The effective value: the user's value if set, otherwise the default. - pub value: serde_json::Value, +pub struct WorkspacesReadFileRequest { + /// Relative path within the workspace files directory + pub path: String, } -/// 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. +/// Contents of the requested workspace file as a UTF-8 string. /// ///
/// @@ -19549,12 +20916,12 @@ pub struct UserSettingMetadata { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct UserSettingsGetResult { - /// Every known user setting keyed by setting name, each with its effective value, default, and whether it is at the default. - pub settings: HashMap, +pub struct WorkspacesReadFileResult { + /// File content as a UTF-8 string + pub content: String, } -/// 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. +/// Pasted content to save as a UTF-8 file in the session workspace. /// ///
/// @@ -19564,12 +20931,23 @@ pub struct UserSettingsGetResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct UserSettingsSetRequest { - /// Partial user settings to write, as a free-form object keyed by setting name - pub settings: serde_json::Value, +pub struct WorkspacesSaveLargePasteRequest { + /// Pasted content to save as a UTF-8 file + pub content: String, } -/// Outcome of writing user settings. +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct WorkspacesSaveLargePasteResultSaved { + /// Filename within the workspace files directory + pub filename: String, + /// Absolute filesystem path to the saved paste file + pub file_path: String, + /// Size of the saved file in bytes + pub size_bytes: i64, +} + +/// Descriptor for the saved paste file, or null when the workspace is unavailable. /// ///
/// @@ -19579,12 +20957,12 @@ pub struct UserSettingsSetRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct 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. - pub shadowed_keys: Vec, +pub struct WorkspacesSaveLargePasteResult { + /// Saved-paste descriptor, or null when the workspace is unavailable (e.g. CCA runtime, non-infinite sessions, remote sessions) + pub saved: Option, } -/// Current sharing status and shareable GitHub URL for a session. +/// Rollback point for local workspace summaries. /// ///
/// @@ -19594,18 +20972,12 @@ pub struct UserSettingsSetResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct VisibilityGetResult { - /// Shareable GitHub URL for the session. Present when the session is synced and the URL can be resolved. - #[serde(skip_serializing_if = "Option::is_none")] - pub share_url: Option, - /// Current sharing status. Absent when the session is not synced or the status could not be retrieved (e.g. the user is not authenticated). - #[serde(skip_serializing_if = "Option::is_none")] - pub status: Option, - /// Whether the session has been synced to Mission Control (i.e. has a GitHub task). When false, the session cannot be shared and `status`/`shareUrl` are absent. - pub synced: bool, +pub struct WorkspacesTruncateSummariesRequest { + /// Number of newest summaries to keep. + pub keep_count: i64, } -/// Desired sharing status for the session. +/// Public-facing workspace metadata for this session, or null if the session has no associated workspace. Excludes runtime-internal fields (GitHub IDs, summary count, internal flags). /// ///
/// @@ -19615,12 +20987,39 @@ pub struct VisibilityGetResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct VisibilitySetRequest { - /// Sharing status to apply. "repo" makes the session visible to repository readers; "unshared" restricts it to the creator and collaborators. - pub status: SessionVisibilityStatus, +pub struct WorkspaceSummary { + /// Branch checked out at session start, if any + #[serde(skip_serializing_if = "Option::is_none")] + pub branch: Option, + /// ISO 8601 timestamp when the workspace was created + #[serde(rename = "created_at", skip_serializing_if = "Option::is_none")] + pub created_at: Option, + /// Current working directory at session start + #[serde(skip_serializing_if = "Option::is_none")] + pub cwd: Option, + /// Resolved git root for cwd, if any + #[serde(rename = "git_root", skip_serializing_if = "Option::is_none")] + pub git_root: Option, + /// Repository host type, if known + #[serde(rename = "host_type", skip_serializing_if = "Option::is_none")] + pub host_type: Option, + /// Workspace identifier (1:1 with sessionId) + pub id: String, + /// Display name for the session, if set + #[serde(skip_serializing_if = "Option::is_none")] + pub name: Option, + /// Repository identifier in 'owner/repo' or 'org/project/repo' format, if any + #[serde(skip_serializing_if = "Option::is_none")] + pub repository: Option, + /// ISO 8601 timestamp when the workspace was last updated + #[serde(rename = "updated_at", skip_serializing_if = "Option::is_none")] + pub updated_at: Option, + /// Whether the display name was explicitly set by the user + #[serde(rename = "user_named", skip_serializing_if = "Option::is_none")] + pub user_named: Option, } -/// Effective sharing status and shareable GitHub URL after updating session visibility. +/// Workspace metadata fields to update. /// ///
/// @@ -19630,18 +21029,16 @@ pub struct VisibilitySetRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct VisibilitySetResult { - /// Shareable GitHub URL for the session. Present when the session is synced and the URL can be resolved. +pub struct WorkspacesUpdateMetadataRequest { + /// Opaque workspace context supplied by the session host. #[serde(skip_serializing_if = "Option::is_none")] - pub share_url: Option, - /// Effective sharing status after the update. May differ from the requested status for task types that are already visible to repository readers by default. Absent when the update could not be applied (e.g. the session is not synced or the user is not authenticated). + pub context: Option, + /// Optional workspace display name override. #[serde(skip_serializing_if = "Option::is_none")] - pub status: Option, - /// Whether the session has been synced to Mission Control (i.e. has a GitHub task). When false, the visibility change could not be applied and `status`/`shareUrl` are absent. - pub synced: bool, + pub name: Option, } -/// A single changed file and its unified diff. +/// Autopilot objective file content to persist. /// ///
/// @@ -19651,22 +21048,12 @@ pub struct VisibilitySetResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct WorkspaceDiffFileChange { - /// Type of change represented by this file diff. - pub change_type: WorkspaceDiffFileChangeType, - /// Unified diff content for the file. Empty when the diff was truncated. - pub diff: String, - /// Whether the diff content was omitted because it exceeded the per-file size limit. - #[serde(skip_serializing_if = "Option::is_none")] - pub is_truncated: Option, - /// Original file path for renamed files. - #[serde(skip_serializing_if = "Option::is_none")] - pub old_path: Option, - /// 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). - pub path: String, +pub struct WorkspacesWriteAutopilotObjectiveRequest { + /// Autopilot objective file content. + pub content: String, } -/// Workspace diff result for the requested mode. +/// Result of writing the autopilot objective file. /// ///
/// @@ -19676,24 +21063,12 @@ pub struct WorkspaceDiffFileChange { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct WorkspaceDiffResult { - /// Default branch used for a branch diff, when branch mode was requested. - #[serde(skip_serializing_if = "Option::is_none")] - pub base_branch: Option, - /// Changed files and their unified diffs. - pub changes: Vec, - /// Whether the requested diff fell back to unstaged changes, either because branch diff failed or session diff was unavailable. - pub is_fallback: bool, - /// Effective mode used for the returned changes. - pub mode: WorkspaceDiffMode, - /// Diff mode requested by the client. - pub requested_mode: WorkspaceDiffMode, - /// 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. - #[serde(skip_serializing_if = "Option::is_none")] - pub unavailable_reason: Option, +pub struct WorkspacesWriteAutopilotObjectiveResult { + /// Filesystem operation performed. + pub operation: String, } -/// Compaction summary checkpoint to persist. +/// List of Copilot models available to the resolved user, including capabilities and billing metadata. /// ///
/// @@ -19703,14 +21078,12 @@ pub struct WorkspaceDiffResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct WorkspacesAddSummaryRequest { - /// Markdown summary content to persist. - pub content: String, - /// Summary title shown in checkpoint listings. - pub title: String, +pub struct ModelsListResult { + /// List of available models with full metadata + pub models: Vec, } -/// Persisted summary metadata and refreshed workspace metadata. +/// The running runtime's complete catalog of well-known built-in model IDs, including supported models and additional IDs with built-in metadata. /// ///
/// @@ -19720,16 +21093,12 @@ pub struct WorkspacesAddSummaryRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct WorkspacesAddSummaryResult { - /// Metadata for the persisted summary. - #[serde(skip_serializing_if = "Option::is_none")] - pub summary: Option, - /// Refreshed metadata for the containing workspace. - #[serde(skip_serializing_if = "Option::is_none")] - pub workspace: Option, +pub struct ModelsGetBuiltInCatalogResult { + /// Built-in model entries. + pub models: Vec, } -/// Whether the autopilot objective file exists. +/// Built-in tools available for the requested model, with their parameters and instructions. /// ///
/// @@ -19739,12 +21108,12 @@ pub struct WorkspacesAddSummaryResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct WorkspacesAutopilotObjectiveExistsResult { - /// True when the objective file exists. - pub exists: bool, +pub struct ToolsListResult { + /// List of available built-in tools with metadata + pub tools: Vec, } -/// Workspace checkpoint metadata with assigned number, human-readable title, and checkpoint filename. +/// User-configured MCP servers, keyed by server name. /// ///
/// @@ -19754,16 +21123,12 @@ pub struct WorkspacesAutopilotObjectiveExistsResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct WorkspacesCheckpoints { - /// Filename of the checkpoint within the workspace checkpoints directory - pub filename: String, - /// Checkpoint number assigned by the workspace manager - pub number: i64, - /// Human-readable checkpoint title - pub title: String, +pub struct McpConfigListResult { + /// All MCP servers from user config, keyed by name + pub servers: HashMap, } -/// Relative path and UTF-8 content for the workspace file to create or overwrite. +/// Extensions discovered from persisted Copilot home state and their effective loading mode. Launch-scoped additional plugins are not included. /// ///
/// @@ -19773,14 +21138,14 @@ pub struct WorkspacesCheckpoints { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct WorkspacesCreateFileRequest { - /// File content to write as a UTF-8 string - pub content: String, - /// Relative path within the workspace files directory - pub path: String, +pub struct ExtensionsDiscoverResult { + /// Discovered user and enabled installed-plugin extensions from persisted Copilot home state + pub extensions: Vec, + /// Effective extension loading mode. Defaults to load_and_augment when unset. + pub mode: DiscoveredExtensionMode, } -/// Result of deleting the autopilot objective file. +/// Plugins installed in user/global state. /// ///
/// @@ -19790,12 +21155,12 @@ pub struct WorkspacesCreateFileRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct WorkspacesDeleteAutopilotObjectiveResult { - /// True when a file was deleted. - pub deleted: bool, +pub struct PluginsListResult { + /// Installed plugins + pub plugins: Vec, } -/// Parameters for computing a workspace diff. +/// Result of installing a plugin. /// ///
/// @@ -19805,15 +21170,20 @@ pub struct WorkspacesDeleteAutopilotObjectiveResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct WorkspacesDiffRequest { - /// When true, ignore whitespace-only changes (git `--ignore-all-space`). Defaults to false. +pub struct PluginsInstallResult { + /// Set when the install path is deprecated (e.g. direct repo / URL / local installs). Callers should surface this to end users. #[serde(skip_serializing_if = "Option::is_none")] - pub ignore_whitespace: Option, - /// Diff mode requested by the client. - pub mode: WorkspaceDiffMode, + pub deprecation_warning: Option, + /// The newly installed plugin's metadata + pub plugin: InstalledPluginInfo, + /// Optional post-install message provided by the plugin (e.g. setup instructions) + #[serde(skip_serializing_if = "Option::is_none")] + pub post_install_message: Option, + /// Number of skills discovered and installed from the plugin + pub skills_installed: i64, } -/// Optional session context used when creating a local workspace. +/// Result of updating a single plugin. /// ///
/// @@ -19823,71 +21193,33 @@ pub struct WorkspacesDiffRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct WorkspacesEnsureRequest { - /// Opaque workspace context supplied by the session host. - #[serde(skip_serializing_if = "Option::is_none")] - pub context: Option, -} - -#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct WorkspacesGetWorkspaceResultWorkspace { - /// Current Git branch. - #[serde(skip_serializing_if = "Option::is_none")] - pub branch: Option, - /// Whether the per-session Chronicle upgrade prompt was dismissed for the workspace. - #[serde( - rename = "chronicle_sync_dismissed", - skip_serializing_if = "Option::is_none" - )] - pub chronicle_sync_dismissed: Option, - /// Name of the client that created the workspace. - #[serde(rename = "client_name", skip_serializing_if = "Option::is_none")] - pub client_name: Option, - /// Timestamp when the workspace was created. - #[serde(rename = "created_at", skip_serializing_if = "Option::is_none")] - pub created_at: Option, - /// Current working directory associated with the workspace. - #[serde(skip_serializing_if = "Option::is_none")] - pub cwd: Option, - /// Git repository root associated with the workspace. - #[serde(rename = "git_root", skip_serializing_if = "Option::is_none")] - pub git_root: Option, - /// Allowed values for the `WorkspacesWorkspaceDetailsHostType` enumeration. - #[serde(rename = "host_type", skip_serializing_if = "Option::is_none")] - pub host_type: Option, - /// Stable workspace identifier. - pub id: String, - /// Most recent Mission Control event identifier observed for the workspace. - #[serde(rename = "mc_last_event_id", skip_serializing_if = "Option::is_none")] - pub mc_last_event_id: Option, - /// Mission Control session identifier associated with the workspace. - #[serde(rename = "mc_session_id", skip_serializing_if = "Option::is_none")] - pub mc_session_id: Option, - /// Mission Control task identifier associated with the workspace. - #[serde(rename = "mc_task_id", skip_serializing_if = "Option::is_none")] - pub mc_task_id: Option, - /// Workspace display name. +pub struct PluginsUpdateResult { + /// Version after the update, when reported by the plugin manifest #[serde(skip_serializing_if = "Option::is_none")] - pub name: Option, - /// Whether the workspace session can be steered remotely. - #[serde(rename = "remote_steerable", skip_serializing_if = "Option::is_none")] - pub remote_steerable: Option, - /// Repository identifier associated with the workspace. + pub new_version: Option, + /// Version that was previously installed, when available #[serde(skip_serializing_if = "Option::is_none")] - pub repository: Option, - /// Number of persisted summaries in the workspace. - #[serde(rename = "summary_count", skip_serializing_if = "Option::is_none")] - pub summary_count: Option, - /// Timestamp when the workspace was last updated. - #[serde(rename = "updated_at", skip_serializing_if = "Option::is_none")] - pub updated_at: Option, - /// Whether the workspace name was explicitly chosen by the user. - #[serde(rename = "user_named", skip_serializing_if = "Option::is_none")] - pub user_named: Option, + pub previous_version: Option, + /// Number of skills discovered and installed after the update + pub skills_installed: i64, +} + +/// Result of updating all installed plugins. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct PluginsUpdateAllResult { + /// Per-plugin update results in deterministic order. + pub results: Vec, } -/// Current workspace metadata for the session, including its absolute filesystem path when available. +/// All registered marketplaces, including built-in defaults. /// ///
/// @@ -19897,15 +21229,12 @@ pub struct WorkspacesGetWorkspaceResultWorkspace { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct WorkspacesGetWorkspaceResult { - /// Absolute filesystem path to the workspace directory. Omitted when the session has no workspace (e.g. remote sessions). - #[serde(skip_serializing_if = "Option::is_none")] - pub path: Option, - /// Current workspace metadata, or null if not available - pub workspace: Option, +pub struct PluginsMarketplacesListResult { + /// Registered marketplaces + pub marketplaces: Vec, } -/// Workspace checkpoints in chronological order; empty when the workspace is not enabled. +/// Result of registering a new marketplace. /// ///
/// @@ -19915,12 +21244,12 @@ pub struct WorkspacesGetWorkspaceResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct WorkspacesListCheckpointsResult { - /// Workspace checkpoints in chronological order. Empty when workspace is not enabled. - pub checkpoints: Vec, +pub struct PluginsMarketplacesAddResult { + /// Final name of the marketplace as resolved from its manifest + pub name: String, } -/// Relative paths of files stored in the session workspace files directory. +/// Outcome of the remove attempt, including dependent-plugin info when applicable. /// ///
/// @@ -19930,12 +21259,15 @@ pub struct WorkspacesListCheckpointsResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct WorkspacesListFilesResult { - /// Relative file paths in the workspace files directory - pub files: Vec, +pub struct PluginsMarketplacesRemoveResult { + /// Names of installed plugins that prevented removal. Populated only when `removed=false`. + #[serde(skip_serializing_if = "Option::is_none")] + pub dependent_plugins: Option>, + /// True when the marketplace was actually removed. False when removal was skipped because the marketplace has dependent plugins and `force` was not set. + pub removed: bool, } -/// Autopilot objective file content, or null when missing. +/// Plugins advertised by the marketplace. /// ///
/// @@ -19945,12 +21277,12 @@ pub struct WorkspacesListFilesResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct WorkspacesReadAutopilotObjectiveResult { - /// Autopilot objective file content, or null when missing. - pub content: Option, +pub struct PluginsMarketplacesBrowseResult { + /// Plugins advertised by the marketplace + pub plugins: Vec, } -/// Checkpoint number to read. +/// Result of refreshing one or more marketplace catalogs. /// ///
/// @@ -19960,12 +21292,12 @@ pub struct WorkspacesReadAutopilotObjectiveResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct WorkspacesReadCheckpointRequest { - /// Checkpoint number to read - pub number: i64, +pub struct PluginsMarketplacesRefreshResult { + /// Per-marketplace refresh results in deterministic order. + pub results: Vec, } -/// Checkpoint content as a UTF-8 string, or null when the checkpoint or workspace is missing. +/// Skills discovered across global and project sources. /// ///
/// @@ -19975,12 +21307,15 @@ pub struct WorkspacesReadCheckpointRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct WorkspacesReadCheckpointResult { - /// Checkpoint content as a UTF-8 string, or null when the checkpoint or workspace is missing - pub content: Option, +pub struct SkillsDiscoverResult { + /// 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. + #[serde(skip_serializing_if = "Option::is_none")] + pub errors: Option>, + /// All discovered skills across all sources + pub skills: Vec, } -/// Relative path of the workspace file to read. +/// Canonical locations where skills can be created so the runtime will recognize them. /// ///
/// @@ -19990,12 +21325,12 @@ pub struct WorkspacesReadCheckpointResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct WorkspacesReadFileRequest { - /// Relative path within the workspace files directory - pub path: String, +pub struct SkillsGetDiscoveryPathsResult { + /// Canonical skill create/discovery directories, in priority order + pub paths: Vec, } -/// Contents of the requested workspace file as a UTF-8 string. +/// Agents discovered across user, project, plugin, and remote sources. /// ///
/// @@ -20005,12 +21340,12 @@ pub struct WorkspacesReadFileRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct WorkspacesReadFileResult { - /// File content as a UTF-8 string - pub content: String, +pub struct AgentsDiscoverResult { + /// All discovered agents across all sources + pub agents: Vec, } -/// Pasted content to save as a UTF-8 file in the session workspace. +/// Canonical locations where custom agents can be created so the runtime will recognize them. /// ///
/// @@ -20020,23 +21355,27 @@ pub struct WorkspacesReadFileResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct WorkspacesSaveLargePasteRequest { - /// Pasted content to save as a UTF-8 file - pub content: String, +pub struct AgentsGetDiscoveryPathsResult { + /// Canonical agent create/discovery directories, in priority order + pub paths: Vec, } +/// Instruction sources discovered across user, repository, and plugin sources. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct WorkspacesSaveLargePasteResultSaved { - /// Filename within the workspace files directory - pub filename: String, - /// Absolute filesystem path to the saved paste file - pub file_path: String, - /// Size of the saved file in bytes - pub size_bytes: i64, +pub struct InstructionsDiscoverResult { + /// All discovered instruction sources + pub sources: Vec, } -/// Descriptor for the saved paste file, or null when the workspace is unavailable. +/// Canonical files and directories where custom instructions can be created so the runtime will recognize them. /// ///
/// @@ -20046,12 +21385,12 @@ pub struct WorkspacesSaveLargePasteResultSaved { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct WorkspacesSaveLargePasteResult { - /// Saved-paste descriptor, or null when the workspace is unavailable (e.g. CCA runtime, non-infinite sessions, remote sessions) - pub saved: Option, +pub struct InstructionsGetDiscoveryPathsResult { + /// Canonical instruction create/discovery files and directories, in priority order + pub paths: Vec, } -/// Rollback point for local workspace summaries. +/// Slash commands available in the session, after applying any include/exclude filters. /// ///
/// @@ -20061,12 +21400,12 @@ pub struct WorkspacesSaveLargePasteResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct WorkspacesTruncateSummariesRequest { - /// Number of newest summaries to keep. - pub keep_count: i64, +pub struct CommandsListResult { + /// Commands available in this session + pub commands: Vec, } -/// Public-facing workspace metadata for this session, or null if the session has no associated workspace. Excludes runtime-internal fields (GitHub IDs, summary count, internal flags). +/// Result of opening a session. /// ///
/// @@ -20076,39 +21415,31 @@ pub struct WorkspacesTruncateSummariesRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct WorkspaceSummary { - /// Branch checked out at session start, if any +pub struct SessionsOpenResult { + /// Remote session metadata, present when status is `connected`. #[serde(skip_serializing_if = "Option::is_none")] - pub branch: Option, - /// ISO 8601 timestamp when the workspace was created - #[serde(rename = "created_at", skip_serializing_if = "Option::is_none")] - pub created_at: Option, - /// Current working directory at session start + pub metadata: Option, + /// Handoff progress steps, present when status is `handed_off`. #[serde(skip_serializing_if = "Option::is_none")] - pub cwd: Option, - /// Resolved git root for cwd, if any - #[serde(rename = "git_root", skip_serializing_if = "Option::is_none")] - pub git_root: Option, - /// Repository host type, if known - #[serde(rename = "host_type", skip_serializing_if = "Option::is_none")] - pub host_type: Option, - /// Workspace identifier (1:1 with sessionId) - pub id: String, - /// Display name for the session, if set + pub progress: Option>, + /// Remote session ID, present when status is `connected`. #[serde(skip_serializing_if = "Option::is_none")] - pub name: Option, - /// Repository identifier in 'owner/repo' or 'org/project/repo' format, if any + pub remote_session_id: Option, + /// In-process SessionClientApi handle for the opened session, returned to CLI callers as a transitional shortcut. Marked internal so the public SDK surface does not expose it; SDK consumers should construct per-session clients from `sessionId` instead. + #[doc(hidden)] #[serde(skip_serializing_if = "Option::is_none")] - pub repository: Option, - /// ISO 8601 timestamp when the workspace was last updated - #[serde(rename = "updated_at", skip_serializing_if = "Option::is_none")] - pub updated_at: Option, - /// Whether the display name was explicitly set by the user - #[serde(rename = "user_named", skip_serializing_if = "Option::is_none")] - pub user_named: Option, + pub(crate) session_api: Option, + /// Opened session ID. Omitted when status is `not_found`. + #[serde(skip_serializing_if = "Option::is_none")] + pub session_id: Option, + /// Startup prompts queued by user-level hook configs at session creation. Only populated when status is `created`; resumed sessions return an empty array. + #[serde(skip_serializing_if = "Option::is_none")] + pub startup_prompts: Option>, + /// Outcome of the open request. + pub status: SessionsOpenStatus, } -/// Workspace metadata fields to update. +/// Remote session connection result. /// ///
/// @@ -20118,16 +21449,14 @@ pub struct WorkspaceSummary { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct WorkspacesUpdateMetadataRequest { - /// Opaque workspace context supplied by the session host. - #[serde(skip_serializing_if = "Option::is_none")] - pub context: Option, - /// Optional workspace display name override. - #[serde(skip_serializing_if = "Option::is_none")] - pub name: Option, +pub struct SessionsConnectResult { + /// Metadata for a connected remote session. + pub metadata: ConnectedRemoteSessionMetadata, + /// SDK session ID for the connected remote session. + pub session_id: SessionId, } -/// Autopilot objective file content to persist. +/// Sessions matching the filter, ordered most-recently-modified first. /// ///
/// @@ -20137,12 +21466,12 @@ pub struct WorkspacesUpdateMetadataRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct WorkspacesWriteAutopilotObjectiveRequest { - /// Autopilot objective file content. - pub content: String, +pub struct SessionsListResult { + /// Sessions ordered most-recently-modified first. Discriminated by `isRemote`. + pub sessions: Vec, } -/// Result of writing the autopilot objective file. +/// ID of the local session bound to the given GitHub task, or omitted when none. /// ///
/// @@ -20152,12 +21481,13 @@ pub struct WorkspacesWriteAutopilotObjectiveRequest { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct WorkspacesWriteAutopilotObjectiveResult { - /// Filesystem operation performed. - pub operation: String, +pub struct SessionsFindByTaskIdResult { + /// Omitted when no local session is bound to that GitHub task + #[serde(skip_serializing_if = "Option::is_none")] + pub session_id: Option, } -/// List of Copilot models available to the resolved user, including capabilities and billing metadata. +/// Map of sessionId -> on-disk size in bytes for each session's workspace directory. /// ///
/// @@ -20167,12 +21497,12 @@ pub struct WorkspacesWriteAutopilotObjectiveResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ModelsListResult { - /// List of available models with full metadata - pub models: Vec, +pub struct SessionsGetSizesResult { + /// Map of sessionId -> on-disk size in bytes for the session's workspace directory + pub sizes: HashMap, } -/// The running runtime's complete catalog of well-known built-in model IDs, including supported models and additional IDs with built-in metadata. +/// Map of sessionId -> bytes freed by removing the session's workspace directory. /// ///
/// @@ -20182,12 +21512,50 @@ pub struct ModelsListResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ModelsGetBuiltInCatalogResult { - /// Built-in model entries. - pub models: Vec, +pub struct SessionsBulkDeleteResult { + /// 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). + pub freed_bytes: HashMap, +} + +/// Outcome of the prune operation: deleted IDs, dry-run candidates, skipped IDs, total bytes freed, and the dry-run flag. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionsPruneOldResult { + /// Session IDs that would be deleted in dry-run mode (always empty otherwise) + pub candidates: Vec, + /// Session IDs that were deleted (always empty in dry-run mode) + pub deleted: Vec, + /// True when no deletions were actually performed + pub dry_run: bool, + /// Total bytes freed (actual when not dry-run, projected when dry-run) + pub freed_bytes: i64, + /// Session IDs that were skipped (e.g., named sessions) + pub skipped: Vec, +} + +/// The enriched metadata records, with summary and context fields backfilled where available. Sessions confirmed empty and unnamed are omitted. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionsEnrichMetadataResult { + /// Enriched records, with summary and context backfilled. Sessions confirmed empty and unnamed may be omitted. + pub sessions: Vec, } -/// Built-in tools available for the requested model, with their parameters and instructions. +/// Queued repo-level startup prompts and the total hook command count after loading. /// ///
/// @@ -20197,12 +21565,14 @@ pub struct ModelsGetBuiltInCatalogResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ToolsListResult { - /// List of available built-in tools with metadata - pub tools: Vec, +pub struct SessionsLoadDeferredRepoHooksResult { + /// 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. + pub hook_count: i64, + /// Repo-level startup prompts queued from repo hook configs. Empty on resume, when no repo configs were pending, or when disableAllHooks is set. + pub startup_prompts: Vec, } -/// User-configured MCP servers, keyed by server name. +/// Wrapper for the singleton's current status. /// ///
/// @@ -20212,12 +21582,12 @@ pub struct ToolsListResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct McpConfigListResult { - /// All MCP servers from user config, keyed by name - pub servers: HashMap, +pub struct SessionsStartRemoteControlResult { + /// State of the runtime-managed remote-control singleton. + pub status: serde_json::Value, } -/// Extensions discovered from persisted Copilot home state and their effective loading mode. Launch-scoped additional plugins are not included. +/// Outcome of a transferRemoteControl call. /// ///
/// @@ -20227,14 +21597,14 @@ pub struct McpConfigListResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ExtensionsDiscoverResult { - /// Discovered user and enabled installed-plugin extensions from persisted Copilot home state - pub extensions: Vec, - /// Effective extension loading mode. Defaults to load_and_augment when unset. - pub mode: DiscoveredExtensionMode, +pub struct SessionsTransferRemoteControlResult { + /// State of the runtime-managed remote-control singleton. + pub status: serde_json::Value, + /// Whether the rebinding actually happened. + pub transferred: bool, } -/// Plugins installed in user/global state. +/// Wrapper for the singleton's current status. /// ///
/// @@ -20244,12 +21614,12 @@ pub struct ExtensionsDiscoverResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PluginsListResult { - /// Installed plugins - pub plugins: Vec, +pub struct SessionsSetRemoteControlSteeringResult { + /// State of the runtime-managed remote-control singleton. + pub status: serde_json::Value, } -/// Result of installing a plugin. +/// Outcome of a stopRemoteControl call. /// ///
/// @@ -20259,20 +21629,14 @@ pub struct PluginsListResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PluginsInstallResult { - /// Set when the install path is deprecated (e.g. direct repo / URL / local installs). Callers should surface this to end users. - #[serde(skip_serializing_if = "Option::is_none")] - pub deprecation_warning: Option, - /// The newly installed plugin's metadata - pub plugin: InstalledPluginInfo, - /// Optional post-install message provided by the plugin (e.g. setup instructions) - #[serde(skip_serializing_if = "Option::is_none")] - pub post_install_message: Option, - /// Number of skills discovered and installed from the plugin - pub skills_installed: i64, +pub struct SessionsStopRemoteControlResult { + /// State of the runtime-managed remote-control singleton. + pub status: serde_json::Value, + /// Whether the singleton was actually torn down by this call. + pub stopped: bool, } -/// Result of updating a single plugin. +/// Wrapper for the singleton's current status. /// ///
/// @@ -20282,18 +21646,12 @@ pub struct PluginsInstallResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PluginsUpdateResult { - /// Version after the update, when reported by the plugin manifest - #[serde(skip_serializing_if = "Option::is_none")] - pub new_version: Option, - /// Version that was previously installed, when available - #[serde(skip_serializing_if = "Option::is_none")] - pub previous_version: Option, - /// Number of skills discovered and installed after the update - pub skills_installed: i64, +pub struct SessionsGetRemoteControlStatusResult { + /// State of the runtime-managed remote-control singleton. + pub status: serde_json::Value, } -/// Result of updating all installed plugins. +/// Handle for releasing the extension tool registration. /// ///
/// @@ -20303,12 +21661,13 @@ pub struct PluginsUpdateResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PluginsUpdateAllResult { - /// Per-plugin update results in deterministic order. - pub results: Vec, +pub(crate) struct SessionsRegisterExtensionToolsOnSessionResult { + /// In-process unsubscribe function (CLI-only optimization). Marked internal: replaced by an explicit `extensions.unregister` RPC in the SDK migration. + #[doc(hidden)] + pub(crate) unsubscribe: serde_json::Value, } -/// All registered marketplaces, including built-in defaults. +/// Identifies the target session. /// ///
/// @@ -20318,12 +21677,12 @@ pub struct PluginsUpdateAllResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PluginsMarketplacesListResult { - /// Registered marketplaces - pub marketplaces: Vec, +pub struct SessionSuspendParams { + /// Target session identifier + pub session_id: SessionId, } -/// Result of registering a new marketplace. +/// Result of sending a user message /// ///
/// @@ -20333,12 +21692,12 @@ pub struct PluginsMarketplacesListResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PluginsMarketplacesAddResult { - /// Final name of the marketplace as resolved from its manifest - pub name: String, +pub struct SessionSendResult { + /// Unique identifier assigned to the message + pub message_id: String, } -/// Outcome of the remove attempt, including dependent-plugin info when applicable. +/// Result of sending zero or more user messages /// ///
/// @@ -20348,15 +21707,12 @@ pub struct PluginsMarketplacesAddResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PluginsMarketplacesRemoveResult { - /// Names of installed plugins that prevented removal. Populated only when `removed=false`. - #[serde(skip_serializing_if = "Option::is_none")] - pub dependent_plugins: Option>, - /// True when the marketplace was actually removed. False when removal was skipped because the marketplace has dependent plugins and `force` was not set. - pub removed: bool, +pub struct SessionSendMessagesResult { + /// Unique identifiers assigned to the messages, one per provided message in order. Empty when no messages were provided. + pub message_ids: Vec, } -/// Plugins advertised by the marketplace. +/// Result of aborting the current turn /// ///
/// @@ -20366,12 +21722,15 @@ pub struct PluginsMarketplacesRemoveResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PluginsMarketplacesBrowseResult { - /// Plugins advertised by the marketplace - pub plugins: Vec, +pub struct SessionAbortResult { + /// Error message if the abort failed + #[serde(skip_serializing_if = "Option::is_none")] + pub error: Option, + /// Whether the abort completed successfully + pub success: bool, } -/// Result of refreshing one or more marketplace catalogs. +/// Result of interrupting the main agent turn. /// ///
/// @@ -20381,12 +21740,12 @@ pub struct PluginsMarketplacesBrowseResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PluginsMarketplacesRefreshResult { - /// Per-marketplace refresh results in deterministic order. - pub results: Vec, +pub struct SessionInterruptMainTurnResult { + /// Whether an in-flight main agent turn was interrupted. False when the main loop was not processing. + pub interrupted: bool, } -/// Skills discovered across global and project sources. +/// Identifies the target session. /// ///
/// @@ -20396,15 +21755,12 @@ pub struct PluginsMarketplacesRefreshResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SkillsDiscoverResult { - /// 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. - #[serde(skip_serializing_if = "Option::is_none")] - pub errors: Option>, - /// All discovered skills across all sources - pub skills: Vec, +pub struct SessionCancelAllBackgroundAgentsParams { + /// Target session identifier + pub session_id: SessionId, } -/// Canonical locations where skills can be created so the runtime will recognize them. +/// Identifies the target session. /// ///
/// @@ -20414,12 +21770,12 @@ pub struct SkillsDiscoverResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SkillsGetDiscoveryPathsResult { - /// Canonical skill create/discovery directories, in priority order - pub paths: Vec, +pub struct SessionGitHubAuthGetStatusParams { + /// Target session identifier + pub session_id: SessionId, } -/// Agents discovered across user, project, plugin, and remote sources. +/// Authentication status and account metadata for the session. /// ///
/// @@ -20429,12 +21785,27 @@ pub struct SkillsGetDiscoveryPathsResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct AgentsDiscoverResult { - /// All discovered agents across all sources - pub agents: Vec, +pub struct SessionGitHubAuthGetStatusResult { + /// Authentication type + #[serde(skip_serializing_if = "Option::is_none")] + pub auth_type: Option, + /// Copilot plan tier (e.g., individual_pro, business) + #[serde(skip_serializing_if = "Option::is_none")] + pub copilot_plan: Option, + /// Authentication host URL + #[serde(skip_serializing_if = "Option::is_none")] + pub host: Option, + /// Whether the session has resolved authentication + pub is_authenticated: bool, + /// Authenticated login/username, if available + #[serde(skip_serializing_if = "Option::is_none")] + pub login: Option, + /// Human-readable authentication status description + #[serde(skip_serializing_if = "Option::is_none")] + pub status_message: Option, } -/// Canonical locations where custom agents can be created so the runtime will recognize them. +/// Indicates whether the credential update succeeded. /// ///
/// @@ -20444,12 +21815,15 @@ pub struct AgentsDiscoverResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct AgentsGetDiscoveryPathsResult { - /// Canonical agent create/discovery directories, in priority order - pub paths: Vec, +pub struct SessionGitHubAuthSetCredentialsResult { + /// 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). + #[serde(skip_serializing_if = "Option::is_none")] + pub copilot_user_resolved: Option, + /// Whether the operation succeeded + pub success: bool, } -/// Instruction sources discovered across user, repository, and plugin sources. +/// Identifies the target session. /// ///
/// @@ -20459,12 +21833,12 @@ pub struct AgentsGetDiscoveryPathsResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct InstructionsDiscoverResult { - /// All discovered instruction sources - pub sources: Vec, +pub struct SessionGitHubAuthGetCurrentAuthInfoParams { + /// Target session identifier + pub session_id: SessionId, } -/// Canonical files and directories where custom instructions can be created so the runtime will recognize them. +/// Identifies the target session. /// ///
/// @@ -20474,12 +21848,12 @@ pub struct InstructionsDiscoverResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct InstructionsGetDiscoveryPathsResult { - /// Canonical instruction create/discovery files and directories, in priority order - pub paths: Vec, +pub struct SessionGitHubAuthGetAllAuthAvailableParams { + /// Target session identifier + pub session_id: SessionId, } -/// Slash commands available in the session, after applying any include/exclude filters. +/// Identifies the target session. /// ///
/// @@ -20489,12 +21863,12 @@ pub struct InstructionsGetDiscoveryPathsResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct CommandsListResult { - /// Commands available in this session - pub commands: Vec, +pub struct SessionGitHubAuthRefreshCopilotUserParams { + /// Target session identifier + pub session_id: SessionId, } -/// Result of opening a session. +/// Identifies the target session. /// ///
/// @@ -20504,31 +21878,12 @@ pub struct CommandsListResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionsOpenResult { - /// Remote session metadata, present when status is `connected`. - #[serde(skip_serializing_if = "Option::is_none")] - pub metadata: Option, - /// Handoff progress steps, present when status is `handed_off`. - #[serde(skip_serializing_if = "Option::is_none")] - pub progress: Option>, - /// Remote session ID, present when status is `connected`. - #[serde(skip_serializing_if = "Option::is_none")] - pub remote_session_id: Option, - /// In-process SessionClientApi handle for the opened session, returned to CLI callers as a transitional shortcut. Marked internal so the public SDK surface does not expose it; SDK consumers should construct per-session clients from `sessionId` instead. - #[doc(hidden)] - #[serde(skip_serializing_if = "Option::is_none")] - pub(crate) session_api: Option, - /// Opened session ID. Omitted when status is `not_found`. - #[serde(skip_serializing_if = "Option::is_none")] - pub session_id: Option, - /// Startup prompts queued by user-level hook configs at session creation. Only populated when status is `created`; resumed sessions return an empty array. - #[serde(skip_serializing_if = "Option::is_none")] - pub startup_prompts: Option>, - /// Outcome of the open request. - pub status: SessionsOpenStatus, +pub struct SessionGitHubAuthLogoutParams { + /// Target session identifier + pub session_id: SessionId, } -/// Remote session connection result. +/// Identifies the target session. /// ///
/// @@ -20538,14 +21893,12 @@ pub struct SessionsOpenResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionsConnectResult { - /// Metadata for a connected remote session. - pub metadata: ConnectedRemoteSessionMetadata, - /// SDK session ID for the connected remote session. +pub struct SessionGitHubAuthLastAuthErrorsParams { + /// Target session identifier pub session_id: SessionId, } -/// Sessions matching the filter, ordered most-recently-modified first. +/// Result of collecting a redacted debug bundle. /// ///
/// @@ -20555,12 +21908,19 @@ pub struct SessionsConnectResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionsListResult { - /// Sessions ordered most-recently-modified first. Discriminated by `isRemote`. - pub sessions: Vec, +pub struct SessionDebugCollectLogsResult { + /// Files included in the redacted bundle. + pub entries: Vec, + /// Destination kind that was written. + pub kind: DebugCollectLogsResultKind, + /// 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. + pub path: String, + /// Optional files or directories that could not be included. + #[serde(skip_serializing_if = "Option::is_none")] + pub skipped_entries: Option>, } -/// ID of the local session bound to the given GitHub task, or omitted when none. +/// Identifies the target session. /// ///
/// @@ -20570,13 +21930,12 @@ pub struct SessionsListResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionsFindByTaskIdResult { - /// Omitted when no local session is bound to that GitHub task - #[serde(skip_serializing_if = "Option::is_none")] - pub session_id: Option, +pub struct SessionCanvasListParams { + /// Target session identifier + pub session_id: SessionId, } -/// Map of sessionId -> on-disk size in bytes for each session's workspace directory. +/// Declared canvases available in this session. /// ///
/// @@ -20586,12 +21945,12 @@ pub struct SessionsFindByTaskIdResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionsGetSizesResult { - /// Map of sessionId -> on-disk size in bytes for the session's workspace directory - pub sizes: HashMap, +pub struct SessionCanvasListResult { + /// Declared canvases available in this session + pub canvases: Vec, } -/// Map of sessionId -> bytes freed by removing the session's workspace directory. +/// Identifies the target session. /// ///
/// @@ -20601,12 +21960,12 @@ pub struct SessionsGetSizesResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionsBulkDeleteResult { - /// 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). - pub freed_bytes: HashMap, +pub struct SessionCanvasListOpenParams { + /// Target session identifier + pub session_id: SessionId, } -/// Outcome of the prune operation: deleted IDs, dry-run candidates, skipped IDs, total bytes freed, and the dry-run flag. +/// Live open-canvas snapshot. /// ///
/// @@ -20616,20 +21975,12 @@ pub struct SessionsBulkDeleteResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionsPruneOldResult { - /// Session IDs that would be deleted in dry-run mode (always empty otherwise) - pub candidates: Vec, - /// Session IDs that were deleted (always empty in dry-run mode) - pub deleted: Vec, - /// True when no deletions were actually performed - pub dry_run: bool, - /// Total bytes freed (actual when not dry-run, projected when dry-run) - pub freed_bytes: i64, - /// Session IDs that were skipped (e.g., named sessions) - pub skipped: Vec, +pub struct SessionCanvasListOpenResult { + /// Currently open canvas instances + pub open_canvases: Vec, } -/// The enriched metadata records, with summary and context fields backfilled where available. Sessions confirmed empty and unnamed are omitted. +/// Open canvas instance snapshot. /// ///
/// @@ -20639,12 +21990,34 @@ pub struct SessionsPruneOldResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionsEnrichMetadataResult { - /// Enriched records, with summary and context backfilled. Sessions confirmed empty and unnamed may be omitted. - pub sessions: Vec, +pub struct SessionCanvasOpenResult { + /// Provider-local canvas identifier + pub canvas_id: String, + /// Owning provider identifier + pub extension_id: String, + /// Owning extension display name, when available + #[serde(skip_serializing_if = "Option::is_none")] + pub extension_name: Option, + /// Host-local PNG path for the canvas icon, when supplied + #[serde(skip_serializing_if = "Option::is_none")] + pub icon: Option, + /// Input supplied when the instance was opened + #[serde(skip_serializing_if = "Option::is_none")] + pub input: Option, + /// Stable caller-supplied canvas instance identifier + pub instance_id: String, + /// Provider-supplied status text + #[serde(skip_serializing_if = "Option::is_none")] + pub status: Option, + /// Rendered title + #[serde(skip_serializing_if = "Option::is_none")] + pub title: Option, + /// URL for web-rendered canvases + #[serde(skip_serializing_if = "Option::is_none")] + pub url: Option, } -/// Queued repo-level startup prompts and the total hook command count after loading. +/// Canvas action invocation result. /// ///
/// @@ -20654,14 +22027,13 @@ pub struct SessionsEnrichMetadataResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionsLoadDeferredRepoHooksResult { - /// 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. - pub hook_count: i64, - /// Repo-level startup prompts queued from repo hook configs. Empty on resume, when no repo configs were pending, or when disableAllHooks is set. - pub startup_prompts: Vec, +pub struct SessionCanvasActionInvokeResult { + /// Provider-supplied action result + #[serde(skip_serializing_if = "Option::is_none")] + pub result: Option, } -/// Wrapper for the singleton's current status. +/// Complete current or terminal factory run envelope. /// ///
/// @@ -20671,12 +22043,29 @@ pub struct SessionsLoadDeferredRepoHooksResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionsStartRemoteControlResult { - /// State of the runtime-managed remote-control singleton. - pub status: serde_json::Value, +pub struct SessionFactoryRunResult { + /// Error message for an errored run. + #[serde(skip_serializing_if = "Option::is_none")] + pub error: Option, + /// Machine-readable failure details for an errored run. + #[serde(skip_serializing_if = "Option::is_none")] + pub failure: Option, + /// Reason for a halted or cancelled run. + #[serde(skip_serializing_if = "Option::is_none")] + pub reason: Option, + /// Completed factory result. + #[serde(skip_serializing_if = "Option::is_none")] + pub result: Option, + /// Factory run identifier. + pub run_id: String, + /// Partial journal and progress snapshot for a halted, cancelled, or errored run. + #[serde(skip_serializing_if = "Option::is_none")] + pub snapshot: Option, + /// Current or terminal factory run status. + pub status: FactoryRunStatus, } -/// Outcome of a transferRemoteControl call. +/// Resolved persisted factory identity and resumed run envelope. /// ///
/// @@ -20686,14 +22075,14 @@ pub struct SessionsStartRemoteControlResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionsTransferRemoteControlResult { - /// State of the runtime-managed remote-control singleton. - pub status: serde_json::Value, - /// Whether the rebinding actually happened. - pub transferred: bool, +pub struct SessionFactoryResumeResult { + /// Persisted factory name resolved for the resumed run. + pub factory_name: String, + /// Terminal resumed run envelope. + pub run: FactoryRunResult, } -/// Wrapper for the singleton's current status. +/// Complete current or terminal factory run envelope. /// ///
/// @@ -20703,12 +22092,29 @@ pub struct SessionsTransferRemoteControlResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionsSetRemoteControlSteeringResult { - /// State of the runtime-managed remote-control singleton. - pub status: serde_json::Value, +pub struct SessionFactoryGetRunResult { + /// Error message for an errored run. + #[serde(skip_serializing_if = "Option::is_none")] + pub error: Option, + /// Machine-readable failure details for an errored run. + #[serde(skip_serializing_if = "Option::is_none")] + pub failure: Option, + /// Reason for a halted or cancelled run. + #[serde(skip_serializing_if = "Option::is_none")] + pub reason: Option, + /// Completed factory result. + #[serde(skip_serializing_if = "Option::is_none")] + pub result: Option, + /// Factory run identifier. + pub run_id: String, + /// Partial journal and progress snapshot for a halted, cancelled, or errored run. + #[serde(skip_serializing_if = "Option::is_none")] + pub snapshot: Option, + /// Current or terminal factory run status. + pub status: FactoryRunStatus, } -/// Outcome of a stopRemoteControl call. +/// A page of factory runs in durable creation order. /// ///
/// @@ -20718,14 +22124,24 @@ pub struct SessionsSetRemoteControlSteeringResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionsStopRemoteControlResult { - /// State of the runtime-managed remote-control singleton. - pub status: serde_json::Value, - /// Whether the singleton was actually torn down by this call. - pub stopped: bool, +pub struct SessionFactoryListRunsResult { + /// Whether terminal runs newer than this page exist. + #[serde(skip_serializing_if = "Option::is_none")] + pub has_more_newer: Option, + /// Newest terminal-run cursor in this page, or null when the terminal window is empty. + #[serde(skip_serializing_if = "Option::is_none")] + pub newest_seq: Option, + /// Oldest terminal-run cursor in this page, or null when the terminal window is empty. + #[serde(skip_serializing_if = "Option::is_none")] + pub oldest_seq: Option, + /// Number of terminal runs older than this page. + #[serde(skip_serializing_if = "Option::is_none")] + pub omitted_older: Option, + /// Factory run summaries in durable creation order. + pub runs: Vec, } -/// Wrapper for the singleton's current status. +/// Full factory run observability detail. /// ///
/// @@ -20735,12 +22151,54 @@ pub struct SessionsStopRemoteControlResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionsGetRemoteControlStatusResult { - /// State of the runtime-managed remote-control singleton. - pub status: serde_json::Value, +pub struct SessionFactoryGetRunDetailResult { + /// Epoch milliseconds when the current active segment started, or null while inactive. + pub active_segment_started_at: Option, + /// Durable identities and live statuses for direct factory agents. + pub agents: Vec, + /// Approved effective resource ceilings, or null until approved. + pub approved: Option, + /// Epoch milliseconds when the run completed, or null while nonterminal. + pub completed_at: Option, + /// Durable resource consumption. + pub consumed: FactoryRunConsumed, + /// Epoch milliseconds when the run was created. + pub created_at: i64, + /// Current phase identity, or null before any phase is entered. + pub current_phase: Option, + /// Resource ceilings declared by the factory. + pub declared_limits: FactoryDeclaredLimits, + /// Number of phases declared by the factory. + pub declared_phase_count: i64, + /// Human-readable factory description. + pub description: String, + /// Registered factory name. + pub factory_name: String, + /// Number of direct factory agents currently live. + pub live_agent_count: i64, + /// Epoch milliseconds when this live-overlay snapshot was observed. + pub observed_at: i64, + /// Lifecycle and timing observations for each factory phase. + pub phases: Vec, + /// Bidirectional page of durable factory progress. + pub progress: FactoryProgressPage, + /// Monotonic durable run revision. + pub revision: i64, + /// Factory run identifier. + pub run_id: String, + /// Epoch milliseconds when execution first started, or null before start. + pub started_at: Option, + /// Current factory run status. + pub status: FactoryRunStatus, + /// Terminal run outcome, or null while nonterminal. + pub terminal: Option, + /// Total direct factory agents spawned across all attempts. + pub total_spawned_agent_count: i64, + /// Epoch milliseconds when the durable run was last updated. + pub updated_at: i64, } -/// Handle for releasing the extension tool registration. +/// A bidirectional page of factory progress. /// ///
/// @@ -20750,13 +22208,22 @@ pub struct SessionsGetRemoteControlStatusResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub(crate) struct SessionsRegisterExtensionToolsOnSessionResult { - /// In-process unsubscribe function (CLI-only optimization). Marked internal: replaced by an explicit `extensions.unregister` RPC in the SDK migration. - #[doc(hidden)] - pub(crate) unsubscribe: serde_json::Value, +pub struct SessionFactoryGetRunProgressResult { + /// Whether progress records newer than this page exist. + pub has_more_newer: bool, + /// Whether progress records older than this page exist. + pub has_more_older: bool, + /// Newest sequence number in this page, or null when empty. + pub newest_seq: Option, + /// Oldest sequence number in this page, or null when empty. + pub oldest_seq: Option, + /// Progress records in sequence order. + pub records: Vec, + /// Run revision reflected by this page. + pub revision: i64, } -/// Identifies the target session. +/// Complete current or terminal factory run envelope. /// ///
/// @@ -20766,12 +22233,29 @@ pub(crate) struct SessionsRegisterExtensionToolsOnSessionResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionSuspendParams { - /// Target session identifier - pub session_id: SessionId, +pub struct SessionFactoryCancelResult { + /// Error message for an errored run. + #[serde(skip_serializing_if = "Option::is_none")] + pub error: Option, + /// Machine-readable failure details for an errored run. + #[serde(skip_serializing_if = "Option::is_none")] + pub failure: Option, + /// Reason for a halted or cancelled run. + #[serde(skip_serializing_if = "Option::is_none")] + pub reason: Option, + /// Completed factory result. + #[serde(skip_serializing_if = "Option::is_none")] + pub result: Option, + /// Factory run identifier. + pub run_id: String, + /// Partial journal and progress snapshot for a halted, cancelled, or errored run. + #[serde(skip_serializing_if = "Option::is_none")] + pub snapshot: Option, + /// Current or terminal factory run status. + pub status: FactoryRunStatus, } -/// Result of sending a user message +/// Acknowledgement that a factory request was accepted. /// ///
/// @@ -20781,12 +22265,9 @@ pub struct SessionSuspendParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionSendResult { - /// Unique identifier assigned to the message - pub message_id: String, -} +pub struct SessionFactoryLogResult {} -/// Result of sending zero or more user messages +/// Result of one factory-scoped subagent call. /// ///
/// @@ -20796,12 +22277,13 @@ pub struct SessionSendResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionSendMessagesResult { - /// Unique identifiers assigned to the messages, one per provided message in order. Empty when no messages were provided. - pub message_ids: Vec, +pub struct SessionFactoryAgentResult { + /// Agent result, omitted when the agent produced no result. + #[serde(skip_serializing_if = "Option::is_none")] + pub result: Option, } -/// Result of aborting the current turn +/// Result of reading a factory journal entry. /// ///
/// @@ -20811,15 +22293,15 @@ pub struct SessionSendMessagesResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionAbortResult { - /// Error message if the abort failed +pub struct SessionFactoryJournalGetResult { + /// Whether the journal contained the requested key. + pub hit: bool, + /// Cached JSON result. The hit field distinguishes a cached JSON null from a miss. #[serde(skip_serializing_if = "Option::is_none")] - pub error: Option, - /// Whether the abort completed successfully - pub success: bool, + pub result_json: Option, } -/// Result of interrupting the main agent turn. +/// Acknowledgement that a factory request was accepted. /// ///
/// @@ -20829,10 +22311,7 @@ pub struct SessionAbortResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionInterruptMainTurnResult { - /// Whether an in-flight main agent turn was interrupted. False when the main loop was not processing. - pub interrupted: bool, -} +pub struct SessionFactoryJournalPutResult {} /// Identifies the target session. /// @@ -20844,12 +22323,12 @@ pub struct SessionInterruptMainTurnResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionCancelAllBackgroundAgentsParams { +pub struct SessionModelGetCurrentParams { /// Target session identifier pub session_id: SessionId, } -/// Identifies the target session. +/// The currently selected model, reasoning effort, and context tier for the session. The context tier reflects `Session.getContextTier()`, restored from the session journal on resume. /// ///
/// @@ -20859,12 +22338,19 @@ pub struct SessionCancelAllBackgroundAgentsParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionGitHubAuthGetStatusParams { - /// Target session identifier - pub session_id: SessionId, +pub struct SessionModelGetCurrentResult { + /// Context tier for models that support multiple context-window sizes. + #[serde(skip_serializing_if = "Option::is_none")] + pub context_tier: Option, + /// Currently active model identifier + #[serde(skip_serializing_if = "Option::is_none")] + pub model_id: Option, + /// 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. + #[serde(skip_serializing_if = "Option::is_none")] + pub reasoning_effort: Option, } -/// Authentication status and account metadata for the session. +/// The model identifier active on the session after the switch. /// ///
/// @@ -20874,27 +22360,34 @@ pub struct SessionGitHubAuthGetStatusParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionGitHubAuthGetStatusResult { - /// Authentication type +pub struct SessionModelSwitchToResult { + /// Compaction confirmation projection when status is confirmation_required #[serde(skip_serializing_if = "Option::is_none")] - pub auth_type: Option, - /// Copilot plan tier (e.g., individual_pro, business) + pub confirmation: Option, + /// 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. #[serde(skip_serializing_if = "Option::is_none")] - pub copilot_plan: Option, - /// Authentication host URL + pub deferred: Option, + /// Deprecation warnings associated with the selected model or options. #[serde(skip_serializing_if = "Option::is_none")] - pub host: Option, - /// Whether the session has resolved authentication - pub is_authenticated: bool, - /// Authenticated login/username, if available + pub deprecation_warnings: Option>, + /// User-facing outcome message for the model switch. #[serde(skip_serializing_if = "Option::is_none")] - pub login: Option, - /// Human-readable authentication status description + pub message: Option, + /// Currently active model identifier after the switch #[serde(skip_serializing_if = "Option::is_none")] - pub status_message: Option, + pub model_id: Option, + /// Persistence failure encountered after applying the model switch. + #[serde(skip_serializing_if = "Option::is_none")] + pub persistence_error: Option, + /// Lifecycle result for the requested switch + #[serde(skip_serializing_if = "Option::is_none")] + pub status: Option, + /// User-facing warning produced while applying the model switch. + #[serde(skip_serializing_if = "Option::is_none")] + pub warning: Option, } -/// Indicates whether the credential update succeeded. +/// The model identifier active on the session after the switch. /// ///
/// @@ -20904,15 +22397,34 @@ pub struct SessionGitHubAuthGetStatusResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionGitHubAuthSetCredentialsResult { - /// 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). +pub struct SessionModelApplyStartupOverlayResult { + /// Compaction confirmation projection when status is confirmation_required #[serde(skip_serializing_if = "Option::is_none")] - pub copilot_user_resolved: Option, - /// Whether the operation succeeded - pub success: bool, + pub confirmation: Option, + /// 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. + #[serde(skip_serializing_if = "Option::is_none")] + pub deferred: Option, + /// Deprecation warnings associated with the selected model or options. + #[serde(skip_serializing_if = "Option::is_none")] + pub deprecation_warnings: Option>, + /// User-facing outcome message for the model switch. + #[serde(skip_serializing_if = "Option::is_none")] + pub message: Option, + /// Currently active model identifier after the switch + #[serde(skip_serializing_if = "Option::is_none")] + pub model_id: Option, + /// Persistence failure encountered after applying the model switch. + #[serde(skip_serializing_if = "Option::is_none")] + pub persistence_error: Option, + /// Lifecycle result for the requested switch + #[serde(skip_serializing_if = "Option::is_none")] + pub status: Option, + /// User-facing warning produced while applying the model switch. + #[serde(skip_serializing_if = "Option::is_none")] + pub warning: Option, } -/// Identifies the target session. +/// 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. /// ///
/// @@ -20922,12 +22434,12 @@ pub struct SessionGitHubAuthSetCredentialsResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionGitHubAuthGetCurrentAuthInfoParams { - /// Target session identifier - pub session_id: SessionId, +pub struct SessionModelSetReasoningEffortResult { + /// Reasoning effort level recorded on the session after the update + pub reasoning_effort: String, } -/// Identifies the target session. +/// The list of models available to this session. /// ///
/// @@ -20937,9 +22449,15 @@ pub struct SessionGitHubAuthGetCurrentAuthInfoParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionGitHubAuthGetAllAuthAvailableParams { - /// Target session identifier - pub session_id: SessionId, +pub struct SessionModelListResult { + /// 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`). + pub list: Vec, + /// 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. + #[serde(skip_serializing_if = "Option::is_none")] + pub model_price_categories: Option>, + /// Per-quota snapshots returned alongside the model list, keyed by quota type. + #[serde(skip_serializing_if = "Option::is_none")] + pub quota_snapshots: Option>, } /// Identifies the target session. @@ -20952,12 +22470,12 @@ pub struct SessionGitHubAuthGetAllAuthAvailableParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionGitHubAuthRefreshCopilotUserParams { +pub struct SessionModeGetParams { /// Target session identifier pub session_id: SessionId, } -/// Identifies the target session. +/// Outcome of a session mode change, including any model switch it triggered and follow-up the host must perform. /// ///
/// @@ -20967,9 +22485,29 @@ pub struct SessionGitHubAuthRefreshCopilotUserParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionGitHubAuthLogoutParams { - /// Target session identifier - pub session_id: SessionId, +pub struct SessionModeSetResult { + /// Whether the host should arm an interactive continuation after the mode change. + #[serde(skip_serializing_if = "Option::is_none")] + pub arm_interactive_continuation: Option, + /// Compaction confirmation required before the mode change can complete. + #[serde(skip_serializing_if = "Option::is_none")] + pub confirmation: Option, + /// Whether the host must defer implementing the requested mode change. + #[serde(skip_serializing_if = "Option::is_none")] + pub defer_implementation: Option, + /// Deprecation warnings associated with the model selected by the mode change. + #[serde(skip_serializing_if = "Option::is_none")] + pub deprecation_warnings: Option>, + /// User-facing outcome message for the model switch triggered by the mode change. + #[serde(skip_serializing_if = "Option::is_none")] + pub message: Option, + /// Whether applying the mode changed the active model. + pub model_changed: bool, + /// Lifecycle status of the requested mode change. + pub status: String, + /// User-facing warning produced while applying the mode change. + #[serde(skip_serializing_if = "Option::is_none")] + pub warning: Option, } /// Identifies the target session. @@ -20982,12 +22520,12 @@ pub struct SessionGitHubAuthLogoutParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionGitHubAuthLastAuthErrorsParams { +pub struct SessionNameGetParams { /// Target session identifier pub session_id: SessionId, } -/// Result of collecting a redacted debug bundle. +/// The session's friendly name, or null when not yet set. /// ///
/// @@ -20997,19 +22535,12 @@ pub struct SessionGitHubAuthLastAuthErrorsParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionDebugCollectLogsResult { - /// Files included in the redacted bundle. - pub entries: Vec, - /// Destination kind that was written. - pub kind: DebugCollectLogsResultKind, - /// 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. - pub path: String, - /// Optional files or directories that could not be included. - #[serde(skip_serializing_if = "Option::is_none")] - pub skipped_entries: Option>, +pub struct SessionNameGetResult { + /// The session name (user-set or auto-generated), or null if not yet set + pub name: Option, } -/// Identifies the target session. +/// Indicates whether the auto-generated summary was applied as the session's name. /// ///
/// @@ -21019,12 +22550,12 @@ pub struct SessionDebugCollectLogsResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionCanvasListParams { - /// Target session identifier - pub session_id: SessionId, +pub struct SessionNameSetAutoResult { + /// 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. + pub applied: bool, } -/// Declared canvases available in this session. +/// Identifies the target session. /// ///
/// @@ -21034,12 +22565,12 @@ pub struct SessionCanvasListParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionCanvasListResult { - /// Declared canvases available in this session - pub canvases: Vec, +pub struct SessionPlanReadParams { + /// Target session identifier + pub session_id: SessionId, } -/// Identifies the target session. +/// Existence, contents, and resolved path of the session plan file. /// ///
/// @@ -21049,12 +22580,16 @@ pub struct SessionCanvasListResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionCanvasListOpenParams { - /// Target session identifier - pub session_id: SessionId, +pub struct SessionPlanReadResult { + /// The content of the plan file, or null if it does not exist + pub content: Option, + /// Whether the plan file exists in the workspace + pub exists: bool, + /// Absolute file path of the plan file, or null if workspace is not enabled + pub path: Option, } -/// Live open-canvas snapshot. +/// Identifies the target session. /// ///
/// @@ -21064,12 +22599,12 @@ pub struct SessionCanvasListOpenParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionCanvasListOpenResult { - /// Currently open canvas instances - pub open_canvases: Vec, +pub struct SessionPlanDeleteParams { + /// Target session identifier + pub session_id: SessionId, } -/// Open canvas instance snapshot. +/// Identifies the target session. /// ///
/// @@ -21077,36 +22612,14 @@ pub struct SessionCanvasListOpenResult { /// and may change or be removed in future SDK or CLI releases. /// ///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct SessionCanvasOpenResult { - /// Provider-local canvas identifier - pub canvas_id: String, - /// Owning provider identifier - pub extension_id: String, - /// Owning extension display name, when available - #[serde(skip_serializing_if = "Option::is_none")] - pub extension_name: Option, - /// Host-local PNG path for the canvas icon, when supplied - #[serde(skip_serializing_if = "Option::is_none")] - pub icon: Option, - /// Input supplied when the instance was opened - #[serde(skip_serializing_if = "Option::is_none")] - pub input: Option, - /// Stable caller-supplied canvas instance identifier - pub instance_id: String, - /// Provider-supplied status text - #[serde(skip_serializing_if = "Option::is_none")] - pub status: Option, - /// Rendered title - #[serde(skip_serializing_if = "Option::is_none")] - pub title: Option, - /// URL for web-rendered canvases - #[serde(skip_serializing_if = "Option::is_none")] - pub url: Option, +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionPlanReadSqlTodosParams { + /// Target session identifier + pub session_id: SessionId, } -/// Canvas action invocation result. +/// Todo rows read from the session SQL database. Empty when no session database is available. /// ///
/// @@ -21116,13 +22629,12 @@ pub struct SessionCanvasOpenResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionCanvasActionInvokeResult { - /// Provider-supplied action result - #[serde(skip_serializing_if = "Option::is_none")] - pub result: Option, +pub struct SessionPlanReadSqlTodosResult { + /// 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. + pub rows: Vec, } -/// Complete current or terminal factory run envelope. +/// Identifies the target session. /// ///
/// @@ -21132,29 +22644,12 @@ pub struct SessionCanvasActionInvokeResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionFactoryRunResult { - /// Error message for an errored run. - #[serde(skip_serializing_if = "Option::is_none")] - pub error: Option, - /// Machine-readable failure details for an errored run. - #[serde(skip_serializing_if = "Option::is_none")] - pub failure: Option, - /// Reason for a halted or cancelled run. - #[serde(skip_serializing_if = "Option::is_none")] - pub reason: Option, - /// Completed factory result. - #[serde(skip_serializing_if = "Option::is_none")] - pub result: Option, - /// Factory run identifier. - pub run_id: String, - /// Partial journal and progress snapshot for a halted, cancelled, or errored run. - #[serde(skip_serializing_if = "Option::is_none")] - pub snapshot: Option, - /// Current or terminal factory run status. - pub status: FactoryRunStatus, +pub struct SessionPlanReadSqlTodosWithDependenciesParams { + /// Target session identifier + pub session_id: SessionId, } -/// Resolved persisted factory identity and resumed run envelope. +/// Todo rows + dependency edges read from the session SQL database. /// ///
/// @@ -21164,14 +22659,14 @@ pub struct SessionFactoryRunResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionFactoryResumeResult { - /// Persisted factory name resolved for the resumed run. - pub factory_name: String, - /// Terminal resumed run envelope. - pub run: FactoryRunResult, +pub struct SessionPlanReadSqlTodosWithDependenciesResult { + /// 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. + pub dependencies: Vec, + /// 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. + pub rows: Vec, } -/// Complete current or terminal factory run envelope. +/// Identifies the target session. /// ///
/// @@ -21181,29 +22676,146 @@ pub struct SessionFactoryResumeResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionFactoryGetRunResult { - /// Error message for an errored run. +pub struct SessionWorkspacesGetWorkspaceParams { + /// Target session identifier + pub session_id: SessionId, +} + +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionWorkspacesGetWorkspaceResultWorkspace { + /// Current Git branch. #[serde(skip_serializing_if = "Option::is_none")] - pub error: Option, - /// Machine-readable failure details for an errored run. + pub branch: Option, + /// Whether the per-session Chronicle upgrade prompt was dismissed for the workspace. + #[serde( + rename = "chronicle_sync_dismissed", + skip_serializing_if = "Option::is_none" + )] + pub chronicle_sync_dismissed: Option, + /// Name of the client that created the workspace. + #[serde(rename = "client_name", skip_serializing_if = "Option::is_none")] + pub client_name: Option, + /// Timestamp when the workspace was created. + #[serde(rename = "created_at", skip_serializing_if = "Option::is_none")] + pub created_at: Option, + /// Current working directory associated with the workspace. #[serde(skip_serializing_if = "Option::is_none")] - pub failure: Option, - /// Reason for a halted or cancelled run. + pub cwd: Option, + /// Git repository root associated with the workspace. + #[serde(rename = "git_root", skip_serializing_if = "Option::is_none")] + pub git_root: Option, + /// Allowed values for the `WorkspacesWorkspaceDetailsHostType` enumeration. + #[serde(rename = "host_type", skip_serializing_if = "Option::is_none")] + pub host_type: Option, + /// Stable workspace identifier. + pub id: String, + /// Most recent Mission Control event identifier observed for the workspace. + #[serde(rename = "mc_last_event_id", skip_serializing_if = "Option::is_none")] + pub mc_last_event_id: Option, + /// Mission Control session identifier associated with the workspace. + #[serde(rename = "mc_session_id", skip_serializing_if = "Option::is_none")] + pub mc_session_id: Option, + /// Mission Control task identifier associated with the workspace. + #[serde(rename = "mc_task_id", skip_serializing_if = "Option::is_none")] + pub mc_task_id: Option, + /// Workspace display name. #[serde(skip_serializing_if = "Option::is_none")] - pub reason: Option, - /// Completed factory result. + pub name: Option, + /// Whether the workspace session can be steered remotely. + #[serde(rename = "remote_steerable", skip_serializing_if = "Option::is_none")] + pub remote_steerable: Option, + /// Repository identifier associated with the workspace. #[serde(skip_serializing_if = "Option::is_none")] - pub result: Option, - /// Factory run identifier. - pub run_id: String, - /// Partial journal and progress snapshot for a halted, cancelled, or errored run. + pub repository: Option, + /// Number of persisted summaries in the workspace. + #[serde(rename = "summary_count", skip_serializing_if = "Option::is_none")] + pub summary_count: Option, + /// Timestamp when the workspace was last updated. + #[serde(rename = "updated_at", skip_serializing_if = "Option::is_none")] + pub updated_at: Option, + /// Whether the workspace name was explicitly chosen by the user. + #[serde(rename = "user_named", skip_serializing_if = "Option::is_none")] + pub user_named: Option, +} + +/// Current workspace metadata for the session, including its absolute filesystem path when available. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionWorkspacesGetWorkspaceResult { + /// Absolute filesystem path to the workspace directory. Omitted when the session has no workspace (e.g. remote sessions). #[serde(skip_serializing_if = "Option::is_none")] - pub snapshot: Option, - /// Current or terminal factory run status. - pub status: FactoryRunStatus, + pub path: Option, + /// Current workspace metadata, or null if not available + pub workspace: Option, } -/// A page of factory runs in durable creation order. +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionWorkspacesUpdateMetadataResultWorkspace { + /// Current Git branch. + #[serde(skip_serializing_if = "Option::is_none")] + pub branch: Option, + /// Whether the per-session Chronicle upgrade prompt was dismissed for the workspace. + #[serde( + rename = "chronicle_sync_dismissed", + skip_serializing_if = "Option::is_none" + )] + pub chronicle_sync_dismissed: Option, + /// Name of the client that created the workspace. + #[serde(rename = "client_name", skip_serializing_if = "Option::is_none")] + pub client_name: Option, + /// Timestamp when the workspace was created. + #[serde(rename = "created_at", skip_serializing_if = "Option::is_none")] + pub created_at: Option, + /// Current working directory associated with the workspace. + #[serde(skip_serializing_if = "Option::is_none")] + pub cwd: Option, + /// Git repository root associated with the workspace. + #[serde(rename = "git_root", skip_serializing_if = "Option::is_none")] + pub git_root: Option, + /// Allowed values for the `WorkspacesWorkspaceDetailsHostType` enumeration. + #[serde(rename = "host_type", skip_serializing_if = "Option::is_none")] + pub host_type: Option, + /// Stable workspace identifier. + pub id: String, + /// Most recent Mission Control event identifier observed for the workspace. + #[serde(rename = "mc_last_event_id", skip_serializing_if = "Option::is_none")] + pub mc_last_event_id: Option, + /// Mission Control session identifier associated with the workspace. + #[serde(rename = "mc_session_id", skip_serializing_if = "Option::is_none")] + pub mc_session_id: Option, + /// Mission Control task identifier associated with the workspace. + #[serde(rename = "mc_task_id", skip_serializing_if = "Option::is_none")] + pub mc_task_id: Option, + /// Workspace display name. + #[serde(skip_serializing_if = "Option::is_none")] + pub name: Option, + /// Whether the workspace session can be steered remotely. + #[serde(rename = "remote_steerable", skip_serializing_if = "Option::is_none")] + pub remote_steerable: Option, + /// Repository identifier associated with the workspace. + #[serde(skip_serializing_if = "Option::is_none")] + pub repository: Option, + /// Number of persisted summaries in the workspace. + #[serde(rename = "summary_count", skip_serializing_if = "Option::is_none")] + pub summary_count: Option, + /// Timestamp when the workspace was last updated. + #[serde(rename = "updated_at", skip_serializing_if = "Option::is_none")] + pub updated_at: Option, + /// Whether the workspace name was explicitly chosen by the user. + #[serde(rename = "user_named", skip_serializing_if = "Option::is_none")] + pub user_named: Option, +} + +/// Current workspace metadata for the session, including its absolute filesystem path when available. /// ///
/// @@ -21213,24 +22825,73 @@ pub struct SessionFactoryGetRunResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionFactoryListRunsResult { - /// Whether terminal runs newer than this page exist. +pub struct SessionWorkspacesUpdateMetadataResult { + /// Absolute filesystem path to the workspace directory. Omitted when the session has no workspace (e.g. remote sessions). #[serde(skip_serializing_if = "Option::is_none")] - pub has_more_newer: Option, - /// Newest terminal-run cursor in this page, or null when the terminal window is empty. + pub path: Option, + /// Current workspace metadata, or null if not available + pub workspace: Option, +} + +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionWorkspacesEnsureResultWorkspace { + /// Current Git branch. #[serde(skip_serializing_if = "Option::is_none")] - pub newest_seq: Option, - /// Oldest terminal-run cursor in this page, or null when the terminal window is empty. + pub branch: Option, + /// Whether the per-session Chronicle upgrade prompt was dismissed for the workspace. + #[serde( + rename = "chronicle_sync_dismissed", + skip_serializing_if = "Option::is_none" + )] + pub chronicle_sync_dismissed: Option, + /// Name of the client that created the workspace. + #[serde(rename = "client_name", skip_serializing_if = "Option::is_none")] + pub client_name: Option, + /// Timestamp when the workspace was created. + #[serde(rename = "created_at", skip_serializing_if = "Option::is_none")] + pub created_at: Option, + /// Current working directory associated with the workspace. #[serde(skip_serializing_if = "Option::is_none")] - pub oldest_seq: Option, - /// Number of terminal runs older than this page. + pub cwd: Option, + /// Git repository root associated with the workspace. + #[serde(rename = "git_root", skip_serializing_if = "Option::is_none")] + pub git_root: Option, + /// Allowed values for the `WorkspacesWorkspaceDetailsHostType` enumeration. + #[serde(rename = "host_type", skip_serializing_if = "Option::is_none")] + pub host_type: Option, + /// Stable workspace identifier. + pub id: String, + /// Most recent Mission Control event identifier observed for the workspace. + #[serde(rename = "mc_last_event_id", skip_serializing_if = "Option::is_none")] + pub mc_last_event_id: Option, + /// Mission Control session identifier associated with the workspace. + #[serde(rename = "mc_session_id", skip_serializing_if = "Option::is_none")] + pub mc_session_id: Option, + /// Mission Control task identifier associated with the workspace. + #[serde(rename = "mc_task_id", skip_serializing_if = "Option::is_none")] + pub mc_task_id: Option, + /// Workspace display name. + #[serde(skip_serializing_if = "Option::is_none")] + pub name: Option, + /// Whether the workspace session can be steered remotely. + #[serde(rename = "remote_steerable", skip_serializing_if = "Option::is_none")] + pub remote_steerable: Option, + /// Repository identifier associated with the workspace. #[serde(skip_serializing_if = "Option::is_none")] - pub omitted_older: Option, - /// Factory run summaries in durable creation order. - pub runs: Vec, + pub repository: Option, + /// Number of persisted summaries in the workspace. + #[serde(rename = "summary_count", skip_serializing_if = "Option::is_none")] + pub summary_count: Option, + /// Timestamp when the workspace was last updated. + #[serde(rename = "updated_at", skip_serializing_if = "Option::is_none")] + pub updated_at: Option, + /// Whether the workspace name was explicitly chosen by the user. + #[serde(rename = "user_named", skip_serializing_if = "Option::is_none")] + pub user_named: Option, } -/// Full factory run observability detail. +/// Current workspace metadata for the session, including its absolute filesystem path when available. /// ///
/// @@ -21240,54 +22901,15 @@ pub struct SessionFactoryListRunsResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionFactoryGetRunDetailResult { - /// Epoch milliseconds when the current active segment started, or null while inactive. - pub active_segment_started_at: Option, - /// Durable identities and live statuses for direct factory agents. - pub agents: Vec, - /// Approved effective resource ceilings, or null until approved. - pub approved: Option, - /// Epoch milliseconds when the run completed, or null while nonterminal. - pub completed_at: Option, - /// Durable resource consumption. - pub consumed: FactoryRunConsumed, - /// Epoch milliseconds when the run was created. - pub created_at: i64, - /// Current phase identity, or null before any phase is entered. - pub current_phase: Option, - /// Resource ceilings declared by the factory. - pub declared_limits: FactoryDeclaredLimits, - /// Number of phases declared by the factory. - pub declared_phase_count: i64, - /// Human-readable factory description. - pub description: String, - /// Registered factory name. - pub factory_name: String, - /// Number of direct factory agents currently live. - pub live_agent_count: i64, - /// Epoch milliseconds when this live-overlay snapshot was observed. - pub observed_at: i64, - /// Lifecycle and timing observations for each factory phase. - pub phases: Vec, - /// Bidirectional page of durable factory progress. - pub progress: FactoryProgressPage, - /// Monotonic durable run revision. - pub revision: i64, - /// Factory run identifier. - pub run_id: String, - /// Epoch milliseconds when execution first started, or null before start. - pub started_at: Option, - /// Current factory run status. - pub status: FactoryRunStatus, - /// Terminal run outcome, or null while nonterminal. - pub terminal: Option, - /// Total direct factory agents spawned across all attempts. - pub total_spawned_agent_count: i64, - /// Epoch milliseconds when the durable run was last updated. - pub updated_at: i64, +pub struct SessionWorkspacesEnsureResult { + /// Absolute filesystem path to the workspace directory. Omitted when the session has no workspace (e.g. remote sessions). + #[serde(skip_serializing_if = "Option::is_none")] + pub path: Option, + /// Current workspace metadata, or null if not available + pub workspace: Option, } -/// A bidirectional page of factory progress. +/// Identifies the target session. /// ///
/// @@ -21297,22 +22919,12 @@ pub struct SessionFactoryGetRunDetailResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionFactoryGetRunProgressResult { - /// Whether progress records newer than this page exist. - pub has_more_newer: bool, - /// Whether progress records older than this page exist. - pub has_more_older: bool, - /// Newest sequence number in this page, or null when empty. - pub newest_seq: Option, - /// Oldest sequence number in this page, or null when empty. - pub oldest_seq: Option, - /// Progress records in sequence order. - pub records: Vec, - /// Run revision reflected by this page. - pub revision: i64, +pub struct SessionWorkspacesListFilesParams { + /// Target session identifier + pub session_id: SessionId, } -/// Complete current or terminal factory run envelope. +/// Relative paths of files stored in the session workspace files directory. /// ///
/// @@ -21322,29 +22934,12 @@ pub struct SessionFactoryGetRunProgressResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionFactoryCancelResult { - /// Error message for an errored run. - #[serde(skip_serializing_if = "Option::is_none")] - pub error: Option, - /// Machine-readable failure details for an errored run. - #[serde(skip_serializing_if = "Option::is_none")] - pub failure: Option, - /// Reason for a halted or cancelled run. - #[serde(skip_serializing_if = "Option::is_none")] - pub reason: Option, - /// Completed factory result. - #[serde(skip_serializing_if = "Option::is_none")] - pub result: Option, - /// Factory run identifier. - pub run_id: String, - /// Partial journal and progress snapshot for a halted, cancelled, or errored run. - #[serde(skip_serializing_if = "Option::is_none")] - pub snapshot: Option, - /// Current or terminal factory run status. - pub status: FactoryRunStatus, +pub struct SessionWorkspacesListFilesResult { + /// Relative file paths in the workspace files directory + pub files: Vec, } -/// Acknowledgement that a factory request was accepted. +/// Contents of the requested workspace file as a UTF-8 string. /// ///
/// @@ -21354,9 +22949,12 @@ pub struct SessionFactoryCancelResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionFactoryLogResult {} +pub struct SessionWorkspacesReadFileResult { + /// File content as a UTF-8 string + pub content: String, +} -/// Result of one factory-scoped subagent call. +/// Identifies the target session. /// ///
/// @@ -21366,13 +22964,12 @@ pub struct SessionFactoryLogResult {} ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionFactoryAgentResult { - /// Agent result, omitted when the agent produced no result. - #[serde(skip_serializing_if = "Option::is_none")] - pub result: Option, +pub struct SessionWorkspacesListCheckpointsParams { + /// Target session identifier + pub session_id: SessionId, } -/// Result of reading a factory journal entry. +/// Workspace checkpoints in chronological order; empty when the workspace is not enabled. /// ///
/// @@ -21382,15 +22979,12 @@ pub struct SessionFactoryAgentResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionFactoryJournalGetResult { - /// Whether the journal contained the requested key. - pub hit: bool, - /// Cached JSON result. The hit field distinguishes a cached JSON null from a miss. - #[serde(skip_serializing_if = "Option::is_none")] - pub result_json: Option, +pub struct SessionWorkspacesListCheckpointsResult { + /// Workspace checkpoints in chronological order. Empty when workspace is not enabled. + pub checkpoints: Vec, } -/// Acknowledgement that a factory request was accepted. +/// Checkpoint content as a UTF-8 string, or null when the checkpoint or workspace is missing. /// ///
/// @@ -21400,9 +22994,12 @@ pub struct SessionFactoryJournalGetResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionFactoryJournalPutResult {} +pub struct SessionWorkspacesReadCheckpointResult { + /// Checkpoint content as a UTF-8 string, or null when the checkpoint or workspace is missing + pub content: Option, +} -/// Identifies the target session. +/// Persisted summary metadata and refreshed workspace metadata. /// ///
/// @@ -21412,34 +23009,74 @@ pub struct SessionFactoryJournalPutResult {} ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionModelGetCurrentParams { - /// Target session identifier - pub session_id: SessionId, +pub struct SessionWorkspacesAddSummaryResult { + /// Metadata for the persisted summary. + #[serde(skip_serializing_if = "Option::is_none")] + pub summary: Option, + /// Refreshed metadata for the containing workspace. + #[serde(skip_serializing_if = "Option::is_none")] + pub workspace: Option, } -/// The currently selected model, reasoning effort, and context tier for the session. The context tier reflects `Session.getContextTier()`, restored from the session journal on resume. -/// -///
-/// -/// **Experimental.** This type is part of an experimental wire-protocol surface -/// and may change or be removed in future SDK or CLI releases. -/// -///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionModelGetCurrentResult { - /// Context tier for models that support multiple context-window sizes. +pub struct SessionWorkspacesTruncateSummariesResultWorkspace { + /// Current Git branch. #[serde(skip_serializing_if = "Option::is_none")] - pub context_tier: Option, - /// Currently active model identifier + pub branch: Option, + /// Whether the per-session Chronicle upgrade prompt was dismissed for the workspace. + #[serde( + rename = "chronicle_sync_dismissed", + skip_serializing_if = "Option::is_none" + )] + pub chronicle_sync_dismissed: Option, + /// Name of the client that created the workspace. + #[serde(rename = "client_name", skip_serializing_if = "Option::is_none")] + pub client_name: Option, + /// Timestamp when the workspace was created. + #[serde(rename = "created_at", skip_serializing_if = "Option::is_none")] + pub created_at: Option, + /// Current working directory associated with the workspace. #[serde(skip_serializing_if = "Option::is_none")] - pub model_id: Option, - /// 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. + pub cwd: Option, + /// Git repository root associated with the workspace. + #[serde(rename = "git_root", skip_serializing_if = "Option::is_none")] + pub git_root: Option, + /// Allowed values for the `WorkspacesWorkspaceDetailsHostType` enumeration. + #[serde(rename = "host_type", skip_serializing_if = "Option::is_none")] + pub host_type: Option, + /// Stable workspace identifier. + pub id: String, + /// Most recent Mission Control event identifier observed for the workspace. + #[serde(rename = "mc_last_event_id", skip_serializing_if = "Option::is_none")] + pub mc_last_event_id: Option, + /// Mission Control session identifier associated with the workspace. + #[serde(rename = "mc_session_id", skip_serializing_if = "Option::is_none")] + pub mc_session_id: Option, + /// Mission Control task identifier associated with the workspace. + #[serde(rename = "mc_task_id", skip_serializing_if = "Option::is_none")] + pub mc_task_id: Option, + /// Workspace display name. #[serde(skip_serializing_if = "Option::is_none")] - pub reasoning_effort: Option, + pub name: Option, + /// Whether the workspace session can be steered remotely. + #[serde(rename = "remote_steerable", skip_serializing_if = "Option::is_none")] + pub remote_steerable: Option, + /// Repository identifier associated with the workspace. + #[serde(skip_serializing_if = "Option::is_none")] + pub repository: Option, + /// Number of persisted summaries in the workspace. + #[serde(rename = "summary_count", skip_serializing_if = "Option::is_none")] + pub summary_count: Option, + /// Timestamp when the workspace was last updated. + #[serde(rename = "updated_at", skip_serializing_if = "Option::is_none")] + pub updated_at: Option, + /// Whether the workspace name was explicitly chosen by the user. + #[serde(rename = "user_named", skip_serializing_if = "Option::is_none")] + pub user_named: Option, } -/// The model identifier active on the session after the switch. +/// Current workspace metadata for the session, including its absolute filesystem path when available. /// ///
/// @@ -21449,34 +23086,15 @@ pub struct SessionModelGetCurrentResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionModelSwitchToResult { - /// Compaction confirmation projection when status is confirmation_required - #[serde(skip_serializing_if = "Option::is_none")] - pub confirmation: Option, - /// 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. - #[serde(skip_serializing_if = "Option::is_none")] - pub deferred: Option, - /// Deprecation warnings associated with the selected model or options. - #[serde(skip_serializing_if = "Option::is_none")] - pub deprecation_warnings: Option>, - /// User-facing outcome message for the model switch. - #[serde(skip_serializing_if = "Option::is_none")] - pub message: Option, - /// Currently active model identifier after the switch - #[serde(skip_serializing_if = "Option::is_none")] - pub model_id: Option, - /// Persistence failure encountered after applying the model switch. - #[serde(skip_serializing_if = "Option::is_none")] - pub persistence_error: Option, - /// Lifecycle result for the requested switch - #[serde(skip_serializing_if = "Option::is_none")] - pub status: Option, - /// User-facing warning produced while applying the model switch. +pub struct SessionWorkspacesTruncateSummariesResult { + /// Absolute filesystem path to the workspace directory. Omitted when the session has no workspace (e.g. remote sessions). #[serde(skip_serializing_if = "Option::is_none")] - pub warning: Option, + pub path: Option, + /// Current workspace metadata, or null if not available + pub workspace: Option, } -/// The model identifier active on the session after the switch. +/// Identifies the target session. /// ///
/// @@ -21486,34 +23104,12 @@ pub struct SessionModelSwitchToResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionModelApplyStartupOverlayResult { - /// Compaction confirmation projection when status is confirmation_required - #[serde(skip_serializing_if = "Option::is_none")] - pub confirmation: Option, - /// 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. - #[serde(skip_serializing_if = "Option::is_none")] - pub deferred: Option, - /// Deprecation warnings associated with the selected model or options. - #[serde(skip_serializing_if = "Option::is_none")] - pub deprecation_warnings: Option>, - /// User-facing outcome message for the model switch. - #[serde(skip_serializing_if = "Option::is_none")] - pub message: Option, - /// Currently active model identifier after the switch - #[serde(skip_serializing_if = "Option::is_none")] - pub model_id: Option, - /// Persistence failure encountered after applying the model switch. - #[serde(skip_serializing_if = "Option::is_none")] - pub persistence_error: Option, - /// Lifecycle result for the requested switch - #[serde(skip_serializing_if = "Option::is_none")] - pub status: Option, - /// User-facing warning produced while applying the model switch. - #[serde(skip_serializing_if = "Option::is_none")] - pub warning: Option, +pub struct SessionWorkspacesReadAutopilotObjectiveParams { + /// Target session identifier + pub session_id: SessionId, } -/// 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. +/// Autopilot objective file content, or null when missing. /// ///
/// @@ -21523,12 +23119,12 @@ pub struct SessionModelApplyStartupOverlayResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionModelSetReasoningEffortResult { - /// Reasoning effort level recorded on the session after the update - pub reasoning_effort: String, +pub struct SessionWorkspacesReadAutopilotObjectiveResult { + /// Autopilot objective file content, or null when missing. + pub content: Option, } -/// The list of models available to this session. +/// Result of writing the autopilot objective file. /// ///
/// @@ -21538,15 +23134,9 @@ pub struct SessionModelSetReasoningEffortResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionModelListResult { - /// 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`). - pub list: Vec, - /// 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. - #[serde(skip_serializing_if = "Option::is_none")] - pub model_price_categories: Option>, - /// Per-quota snapshots returned alongside the model list, keyed by quota type. - #[serde(skip_serializing_if = "Option::is_none")] - pub quota_snapshots: Option>, +pub struct SessionWorkspacesWriteAutopilotObjectiveResult { + /// Filesystem operation performed. + pub operation: String, } /// Identifies the target session. @@ -21559,12 +23149,12 @@ pub struct SessionModelListResult { /// #[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionModeGetParams { +pub struct SessionWorkspacesDeleteAutopilotObjectiveParams { /// Target session identifier pub session_id: SessionId, } -/// Outcome of a session mode change, including any model switch it triggered and follow-up the host must perform. +/// Result of deleting the autopilot objective file. /// ///
/// @@ -21574,29 +23164,9 @@ pub struct SessionModeGetParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionModeSetResult { - /// Whether the host should arm an interactive continuation after the mode change. - #[serde(skip_serializing_if = "Option::is_none")] - pub arm_interactive_continuation: Option, - /// Compaction confirmation required before the mode change can complete. - #[serde(skip_serializing_if = "Option::is_none")] - pub confirmation: Option, - /// Whether the host must defer implementing the requested mode change. - #[serde(skip_serializing_if = "Option::is_none")] - pub defer_implementation: Option, - /// Deprecation warnings associated with the model selected by the mode change. - #[serde(skip_serializing_if = "Option::is_none")] - pub deprecation_warnings: Option>, - /// User-facing outcome message for the model switch triggered by the mode change. - #[serde(skip_serializing_if = "Option::is_none")] - pub message: Option, - /// Whether applying the mode changed the active model. - pub model_changed: bool, - /// Lifecycle status of the requested mode change. - pub status: String, - /// User-facing warning produced while applying the mode change. - #[serde(skip_serializing_if = "Option::is_none")] - pub warning: Option, +pub struct SessionWorkspacesDeleteAutopilotObjectiveResult { + /// True when a file was deleted. + pub deleted: bool, } /// Identifies the target session. @@ -21609,12 +23179,12 @@ pub struct SessionModeSetResult { /// #[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionNameGetParams { +pub struct SessionWorkspacesAutopilotObjectiveExistsParams { /// Target session identifier pub session_id: SessionId, } -/// The session's friendly name, or null when not yet set. +/// Whether the autopilot objective file exists. /// ///
/// @@ -21624,27 +23194,23 @@ pub struct SessionNameGetParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionNameGetResult { - /// The session name (user-set or auto-generated), or null if not yet set - pub name: Option, +pub struct SessionWorkspacesAutopilotObjectiveExistsResult { + /// True when the objective file exists. + pub exists: bool, } -/// Indicates whether the auto-generated summary was applied as the session's name. -/// -///
-/// -/// **Experimental.** This type is part of an experimental wire-protocol surface -/// and may change or be removed in future SDK or CLI releases. -/// -///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionNameSetAutoResult { - /// 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. - pub applied: bool, +pub struct SessionWorkspacesSaveLargePasteResultSaved { + /// Filename within the workspace files directory + pub filename: String, + /// Absolute filesystem path to the saved paste file + pub file_path: String, + /// Size of the saved file in bytes + pub size_bytes: i64, } -/// Identifies the target session. +/// Descriptor for the saved paste file, or null when the workspace is unavailable. /// ///
/// @@ -21654,12 +23220,12 @@ pub struct SessionNameSetAutoResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionPlanReadParams { - /// Target session identifier - pub session_id: SessionId, +pub struct SessionWorkspacesSaveLargePasteResult { + /// Saved-paste descriptor, or null when the workspace is unavailable (e.g. CCA runtime, non-infinite sessions, remote sessions) + pub saved: Option, } -/// Existence, contents, and resolved path of the session plan file. +/// Workspace diff result for the requested mode. /// ///
/// @@ -21669,13 +23235,21 @@ pub struct SessionPlanReadParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionPlanReadResult { - /// The content of the plan file, or null if it does not exist - pub content: Option, - /// Whether the plan file exists in the workspace - pub exists: bool, - /// Absolute file path of the plan file, or null if workspace is not enabled - pub path: Option, +pub struct SessionWorkspacesDiffResult { + /// Default branch used for a branch diff, when branch mode was requested. + #[serde(skip_serializing_if = "Option::is_none")] + pub base_branch: Option, + /// Changed files and their unified diffs. + pub changes: Vec, + /// Whether the requested diff fell back to unstaged changes, either because branch diff failed or session diff was unavailable. + pub is_fallback: bool, + /// Effective mode used for the returned changes. + pub mode: WorkspaceDiffMode, + /// Diff mode requested by the client. + pub requested_mode: WorkspaceDiffMode, + /// 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. + #[serde(skip_serializing_if = "Option::is_none")] + pub unavailable_reason: Option, } /// Identifies the target session. @@ -21688,12 +23262,12 @@ pub struct SessionPlanReadResult { /// #[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionPlanDeleteParams { +pub struct SessionCompletionsGetTriggerCharactersParams { /// Target session identifier pub session_id: SessionId, } -/// Identifies the target session. +/// 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`). /// ///
/// @@ -21703,12 +23277,12 @@ pub struct SessionPlanDeleteParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionPlanReadSqlTodosParams { - /// Target session identifier - pub session_id: SessionId, +pub struct SessionCompletionsGetTriggerCharactersResult { + /// Trigger characters advertised by the host (e.g. `["@", "#"]`). Empty disables host-driven completions for the session. + pub trigger_characters: Vec, } -/// Todo rows read from the session SQL database. Empty when no session database is available. +/// Host-driven completion items for the current composer input. Empty when the host returns no items or does not support completions. /// ///
/// @@ -21718,9 +23292,9 @@ pub struct SessionPlanReadSqlTodosParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionPlanReadSqlTodosResult { - /// 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. - pub rows: Vec, +pub struct SessionCompletionsRequestResult { + /// Completion items in host-ranked order. + pub items: Vec, } /// Identifies the target session. @@ -21733,12 +23307,12 @@ pub struct SessionPlanReadSqlTodosResult { /// #[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionPlanReadSqlTodosWithDependenciesParams { +pub struct SessionInstructionsGetSourcesParams { /// Target session identifier pub session_id: SessionId, } -/// Todo rows + dependency edges read from the session SQL database. +/// Instruction sources loaded for the session, in merge order. /// ///
/// @@ -21748,14 +23322,12 @@ pub struct SessionPlanReadSqlTodosWithDependenciesParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionPlanReadSqlTodosWithDependenciesResult { - /// 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. - pub dependencies: Vec, - /// 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. - pub rows: Vec, +pub struct SessionInstructionsGetSourcesResult { + /// Instruction sources for the session + pub sources: Vec, } -/// Identifies the target session. +/// Indicates whether fleet mode was successfully activated. /// ///
/// @@ -21765,70 +23337,12 @@ pub struct SessionPlanReadSqlTodosWithDependenciesResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionWorkspacesGetWorkspaceParams { - /// Target session identifier - pub session_id: SessionId, -} - -#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct SessionWorkspacesGetWorkspaceResultWorkspace { - /// Current Git branch. - #[serde(skip_serializing_if = "Option::is_none")] - pub branch: Option, - /// Whether the per-session Chronicle upgrade prompt was dismissed for the workspace. - #[serde( - rename = "chronicle_sync_dismissed", - skip_serializing_if = "Option::is_none" - )] - pub chronicle_sync_dismissed: Option, - /// Name of the client that created the workspace. - #[serde(rename = "client_name", skip_serializing_if = "Option::is_none")] - pub client_name: Option, - /// Timestamp when the workspace was created. - #[serde(rename = "created_at", skip_serializing_if = "Option::is_none")] - pub created_at: Option, - /// Current working directory associated with the workspace. - #[serde(skip_serializing_if = "Option::is_none")] - pub cwd: Option, - /// Git repository root associated with the workspace. - #[serde(rename = "git_root", skip_serializing_if = "Option::is_none")] - pub git_root: Option, - /// Allowed values for the `WorkspacesWorkspaceDetailsHostType` enumeration. - #[serde(rename = "host_type", skip_serializing_if = "Option::is_none")] - pub host_type: Option, - /// Stable workspace identifier. - pub id: String, - /// Most recent Mission Control event identifier observed for the workspace. - #[serde(rename = "mc_last_event_id", skip_serializing_if = "Option::is_none")] - pub mc_last_event_id: Option, - /// Mission Control session identifier associated with the workspace. - #[serde(rename = "mc_session_id", skip_serializing_if = "Option::is_none")] - pub mc_session_id: Option, - /// Mission Control task identifier associated with the workspace. - #[serde(rename = "mc_task_id", skip_serializing_if = "Option::is_none")] - pub mc_task_id: Option, - /// Workspace display name. - #[serde(skip_serializing_if = "Option::is_none")] - pub name: Option, - /// Whether the workspace session can be steered remotely. - #[serde(rename = "remote_steerable", skip_serializing_if = "Option::is_none")] - pub remote_steerable: Option, - /// Repository identifier associated with the workspace. - #[serde(skip_serializing_if = "Option::is_none")] - pub repository: Option, - /// Number of persisted summaries in the workspace. - #[serde(rename = "summary_count", skip_serializing_if = "Option::is_none")] - pub summary_count: Option, - /// Timestamp when the workspace was last updated. - #[serde(rename = "updated_at", skip_serializing_if = "Option::is_none")] - pub updated_at: Option, - /// Whether the workspace name was explicitly chosen by the user. - #[serde(rename = "user_named", skip_serializing_if = "Option::is_none")] - pub user_named: Option, +pub struct SessionFleetStartResult { + /// Whether fleet mode was successfully activated + pub started: bool, } -/// Current workspace metadata for the session, including its absolute filesystem path when available. +/// Agents available to the session. /// ///
/// @@ -21838,73 +23352,27 @@ pub struct SessionWorkspacesGetWorkspaceResultWorkspace { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionWorkspacesGetWorkspaceResult { - /// Absolute filesystem path to the workspace directory. Omitted when the session has no workspace (e.g. remote sessions). - #[serde(skip_serializing_if = "Option::is_none")] - pub path: Option, - /// Current workspace metadata, or null if not available - pub workspace: Option, +pub struct SessionAgentListResult { + /// Available agents + pub agents: Vec, } +/// Identifies the target session. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionWorkspacesUpdateMetadataResultWorkspace { - /// Current Git branch. - #[serde(skip_serializing_if = "Option::is_none")] - pub branch: Option, - /// Whether the per-session Chronicle upgrade prompt was dismissed for the workspace. - #[serde( - rename = "chronicle_sync_dismissed", - skip_serializing_if = "Option::is_none" - )] - pub chronicle_sync_dismissed: Option, - /// Name of the client that created the workspace. - #[serde(rename = "client_name", skip_serializing_if = "Option::is_none")] - pub client_name: Option, - /// Timestamp when the workspace was created. - #[serde(rename = "created_at", skip_serializing_if = "Option::is_none")] - pub created_at: Option, - /// Current working directory associated with the workspace. - #[serde(skip_serializing_if = "Option::is_none")] - pub cwd: Option, - /// Git repository root associated with the workspace. - #[serde(rename = "git_root", skip_serializing_if = "Option::is_none")] - pub git_root: Option, - /// Allowed values for the `WorkspacesWorkspaceDetailsHostType` enumeration. - #[serde(rename = "host_type", skip_serializing_if = "Option::is_none")] - pub host_type: Option, - /// Stable workspace identifier. - pub id: String, - /// Most recent Mission Control event identifier observed for the workspace. - #[serde(rename = "mc_last_event_id", skip_serializing_if = "Option::is_none")] - pub mc_last_event_id: Option, - /// Mission Control session identifier associated with the workspace. - #[serde(rename = "mc_session_id", skip_serializing_if = "Option::is_none")] - pub mc_session_id: Option, - /// Mission Control task identifier associated with the workspace. - #[serde(rename = "mc_task_id", skip_serializing_if = "Option::is_none")] - pub mc_task_id: Option, - /// Workspace display name. - #[serde(skip_serializing_if = "Option::is_none")] - pub name: Option, - /// Whether the workspace session can be steered remotely. - #[serde(rename = "remote_steerable", skip_serializing_if = "Option::is_none")] - pub remote_steerable: Option, - /// Repository identifier associated with the workspace. - #[serde(skip_serializing_if = "Option::is_none")] - pub repository: Option, - /// Number of persisted summaries in the workspace. - #[serde(rename = "summary_count", skip_serializing_if = "Option::is_none")] - pub summary_count: Option, - /// Timestamp when the workspace was last updated. - #[serde(rename = "updated_at", skip_serializing_if = "Option::is_none")] - pub updated_at: Option, - /// Whether the workspace name was explicitly chosen by the user. - #[serde(rename = "user_named", skip_serializing_if = "Option::is_none")] - pub user_named: Option, +pub struct SessionAgentGetCurrentParams { + /// Target session identifier + pub session_id: SessionId, } -/// Current workspace metadata for the session, including its absolute filesystem path when available. +/// The currently selected custom agent, or null when using the default agent. /// ///
/// @@ -21914,73 +23382,27 @@ pub struct SessionWorkspacesUpdateMetadataResultWorkspace { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionWorkspacesUpdateMetadataResult { - /// Absolute filesystem path to the workspace directory. Omitted when the session has no workspace (e.g. remote sessions). - #[serde(skip_serializing_if = "Option::is_none")] - pub path: Option, - /// Current workspace metadata, or null if not available - pub workspace: Option, +pub struct SessionAgentGetCurrentResult { + /// Currently selected custom agent, or null if using the default agent + pub agent: AgentInfo, } +/// The newly selected custom agent. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionWorkspacesEnsureResultWorkspace { - /// Current Git branch. - #[serde(skip_serializing_if = "Option::is_none")] - pub branch: Option, - /// Whether the per-session Chronicle upgrade prompt was dismissed for the workspace. - #[serde( - rename = "chronicle_sync_dismissed", - skip_serializing_if = "Option::is_none" - )] - pub chronicle_sync_dismissed: Option, - /// Name of the client that created the workspace. - #[serde(rename = "client_name", skip_serializing_if = "Option::is_none")] - pub client_name: Option, - /// Timestamp when the workspace was created. - #[serde(rename = "created_at", skip_serializing_if = "Option::is_none")] - pub created_at: Option, - /// Current working directory associated with the workspace. - #[serde(skip_serializing_if = "Option::is_none")] - pub cwd: Option, - /// Git repository root associated with the workspace. - #[serde(rename = "git_root", skip_serializing_if = "Option::is_none")] - pub git_root: Option, - /// Allowed values for the `WorkspacesWorkspaceDetailsHostType` enumeration. - #[serde(rename = "host_type", skip_serializing_if = "Option::is_none")] - pub host_type: Option, - /// Stable workspace identifier. - pub id: String, - /// Most recent Mission Control event identifier observed for the workspace. - #[serde(rename = "mc_last_event_id", skip_serializing_if = "Option::is_none")] - pub mc_last_event_id: Option, - /// Mission Control session identifier associated with the workspace. - #[serde(rename = "mc_session_id", skip_serializing_if = "Option::is_none")] - pub mc_session_id: Option, - /// Mission Control task identifier associated with the workspace. - #[serde(rename = "mc_task_id", skip_serializing_if = "Option::is_none")] - pub mc_task_id: Option, - /// Workspace display name. - #[serde(skip_serializing_if = "Option::is_none")] - pub name: Option, - /// Whether the workspace session can be steered remotely. - #[serde(rename = "remote_steerable", skip_serializing_if = "Option::is_none")] - pub remote_steerable: Option, - /// Repository identifier associated with the workspace. - #[serde(skip_serializing_if = "Option::is_none")] - pub repository: Option, - /// Number of persisted summaries in the workspace. - #[serde(rename = "summary_count", skip_serializing_if = "Option::is_none")] - pub summary_count: Option, - /// Timestamp when the workspace was last updated. - #[serde(rename = "updated_at", skip_serializing_if = "Option::is_none")] - pub updated_at: Option, - /// Whether the workspace name was explicitly chosen by the user. - #[serde(rename = "user_named", skip_serializing_if = "Option::is_none")] - pub user_named: Option, +pub struct SessionAgentSelectResult { + /// The newly selected custom agent + pub agent: AgentInfo, } -/// Current workspace metadata for the session, including its absolute filesystem path when available. +/// Identifies the target session. /// ///
/// @@ -21990,12 +23412,9 @@ pub struct SessionWorkspacesEnsureResultWorkspace { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionWorkspacesEnsureResult { - /// Absolute filesystem path to the workspace directory. Omitted when the session has no workspace (e.g. remote sessions). - #[serde(skip_serializing_if = "Option::is_none")] - pub path: Option, - /// Current workspace metadata, or null if not available - pub workspace: Option, +pub struct SessionAgentDeselectParams { + /// Target session identifier + pub session_id: SessionId, } /// Identifies the target session. @@ -22008,12 +23427,12 @@ pub struct SessionWorkspacesEnsureResult { /// #[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionWorkspacesListFilesParams { +pub struct SessionAgentReloadParams { /// Target session identifier pub session_id: SessionId, } -/// Relative paths of files stored in the session workspace files directory. +/// Custom agents available to the session after reloading definitions from disk. /// ///
/// @@ -22023,12 +23442,12 @@ pub struct SessionWorkspacesListFilesParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionWorkspacesListFilesResult { - /// Relative file paths in the workspace files directory - pub files: Vec, +pub struct SessionAgentReloadResult { + /// Reloaded custom agents + pub agents: Vec, } -/// Contents of the requested workspace file as a UTF-8 string. +/// Identifier assigned to the newly started background agent task. /// ///
/// @@ -22038,9 +23457,9 @@ pub struct SessionWorkspacesListFilesResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionWorkspacesReadFileResult { - /// File content as a UTF-8 string - pub content: String, +pub struct SessionTasksStartAgentResult { + /// Generated agent ID for the background task + pub agent_id: String, } /// Identifies the target session. @@ -22053,12 +23472,12 @@ pub struct SessionWorkspacesReadFileResult { /// #[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionWorkspacesListCheckpointsParams { +pub struct SessionTasksListParams { /// Target session identifier pub session_id: SessionId, } -/// Workspace checkpoints in chronological order; empty when the workspace is not enabled. +/// Background tasks currently tracked by the session. /// ///
/// @@ -22068,12 +23487,12 @@ pub struct SessionWorkspacesListCheckpointsParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionWorkspacesListCheckpointsResult { - /// Workspace checkpoints in chronological order. Empty when workspace is not enabled. - pub checkpoints: Vec, +pub struct SessionTasksListResult { + /// Currently tracked tasks + pub tasks: Vec, } -/// Checkpoint content as a UTF-8 string, or null when the checkpoint or workspace is missing. +/// Identifies the target session. /// ///
/// @@ -22083,12 +23502,12 @@ pub struct SessionWorkspacesListCheckpointsResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionWorkspacesReadCheckpointResult { - /// Checkpoint content as a UTF-8 string, or null when the checkpoint or workspace is missing - pub content: Option, +pub struct SessionTasksRefreshParams { + /// Target session identifier + pub session_id: SessionId, } -/// Persisted summary metadata and refreshed workspace metadata. +/// 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. /// ///
/// @@ -22098,74 +23517,24 @@ pub struct SessionWorkspacesReadCheckpointResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionWorkspacesAddSummaryResult { - /// Metadata for the persisted summary. - #[serde(skip_serializing_if = "Option::is_none")] - pub summary: Option, - /// Refreshed metadata for the containing workspace. - #[serde(skip_serializing_if = "Option::is_none")] - pub workspace: Option, -} +pub struct SessionTasksRefreshResult {} +/// Identifies the target session. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionWorkspacesTruncateSummariesResultWorkspace { - /// Current Git branch. - #[serde(skip_serializing_if = "Option::is_none")] - pub branch: Option, - /// Whether the per-session Chronicle upgrade prompt was dismissed for the workspace. - #[serde( - rename = "chronicle_sync_dismissed", - skip_serializing_if = "Option::is_none" - )] - pub chronicle_sync_dismissed: Option, - /// Name of the client that created the workspace. - #[serde(rename = "client_name", skip_serializing_if = "Option::is_none")] - pub client_name: Option, - /// Timestamp when the workspace was created. - #[serde(rename = "created_at", skip_serializing_if = "Option::is_none")] - pub created_at: Option, - /// Current working directory associated with the workspace. - #[serde(skip_serializing_if = "Option::is_none")] - pub cwd: Option, - /// Git repository root associated with the workspace. - #[serde(rename = "git_root", skip_serializing_if = "Option::is_none")] - pub git_root: Option, - /// Allowed values for the `WorkspacesWorkspaceDetailsHostType` enumeration. - #[serde(rename = "host_type", skip_serializing_if = "Option::is_none")] - pub host_type: Option, - /// Stable workspace identifier. - pub id: String, - /// Most recent Mission Control event identifier observed for the workspace. - #[serde(rename = "mc_last_event_id", skip_serializing_if = "Option::is_none")] - pub mc_last_event_id: Option, - /// Mission Control session identifier associated with the workspace. - #[serde(rename = "mc_session_id", skip_serializing_if = "Option::is_none")] - pub mc_session_id: Option, - /// Mission Control task identifier associated with the workspace. - #[serde(rename = "mc_task_id", skip_serializing_if = "Option::is_none")] - pub mc_task_id: Option, - /// Workspace display name. - #[serde(skip_serializing_if = "Option::is_none")] - pub name: Option, - /// Whether the workspace session can be steered remotely. - #[serde(rename = "remote_steerable", skip_serializing_if = "Option::is_none")] - pub remote_steerable: Option, - /// Repository identifier associated with the workspace. - #[serde(skip_serializing_if = "Option::is_none")] - pub repository: Option, - /// Number of persisted summaries in the workspace. - #[serde(rename = "summary_count", skip_serializing_if = "Option::is_none")] - pub summary_count: Option, - /// Timestamp when the workspace was last updated. - #[serde(rename = "updated_at", skip_serializing_if = "Option::is_none")] - pub updated_at: Option, - /// Whether the workspace name was explicitly chosen by the user. - #[serde(rename = "user_named", skip_serializing_if = "Option::is_none")] - pub user_named: Option, +pub struct SessionTasksWaitForPendingParams { + /// Target session identifier + pub session_id: SessionId, } -/// Current workspace metadata for the session, including its absolute filesystem path when available. +/// 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). /// ///
/// @@ -22175,12 +23544,21 @@ pub struct SessionWorkspacesTruncateSummariesResultWorkspace { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionWorkspacesTruncateSummariesResult { - /// Absolute filesystem path to the workspace directory. Omitted when the session has no workspace (e.g. remote sessions). - #[serde(skip_serializing_if = "Option::is_none")] - pub path: Option, - /// Current workspace metadata, or null if not available - pub workspace: Option, +pub struct SessionTasksWaitForPendingResult {} + +/// Progress information for the task, or null when no task with that ID is tracked. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionTasksGetProgressResult { + /// Progress information for the task, discriminated by type. Returns null when no task with this ID is currently tracked. + pub progress: Option, } /// Identifies the target session. @@ -22193,12 +23571,12 @@ pub struct SessionWorkspacesTruncateSummariesResult { /// #[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionWorkspacesReadAutopilotObjectiveParams { +pub struct SessionTasksGetCurrentPromotableParams { /// Target session identifier pub session_id: SessionId, } -/// Autopilot objective file content, or null when missing. +/// The first sync-waiting task that can currently be promoted to background mode. /// ///
/// @@ -22208,12 +23586,13 @@ pub struct SessionWorkspacesReadAutopilotObjectiveParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionWorkspacesReadAutopilotObjectiveResult { - /// Autopilot objective file content, or null when missing. - pub content: Option, +pub struct SessionTasksGetCurrentPromotableResult { + /// 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. + #[serde(skip_serializing_if = "Option::is_none")] + pub task: Option, } -/// Result of writing the autopilot objective file. +/// Indicates whether the task was successfully promoted to background mode. /// ///
/// @@ -22223,9 +23602,9 @@ pub struct SessionWorkspacesReadAutopilotObjectiveResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionWorkspacesWriteAutopilotObjectiveResult { - /// Filesystem operation performed. - pub operation: String, +pub struct SessionTasksPromoteToBackgroundResult { + /// Whether the task was successfully promoted to background mode + pub promoted: bool, } /// Identifies the target session. @@ -22238,12 +23617,12 @@ pub struct SessionWorkspacesWriteAutopilotObjectiveResult { /// #[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionWorkspacesDeleteAutopilotObjectiveParams { +pub struct SessionTasksPromoteCurrentToBackgroundParams { /// Target session identifier pub session_id: SessionId, } -/// Result of deleting the autopilot objective file. +/// The promoted task as it now exists in background mode, omitted if no promotable task was waiting. /// ///
/// @@ -22253,12 +23632,13 @@ pub struct SessionWorkspacesDeleteAutopilotObjectiveParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionWorkspacesDeleteAutopilotObjectiveResult { - /// True when a file was deleted. - pub deleted: bool, +pub struct SessionTasksPromoteCurrentToBackgroundResult { + /// 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. + #[serde(skip_serializing_if = "Option::is_none")] + pub task: Option, } -/// Identifies the target session. +/// Indicates whether the background task was successfully cancelled. /// ///
/// @@ -22268,12 +23648,12 @@ pub struct SessionWorkspacesDeleteAutopilotObjectiveResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionWorkspacesAutopilotObjectiveExistsParams { - /// Target session identifier - pub session_id: SessionId, +pub struct SessionTasksCancelResult { + /// Whether the task was successfully cancelled + pub cancelled: bool, } -/// Whether the autopilot objective file exists. +/// Indicates whether the task was removed. False when the task does not exist or is still running/idle. /// ///
/// @@ -22283,23 +23663,30 @@ pub struct SessionWorkspacesAutopilotObjectiveExistsParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionWorkspacesAutopilotObjectiveExistsResult { - /// True when the objective file exists. - pub exists: bool, +pub struct SessionTasksRemoveResult { + /// Whether the task was removed. Returns false if the task does not exist or is still running/idle (cancel it first). + pub removed: bool, } +/// Indicates whether the message was delivered, with an error message when delivery failed. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionWorkspacesSaveLargePasteResultSaved { - /// Filename within the workspace files directory - pub filename: String, - /// Absolute filesystem path to the saved paste file - pub file_path: String, - /// Size of the saved file in bytes - pub size_bytes: i64, +pub struct SessionTasksSendMessageResult { + /// Error message if delivery failed + #[serde(skip_serializing_if = "Option::is_none")] + pub error: Option, + /// Whether the message was successfully delivered or steered + pub sent: bool, } -/// Descriptor for the saved paste file, or null when the workspace is unavailable. +/// Identifies the target session. /// ///
/// @@ -22309,12 +23696,12 @@ pub struct SessionWorkspacesSaveLargePasteResultSaved { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionWorkspacesSaveLargePasteResult { - /// Saved-paste descriptor, or null when the workspace is unavailable (e.g. CCA runtime, non-infinite sessions, remote sessions) - pub saved: Option, +pub struct SessionSkillsListParams { + /// Target session identifier + pub session_id: SessionId, } -/// Workspace diff result for the requested mode. +/// Skills available to the session, with their enabled state. /// ///
/// @@ -22324,21 +23711,9 @@ pub struct SessionWorkspacesSaveLargePasteResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionWorkspacesDiffResult { - /// Default branch used for a branch diff, when branch mode was requested. - #[serde(skip_serializing_if = "Option::is_none")] - pub base_branch: Option, - /// Changed files and their unified diffs. - pub changes: Vec, - /// Whether the requested diff fell back to unstaged changes, either because branch diff failed or session diff was unavailable. - pub is_fallback: bool, - /// Effective mode used for the returned changes. - pub mode: WorkspaceDiffMode, - /// Diff mode requested by the client. - pub requested_mode: WorkspaceDiffMode, - /// 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. - #[serde(skip_serializing_if = "Option::is_none")] - pub unavailable_reason: Option, +pub struct SessionSkillsListResult { + /// Available skills + pub skills: Vec, } /// Identifies the target session. @@ -22351,12 +23726,12 @@ pub struct SessionWorkspacesDiffResult { /// #[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionCompletionsGetTriggerCharactersParams { +pub struct SessionSkillsGetInvokedParams { /// Target session identifier pub session_id: SessionId, } -/// 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`). +/// Skills invoked during this session, ordered by invocation time (most recent last). /// ///
/// @@ -22366,12 +23741,12 @@ pub struct SessionCompletionsGetTriggerCharactersParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionCompletionsGetTriggerCharactersResult { - /// Trigger characters advertised by the host (e.g. `["@", "#"]`). Empty disables host-driven completions for the session. - pub trigger_characters: Vec, +pub struct SessionSkillsGetInvokedResult { + /// Skills invoked during this session, ordered by invocation time (most recent last) + pub skills: Vec, } -/// Host-driven completion items for the current composer input. Empty when the host returns no items or does not support completions. +/// Identifies the target session. /// ///
/// @@ -22381,9 +23756,26 @@ pub struct SessionCompletionsGetTriggerCharactersResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionCompletionsRequestResult { - /// Completion items in host-ranked order. - pub items: Vec, +pub struct SessionSkillsReloadParams { + /// Target session identifier + pub session_id: SessionId, +} + +/// Diagnostics from reloading skill definitions, with warnings and errors as separate lists. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionSkillsReloadResult { + /// Errors emitted while loading skills (e.g. skills that failed to load entirely) + pub errors: Vec, + /// Warnings emitted while loading skills (e.g. skills that loaded but had issues) + pub warnings: Vec, } /// Identifies the target session. @@ -22396,12 +23788,12 @@ pub struct SessionCompletionsRequestResult { /// #[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionInstructionsGetSourcesParams { +pub struct SessionSkillsEnsureLoadedParams { /// Target session identifier pub session_id: SessionId, } -/// Instruction sources loaded for the session, in merge order. +/// Identifies the target session. /// ///
/// @@ -22411,12 +23803,12 @@ pub struct SessionInstructionsGetSourcesParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionInstructionsGetSourcesResult { - /// Instruction sources for the session - pub sources: Vec, +pub struct SessionMcpListParams { + /// Target session identifier + pub session_id: SessionId, } -/// Indicates whether fleet mode was successfully activated. +/// MCP servers configured for the session, with their connection status and host-level state. /// ///
/// @@ -22426,12 +23818,15 @@ pub struct SessionInstructionsGetSourcesResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionFleetStartResult { - /// Whether fleet mode was successfully activated - pub started: bool, +pub struct SessionMcpListResult { + /// Host-level state, omitted when no MCP host is initialized. + #[serde(skip_serializing_if = "Option::is_none")] + pub host: Option, + /// Configured MCP servers + pub servers: Vec, } -/// Agents available to the session. +/// Tools exposed by the connected MCP server. Throws when the server is not connected. /// ///
/// @@ -22441,9 +23836,9 @@ pub struct SessionFleetStartResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionAgentListResult { - /// Available agents - pub agents: Vec, +pub struct SessionMcpListToolsResult { + /// Tools exposed by the server. + pub tools: Vec, } /// Identifies the target session. @@ -22456,12 +23851,12 @@ pub struct SessionAgentListResult { /// #[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionAgentGetCurrentParams { +pub struct SessionMcpReloadParams { /// Target session identifier pub session_id: SessionId, } -/// The currently selected custom agent, or null when using the default agent. +/// Identifies the target session. /// ///
/// @@ -22471,12 +23866,12 @@ pub struct SessionAgentGetCurrentParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionAgentGetCurrentResult { - /// Currently selected custom agent, or null if using the default agent - pub agent: AgentInfo, +pub struct SessionMcpMoveLoadingToBackgroundParams { + /// Target session identifier + pub session_id: SessionId, } -/// The newly selected custom agent. +/// Result of moving in-flight MCP loading to the background. /// ///
/// @@ -22486,12 +23881,12 @@ pub struct SessionAgentGetCurrentResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionAgentSelectResult { - /// The newly selected custom agent - pub agent: AgentInfo, +pub struct SessionMcpMoveLoadingToBackgroundResult { + /// 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. + pub moved_to_background: bool, } -/// Identifies the target session. +/// MCP server startup filtering result. /// ///
/// @@ -22501,9 +23896,66 @@ pub struct SessionAgentSelectResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionAgentDeselectParams { - /// Target session identifier - pub session_id: SessionId, +pub struct SessionMcpReloadWithConfigResult { + /// Non-default servers allowed by policy + #[serde(skip_serializing_if = "Option::is_none")] + pub allowed_servers: Option>, + /// Servers whose connection attempt failed. + #[serde(skip_serializing_if = "Option::is_none")] + pub failed_servers: Option>, + /// Servers filtered out before startup + pub filtered_servers: Vec, +} + +/// Outcome of an MCP sampling execution: success result, failure error, or cancellation. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionMcpExecuteSamplingResult { + /// 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. + pub action: McpSamplingExecutionAction, + /// Error description, present when action='failure'. + #[serde(skip_serializing_if = "Option::is_none")] + pub error: Option, + /// 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. + #[serde(skip_serializing_if = "Option::is_none")] + pub result: Option, +} + +/// Indicates whether an in-flight sampling execution with the given requestId was found and cancelled. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionMcpCancelSamplingExecutionResult { + /// 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). + pub cancelled: bool, +} + +/// Env-value mode recorded on the session after the update. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionMcpSetEnvValueModeResult { + /// Mode recorded on the session after the update + pub mode: McpSetEnvValueModeDetails, } /// Identifies the target session. @@ -22516,12 +23968,12 @@ pub struct SessionAgentDeselectParams { /// #[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionAgentReloadParams { +pub struct SessionMcpRemoveGitHubParams { /// Target session identifier pub session_id: SessionId, } -/// Custom agents available to the session after reloading definitions from disk. +/// Indicates whether the auto-managed `github` MCP server was removed (false when nothing to remove). /// ///
/// @@ -22531,12 +23983,12 @@ pub struct SessionAgentReloadParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionAgentReloadResult { - /// Reloaded custom agents - pub agents: Vec, +pub struct SessionMcpRemoveGitHubResult { + /// 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). + pub removed: bool, } -/// Identifier assigned to the newly started background agent task. +/// Result of configuring GitHub MCP. /// ///
/// @@ -22546,12 +23998,12 @@ pub struct SessionAgentReloadResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionTasksStartAgentResult { - /// Generated agent ID for the background task - pub agent_id: String, +pub struct SessionMcpConfigureGitHubResult { + /// Whether GitHub MCP configuration changed. + pub changed: bool, } -/// Identifies the target session. +/// Whether the named MCP server is running. /// ///
/// @@ -22561,12 +24013,12 @@ pub struct SessionTasksStartAgentResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionTasksListParams { - /// Target session identifier - pub session_id: SessionId, +pub struct SessionMcpIsServerRunningResult { + /// True if the server has an active client and transport. + pub running: bool, } -/// Background tasks currently tracked by the session. +/// Indicates whether the pending MCP OAuth response was accepted. /// ///
/// @@ -22576,12 +24028,12 @@ pub struct SessionTasksListParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionTasksListResult { - /// Currently tracked tasks - pub tasks: Vec, +pub struct SessionMcpOauthHandlePendingRequestResult { + /// Whether the response was accepted. False if the request was unknown, timed out, or already resolved. + pub success: bool, } -/// Identifies the target session. +/// OAuth authorization URL the caller should open, or empty when cached tokens already authenticated the server. /// ///
/// @@ -22591,12 +24043,13 @@ pub struct SessionTasksListResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionTasksRefreshParams { - /// Target session identifier - pub session_id: SessionId, +pub struct SessionMcpOauthLoginResult { + /// 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. + #[serde(skip_serializing_if = "Option::is_none")] + pub authorization_url: Option, } -/// 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. +/// Indicates whether the pending MCP OAuth response was accepted. /// ///
/// @@ -22606,9 +24059,12 @@ pub struct SessionTasksRefreshParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionTasksRefreshResult {} +pub struct SessionMcpOauthRespondResult { + /// Whether the response was accepted. False if the request was unknown, timed out, or already resolved. + pub success: bool, +} -/// Identifies the target session. +/// Indicates whether the pending MCP headers refresh response was accepted. /// ///
/// @@ -22618,12 +24074,12 @@ pub struct SessionTasksRefreshResult {} ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionTasksWaitForPendingParams { - /// Target session identifier - pub session_id: SessionId, +pub struct SessionMcpHeadersHandlePendingHeadersRefreshRequestResult { + /// Whether the response was accepted. False if the request was unknown, timed out, or already resolved. + pub success: bool, } -/// 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). +/// Resource contents returned by the MCP server. /// ///
/// @@ -22633,9 +24089,12 @@ pub struct SessionTasksWaitForPendingParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionTasksWaitForPendingResult {} +pub struct SessionMcpAppsReadResourceResult { + /// Resource contents returned by the server + pub contents: Vec, +} -/// Progress information for the task, or null when no task with that ID is tracked. +/// App-callable tools from the named MCP server. /// ///
/// @@ -22645,9 +24104,9 @@ pub struct SessionTasksWaitForPendingResult {} ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionTasksGetProgressResult { - /// Progress information for the task, discriminated by type. Returns null when no task with this ID is currently tracked. - pub progress: Option, +pub struct SessionMcpAppsListToolsResult { + /// App-callable tools from the server + pub tools: Vec>, } /// Identifies the target session. @@ -22660,12 +24119,12 @@ pub struct SessionTasksGetProgressResult { /// #[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionTasksGetCurrentPromotableParams { +pub struct SessionMcpAppsGetHostContextParams { /// Target session identifier pub session_id: SessionId, } -/// The first sync-waiting task that can currently be promoted to background mode. +/// Current host context advertised to MCP App guests. /// ///
/// @@ -22675,13 +24134,12 @@ pub struct SessionTasksGetCurrentPromotableParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionTasksGetCurrentPromotableResult { - /// 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. - #[serde(skip_serializing_if = "Option::is_none")] - pub task: Option, +pub struct SessionMcpAppsGetHostContextResult { + /// Current host context + pub context: McpAppsHostContextDetails, } -/// Indicates whether the task was successfully promoted to background mode. +/// Diagnostic snapshot of MCP Apps wiring for the named server. /// ///
/// @@ -22691,12 +24149,14 @@ pub struct SessionTasksGetCurrentPromotableResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionTasksPromoteToBackgroundResult { - /// Whether the task was successfully promoted to background mode - pub promoted: bool, +pub struct SessionMcpAppsDiagnoseResult { + /// Capability negotiation snapshot + pub capability: McpAppsDiagnoseCapability, + /// What the server returned for this session + pub server: McpAppsDiagnoseServer, } -/// Identifies the target session. +/// Resource contents returned by the MCP server. /// ///
/// @@ -22706,12 +24166,12 @@ pub struct SessionTasksPromoteToBackgroundResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionTasksPromoteCurrentToBackgroundParams { - /// Target session identifier - pub session_id: SessionId, +pub struct SessionMcpResourcesReadResult { + /// Resource contents returned by the server + pub contents: Vec, } -/// The promoted task as it now exists in background mode, omitted if no promotable task was waiting. +/// One page of resources advertised by the named MCP server. /// ///
/// @@ -22721,13 +24181,15 @@ pub struct SessionTasksPromoteCurrentToBackgroundParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionTasksPromoteCurrentToBackgroundResult { - /// 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. +pub struct SessionMcpResourcesListResult { + /// Opaque cursor for the next page, if the server has more resources #[serde(skip_serializing_if = "Option::is_none")] - pub task: Option, + pub next_cursor: Option, + /// Resources advertised by the server (proxied MCP `resources/list`) + pub resources: Vec, } -/// Indicates whether the background task was successfully cancelled. +/// One page of resource templates advertised by the named MCP server. /// ///
/// @@ -22737,12 +24199,15 @@ pub struct SessionTasksPromoteCurrentToBackgroundResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionTasksCancelResult { - /// Whether the task was successfully cancelled - pub cancelled: bool, +pub struct SessionMcpResourcesListTemplatesResult { + /// Opaque cursor for the next page, if the server has more resource templates + #[serde(skip_serializing_if = "Option::is_none")] + pub next_cursor: Option, + /// Resource templates advertised by the server (proxied MCP `resources/templates/list`) + pub resource_templates: Vec, } -/// Indicates whether the task was removed. False when the task does not exist or is still running/idle. +/// Identifies the target session. /// ///
/// @@ -22752,12 +24217,12 @@ pub struct SessionTasksCancelResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionTasksRemoveResult { - /// Whether the task was removed. Returns false if the task does not exist or is still running/idle (cancel it first). - pub removed: bool, +pub struct SessionPluginsListParams { + /// Target session identifier + pub session_id: SessionId, } -/// Indicates whether the message was delivered, with an error message when delivery failed. +/// Plugins installed for the session, with their enabled state and version metadata. /// ///
/// @@ -22767,15 +24232,12 @@ pub struct SessionTasksRemoveResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionTasksSendMessageResult { - /// Error message if delivery failed - #[serde(skip_serializing_if = "Option::is_none")] - pub error: Option, - /// Whether the message was successfully delivered or steered - pub sent: bool, +pub struct SessionPluginsListResult { + /// Installed plugins + pub plugins: Vec, } -/// Identifies the target session. +/// A snapshot of the provider endpoint the session is currently configured to talk to. /// ///
/// @@ -22785,12 +24247,28 @@ pub struct SessionTasksSendMessageResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionSkillsListParams { - /// Target session identifier - pub session_id: SessionId, +pub struct SessionProviderGetEndpointResult { + /// A credential the caller should use with this endpoint. Omitted only when the endpoint accepts unauthenticated requests. + #[serde(skip_serializing_if = "Option::is_none")] + pub api_key: Option, + /// Base URL to pass to the LLM client library. + pub base_url: String, + /// HTTP headers the caller must include on every outbound request. + pub headers: HashMap, + /// 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. + #[serde(skip_serializing_if = "Option::is_none")] + pub session_token: Option, + /// Transport to be used for provider requests. + #[serde(skip_serializing_if = "Option::is_none")] + pub transport: Option, + /// Provider family. Matches the `type` field of a BYOK provider config. + pub r#type: ProviderEndpointType, + /// Wire API to be used, when required for the provider type. + #[serde(skip_serializing_if = "Option::is_none")] + pub wire_api: Option, } -/// Skills available to the session, with their enabled state. +/// The selectable model entries synthesized for the models added by this call. /// ///
/// @@ -22800,12 +24278,12 @@ pub struct SessionSkillsListParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionSkillsListResult { - /// Available skills - pub skills: Vec, +pub struct SessionProviderAddResult { + /// 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. + pub models: Vec, } -/// Identifies the target session. +/// Indicates whether the session options patch was applied successfully. /// ///
/// @@ -22815,12 +24293,15 @@ pub struct SessionSkillsListResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionSkillsGetInvokedParams { - /// Target session identifier - pub session_id: SessionId, +pub struct SessionOptionsUpdateResult { + /// Number of hooks loaded from installed plugins, returned when installedPlugins is updated + #[serde(skip_serializing_if = "Option::is_none")] + pub plugin_hook_count: Option, + /// Whether the operation succeeded + pub success: bool, } -/// Skills invoked during this session, ordered by invocation time (most recent last). +/// Identifies the target session. /// ///
/// @@ -22830,12 +24311,12 @@ pub struct SessionSkillsGetInvokedParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionSkillsGetInvokedResult { - /// Skills invoked during this session, ordered by invocation time (most recent last) - pub skills: Vec, +pub struct SessionExtensionsListParams { + /// Target session identifier + pub session_id: SessionId, } -/// Identifies the target session. +/// Extensions discovered for the session, with their current status. /// ///
/// @@ -22845,12 +24326,12 @@ pub struct SessionSkillsGetInvokedResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionSkillsReloadParams { - /// Target session identifier - pub session_id: SessionId, +pub struct SessionExtensionsListResult { + /// Discovered extensions and their current status + pub extensions: Vec, } -/// Diagnostics from reloading skill definitions, with warnings and errors as separate lists. +/// Identifies the target session. /// ///
/// @@ -22860,14 +24341,12 @@ pub struct SessionSkillsReloadParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionSkillsReloadResult { - /// Errors emitted while loading skills (e.g. skills that failed to load entirely) - pub errors: Vec, - /// Warnings emitted while loading skills (e.g. skills that loaded but had issues) - pub warnings: Vec, +pub struct SessionExtensionsReloadParams { + /// Target session identifier + pub session_id: SessionId, } -/// Identifies the target session. +/// Rust-owned built-in tool descriptors for the session. /// ///
/// @@ -22877,12 +24356,12 @@ pub struct SessionSkillsReloadResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionSkillsEnsureLoadedParams { - /// Target session identifier - pub session_id: SessionId, +pub struct SessionToolsGetBuiltinDescriptorsResult { + /// Built-in tool descriptors materialized for the session. + pub tools: Vec, } -/// Identifies the target session. +/// Task completion notification with summary from the agent /// ///
/// @@ -22892,12 +24371,25 @@ pub struct SessionSkillsEnsureLoadedParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionMcpListParams { - /// Target session identifier - pub session_id: SessionId, +pub struct SessionToolsTaskCompleteEventDataResult { + /// Active autopilot objective ID evaluated by the completion reviewer + #[serde(skip_serializing_if = "Option::is_none")] + pub objective_id: Option, + /// Semantic completion decision. Absent on legacy events and invalid tool calls + #[serde(skip_serializing_if = "Option::is_none")] + pub outcome: Option, + /// 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 + #[serde(skip_serializing_if = "Option::is_none")] + pub reason: Option, + /// Whether the task was accepted as complete. False when validation failed or completion was rejected or blocked by the reviewer + #[serde(skip_serializing_if = "Option::is_none")] + pub success: Option, + /// Summary of the completed task, provided by the agent + #[serde(skip_serializing_if = "Option::is_none")] + pub summary: Option, } -/// MCP servers configured for the session, with their connection status and host-level state. +/// Indicates whether the external tool call result was handled successfully. /// ///
/// @@ -22907,15 +24399,12 @@ pub struct SessionMcpListParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionMcpListResult { - /// Host-level state, omitted when no MCP host is initialized. - #[serde(skip_serializing_if = "Option::is_none")] - pub host: Option, - /// Configured MCP servers - pub servers: Vec, +pub struct SessionToolsHandlePendingToolCallResult { + /// Whether the tool call result was handled successfully + pub success: bool, } -/// Tools exposed by the connected MCP server. Throws when the server is not connected. +/// Identifies the target session. /// ///
/// @@ -22925,12 +24414,12 @@ pub struct SessionMcpListResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionMcpListToolsResult { - /// Tools exposed by the server. - pub tools: Vec, +pub struct SessionToolsInitializeAndValidateParams { + /// Target session identifier + pub session_id: SessionId, } -/// Identifies the target session. +/// 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. /// ///
/// @@ -22940,12 +24429,9 @@ pub struct SessionMcpListToolsResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionMcpReloadParams { - /// Target session identifier - pub session_id: SessionId, -} +pub struct SessionToolsInitializeAndValidateResult {} -/// MCP server startup filtering result. +/// Identifies the target session. /// ///
/// @@ -22955,18 +24441,12 @@ pub struct SessionMcpReloadParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionMcpReloadWithConfigResult { - /// Non-default servers allowed by policy - #[serde(skip_serializing_if = "Option::is_none")] - pub allowed_servers: Option>, - /// Servers whose connection attempt failed. - #[serde(skip_serializing_if = "Option::is_none")] - pub failed_servers: Option>, - /// Servers filtered out before startup - pub filtered_servers: Vec, +pub struct SessionToolsGetCurrentMetadataParams { + /// Target session identifier + pub session_id: SessionId, } -/// Outcome of an MCP sampling execution: success result, failure error, or cancellation. +/// Current lightweight tool metadata snapshot for the session. /// ///
/// @@ -22976,18 +24456,12 @@ pub struct SessionMcpReloadWithConfigResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionMcpExecuteSamplingResult { - /// 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. - pub action: McpSamplingExecutionAction, - /// Error description, present when action='failure'. - #[serde(skip_serializing_if = "Option::is_none")] - pub error: Option, - /// 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. - #[serde(skip_serializing_if = "Option::is_none")] - pub result: Option, +pub struct SessionToolsGetCurrentMetadataResult { + /// Current tool metadata, or null when tools have not been initialized yet + pub tools: Option>, } -/// Indicates whether an in-flight sampling execution with the given requestId was found and cancelled. +/// Empty result after replacing the calling connection's externally implemented tools. /// ///
/// @@ -22997,12 +24471,9 @@ pub struct SessionMcpExecuteSamplingResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionMcpCancelSamplingExecutionResult { - /// 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). - pub cancelled: bool, -} +pub struct SessionToolsSetResult {} -/// Env-value mode recorded on the session after the update. +/// Empty result after applying subagent settings /// ///
/// @@ -23012,12 +24483,9 @@ pub struct SessionMcpCancelSamplingExecutionResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionMcpSetEnvValueModeResult { - /// Mode recorded on the session after the update - pub mode: McpSetEnvValueModeDetails, -} +pub struct SessionToolsUpdateSubagentSettingsResult {} -/// Identifies the target session. +/// Slash commands available in the session, after applying any include/exclude filters. /// ///
/// @@ -23027,12 +24495,12 @@ pub struct SessionMcpSetEnvValueModeResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionMcpRemoveGitHubParams { - /// Target session identifier - pub session_id: SessionId, +pub struct SessionCommandsListResult { + /// Commands available in this session + pub commands: Vec, } -/// Indicates whether the auto-managed `github` MCP server was removed (false when nothing to remove). +/// Whether finalizing the invocation effect succeeded, and the failure reason when it did not. /// ///
/// @@ -23042,12 +24510,15 @@ pub struct SessionMcpRemoveGitHubParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionMcpRemoveGitHubResult { - /// 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). - pub removed: bool, +pub struct SessionCommandsFinalizeInvocationEffectResult { + /// Failure reason when the invocation effect could not be finalized. + #[serde(skip_serializing_if = "Option::is_none")] + pub error: Option, + /// Whether the pending invocation effect was finalized successfully. + pub success: bool, } -/// Result of configuring GitHub MCP. +/// Indicates whether the pending client-handled command was completed successfully. /// ///
/// @@ -23057,12 +24528,12 @@ pub struct SessionMcpRemoveGitHubResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionMcpConfigureGitHubResult { - /// Whether GitHub MCP configuration changed. - pub changed: bool, +pub struct SessionCommandsHandlePendingCommandResult { + /// Whether the command was handled successfully + pub success: bool, } -/// Whether the named MCP server is running. +/// Error message produced while executing the command, if any. /// ///
/// @@ -23072,12 +24543,13 @@ pub struct SessionMcpConfigureGitHubResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionMcpIsServerRunningResult { - /// True if the server has an active client and transport. - pub running: bool, +pub struct SessionCommandsExecuteResult { + /// Error message produced while executing the command, if any. Omitted when the handler succeeded. + #[serde(skip_serializing_if = "Option::is_none")] + pub error: Option, } -/// Indicates whether the pending MCP OAuth response was accepted. +/// Indicates whether the command was accepted into the local execution queue. /// ///
/// @@ -23087,12 +24559,12 @@ pub struct SessionMcpIsServerRunningResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionMcpOauthHandlePendingRequestResult { - /// Whether the response was accepted. False if the request was unknown, timed out, or already resolved. - pub success: bool, +pub struct SessionCommandsEnqueueResult { + /// 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). + pub queued: bool, } -/// OAuth authorization URL the caller should open, or empty when cached tokens already authenticated the server. +/// Indicates whether the queued-command response was matched to a pending request. /// ///
/// @@ -23102,13 +24574,12 @@ pub struct SessionMcpOauthHandlePendingRequestResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionMcpOauthLoginResult { - /// 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. - #[serde(skip_serializing_if = "Option::is_none")] - pub authorization_url: Option, +pub struct SessionCommandsRespondToQueuedCommandResult { + /// Whether a pending queued command with the given request ID was found and resolved. False when the request was already resolved, cancelled, or unknown. + pub success: bool, } -/// Indicates whether the pending MCP OAuth response was accepted. +/// Identifies the target session. /// ///
/// @@ -23118,12 +24589,12 @@ pub struct SessionMcpOauthLoginResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionMcpOauthRespondResult { - /// Whether the response was accepted. False if the request was unknown, timed out, or already resolved. - pub success: bool, +pub struct SessionTelemetryGetEngagementIdParams { + /// Target session identifier + pub session_id: SessionId, } -/// Indicates whether the pending MCP headers refresh response was accepted. +/// Telemetry engagement ID for the session, when available. /// ///
/// @@ -23133,12 +24604,13 @@ pub struct SessionMcpOauthRespondResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionMcpHeadersHandlePendingHeadersRefreshRequestResult { - /// Whether the response was accepted. False if the request was unknown, timed out, or already resolved. - pub success: bool, +pub struct SessionTelemetryGetEngagementIdResult { + /// Current telemetry engagement ID, when available. + #[serde(skip_serializing_if = "Option::is_none")] + pub engagement_id: Option, } -/// Resource contents returned by the MCP server. +/// Completed transient query. Ordered chunks and the terminal outcome are also delivered through `ui.ephemeral_query` session events while it runs. /// ///
/// @@ -23148,12 +24620,12 @@ pub struct SessionMcpHeadersHandlePendingHeadersRefreshRequestResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionMcpAppsReadResourceResult { - /// Resource contents returned by the server - pub contents: Vec, +pub struct SessionUiEphemeralQueryResult { + /// Answer returned by the model + pub answer: String, } -/// App-callable tools from the named MCP server. +/// The elicitation response (accept with form values, decline, or cancel) /// ///
/// @@ -23163,12 +24635,18 @@ pub struct SessionMcpAppsReadResourceResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionMcpAppsListToolsResult { - /// App-callable tools from the server - pub tools: Vec>, +pub struct SessionUiElicitationResult { + /// MCP response metadata. + #[serde(rename = "_meta", skip_serializing_if = "Option::is_none")] + pub meta: Option>, + /// The user's response: accept (submitted), decline (rejected), or cancel (dismissed) + pub action: UIElicitationResponseAction, + /// The form values submitted by the user (present when action is 'accept') + #[serde(skip_serializing_if = "Option::is_none")] + pub content: Option>, } -/// Identifies the target session. +/// Indicates whether the elicitation response was accepted; false if it was already resolved by another client. /// ///
/// @@ -23178,12 +24656,12 @@ pub struct SessionMcpAppsListToolsResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionMcpAppsGetHostContextParams { - /// Target session identifier - pub session_id: SessionId, +pub struct SessionUiHandlePendingElicitationResult { + /// Whether the response was accepted. False if the request was already resolved by another client. + pub success: bool, } -/// Current host context advertised to MCP App guests. +/// Indicates whether the pending UI request was resolved by this call. /// ///
/// @@ -23193,12 +24671,12 @@ pub struct SessionMcpAppsGetHostContextParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionMcpAppsGetHostContextResult { - /// Current host context - pub context: McpAppsHostContextDetails, +pub struct SessionUiHandlePendingUserInputResult { + /// 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. + pub success: bool, } -/// Diagnostic snapshot of MCP Apps wiring for the named server. +/// Indicates whether the pending UI request was resolved by this call. /// ///
/// @@ -23208,14 +24686,12 @@ pub struct SessionMcpAppsGetHostContextResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionMcpAppsDiagnoseResult { - /// Capability negotiation snapshot - pub capability: McpAppsDiagnoseCapability, - /// What the server returned for this session - pub server: McpAppsDiagnoseServer, +pub struct SessionUiHandlePendingSamplingResult { + /// 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. + pub success: bool, } -/// Resource contents returned by the MCP server. +/// Indicates whether the pending UI request was resolved by this call. /// ///
/// @@ -23225,12 +24701,12 @@ pub struct SessionMcpAppsDiagnoseResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionMcpResourcesReadResult { - /// Resource contents returned by the server - pub contents: Vec, +pub struct SessionUiHandlePendingAutoModeSwitchResult { + /// 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. + pub success: bool, } -/// One page of resources advertised by the named MCP server. +/// Indicates whether the pending UI request was resolved by this call. /// ///
/// @@ -23240,15 +24716,12 @@ pub struct SessionMcpResourcesReadResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionMcpResourcesListResult { - /// Opaque cursor for the next page, if the server has more resources - #[serde(skip_serializing_if = "Option::is_none")] - pub next_cursor: Option, - /// Resources advertised by the server (proxied MCP `resources/list`) - pub resources: Vec, +pub struct SessionUiHandlePendingSessionLimitsExhaustedResult { + /// 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. + pub success: bool, } -/// One page of resource templates advertised by the named MCP server. +/// Indicates whether the pending UI request was resolved by this call. /// ///
/// @@ -23258,12 +24731,9 @@ pub struct SessionMcpResourcesListResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionMcpResourcesListTemplatesResult { - /// Opaque cursor for the next page, if the server has more resource templates - #[serde(skip_serializing_if = "Option::is_none")] - pub next_cursor: Option, - /// Resource templates advertised by the server (proxied MCP `resources/templates/list`) - pub resource_templates: Vec, +pub struct SessionUiHandlePendingExitPlanModeResult { + /// 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. + pub success: bool, } /// Identifies the target session. @@ -23276,12 +24746,12 @@ pub struct SessionMcpResourcesListTemplatesResult { /// #[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionPluginsListParams { +pub struct SessionUiRegisterDirectAutoModeSwitchHandlerParams { /// Target session identifier pub session_id: SessionId, } -/// Plugins installed for the session, with their enabled state and version metadata. +/// 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). /// ///
/// @@ -23291,12 +24761,12 @@ pub struct SessionPluginsListParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionPluginsListResult { - /// Installed plugins - pub plugins: Vec, +pub struct SessionUiRegisterDirectAutoModeSwitchHandlerResult { + /// 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. + pub handle: String, } -/// A snapshot of the provider endpoint the session is currently configured to talk to. +/// Indicates whether the handle was active and the registration count was decremented. /// ///
/// @@ -23306,28 +24776,12 @@ pub struct SessionPluginsListResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionProviderGetEndpointResult { - /// A credential the caller should use with this endpoint. Omitted only when the endpoint accepts unauthenticated requests. - #[serde(skip_serializing_if = "Option::is_none")] - pub api_key: Option, - /// Base URL to pass to the LLM client library. - pub base_url: String, - /// HTTP headers the caller must include on every outbound request. - pub headers: HashMap, - /// 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. - #[serde(skip_serializing_if = "Option::is_none")] - pub session_token: Option, - /// Transport to be used for provider requests. - #[serde(skip_serializing_if = "Option::is_none")] - pub transport: Option, - /// Provider family. Matches the `type` field of a BYOK provider config. - pub r#type: ProviderEndpointType, - /// Wire API to be used, when required for the provider type. - #[serde(skip_serializing_if = "Option::is_none")] - pub wire_api: Option, +pub struct SessionUiUnregisterDirectAutoModeSwitchHandlerResult { + /// True if the handle was active and decremented the counter; false if the handle was unknown. + pub unregistered: bool, } -/// The selectable model entries synthesized for the models added by this call. +/// Indicates whether the operation succeeded. /// ///
/// @@ -23337,12 +24791,12 @@ pub struct SessionProviderGetEndpointResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionProviderAddResult { - /// 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. - pub models: Vec, +pub struct SessionPermissionsConfigureResult { + /// Whether the operation succeeded + pub success: bool, } -/// Indicates whether the session options patch was applied successfully. +/// Indicates whether the permission decision was applied; false when the request was already resolved. /// ///
/// @@ -23352,15 +24806,12 @@ pub struct SessionProviderAddResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionOptionsUpdateResult { - /// Number of hooks loaded from installed plugins, returned when installedPlugins is updated - #[serde(skip_serializing_if = "Option::is_none")] - pub plugin_hook_count: Option, - /// Whether the operation succeeded +pub struct SessionPermissionsHandlePendingPermissionRequestResult { + /// Whether the permission request was handled successfully pub success: bool, } -/// Identifies the target session. +/// List of pending permission requests reconstructed from event history. /// ///
/// @@ -23370,12 +24821,12 @@ pub struct SessionOptionsUpdateResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionExtensionsListParams { - /// Target session identifier - pub session_id: SessionId, +pub struct SessionPermissionsPendingRequestsResult { + /// Pending permission prompts reconstructed from the session's event history. Equivalent to the set of `permission.requested` events that have not yet been followed by a matching `permission.completed` event. Used by clients (e.g. the CLI) to hydrate UI for prompts that were emitted before the client attached to the session. + pub items: Vec, } -/// Extensions discovered for the session, with their current status. +/// Indicates whether the operation succeeded. /// ///
/// @@ -23385,12 +24836,12 @@ pub struct SessionExtensionsListParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionExtensionsListResult { - /// Discovered extensions and their current status - pub extensions: Vec, +pub struct SessionPermissionsSetApproveAllResult { + /// Whether the operation succeeded + pub success: bool, } -/// Identifies the target session. +/// Indicates whether the requested permission mode was applied and reports the authoritative post-mutation mode. /// ///
/// @@ -23400,12 +24851,14 @@ pub struct SessionExtensionsListResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionExtensionsReloadParams { - /// Target session identifier - pub session_id: SessionId, +pub struct SessionPermissionsSetModeResult { + /// Authoritative permission mode after the mutation + pub mode: PermissionMode, + /// Whether the operation succeeded + pub success: bool, } -/// Rust-owned built-in tool descriptors for the session. +/// Current permission mode. /// ///
/// @@ -23415,12 +24868,12 @@ pub struct SessionExtensionsReloadParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionToolsGetBuiltinDescriptorsResult { - /// Built-in tool descriptors materialized for the session. - pub tools: Vec, +pub struct SessionPermissionsGetModeResult { + /// Current permission mode + pub mode: PermissionMode, } -/// Task completion notification with summary from the agent +/// Indicates whether the operation succeeded. /// ///
/// @@ -23430,25 +24883,12 @@ pub struct SessionToolsGetBuiltinDescriptorsResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionToolsTaskCompleteEventDataResult { - /// Active autopilot objective ID evaluated by the completion reviewer - #[serde(skip_serializing_if = "Option::is_none")] - pub objective_id: Option, - /// Semantic completion decision. Absent on legacy events and invalid tool calls - #[serde(skip_serializing_if = "Option::is_none")] - pub outcome: Option, - /// 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 - #[serde(skip_serializing_if = "Option::is_none")] - pub reason: Option, - /// Whether the task was accepted as complete. False when validation failed or completion was rejected or blocked by the reviewer - #[serde(skip_serializing_if = "Option::is_none")] - pub success: Option, - /// Summary of the completed task, provided by the agent - #[serde(skip_serializing_if = "Option::is_none")] - pub summary: Option, +pub struct SessionPermissionsModifyRulesResult { + /// Whether the operation succeeded + pub success: bool, } -/// Indicates whether the external tool call result was handled successfully. +/// Indicates whether the operation succeeded. /// ///
/// @@ -23458,12 +24898,12 @@ pub struct SessionToolsTaskCompleteEventDataResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionToolsHandlePendingToolCallResult { - /// Whether the tool call result was handled successfully +pub struct SessionPermissionsSetRequiredResult { + /// Whether the operation succeeded pub success: bool, } -/// Identifies the target session. +/// Indicates whether the operation succeeded. /// ///
/// @@ -23473,12 +24913,12 @@ pub struct SessionToolsHandlePendingToolCallResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionToolsInitializeAndValidateParams { - /// Target session identifier - pub session_id: SessionId, +pub struct SessionPermissionsResetSessionApprovalsResult { + /// Whether the operation succeeded + pub success: bool, } -/// 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. +/// Indicates whether the operation succeeded. /// ///
/// @@ -23488,9 +24928,12 @@ pub struct SessionToolsInitializeAndValidateParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionToolsInitializeAndValidateResult {} +pub struct SessionPermissionsNotifyPromptShownResult { + /// Whether the operation succeeded + pub success: bool, +} -/// Identifies the target session. +/// Snapshot of the session's allow-listed directories and primary working directory. /// ///
/// @@ -23500,12 +24943,14 @@ pub struct SessionToolsInitializeAndValidateResult {} ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionToolsGetCurrentMetadataParams { - /// Target session identifier - pub session_id: SessionId, +pub struct SessionPermissionsPathsListResult { + /// All directories currently allowed for tool access on this session. + pub directories: Vec, + /// The primary working directory for this session. + pub primary: String, } -/// Current lightweight tool metadata snapshot for the session. +/// Indicates whether the operation succeeded. /// ///
/// @@ -23515,12 +24960,12 @@ pub struct SessionToolsGetCurrentMetadataParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionToolsGetCurrentMetadataResult { - /// Current tool metadata, or null when tools have not been initialized yet - pub tools: Option>, +pub struct SessionPermissionsPathsAddResult { + /// Whether the operation succeeded + pub success: bool, } -/// Empty result after replacing the calling connection's externally implemented tools. +/// Indicates whether the operation succeeded. /// ///
/// @@ -23530,9 +24975,12 @@ pub struct SessionToolsGetCurrentMetadataResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionToolsSetResult {} +pub struct SessionPermissionsPathsUpdatePrimaryResult { + /// Whether the operation succeeded + pub success: bool, +} -/// Empty result after applying subagent settings +/// Indicates whether the supplied path is within the session's allowed directories. /// ///
/// @@ -23542,9 +24990,12 @@ pub struct SessionToolsSetResult {} ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionToolsUpdateSubagentSettingsResult {} +pub struct SessionPermissionsPathsIsPathWithinAllowedDirectoriesResult { + /// Whether the path is within the session's allowed directories + pub allowed: bool, +} -/// Slash commands available in the session, after applying any include/exclude filters. +/// Indicates whether the supplied path is within the session's workspace directory. /// ///
/// @@ -23554,12 +25005,12 @@ pub struct SessionToolsUpdateSubagentSettingsResult {} ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionCommandsListResult { - /// Commands available in this session - pub commands: Vec, +pub struct SessionPermissionsPathsIsPathWithinWorkspaceResult { + /// Whether the path is within the session workspace directory + pub allowed: bool, } -/// Whether finalizing the invocation effect succeeded, and the failure reason when it did not. +/// Resolved location-permissions key and type. /// ///
/// @@ -23569,15 +25020,14 @@ pub struct SessionCommandsListResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionCommandsFinalizeInvocationEffectResult { - /// Failure reason when the invocation effect could not be finalized. - #[serde(skip_serializing_if = "Option::is_none")] - pub error: Option, - /// Whether the pending invocation effect was finalized successfully. - pub success: bool, +pub struct SessionPermissionsLocationsResolveResult { + /// Location key used in the location-permissions store + pub location_key: String, + /// Whether the location is a git repo or directory + pub location_type: PermissionLocationType, } -/// Indicates whether the pending client-handled command was completed successfully. +/// Summary of persisted location permissions applied to the session. /// ///
/// @@ -23587,12 +25037,22 @@ pub struct SessionCommandsFinalizeInvocationEffectResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionCommandsHandlePendingCommandResult { - /// Whether the command was handled successfully - pub success: bool, +pub struct SessionPermissionsLocationsApplyResult { + /// Number of persisted allowed directories added to the live path manager + pub applied_directory_count: i64, + /// Number of location-scoped rules added to the live permission service + pub applied_rule_count: i64, + /// Location-scoped rules applied to the live permission service + pub applied_rules: Vec, + /// Whether a different location was applied since the previous apply call + pub changed: bool, + /// Location key used in the location-permissions store + pub location_key: String, + /// Whether the location is a git repo or directory + pub location_type: PermissionLocationType, } -/// Error message produced while executing the command, if any. +/// Indicates whether the operation succeeded. /// ///
/// @@ -23602,13 +25062,12 @@ pub struct SessionCommandsHandlePendingCommandResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionCommandsExecuteResult { - /// Error message produced while executing the command, if any. Omitted when the handler succeeded. - #[serde(skip_serializing_if = "Option::is_none")] - pub error: Option, +pub struct SessionPermissionsLocationsAddToolApprovalResult { + /// Whether the operation succeeded + pub success: bool, } -/// Indicates whether the command was accepted into the local execution queue. +/// Folder trust check result. /// ///
/// @@ -23618,12 +25077,12 @@ pub struct SessionCommandsExecuteResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionCommandsEnqueueResult { - /// 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). - pub queued: bool, +pub struct SessionPermissionsFolderTrustIsTrustedResult { + /// Whether the folder is trusted + pub trusted: bool, } -/// Indicates whether the queued-command response was matched to a pending request. +/// Indicates whether the operation succeeded. /// ///
/// @@ -23633,12 +25092,12 @@ pub struct SessionCommandsEnqueueResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionCommandsRespondToQueuedCommandResult { - /// Whether a pending queued command with the given request ID was found and resolved. False when the request was already resolved, cancelled, or unknown. +pub struct SessionPermissionsFolderTrustAddTrustedResult { + /// Whether the operation succeeded pub success: bool, } -/// Identifies the target session. +/// Indicates whether the operation succeeded. /// ///
/// @@ -23648,12 +25107,12 @@ pub struct SessionCommandsRespondToQueuedCommandResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionTelemetryGetEngagementIdParams { - /// Target session identifier - pub session_id: SessionId, +pub struct SessionPermissionsUrlsSetUnrestrictedModeResult { + /// Whether the operation succeeded + pub success: bool, } -/// Telemetry engagement ID for the session, when available. +/// Identifier of the session event that was emitted for the log message. /// ///
/// @@ -23663,13 +25122,12 @@ pub struct SessionTelemetryGetEngagementIdParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionTelemetryGetEngagementIdResult { - /// Current telemetry engagement ID, when available. - #[serde(skip_serializing_if = "Option::is_none")] - pub engagement_id: Option, +pub struct SessionLogResult { + /// The unique identifier of the emitted session event + pub event_id: String, } -/// Completed transient query. Ordered chunks and the terminal outcome are also delivered through `ui.ephemeral_query` session events while it runs. +/// Identifies the target session. /// ///
/// @@ -23679,12 +25137,47 @@ pub struct SessionTelemetryGetEngagementIdResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionUiEphemeralQueryResult { - /// Answer returned by the model - pub answer: String, +pub struct SessionMetadataSnapshotParams { + /// Target session identifier + pub session_id: SessionId, } -/// The elicitation response (accept with form values, decline, or cancel) +/// Public-facing projection of workspace metadata for SDK / TUI consumers +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionMetadataSnapshotResultWorkspace { + /// Branch checked out at session start, if any + #[serde(skip_serializing_if = "Option::is_none")] + pub branch: Option, + /// ISO 8601 timestamp when the workspace was created + #[serde(rename = "created_at", skip_serializing_if = "Option::is_none")] + pub created_at: Option, + /// Current working directory at session start + #[serde(skip_serializing_if = "Option::is_none")] + pub cwd: Option, + /// Resolved git root for cwd, if any + #[serde(rename = "git_root", skip_serializing_if = "Option::is_none")] + pub git_root: Option, + /// Repository host type, if known + #[serde(rename = "host_type", skip_serializing_if = "Option::is_none")] + pub host_type: Option, + /// Workspace identifier (1:1 with sessionId) + pub id: String, + /// Display name for the session, if set + #[serde(skip_serializing_if = "Option::is_none")] + pub name: Option, + /// Repository identifier in 'owner/repo' or 'org/project/repo' format, if any + #[serde(skip_serializing_if = "Option::is_none")] + pub repository: Option, + /// ISO 8601 timestamp when the workspace was last updated + #[serde(rename = "updated_at", skip_serializing_if = "Option::is_none")] + pub updated_at: Option, + /// Whether the display name was explicitly set by the user + #[serde(rename = "user_named", skip_serializing_if = "Option::is_none")] + pub user_named: Option, +} + +/// Point-in-time snapshot of slow-changing session identifier and state fields /// ///
/// @@ -23694,18 +25187,45 @@ pub struct SessionUiEphemeralQueryResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionUiElicitationResult { - /// MCP response metadata. - #[serde(rename = "_meta", skip_serializing_if = "Option::is_none")] - pub meta: Option>, - /// The user's response: accept (submitted), decline (rejected), or cancel (dismissed) - pub action: UIElicitationResponseAction, - /// The form values submitted by the user (present when action is 'accept') +pub struct SessionMetadataSnapshotResult { + /// True when the session was detected to be in use by another process at construction time. Local consumers may surface a confirmation prompt before fully attaching. Always false for new sessions. + pub already_in_use: bool, + /// Runtime client name associated with the session (telemetry identifier). + #[serde(skip_serializing_if = "Option::is_none")] + pub client_name: Option, + /// The current agent mode for this session (e.g., 'interactive', 'plan', 'autopilot') + pub current_mode: MetadataSnapshotCurrentMode, + /// User-provided name supplied at session construction (via `--name`), if any. Immutable after construction. + #[serde(skip_serializing_if = "Option::is_none")] + pub initial_name: Option, + /// Whether this is a remote session (i.e., one whose runtime executes elsewhere and is steered through this process) + pub is_remote: bool, + /// ISO 8601 timestamp of when the session's persisted state was last modified on disk. For new sessions, equals startTime. For resumed sessions, reflects the previous modification time at construction. + pub modified_time: String, + /// Remote-session-specific metadata. Populated only when `isRemote` is true. Fields are immutable for the lifetime of the session. + #[serde(skip_serializing_if = "Option::is_none")] + pub remote_metadata: Option, + /// Currently selected model identifier, if any + #[serde(skip_serializing_if = "Option::is_none")] + pub selected_model: Option, + /// The unique identifier of the session + pub session_id: SessionId, + /// Current session limits, or null when no limits are active + pub session_limits: Option, + /// ISO 8601 timestamp of when the session started + pub start_time: String, + /// Short human-readable summary of the session, if known. Omitted when no summary has been generated. #[serde(skip_serializing_if = "Option::is_none")] - pub content: Option>, + pub summary: Option, + /// Absolute path to the session's current working directory + pub working_directory: String, + /// Public-facing workspace metadata for this session, or null if the session has no associated workspace. Excludes runtime-internal fields (GitHub IDs, summary count, internal flags). + pub workspace: Option, + /// Absolute path to the session's workspace directory on disk, or null if the session has no associated workspace + pub workspace_path: Option, } -/// Indicates whether the elicitation response was accepted; false if it was already resolved by another client. +/// Identifies the target session. /// ///
/// @@ -23715,12 +25235,12 @@ pub struct SessionUiElicitationResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionUiHandlePendingElicitationResult { - /// Whether the response was accepted. False if the request was already resolved by another client. - pub success: bool, +pub struct SessionMetadataIsProcessingParams { + /// Target session identifier + pub session_id: SessionId, } -/// Indicates whether the pending UI request was resolved by this call. +/// Indicates whether the local session is currently processing a turn or background continuation. /// ///
/// @@ -23730,12 +25250,12 @@ pub struct SessionUiHandlePendingElicitationResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionUiHandlePendingUserInputResult { - /// 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. - pub success: bool, +pub struct SessionMetadataIsProcessingResult { + /// Whether the session is currently processing user/agent messages. False for non-local sessions (which don't run a local agentic loop). Reflects an in-flight turn or background continuation. + pub processing: bool, } -/// Indicates whether the pending UI request was resolved by this call. +/// Identifies the target session. /// ///
/// @@ -23745,12 +25265,12 @@ pub struct SessionUiHandlePendingUserInputResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionUiHandlePendingSamplingResult { - /// 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. - pub success: bool, +pub struct SessionMetadataActivityParams { + /// Target session identifier + pub session_id: SessionId, } -/// Indicates whether the pending UI request was resolved by this call. +/// Current activity flags for the session. /// ///
/// @@ -23760,27 +25280,40 @@ pub struct SessionUiHandlePendingSamplingResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionUiHandlePendingAutoModeSwitchResult { - /// 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. - pub success: bool, +pub struct SessionMetadataActivityResult { + /// Whether an in-flight operation can currently be aborted. + pub abortable: bool, + /// Whether the session currently has active work, including running turns or tasks. + pub has_active_work: bool, } -/// Indicates whether the pending UI request was resolved by this call. -/// -///
-/// -/// **Experimental.** This type is part of an experimental wire-protocol surface -/// and may change or be removed in future SDK or CLI releases. -/// -///
+/// Token-usage breakdown for the session's current context window #[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionUiHandlePendingSessionLimitsExhaustedResult { - /// 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. - pub success: bool, +pub struct SessionMetadataContextInfoResultContextInfo { + /// Output reserve plus tokens after the buffer-exhaustion blocking threshold (default 95%) + pub buffer_tokens: i64, + /// Token count at which background compaction starts (configurable percentage of promptTokenLimit) + pub compaction_threshold: i64, + /// Tokens consumed by user/assistant/tool messages + pub conversation_tokens: i64, + /// Prompt token limit plus the model's full output token limit. + pub limit: i64, + /// Tokens consumed by MCP tool definitions (subset of toolDefinitionsTokens, excludes deferred tools) + pub mcp_tools_tokens: i64, + /// The model used for token counting + pub model_name: String, + /// Maximum prompt tokens allowed by the model (or DEFAULT_TOKEN_LIMIT if unspecified) + pub prompt_token_limit: i64, + /// Tokens consumed by the system prompt + pub system_tokens: i64, + /// Tokens consumed by tool definitions sent to the model (excludes deferred tools) + pub tool_definitions_tokens: i64, + /// Sum of system, conversation and tool-definition tokens + pub total_tokens: i64, } -/// Indicates whether the pending UI request was resolved by this call. +/// Token breakdown for the session's current context window, or null if uninitialized. /// ///
/// @@ -23790,9 +25323,9 @@ pub struct SessionUiHandlePendingSessionLimitsExhaustedResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionUiHandlePendingExitPlanModeResult { - /// 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. - pub success: bool, +pub struct SessionMetadataContextInfoResult { + /// Token breakdown for the current context window, or null if the session has not yet been initialized (no system prompt or tool metadata cached). + pub context_info: Option, } /// Identifies the target session. @@ -23805,42 +25338,85 @@ pub struct SessionUiHandlePendingExitPlanModeResult { /// #[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionUiRegisterDirectAutoModeSwitchHandlerParams { +pub struct SessionMetadataGetContextAttributionParams { /// Target session identifier pub session_id: SessionId, } -/// 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.** This type is part of an experimental wire-protocol surface -/// and may change or be removed in future SDK or CLI releases. -/// -///
+/// The six normalized `/context` header buckets, computed from the same tokenization as `entries` so the two never disagree. Convenience rollups: `freeSpace` and `buffer` describe window capacity rather than occupied context, so the values do not sum to `totalTokens`. #[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionUiRegisterDirectAutoModeSwitchHandlerResult { - /// 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. - pub handle: String, +pub struct SessionMetadataGetContextAttributionResultContextAttributionCategories { + /// Output reserve plus post-blocking-threshold buffer. + pub buffer: i64, + /// Custom-instructions tokens (0 when none are configured). + pub custom_instructions: i64, + /// Remaining unused window capacity (clamped at 0). + pub free_space: i64, + /// MCP tool-definition tokens. + pub mcp_tools: i64, + /// Conversation (user/assistant/tool) message tokens. + pub messages: i64, + /// System prompt tokens, excluding custom instructions. + pub system_prompt: i64, + /// Non-MCP tool-definition tokens. + pub system_tools: i64, } -/// Indicates whether the handle was active and the registration count was decremented. -/// -///
-/// -/// **Experimental.** This type is part of an experimental wire-protocol surface -/// and may change or be removed in future SDK or CLI releases. -/// -///
+/// Successful compaction history for the session. #[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionUiUnregisterDirectAutoModeSwitchHandlerResult { - /// True if the handle was active and decremented the counter; false if the handle was unknown. - pub unregistered: bool, +pub struct SessionMetadataGetContextAttributionResultContextAttributionCompactions { + /// Number of successful compactions in this session. + pub count: i64, } -/// Indicates whether the operation succeeded. +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionMetadataGetContextAttributionResultContextAttributionEntriesItem { + /// Supplementary per-entry metadata (e.g. `messageCount`, `role`, `evictable`, `pluginSource`). Values are stringified; parse as needed and ignore unrecognized keys. + #[serde(skip_serializing_if = "Option::is_none")] + pub attributes: Option>, + /// Identifier for this entry, formed by joining its `kind` and source name (e.g. `tool:bash`, `skill:tmux`, `toolDefinition:bash`); unique within the snapshot. Use it to match the same entry across snapshots, to correlate with other APIs (skill/agent/MCP registries), and as the `parentId` target for nesting. Distinct from the human-facing `label`. + pub id: String, + /// Source category for this entry. Not a closed set — tolerate unknown values. Known values today: `skill`, `subagent`, `mcpServer`, `tool`, `system`, `toolDefinition`, `plugin`. + pub kind: String, + /// Human-readable display label, e.g. `bash` or `skill: tmux`. Presentation-only; may be localized/reformatted without notice — do not key off it. + pub label: String, + /// Optional `id` of the parent entry: e.g. a `plugin` entry parenting its `skill`/`mcpServer` entries, or the `system` entry parenting `toolDefinition` entries. Omitted for top-level entries. + #[serde(skip_serializing_if = "Option::is_none")] + pub parent_id: Option, + /// Token count currently in context attributable to this entry. + pub tokens: i64, +} + +/// Per-source token attribution snapshot for the current context window. The heaviest individual messages are available separately via `metadata.getContextHeaviestMessages`. +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionMetadataGetContextAttributionResultContextAttribution { + /// Output reserve plus the tokens past the buffer-exhaustion blocking threshold. Mirrors `SessionContextInfo.bufferTokens`. + pub buffer_tokens: i64, + /// The six normalized `/context` header buckets, computed from the same tokenization as `entries` so the two never disagree. Convenience rollups: `freeSpace` and `buffer` describe window capacity rather than occupied context, so the values do not sum to `totalTokens`. + pub categories: SessionMetadataGetContextAttributionResultContextAttributionCategories, + /// Successful compaction history for the session. + pub compactions: SessionMetadataGetContextAttributionResultContextAttributionCompactions, + /// Token count at which background compaction starts. Mirrors `SessionContextInfo.compactionThreshold`. + pub compaction_threshold: i64, + /// Flat list of per-source attribution entries. Group by `kind` and render unrecognized kinds generically. Nesting and rollups are expressed via `parentId`. + pub entries: Vec, + /// Prompt limit plus the model's output reserve: the full context window `categories.freeSpace` and `categories.buffer` are measured against. Mirrors `SessionContextInfo.limit`. + pub limit: i64, + /// The concrete model id the entire breakdown was tokenized against (feeds the per-model token multiplier). Under `Auto` (Free/Student) this is the resolved model, not the literal `auto` sentinel, so totals are not undercounted. A single-model approximation of a potentially multi-model Auto session. + pub model_id: String, + /// How `modelId` was chosen. Not a closed set — tolerate unknown values. Known values today: `autoResolved` (the model Auto resolved to), `selected` (the user's explicitly selected model), `default` (a fallback before any model is known). + pub model_source: String, + /// Maximum prompt tokens the resolved model accepts — the denominator for a `##k/###k` context-usage display. Mirrors `SessionContextInfo.promptTokenLimit`. + pub prompt_token_limit: i64, + /// Total token count of the current context window the entries are measured against (system message + conversation messages + tool definitions — the same total reported by /context). Divide an entry's `tokens` by this to derive its share. + pub total_tokens: i64, +} + +/// Per-source attribution breakdown for the session's current context window, or null if uninitialized. /// ///
/// @@ -23850,12 +25426,12 @@ pub struct SessionUiUnregisterDirectAutoModeSwitchHandlerResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionPermissionsConfigureResult { - /// Whether the operation succeeded - pub success: bool, +pub struct SessionMetadataGetContextAttributionResult { + /// Per-source context-window attribution, or null if the session has not yet been initialized (no system prompt or tool metadata cached). + pub context_attribution: Option, } -/// Indicates whether the permission decision was applied; false when the request was already resolved. +/// The heaviest individual messages in the session's context window, most-expensive first. /// ///
/// @@ -23865,12 +25441,14 @@ pub struct SessionPermissionsConfigureResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionPermissionsHandlePendingPermissionRequestResult { - /// Whether the permission request was handled successfully - pub success: bool, +pub struct SessionMetadataGetContextHeaviestMessagesResult { + /// Heaviest messages, most-expensive first. + pub messages: Vec, + /// Total token count of the current context window, so callers can compute each message's share without a second call. + pub total_tokens: i64, } -/// List of pending permission requests reconstructed from event history. +/// Notify the session that its working directory context has changed. Emits a `session.context_changed` event so consumers (telemetry, OTel tracker, ACP, the timeline UI) can react. Use this when the host has detected a cwd/branch/repo change outside the session's normal lifecycle (e.g., after a shell command in interactive mode). For a local session, a report whose `cwd` diverges from the session's current working directory is ignored (the call still succeeds but records nothing and emits no event); move a local session's working directory via `metadata.setWorkingDirectory` instead. /// ///
/// @@ -23880,12 +25458,9 @@ pub struct SessionPermissionsHandlePendingPermissionRequestResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionPermissionsPendingRequestsResult { - /// Pending permission prompts reconstructed from the session's event history. Equivalent to the set of `permission.requested` events that have not yet been followed by a matching `permission.completed` event. Used by clients (e.g. the CLI) to hydrate UI for prompts that were emitted before the client attached to the session. - pub items: Vec, -} +pub struct SessionMetadataRecordContextChangeResult {} -/// Indicates whether the operation succeeded. +/// Update the session's working directory. Used by the host when the user explicitly changes cwd (e.g., the `/cd` slash command). The host is responsible for any related side-effects (file index, etc.); it does NOT change the process working directory (a session's cwd is per-session, not process-global). For local sessions the runtime validates the target first (an absolute path that exists on disk) and re-bases the permission primary directory; a rejected validation fails the call before anything is mutated, persisted, or emitted. Location-scoped permission rules are then re-keyed to the new directory (best-effort). Remote sessions only record the path. /// ///
/// @@ -23895,12 +25470,12 @@ pub struct SessionPermissionsPendingRequestsResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionPermissionsSetApproveAllResult { - /// Whether the operation succeeded - pub success: bool, +pub struct SessionMetadataSetWorkingDirectoryResult { + /// Working directory after the update + pub working_directory: String, } -/// Indicates whether the operation succeeded and reports the post-mutation state. +/// Re-tokenize the session's existing messages against `modelId` and return the token totals. Useful for hosts that want an initial estimate of context usage on session resume, before the next agent turn fires `session.context_info_changed` events. Returns zeros for an empty session. /// ///
/// @@ -23910,17 +25485,16 @@ pub struct SessionPermissionsSetApproveAllResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionPermissionsSetAllowAllResult { - /// Authoritative full allow-all state after the mutation - pub enabled: bool, - /// Authoritative allow-all mode after the mutation - #[serde(skip_serializing_if = "Option::is_none")] - pub mode: Option, - /// Whether the operation succeeded - pub success: bool, +pub struct SessionMetadataRecomputeContextTokensResult { + /// Tokens contributed by user/assistant/tool messages (excludes system/developer prompts). + pub messages_token_count: i64, + /// Tokens contributed by system/developer prompt snapshots. + pub system_token_count: i64, + /// Sum of tokens across chat-context and system-context messages currently held by the session. + pub total_tokens: i64, } -/// Current allow-all permission mode. +/// Identifies the target session. /// ///
/// @@ -23930,15 +25504,12 @@ pub struct SessionPermissionsSetAllowAllResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionPermissionsGetAllowAllResult { - /// Whether full allow-all permissions are currently active - pub enabled: bool, - /// Current allow-all mode - #[serde(skip_serializing_if = "Option::is_none")] - pub mode: Option, +pub struct SessionSettingsSnapshotParams { + /// Target session identifier + pub session_id: SessionId, } -/// Indicates whether the operation succeeded. +/// Redacted, serializable view of session runtime settings for SDK boundary consumers. Secrets and raw feature flags are intentionally excluded. /// ///
/// @@ -23948,12 +25519,32 @@ pub struct SessionPermissionsGetAllowAllResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionPermissionsModifyRulesResult { - /// Whether the operation succeeded - pub success: bool, +pub struct SessionSettingsSnapshotResult { + /// Name of the SDK client that created the session. + #[serde(skip_serializing_if = "Option::is_none")] + pub client_name: Option, + /// Redacted job settings. + pub job: SessionSettingsJobSnapshot, + /// Redacted model routing settings. + pub model: SessionSettingsModelSnapshot, + /// Online-evaluation settings safe for SDK consumers. + pub online_evaluation: SessionSettingsOnlineEvaluationSnapshot, + /// Redacted repository and host settings. + pub repo: SessionSettingsRepoSnapshot, + /// Session start time as Unix epoch milliseconds. + #[serde(skip_serializing_if = "Option::is_none")] + pub start_time_ms: Option, + /// Session timeout in milliseconds. + #[serde(skip_serializing_if = "Option::is_none")] + pub timeout_ms: Option, + /// Redacted validation and memory-tool settings. + pub validation: SessionSettingsValidationSnapshot, + /// Agent runtime version selector copied from the session settings, such as `latest` or a runtime release identifier. + #[serde(skip_serializing_if = "Option::is_none")] + pub version: Option, } -/// Indicates whether the operation succeeded. +/// Batch content-exclusion result. Callers must fail closed when policy evaluation is unavailable. /// ///
/// @@ -23963,12 +25554,14 @@ pub struct SessionPermissionsModifyRulesResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionPermissionsSetRequiredResult { - /// Whether the operation succeeded - pub success: bool, +pub struct SessionContentExclusionCheckPathsResult { + /// Whether the session's policy service was available for the complete batch. When false, checks is empty and callers must treat every requested path as excluded. + pub available: bool, + /// Per-path decisions in request order. Empty when available is false. + pub checks: Vec, } -/// Indicates whether the operation succeeded. +/// Identifier of the spawned process, used to correlate streamed output and exit notifications. /// ///
/// @@ -23978,12 +25571,12 @@ pub struct SessionPermissionsSetRequiredResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionPermissionsResetSessionApprovalsResult { - /// Whether the operation succeeded - pub success: bool, +pub struct SessionShellExecResult { + /// Unique identifier for tracking streamed output + pub process_id: String, } -/// Indicates whether the operation succeeded. +/// Indicates whether the signal was delivered; false if the process was unknown or already exited. /// ///
/// @@ -23993,12 +25586,12 @@ pub struct SessionPermissionsResetSessionApprovalsResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionPermissionsNotifyPromptShownResult { - /// Whether the operation succeeded - pub success: bool, +pub struct SessionShellKillResult { + /// Whether the signal was sent successfully + pub killed: bool, } -/// Snapshot of the session's allow-listed directories and primary working directory. +/// Result of a user-requested shell command. /// ///
/// @@ -24008,14 +25601,22 @@ pub struct SessionPermissionsNotifyPromptShownResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionPermissionsPathsListResult { - /// All directories currently allowed for tool access on this session. - pub directories: Vec, - /// The primary working directory for this session. - pub primary: String, +pub struct SessionShellExecuteUserRequestedResult { + /// Error output when the execution failed + #[serde(skip_serializing_if = "Option::is_none")] + pub error: Option, + /// Process exit code, when available + #[serde(skip_serializing_if = "Option::is_none")] + pub exit_code: Option, + /// Captured command output + pub output: String, + /// Whether the command completed successfully + pub success: bool, + /// Tool call id emitted for the shell execution + pub tool_call_id: String, } -/// Indicates whether the operation succeeded. +/// Cancellation result for a user-requested shell command. /// ///
/// @@ -24025,12 +25626,12 @@ pub struct SessionPermissionsPathsListResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionPermissionsPathsAddResult { - /// Whether the operation succeeded - pub success: bool, +pub struct SessionShellCancelUserRequestedResult { + /// Whether an in-flight execution was found and signalled to cancel + pub cancelled: bool, } -/// Indicates whether the operation succeeded. +/// Compaction outcome with the number of tokens and messages removed, summary text, and the resulting context window breakdown. /// ///
/// @@ -24040,12 +25641,22 @@ pub struct SessionPermissionsPathsAddResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionPermissionsPathsUpdatePrimaryResult { - /// Whether the operation succeeded +pub struct SessionHistoryCompactResult { + /// Post-compaction context window usage breakdown + #[serde(skip_serializing_if = "Option::is_none")] + pub context_window: Option, + /// Number of messages removed during compaction + pub messages_removed: i64, + /// Whether compaction completed successfully pub success: bool, + /// Summary text produced by compaction. Omitted when compaction did not produce a summary (e.g. failure path). + #[serde(skip_serializing_if = "Option::is_none")] + pub summary_content: Option, + /// Number of tokens freed by compaction + pub tokens_removed: i64, } -/// Indicates whether the supplied path is within the session's allowed directories. +/// Number of events that were removed by the truncation. /// ///
/// @@ -24055,12 +25666,18 @@ pub struct SessionPermissionsPathsUpdatePrimaryResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionPermissionsPathsIsPathWithinAllowedDirectoriesResult { - /// Whether the path is within the session's allowed directories - pub allowed: bool, +pub struct SessionHistoryTruncateResult { + /// Failure detail when checkpointCleanupFailed is true. + #[serde(skip_serializing_if = "Option::is_none")] + pub checkpoint_cleanup_error: Option, + /// True when conversation truncation succeeded but post-truncation workspace checkpoint cleanup failed. History is already truncated; callers may still prune snapshots but should report a checkpoint-cleanup rather than a truncation failure. + #[serde(skip_serializing_if = "Option::is_none")] + pub checkpoint_cleanup_failed: Option, + /// Number of events that were removed + pub events_removed: i64, } -/// Indicates whether the supplied path is within the session's workspace directory. +/// Identifies the target session. /// ///
/// @@ -24070,12 +25687,12 @@ pub struct SessionPermissionsPathsIsPathWithinAllowedDirectoriesResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionPermissionsPathsIsPathWithinWorkspaceResult { - /// Whether the path is within the session workspace directory - pub allowed: bool, +pub struct SessionHistoryListRewindPointsParams { + /// Target session identifier + pub session_id: SessionId, } -/// Resolved location-permissions key and type. +/// Rewind points and file-change-tracking availability for the session. /// ///
/// @@ -24085,14 +25702,17 @@ pub struct SessionPermissionsPathsIsPathWithinWorkspaceResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionPermissionsLocationsResolveResult { - /// Location key used in the location-permissions store - pub location_key: String, - /// Whether the location is a git repo or directory - pub location_type: PermissionLocationType, +pub struct SessionHistoryListRewindPointsResult { + /// Whether this session captured file changes from its first turn. + pub file_change_tracking_enabled: bool, + /// Root user turns in chronological order. Empty when `unavailableReason` is set. + pub points: Vec, + /// Why the listed points could not be produced, when applicable; the points list is empty whenever it is set. `unsupported-remote-session` is permanent for the session and comes with `fileChangeTrackingEnabled: false`. `session-busy` is transient and only ever reported by a session that *is* tracking (`fileChangeTrackingEnabled: true`), because the file-change captures cannot be read while work that may still mutate them is in flight; the same request succeeds once the session settles, so a client that wants points should retry rather than treat it as a failure. It is never `file-change-tracking-disabled`: an untracked local session still lists conversation-only points and reports that through `fileChangeTrackingEnabled: false`. + #[serde(skip_serializing_if = "Option::is_none")] + pub unavailable_reason: Option, } -/// Summary of persisted location permissions applied to the session. +/// Files and aggregate changes for a prospective rewind. /// ///
/// @@ -24102,22 +25722,19 @@ pub struct SessionPermissionsLocationsResolveResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionPermissionsLocationsApplyResult { - /// Number of persisted allowed directories added to the live path manager - pub applied_directory_count: i64, - /// Number of location-scoped rules added to the live permission service - pub applied_rule_count: i64, - /// Location-scoped rules applied to the live permission service - pub applied_rules: Vec, - /// Whether a different location was applied since the previous apply call - pub changed: bool, - /// Location key used in the location-permissions store - pub location_key: String, - /// Whether the location is a git repo or directory - pub location_type: PermissionLocationType, +pub struct SessionHistoryPreviewRewindResult { + /// Whether file restore is available for this session. This is authoritative: switch on it and read `reason` only when it is false. + pub available: bool, + /// Number of unique files in the preview. + pub file_count: i64, + /// Files ordered by path. + pub files: Vec, + /// Why file restore is unavailable, when applicable. Populated only when `available` is false and never set when `available` is true. + #[serde(skip_serializing_if = "Option::is_none")] + pub reason: Option, } -/// Indicates whether the operation succeeded. +/// Structured outcome of a rewind request. /// ///
/// @@ -24127,12 +25744,22 @@ pub struct SessionPermissionsLocationsApplyResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionPermissionsLocationsAddToolApprovalResult { - /// Whether the operation succeeded - pub success: bool, +pub struct SessionHistoryRewindResult { + /// Failure detail. Set only for the failure and partial-failure outcomes (`files-rolled-back`, `rollback-incomplete`, `truncation-failed`, `checkpoint-cleanup-failed`, `snapshot-prune-failed`); omitted for `success` and for the unavailable outcomes (`session-busy`, `file-change-tracking-disabled`, `unsupported-remote-session`). + #[serde(skip_serializing_if = "Option::is_none")] + pub error: Option, + /// Number of persisted events removed by conversation truncation. Present only when truncation succeeded (outcomes `success`, `checkpoint-cleanup-failed`, and `snapshot-prune-failed`); omitted for every unavailable outcome (`session-busy`, `file-change-tracking-disabled`, `unsupported-remote-session`) and for `truncation-failed`, `files-rolled-back`, and `rollback-incomplete`. + #[serde(skip_serializing_if = "Option::is_none")] + pub events_removed: Option, + /// Overall rewind outcome. This discriminates the result: it governs which of the remaining fields are populated, so consumers must switch on it before reading `eventsRemoved`, `restoredFiles`, `skippedFiles`, or `error`. See each field for the outcomes that populate it. + pub outcome: HistoryRewindOutcome, + /// Absolute paths restored to their captured preimages. Always empty for conversation-only rewinds and for the unavailable outcomes (`session-busy`, `file-change-tracking-disabled`, `unsupported-remote-session`); only conversation-and-files outcomes that reached the file-restore stage populate it. + pub restored_files: Vec, + /// Captured files intentionally left unchanged. Always empty for conversation-only rewinds and for the unavailable outcomes (`session-busy`, `file-change-tracking-disabled`, `unsupported-remote-session`); only conversation-and-files outcomes that reached the file-restore stage populate it. + pub skipped_files: Vec, } -/// Folder trust check result. +/// Identifies the target session. /// ///
/// @@ -24142,12 +25769,12 @@ pub struct SessionPermissionsLocationsAddToolApprovalResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionPermissionsFolderTrustIsTrustedResult { - /// Whether the folder is trusted - pub trusted: bool, +pub struct SessionHistoryCancelBackgroundCompactionParams { + /// Target session identifier + pub session_id: SessionId, } -/// Indicates whether the operation succeeded. +/// Indicates whether an in-progress background compaction was cancelled. /// ///
/// @@ -24157,12 +25784,12 @@ pub struct SessionPermissionsFolderTrustIsTrustedResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionPermissionsFolderTrustAddTrustedResult { - /// Whether the operation succeeded - pub success: bool, +pub struct SessionHistoryCancelBackgroundCompactionResult { + /// Whether an in-progress background compaction was cancelled. False when no compaction was running, when the session is remote, or when the underlying processor was unavailable. + pub cancelled: bool, } -/// Indicates whether the operation succeeded. +/// Identifies the target session. /// ///
/// @@ -24172,12 +25799,12 @@ pub struct SessionPermissionsFolderTrustAddTrustedResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionPermissionsUrlsSetUnrestrictedModeResult { - /// Whether the operation succeeded - pub success: bool, +pub struct SessionHistoryAbortManualCompactionParams { + /// Target session identifier + pub session_id: SessionId, } -/// Identifier of the session event that was emitted for the log message. +/// Indicates whether an in-progress manual compaction was aborted. /// ///
/// @@ -24187,9 +25814,9 @@ pub struct SessionPermissionsUrlsSetUnrestrictedModeResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionLogResult { - /// The unique identifier of the emitted session event - pub event_id: String, +pub struct SessionHistoryAbortManualCompactionResult { + /// Whether an in-progress manual compaction was aborted. False when no manual compaction was running, when its abort controller was already aborted, or when the session is remote. + pub aborted: bool, } /// Identifies the target session. @@ -24202,47 +25829,12 @@ pub struct SessionLogResult { /// #[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionMetadataSnapshotParams { +pub struct SessionHistorySummarizeForHandoffParams { /// Target session identifier pub session_id: SessionId, } -/// Public-facing projection of workspace metadata for SDK / TUI consumers -#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct SessionMetadataSnapshotResultWorkspace { - /// Branch checked out at session start, if any - #[serde(skip_serializing_if = "Option::is_none")] - pub branch: Option, - /// ISO 8601 timestamp when the workspace was created - #[serde(rename = "created_at", skip_serializing_if = "Option::is_none")] - pub created_at: Option, - /// Current working directory at session start - #[serde(skip_serializing_if = "Option::is_none")] - pub cwd: Option, - /// Resolved git root for cwd, if any - #[serde(rename = "git_root", skip_serializing_if = "Option::is_none")] - pub git_root: Option, - /// Repository host type, if known - #[serde(rename = "host_type", skip_serializing_if = "Option::is_none")] - pub host_type: Option, - /// Workspace identifier (1:1 with sessionId) - pub id: String, - /// Display name for the session, if set - #[serde(skip_serializing_if = "Option::is_none")] - pub name: Option, - /// Repository identifier in 'owner/repo' or 'org/project/repo' format, if any - #[serde(skip_serializing_if = "Option::is_none")] - pub repository: Option, - /// ISO 8601 timestamp when the workspace was last updated - #[serde(rename = "updated_at", skip_serializing_if = "Option::is_none")] - pub updated_at: Option, - /// Whether the display name was explicitly set by the user - #[serde(rename = "user_named", skip_serializing_if = "Option::is_none")] - pub user_named: Option, -} - -/// Point-in-time snapshot of slow-changing session identifier and state fields +/// Markdown summary of the conversation context (empty when not available). /// ///
/// @@ -24252,42 +25844,24 @@ pub struct SessionMetadataSnapshotResultWorkspace { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionMetadataSnapshotResult { - /// True when the session was detected to be in use by another process at construction time. Local consumers may surface a confirmation prompt before fully attaching. Always false for new sessions. - pub already_in_use: bool, - /// Runtime client name associated with the session (telemetry identifier). - #[serde(skip_serializing_if = "Option::is_none")] - pub client_name: Option, - /// The current agent mode for this session (e.g., 'interactive', 'plan', 'autopilot') - pub current_mode: MetadataSnapshotCurrentMode, - /// User-provided name supplied at session construction (via `--name`), if any. Immutable after construction. - #[serde(skip_serializing_if = "Option::is_none")] - pub initial_name: Option, - /// Whether this is a remote session (i.e., one whose runtime executes elsewhere and is steered through this process) - pub is_remote: bool, - /// ISO 8601 timestamp of when the session's persisted state was last modified on disk. For new sessions, equals startTime. For resumed sessions, reflects the previous modification time at construction. - pub modified_time: String, - /// Remote-session-specific metadata. Populated only when `isRemote` is true. Fields are immutable for the lifetime of the session. - #[serde(skip_serializing_if = "Option::is_none")] - pub remote_metadata: Option, - /// Currently selected model identifier, if any - #[serde(skip_serializing_if = "Option::is_none")] - pub selected_model: Option, - /// The unique identifier of the session - pub session_id: SessionId, - /// Current session limits, or null when no limits are active - pub session_limits: Option, - /// ISO 8601 timestamp of when the session started - pub start_time: String, - /// Short human-readable summary of the session, if known. Omitted when no summary has been generated. - #[serde(skip_serializing_if = "Option::is_none")] - pub summary: Option, - /// Absolute path to the session's current working directory - pub working_directory: String, - /// Public-facing workspace metadata for this session, or null if the session has no associated workspace. Excludes runtime-internal fields (GitHub IDs, summary count, internal flags). - pub workspace: Option, - /// Absolute path to the session's workspace directory on disk, or null if the session has no associated workspace - pub workspace_path: Option, +pub struct SessionHistorySummarizeForHandoffResult { + /// Markdown summary of the conversation context produced by an LLM. Empty string when there are no messages or when the session does not support local summarization. + pub summary: String, +} + +/// What a successful clear removed. A clear that could not be applied rejects instead of reporting a count. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionHistoryClearContextResult { + /// Number of non-system, non-developer messages that were removed from the conversation. Zero only when the window already held no conversation. + pub messages_cleared: i64, } /// Identifies the target session. @@ -24300,12 +25874,12 @@ pub struct SessionMetadataSnapshotResult { /// #[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionMetadataIsProcessingParams { +pub struct SessionQueuePendingItemsParams { /// Target session identifier pub session_id: SessionId, } -/// Indicates whether the local session is currently processing a turn or background continuation. +/// Snapshot of the session's pending queued items and immediate-steering messages. /// ///
/// @@ -24315,9 +25889,11 @@ pub struct SessionMetadataIsProcessingParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionMetadataIsProcessingResult { - /// Whether the session is currently processing user/agent messages. False for non-local sessions (which don't run a local agentic loop). Reflects an in-flight turn or background continuation. - pub processing: bool, +pub struct SessionQueuePendingItemsResult { + /// Pending queued items in submission order. Includes user messages, queued slash commands, and queued model changes; omits internal system items. + pub items: Vec, + /// Display text for messages currently in the immediate steering queue (interjections sent during a running turn). + pub steering_messages: Vec, } /// Identifies the target session. @@ -24330,12 +25906,12 @@ pub struct SessionMetadataIsProcessingResult { /// #[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionMetadataActivityParams { +pub struct SessionQueueSnapshotParams { /// Target session identifier pub session_id: SessionId, } -/// Current activity flags for the session. +/// Internal snapshot of native queue state for local session orchestration. /// ///
/// @@ -24345,40 +25921,20 @@ pub struct SessionMetadataActivityParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionMetadataActivityResult { - /// Whether an in-flight operation can currently be aborted. - pub abortable: bool, - /// Whether the session currently has active work, including running turns or tasks. - pub has_active_work: bool, -} - -/// Token-usage breakdown for the session's current context window -#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct SessionMetadataContextInfoResultContextInfo { - /// Output reserve plus tokens after the buffer-exhaustion blocking threshold (default 95%) - pub buffer_tokens: i64, - /// Token count at which background compaction starts (configurable percentage of promptTokenLimit) - pub compaction_threshold: i64, - /// Tokens consumed by user/assistant/tool messages - pub conversation_tokens: i64, - /// Prompt token limit plus the model's full output token limit. - pub limit: i64, - /// Tokens consumed by MCP tool definitions (subset of toolDefinitionsTokens, excludes deferred tools) - pub mcp_tools_tokens: i64, - /// The model used for token counting - pub model_name: String, - /// Maximum prompt tokens allowed by the model (or DEFAULT_TOKEN_LIMIT if unspecified) - pub prompt_token_limit: i64, - /// Tokens consumed by the system prompt - pub system_tokens: i64, - /// Tokens consumed by tool definitions sent to the model (excludes deferred tools) - pub tool_definitions_tokens: i64, - /// Sum of system, conversation and tool-definition tokens - pub total_tokens: i64, +pub struct SessionQueueSnapshotResult { + /// Insertion orders for queued items, aligned with `items`. + #[serde(skip_serializing_if = "Option::is_none")] + pub item_orders: Option>, + /// User-facing pending items in FIFO order. + pub items: Vec, + /// Insertion orders for immediate steering messages, aligned with `steeringMessages`. + #[serde(skip_serializing_if = "Option::is_none")] + pub steering_message_orders: Option>, + /// Immediate steering messages waiting for an active turn. + pub steering_messages: Vec, } -/// Token breakdown for the session's current context window, or null if uninitialized. +/// Result of moving a queued item. /// ///
/// @@ -24388,12 +25944,12 @@ pub struct SessionMetadataContextInfoResultContextInfo { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionMetadataContextInfoResult { - /// Token breakdown for the current context window, or null if the session has not yet been initialized (no system prompt or tool metadata cached). - pub context_info: Option, +pub struct SessionQueueMoveItemResult { + /// True when the item changed position; false when it was already at the requested position. + pub changed: bool, } -/// Identifies the target session. +/// Result of inserting a queued message. /// ///
/// @@ -24403,85 +25959,27 @@ pub struct SessionMetadataContextInfoResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionMetadataGetContextAttributionParams { - /// Target session identifier - pub session_id: SessionId, -} - -/// The six normalized `/context` header buckets, computed from the same tokenization as `entries` so the two never disagree. Convenience rollups: `freeSpace` and `buffer` describe window capacity rather than occupied context, so the values do not sum to `totalTokens`. -#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct SessionMetadataGetContextAttributionResultContextAttributionCategories { - /// Output reserve plus post-blocking-threshold buffer. - pub buffer: i64, - /// Custom-instructions tokens (0 when none are configured). - pub custom_instructions: i64, - /// Remaining unused window capacity (clamped at 0). - pub free_space: i64, - /// MCP tool-definition tokens. - pub mcp_tools: i64, - /// Conversation (user/assistant/tool) message tokens. - pub messages: i64, - /// System prompt tokens, excluding custom instructions. - pub system_prompt: i64, - /// Non-MCP tool-definition tokens. - pub system_tools: i64, -} - -/// Successful compaction history for the session. -#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct SessionMetadataGetContextAttributionResultContextAttributionCompactions { - /// Number of successful compactions in this session. - pub count: i64, -} - -#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct SessionMetadataGetContextAttributionResultContextAttributionEntriesItem { - /// Supplementary per-entry metadata (e.g. `messageCount`, `role`, `evictable`, `pluginSource`). Values are stringified; parse as needed and ignore unrecognized keys. - #[serde(skip_serializing_if = "Option::is_none")] - pub attributes: Option>, - /// Identifier for this entry, formed by joining its `kind` and source name (e.g. `tool:bash`, `skill:tmux`, `toolDefinition:bash`); unique within the snapshot. Use it to match the same entry across snapshots, to correlate with other APIs (skill/agent/MCP registries), and as the `parentId` target for nesting. Distinct from the human-facing `label`. +pub struct SessionQueueInsertAtResult { + /// Fresh stable opaque id assigned to the inserted item. pub id: String, - /// Source category for this entry. Not a closed set — tolerate unknown values. Known values today: `skill`, `subagent`, `mcpServer`, `tool`, `system`, `toolDefinition`, `plugin`. - pub kind: String, - /// Human-readable display label, e.g. `bash` or `skill: tmux`. Presentation-only; may be localized/reformatted without notice — do not key off it. - pub label: String, - /// Optional `id` of the parent entry: e.g. a `plugin` entry parenting its `skill`/`mcpServer` entries, or the `system` entry parenting `toolDefinition` entries. Omitted for top-level entries. - #[serde(skip_serializing_if = "Option::is_none")] - pub parent_id: Option, - /// Token count currently in context attributable to this entry. - pub tokens: i64, } -/// Per-source token attribution snapshot for the current context window. The heaviest individual messages are available separately via `metadata.getContextHeaviestMessages`. +/// Result of removing a queued item. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionMetadataGetContextAttributionResultContextAttribution { - /// Output reserve plus the tokens past the buffer-exhaustion blocking threshold. Mirrors `SessionContextInfo.bufferTokens`. - pub buffer_tokens: i64, - /// The six normalized `/context` header buckets, computed from the same tokenization as `entries` so the two never disagree. Convenience rollups: `freeSpace` and `buffer` describe window capacity rather than occupied context, so the values do not sum to `totalTokens`. - pub categories: SessionMetadataGetContextAttributionResultContextAttributionCategories, - /// Successful compaction history for the session. - pub compactions: SessionMetadataGetContextAttributionResultContextAttributionCompactions, - /// Token count at which background compaction starts. Mirrors `SessionContextInfo.compactionThreshold`. - pub compaction_threshold: i64, - /// Flat list of per-source attribution entries. Group by `kind` and render unrecognized kinds generically. Nesting and rollups are expressed via `parentId`. - pub entries: Vec, - /// Prompt limit plus the model's output reserve: the full context window `categories.freeSpace` and `categories.buffer` are measured against. Mirrors `SessionContextInfo.limit`. - pub limit: i64, - /// The concrete model id the entire breakdown was tokenized against (feeds the per-model token multiplier). Under `Auto` (Free/Student) this is the resolved model, not the literal `auto` sentinel, so totals are not undercounted. A single-model approximation of a potentially multi-model Auto session. - pub model_id: String, - /// How `modelId` was chosen. Not a closed set — tolerate unknown values. Known values today: `autoResolved` (the model Auto resolved to), `selected` (the user's explicitly selected model), `default` (a fallback before any model is known). - pub model_source: String, - /// Maximum prompt tokens the resolved model accepts — the denominator for a `##k/###k` context-usage display. Mirrors `SessionContextInfo.promptTokenLimit`. - pub prompt_token_limit: i64, - /// Total token count of the current context window the entries are measured against (system message + conversation messages + tool definitions — the same total reported by /context). Divide an entry's `tokens` by this to derive its share. - pub total_tokens: i64, +pub struct SessionQueueRemoveAtResult { + /// True when the addressed item was removed. + pub removed: bool, } -/// Per-source attribution breakdown for the session's current context window, or null if uninitialized. +/// Result of editing a queued message. /// ///
/// @@ -24491,12 +25989,12 @@ pub struct SessionMetadataGetContextAttributionResultContextAttribution { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionMetadataGetContextAttributionResult { - /// Per-source context-window attribution, or null if the session has not yet been initialized (no system prompt or tool metadata cached). - pub context_attribution: Option, +pub struct SessionQueueUpdateTextResult { + /// True when the stored text changed. + pub updated: bool, } -/// The heaviest individual messages in the session's context window, most-expensive first. +/// Result of duplicating a queued item. /// ///
/// @@ -24506,14 +26004,12 @@ pub struct SessionMetadataGetContextAttributionResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionMetadataGetContextHeaviestMessagesResult { - /// Heaviest messages, most-expensive first. - pub messages: Vec, - /// Total token count of the current context window, so callers can compute each message's share without a second call. - pub total_tokens: i64, +pub struct SessionQueueDuplicateAtResult { + /// Fresh stable opaque id assigned to the duplicate. + pub id: String, } -/// Notify the session that its working directory context has changed. Emits a `session.context_changed` event so consumers (telemetry, OTel tracker, ACP, the timeline UI) can react. Use this when the host has detected a cwd/branch/repo change outside the session's normal lifecycle (e.g., after a shell command in interactive mode). For a local session, a report whose `cwd` diverges from the session's current working directory is ignored (the call still succeeds but records nothing and emits no event); move a local session's working directory via `metadata.setWorkingDirectory` instead. +/// Result of trying to steer a queued message into a live turn. /// ///
/// @@ -24523,9 +26019,12 @@ pub struct SessionMetadataGetContextHeaviestMessagesResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionMetadataRecordContextChangeResult {} +pub struct SessionQueueSendNowResult { + /// True when the item was accepted into the steering lane; false when no main turn was live. + pub steered: bool, +} -/// Update the session's working directory. Used by the host when the user explicitly changes cwd (e.g., the `/cd` slash command). The host is responsible for any related side-effects (file index, etc.); it does NOT change the process working directory (a session's cwd is per-session, not process-global). For local sessions the runtime validates the target first (an absolute path that exists on disk) and re-bases the permission primary directory; a rejected validation fails the call before anything is mutated, persisted, or emitted. Location-scoped permission rules are then re-keyed to the new directory (best-effort). Remote sessions only record the path. +/// Identifies the target session. /// ///
/// @@ -24535,12 +26034,12 @@ pub struct SessionMetadataRecordContextChangeResult {} ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionMetadataSetWorkingDirectoryResult { - /// Working directory after the update - pub working_directory: String, +pub struct SessionQueueHasPendingParams { + /// Target session identifier + pub session_id: SessionId, } -/// Re-tokenize the session's existing messages against `modelId` and return the token totals. Useful for hosts that want an initial estimate of context usage on session resume, before the next agent turn fires `session.context_info_changed` events. Returns zeros for an empty session. +/// Whether the native queue has pending work. /// ///
/// @@ -24550,16 +26049,12 @@ pub struct SessionMetadataSetWorkingDirectoryResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionMetadataRecomputeContextTokensResult { - /// Tokens contributed by user/assistant/tool messages (excludes system/developer prompts). - pub messages_token_count: i64, - /// Tokens contributed by system/developer prompt snapshots. - pub system_token_count: i64, - /// Sum of tokens across chat-context and system-context messages currently held by the session. - pub total_tokens: i64, +pub struct SessionQueueHasPendingResult { + /// True when queued or immediate native work is pending. + pub has_pending: bool, } -/// Identifies the target session. +/// Whether a deferred-idle drain should run. /// ///
/// @@ -24569,12 +26064,12 @@ pub struct SessionMetadataRecomputeContextTokensResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionSettingsSnapshotParams { - /// Target session identifier - pub session_id: SessionId, +pub struct SessionQueueBeginDeferredIdleDrainResult { + /// True when the host should run finishDeferredIdleDrain asynchronously. + pub should_drain: bool, } -/// Redacted, serializable view of session runtime settings for SDK boundary consumers. Secrets and raw feature flags are intentionally excluded. +/// Action selected by the native deferred-idle drain. /// ///
/// @@ -24584,32 +26079,29 @@ pub struct SessionSettingsSnapshotParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionSettingsSnapshotResult { - /// Name of the SDK client that created the session. - #[serde(skip_serializing_if = "Option::is_none")] - pub client_name: Option, - /// Redacted job settings. - pub job: SessionSettingsJobSnapshot, - /// Redacted model routing settings. - pub model: SessionSettingsModelSnapshot, - /// Online-evaluation settings safe for SDK consumers. - pub online_evaluation: SessionSettingsOnlineEvaluationSnapshot, - /// Redacted repository and host settings. - pub repo: SessionSettingsRepoSnapshot, - /// Session start time as Unix epoch milliseconds. - #[serde(skip_serializing_if = "Option::is_none")] - pub start_time_ms: Option, - /// Session timeout in milliseconds. - #[serde(skip_serializing_if = "Option::is_none")] - pub timeout_ms: Option, - /// Redacted validation and memory-tool settings. - pub validation: SessionSettingsValidationSnapshot, - /// Agent runtime version selector copied from the session settings, such as `latest` or a runtime release identifier. - #[serde(skip_serializing_if = "Option::is_none")] - pub version: Option, +pub struct SessionQueueFinishDeferredIdleDrainResult { + /// Whether the deferred idle was caused by an aborted foreground turn. + pub aborted: bool, + /// One of none, processQueue, or emitSessionIdle. + pub action: String, +} + +/// Identifies the target session. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionQueueRemoveMostRecentParams { + /// Target session identifier + pub session_id: SessionId, } -/// Batch content-exclusion result. Callers must fail closed when policy evaluation is unavailable. +/// Indicates whether a user-facing pending item was removed. /// ///
/// @@ -24619,14 +26111,12 @@ pub struct SessionSettingsSnapshotResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionContentExclusionCheckPathsResult { - /// Whether the session's policy service was available for the complete batch. When false, checks is empty and callers must treat every requested path as excluded. - pub available: bool, - /// Per-path decisions in request order. Empty when available is false. - pub checks: Vec, +pub struct SessionQueueRemoveMostRecentResult { + /// True if a user-facing pending item was removed (LIFO across both queues); false when no removable items remained. + pub removed: bool, } -/// Identifier of the spawned process, used to correlate streamed output and exit notifications. +/// Identifies the target session. /// ///
/// @@ -24636,12 +26126,12 @@ pub struct SessionContentExclusionCheckPathsResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionShellExecResult { - /// Unique identifier for tracking streamed output - pub process_id: String, +pub struct SessionQueueClearParams { + /// Target session identifier + pub session_id: SessionId, } -/// Indicates whether the signal was delivered; false if the process was unknown or already exited. +/// Indicates whether a user-facing pending item was removed. /// ///
/// @@ -24651,12 +26141,12 @@ pub struct SessionShellExecResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionShellKillResult { - /// Whether the signal was sent successfully - pub killed: bool, +pub struct SessionQueueConsumeSystemNotificationsResult { + /// True if a user-facing pending item was removed (LIFO across both queues); false when no removable items remained. + pub removed: bool, } -/// Result of a user-requested shell command. +/// Identifies the target session. /// ///
/// @@ -24666,22 +26156,12 @@ pub struct SessionShellKillResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionShellExecuteUserRequestedResult { - /// Error output when the execution failed - #[serde(skip_serializing_if = "Option::is_none")] - pub error: Option, - /// Process exit code, when available - #[serde(skip_serializing_if = "Option::is_none")] - pub exit_code: Option, - /// Captured command output - pub output: String, - /// Whether the command completed successfully - pub success: bool, - /// Tool call id emitted for the shell execution - pub tool_call_id: String, +pub struct SessionQueueEnqueueResumePendingParams { + /// Target session identifier + pub session_id: SessionId, } -/// Cancellation result for a user-requested shell command. +/// Result of enqueueing the resume-pending wake item. /// ///
/// @@ -24691,12 +26171,12 @@ pub struct SessionShellExecuteUserRequestedResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionShellCancelUserRequestedResult { - /// Whether an in-flight execution was found and signalled to cancel - pub cancelled: bool, +pub struct SessionQueueEnqueueResumePendingResult { + /// True when a wake item was newly queued. + pub queued: bool, } -/// Compaction outcome with the number of tokens and messages removed, summary text, and the resulting context window breakdown. +/// Identifies the target session. /// ///
/// @@ -24706,22 +26186,12 @@ pub struct SessionShellCancelUserRequestedResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionHistoryCompactResult { - /// Post-compaction context window usage breakdown - #[serde(skip_serializing_if = "Option::is_none")] - pub context_window: Option, - /// Number of messages removed during compaction - pub messages_removed: i64, - /// Whether compaction completed successfully - pub success: bool, - /// Summary text produced by compaction. Omitted when compaction did not produce a summary (e.g. failure path). - #[serde(skip_serializing_if = "Option::is_none")] - pub summary_content: Option, - /// Number of tokens freed by compaction - pub tokens_removed: i64, +pub struct SessionQueueProcessParams { + /// Target session identifier + pub session_id: SessionId, } -/// Number of events that were removed by the truncation. +/// Batch of session events returned by a read, with cursor and continuation metadata. /// ///
/// @@ -24731,15 +26201,15 @@ pub struct SessionHistoryCompactResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionHistoryTruncateResult { - /// Failure detail when checkpointCleanupFailed is true. - #[serde(skip_serializing_if = "Option::is_none")] - pub checkpoint_cleanup_error: Option, - /// True when conversation truncation succeeded but post-truncation workspace checkpoint cleanup failed. History is already truncated; callers may still prune snapshots but should report a checkpoint-cleanup rather than a truncation failure. - #[serde(skip_serializing_if = "Option::is_none")] - pub checkpoint_cleanup_failed: Option, - /// Number of events that were removed - pub events_removed: i64, +pub struct SessionEventLogReadResult { + /// 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). + pub cursor: String, + /// 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. + pub cursor_status: EventsCursorStatus, + /// 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. + pub events: Vec, + /// 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. + pub has_more: bool, } /// Identifies the target session. @@ -24752,12 +26222,12 @@ pub struct SessionHistoryTruncateResult { /// #[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionHistoryListRewindPointsParams { +pub struct SessionEventLogTailParams { /// Target session identifier pub session_id: SessionId, } -/// Rewind points and file-change-tracking availability for the session. +/// Snapshot of the current tail cursor without returning any events. Use this when a consumer wants to subscribe to live events going forward without first paginating through the entire persisted history (which would happen if `read` were called without a cursor on a long-lived session). /// ///
/// @@ -24767,17 +26237,12 @@ pub struct SessionHistoryListRewindPointsParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionHistoryListRewindPointsResult { - /// Whether this session captured file changes from its first turn. - pub file_change_tracking_enabled: bool, - /// Root user turns in chronological order. Empty when `unavailableReason` is set. - pub points: Vec, - /// Why the listed points could not be produced, when applicable; the points list is empty whenever it is set. `unsupported-remote-session` is permanent for the session and comes with `fileChangeTrackingEnabled: false`. `session-busy` is transient and only ever reported by a session that *is* tracking (`fileChangeTrackingEnabled: true`), because the file-change captures cannot be read while work that may still mutate them is in flight; the same request succeeds once the session settles, so a client that wants points should retry rather than treat it as a failure. It is never `file-change-tracking-disabled`: an untracked local session still lists conversation-only points and reports that through `fileChangeTrackingEnabled: false`. - #[serde(skip_serializing_if = "Option::is_none")] - pub unavailable_reason: Option, +pub struct SessionEventLogTailResult { + /// Opaque cursor pointing at the current tail of the session's persisted-events history. Pass back to `read` to receive only events that arrive AFTER this snapshot. When the session has no events, this returns the same sentinel as an unset cursor (i.e. equivalent to omitting the cursor on a first read). + pub cursor: String, } -/// Files and aggregate changes for a prospective rewind. +/// Opaque handle representing an event-type interest registration. /// ///
/// @@ -24787,19 +26252,12 @@ pub struct SessionHistoryListRewindPointsResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionHistoryPreviewRewindResult { - /// Whether file restore is available for this session. This is authoritative: switch on it and read `reason` only when it is false. - pub available: bool, - /// Number of unique files in the preview. - pub file_count: i64, - /// Files ordered by path. - pub files: Vec, - /// Why file restore is unavailable, when applicable. Populated only when `available` is false and never set when `available` is true. - #[serde(skip_serializing_if = "Option::is_none")] - pub reason: Option, +pub struct SessionEventLogRegisterInterestResult { + /// Opaque handle for this registration. Pass to releaseInterest to release. Each call to registerInterest produces a fresh handle, even when the same eventType is registered multiple times. + pub handle: String, } -/// Structured outcome of a rewind request. +/// Indicates whether the operation succeeded. /// ///
/// @@ -24809,19 +26267,9 @@ pub struct SessionHistoryPreviewRewindResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionHistoryRewindResult { - /// Failure detail. Set only for the failure and partial-failure outcomes (`files-rolled-back`, `rollback-incomplete`, `truncation-failed`, `checkpoint-cleanup-failed`, `snapshot-prune-failed`); omitted for `success` and for the unavailable outcomes (`session-busy`, `file-change-tracking-disabled`, `unsupported-remote-session`). - #[serde(skip_serializing_if = "Option::is_none")] - pub error: Option, - /// Number of persisted events removed by conversation truncation. Present only when truncation succeeded (outcomes `success`, `checkpoint-cleanup-failed`, and `snapshot-prune-failed`); omitted for every unavailable outcome (`session-busy`, `file-change-tracking-disabled`, `unsupported-remote-session`) and for `truncation-failed`, `files-rolled-back`, and `rollback-incomplete`. - #[serde(skip_serializing_if = "Option::is_none")] - pub events_removed: Option, - /// Overall rewind outcome. This discriminates the result: it governs which of the remaining fields are populated, so consumers must switch on it before reading `eventsRemoved`, `restoredFiles`, `skippedFiles`, or `error`. See each field for the outcomes that populate it. - pub outcome: HistoryRewindOutcome, - /// Absolute paths restored to their captured preimages. Always empty for conversation-only rewinds and for the unavailable outcomes (`session-busy`, `file-change-tracking-disabled`, `unsupported-remote-session`); only conversation-and-files outcomes that reached the file-restore stage populate it. - pub restored_files: Vec, - /// Captured files intentionally left unchanged. Always empty for conversation-only rewinds and for the unavailable outcomes (`session-busy`, `file-change-tracking-disabled`, `unsupported-remote-session`); only conversation-and-files outcomes that reached the file-restore stage populate it. - pub skipped_files: Vec, +pub struct SessionEventLogReleaseInterestResult { + /// Whether the operation succeeded + pub success: bool, } /// Identifies the target session. @@ -24834,12 +26282,12 @@ pub struct SessionHistoryRewindResult { /// #[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionHistoryCancelBackgroundCompactionParams { +pub struct SessionUsageGetMetricsParams { /// Target session identifier pub session_id: SessionId, } -/// Indicates whether an in-progress background compaction was cancelled. +/// Accumulated session usage metrics, including premium request cost, token counts, model breakdown, and code-change totals. /// ///
/// @@ -24849,9 +26297,53 @@ pub struct SessionHistoryCancelBackgroundCompactionParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionHistoryCancelBackgroundCompactionResult { - /// Whether an in-progress background compaction was cancelled. False when no compaction was running, when the session is remote, or when the underlying processor was unavailable. - pub cancelled: bool, +pub struct SessionUsageGetMetricsResult { + /// Per-agent usage metrics, keyed by agent instance identifier. The main conversation uses the stable key `main`. + #[serde(skip_serializing_if = "Option::is_none")] + pub agent_metrics: Option>, + /// Aggregated code change metrics + pub code_changes: UsageMetricsCodeChanges, + /// Currently active model identifier + #[serde(skip_serializing_if = "Option::is_none")] + pub current_model: Option, + /// Input tokens from the most recent main-agent API call + pub last_call_input_tokens: i64, + /// Output tokens from the most recent main-agent API call + pub last_call_output_tokens: i64, + /// Per-model token and request metrics, keyed by model identifier + pub model_metrics: HashMap, + /// ISO 8601 timestamp when the session started + pub session_start_time: String, + /// Session-wide per-token-type accumulated token counts + #[serde(skip_serializing_if = "Option::is_none")] + pub token_details: Option>, + /// Total time spent in model API calls (milliseconds) + pub total_api_duration_ms: i64, + /// Session-wide accumulated nano-AI units cost + #[serde(skip_serializing_if = "Option::is_none")] + pub total_nano_aiu: Option, + /// Total user-initiated premium request cost across all models (may be fractional due to multipliers) + pub total_premium_request_cost: f64, + /// Raw count of user-initiated API requests + pub total_user_requests: i64, +} + +/// GitHub URL for the session and a flag indicating whether remote steering is enabled. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionRemoteEnableResult { + /// Whether remote steering is enabled + pub remote_steerable: bool, + /// GitHub frontend URL for this session + #[serde(skip_serializing_if = "Option::is_none")] + pub url: Option, } /// Identifies the target session. @@ -24864,12 +26356,12 @@ pub struct SessionHistoryCancelBackgroundCompactionResult { /// #[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionHistoryAbortManualCompactionParams { +pub struct SessionRemoteDisableParams { /// Target session identifier pub session_id: SessionId, } -/// Indicates whether an in-progress manual compaction was aborted. +/// Persist a steerability change as a `session.remote_steerable_changed` event. Used by the host (CLI / SDK consumer) when it has just finished enabling or disabling steering on a remote exporter that the runtime does not directly own. /// ///
/// @@ -24879,10 +26371,7 @@ pub struct SessionHistoryAbortManualCompactionParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionHistoryAbortManualCompactionResult { - /// Whether an in-progress manual compaction was aborted. False when no manual compaction was running, when its abort controller was already aborted, or when the session is remote. - pub aborted: bool, -} +pub struct SessionRemoteNotifySteerableChangedResult {} /// Identifies the target session. /// @@ -24894,12 +26383,12 @@ pub struct SessionHistoryAbortManualCompactionResult { /// #[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionHistorySummarizeForHandoffParams { +pub struct SessionVisibilityGetParams { /// Target session identifier pub session_id: SessionId, } -/// Markdown summary of the conversation context (empty when not available). +/// Current sharing status and shareable GitHub URL for a session. /// ///
/// @@ -24909,12 +26398,18 @@ pub struct SessionHistorySummarizeForHandoffParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionHistorySummarizeForHandoffResult { - /// Markdown summary of the conversation context produced by an LLM. Empty string when there are no messages or when the session does not support local summarization. - pub summary: String, +pub struct SessionVisibilityGetResult { + /// Shareable GitHub URL for the session. Present when the session is synced and the URL can be resolved. + #[serde(skip_serializing_if = "Option::is_none")] + pub share_url: Option, + /// Current sharing status. Absent when the session is not synced or the status could not be retrieved (e.g. the user is not authenticated). + #[serde(skip_serializing_if = "Option::is_none")] + pub status: Option, + /// Whether the session has been synced to Mission Control (i.e. has a GitHub task). When false, the session cannot be shared and `status`/`shareUrl` are absent. + pub synced: bool, } -/// What a successful clear removed. A clear that could not be applied rejects instead of reporting a count. +/// Effective sharing status and shareable GitHub URL after updating session visibility. /// ///
/// @@ -24924,9 +26419,15 @@ pub struct SessionHistorySummarizeForHandoffResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionHistoryClearContextResult { - /// Number of non-system, non-developer messages that were removed from the conversation. Zero only when the window already held no conversation. - pub messages_cleared: i64, +pub struct SessionVisibilitySetResult { + /// Shareable GitHub URL for the session. Present when the session is synced and the URL can be resolved. + #[serde(skip_serializing_if = "Option::is_none")] + pub share_url: Option, + /// Effective sharing status after the update. May differ from the requested status for task types that are already visible to repository readers by default. Absent when the update could not be applied (e.g. the session is not synced or the user is not authenticated). + #[serde(skip_serializing_if = "Option::is_none")] + pub status: Option, + /// Whether the session has been synced to Mission Control (i.e. has a GitHub task). When false, the visibility change could not be applied and `status`/`shareUrl` are absent. + pub synced: bool, } /// Identifies the target session. @@ -24939,12 +26440,27 @@ pub struct SessionHistoryClearContextResult { /// #[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionQueuePendingItemsParams { +pub struct SessionScheduleListParams { /// Target session identifier pub session_id: SessionId, } -/// Snapshot of the session's pending queued items and immediate-steering messages. +/// Snapshot of the currently active recurring prompts for this session. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionScheduleListResult { + /// Active scheduled prompts, ordered by id. + pub entries: Vec, +} + +/// Identifies the target session. /// ///
/// @@ -24954,11 +26470,9 @@ pub struct SessionQueuePendingItemsParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionQueuePendingItemsResult { - /// Pending queued items in submission order. Includes user messages, queued slash commands, and queued model changes; omits internal system items. - pub items: Vec, - /// Display text for messages currently in the immediate steering queue (interjections sent during a running turn). - pub steering_messages: Vec, +pub struct SessionScheduleHydrateParams { + /// Target session identifier + pub session_id: SessionId, } /// Identifies the target session. @@ -24971,12 +26485,12 @@ pub struct SessionQueuePendingItemsResult { /// #[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionQueueSnapshotParams { +pub struct SessionScheduleHasSelfPacedParams { /// Target session identifier pub session_id: SessionId, } -/// Internal snapshot of native queue state for local session orchestration. +/// Whether the session currently has an active self-paced schedule. /// ///
/// @@ -24986,20 +26500,12 @@ pub struct SessionQueueSnapshotParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionQueueSnapshotResult { - /// Insertion orders for queued items, aligned with `items`. - #[serde(skip_serializing_if = "Option::is_none")] - pub item_orders: Option>, - /// User-facing pending items in FIFO order. - pub items: Vec, - /// Insertion orders for immediate steering messages, aligned with `steeringMessages`. - #[serde(skip_serializing_if = "Option::is_none")] - pub steering_message_orders: Option>, - /// Immediate steering messages waiting for an active turn. - pub steering_messages: Vec, +pub struct SessionScheduleHasSelfPacedResult { + /// True when at least one active schedule is self-paced. + pub has_self_paced: bool, } -/// Result of moving a queued item. +/// Result of registering or re-arming a scheduled prompt. /// ///
/// @@ -25009,12 +26515,16 @@ pub struct SessionQueueSnapshotResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionQueueMoveItemResult { - /// True when the item changed position; false when it was already at the requested position. - pub changed: bool, +pub struct SessionScheduleAddResult { + /// The registered or updated schedule entry. + #[serde(skip_serializing_if = "Option::is_none")] + pub entry: Option, + /// User-facing validation error, when registration failed. + #[serde(skip_serializing_if = "Option::is_none")] + pub error: Option, } -/// Result of inserting a queued message. +/// Result of registering or re-arming a scheduled prompt. /// ///
/// @@ -25024,12 +26534,16 @@ pub struct SessionQueueMoveItemResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionQueueInsertAtResult { - /// Fresh stable opaque id assigned to the inserted item. - pub id: String, +pub struct SessionScheduleAddCronResult { + /// The registered or updated schedule entry. + #[serde(skip_serializing_if = "Option::is_none")] + pub entry: Option, + /// User-facing validation error, when registration failed. + #[serde(skip_serializing_if = "Option::is_none")] + pub error: Option, } -/// Result of removing a queued item. +/// Result of registering or re-arming a scheduled prompt. /// ///
/// @@ -25039,12 +26553,16 @@ pub struct SessionQueueInsertAtResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionQueueRemoveAtResult { - /// True when the addressed item was removed. - pub removed: bool, +pub struct SessionScheduleAddAtResult { + /// The registered or updated schedule entry. + #[serde(skip_serializing_if = "Option::is_none")] + pub entry: Option, + /// User-facing validation error, when registration failed. + #[serde(skip_serializing_if = "Option::is_none")] + pub error: Option, } -/// Result of editing a queued message. +/// Result of registering or re-arming a scheduled prompt. /// ///
/// @@ -25054,12 +26572,16 @@ pub struct SessionQueueRemoveAtResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionQueueUpdateTextResult { - /// True when the stored text changed. - pub updated: bool, +pub struct SessionScheduleAddSelfPacedResult { + /// The registered or updated schedule entry. + #[serde(skip_serializing_if = "Option::is_none")] + pub entry: Option, + /// User-facing validation error, when registration failed. + #[serde(skip_serializing_if = "Option::is_none")] + pub error: Option, } -/// Result of duplicating a queued item. +/// Result of registering or re-arming a scheduled prompt. /// ///
/// @@ -25069,12 +26591,16 @@ pub struct SessionQueueUpdateTextResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionQueueDuplicateAtResult { - /// Fresh stable opaque id assigned to the duplicate. - pub id: String, +pub struct SessionScheduleRearmSelfPacedResult { + /// The registered or updated schedule entry. + #[serde(skip_serializing_if = "Option::is_none")] + pub entry: Option, + /// User-facing validation error, when registration failed. + #[serde(skip_serializing_if = "Option::is_none")] + pub error: Option, } -/// Result of trying to steer a queued message into a live turn. +/// Remove a scheduled prompt by id. The result entry is omitted if the id was unknown. /// ///
/// @@ -25084,12 +26610,13 @@ pub struct SessionQueueDuplicateAtResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionQueueSendNowResult { - /// True when the item was accepted into the steering lane; false when no main turn was live. - pub steered: bool, +pub struct SessionScheduleStopResult { + /// The removed entry, or omitted if no entry matched. + #[serde(skip_serializing_if = "Option::is_none")] + pub entry: Option, } -/// Identifies the target session. +/// A bearer token supplied by the SDK client for a BYOK provider. The runtime sets it as `Authorization: Bearer ` on the outbound request and does no caching; the SDK consumer owns token caching and refresh. /// ///
/// @@ -25099,12 +26626,12 @@ pub struct SessionQueueSendNowResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionQueueHasPendingParams { - /// Target session identifier - pub session_id: SessionId, +pub struct ProviderTokenGetTokenResult { + /// The bearer token value (without the `Bearer ` prefix). + pub token: String, } -/// Whether the native queue has pending work. +/// Acknowledgement that a factory request was accepted. /// ///
/// @@ -25114,12 +26641,9 @@ pub struct SessionQueueHasPendingParams { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionQueueHasPendingResult { - /// True when queued or immediate native work is pending. - pub has_pending: bool, -} +pub struct FactoryAbortResult {} -/// Whether a deferred-idle drain should run. +/// Identifies the target session. /// ///
/// @@ -25129,12 +26653,12 @@ pub struct SessionQueueHasPendingResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionQueueBeginDeferredIdleDrainResult { - /// True when the host should run finishDeferredIdleDrain asynchronously. - pub should_drain: bool, +pub struct SessionFsSqliteExistsParams { + /// Target session identifier + pub session_id: SessionId, } -/// Action selected by the native deferred-idle drain. +/// Canvas open result returned by the provider. /// ///
/// @@ -25144,14 +26668,19 @@ pub struct SessionQueueBeginDeferredIdleDrainResult { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct SessionQueueFinishDeferredIdleDrainResult { - /// Whether the deferred idle was caused by an aborted foreground turn. - pub aborted: bool, - /// One of none, processQueue, or emitSessionIdle. - pub action: String, +pub struct CanvasOpenResult { + /// Provider-supplied status text + #[serde(skip_serializing_if = "Option::is_none")] + pub status: Option, + /// Provider-supplied title + #[serde(skip_serializing_if = "Option::is_none")] + pub title: Option, + /// URL for web-rendered canvases + #[serde(skip_serializing_if = "Option::is_none")] + pub url: Option, } -/// Identifies the target session. +/// Validation errors from the most recent authentication attempt. /// ///
/// @@ -25159,14 +26688,9 @@ pub struct SessionQueueFinishDeferredIdleDrainResult { /// and may change or be removed in future SDK or CLI releases. /// ///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct SessionQueueRemoveMostRecentParams { - /// Target session identifier - pub session_id: SessionId, -} +pub type AuthValidationErrors = Vec; -/// Indicates whether a user-facing pending item was removed. +/// SHA-256 digest encoded as exactly 64 lowercase hexadecimal characters. /// ///
/// @@ -25174,14 +26698,9 @@ pub struct SessionQueueRemoveMostRecentParams { /// and may change or be removed in future SDK or CLI releases. /// ///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct SessionQueueRemoveMostRecentResult { - /// True if a user-facing pending item was removed (LIFO across both queues); false when no removable items remained. - pub removed: bool, -} +pub type CardDigestValue = String; -/// Identifies the target session. +/// Bounded extensible wire-feature identifier. Known values are described by `CatalogCapability`; newer callers may send future identifiers so an older runtime can return a typed negotiation refusal instead of failing schema validation. Capability negotiation establishes contract understanding, while each operation's result separately reports runtime availability. /// ///
/// @@ -25189,14 +26708,9 @@ pub struct SessionQueueRemoveMostRecentResult { /// and may change or be removed in future SDK or CLI releases. /// ///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct SessionQueueClearParams { - /// Target session identifier - pub session_id: SessionId, -} +pub type CatalogCapabilityId = String; -/// Indicates whether a user-facing pending item was removed. +/// HTTP headers as a map from lowercased header name to a list of values. Multi-valued headers (e.g. Set-Cookie) preserve all values. /// ///
/// @@ -25204,14 +26718,9 @@ pub struct SessionQueueClearParams { /// and may change or be removed in future SDK or CLI releases. /// ///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct SessionQueueConsumeSystemNotificationsResult { - /// True if a user-facing pending item was removed (LIFO across both queues); false when no removable items remained. - pub removed: bool, -} +pub type LlmInferenceHeaders = HashMap>; -/// Identifies the target session. +/// 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. /// ///
/// @@ -25219,14 +26728,9 @@ pub struct SessionQueueConsumeSystemNotificationsResult { /// and may change or be removed in future SDK or CLI releases. /// ///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct SessionQueueEnqueueResumePendingParams { - /// Target session identifier - pub session_id: SessionId, -} +pub type McpExecuteSamplingResult = HashMap; -/// Result of enqueueing the resume-pending wake item. +/// A runtime-assigned secret placeholder. The identifier is carried once, inside the placeholder, so it cannot contradict a separate secret-id field. /// ///
/// @@ -25234,14 +26738,9 @@ pub struct SessionQueueEnqueueResumePendingParams { /// and may change or be removed in future SDK or CLI releases. /// ///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct SessionQueueEnqueueResumePendingResult { - /// True when a wake item was newly queued. - pub queued: bool, -} +pub type McpPlanSecretReference = String; -/// Identifies the target session. +/// The form values submitted by the user (present when action is 'accept') /// ///
/// @@ -25249,14 +26748,9 @@ pub struct SessionQueueEnqueueResumePendingResult { /// and may change or be removed in future SDK or CLI releases. /// ///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct SessionQueueProcessParams { - /// Target session identifier - pub session_id: SessionId, -} +pub type UIElicitationResponseContent = HashMap; -/// Batch of session events returned by a read, with cursor and continuation metadata. +/// List of all authenticated users /// ///
/// @@ -25264,20 +26758,9 @@ pub struct SessionQueueProcessParams { /// and may change or be removed in future SDK or CLI releases. /// ///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct SessionEventLogReadResult { - /// 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). - pub cursor: String, - /// 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. - pub cursor_status: EventsCursorStatus, - /// 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. - pub events: Vec, - /// 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. - pub has_more: bool, -} +pub type AccountGetAllUsersResult = Vec; -/// Identifies the target session. +/// The number of running background agents (task-registry agents) that were cancelled. /// ///
/// @@ -25285,14 +26768,9 @@ pub struct SessionEventLogReadResult { /// and may change or be removed in future SDK or CLI releases. /// ///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct SessionEventLogTailParams { - /// Target session identifier - pub session_id: SessionId, -} +pub type SessionCancelAllBackgroundAgentsResult = i64; -/// Snapshot of the current tail cursor without returning any events. Use this when a consumer wants to subscribe to live events going forward without first paginating through the entire persisted history (which would happen if `read` were called without a cursor on a long-lived session). +/// Authentication accounts available to the internal session host. /// ///
/// @@ -25300,14 +26778,9 @@ pub struct SessionEventLogTailParams { /// and may change or be removed in future SDK or CLI releases. /// ///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct SessionEventLogTailResult { - /// Opaque cursor pointing at the current tail of the session's persisted-events history. Pass back to `read` to receive only events that arrive AFTER this snapshot. When the session has no events, this returns the same sentinel as an unset cursor (i.e. equivalent to omitting the cursor on a first read). - pub cursor: String, -} +pub type SessionGitHubAuthGetAllAuthAvailableResult = Vec; -/// Opaque handle representing an event-type interest registration. +/// Whether the current authentication was logged out. /// ///
/// @@ -25315,14 +26788,9 @@ pub struct SessionEventLogTailResult { /// and may change or be removed in future SDK or CLI releases. /// ///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct SessionEventLogRegisterInterestResult { - /// Opaque handle for this registration. Pass to releaseInterest to release. Each call to registerInterest produces a fresh handle, even when the same eventType is registered multiple times. - pub handle: String, -} +pub type SessionGitHubAuthLogoutResult = bool; -/// Indicates whether the operation succeeded. +/// Whether the requested authentication was logged out. /// ///
/// @@ -25330,14 +26798,9 @@ pub struct SessionEventLogRegisterInterestResult { /// and may change or be removed in future SDK or CLI releases. /// ///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct SessionEventLogReleaseInterestResult { - /// Whether the operation succeeded - pub success: bool, -} +pub type SessionGitHubAuthLogoutUserResult = bool; -/// Identifies the target session. +/// Validation errors from the most recent authentication attempt. /// ///
/// @@ -25345,14 +26808,9 @@ pub struct SessionEventLogReleaseInterestResult { /// and may change or be removed in future SDK or CLI releases. /// ///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct SessionUsageGetMetricsParams { - /// Target session identifier - pub session_id: SessionId, -} +pub type SessionGitHubAuthLastAuthErrorsResult = Vec; -/// Accumulated session usage metrics, including premium request cost, token counts, model breakdown, and code-change totals. +/// Standard MCP CallToolResult /// ///
/// @@ -25360,40 +26818,81 @@ pub struct SessionUsageGetMetricsParams { /// and may change or be removed in future SDK or CLI releases. /// ///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct SessionUsageGetMetricsResult { - /// Per-agent usage metrics, keyed by agent instance identifier. The main conversation uses the stable key `main`. - #[serde(skip_serializing_if = "Option::is_none")] - pub agent_metrics: Option>, - /// Aggregated code change metrics - pub code_changes: UsageMetricsCodeChanges, - /// Currently active model identifier - #[serde(skip_serializing_if = "Option::is_none")] - pub current_model: Option, - /// Input tokens from the most recent main-agent API call - pub last_call_input_tokens: i64, - /// Output tokens from the most recent main-agent API call - pub last_call_output_tokens: i64, - /// Per-model token and request metrics, keyed by model identifier - pub model_metrics: HashMap, - /// ISO 8601 timestamp when the session started - pub session_start_time: String, - /// Session-wide per-token-type accumulated token counts - #[serde(skip_serializing_if = "Option::is_none")] - pub token_details: Option>, - /// Total time spent in model API calls (milliseconds) - pub total_api_duration_ms: i64, - /// Session-wide accumulated nano-AI units cost - #[serde(skip_serializing_if = "Option::is_none")] - pub total_nano_aiu: Option, - /// Total user-initiated premium request cost across all models (may be fractional due to multipliers) - pub total_premium_request_cost: f64, - /// Raw count of user-initiated API requests - pub total_user_requests: i64, +pub type SessionMcpAppsCallToolResult = HashMap; + +/// Authentication host. HMAC auth always targets the public GitHub host. +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum HMACAuthInfoHost { + #[serde(rename = "https://github.com")] + #[default] + HttpsGitHubCom, } -/// GitHub URL for the session and a flag indicating whether remote steering is enabled. +/// HMAC-based authentication used by GitHub-internal services. +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum HMACAuthInfoType { + #[serde(rename = "hmac")] + #[default] + Hmac, +} + +/// Personal access token (PAT) or server-to-server token sourced from an environment variable. +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum EnvAuthInfoType { + #[serde(rename = "env")] + #[default] + Env, +} + +/// SDK-side token authentication; the host configured the token directly via the SDK. +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum TokenAuthInfoType { + #[serde(rename = "token")] + #[default] + Token, +} + +/// Authentication host (always the public GitHub host). +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum CopilotApiTokenAuthInfoHost { + #[serde(rename = "https://github.com")] + #[default] + HttpsGitHubCom, +} + +/// Direct Copilot API authentication via the `GITHUB_COPILOT_API_TOKEN` + `COPILOT_API_URL` environment-variable pair. The token itself is read from the environment by the runtime, not carried in this struct. +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum CopilotApiTokenAuthInfoType { + #[serde(rename = "copilot-api-token")] + #[default] + CopilotApiToken, +} + +/// OAuth user authentication. The token itself is held in the runtime's secret token store (keyed by host+login) and is NOT carried in this struct. +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum UserAuthInfoType { + #[serde(rename = "user")] + #[default] + User, +} + +/// Authentication via the `gh` CLI's saved credentials. +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum GhCliAuthInfoType { + #[serde(rename = "gh-cli")] + #[default] + GhCli, +} + +/// API-key authentication for non-GitHub LLM providers (e.g. when running BYOM-style). +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum ApiKeyAuthInfoType { + #[serde(rename = "api-key")] + #[default] + ApiKey, +} + +/// Authentication credentials accepted only at native protocol ingress. Runtime outputs use credential-free `AuthIdentity` metadata. /// ///
/// @@ -25401,17 +26900,19 @@ pub struct SessionUsageGetMetricsResult { /// and may change or be removed in future SDK or CLI releases. /// ///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct SessionRemoteEnableResult { - /// Whether remote steering is enabled - pub remote_steerable: bool, - /// GitHub frontend URL for this session - #[serde(skip_serializing_if = "Option::is_none")] - pub url: Option, +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum AuthInfo { + Hmac(HMACAuthInfo), + Env(EnvAuthInfo), + Token(TokenAuthInfo), + CopilotApiToken(CopilotApiTokenAuthInfo), + User(UserAuthInfo), + GhCli(GhCliAuthInfo), + ApiKey(ApiKeyAuthInfo), } -/// Identifies the target session. +/// Resolved Anthropic adaptive-thinking capability for a model. /// ///
/// @@ -25419,14 +26920,24 @@ pub struct SessionRemoteEnableResult { /// and may change or be removed in future SDK or CLI releases. /// ///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct SessionRemoteDisableParams { - /// Target session identifier - pub session_id: SessionId, +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum AdaptiveThinkingSupport { + /// The model does not accept thinking.type='adaptive' + #[serde(rename = "unsupported")] + Unsupported, + /// The model accepts adaptive thinking but also accepts thinking.type='enabled' + #[serde(rename = "optional")] + Optional, + /// The model only accepts adaptive thinking and rejects thinking.type='enabled' with HTTP 400 (e.g. opus-4.7/4.8) + #[serde(rename = "required")] + Required, + /// Unknown variant for forward compatibility. + #[default] + #[serde(other)] + Unknown, } -/// Persist a steerability change as a `session.remote_steerable_changed` event. Used by the host (CLI / SDK consumer) when it has just finished enabling or disabling steering on a remote exporter that the runtime does not directly own. +/// Which tier this directory belongs to /// ///
/// @@ -25434,11 +26945,21 @@ pub struct SessionRemoteDisableParams { /// and may change or be removed in future SDK or CLI releases. /// ///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct SessionRemoteNotifySteerableChangedResult {} +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum AgentDiscoveryPathScope { + /// The user's personal agent configuration directory. + #[serde(rename = "user")] + User, + /// A project's repository agent directory. + #[serde(rename = "project")] + Project, + /// Unknown variant for forward compatibility. + #[default] + #[serde(other)] + Unknown, +} -/// Identifies the target session. +/// Where the agent definition was loaded from /// ///
/// @@ -25446,14 +26967,33 @@ pub struct SessionRemoteNotifySteerableChangedResult {} /// and may change or be removed in future SDK or CLI releases. /// ///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct SessionVisibilityGetParams { - /// Target session identifier - pub session_id: SessionId, +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum AgentInfoSource { + /// Agent loaded from the user's personal agent configuration. + #[serde(rename = "user")] + User, + /// Agent loaded from the current project's repository configuration. + #[serde(rename = "project")] + Project, + /// Agent inherited from a parent project or workspace. + #[serde(rename = "inherited")] + Inherited, + /// Agent provided by a remote runtime or service. + #[serde(rename = "remote")] + Remote, + /// Agent contributed by an installed plugin. + #[serde(rename = "plugin")] + Plugin, + /// Agent built into the Copilot runtime. + #[serde(rename = "builtin")] + Builtin, + /// Unknown variant for forward compatibility. + #[default] + #[serde(other)] + Unknown, } -/// Current sharing status and shareable GitHub URL for a session. +/// Kind of attention required when status === "attention". Meaningful only when status === "attention". /// ///
/// @@ -25461,20 +27001,30 @@ pub struct SessionVisibilityGetParams { /// and may change or be removed in future SDK or CLI releases. /// ///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct SessionVisibilityGetResult { - /// Shareable GitHub URL for the session. Present when the session is synced and the URL can be resolved. - #[serde(skip_serializing_if = "Option::is_none")] - pub share_url: Option, - /// Current sharing status. Absent when the session is not synced or the status could not be retrieved (e.g. the user is not authenticated). - #[serde(skip_serializing_if = "Option::is_none")] - pub status: Option, - /// Whether the session has been synced to Mission Control (i.e. has a GitHub task). When false, the session cannot be shared and `status`/`shareUrl` are absent. - pub synced: bool, +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum AgentRegistryLiveTargetEntryAttentionKind { + /// Session is blocked on an unrecoverable error + #[serde(rename = "error")] + Error, + /// Session is waiting for a tool-permission decision + #[serde(rename = "permission")] + Permission, + /// Session is waiting for the user to approve or reject a plan + #[serde(rename = "exit_plan")] + ExitPlan, + /// Session is waiting on an elicitation prompt + #[serde(rename = "elicitation")] + Elicitation, + /// Session is waiting for free-form user input + #[serde(rename = "user_input")] + UserInput, + /// Unknown variant for forward compatibility. + #[default] + #[serde(other)] + Unknown, } -/// Effective sharing status and shareable GitHub URL after updating session visibility. +/// Process kind tag for the registry entry /// ///
/// @@ -25482,20 +27032,21 @@ pub struct SessionVisibilityGetResult { /// and may change or be removed in future SDK or CLI releases. /// ///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct SessionVisibilitySetResult { - /// Shareable GitHub URL for the session. Present when the session is synced and the URL can be resolved. - #[serde(skip_serializing_if = "Option::is_none")] - pub share_url: Option, - /// Effective sharing status after the update. May differ from the requested status for task types that are already visible to repository readers by default. Absent when the update could not be applied (e.g. the session is not synced or the user is not authenticated). - #[serde(skip_serializing_if = "Option::is_none")] - pub status: Option, - /// Whether the session has been synced to Mission Control (i.e. has a GitHub task). When false, the visibility change could not be applied and `status`/`shareUrl` are absent. - pub synced: bool, +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum AgentRegistryLiveTargetEntryKind { + /// Interactive Copilot CLI exposing a UI server (legacy/normal CLI process) + #[serde(rename = "ui-server")] + UiServer, + /// Headless `--server --managed-server` child spawned by a controller + #[serde(rename = "managed-server")] + ManagedServer, + /// Unknown variant for forward compatibility. + #[default] + #[serde(other)] + Unknown, } -/// Identifies the target session. +/// How the most recent turn ended (clean vs aborted). Lets the renderer distinguish done from done_cancelled. /// ///
/// @@ -25503,14 +27054,21 @@ pub struct SessionVisibilitySetResult { /// and may change or be removed in future SDK or CLI releases. /// ///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct SessionScheduleListParams { - /// Target session identifier - pub session_id: SessionId, +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum AgentRegistryLiveTargetEntryLastTerminalEvent { + /// Last turn ended cleanly (model returned a final assistant message) + #[serde(rename = "turn_end")] + TurnEnd, + /// Last turn was aborted (e.g. user interrupted) + #[serde(rename = "abort")] + Abort, + /// Unknown variant for forward compatibility. + #[default] + #[serde(other)] + Unknown, } -/// Snapshot of the currently active recurring prompts for this session. +/// Coarse lifecycle status of the foreground session /// ///
/// @@ -25518,14 +27076,27 @@ pub struct SessionScheduleListParams { /// and may change or be removed in future SDK or CLI releases. /// ///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct SessionScheduleListResult { - /// Active scheduled prompts, ordered by id. - pub entries: Vec, +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum AgentRegistryLiveTargetEntryStatus { + /// Session is actively processing a turn + #[serde(rename = "working")] + Working, + /// Session is idle, waiting for input + #[serde(rename = "waiting")] + Waiting, + /// Last turn completed successfully + #[serde(rename = "done")] + Done, + /// Session needs user attention (see attentionKind for the specific reason) + #[serde(rename = "attention")] + Attention, + /// Unknown variant for forward compatibility. + #[default] + #[serde(other)] + Unknown, } -/// Identifies the target session. +/// Categorized reason for log-open failure /// ///
/// @@ -25533,14 +27104,32 @@ pub struct SessionScheduleListResult { /// and may change or be removed in future SDK or CLI releases. /// ///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct SessionScheduleHydrateParams { - /// Target session identifier - pub session_id: SessionId, +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum AgentRegistryLogCaptureOpenErrorReason { + /// Filesystem permission denied opening the log file + #[serde(rename = "permission")] + Permission, + /// No space left on device + #[serde(rename = "disk_full")] + DiskFull, + /// Other / uncategorized open failure + #[serde(rename = "other")] + Other, + /// Unknown variant for forward compatibility. + #[default] + #[serde(other)] + Unknown, } -/// Identifies the target session. +/// Discriminator: child_process.spawn itself failed +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum AgentRegistrySpawnErrorKind { + #[serde(rename = "spawn-error")] + #[default] + SpawnError, +} + +/// Permission posture for the new session. 'yolo' requires the controller-local session to currently be in allow-all mode. /// ///
/// @@ -25548,14 +27137,37 @@ pub struct SessionScheduleHydrateParams { /// and may change or be removed in future SDK or CLI releases. /// ///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct SessionScheduleHasSelfPacedParams { - /// Target session identifier - pub session_id: SessionId, +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum AgentRegistrySpawnPermissionMode { + /// Standard permission posture (prompts for each request) + #[serde(rename = "default")] + Default, + /// Full allow-all (requires the controller-local session to currently be in allow-all mode) + #[serde(rename = "yolo")] + Yolo, + /// Unknown variant for forward compatibility. + #[default] + #[serde(other)] + Unknown, } -/// Whether the session currently has an active self-paced schedule. +/// Discriminator: spawn succeeded but child never registered +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum AgentRegistrySpawnRegistryTimeoutKind { + #[serde(rename = "registry-timeout")] + #[default] + RegistryTimeout, +} + +/// Discriminator: managed-server child spawned successfully +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum AgentRegistrySpawnSpawnedKind { + #[serde(rename = "spawned")] + #[default] + Spawned, +} + +/// Which parameter field was invalid. Omitted when the rejection is not field-specific. /// ///
/// @@ -25563,14 +27175,38 @@ pub struct SessionScheduleHasSelfPacedParams { /// and may change or be removed in future SDK or CLI releases. /// ///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct SessionScheduleHasSelfPacedResult { - /// True when at least one active schedule is self-paced. - pub has_self_paced: bool, +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum AgentRegistrySpawnValidationErrorField { + /// The cwd parameter + #[serde(rename = "cwd")] + Cwd, + /// The session name parameter + #[serde(rename = "name")] + Name, + /// The agentName parameter + #[serde(rename = "agentName")] + AgentName, + /// The model parameter + #[serde(rename = "model")] + Model, + /// The permissionMode parameter + #[serde(rename = "permissionMode")] + PermissionMode, + /// Unknown variant for forward compatibility. + #[default] + #[serde(other)] + Unknown, } -/// Result of registering or re-arming a scheduled prompt. +/// Discriminator: synchronous pre-validation rejected the request +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum AgentRegistrySpawnValidationErrorKind { + #[serde(rename = "validation-error")] + #[default] + ValidationError, +} + +/// Categorized reason for the rejection. Low-cardinality enum so telemetry can aggregate by reason without leaking raw paths or agent/model names. /// ///
/// @@ -25578,18 +27214,33 @@ pub struct SessionScheduleHasSelfPacedResult { /// and may change or be removed in future SDK or CLI releases. /// ///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct SessionScheduleAddResult { - /// The registered or updated schedule entry. - #[serde(skip_serializing_if = "Option::is_none")] - pub entry: Option, - /// User-facing validation error, when registration failed. - #[serde(skip_serializing_if = "Option::is_none")] - pub error: Option, +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum AgentRegistrySpawnValidationErrorReason { + /// Provided cwd does not exist on disk + #[serde(rename = "cwd-not-found")] + CwdNotFound, + /// Provided cwd exists but is not a directory + #[serde(rename = "cwd-not-directory")] + CwdNotDirectory, + /// Session name failed validateSessionName + #[serde(rename = "invalid-name")] + InvalidName, + /// Requested agent name was not found in builtin or custom agents + #[serde(rename = "unknown-agent")] + UnknownAgent, + /// Requested model is not available to this session + #[serde(rename = "unknown-model")] + UnknownModel, + /// Caller asked for permissionMode='yolo' but the controller is not currently in allow-all mode + #[serde(rename = "yolo-not-allowed")] + YoloNotAllowed, + /// Unknown variant for forward compatibility. + #[default] + #[serde(other)] + Unknown, } -/// Result of registering or re-arming a scheduled prompt. +/// Outcome of an agentRegistry.spawn call. /// ///
/// @@ -25597,18 +27248,80 @@ pub struct SessionScheduleAddResult { /// and may change or be removed in future SDK or CLI releases. /// ///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct SessionScheduleAddCronResult { - /// The registered or updated schedule entry. - #[serde(skip_serializing_if = "Option::is_none")] - pub entry: Option, - /// User-facing validation error, when registration failed. - #[serde(skip_serializing_if = "Option::is_none")] - pub error: Option, +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum AgentRegistrySpawnResult { + Spawned(AgentRegistrySpawnSpawned), + SpawnError(AgentRegistrySpawnError), + RegistryTimeout(AgentRegistrySpawnRegistryTimeout), + ValidationError(AgentRegistrySpawnValidationError), +} + +/// Attachment type discriminator +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum AttachmentBlobType { + #[serde(rename = "blob")] + #[default] + Blob, +} + +/// Attachment type discriminator +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum AttachmentDirectoryType { + #[serde(rename = "directory")] + #[default] + Directory, +} + +/// Attachment type discriminator +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum AttachmentExtensionContextType { + #[serde(rename = "extension_context")] + #[default] + ExtensionContext, +} + +/// Attachment type discriminator +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum AttachmentFileType { + #[serde(rename = "file")] + #[default] + File, +} + +/// Attachment type discriminator +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum AttachmentGitHubActionsJobType { + #[serde(rename = "github_actions_job")] + #[default] + GitHubActionsJob, +} + +/// Attachment type discriminator +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum AttachmentGitHubCommitType { + #[serde(rename = "github_commit")] + #[default] + GitHubCommit, +} + +/// Attachment type discriminator +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum AttachmentGitHubFileType { + #[serde(rename = "github_file")] + #[default] + GitHubFile, +} + +/// Attachment type discriminator +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum AttachmentGitHubFileDiffType { + #[serde(rename = "github_file_diff")] + #[default] + GitHubFileDiff, } -/// Result of registering or re-arming a scheduled prompt. +/// Type of GitHub reference /// ///
/// @@ -25616,114 +27329,72 @@ pub struct SessionScheduleAddCronResult { /// and may change or be removed in future SDK or CLI releases. /// ///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct SessionScheduleAddAtResult { - /// The registered or updated schedule entry. - #[serde(skip_serializing_if = "Option::is_none")] - pub entry: Option, - /// User-facing validation error, when registration failed. - #[serde(skip_serializing_if = "Option::is_none")] - pub error: Option, +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum AttachmentGitHubReferenceType { + /// GitHub issue reference. + #[serde(rename = "issue")] + Issue, + /// GitHub pull request reference. + #[serde(rename = "pr")] + Pr, + /// GitHub discussion reference. + #[serde(rename = "discussion")] + Discussion, + /// Unknown variant for forward compatibility. + #[default] + #[serde(other)] + Unknown, } -/// Result of registering or re-arming a scheduled prompt. -/// -///
-/// -/// **Experimental.** This type is part of an experimental wire-protocol surface -/// and may change or be removed in future SDK or CLI releases. -/// -///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct SessionScheduleAddSelfPacedResult { - /// The registered or updated schedule entry. - #[serde(skip_serializing_if = "Option::is_none")] - pub entry: Option, - /// User-facing validation error, when registration failed. - #[serde(skip_serializing_if = "Option::is_none")] - pub error: Option, +/// Attachment type discriminator +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum AttachmentGitHubReleaseType { + #[serde(rename = "github_release")] + #[default] + GitHubRelease, } -/// Result of registering or re-arming a scheduled prompt. -/// -///
-/// -/// **Experimental.** This type is part of an experimental wire-protocol surface -/// and may change or be removed in future SDK or CLI releases. -/// -///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct SessionScheduleRearmSelfPacedResult { - /// The registered or updated schedule entry. - #[serde(skip_serializing_if = "Option::is_none")] - pub entry: Option, - /// User-facing validation error, when registration failed. - #[serde(skip_serializing_if = "Option::is_none")] - pub error: Option, +/// Attachment type discriminator +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum AttachmentGitHubRepositoryType { + #[serde(rename = "github_repository")] + #[default] + GitHubRepository, } -/// Remove a scheduled prompt by id. The result entry is omitted if the id was unknown. -/// -///
-/// -/// **Experimental.** This type is part of an experimental wire-protocol surface -/// and may change or be removed in future SDK or CLI releases. -/// -///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct SessionScheduleStopResult { - /// The removed entry, or omitted if no entry matched. - #[serde(skip_serializing_if = "Option::is_none")] - pub entry: Option, +/// Attachment type discriminator +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum AttachmentGitHubSnippetType { + #[serde(rename = "github_snippet")] + #[default] + GitHubSnippet, } -/// A bearer token supplied by the SDK client for a BYOK provider. The runtime sets it as `Authorization: Bearer ` on the outbound request and does no caching; the SDK consumer owns token caching and refresh. -/// -///
-/// -/// **Experimental.** This type is part of an experimental wire-protocol surface -/// and may change or be removed in future SDK or CLI releases. -/// -///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct ProviderTokenGetTokenResult { - /// The bearer token value (without the `Bearer ` prefix). - pub token: String, +/// Attachment type discriminator +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum AttachmentGitHubTreeComparisonType { + #[serde(rename = "github_tree_comparison")] + #[default] + GitHubTreeComparison, } -/// Acknowledgement that a factory request was accepted. -/// -///
-/// -/// **Experimental.** This type is part of an experimental wire-protocol surface -/// and may change or be removed in future SDK or CLI releases. -/// -///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct FactoryAbortResult {} +/// Attachment type discriminator +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum AttachmentGitHubUrlType { + #[serde(rename = "github_url")] + #[default] + GitHubUrl, +} -/// Identifies the target session. -/// -///
-/// -/// **Experimental.** This type is part of an experimental wire-protocol surface -/// and may change or be removed in future SDK or CLI releases. -/// -///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct SessionFsSqliteExistsParams { - /// Target session identifier - pub session_id: SessionId, +/// Attachment type discriminator +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum AttachmentSelectionType { + #[serde(rename = "selection")] + #[default] + Selection, } -/// Canvas open result returned by the provider. +/// Authentication type /// ///
/// @@ -25731,21 +27402,36 @@ pub struct SessionFsSqliteExistsParams { /// and may change or be removed in future SDK or CLI releases. /// ///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct CanvasOpenResult { - /// Provider-supplied status text - #[serde(skip_serializing_if = "Option::is_none")] - pub status: Option, - /// Provider-supplied title - #[serde(skip_serializing_if = "Option::is_none")] - pub title: Option, - /// URL for web-rendered canvases - #[serde(skip_serializing_if = "Option::is_none")] - pub url: Option, +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum AuthInfoType { + /// Authentication provided by a GitHub App HMAC credential. + #[serde(rename = "hmac")] + Hmac, + /// Authentication resolved from environment-provided credentials. + #[serde(rename = "env")] + Env, + /// Authentication from an interactive user sign-in. + #[serde(rename = "user")] + User, + /// Authentication delegated to the GitHub CLI. + #[serde(rename = "gh-cli")] + GhCli, + /// Authentication from an API key credential. + #[serde(rename = "api-key")] + ApiKey, + /// Authentication from a GitHub token. + #[serde(rename = "token")] + Token, + /// Authentication from a Copilot API token. + #[serde(rename = "copilot-api-token")] + CopilotApiToken, + /// Unknown variant for forward compatibility. + #[default] + #[serde(other)] + Unknown, } -/// Validation errors from the most recent authentication attempt. +/// Custom input-format kind. /// ///
/// @@ -25753,9 +27439,18 @@ pub struct CanvasOpenResult { /// and may change or be removed in future SDK or CLI releases. /// ///
-pub type AuthValidationErrors = Vec; +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum BuiltinToolFormatType { + /// The tool input is parsed with the supplied grammar. + #[serde(rename = "grammar")] + Grammar, + /// Unknown variant for forward compatibility. + #[default] + #[serde(other)] + Unknown, +} -/// HTTP headers as a map from lowercased header name to a list of values. Multi-valued headers (e.g. Set-Cookie) preserve all values. +/// Root JSON Schema type for a built-in tool input. /// ///
/// @@ -25763,9 +27458,18 @@ pub type AuthValidationErrors = Vec; /// and may change or be removed in future SDK or CLI releases. /// ///
-pub type LlmInferenceHeaders = HashMap>; +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum BuiltinToolInputSchemaType { + /// The tool accepts a JSON object. + #[serde(rename = "object")] + Object, + /// Unknown variant for forward compatibility. + #[default] + #[serde(other)] + Unknown, +} -/// 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. +/// Canonical digest algorithm for a validated MCP card /// ///
/// @@ -25773,19 +27477,66 @@ pub type LlmInferenceHeaders = HashMap>; /// and may change or be removed in future SDK or CLI releases. /// ///
-pub type McpExecuteSamplingResult = HashMap; +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum CardDigestAlgorithm { + /// SHA-256 over RFC 8785 canonical JSON encoded as UTF-8. + #[serde(rename = "sha256-rfc8785")] + Sha256Rfc8785, + /// Unknown variant for forward compatibility. + #[default] + #[serde(other)] + Unknown, +} -/// The form values submitted by the user (present when action is 'accept') -/// -///
-/// -/// **Experimental.** This type is part of an experimental wire-protocol surface -/// and may change or be removed in future SDK or CLI releases. -/// -///
-pub type UIElicitationResponseContent = HashMap; +/// AI skills are discovery-only and cannot be installed through this surface +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum CatalogAiSkillCandidateInstallability { + #[serde(rename = "not-installable-kind")] + #[default] + NotInstallableKind, +} + +/// Discriminator: this candidate describes an AI skill +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum CatalogAiSkillCandidateKind { + #[serde(rename = "ai-skill")] + #[default] + AiSkill, +} + +/// Media type of the underlying AI skill card +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum CatalogAiSkillCandidateMediaType { + #[serde(rename = "application/ai-skill")] + #[default] + ApplicationAiSkill, +} + +/// Media type advertised for the referenced AI skill card +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum CatalogAiSkillCandidateProvenanceMediaType { + #[serde(rename = "application/ai-skill")] + #[default] + ApplicationAiSkill, +} + +/// Discriminator: the card is URL-backed, and carries no embedded data +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum CatalogCandidateSourceUrlKind { + #[serde(rename = "url")] + #[default] + Url, +} -/// List of all authenticated users +/// Discriminator: the card is embedded, and carries no URL +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum CatalogCandidateSourceEmbeddedKind { + #[serde(rename = "embedded")] + #[default] + Embedded, +} + +/// 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. /// ///
/// @@ -25793,9 +27544,22 @@ pub type UIElicitationResponseContent = HashMap; /// and may change or be removed in future SDK or CLI releases. /// ///
-pub type AccountGetAllUsersResult = Vec; +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum CatalogCandidateSource { + Url(CatalogCandidateSourceUrl), + Embedded(CatalogCandidateSourceEmbedded), +} -/// The number of running background agents (task-registry agents) that were cancelled. +/// Discriminator: the caller is not authenticated +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum CatalogAuthenticationRequiredErrorKind { + #[serde(rename = "authentication-required")] + #[default] + AuthenticationRequired, +} + +/// Why the catalog authority did not accept the caller's identity /// ///
/// @@ -25803,9 +27567,24 @@ pub type AccountGetAllUsersResult = Vec; /// and may change or be removed in future SDK or CLI releases. /// ///
-pub type SessionCancelAllBackgroundAgentsResult = i64; +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum CatalogAuthenticationRequiredReason { + /// No credential was presented, so there is nothing to refresh and the caller must sign in. + #[serde(rename = "no-credential")] + NoCredential, + /// A credential was presented and its lifetime has elapsed. A silent refresh is worth attempting before prompting anyone. + #[serde(rename = "credential-expired")] + CredentialExpired, + /// A credential was presented and the authority refused it, for example because it was revoked, malformed, or issued for another audience. Refreshing the same rejected credential is not useful; the caller must sign in again. + #[serde(rename = "credential-rejected")] + CredentialRejected, + /// Unknown variant for forward compatibility. + #[default] + #[serde(other)] + Unknown, +} -/// Authentication accounts available to the internal session host. +/// Whether an MCP server candidate can be planned for installation /// ///
/// @@ -25813,9 +27592,29 @@ pub type SessionCancelAllBackgroundAgentsResult = i64; /// and may change or be removed in future SDK or CLI releases. /// ///
-pub type SessionGitHubAuthGetAllAuthAvailableResult = Vec; +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum CatalogMcpServerInstallability { + /// An install plan can be computed for this MCP server candidate. + #[serde(rename = "installable")] + Installable, + /// Policy forbids installing this MCP server candidate. + #[serde(rename = "not-installable-policy")] + NotInstallablePolicy, + /// Unknown variant for forward compatibility. + #[default] + #[serde(other)] + Unknown, +} -/// Whether the current authentication was logged out. +/// Discriminator: this candidate describes an MCP server +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum CatalogMcpServerCandidateKind { + #[serde(rename = "mcp-server")] + #[default] + McpServer, +} + +/// JSON MCP card media type accepted for install planning /// ///
/// @@ -25823,9 +27622,21 @@ pub type SessionGitHubAuthGetAllAuthAvailableResult = Vec; /// and may change or be removed in future SDK or CLI releases. /// ///
-pub type SessionGitHubAuthLogoutResult = bool; +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum McpServerCardMediaType { + /// The current MCP server card media type. + #[serde(rename = "application/mcp-server-card+json")] + ApplicationMcpServerCardJson, + /// The legacy MCP server card media type, accepted for compatibility. + #[serde(rename = "application/mcp-server+json")] + ApplicationMcpServerJson, + /// Unknown variant for forward compatibility. + #[default] + #[serde(other)] + Unknown, +} -/// Whether the requested authentication was logged out. +/// 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. /// ///
/// @@ -25833,9 +27644,14 @@ pub type SessionGitHubAuthLogoutResult = bool; /// and may change or be removed in future SDK or CLI releases. /// ///
-pub type SessionGitHubAuthLogoutUserResult = bool; +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum CatalogCandidate { + McpServer(CatalogMcpServerCandidate), + AiSkill(CatalogAiSkillCandidate), +} -/// Validation errors from the most recent authentication attempt. +/// What kind of resource a catalog candidate describes /// ///
/// @@ -25843,9 +27659,21 @@ pub type SessionGitHubAuthLogoutUserResult = bool; /// and may change or be removed in future SDK or CLI releases. /// ///
-pub type SessionGitHubAuthLastAuthErrorsResult = Vec; +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum CatalogCandidateKind { + /// An MCP server, which can be planned for installation. + #[serde(rename = "mcp-server")] + McpServer, + /// An AI skill, which is discoverable but not installable through this surface. + #[serde(rename = "ai-skill")] + AiSkill, + /// Unknown variant for forward compatibility. + #[default] + #[serde(other)] + Unknown, +} -/// Standard MCP CallToolResult +/// A wire feature a caller can require of the catalog surface, negotiated per request. A grant means the runtime understands the feature's contract, not that the deployment has enabled the operation; typed unavailable results report availability separately. /// ///
/// @@ -25853,81 +27681,38 @@ pub type SessionGitHubAuthLastAuthErrorsResult = Vec; /// and may change or be removed in future SDK or CLI releases. /// ///
-pub type SessionMcpAppsCallToolResult = HashMap; - -/// Authentication host. HMAC auth always targets the public GitHub host. -#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum HMACAuthInfoHost { - #[serde(rename = "https://github.com")] - #[default] - HttpsGitHubCom, -} - -/// HMAC-based authentication used by GitHub-internal services. -#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum HMACAuthInfoType { - #[serde(rename = "hmac")] - #[default] - Hmac, -} - -/// Personal access token (PAT) or server-to-server token sourced from an environment variable. -#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum EnvAuthInfoType { - #[serde(rename = "env")] - #[default] - Env, -} - -/// SDK-side token authentication; the host configured the token directly via the SDK. -#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum TokenAuthInfoType { - #[serde(rename = "token")] - #[default] - Token, -} - -/// Authentication host (always the public GitHub host). -#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum CopilotApiTokenAuthInfoHost { - #[serde(rename = "https://github.com")] - #[default] - HttpsGitHubCom, -} - -/// Direct Copilot API authentication via the `GITHUB_COPILOT_API_TOKEN` + `COPILOT_API_URL` environment-variable pair. The token itself is read from the environment by the runtime, not carried in this struct. -#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum CopilotApiTokenAuthInfoType { - #[serde(rename = "copilot-api-token")] - #[default] - CopilotApiToken, -} - -/// OAuth user authentication. The token itself is held in the runtime's secret token store (keyed by host+login) and is NOT carried in this struct. -#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum UserAuthInfoType { - #[serde(rename = "user")] - #[default] - User, -} - -/// Authentication via the `gh` CLI's saved credentials. #[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum GhCliAuthInfoType { - #[serde(rename = "gh-cli")] +pub enum CatalogCapability { + /// Understands the current `application/mcp-server-card+json` media type. + #[serde(rename = "mcp-server-card")] + McpServerCard, + /// Understands the legacy `application/mcp-server+json` media type. + #[serde(rename = "legacy-mcp-server-card")] + LegacyMcpServerCard, + /// Understands `application/ai-skill` candidates as discovery-only and typed non-installable. + #[serde(rename = "ai-skill-discovery")] + AiSkillDiscovery, + /// Understands side-effect-free MCP install-plan requests, results, and plan handles; `planning-unavailable` separately reports that planning is not enabled. + #[serde(rename = "mcp-install-planning")] + McpInstallPlanning, + /// Understands plans that enumerate every eligible transport rather than a single preferred one. + #[serde(rename = "multiple-transport-choice")] + MultipleTransportChoice, + /// Unknown variant for forward compatibility. #[default] - GhCli, + #[serde(other)] + Unknown, } -/// API-key authentication for non-GitHub LLM providers (e.g. when running BYOM-style). +/// Discriminator: the upstream response broke the contract #[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum ApiKeyAuthInfoType { - #[serde(rename = "api-key")] +pub enum CatalogContractViolationErrorKind { + #[serde(rename = "contract-violation")] #[default] - ApiKey, + ContractViolation, } -/// Authentication credentials accepted only at native protocol ingress. Runtime outputs use credential-free `AuthIdentity` metadata. +/// Which wire-contract rule an upstream response broke /// ///
/// @@ -25935,19 +27720,27 @@ pub enum ApiKeyAuthInfoType { /// and may change or be removed in future SDK or CLI releases. /// ///
-#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum AuthInfo { - Hmac(HMACAuthInfo), - Env(EnvAuthInfo), - Token(TokenAuthInfo), - CopilotApiToken(CopilotApiTokenAuthInfo), - User(UserAuthInfo), - GhCli(GhCliAuthInfo), - ApiKey(ApiKeyAuthInfo), +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum CatalogContractViolationReason { + /// A result carried both a URL and embedded data, when exactly one is permitted. + #[serde(rename = "both-url-and-data")] + BothUrlAndData, + /// A result carried neither a URL nor embedded data, when exactly one is required. + #[serde(rename = "neither-url-nor-data")] + NeitherUrlNorData, + /// Two results claimed the same normalised identity. + #[serde(rename = "duplicate-identity")] + DuplicateIdentity, + /// A result declared no media type, or one this contract does not model. + #[serde(rename = "unknown-media-type")] + UnknownMediaType, + /// Unknown variant for forward compatibility. + #[default] + #[serde(other)] + Unknown, } -/// Resolved Anthropic adaptive-thinking capability for a model. +/// Which kind of opaque handle was presented /// ///
/// @@ -25956,23 +27749,28 @@ pub enum AuthInfo { /// ///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum AdaptiveThinkingSupport { - /// The model does not accept thinking.type='adaptive' - #[serde(rename = "unsupported")] - Unsupported, - /// The model accepts adaptive thinking but also accepts thinking.type='enabled' - #[serde(rename = "optional")] - Optional, - /// The model only accepts adaptive thinking and rejects thinking.type='enabled' with HTTP 400 (e.g. opus-4.7/4.8) - #[serde(rename = "required")] - Required, +pub enum CatalogHandleType { + /// A search candidate handle. + #[serde(rename = "candidate")] + Candidate, + /// An install plan handle. + #[serde(rename = "plan")] + Plan, /// Unknown variant for forward compatibility. #[default] #[serde(other)] Unknown, } -/// Which tier this directory belongs to +/// Discriminator: a handle was rejected +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum CatalogHandleRejectedErrorKind { + #[serde(rename = "handle-rejected")] + #[default] + HandleRejected, +} + +/// Why a presented handle was rejected /// ///
/// @@ -25981,20 +27779,26 @@ pub enum AdaptiveThinkingSupport { /// ///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum AgentDiscoveryPathScope { - /// The user's personal agent configuration directory. - #[serde(rename = "user")] - User, - /// A project's repository agent directory. - #[serde(rename = "project")] - Project, +pub enum CatalogHandleRejectionReason { + /// The handle is unparseable, unknown, or was issued for a different operation. + #[serde(rename = "invalid")] + Invalid, + /// The handle's time to live has elapsed. + #[serde(rename = "stale")] + Stale, + /// The handle has already been used, and handles are single-use. + #[serde(rename = "replayed")] + Replayed, + /// The handle was issued by a different runtime instance. + #[serde(rename = "foreign")] + Foreign, /// Unknown variant for forward compatibility. #[default] #[serde(other)] Unknown, } -/// Where the agent definition was loaded from +/// Which request field was rejected before any work was done /// ///
/// @@ -26003,32 +27807,51 @@ pub enum AgentDiscoveryPathScope { /// ///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum AgentInfoSource { - /// Agent loaded from the user's personal agent configuration. - #[serde(rename = "user")] - User, - /// Agent loaded from the current project's repository configuration. - #[serde(rename = "project")] - Project, - /// Agent inherited from a parent project or workspace. - #[serde(rename = "inherited")] - Inherited, - /// Agent provided by a remote runtime or service. - #[serde(rename = "remote")] - Remote, - /// Agent contributed by an installed plugin. - #[serde(rename = "plugin")] - Plugin, - /// Agent built into the Copilot runtime. - #[serde(rename = "builtin")] - Builtin, +pub enum CatalogInvalidRequestField { + /// The search query was empty or longer than permitted. + #[serde(rename = "query")] + Query, + /// The requested result count fell outside its permitted range. + #[serde(rename = "limit")] + Limit, + /// The requested candidate kinds were empty or contained a duplicate. + #[serde(rename = "kinds")] + Kinds, + /// The negotiation block was missing or malformed. + #[serde(rename = "contract")] + Contract, + /// The plan source was missing or malformed. + #[serde(rename = "source")] + Source, + /// The supplied card was missing its media type, URL, or data. + #[serde(rename = "card")] + Card, + /// The requested configuration scope is not one this runtime writes. + #[serde(rename = "scope")] + Scope, /// Unknown variant for forward compatibility. #[default] #[serde(other)] Unknown, } -/// Kind of attention required when status === "attention". Meaningful only when status === "attention". +/// Discriminator: the request itself was invalid +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum CatalogInvalidRequestErrorKind { + #[serde(rename = "invalid-request")] + #[default] + InvalidRequest, +} + +/// Discriminator: the card was malformed +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum CatalogMalformedCardErrorKind { + #[serde(rename = "malformed-card")] + #[default] + MalformedCard, +} + +/// Media type a catalog card is interpreted as /// ///
/// @@ -26037,29 +27860,23 @@ pub enum AgentInfoSource { /// ///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum AgentRegistryLiveTargetEntryAttentionKind { - /// Session is blocked on an unrecoverable error - #[serde(rename = "error")] - Error, - /// Session is waiting for a tool-permission decision - #[serde(rename = "permission")] - Permission, - /// Session is waiting for the user to approve or reject a plan - #[serde(rename = "exit_plan")] - ExitPlan, - /// Session is waiting on an elicitation prompt - #[serde(rename = "elicitation")] - Elicitation, - /// Session is waiting for free-form user input - #[serde(rename = "user_input")] - UserInput, +pub enum CatalogMediaType { + /// The current MCP server card media type. + #[serde(rename = "application/mcp-server-card+json")] + ApplicationMcpServerCardJson, + /// The legacy MCP server card media type, accepted for compatibility. + #[serde(rename = "application/mcp-server+json")] + ApplicationMcpServerJson, + /// An AI skill card. Representable and searchable, but typed non-installable. + #[serde(rename = "application/ai-skill")] + ApplicationAiSkill, /// Unknown variant for forward compatibility. #[default] #[serde(other)] Unknown, } -/// Process kind tag for the registry entry +/// How a card failed validation /// ///
/// @@ -26068,20 +27885,37 @@ pub enum AgentRegistryLiveTargetEntryAttentionKind { /// ///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum AgentRegistryLiveTargetEntryKind { - /// Interactive Copilot CLI exposing a UI server (legacy/normal CLI process) - #[serde(rename = "ui-server")] - UiServer, - /// Headless `--server --managed-server` child spawned by a controller - #[serde(rename = "managed-server")] - ManagedServer, +pub enum CatalogMalformedCardReason { + /// The document is not well-formed JSON. + #[serde(rename = "invalid-json")] + InvalidJson, + /// The document does not satisfy its media type's schema. + #[serde(rename = "schema-violation")] + SchemaViolation, + /// The declared media type is not one this runtime understands. + #[serde(rename = "unsupported-media-type")] + UnsupportedMediaType, + /// A field the media type requires is absent. + #[serde(rename = "missing-required-field")] + MissingRequiredField, + /// The document exceeded the permitted size. + #[serde(rename = "size-limit-exceeded")] + SizeLimitExceeded, /// Unknown variant for forward compatibility. #[default] #[serde(other)] Unknown, } -/// How the most recent turn ended (clean vs aborted). Lets the renderer distinguish done from done_cancelled. +/// Discriminator: capability or protocol-version negotiation failed +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum CatalogNegotiationRefusedErrorKind { + #[serde(rename = "negotiation-refused")] + #[default] + NegotiationRefused, +} + +/// Why capability and protocol-version negotiation refused a caller /// ///
/// @@ -26090,48 +27924,76 @@ pub enum AgentRegistryLiveTargetEntryKind { /// ///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum AgentRegistryLiveTargetEntryLastTerminalEvent { - /// Last turn ended cleanly (model returned a final assistant message) - #[serde(rename = "turn_end")] - TurnEnd, - /// Last turn was aborted (e.g. user interrupted) - #[serde(rename = "abort")] - Abort, +pub enum CatalogNegotiationRefusedReason { + /// The caller's protocol version is below the lowest this runtime serves. + #[serde(rename = "unsupported-protocol-version")] + UnsupportedProtocolVersion, + /// The caller requires at least one capability this runtime cannot honour. + #[serde(rename = "unsupported-capability")] + UnsupportedCapability, /// Unknown variant for forward compatibility. #[default] #[serde(other)] Unknown, } -/// Coarse lifecycle status of the foreground session -/// -///
-/// -/// **Experimental.** This type is part of an experimental wire-protocol surface -/// and may change or be removed in future SDK or CLI releases. -/// -///
+/// Discriminator: the network operation failed #[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum AgentRegistryLiveTargetEntryStatus { - /// Session is actively processing a turn - #[serde(rename = "working")] - Working, - /// Session is idle, waiting for input - #[serde(rename = "waiting")] - Waiting, - /// Last turn completed successfully - #[serde(rename = "done")] - Done, - /// Session needs user attention (see attentionKind for the specific reason) - #[serde(rename = "attention")] - Attention, +pub enum CatalogNetworkFailureErrorKind { + #[serde(rename = "network-failure")] + #[default] + NetworkFailure, +} + +/// Categorised network failure, low cardinality so it can be aggregated without carrying a URL +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum CatalogNetworkFailureReason { + /// No network is available, so nothing was attempted. + #[serde(rename = "offline")] + Offline, + /// The authority's name could not be resolved. + #[serde(rename = "dns")] + Dns, + /// The request exceeded its time budget. + #[serde(rename = "timeout")] + Timeout, + /// The TLS handshake or certificate validation failed. + #[serde(rename = "tls")] + Tls, + /// The connection was refused or reset. + #[serde(rename = "connection-refused")] + ConnectionRefused, + /// The authority returned a status the runtime treats as a failure. + #[serde(rename = "http-status")] + HttpStatus, + /// The response exceeded the permitted size. + #[serde(rename = "response-too-large")] + ResponseTooLarge, + /// A redirect was refused by the runtime's redirect policy. + #[serde(rename = "redirect-rejected")] + RedirectRejected, /// Unknown variant for forward compatibility. #[default] #[serde(other)] Unknown, } -/// Categorized reason for log-open failure +/// Discriminator: the candidate cannot be installed +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum CatalogNotInstallableErrorKind { + #[serde(rename = "not-installable")] + #[default] + NotInstallable, +} + +/// Why a discoverable candidate cannot be installed /// ///
/// @@ -26140,31 +28002,31 @@ pub enum AgentRegistryLiveTargetEntryStatus { /// ///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum AgentRegistryLogCaptureOpenErrorReason { - /// Filesystem permission denied opening the log file - #[serde(rename = "permission")] - Permission, - /// No space left on device - #[serde(rename = "disk_full")] - DiskFull, - /// Other / uncategorized open failure - #[serde(rename = "other")] - Other, +pub enum CatalogNotInstallableReason { + /// This kind of resource is not installable through this surface. + #[serde(rename = "kind-not-installable")] + KindNotInstallable, + /// AI skills are discoverable but have no typed importer in this phase. + #[serde(rename = "ai-skill-not-installable")] + AiSkillNotInstallable, + /// Policy forbids installing this candidate. + #[serde(rename = "policy-forbids")] + PolicyForbids, /// Unknown variant for forward compatibility. #[default] #[serde(other)] Unknown, } -/// Discriminator: child_process.spawn itself failed +/// Discriminator: policy refused the operation #[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum AgentRegistrySpawnErrorKind { - #[serde(rename = "spawn-error")] +pub enum CatalogPolicyRejectedErrorKind { + #[serde(rename = "policy-rejected")] #[default] - SpawnError, + PolicyRejected, } -/// Permission posture for the new session. 'yolo' requires the controller-local session to currently be in allow-all mode. +/// Which authority produced a policy decision /// ///
/// @@ -26173,36 +28035,50 @@ pub enum AgentRegistrySpawnErrorKind { /// ///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum AgentRegistrySpawnPermissionMode { - /// Standard permission posture (prompts for each request) - #[serde(rename = "default")] - Default, - /// Full allow-all (requires the controller-local session to currently be in allow-all mode) - #[serde(rename = "yolo")] - Yolo, +pub enum McpPlanPolicySource { + /// No policy applied, so the server is permitted by default. + #[serde(rename = "none")] + None, + /// An enterprise allowlist evaluated the server. + #[serde(rename = "enterprise-allowlist")] + EnterpriseAllowlist, + /// The registry the card came from evaluated the server. + #[serde(rename = "registry-policy")] + RegistryPolicy, + /// Local trust settings evaluated the server. + #[serde(rename = "local-trust")] + LocalTrust, /// Unknown variant for forward compatibility. #[default] #[serde(other)] Unknown, } -/// Discriminator: spawn succeeded but child never registered +/// Discriminator: the search completed #[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum AgentRegistrySpawnRegistryTimeoutKind { - #[serde(rename = "registry-timeout")] +pub enum CatalogSearchSucceededKind { + #[serde(rename = "succeeded")] #[default] - RegistryTimeout, + Succeeded, } -/// Discriminator: managed-server child spawned successfully +/// Discriminator: an unsupported candidate kind was requested #[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum AgentRegistrySpawnSpawnedKind { - #[serde(rename = "spawned")] +pub enum CatalogUnsupportedKindErrorKind { + #[serde(rename = "unsupported-kind")] #[default] - Spawned, + UnsupportedKind, } -/// Which parameter field was invalid. Omitted when the rejection is not field-specific. +/// Discriminator: retrieval was refused as unsafe +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum CatalogUnsafeRetrievalErrorKind { + #[serde(rename = "unsafe-retrieval")] + #[default] + UnsafeRetrieval, +} + +/// Which hardened-fetch control refused a retrieval /// ///
/// @@ -26211,37 +28087,40 @@ pub enum AgentRegistrySpawnSpawnedKind { /// ///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum AgentRegistrySpawnValidationErrorField { - /// The cwd parameter - #[serde(rename = "cwd")] - Cwd, - /// The session name parameter - #[serde(rename = "name")] - Name, - /// The agentName parameter - #[serde(rename = "agentName")] - AgentName, - /// The model parameter - #[serde(rename = "model")] - Model, - /// The permissionMode parameter - #[serde(rename = "permissionMode")] - PermissionMode, +pub enum CatalogUnsafeRetrievalReason { + /// The URL used a scheme the runtime refuses to fetch. + #[serde(rename = "blocked-scheme")] + BlockedScheme, + /// The URL embedded credentials. + #[serde(rename = "credentials-in-url")] + CredentialsInUrl, + /// The URL resolved to a loopback, private, link-local, or cloud metadata address. + #[serde(rename = "blocked-address")] + BlockedAddress, + /// A redirect target resolved to a blocked address. + #[serde(rename = "redirect-to-blocked-address")] + RedirectToBlockedAddress, + /// The configured proxy policy refused the request. + #[serde(rename = "proxy-rejected")] + ProxyRejected, + /// The authority is not permitted for card retrieval. + #[serde(rename = "host-not-permitted")] + HostNotPermitted, /// Unknown variant for forward compatibility. #[default] #[serde(other)] Unknown, } -/// Discriminator: synchronous pre-validation rejected the request +/// Discriminator: the operation is not available #[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum AgentRegistrySpawnValidationErrorKind { - #[serde(rename = "validation-error")] +pub enum CatalogUnavailableErrorKind { + #[serde(rename = "unavailable")] #[default] - ValidationError, + Unavailable, } -/// Categorized reason for the rejection. Low-cardinality enum so telemetry can aggregate by reason without leaking raw paths or agent/model names. +/// Why a catalog operation is not available on this runtime /// ///
/// @@ -26250,32 +28129,26 @@ pub enum AgentRegistrySpawnValidationErrorKind { /// ///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum AgentRegistrySpawnValidationErrorReason { - /// Provided cwd does not exist on disk - #[serde(rename = "cwd-not-found")] - CwdNotFound, - /// Provided cwd exists but is not a directory - #[serde(rename = "cwd-not-directory")] - CwdNotDirectory, - /// Session name failed validateSessionName - #[serde(rename = "invalid-name")] - InvalidName, - /// Requested agent name was not found in builtin or custom agents - #[serde(rename = "unknown-agent")] - UnknownAgent, - /// Requested model is not available to this session - #[serde(rename = "unknown-model")] - UnknownModel, - /// Caller asked for permissionMode='yolo' but the controller is not currently in allow-all mode - #[serde(rename = "yolo-not-allowed")] - YoloNotAllowed, +pub enum CatalogUnavailableReason { + /// Bounded search is not wired up on this runtime build. + #[serde(rename = "search-unavailable")] + SearchUnavailable, + /// Install planning is not wired up on this runtime build. + #[serde(rename = "planning-unavailable")] + PlanningUnavailable, + /// No catalog authority is configured for this runtime. + #[serde(rename = "authority-not-configured")] + AuthorityNotConfigured, + /// The surface is disabled by policy on this runtime. + #[serde(rename = "disabled-by-policy")] + DisabledByPolicy, /// Unknown variant for forward compatibility. #[default] #[serde(other)] Unknown, } -/// Outcome of an agentRegistry.spawn call. +/// Outcome of a catalog.search call: either bounded inert candidates, or one typed refusal. Never a partial success. /// ///
/// @@ -26285,14 +28158,29 @@ pub enum AgentRegistrySpawnValidationErrorReason { ///
#[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] -pub enum AgentRegistrySpawnResult { - Spawned(AgentRegistrySpawnSpawned), - SpawnError(AgentRegistrySpawnError), - RegistryTimeout(AgentRegistrySpawnRegistryTimeout), - ValidationError(AgentRegistrySpawnValidationError), +pub enum CatalogSearchResult { + Succeeded(CatalogSearchSucceeded), + NegotiationRefused(CatalogNegotiationRefusedError), + UnsupportedKind(CatalogUnsupportedKindError), + InvalidRequest(CatalogInvalidRequestError), + AuthenticationRequired(CatalogAuthenticationRequiredError), + PolicyRejected(CatalogPolicyRejectedError), + NetworkFailure(CatalogNetworkFailureError), + UnsafeRetrieval(CatalogUnsafeRetrievalError), + MalformedCard(CatalogMalformedCardError), + ContractViolation(CatalogContractViolationError), + Unavailable(CatalogUnavailableError), +} + +/// Discriminator: no usable transport is available +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum CatalogUnavailableTransportErrorKind { + #[serde(rename = "unavailable-transport")] + #[default] + UnavailableTransport, } -/// Current or requested allow-all mode. +/// Why no usable transport could be offered /// ///
/// @@ -26301,87 +28189,153 @@ pub enum AgentRegistrySpawnResult { /// ///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum PermissionsAllowAllMode { - /// Permission requests follow the normal approval flow. - #[serde(rename = "off")] - Off, - /// Tool, path, and URL permission requests are automatically approved. - #[serde(rename = "on")] - On, - /// Permission requests follow the normal approval flow with an LLM advisory recommendation attached; clients may choose to auto-approve requests the judge evaluated as acceptable. - #[serde(rename = "auto")] - Auto, +pub enum CatalogUnavailableTransportReason { + /// The card advertises no transport this runtime can use. + #[serde(rename = "no-eligible-transport")] + NoEligibleTransport, + /// Every advertised transport is of a kind this runtime does not implement. + #[serde(rename = "transport-not-supported")] + TransportNotSupported, + /// Eligible remotes could not be enumerated, so no explicit choice can be offered. + #[serde(rename = "remote-enumeration-unavailable")] + RemoteEnumerationUnavailable, /// Unknown variant for forward compatibility. #[default] #[serde(other)] Unknown, } -/// Attachment type discriminator -#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum AttachmentBlobType { - #[serde(rename = "blob")] - #[default] - Blob, -} - -/// Attachment type discriminator +/// Optional completion hint for the input (e.g. 'directory' for filesystem path completion) +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum AttachmentDirectoryType { +pub enum SlashCommandInputCompletion { + /// Input should complete filesystem directories. #[serde(rename = "directory")] - #[default] Directory, -} - -/// Attachment type discriminator -#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum AttachmentExtensionContextType { - #[serde(rename = "extension_context")] + /// Unknown variant for forward compatibility. #[default] - ExtensionContext, + #[serde(other)] + Unknown, } -/// Attachment type discriminator +/// Coarse command category for grouping and behavior: runtime built-in, skill-backed command, or SDK/client-owned command +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum AttachmentFileType { - #[serde(rename = "file")] +pub enum SlashCommandKind { + /// Command implemented by the runtime. + #[serde(rename = "builtin")] + Builtin, + /// Command backed by a skill. + #[serde(rename = "skill")] + Skill, + /// Command registered by an SDK client or extension. + #[serde(rename = "client")] + Client, + /// Unknown variant for forward compatibility. #[default] - File, + #[serde(other)] + Unknown, } -/// Attachment type discriminator +/// Whether a pending slash-command invocation effect was applied or cancelled by the host. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum AttachmentGitHubActionsJobType { - #[serde(rename = "github_actions_job")] +pub enum CommandsInvocationEffectOutcome { + /// The host applied the pending invocation effect. + #[serde(rename = "applied")] + Applied, + /// The host cancelled the pending invocation effect, so any provisional state must be reverted. + #[serde(rename = "cancelled")] + Cancelled, + /// Unknown variant for forward compatibility. #[default] - GitHubActionsJob, + #[serde(other)] + Unknown, } -/// Attachment type discriminator +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum AttachmentGitHubCommitType { - #[serde(rename = "github_commit")] +pub enum CommandsInvocationOrigin { + #[serde(rename = "settings")] + Settings, + /// Unknown variant for forward compatibility. #[default] - GitHubCommit, + #[serde(other)] + Unknown, } -/// Attachment type discriminator +/// Neutral SDK discriminator for the connected remote session kind. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum AttachmentGitHubFileType { - #[serde(rename = "github_file")] +pub enum ConnectedRemoteSessionMetadataKind { + /// Remote CLI session. + #[serde(rename = "remote-session")] + RemoteSession, + /// GitHub Copilot coding agent session. + #[serde(rename = "coding-agent")] + CodingAgent, + /// Unknown variant for forward compatibility. #[default] - GitHubFile, + #[serde(other)] + Unknown, } -/// Attachment type discriminator +/// Controls how MCP tool result content is filtered: none leaves content unchanged, markdown sanitizes HTML while preserving Markdown-friendly output, and hidden_characters removes characters that can hide directives. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum AttachmentGitHubFileDiffType { - #[serde(rename = "github_file_diff")] +pub enum ContentFilterMode { + /// Leave MCP tool result content unchanged. + #[serde(rename = "none")] + None, + /// Sanitize HTML while preserving Markdown-friendly output. + #[serde(rename = "markdown")] + Markdown, + /// Remove characters that can hide directives. + #[serde(rename = "hidden_characters")] + HiddenCharacters, + /// Unknown variant for forward compatibility. #[default] - GitHubFileDiff, + #[serde(other)] + Unknown, } -/// Type of GitHub reference +/// Source category for a collected debug bundle entry. /// ///
/// @@ -26390,71 +28344,122 @@ pub enum AttachmentGitHubFileDiffType { /// ///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum AttachmentGitHubReferenceType { - /// GitHub issue reference. - #[serde(rename = "issue")] - Issue, - /// GitHub pull request reference. - #[serde(rename = "pr")] - Pr, - /// GitHub discussion reference. - #[serde(rename = "discussion")] - Discussion, +pub enum DebugCollectLogsSource { + /// Session event log. + #[serde(rename = "events")] + Events, + /// Process log for the session. + #[serde(rename = "process-log")] + ProcessLog, + /// Interactive shell log for the session. + #[serde(rename = "shell-log")] + ShellLog, + /// Caller-provided diagnostic entry. + #[serde(rename = "additional")] + Additional, /// Unknown variant for forward compatibility. #[default] #[serde(other)] Unknown, } -/// Attachment type discriminator +/// Destination variant discriminator. #[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum AttachmentGitHubReleaseType { - #[serde(rename = "github_release")] +pub enum DebugCollectLogsDestinationArchiveKind { + #[serde(rename = "archive")] #[default] - GitHubRelease, + Archive, } -/// Attachment type discriminator +/// Destination variant discriminator. #[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum AttachmentGitHubRepositoryType { - #[serde(rename = "github_repository")] +pub enum DebugCollectLogsDestinationDirectoryKind { + #[serde(rename = "directory")] #[default] - GitHubRepository, + Directory, } -/// Attachment type discriminator -#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum AttachmentGitHubSnippetType { - #[serde(rename = "github_snippet")] - #[default] - GitHubSnippet, +/// Destination for the redacted debug bundle. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum DebugCollectLogsDestination { + Archive(DebugCollectLogsDestinationArchive), + Directory(DebugCollectLogsDestinationDirectory), } -/// Attachment type discriminator +/// Kind of caller-provided debug log entry. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum AttachmentGitHubTreeComparisonType { - #[serde(rename = "github_tree_comparison")] +pub enum DebugCollectLogsEntryKind { + /// Include a single server-local file. + #[serde(rename = "file")] + File, + /// Include files from a server-local directory recursively. + #[serde(rename = "directory")] + Directory, + /// Unknown variant for forward compatibility. #[default] - GitHubTreeComparison, + #[serde(other)] + Unknown, } -/// Attachment type discriminator +/// How a collected debug entry should be redacted before being staged. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum AttachmentGitHubUrlType { - #[serde(rename = "github_url")] +pub enum DebugCollectLogsRedaction { + /// Redact the file as plain UTF-8 log text. + #[serde(rename = "plain-text")] + PlainText, + /// Redact each non-empty line as a session event JSON object, falling back to plain-text redaction for malformed lines. + #[serde(rename = "events-jsonl")] + EventsJsonl, + /// Unknown variant for forward compatibility. #[default] - GitHubUrl, + #[serde(other)] + Unknown, } -/// Attachment type discriminator +/// Destination kind that was written. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum AttachmentSelectionType { - #[serde(rename = "selection")] +pub enum DebugCollectLogsResultKind { + /// A .tgz archive was written. + #[serde(rename = "archive")] + Archive, + /// A directory containing redacted files was written. + #[serde(rename = "directory")] + Directory, + /// Unknown variant for forward compatibility. #[default] - Selection, + #[serde(other)] + Unknown, } -/// Authentication type /// ///
/// @@ -26463,35 +28468,16 @@ pub enum AttachmentSelectionType { /// ///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum AuthInfoType { - /// Authentication provided by a GitHub App HMAC credential. - #[serde(rename = "hmac")] - Hmac, - /// Authentication resolved from environment-provided credentials. - #[serde(rename = "env")] - Env, - /// Authentication from an interactive user sign-in. - #[serde(rename = "user")] - User, - /// Authentication delegated to the GitHub CLI. - #[serde(rename = "gh-cli")] - GhCli, - /// Authentication from an API key credential. - #[serde(rename = "api-key")] - ApiKey, - /// Authentication from a GitHub token. - #[serde(rename = "token")] - Token, - /// Authentication from a Copilot API token. - #[serde(rename = "copilot-api-token")] - CopilotApiToken, +pub enum DisableBypassPermissionsMode { + #[serde(rename = "disable")] + Disable, /// Unknown variant for forward compatibility. #[default] #[serde(other)] Unknown, } -/// Custom input-format kind. +/// Persisted extension discovery source /// ///
/// @@ -26500,17 +28486,20 @@ pub enum AuthInfoType { /// ///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum BuiltinToolFormatType { - /// The tool input is parsed with the supplied grammar. - #[serde(rename = "grammar")] - Grammar, +pub enum DiscoveredExtensionSource { + /// Extension discovered from the user's extensions directory. + #[serde(rename = "user")] + User, + /// Extension contributed by an installed plugin. + #[serde(rename = "plugin")] + Plugin, /// Unknown variant for forward compatibility. #[default] #[serde(other)] Unknown, } -/// Root JSON Schema type for a built-in tool input. +/// Effective extension loading and agent-management mode /// ///
/// @@ -26519,17 +28508,23 @@ pub enum BuiltinToolFormatType { /// ///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum BuiltinToolInputSchemaType { - /// The tool accepts a JSON object. - #[serde(rename = "object")] - Object, +pub enum DiscoveredExtensionMode { + /// Extensions are not loaded. + #[serde(rename = "disabled")] + Disabled, + /// Extensions are loaded, but the agent cannot create, reload, or manage them. + #[serde(rename = "load_only")] + LoadOnly, + /// Extensions are loaded and the agent can create, reload, and manage them. + #[serde(rename = "load_and_augment")] + LoadAndAugment, /// Unknown variant for forward compatibility. #[default] #[serde(other)] Unknown, } -/// Optional completion hint for the input (e.g. 'directory' for filesystem path completion) +/// Server transport type: stdio, http, sse (deprecated), or memory /// ///
/// @@ -26538,17 +28533,26 @@ pub enum BuiltinToolInputSchemaType { /// ///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum SlashCommandInputCompletion { - /// Input should complete filesystem directories. - #[serde(rename = "directory")] - Directory, +pub enum DiscoveredMcpServerType { + /// Server communicates over stdio with a local child process. + #[serde(rename = "stdio")] + Stdio, + /// Server communicates over streamable HTTP. + #[serde(rename = "http")] + Http, + /// Server communicates over Server-Sent Events (deprecated). + #[serde(rename = "sse")] + Sse, + /// Server is backed by an in-memory runtime implementation. + #[serde(rename = "memory")] + Memory, /// Unknown variant for forward compatibility. #[default] #[serde(other)] Unknown, } -/// Coarse command category for grouping and behavior: runtime built-in, skill-backed command, or SDK/client-owned command +/// Agent-scope filter: 'primary' returns only main-agent events plus events whose type starts with 'subagent.' (matching the typed-subscription default behavior); 'all' returns events from all agents (matching wildcard-subscription behavior). Default is 'all' to preserve wildcard semantics for catch-up callers. /// ///
/// @@ -26557,23 +28561,20 @@ pub enum SlashCommandInputCompletion { /// ///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum SlashCommandKind { - /// Command implemented by the runtime. - #[serde(rename = "builtin")] - Builtin, - /// Command backed by a skill. - #[serde(rename = "skill")] - Skill, - /// Command registered by an SDK client or extension. - #[serde(rename = "client")] - Client, +pub enum EventsAgentScope { + /// Return main-agent events and typed subagent lifecycle events. + #[serde(rename = "primary")] + Primary, + /// Return events from all agents. + #[serde(rename = "all")] + All, /// Unknown variant for forward compatibility. #[default] #[serde(other)] Unknown, } -/// Whether a pending slash-command invocation effect was applied or cancelled by the host. +/// Direction to page through the session's persisted event history. 'forward' pages from the cursor toward newer events; 'backward' returns the newest window first (tail-first) and pages toward older events. Events within a returned batch are always chronological (oldest-to-newest), even for a backward read. /// ///
/// @@ -26582,19 +28583,20 @@ pub enum SlashCommandKind { /// ///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum CommandsInvocationEffectOutcome { - /// The host applied the pending invocation effect. - #[serde(rename = "applied")] - Applied, - /// The host cancelled the pending invocation effect, so any provisional state must be reverted. - #[serde(rename = "cancelled")] - Cancelled, +pub enum EventsReadDirection { + /// Page from the cursor toward newer events (default). + #[serde(rename = "forward")] + Forward, + /// Tail-first: return the newest events and page toward older events. + #[serde(rename = "backward")] + Backward, /// Unknown variant for forward compatibility. #[default] #[serde(other)] Unknown, } +/// Cursor status: 'ok' means the cursor was applied successfully; 'expired' means the cursor referred to an event that no longer exists in history (e.g. truncated or compacted away) and the read fell back to a boundary of the remaining history (the beginning for a forward read, the tail for a backward read). The fallback page is a fresh boundary snapshot, not a continuation of the requested cursor, so it may overlap already-rendered events; on 'expired' a consumer should reset/rebase its pagination state (or deduplicate by event id) before continuing from the returned cursor. /// ///
/// @@ -26603,16 +28605,20 @@ pub enum CommandsInvocationEffectOutcome { /// ///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum CommandsInvocationOrigin { - #[serde(rename = "settings")] - Settings, +pub enum EventsCursorStatus { + /// The cursor was applied successfully. + #[serde(rename = "ok")] + Ok, + /// The cursor referred to history that is no longer available. + #[serde(rename = "expired")] + Expired, /// Unknown variant for forward compatibility. #[default] #[serde(other)] Unknown, } -/// Neutral SDK discriminator for the connected remote session kind. +/// Discovery source: project (.github/extensions/), user (~/.copilot/extensions/), plugin (installed plugin), or session (session-state//extensions/) /// ///
/// @@ -26621,20 +28627,26 @@ pub enum CommandsInvocationOrigin { /// ///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum ConnectedRemoteSessionMetadataKind { - /// Remote CLI session. - #[serde(rename = "remote-session")] - RemoteSession, - /// GitHub Copilot coding agent session. - #[serde(rename = "coding-agent")] - CodingAgent, +pub enum ExtensionSource { + /// Extension discovered from the current project's .github/extensions directory. + #[serde(rename = "project")] + Project, + /// Extension discovered from the user's ~/.copilot/extensions directory. + #[serde(rename = "user")] + User, + /// Extension contributed by an installed plugin. + #[serde(rename = "plugin")] + Plugin, + /// Extension discovered from the current session's state directory (loaded only for this session). + #[serde(rename = "session")] + Session, /// Unknown variant for forward compatibility. #[default] #[serde(other)] Unknown, } -/// Controls how MCP tool result content is filtered: none leaves content unchanged, markdown sanitizes HTML while preserving Markdown-friendly output, and hidden_characters removes characters that can hide directives. +/// Current status: running, disabled, failed, or starting /// ///
/// @@ -26643,23 +28655,34 @@ pub enum ConnectedRemoteSessionMetadataKind { /// ///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum ContentFilterMode { - /// Leave MCP tool result content unchanged. - #[serde(rename = "none")] - None, - /// Sanitize HTML while preserving Markdown-friendly output. - #[serde(rename = "markdown")] - Markdown, - /// Remove characters that can hide directives. - #[serde(rename = "hidden_characters")] - HiddenCharacters, +pub enum ExtensionStatus { + /// The extension process is running. + #[serde(rename = "running")] + Running, + /// The extension is installed but disabled. + #[serde(rename = "disabled")] + Disabled, + /// The extension failed to start or crashed. + #[serde(rename = "failed")] + Failed, + /// The extension process is starting. + #[serde(rename = "starting")] + Starting, /// Unknown variant for forward compatibility. #[default] #[serde(other)] Unknown, } -/// Source category for a collected debug bundle entry. +/// Attachment type discriminator +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum ExtensionContextPushInputType { + #[serde(rename = "extension_context")] + #[default] + ExtensionContext, +} + +/// Binary result type discriminator. Use "image" for images and "resource" for other binary data. /// ///
/// @@ -26668,57 +28691,44 @@ pub enum ContentFilterMode { /// ///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum DebugCollectLogsSource { - /// Session event log. - #[serde(rename = "events")] - Events, - /// Process log for the session. - #[serde(rename = "process-log")] - ProcessLog, - /// Interactive shell log for the session. - #[serde(rename = "shell-log")] - ShellLog, - /// Caller-provided diagnostic entry. - #[serde(rename = "additional")] - Additional, +pub enum ExternalToolTextResultForLlmBinaryResultsForLlmType { + /// Binary image data. + #[serde(rename = "image")] + Image, + /// Other binary resource data. + #[serde(rename = "resource")] + Resource, /// Unknown variant for forward compatibility. #[default] #[serde(other)] Unknown, } -/// Destination variant discriminator. +/// Content block type discriminator #[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum DebugCollectLogsDestinationArchiveKind { - #[serde(rename = "archive")] +pub enum ExternalToolTextResultForLlmContentAudioType { + #[serde(rename = "audio")] #[default] - Archive, + Audio, } -/// Destination variant discriminator. +/// Content block type discriminator #[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum DebugCollectLogsDestinationDirectoryKind { - #[serde(rename = "directory")] +pub enum ExternalToolTextResultForLlmContentImageType { + #[serde(rename = "image")] #[default] - Directory, + Image, } -/// Destination for the redacted debug bundle. -/// -///
-/// -/// **Experimental.** This type is part of an experimental wire-protocol surface -/// and may change or be removed in future SDK or CLI releases. -/// -///
-#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DebugCollectLogsDestination { - Archive(DebugCollectLogsDestinationArchive), - Directory(DebugCollectLogsDestinationDirectory), +/// Content block type discriminator +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum ExternalToolTextResultForLlmContentResourceType { + #[serde(rename = "resource")] + #[default] + Resource, } -/// Kind of caller-provided debug log entry. +/// Theme variant this icon is intended for /// ///
/// @@ -26727,63 +28737,52 @@ pub enum DebugCollectLogsDestination { /// ///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum DebugCollectLogsEntryKind { - /// Include a single server-local file. - #[serde(rename = "file")] - File, - /// Include files from a server-local directory recursively. - #[serde(rename = "directory")] - Directory, +pub enum ExternalToolTextResultForLlmContentResourceLinkIconTheme { + /// Icon intended for light themes. + #[serde(rename = "light")] + Light, + /// Icon intended for dark themes. + #[serde(rename = "dark")] + Dark, /// Unknown variant for forward compatibility. #[default] #[serde(other)] Unknown, } -/// How a collected debug entry should be redacted before being staged. -/// -///
-/// -/// **Experimental.** This type is part of an experimental wire-protocol surface -/// and may change or be removed in future SDK or CLI releases. -/// -///
+/// Content block type discriminator #[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum DebugCollectLogsRedaction { - /// Redact the file as plain UTF-8 log text. - #[serde(rename = "plain-text")] - PlainText, - /// Redact each non-empty line as a session event JSON object, falling back to plain-text redaction for malformed lines. - #[serde(rename = "events-jsonl")] - EventsJsonl, - /// Unknown variant for forward compatibility. +pub enum ExternalToolTextResultForLlmContentResourceLinkType { + #[serde(rename = "resource_link")] #[default] - #[serde(other)] - Unknown, + ResourceLink, } -/// Destination kind that was written. -/// -///
-/// -/// **Experimental.** This type is part of an experimental wire-protocol surface -/// and may change or be removed in future SDK or CLI releases. -/// -///
+/// Content block type discriminator #[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum DebugCollectLogsResultKind { - /// A .tgz archive was written. - #[serde(rename = "archive")] - Archive, - /// A directory containing redacted files was written. - #[serde(rename = "directory")] - Directory, - /// Unknown variant for forward compatibility. +pub enum ExternalToolTextResultForLlmContentShellExitType { + #[serde(rename = "shell_exit")] #[default] - #[serde(other)] - Unknown, + ShellExit, +} + +/// Content block type discriminator +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum ExternalToolTextResultForLlmContentTerminalType { + #[serde(rename = "terminal")] + #[default] + Terminal, +} + +/// Content block type discriminator +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum ExternalToolTextResultForLlmContentTextType { + #[serde(rename = "text")] + #[default] + Text, } +/// Execution-critical factory storage operation. /// ///
/// @@ -26792,16 +28791,47 @@ pub enum DebugCollectLogsResultKind { /// ///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum DisableBypassPermissionsMode { - #[serde(rename = "disable")] - Disable, +pub enum FactoryDurableOperation { + /// Creating the durable run and declared phases. + #[serde(rename = "createRun")] + CreateRun, + /// Persisting the transition to running. + #[serde(rename = "markRunStarted")] + MarkRunStarted, + /// Persisting the terminal run envelope. + #[serde(rename = "finishRun")] + FinishRun, + /// Persisting subagent admission accounting. + #[serde(rename = "reserveAgent")] + ReserveAgent, + /// Rolling back an uncommitted subagent admission. + #[serde(rename = "releaseAgent")] + ReleaseAgent, + /// Persisting an idempotent model-usage charge. + #[serde(rename = "chargeCredit")] + ChargeCredit, + /// Persisting active execution time. + #[serde(rename = "addElapsed")] + AddElapsed, + /// Reading the authoritative AI-credit total. + #[serde(rename = "reconcileCreditTotal")] + ReconcileCreditTotal, + /// Reading a journal entry without treating storage failure as a cache miss. + #[serde(rename = "journalGet")] + JournalGet, + /// Persisting a journal entry before reporting success. + #[serde(rename = "journalPut")] + JournalPut, + /// Renewing the durable owner lease that proves this process still owns the run. + #[serde(rename = "refreshLease")] + RefreshLease, /// Unknown variant for forward compatibility. #[default] #[serde(other)] Unknown, } -/// Persisted extension discovery source +/// Current or terminal state of a factory run. /// ///
/// @@ -26810,20 +28840,32 @@ pub enum DisableBypassPermissionsMode { /// ///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum DiscoveredExtensionSource { - /// Extension discovered from the user's extensions directory. - #[serde(rename = "user")] - User, - /// Extension contributed by an installed plugin. - #[serde(rename = "plugin")] - Plugin, +pub enum FactoryRunStatus { + /// The run was minted and is awaiting approval. + #[serde(rename = "pending")] + Pending, + /// The run is executing. + #[serde(rename = "running")] + Running, + /// The run completed successfully. + #[serde(rename = "completed")] + Completed, + /// The run was interrupted while resource budget remained. + #[serde(rename = "halted")] + Halted, + /// The run was cancelled before completion. + #[serde(rename = "cancelled")] + Cancelled, + /// The factory body failed or reached a cumulative resource ceiling. + #[serde(rename = "error")] + Error, /// Unknown variant for forward compatibility. #[default] #[serde(other)] Unknown, } -/// Effective extension loading and agent-management mode +/// Kind of factory progress line. /// ///
/// @@ -26831,24 +28873,21 @@ pub enum DiscoveredExtensionSource { /// and may change or be removed in future SDK or CLI releases. /// ///
-#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum DiscoveredExtensionMode { - /// Extensions are not loaded. - #[serde(rename = "disabled")] - Disabled, - /// Extensions are loaded, but the agent cannot create, reload, or manage them. - #[serde(rename = "load_only")] - LoadOnly, - /// Extensions are loaded and the agent can create, reload, and manage them. - #[serde(rename = "load_and_augment")] - LoadAndAugment, +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum FactoryLogLineKind { + /// A narrator log line. + #[serde(rename = "log")] + Log, + /// A named factory phase marker. + #[serde(rename = "phase")] + Phase, /// Unknown variant for forward compatibility. #[default] #[serde(other)] Unknown, } -/// Server transport type: stdio, http, sse (deprecated), or memory +/// Derived lifecycle state of a factory phase. /// ///
/// @@ -26857,26 +28896,26 @@ pub enum DiscoveredExtensionMode { /// ///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum DiscoveredMcpServerType { - /// Server communicates over stdio with a local child process. - #[serde(rename = "stdio")] - Stdio, - /// Server communicates over streamable HTTP. - #[serde(rename = "http")] - Http, - /// Server communicates over Server-Sent Events (deprecated). - #[serde(rename = "sse")] - Sse, - /// Server is backed by an in-memory runtime implementation. - #[serde(rename = "memory")] - Memory, +pub enum FactoryPhaseStatus { + /// The phase has not been entered yet. + #[serde(rename = "pending")] + Pending, + /// The phase is currently entered and accumulating active time. + #[serde(rename = "active")] + Active, + /// The phase was entered and has since been closed. + #[serde(rename = "completed")] + Completed, + /// The phase was never entered because a later phase was entered or the run reached a terminal state. + #[serde(rename = "skipped")] + Skipped, /// Unknown variant for forward compatibility. #[default] #[serde(other)] Unknown, } -/// Agent-scope filter: 'primary' returns only main-agent events plus events whose type starts with 'subagent.' (matching the typed-subscription default behavior); 'all' returns events from all agents (matching wildcard-subscription behavior). Default is 'all' to preserve wildcard semantics for catch-up callers. +/// Cumulative resource ceiling that stopped a factory run. /// ///
/// @@ -26885,20 +28924,38 @@ pub enum DiscoveredMcpServerType { /// ///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum EventsAgentScope { - /// Return main-agent events and typed subagent lifecycle events. - #[serde(rename = "primary")] - Primary, - /// Return events from all agents. - #[serde(rename = "all")] - All, +pub enum FactoryRunFailureKind { + /// The run admitted the approved maximum total number of subagents. + #[serde(rename = "maxTotalSubagents")] + MaxTotalSubagents, + /// The run reached the approved accumulated active-execution time in seconds. + #[serde(rename = "timeoutSeconds")] + TimeoutSeconds, + /// The run's settled subagent model usage exceeded the approved AI-credit ceiling, or no headroom remained for another subagent. + #[serde(rename = "maxAiCredits")] + MaxAiCredits, /// Unknown variant for forward compatibility. #[default] #[serde(other)] Unknown, } -/// Direction to page through the session's persisted event history. 'forward' pages from the cursor toward newer events; 'backward' returns the newest window first (tail-first) and pages toward older events. Events within a returned batch are always chronological (oldest-to-newest), even for a backward read. +/// What initiated this compaction request, recorded as the `trigger` on the persisted `session.compaction_start` / `session.compaction_complete` events. When absent, the compaction is persisted without trigger attribution (initiator unknown). +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum HistoryCompactRequestTrigger { + /// User-requested compaction, e.g. the /compact command or a direct history.compact call. + #[serde(rename = "manual")] + Manual, + /// Compaction requested while switching to a model with a smaller context window. + #[serde(rename = "model_switch")] + ModelSwitch, + /// Unknown variant for forward compatibility. + #[default] + #[serde(other)] + Unknown, +} + +/// Reason a captured file was not restored. /// ///
/// @@ -26907,20 +28964,20 @@ pub enum EventsAgentScope { /// ///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum EventsReadDirection { - /// Page from the cursor toward newer events (default). - #[serde(rename = "forward")] - Forward, - /// Tail-first: return the newest events and page toward older events. - #[serde(rename = "backward")] - Backward, +pub enum HistoryFileRestoreSkipReason { + /// The file changed after Copilot's last captured write. + #[serde(rename = "user-modified")] + UserModified, + /// A faithful preimage was not captured. + #[serde(rename = "skipped-capture")] + SkippedCapture, /// Unknown variant for forward compatibility. #[default] #[serde(other)] Unknown, } -/// Cursor status: 'ok' means the cursor was applied successfully; 'expired' means the cursor referred to an event that no longer exists in history (e.g. truncated or compacted away) and the read fell back to a boundary of the remaining history (the beginning for a forward read, the tail for a backward read). The fallback page is a fresh boundary snapshot, not a continuation of the requested cursor, so it may overlap already-rendered events; on 'expired' a consumer should reset/rebase its pagination state (or deduplicate by event id) before continuing from the returned cursor. +/// Reason a rewind read (rewind points, file-restore preview, or session diff) could not be answered from the session's file-change captures. /// ///
/// @@ -26929,20 +28986,23 @@ pub enum EventsReadDirection { /// ///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum EventsCursorStatus { - /// The cursor was applied successfully. - #[serde(rename = "ok")] - Ok, - /// The cursor referred to history that is no longer available. - #[serde(rename = "expired")] - Expired, +pub enum HistoryRewindUnavailableReason { + /// The session did not opt into file-change tracking before its first turn. + #[serde(rename = "file-change-tracking-disabled")] + FileChangeTrackingDisabled, + /// The session still has work that may mutate files or history. Transient: the same request succeeds once the session settles, so callers should retry rather than treat it as a failure. + #[serde(rename = "session-busy")] + SessionBusy, + /// Remote-backed rewind routing is not supported. + #[serde(rename = "unsupported-remote-session")] + UnsupportedRemoteSession, /// Unknown variant for forward compatibility. #[default] #[serde(other)] Unknown, } -/// Discovery source: project (.github/extensions/), user (~/.copilot/extensions/), plugin (installed plugin), or session (session-state//extensions/) +/// Aggregate file change represented by a rewind preview. /// ///
/// @@ -26951,26 +29011,23 @@ pub enum EventsCursorStatus { /// ///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum ExtensionSource { - /// Extension discovered from the current project's .github/extensions directory. - #[serde(rename = "project")] - Project, - /// Extension discovered from the user's ~/.copilot/extensions directory. - #[serde(rename = "user")] - User, - /// Extension contributed by an installed plugin. - #[serde(rename = "plugin")] - Plugin, - /// Extension discovered from the current session's state directory (loaded only for this session). - #[serde(rename = "session")] - Session, +pub enum HistoryRewindChangeType { + /// The discarded turns created the file. + #[serde(rename = "created")] + Created, + /// The discarded turns deleted the file. + #[serde(rename = "deleted")] + Deleted, + /// The discarded turns modified the file. + #[serde(rename = "modified")] + Modified, /// Unknown variant for forward compatibility. #[default] #[serde(other)] Unknown, } -/// Current status: running, disabled, failed, or starting +/// Scope of a rewind operation. /// ///
/// @@ -26979,34 +29036,20 @@ pub enum ExtensionSource { /// ///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum ExtensionStatus { - /// The extension process is running. - #[serde(rename = "running")] - Running, - /// The extension is installed but disabled. - #[serde(rename = "disabled")] - Disabled, - /// The extension failed to start or crashed. - #[serde(rename = "failed")] - Failed, - /// The extension process is starting. - #[serde(rename = "starting")] - Starting, +pub enum HistoryRewindMode { + /// Discard conversation events while leaving files unchanged. + #[serde(rename = "conversation")] + Conversation, + /// Discard conversation events and restore captured files changed by those turns. + #[serde(rename = "conversation-and-files")] + ConversationAndFiles, /// Unknown variant for forward compatibility. #[default] #[serde(other)] Unknown, } -/// Attachment type discriminator -#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum ExtensionContextPushInputType { - #[serde(rename = "extension_context")] - #[default] - ExtensionContext, -} - -/// Binary result type discriminator. Use "image" for images and "resource" for other binary data. +/// Outcome of a rewind request. /// ///
/// @@ -27015,44 +29058,125 @@ pub enum ExtensionContextPushInputType { /// ///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum ExternalToolTextResultForLlmBinaryResultsForLlmType { - /// Binary image data. - #[serde(rename = "image")] - Image, - /// Other binary resource data. - #[serde(rename = "resource")] - Resource, +pub enum HistoryRewindOutcome { + /// The requested rewind completed; reachable in either mode. + #[serde(rename = "success")] + Success, + /// The session still has work that may mutate files or history; reachable in either mode. + #[serde(rename = "session-busy")] + SessionBusy, + /// A conversation-and-files rewind was requested for a session that did not enable capture; conversation-only rewinds never produce this. + #[serde(rename = "file-change-tracking-disabled")] + FileChangeTrackingDisabled, + /// Remote-backed rewind routing is not supported; reachable in either mode. + #[serde(rename = "unsupported-remote-session")] + UnsupportedRemoteSession, + /// File restore failed and all applied file changes were rolled back; only conversation-and-files rewinds produce this. + #[serde(rename = "files-rolled-back")] + FilesRolledBack, + /// File restore failed and its rollback could not fully restore the pre-rewind state; only conversation-and-files rewinds produce this. + #[serde(rename = "rollback-incomplete")] + RollbackIncomplete, + /// Conversation truncation failed. In conversation-and-files mode any files that were restored are left in place because conversation history cannot be un-truncated; in conversation-only mode no files are restored. Consult restoredFiles for what, if anything, was applied. + #[serde(rename = "truncation-failed")] + TruncationFailed, + /// The conversation was rewound (and, in conversation-and-files mode, captured files were restored), but persisted checkpoints could not be cleaned up; reachable in either mode. + #[serde(rename = "checkpoint-cleanup-failed")] + CheckpointCleanupFailed, + /// Files and conversation were rewound, but obsolete file snapshots could not be removed; only conversation-and-files rewinds produce this. + #[serde(rename = "snapshot-prune-failed")] + SnapshotPruneFailed, + /// Unknown variant for forward compatibility. + #[default] + #[serde(other)] + Unknown, +} + +/// Hook event name dispatched through the SDK callback transport. +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum HookType { + /// Runs before a tool is invoked. + #[serde(rename = "preToolUse")] + PreToolUse, + /// Runs before an MCP tool is invoked. + #[serde(rename = "preMcpToolCall")] + PreMcpToolCall, + /// Runs after a tool completes successfully. + #[serde(rename = "postToolUse")] + PostToolUse, + /// Runs after a tool fails. + #[serde(rename = "postToolUseFailure")] + PostToolUseFailure, + /// Runs after the user submits a prompt. + #[serde(rename = "userPromptSubmitted")] + UserPromptSubmitted, + /// Runs after the runtime transforms the submitted prompt for the model, before it is added to session history. + #[serde(rename = "userPromptTransformed")] + UserPromptTransformed, + /// Runs when a session starts. + #[serde(rename = "sessionStart")] + SessionStart, + /// Runs when a session ends. + #[serde(rename = "sessionEnd")] + SessionEnd, + /// Runs after an agent result is produced. + #[serde(rename = "postResult")] + PostResult, + /// Runs before a pull request description is generated. + #[serde(rename = "prePRDescription")] + PrePRDescription, + /// Runs when the agent encounters an error. + #[serde(rename = "errorOccurred")] + ErrorOccurred, + /// Runs when the agent stops. + #[serde(rename = "agentStop")] + AgentStop, + /// Runs when a subagent starts. + #[serde(rename = "subagentStart")] + SubagentStart, + /// Runs when a subagent stops. + #[serde(rename = "subagentStop")] + SubagentStop, + /// Runs before conversation context is compacted. + #[serde(rename = "preCompact")] + PreCompact, + /// Runs when the agent requests permission. + #[serde(rename = "permissionRequest")] + PermissionRequest, + /// Runs when the agent emits a notification. + #[serde(rename = "notification")] + Notification, /// Unknown variant for forward compatibility. #[default] #[serde(other)] Unknown, } -/// Content block type discriminator +/// Constant value. Always "github". #[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum ExternalToolTextResultForLlmContentAudioType { - #[serde(rename = "audio")] +pub enum InstalledPluginSourceGitHubSource { + #[serde(rename = "github")] #[default] - Audio, + GitHub, } -/// Content block type discriminator +/// Constant value. Always "local". #[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum ExternalToolTextResultForLlmContentImageType { - #[serde(rename = "image")] +pub enum InstalledPluginSourceLocalSource { + #[serde(rename = "local")] #[default] - Image, + Local, } -/// Content block type discriminator +/// Constant value. Always "url". #[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum ExternalToolTextResultForLlmContentResourceType { - #[serde(rename = "resource")] +pub enum InstalledPluginSourceUrlSource { + #[serde(rename = "url")] #[default] - Resource, + Url, } -/// Theme variant this icon is intended for +/// Whether the target is a single file or a directory of instruction files /// ///
/// @@ -27061,52 +29185,76 @@ pub enum ExternalToolTextResultForLlmContentResourceType { /// ///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum ExternalToolTextResultForLlmContentResourceLinkIconTheme { - /// Icon intended for light themes. - #[serde(rename = "light")] - Light, - /// Icon intended for dark themes. - #[serde(rename = "dark")] - Dark, +pub enum InstructionDiscoveryPathKind { + /// The target is a single instruction file. + #[serde(rename = "file")] + File, + /// The target is a directory that holds instruction files. + #[serde(rename = "directory")] + Directory, /// Unknown variant for forward compatibility. #[default] #[serde(other)] Unknown, } -/// Content block type discriminator -#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum ExternalToolTextResultForLlmContentResourceLinkType { - #[serde(rename = "resource_link")] - #[default] - ResourceLink, -} - -/// Content block type discriminator -#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum ExternalToolTextResultForLlmContentShellExitType { - #[serde(rename = "shell_exit")] - #[default] - ShellExit, -} - -/// Content block type discriminator +/// Which tier this target belongs to +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum ExternalToolTextResultForLlmContentTerminalType { - #[serde(rename = "terminal")] +pub enum InstructionDiscoveryPathLocation { + /// Instructions live in user-level configuration. + #[serde(rename = "user")] + User, + /// Instructions live in repository-level configuration. + #[serde(rename = "repository")] + Repository, + /// Instructions live under the current working directory. + #[serde(rename = "working-directory")] + WorkingDirectory, + /// Instructions live in plugin-provided configuration. + #[serde(rename = "plugin")] + Plugin, + /// Unknown variant for forward compatibility. #[default] - Terminal, + #[serde(other)] + Unknown, } -/// Content block type discriminator +/// Where this source lives — used for UI grouping +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum ExternalToolTextResultForLlmContentTextType { - #[serde(rename = "text")] +pub enum InstructionSourceLocation { + /// Instructions live in user-level configuration. + #[serde(rename = "user")] + User, + /// Instructions live in repository-level configuration. + #[serde(rename = "repository")] + Repository, + /// Instructions live under the current working directory. + #[serde(rename = "working-directory")] + WorkingDirectory, + /// Instructions live in plugin-provided configuration. + #[serde(rename = "plugin")] + Plugin, + /// Unknown variant for forward compatibility. #[default] - Text, + #[serde(other)] + Unknown, } -/// Execution-critical factory storage operation. +/// Category of instruction source — used for merge logic /// ///
/// @@ -27115,47 +29263,50 @@ pub enum ExternalToolTextResultForLlmContentTextType { /// ///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum FactoryDurableOperation { - /// Creating the durable run and declared phases. - #[serde(rename = "createRun")] - CreateRun, - /// Persisting the transition to running. - #[serde(rename = "markRunStarted")] - MarkRunStarted, - /// Persisting the terminal run envelope. - #[serde(rename = "finishRun")] - FinishRun, - /// Persisting subagent admission accounting. - #[serde(rename = "reserveAgent")] - ReserveAgent, - /// Rolling back an uncommitted subagent admission. - #[serde(rename = "releaseAgent")] - ReleaseAgent, - /// Persisting an idempotent model-usage charge. - #[serde(rename = "chargeCredit")] - ChargeCredit, - /// Persisting active execution time. - #[serde(rename = "addElapsed")] - AddElapsed, - /// Reading the authoritative AI-credit total. - #[serde(rename = "reconcileCreditTotal")] - ReconcileCreditTotal, - /// Reading a journal entry without treating storage failure as a cache miss. - #[serde(rename = "journalGet")] - JournalGet, - /// Persisting a journal entry before reporting success. - #[serde(rename = "journalPut")] - JournalPut, - /// Renewing the durable owner lease that proves this process still owns the run. - #[serde(rename = "refreshLease")] - RefreshLease, +pub enum InstructionSourceType { + /// Instructions loaded from the user's home configuration. + #[serde(rename = "home")] + Home, + /// Instructions loaded from repository-scoped files. + #[serde(rename = "repo")] + Repo, + /// Instructions loaded from model-specific files. + #[serde(rename = "model")] + Model, + /// Instructions loaded from VS Code instruction files. + #[serde(rename = "vscode")] + Vscode, + /// Instructions discovered from nested agent files. + #[serde(rename = "nested-agents")] + NestedAgents, + /// Instructions inherited from child instruction files. + #[serde(rename = "child-instructions")] + ChildInstructions, + /// Instructions supplied by an installed plugin. + #[serde(rename = "plugin")] + Plugin, /// Unknown variant for forward compatibility. #[default] #[serde(other)] Unknown, } -/// Current or terminal state of a factory run. +/// Transport the runtime would otherwise use for this request. `http` (the default when absent) covers plain HTTP and SSE responses; `websocket` indicates a full-duplex message channel where each body chunk maps to one WebSocket message and the `binary` flag distinguishes text from binary frames. The SDK consumer uses this to decide whether to service the request with an HTTP client or a WebSocket client. It is the one piece of request metadata the consumer cannot reliably infer from the URL or headers alone. +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum LlmInferenceHttpRequestStartTransport { + /// Plain HTTP or SSE response. Each body chunk is an opaque byte range; the response is a status line, headers, and a (possibly streamed) body. + #[serde(rename = "http")] + Http, + /// Full-duplex WebSocket channel. Each body chunk maps to exactly one WebSocket message and the `binary` flag distinguishes text from binary frames; request and response chunks flow concurrently. + #[serde(rename = "websocket")] + Websocket, + /// Unknown variant for forward compatibility. + #[default] + #[serde(other)] + Unknown, +} + +/// Repository host type /// ///
/// @@ -27164,32 +29315,20 @@ pub enum FactoryDurableOperation { /// ///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum FactoryRunStatus { - /// The run was minted and is awaiting approval. - #[serde(rename = "pending")] - Pending, - /// The run is executing. - #[serde(rename = "running")] - Running, - /// The run completed successfully. - #[serde(rename = "completed")] - Completed, - /// The run was interrupted while resource budget remained. - #[serde(rename = "halted")] - Halted, - /// The run was cancelled before completion. - #[serde(rename = "cancelled")] - Cancelled, - /// The factory body failed or reached a cumulative resource ceiling. - #[serde(rename = "error")] - Error, +pub enum SessionContextHostType { + /// Session repository is hosted on GitHub. + #[serde(rename = "github")] + GitHub, + /// Session repository is hosted on Azure DevOps. + #[serde(rename = "ado")] + Ado, /// Unknown variant for forward compatibility. #[default] #[serde(other)] Unknown, } -/// Kind of factory progress line. +/// Log severity level. Determines how the message is displayed in the timeline. Defaults to "info". /// ///
/// @@ -27198,20 +29337,23 @@ pub enum FactoryRunStatus { /// ///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum FactoryLogLineKind { - /// A narrator log line. - #[serde(rename = "log")] - Log, - /// A named factory phase marker. - #[serde(rename = "phase")] - Phase, +pub enum SessionLogLevel { + /// Informational message. + #[serde(rename = "info")] + Info, + /// Warning message that may require attention. + #[serde(rename = "warning")] + Warning, + /// Error message describing a failure. + #[serde(rename = "error")] + Error, /// Unknown variant for forward compatibility. #[default] #[serde(other)] Unknown, } -/// Derived lifecycle state of a factory phase. +/// Allowed values for the `McpAppsHostContextDetailsAvailableDisplayMode` enumeration. /// ///
/// @@ -27220,26 +29362,23 @@ pub enum FactoryLogLineKind { /// ///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum FactoryPhaseStatus { - /// The phase has not been entered yet. - #[serde(rename = "pending")] - Pending, - /// The phase is currently entered and accumulating active time. - #[serde(rename = "active")] - Active, - /// The phase was entered and has since been closed. - #[serde(rename = "completed")] - Completed, - /// The phase was never entered because a later phase was entered or the run reached a terminal state. - #[serde(rename = "skipped")] - Skipped, +pub enum McpAppsHostContextDetailsAvailableDisplayMode { + /// Rendered inline within the host conversation surface + #[serde(rename = "inline")] + Inline, + /// Rendered as a fullscreen overlay + #[serde(rename = "fullscreen")] + Fullscreen, + /// Rendered as a picture-in-picture floating panel + #[serde(rename = "pip")] + Pip, /// Unknown variant for forward compatibility. #[default] #[serde(other)] Unknown, } -/// Cumulative resource ceiling that stopped a factory run. +/// Current display mode (SEP-1865) /// ///
/// @@ -27248,38 +29387,48 @@ pub enum FactoryPhaseStatus { /// ///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum FactoryRunFailureKind { - /// The run admitted the approved maximum total number of subagents. - #[serde(rename = "maxTotalSubagents")] - MaxTotalSubagents, - /// The run reached the approved accumulated active-execution time in seconds. - #[serde(rename = "timeoutSeconds")] - TimeoutSeconds, - /// The run's settled subagent model usage exceeded the approved AI-credit ceiling, or no headroom remained for another subagent. - #[serde(rename = "maxAiCredits")] - MaxAiCredits, +pub enum McpAppsHostContextDetailsDisplayMode { + /// Rendered inline within the host conversation surface + #[serde(rename = "inline")] + Inline, + /// Rendered as a fullscreen overlay + #[serde(rename = "fullscreen")] + Fullscreen, + /// Rendered as a picture-in-picture floating panel + #[serde(rename = "pip")] + Pip, /// Unknown variant for forward compatibility. #[default] #[serde(other)] Unknown, } -/// What initiated this compaction request, recorded as the `trigger` on the persisted `session.compaction_start` / `session.compaction_complete` events. When absent, the compaction is persisted without trigger attribution (initiator unknown). +/// Platform type for responsive design +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum HistoryCompactRequestTrigger { - /// User-requested compaction, e.g. the /compact command or a direct history.compact call. - #[serde(rename = "manual")] - Manual, - /// Compaction requested while switching to a model with a smaller context window. - #[serde(rename = "model_switch")] - ModelSwitch, +pub enum McpAppsHostContextDetailsPlatform { + /// Host runs in a web browser + #[serde(rename = "web")] + Web, + /// Host runs as a desktop application + #[serde(rename = "desktop")] + Desktop, + /// Host runs on a mobile device + #[serde(rename = "mobile")] + Mobile, /// Unknown variant for forward compatibility. #[default] #[serde(other)] Unknown, } -/// Reason a captured file was not restored. +/// UI theme preference per SEP-1865 /// ///
/// @@ -27288,20 +29437,20 @@ pub enum HistoryCompactRequestTrigger { /// ///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum HistoryFileRestoreSkipReason { - /// The file changed after Copilot's last captured write. - #[serde(rename = "user-modified")] - UserModified, - /// A faithful preimage was not captured. - #[serde(rename = "skipped-capture")] - SkippedCapture, +pub enum McpAppsHostContextDetailsTheme { + /// Light UI theme + #[serde(rename = "light")] + Light, + /// Dark UI theme + #[serde(rename = "dark")] + Dark, /// Unknown variant for forward compatibility. #[default] #[serde(other)] Unknown, } -/// Reason a rewind read (rewind points, file-restore preview, or session diff) could not be answered from the session's file-change captures. +/// Allowed values for the `McpAppsSetHostContextDetailsAvailableDisplayMode` enumeration. /// ///
/// @@ -27310,23 +29459,23 @@ pub enum HistoryFileRestoreSkipReason { /// ///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum HistoryRewindUnavailableReason { - /// The session did not opt into file-change tracking before its first turn. - #[serde(rename = "file-change-tracking-disabled")] - FileChangeTrackingDisabled, - /// The session still has work that may mutate files or history. Transient: the same request succeeds once the session settles, so callers should retry rather than treat it as a failure. - #[serde(rename = "session-busy")] - SessionBusy, - /// Remote-backed rewind routing is not supported. - #[serde(rename = "unsupported-remote-session")] - UnsupportedRemoteSession, +pub enum McpAppsSetHostContextDetailsAvailableDisplayMode { + /// Rendered inline within the host conversation surface + #[serde(rename = "inline")] + Inline, + /// Rendered as a fullscreen overlay + #[serde(rename = "fullscreen")] + Fullscreen, + /// Rendered as a picture-in-picture floating panel + #[serde(rename = "pip")] + Pip, /// Unknown variant for forward compatibility. #[default] #[serde(other)] Unknown, } -/// Aggregate file change represented by a rewind preview. +/// Current display mode (SEP-1865) /// ///
/// @@ -27335,23 +29484,23 @@ pub enum HistoryRewindUnavailableReason { /// ///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum HistoryRewindChangeType { - /// The discarded turns created the file. - #[serde(rename = "created")] - Created, - /// The discarded turns deleted the file. - #[serde(rename = "deleted")] - Deleted, - /// The discarded turns modified the file. - #[serde(rename = "modified")] - Modified, +pub enum McpAppsSetHostContextDetailsDisplayMode { + /// Rendered inline within the host conversation surface + #[serde(rename = "inline")] + Inline, + /// Rendered as a fullscreen overlay + #[serde(rename = "fullscreen")] + Fullscreen, + /// Rendered as a picture-in-picture floating panel + #[serde(rename = "pip")] + Pip, /// Unknown variant for forward compatibility. #[default] #[serde(other)] Unknown, } -/// Scope of a rewind operation. +/// Platform type for responsive design /// ///
/// @@ -27360,20 +29509,23 @@ pub enum HistoryRewindChangeType { /// ///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum HistoryRewindMode { - /// Discard conversation events while leaving files unchanged. - #[serde(rename = "conversation")] - Conversation, - /// Discard conversation events and restore captured files changed by those turns. - #[serde(rename = "conversation-and-files")] - ConversationAndFiles, +pub enum McpAppsSetHostContextDetailsPlatform { + /// Host runs in a web browser + #[serde(rename = "web")] + Web, + /// Host runs as a desktop application + #[serde(rename = "desktop")] + Desktop, + /// Host runs on a mobile device + #[serde(rename = "mobile")] + Mobile, /// Unknown variant for forward compatibility. #[default] #[serde(other)] Unknown, } -/// Outcome of a rewind request. +/// UI theme preference per SEP-1865 /// ///
/// @@ -27382,125 +29534,69 @@ pub enum HistoryRewindMode { /// ///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum HistoryRewindOutcome { - /// The requested rewind completed; reachable in either mode. - #[serde(rename = "success")] - Success, - /// The session still has work that may mutate files or history; reachable in either mode. - #[serde(rename = "session-busy")] - SessionBusy, - /// A conversation-and-files rewind was requested for a session that did not enable capture; conversation-only rewinds never produce this. - #[serde(rename = "file-change-tracking-disabled")] - FileChangeTrackingDisabled, - /// Remote-backed rewind routing is not supported; reachable in either mode. - #[serde(rename = "unsupported-remote-session")] - UnsupportedRemoteSession, - /// File restore failed and all applied file changes were rolled back; only conversation-and-files rewinds produce this. - #[serde(rename = "files-rolled-back")] - FilesRolledBack, - /// File restore failed and its rollback could not fully restore the pre-rewind state; only conversation-and-files rewinds produce this. - #[serde(rename = "rollback-incomplete")] - RollbackIncomplete, - /// Conversation truncation failed. In conversation-and-files mode any files that were restored are left in place because conversation history cannot be un-truncated; in conversation-only mode no files are restored. Consult restoredFiles for what, if anything, was applied. - #[serde(rename = "truncation-failed")] - TruncationFailed, - /// The conversation was rewound (and, in conversation-and-files mode, captured files were restored), but persisted checkpoints could not be cleaned up; reachable in either mode. - #[serde(rename = "checkpoint-cleanup-failed")] - CheckpointCleanupFailed, - /// Files and conversation were rewound, but obsolete file snapshots could not be removed; only conversation-and-files rewinds produce this. - #[serde(rename = "snapshot-prune-failed")] - SnapshotPruneFailed, +pub enum McpAppsSetHostContextDetailsTheme { + /// Light UI theme + #[serde(rename = "light")] + Light, + /// Dark UI theme + #[serde(rename = "dark")] + Dark, /// Unknown variant for forward compatibility. #[default] #[serde(other)] Unknown, } -/// Hook event name dispatched through the SDK callback transport. +/// Structured MCP elicitation mode. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum HookType { - /// Runs before a tool is invoked. - #[serde(rename = "preToolUse")] - PreToolUse, - /// Runs before an MCP tool is invoked. - #[serde(rename = "preMcpToolCall")] - PreMcpToolCall, - /// Runs after a tool completes successfully. - #[serde(rename = "postToolUse")] - PostToolUse, - /// Runs after a tool fails. - #[serde(rename = "postToolUseFailure")] - PostToolUseFailure, - /// Runs after the user submits a prompt. - #[serde(rename = "userPromptSubmitted")] - UserPromptSubmitted, - /// Runs after the runtime transforms the submitted prompt for the model, before it is added to session history. - #[serde(rename = "userPromptTransformed")] - UserPromptTransformed, - /// Runs when a session starts. - #[serde(rename = "sessionStart")] - SessionStart, - /// Runs when a session ends. - #[serde(rename = "sessionEnd")] - SessionEnd, - /// Runs after an agent result is produced. - #[serde(rename = "postResult")] - PostResult, - /// Runs before a pull request description is generated. - #[serde(rename = "prePRDescription")] - PrePRDescription, - /// Runs when the agent encounters an error. - #[serde(rename = "errorOccurred")] - ErrorOccurred, - /// Runs when the agent stops. - #[serde(rename = "agentStop")] - AgentStop, - /// Runs when a subagent starts. - #[serde(rename = "subagentStart")] - SubagentStart, - /// Runs when a subagent stops. - #[serde(rename = "subagentStop")] - SubagentStop, - /// Runs before conversation context is compacted. - #[serde(rename = "preCompact")] - PreCompact, - /// Runs when the agent requests permission. - #[serde(rename = "permissionRequest")] - PermissionRequest, - /// Runs when the agent emits a notification. - #[serde(rename = "notification")] - Notification, +pub enum McpElicitationFormMode { + #[serde(rename = "form")] + Form, /// Unknown variant for forward compatibility. #[default] #[serde(other)] Unknown, } -/// Constant value. Always "github". +/// Headers-refresh response variant discriminator. #[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum InstalledPluginSourceGitHubSource { - #[serde(rename = "github")] +pub enum McpHeadersHandlePendingHeadersRefreshRequestHeadersKind { + #[serde(rename = "headers")] #[default] - GitHub, + Headers, } -/// Constant value. Always "local". +/// Headers-refresh response variant discriminator. #[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum InstalledPluginSourceLocalSource { - #[serde(rename = "local")] +pub enum McpHeadersHandlePendingHeadersRefreshRequestNoneKind { + #[serde(rename = "none")] #[default] - Local, + None, } -/// Constant value. Always "url". -#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum InstalledPluginSourceUrlSource { - #[serde(rename = "url")] - #[default] - Url, +/// Host response: supply dynamic headers or decline this refresh. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum McpHeadersHandlePendingHeadersRefreshRequest { + Headers(McpHeadersHandlePendingHeadersRefreshRequestHeaders), + None(McpHeadersHandlePendingHeadersRefreshRequestNone), } -/// Whether the target is a single file or a directory of instruction files +/// Whether a planned configuration change would create or modify an entry /// ///
/// @@ -27509,20 +29605,20 @@ pub enum InstalledPluginSourceUrlSource { /// ///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum InstructionDiscoveryPathKind { - /// The target is a single instruction file. - #[serde(rename = "file")] - File, - /// The target is a directory that holds instruction files. - #[serde(rename = "directory")] - Directory, +pub enum McpPlanConfigurationOperation { + /// Creates a configuration entry that does not exist yet. + #[serde(rename = "add")] + Add, + /// Modifies a configuration entry that already exists. + #[serde(rename = "update")] + Update, /// Unknown variant for forward compatibility. #[default] #[serde(other)] Unknown, } -/// Which tier this target belongs to +/// Configuration scope an MCP install plan targets /// ///
/// @@ -27531,26 +29627,17 @@ pub enum InstructionDiscoveryPathKind { /// ///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum InstructionDiscoveryPathLocation { - /// Instructions live in user-level configuration. +pub enum McpPlanScope { + /// The user's own MCP configuration. #[serde(rename = "user")] User, - /// Instructions live in repository-level configuration. - #[serde(rename = "repository")] - Repository, - /// Instructions live under the current working directory. - #[serde(rename = "working-directory")] - WorkingDirectory, - /// Instructions live in plugin-provided configuration. - #[serde(rename = "plugin")] - Plugin, /// Unknown variant for forward compatibility. #[default] #[serde(other)] Unknown, } -/// Where this source lives — used for UI grouping +/// What policy decided for a planned server /// ///
/// @@ -27559,26 +29646,23 @@ pub enum InstructionDiscoveryPathLocation { /// ///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum InstructionSourceLocation { - /// Instructions live in user-level configuration. - #[serde(rename = "user")] - User, - /// Instructions live in repository-level configuration. - #[serde(rename = "repository")] - Repository, - /// Instructions live under the current working directory. - #[serde(rename = "working-directory")] - WorkingDirectory, - /// Instructions live in plugin-provided configuration. - #[serde(rename = "plugin")] - Plugin, +pub enum McpPlanPolicyDecision { + /// Policy permits the server. + #[serde(rename = "allowed")] + Allowed, + /// Policy forbids the server, so the plan cannot be applied. + #[serde(rename = "blocked")] + Blocked, + /// Policy permits the server only after an explicit approval. + #[serde(rename = "requires-approval")] + RequiresApproval, /// Unknown variant for forward compatibility. #[default] #[serde(other)] Unknown, } -/// Category of instruction source — used for merge logic +/// Consumer allowed to call an MCP tool. /// ///
/// @@ -27587,72 +29671,36 @@ pub enum InstructionSourceLocation { /// ///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum InstructionSourceType { - /// Instructions loaded from the user's home configuration. - #[serde(rename = "home")] - Home, - /// Instructions loaded from repository-scoped files. - #[serde(rename = "repo")] - Repo, - /// Instructions loaded from model-specific files. +pub enum McpToolUiVisibility { + /// The model may call the tool. #[serde(rename = "model")] Model, - /// Instructions loaded from VS Code instruction files. - #[serde(rename = "vscode")] - Vscode, - /// Instructions discovered from nested agent files. - #[serde(rename = "nested-agents")] - NestedAgents, - /// Instructions inherited from child instruction files. - #[serde(rename = "child-instructions")] - ChildInstructions, - /// Instructions supplied by an installed plugin. - #[serde(rename = "plugin")] - Plugin, + /// An MCP App view may call the tool. + #[serde(rename = "app")] + App, /// Unknown variant for forward compatibility. #[default] #[serde(other)] Unknown, } -/// Transport the runtime would otherwise use for this request. `http` (the default when absent) covers plain HTTP and SSE responses; `websocket` indicates a full-duplex message channel where each body chunk maps to one WebSocket message and the `binary` flag distinguishes text from binary frames. The SDK consumer uses this to decide whether to service the request with an HTTP client or a WebSocket client. It is the one piece of request metadata the consumer cannot reliably infer from the URL or headers alone. +/// OAuth response variant discriminator. #[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum LlmInferenceHttpRequestStartTransport { - /// Plain HTTP or SSE response. Each body chunk is an opaque byte range; the response is a status line, headers, and a (possibly streamed) body. - #[serde(rename = "http")] - Http, - /// Full-duplex WebSocket channel. Each body chunk maps to exactly one WebSocket message and the `binary` flag distinguishes text from binary frames; request and response chunks flow concurrently. - #[serde(rename = "websocket")] - Websocket, - /// Unknown variant for forward compatibility. +pub enum McpOauthPendingRequestResponseTokenKind { + #[serde(rename = "token")] #[default] - #[serde(other)] - Unknown, + Token, } -/// Repository host type -/// -///
-/// -/// **Experimental.** This type is part of an experimental wire-protocol surface -/// and may change or be removed in future SDK or CLI releases. -/// -///
+/// OAuth response variant discriminator. #[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum SessionContextHostType { - /// Session repository is hosted on GitHub. - #[serde(rename = "github")] - GitHub, - /// Session repository is hosted on Azure DevOps. - #[serde(rename = "ado")] - Ado, - /// Unknown variant for forward compatibility. +pub enum McpOauthPendingRequestResponseCancelledKind { + #[serde(rename = "cancelled")] #[default] - #[serde(other)] - Unknown, + Cancelled, } -/// Log severity level. Determines how the message is displayed in the timeline. Defaults to "info". +/// Host response to the pending OAuth request. /// ///
/// @@ -27660,24 +29708,14 @@ pub enum SessionContextHostType { /// and may change or be removed in future SDK or CLI releases. /// ///
-#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum SessionLogLevel { - /// Informational message. - #[serde(rename = "info")] - Info, - /// Warning message that may require attention. - #[serde(rename = "warning")] - Warning, - /// Error message describing a failure. - #[serde(rename = "error")] - Error, - /// Unknown variant for forward compatibility. - #[default] - #[serde(other)] - Unknown, +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum McpOauthPendingRequestResponse { + Token(McpOauthPendingRequestResponseToken), + Cancelled(McpOauthPendingRequestResponseCancelled), } -/// Allowed values for the `McpAppsHostContextDetailsAvailableDisplayMode` enumeration. +/// OAuth grant type override for this login. /// ///
/// @@ -27686,23 +29724,20 @@ pub enum SessionLogLevel { /// ///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum McpAppsHostContextDetailsAvailableDisplayMode { - /// Rendered inline within the host conversation surface - #[serde(rename = "inline")] - Inline, - /// Rendered as a fullscreen overlay - #[serde(rename = "fullscreen")] - Fullscreen, - /// Rendered as a picture-in-picture floating panel - #[serde(rename = "pip")] - Pip, +pub enum McpOauthLoginGrantType { + /// Interactive browser-based OAuth flow using an authorization code, typically with PKCE. + #[serde(rename = "authorization_code")] + AuthorizationCode, + /// Headless OAuth flow where a confidential client authenticates directly with a client secret. + #[serde(rename = "client_credentials")] + ClientCredentials, /// Unknown variant for forward compatibility. #[default] #[serde(other)] Unknown, } -/// Current display mode (SEP-1865) +/// Why a passive MCP OAuth probe determined authentication is needed. /// ///
/// @@ -27711,23 +29746,55 @@ pub enum McpAppsHostContextDetailsAvailableDisplayMode { /// ///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum McpAppsHostContextDetailsDisplayMode { - /// Rendered inline within the host conversation surface - #[serde(rename = "inline")] - Inline, - /// Rendered as a fullscreen overlay - #[serde(rename = "fullscreen")] - Fullscreen, - /// Rendered as a picture-in-picture floating panel - #[serde(rename = "pip")] - Pip, +pub enum McpOauthProbeNeedsAuthReason { + /// No token was sent and the server requires authentication. + #[serde(rename = "initial")] + Initial, + /// A cached token was sent and rejected. + #[serde(rename = "refresh")] + Refresh, + /// The server returned a 403 insufficient_scope challenge, indicating additional scopes or audience are needed. + #[serde(rename = "upscope")] + Upscope, /// Unknown variant for forward compatibility. #[default] #[serde(other)] Unknown, } -/// Platform type for responsive design +/// Probe outcome variant discriminator. +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum McpOauthProbeResultNoAuthRequiredStatus { + #[serde(rename = "no-auth-required")] + #[default] + NoAuthRequired, +} + +/// Probe outcome variant discriminator. +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum McpOauthProbeResultAuthenticatedStatus { + #[serde(rename = "authenticated")] + #[default] + Authenticated, +} + +/// Probe outcome variant discriminator. +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum McpOauthProbeResultNeedsAuthStatus { + #[serde(rename = "needs-auth")] + #[default] + NeedsAuth, +} + +/// Probe outcome variant discriminator. +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum McpOauthProbeResultFailedStatus { + #[serde(rename = "failed")] + #[default] + Failed, +} + +/// 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. /// ///
/// @@ -27735,24 +29802,16 @@ pub enum McpAppsHostContextDetailsDisplayMode { /// and may change or be removed in future SDK or CLI releases. /// ///
-#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum McpAppsHostContextDetailsPlatform { - /// Host runs in a web browser - #[serde(rename = "web")] - Web, - /// Host runs as a desktop application - #[serde(rename = "desktop")] - Desktop, - /// Host runs on a mobile device - #[serde(rename = "mobile")] - Mobile, - /// Unknown variant for forward compatibility. - #[default] - #[serde(other)] - Unknown, +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum McpOauthProbeResult { + NoAuthRequired(McpOauthProbeResultNoAuthRequired), + Authenticated(McpOauthProbeResultAuthenticated), + NeedsAuth(McpOauthProbeResultNeedsAuth), + Failed(McpOauthProbeResultFailed), } -/// UI theme preference per SEP-1865 +/// Discriminator for an enumerated required value /// ///
/// @@ -27761,45 +29820,25 @@ pub enum McpAppsHostContextDetailsPlatform { /// ///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum McpAppsHostContextDetailsTheme { - /// Light UI theme - #[serde(rename = "light")] - Light, - /// Dark UI theme - #[serde(rename = "dark")] - Dark, +pub enum McpPlanEnumValueType { + /// One of a fixed, non-empty set of permitted values. + #[serde(rename = "enum")] + Enum, /// Unknown variant for forward compatibility. #[default] #[serde(other)] Unknown, } -/// Allowed values for the `McpAppsSetHostContextDetailsAvailableDisplayMode` enumeration. -/// -///
-/// -/// **Experimental.** This type is part of an experimental wire-protocol surface -/// and may change or be removed in future SDK or CLI releases. -/// -///
-#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum McpAppsSetHostContextDetailsAvailableDisplayMode { - /// Rendered inline within the host conversation surface - #[serde(rename = "inline")] - Inline, - /// Rendered as a fullscreen overlay - #[serde(rename = "fullscreen")] - Fullscreen, - /// Rendered as a picture-in-picture floating panel - #[serde(rename = "pip")] - Pip, - /// Unknown variant for forward compatibility. +/// Discriminator: a plan was computed and nothing was changed +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum McpPlanInstallPlannedKind { + #[serde(rename = "planned")] #[default] - #[serde(other)] - Unknown, + Planned, } -/// Current display mode (SEP-1865) +/// Discriminator for a candidate-backed install-plan source /// ///
/// @@ -27808,23 +29847,17 @@ pub enum McpAppsSetHostContextDetailsAvailableDisplayMode { /// ///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum McpAppsSetHostContextDetailsDisplayMode { - /// Rendered inline within the host conversation surface - #[serde(rename = "inline")] - Inline, - /// Rendered as a fullscreen overlay - #[serde(rename = "fullscreen")] - Fullscreen, - /// Rendered as a picture-in-picture floating panel - #[serde(rename = "pip")] - Pip, +pub enum McpPlanInstallSourceCandidateKind { + /// Plan from a candidate returned by catalog search. + #[serde(rename = "candidate")] + Candidate, /// Unknown variant for forward compatibility. #[default] #[serde(other)] Unknown, } -/// Platform type for responsive design +/// Discriminator for a URL-backed MCP server card /// ///
/// @@ -27833,23 +29866,17 @@ pub enum McpAppsSetHostContextDetailsDisplayMode { /// ///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum McpAppsSetHostContextDetailsPlatform { - /// Host runs in a web browser - #[serde(rename = "web")] - Web, - /// Host runs as a desktop application - #[serde(rename = "desktop")] - Desktop, - /// Host runs on a mobile device - #[serde(rename = "mobile")] - Mobile, +pub enum McpServerCardUrlKind { + /// Retrieve the card from its URL. + #[serde(rename = "url")] + Url, /// Unknown variant for forward compatibility. #[default] #[serde(other)] Unknown, } -/// UI theme preference per SEP-1865 +/// Discriminator for an embedded MCP server card /// ///
/// @@ -27858,20 +29885,32 @@ pub enum McpAppsSetHostContextDetailsPlatform { /// ///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum McpAppsSetHostContextDetailsTheme { - /// Light UI theme - #[serde(rename = "light")] - Light, - /// Dark UI theme - #[serde(rename = "dark")] - Dark, +pub enum McpServerCardEmbeddedKind { + /// Use the embedded card document. + #[serde(rename = "embedded")] + Embedded, /// Unknown variant for forward compatibility. #[default] #[serde(other)] Unknown, } -/// Structured MCP elicitation mode. +/// 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. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum McpServerCardReference { + Url(McpServerCardUrl), + Embedded(McpServerCardEmbedded), +} + +/// Discriminator for a caller-supplied-card install-plan source /// ///
/// @@ -27880,32 +29919,32 @@ pub enum McpAppsSetHostContextDetailsTheme { /// ///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum McpElicitationFormMode { - #[serde(rename = "form")] - Form, +pub enum McpPlanInstallSourceCardKind { + /// Plan directly from a caller-supplied card. + #[serde(rename = "card")] + Card, /// Unknown variant for forward compatibility. #[default] #[serde(other)] Unknown, } -/// Headers-refresh response variant discriminator. -#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum McpHeadersHandlePendingHeadersRefreshRequestHeadersKind { - #[serde(rename = "headers")] - #[default] - Headers, -} - -/// Headers-refresh response variant discriminator. -#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum McpHeadersHandlePendingHeadersRefreshRequestNoneKind { - #[serde(rename = "none")] - #[default] - None, +/// What an install plan is computed from: a candidate handle from a previous search, or a card supplied directly. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum McpPlanInstallSource { + Candidate(McpPlanInstallSourceCandidate), + Card(McpPlanInstallSourceCard), } -/// Host response: supply dynamic headers or decline this refresh. +/// Outcome of an mcp.planInstall call: either a normalised plan, or one typed refusal. Nothing is written in either case. /// ///
/// @@ -27915,12 +29954,23 @@ pub enum McpHeadersHandlePendingHeadersRefreshRequestNoneKind { ///
#[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] -pub enum McpHeadersHandlePendingHeadersRefreshRequest { - Headers(McpHeadersHandlePendingHeadersRefreshRequestHeaders), - None(McpHeadersHandlePendingHeadersRefreshRequestNone), +pub enum McpPlanInstallResult { + Planned(McpPlanInstallPlanned), + NegotiationRefused(CatalogNegotiationRefusedError), + HandleRejected(CatalogHandleRejectedError), + InvalidRequest(CatalogInvalidRequestError), + AuthenticationRequired(CatalogAuthenticationRequiredError), + PolicyRejected(CatalogPolicyRejectedError), + NetworkFailure(CatalogNetworkFailureError), + UnsafeRetrieval(CatalogUnsafeRetrievalError), + MalformedCard(CatalogMalformedCardError), + ContractViolation(CatalogContractViolationError), + UnavailableTransport(CatalogUnavailableTransportError), + NotInstallable(CatalogNotInstallableError), + Unavailable(CatalogUnavailableError), } -/// Consumer allowed to call an MCP tool. +/// Discriminator for a package-backed transport choice /// ///
/// @@ -27929,36 +29979,17 @@ pub enum McpHeadersHandlePendingHeadersRefreshRequest { /// ///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum McpToolUiVisibility { - /// The model may call the tool. - #[serde(rename = "model")] - Model, - /// An MCP App view may call the tool. - #[serde(rename = "app")] - App, +pub enum McpPlanPackageInstallMethod { + /// Install and run a local package. + #[serde(rename = "package")] + Package, /// Unknown variant for forward compatibility. #[default] #[serde(other)] Unknown, } -/// OAuth response variant discriminator. -#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum McpOauthPendingRequestResponseTokenKind { - #[serde(rename = "token")] - #[default] - Token, -} - -/// OAuth response variant discriminator. -#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum McpOauthPendingRequestResponseCancelledKind { - #[serde(rename = "cancelled")] - #[default] - Cancelled, -} - -/// Host response to the pending OAuth request. +/// Transport exposed by a locally launched package /// ///
/// @@ -27966,14 +29997,18 @@ pub enum McpOauthPendingRequestResponseCancelledKind { /// and may change or be removed in future SDK or CLI releases. /// ///
-#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum McpOauthPendingRequestResponse { - Token(McpOauthPendingRequestResponseToken), - Cancelled(McpOauthPendingRequestResponseCancelled), +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum McpPlanPackageTransport { + /// A locally launched process spoken to over standard input and output. + #[serde(rename = "stdio")] + Stdio, + /// Unknown variant for forward compatibility. + #[default] + #[serde(other)] + Unknown, } -/// OAuth grant type override for this login. +/// Discriminator for a remote-endpoint transport choice /// ///
/// @@ -27982,20 +30017,17 @@ pub enum McpOauthPendingRequestResponse { /// ///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum McpOauthLoginGrantType { - /// Interactive browser-based OAuth flow using an authorization code, typically with PKCE. - #[serde(rename = "authorization_code")] - AuthorizationCode, - /// Headless OAuth flow where a confidential client authenticates directly with a client secret. - #[serde(rename = "client_credentials")] - ClientCredentials, +pub enum McpPlanRemoteInstallMethod { + /// Connect to a remote endpoint. + #[serde(rename = "remote")] + Remote, /// Unknown variant for forward compatibility. #[default] #[serde(other)] Unknown, } -/// Why a passive MCP OAuth probe determined authentication is needed. +/// Transport exposed by a remote endpoint /// ///
/// @@ -28004,55 +30036,120 @@ pub enum McpOauthLoginGrantType { /// ///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum McpOauthProbeNeedsAuthReason { - /// No token was sent and the server requires authentication. - #[serde(rename = "initial")] - Initial, - /// A cached token was sent and rejected. - #[serde(rename = "refresh")] - Refresh, - /// The server returned a 403 insufficient_scope challenge, indicating additional scopes or audience are needed. - #[serde(rename = "upscope")] - Upscope, +pub enum McpPlanRemoteTransport { + /// An HTTP endpoint. + #[serde(rename = "http")] + Http, + /// A streamable HTTP endpoint. + #[serde(rename = "streamable-http")] + StreamableHttp, + /// A server-sent events endpoint. + #[serde(rename = "sse")] + Sse, /// Unknown variant for forward compatibility. #[default] #[serde(other)] Unknown, } -/// Probe outcome variant discriminator. +/// Where a required value is applied when the planned server is launched +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum McpOauthProbeResultNoAuthRequiredStatus { - #[serde(rename = "no-auth-required")] +pub enum McpPlanValueCategory { + /// Set as an environment variable on the launched process. + #[serde(rename = "environment-variable")] + EnvironmentVariable, + /// Passed to the runtime that launches the package. + #[serde(rename = "runtime-argument")] + RuntimeArgument, + /// Passed to the packaged server itself. + #[serde(rename = "package-argument")] + PackageArgument, + /// Sent as a request header to a remote endpoint. + #[serde(rename = "header")] + Header, + /// Substituted into the remote endpoint URL. + #[serde(rename = "url-variable")] + UrlVariable, + /// Unknown variant for forward compatibility. #[default] - NoAuthRequired, + #[serde(other)] + Unknown, } -/// Probe outcome variant discriminator. +/// Discriminator for a scalar required value +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum McpOauthProbeResultAuthenticatedStatus { - #[serde(rename = "authenticated")] +pub enum McpPlanRequiredValueScalarKind { + /// The value uses one scalar type. + #[serde(rename = "scalar")] + Scalar, + /// Unknown variant for forward compatibility. #[default] - Authenticated, + #[serde(other)] + Unknown, } -/// Probe outcome variant discriminator. +/// Scalar type a required value must conform to +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum McpOauthProbeResultNeedsAuthStatus { - #[serde(rename = "needs-auth")] +pub enum McpPlanScalarValueType { + /// Free text. + #[serde(rename = "string")] + String, + /// A number. + #[serde(rename = "number")] + Number, + /// A boolean. + #[serde(rename = "boolean")] + Boolean, + /// A filesystem path. + #[serde(rename = "path")] + Path, + /// Unknown variant for forward compatibility. #[default] - NeedsAuth, + #[serde(other)] + Unknown, } -/// Probe outcome variant discriminator. +/// Discriminator for an enumerated required value +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum McpOauthProbeResultFailedStatus { - #[serde(rename = "failed")] +pub enum McpPlanRequiredValueEnumKind { + /// The value uses a fixed non-empty enumeration. + #[serde(rename = "enum")] + Enum, + /// Unknown variant for forward compatibility. #[default] - Failed, + #[serde(other)] + Unknown, } -/// 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. +/// 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. /// ///
/// @@ -28062,11 +30159,9 @@ pub enum McpOauthProbeResultFailedStatus { ///
#[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] -pub enum McpOauthProbeResult { - NoAuthRequired(McpOauthProbeResultNoAuthRequired), - Authenticated(McpOauthProbeResultAuthenticated), - NeedsAuth(McpOauthProbeResultNeedsAuth), - Failed(McpOauthProbeResultFailed), +pub enum McpPlanRequiredValue { + Scalar(McpPlanRequiredValueScalar), + Enum(McpPlanRequiredValueEnum), } /// 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. @@ -28962,9 +31057,9 @@ pub enum PermissionDecisionOutcome { /// #[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] pub enum PermissionDecisionSource { - /// The response followed the auto-approval judge recommendation. - #[serde(rename = "judge_recommendation")] - JudgeRecommendation, + /// The response followed the assisted-approval judge recommendation. + #[serde(rename = "assisted_approval")] + AssistedApproval, /// A human supplied the response through an interactive prompt. #[serde(rename = "human_response")] HumanResponse, @@ -29142,6 +31237,34 @@ pub enum PermissionLocationType { Unknown, } +/// Optional source for permission-mode telemetry. Defaults to `rpc` when omitted for SDK callers. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum PermissionModeSource { + /// The mode was set from a CLI command-line flag. + #[serde(rename = "cli_flag")] + CliFlag, + /// The mode was set by a slash command. + #[serde(rename = "slash_command")] + SlashCommand, + /// The mode was set by confirming autopilot behavior. + #[serde(rename = "autopilot_confirmation")] + AutopilotConfirmation, + /// The mode was set through an RPC caller. + #[serde(rename = "rpc")] + Rpc, + /// Unknown variant for forward compatibility. + #[default] + #[serde(other)] + Unknown, +} + /// Allowed values for the `PermissionsConfigureAdditionalContentExclusionPolicyScope` enumeration. /// ///
@@ -29186,34 +31309,6 @@ pub enum PermissionsModifyRulesScope { Unknown, } -/// Optional source for allow-all telemetry. Defaults to `rpc` when omitted for SDK callers. -/// -///
-/// -/// **Experimental.** This type is part of an experimental wire-protocol surface -/// and may change or be removed in future SDK or CLI releases. -/// -///
-#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum PermissionsSetAllowAllSource { - /// Allow-all was enabled from a CLI command-line flag. - #[serde(rename = "cli_flag")] - CliFlag, - /// Allow-all was enabled by a slash command. - #[serde(rename = "slash_command")] - SlashCommand, - /// Allow-all was enabled by confirming autopilot behavior. - #[serde(rename = "autopilot_confirmation")] - AutopilotConfirmation, - /// Allow-all was enabled through an RPC caller. - #[serde(rename = "rpc")] - Rpc, - /// Unknown variant for forward compatibility. - #[default] - #[serde(other)] - Unknown, -} - /// Optional source for allow-all telemetry. Defaults to `rpc` when omitted for SDK callers. /// ///
diff --git a/rust/src/generated/rpc.rs b/rust/src/generated/rpc.rs index 06e9a8fb7c..1e3d559baa 100644 --- a/rust/src/generated/rpc.rs +++ b/rust/src/generated/rpc.rs @@ -43,6 +43,13 @@ impl<'a> ClientRpc<'a> { } } + /// `catalog.*` sub-namespace. + pub fn catalog(&self) -> ClientRpcCatalog<'a> { + ClientRpcCatalog { + client: self.client, + } + } + /// `commands.*` sub-namespace. pub fn commands(&self) -> ClientRpcCommands<'a> { ClientRpcCommands { @@ -501,6 +508,42 @@ impl<'a> ClientRpcAgents<'a> { } } +/// `catalog.*` RPCs. +#[derive(Clone, Copy)] +pub struct ClientRpcCatalog<'a> { + pub(crate) client: &'a Client, +} + +impl<'a> ClientRpcCatalog<'a> { + /// Requests a bounded catalog search. This host-implemented server method is available through SDK/TUI hosts; standalone and C-ABI runtimes whose host does not implement server-method dispatch return JSON-RPC MethodNotFound. A runtime with search available returns inert candidate summaries, each with an opaque single-use handle scoped to this runtime instance; a runtime without it returns the typed search-unavailable result. Public authorities may be searched anonymously, while an authority that requires credentials yields the typed authentication-required result. All returned text, URLs, and package metadata are untrusted external data and can never trigger instructions, tools, or installation. Read-only: nothing is installed, configured, or persisted. + /// + /// Wire method: `catalog.search`. + /// + /// # Parameters + /// + /// * `params` - 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. + /// + /// # Returns + /// + /// Outcome of a catalog.search call: either bounded inert candidates, or one typed refusal. Never a partial success. + /// + ///
+ /// + /// **Experimental.** This API is part of an experimental wire-protocol surface + /// and may change or be removed in future SDK or CLI releases. Pin both the + /// SDK and CLI versions if your code depends on it. + /// + ///
+ pub async fn search(&self, params: CatalogSearchRequest) -> Result { + let wire_params = serde_json::to_value(params)?; + let _value = self + .client + .call(rpc_methods::CATALOG_SEARCH, Some(wire_params)) + .await?; + Ok(serde_json::from_value(_value)?) + } +} + /// `commands.*` RPCs. #[derive(Clone, Copy)] pub struct ClientRpcCommands<'a> { @@ -859,6 +902,37 @@ impl<'a> ClientRpcMcp<'a> { .await?; Ok(serde_json::from_value(_value)?) } + + /// Requests a side-effect-free MCP install plan from a catalog candidate handle or a caller-supplied card. This host-implemented server method is available through SDK/TUI hosts; standalone and C-ABI runtimes whose host does not implement server-method dispatch return JSON-RPC MethodNotFound. A runtime with planning available returns a normalised plan and opaque single-use plan handle; a runtime without it returns the typed planning-unavailable result. A completed plan reports resource identity, provenance, eligible transport choices, the user-scope target, required typed values and secret placeholders, the policy result, the configuration changes installing would make, and whether a reload would be needed. Planning never writes configuration, stores a secret, or reloads MCP servers, so abandoning a plan needs no call and leaves nothing behind. + /// + /// Wire method: `mcp.planInstall`. + /// + /// # Parameters + /// + /// * `params` - A side-effect-free request for an MCP install plan. Computing a plan never writes configuration, stores a secret, or reloads MCP servers. + /// + /// # Returns + /// + /// Outcome of an mcp.planInstall call: either a normalised plan, or one typed refusal. Nothing is written in either case. + /// + ///
+ /// + /// **Experimental.** This API is part of an experimental wire-protocol surface + /// and may change or be removed in future SDK or CLI releases. Pin both the + /// SDK and CLI versions if your code depends on it. + /// + ///
+ pub async fn plan_install( + &self, + params: McpPlanInstallRequest, + ) -> Result { + let wire_params = serde_json::to_value(params)?; + let _value = self + .client + .call(rpc_methods::MCP_PLANINSTALL, Some(wire_params)) + .await?; + Ok(serde_json::from_value(_value)?) + } } /// `mcp.config.*` RPCs. @@ -5921,6 +5995,36 @@ impl<'a> SessionRpcMcp<'a> { Ok(()) } + /// Releases any turns waiting on an in-flight MCP load without cancelling the load, letting the agent proceed while MCP servers finish connecting in the background. No-op when no MCP load is in flight or waiting turns were already released. + /// + /// Wire method: `session.mcp.moveLoadingToBackground`. + /// + /// # Returns + /// + /// Result of moving in-flight MCP loading to the background. + /// + ///
+ /// + /// **Experimental.** This API is part of an experimental wire-protocol surface + /// and may change or be removed in future SDK or CLI releases. Pin both the + /// SDK and CLI versions if your code depends on it. + /// + ///
+ pub async fn move_loading_to_background( + &self, + ) -> Result { + let wire_params = serde_json::json!({ "sessionId": self.session.id() }); + let _value = self + .session + .client() + .call( + rpc_methods::SESSION_MCP_MOVELOADINGTOBACKGROUND, + Some(wire_params), + ) + .await?; + Ok(serde_json::from_value(_value)?) + } + /// Reloads MCP server connections for the session with an explicit host-provided configuration. /// /// Wire method: `session.mcp.reloadWithConfig`. @@ -7667,17 +7771,17 @@ impl<'a> SessionRpcPermissions<'a> { Ok(serde_json::from_value(_value)?) } - /// Sets the allow-all permission mode for the session. Used by attach-mode clients (e.g. LocalRpcSession's `/allow-all` forwarder) to flip the target session's permission state. The `on` mode swaps in unrestricted path and URL managers and emits `session.permissions_changed` on transition; the `auto` mode keeps normal prompt paths active while attaching LLM safety recommendations. The result returns the authoritative post-mutation state so callers can update their local mirrors without racing the `session.permissions_changed` notification on the same wire. + /// Sets the permission mode for the session. `manual` follows the normal approval flow, `assisted` attaches LLM safety recommendations, and `allow-all` automatically approves permission requests. The result returns the authoritative post-mutation mode so callers can update local state without racing the `session.permissions_changed` notification. /// - /// Wire method: `session.permissions.setAllowAll`. + /// Wire method: `session.permissions.setMode`. /// /// # Parameters /// - /// * `params` - Allow-all mode to apply for the session. + /// * `params` - Permission mode to apply for the session. /// /// # Returns /// - /// Indicates whether the operation succeeded and reports the post-mutation state. + /// Indicates whether the requested permission mode was applied and reports the authoritative post-mutation mode. /// ///
/// @@ -7686,30 +7790,27 @@ impl<'a> SessionRpcPermissions<'a> { /// SDK and CLI versions if your code depends on it. /// ///
- pub async fn set_allow_all( + pub async fn set_mode( &self, - params: PermissionsSetAllowAllRequest, - ) -> Result { + params: PermissionsSetModeRequest, + ) -> Result { let mut wire_params = serde_json::to_value(params)?; wire_params["sessionId"] = serde_json::Value::String(self.session.id().to_string()); let _value = self .session .client() - .call( - rpc_methods::SESSION_PERMISSIONS_SETALLOWALL, - Some(wire_params), - ) + .call(rpc_methods::SESSION_PERMISSIONS_SETMODE, Some(wire_params)) .await?; Ok(serde_json::from_value(_value)?) } - /// Returns the current allow-all permission mode for the session. + /// Returns the current permission mode for the session. /// - /// Wire method: `session.permissions.getAllowAll`. + /// Wire method: `session.permissions.getMode`. /// /// # Returns /// - /// Current allow-all permission mode. + /// Current permission mode. /// ///
/// @@ -7718,15 +7819,12 @@ impl<'a> SessionRpcPermissions<'a> { /// SDK and CLI versions if your code depends on it. /// ///
- pub async fn get_allow_all(&self) -> Result { + pub async fn get_mode(&self) -> Result { let wire_params = serde_json::json!({ "sessionId": self.session.id() }); let _value = self .session .client() - .call( - rpc_methods::SESSION_PERMISSIONS_GETALLOWALL, - Some(wire_params), - ) + .call(rpc_methods::SESSION_PERMISSIONS_GETMODE, Some(wire_params)) .await?; Ok(serde_json::from_value(_value)?) } diff --git a/rust/src/generated/session_events.rs b/rust/src/generated/session_events.rs index f7c7261eb5..1a7ca36cbd 100644 --- a/rust/src/generated/session_events.rs +++ b/rust/src/generated/session_events.rs @@ -41,6 +41,13 @@ pub enum SessionEventType { SessionModeChanged, #[serde(rename = "session.session_limits_changed")] SessionSessionLimitsChanged, + /// + ///
+ /// + /// **Experimental.** This type is part of an experimental wire-protocol surface + /// and may change or be removed in future SDK or CLI releases. + /// + ///
#[serde(rename = "session.permissions_changed")] SessionPermissionsChanged, #[serde(rename = "session.plan_changed")] @@ -393,6 +400,13 @@ pub enum SessionEventData { SessionModeChanged(SessionModeChangedData), #[serde(rename = "session.session_limits_changed")] SessionSessionLimitsChanged(SessionSessionLimitsChangedData), + /// + ///
+ /// + /// **Experimental.** This type is part of an experimental wire-protocol surface + /// and may change or be removed in future SDK or CLI releases. + /// + ///
#[serde(rename = "session.permissions_changed")] SessionPermissionsChanged(SessionPermissionsChangedData), #[serde(rename = "session.plan_changed")] @@ -1086,11 +1100,18 @@ pub struct SessionSessionLimitsChangedData { pub session_limits: Option, } -/// Session event "session.permissions_changed". Permissions change details carrying the aggregate allow-all transition. +/// Session event "session.permissions_changed". Permission-mode transition details. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct SessionPermissionsChangedData { - /// Allow-all mode after the change + /// Explicit LLM judge model override used by assisted mode; omitted when the provider default applies /// ///
/// @@ -1099,10 +1120,8 @@ pub struct SessionPermissionsChangedData { /// ///
#[serde(skip_serializing_if = "Option::is_none")] - pub allow_all_permission_mode: Option, - /// Aggregate allow-all flag after the change - pub allow_all_permissions: bool, - /// Allow-all mode before the change + pub assisted_approval_model: Option, + /// Permission mode after the change /// ///
/// @@ -1110,10 +1129,16 @@ pub struct SessionPermissionsChangedData { /// and may change or be removed in future SDK or CLI releases. /// ///
- #[serde(skip_serializing_if = "Option::is_none")] - pub previous_allow_all_permission_mode: Option, - /// Aggregate allow-all flag before the change - pub previous_allow_all_permissions: bool, + pub mode: PermissionMode, + /// Permission mode before the change + /// + ///
+ /// + /// **Experimental.** This type is part of an experimental wire-protocol surface + /// and may change or be removed in future SDK or CLI releases. + /// + ///
+ pub previous_mode: PermissionMode, } /// Session event "session.plan_changed". Plan file operation details indicating what changed @@ -3587,7 +3612,7 @@ pub struct PermissionRequestUrl { pub url: String, } -/// Auto-approval judge information attached to a permission request. Present (non-null) only when the session's allow-all mode is "auto"; its absence means auto mode was off and the judge did not evaluate the request. The `recommendation` conveys the judge's disposition for this request. +/// Assisted-approval judge information attached to a permission request. Present only in assisted mode; its absence means the judge did not evaluate the request. The `recommendation` conveys the judge's disposition for this request. /// ///
/// @@ -3597,18 +3622,18 @@ pub struct PermissionRequestUrl { ///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct PermissionAutoApproval { +pub struct PermissionAssistedApproval { /// Classified cause of an `error` recommendation. Absent for every other recommendation. #[serde(skip_serializing_if = "Option::is_none")] - pub failure_reason: Option, + pub failure_reason: Option, /// Model id that produced the recommendation, when the judge was consulted and reported one. Absent for `excluded` (the judge was not consulted) and for failures that occurred before a model was selected. #[serde(skip_serializing_if = "Option::is_none")] pub model: Option, /// Human-readable reason for the judge's recommendation, when available. #[serde(skip_serializing_if = "Option::is_none")] pub reason: Option, - /// The auto-approval safety judge's outcome for this request. - pub recommendation: AutoApprovalRecommendation, + /// The assisted-approval safety judge's outcome for this request. + pub recommendation: AssistedApprovalRecommendation, } /// Memory operation permission request @@ -3618,9 +3643,16 @@ pub struct PermissionRequestMemory { /// Whether this is a store or vote memory operation #[serde(skip_serializing_if = "Option::is_none")] pub action: Option, - /// Auto-approval judge information for this request; present only when auto mode is enabled. + /// Assisted-approval judge information for this request; present only in assisted mode. + /// + ///
+ /// + /// **Experimental.** This type is part of an experimental wire-protocol surface + /// and may change or be removed in future SDK or CLI releases. + /// + ///
#[serde(skip_serializing_if = "Option::is_none")] - pub auto_approval: Option, + pub assisted_approval: Option, /// Source references for the stored fact (store only) #[serde(skip_serializing_if = "Option::is_none")] pub citations: Option, @@ -3817,7 +3849,7 @@ pub struct PermissionRequestExtensionEnvAccess { #[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct PermissionPromptRequestCommands { - /// Auto-approval judge information for this request; present only when auto mode is enabled. + /// Assisted-approval judge information for this request; present only in assisted mode. /// ///
/// @@ -3826,7 +3858,7 @@ pub struct PermissionPromptRequestCommands { /// ///
#[serde(skip_serializing_if = "Option::is_none")] - pub auto_approval: Option, + pub assisted_approval: Option, /// Whether the UI can offer session-wide approval for this command pattern pub can_offer_session_approval: bool, /// Command identifiers covered by this approval prompt @@ -3852,7 +3884,7 @@ pub struct PermissionPromptRequestCommands { #[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct PermissionPromptRequestWrite { - /// Auto-approval judge information for this request; present only when auto mode is enabled. + /// Assisted-approval judge information for this request; present only in assisted mode. /// ///
/// @@ -3861,7 +3893,7 @@ pub struct PermissionPromptRequestWrite { /// ///
#[serde(skip_serializing_if = "Option::is_none")] - pub auto_approval: Option, + pub assisted_approval: Option, /// Whether the UI can offer session-wide approval for file write operations pub can_offer_session_approval: bool, /// Unified diff showing the proposed changes @@ -3887,7 +3919,7 @@ pub struct PermissionPromptRequestWrite { #[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct PermissionPromptRequestRead { - /// Auto-approval judge information for this request; present only when auto mode is enabled. + /// Assisted-approval judge information for this request; present only in assisted mode. /// ///
/// @@ -3896,7 +3928,7 @@ pub struct PermissionPromptRequestRead { /// ///
#[serde(skip_serializing_if = "Option::is_none")] - pub auto_approval: Option, + pub assisted_approval: Option, /// Human-readable description of why the file is being read pub intention: String, /// Prompt kind discriminator @@ -3918,7 +3950,7 @@ pub struct PermissionPromptRequestMcp { /// Arguments to pass to the MCP tool #[serde(skip_serializing_if = "Option::is_none")] pub args: Option, - /// Auto-approval judge information for this request; present only when auto mode is enabled. + /// Assisted-approval judge information for this request; present only in assisted mode. /// ///
/// @@ -3927,7 +3959,7 @@ pub struct PermissionPromptRequestMcp { /// ///
#[serde(skip_serializing_if = "Option::is_none")] - pub auto_approval: Option, + pub assisted_approval: Option, /// Prompt kind discriminator pub kind: PermissionPromptRequestMcpKind, /// Advisory runtime permission recommendation. The host remains responsible for deciding the request and may reject it. @@ -3955,7 +3987,7 @@ pub struct PermissionPromptRequestMcp { #[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct PermissionPromptRequestUrl { - /// Auto-approval judge information for this request; present only when auto mode is enabled. + /// Assisted-approval judge information for this request; present only in assisted mode. /// ///
/// @@ -3964,7 +3996,7 @@ pub struct PermissionPromptRequestUrl { /// ///
#[serde(skip_serializing_if = "Option::is_none")] - pub auto_approval: Option, + pub assisted_approval: Option, /// Human-readable description of why the URL is being accessed pub intention: String, /// Prompt kind discriminator @@ -3995,7 +4027,7 @@ pub struct PermissionPromptRequestMemory { /// Whether this is a store or vote memory operation #[serde(skip_serializing_if = "Option::is_none")] pub action: Option, - /// Auto-approval judge information for this request; present only when auto mode is enabled. + /// Assisted-approval judge information for this request; present only in assisted mode. /// ///
/// @@ -4004,7 +4036,7 @@ pub struct PermissionPromptRequestMemory { /// ///
#[serde(skip_serializing_if = "Option::is_none")] - pub auto_approval: Option, + pub assisted_approval: Option, /// Source references for the stored fact (store only) #[serde(skip_serializing_if = "Option::is_none")] pub citations: Option, @@ -4033,7 +4065,7 @@ pub struct PermissionPromptRequestCustomTool { /// Arguments to pass to the custom tool #[serde(skip_serializing_if = "Option::is_none")] pub args: Option, - /// Auto-approval judge information for this request; present only when auto mode is enabled. + /// Assisted-approval judge information for this request; present only in assisted mode. /// ///
/// @@ -4042,7 +4074,7 @@ pub struct PermissionPromptRequestCustomTool { /// ///
#[serde(skip_serializing_if = "Option::is_none")] - pub auto_approval: Option, + pub assisted_approval: Option, /// Prompt kind discriminator pub kind: PermissionPromptRequestCustomToolKind, /// Tool call ID that triggered this permission request @@ -4060,7 +4092,7 @@ pub struct PermissionPromptRequestCustomTool { pub struct PermissionPromptRequestPath { /// Underlying permission kind that needs path approval pub access_kind: PermissionPromptRequestPathAccessKind, - /// Auto-approval judge information for this request; present only when auto mode is enabled. + /// Assisted-approval judge information for this request; present only in assisted mode. /// ///
/// @@ -4069,7 +4101,7 @@ pub struct PermissionPromptRequestPath { /// ///
#[serde(skip_serializing_if = "Option::is_none")] - pub auto_approval: Option, + pub assisted_approval: Option, /// Prompt kind discriminator pub kind: PermissionPromptRequestPathKind, /// File paths that require explicit approval @@ -4083,7 +4115,7 @@ pub struct PermissionPromptRequestPath { #[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct PermissionPromptRequestHook { - /// Auto-approval judge information for this request; present only when auto mode is enabled. + /// Assisted-approval judge information for this request; present only in assisted mode. /// ///
/// @@ -4092,7 +4124,7 @@ pub struct PermissionPromptRequestHook { /// ///
#[serde(skip_serializing_if = "Option::is_none")] - pub auto_approval: Option, + pub assisted_approval: Option, /// Optional message from the hook explaining why confirmation is needed #[serde(skip_serializing_if = "Option::is_none")] pub hook_message: Option, @@ -4112,7 +4144,7 @@ pub struct PermissionPromptRequestHook { #[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct PermissionPromptRequestExtensionManagement { - /// Auto-approval judge information for this request; present only when auto mode is enabled. + /// Assisted-approval judge information for this request; present only in assisted mode. /// ///
/// @@ -4121,7 +4153,7 @@ pub struct PermissionPromptRequestExtensionManagement { /// ///
#[serde(skip_serializing_if = "Option::is_none")] - pub auto_approval: Option, + pub assisted_approval: Option, /// Name of the extension being managed #[serde(skip_serializing_if = "Option::is_none")] pub extension_name: Option, @@ -4140,7 +4172,7 @@ pub struct PermissionPromptRequestExtensionManagement { pub struct PermissionPromptRequestFactory { /// Canonical key used for scoped factory approvals pub approval_key: String, - /// Auto-approval judge information for this request; present only when auto mode is enabled. + /// Assisted-approval judge information for this request; present only in assisted mode. /// ///
/// @@ -4149,7 +4181,7 @@ pub struct PermissionPromptRequestFactory { /// ///
#[serde(skip_serializing_if = "Option::is_none")] - pub auto_approval: Option, + pub assisted_approval: Option, /// Whether this factory is eligible for persistent approval pub can_persist_approval: bool, /// Factory-declared AI-credit limit before any run/resume caller override is applied. @@ -4198,7 +4230,7 @@ pub struct PermissionPromptRequestFactory { #[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct PermissionPromptRequestExtensionPermissionAccess { - /// Auto-approval judge information for this request; present only when auto mode is enabled. + /// Assisted-approval judge information for this request; present only in assisted mode. /// ///
/// @@ -4207,7 +4239,7 @@ pub struct PermissionPromptRequestExtensionPermissionAccess { /// ///
#[serde(skip_serializing_if = "Option::is_none")] - pub auto_approval: Option, + pub assisted_approval: Option, /// Capabilities the extension is requesting pub capabilities: Vec, /// Name of the extension requesting permission access @@ -4223,7 +4255,7 @@ pub struct PermissionPromptRequestExtensionPermissionAccess { #[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct PermissionPromptRequestExtensionEnvAccess { - /// Auto-approval judge information for this request; present only when auto mode is enabled. + /// Assisted-approval judge information for this request; present only in assisted mode. /// ///
/// @@ -4232,7 +4264,7 @@ pub struct PermissionPromptRequestExtensionEnvAccess { /// ///
#[serde(skip_serializing_if = "Option::is_none")] - pub auto_approval: Option, + pub assisted_approval: Option, /// Names of the sensitive environment variables the extension is requesting. Values never appear here. pub environment_variables: Vec, /// Name of the extension requesting environment variable access @@ -5750,7 +5782,7 @@ pub enum SessionMode { Unknown, } -/// Allow-all mode for the session. +/// Permission mode for the session. /// ///
/// @@ -5759,16 +5791,16 @@ pub enum SessionMode { /// ///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum PermissionAllowAllMode { +pub enum PermissionMode { /// Permission requests follow the normal approval flow. - #[serde(rename = "off")] - Off, + #[serde(rename = "manual")] + Manual, + /// Permission requests include an LLM safety recommendation; clients may automatically approve requests judged acceptable. + #[serde(rename = "assisted")] + Assisted, /// Tool, path, and URL permission requests are automatically approved. - #[serde(rename = "on")] - On, - /// Permission requests follow the normal approval flow with an LLM advisory recommendation attached; clients may choose to auto-approve requests the judge evaluated as acceptable. - #[serde(rename = "auto")] - Auto, + #[serde(rename = "allow-all")] + AllowAll, /// Unknown variant for forward compatibility. #[default] #[serde(other)] @@ -6435,7 +6467,7 @@ pub enum PermissionRequestMemoryAction { Unknown, } -/// Why the auto-approval judge produced no usable recommendation. Present only alongside an `error` recommendation, where the human-readable reason is a fixed string and therefore cannot distinguish these cases. Intended to make a judge failure reportable by a consumer that has no access to the host's logs. +/// Why the assisted-approval judge produced no usable recommendation. Present only alongside an `error` recommendation, where the human-readable reason is a fixed string and therefore cannot distinguish these cases. Intended to make a judge failure reportable by a consumer that has no access to the host's logs. /// ///
/// @@ -6444,7 +6476,7 @@ pub enum PermissionRequestMemoryAction { /// ///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum AutoApprovalJudgeFailureReason { +pub enum AssistedApprovalJudgeFailureReason { /// The judge model call exceeded its deadline. #[serde(rename = "timeout")] Timeout, @@ -6466,7 +6498,7 @@ pub enum AutoApprovalJudgeFailureReason { Unknown, } -/// Outcome of the auto-approval safety judge for a permission request. Present only when auto mode is enabled; its absence means the judge did not evaluate the request (auto mode was off). +/// Outcome of the assisted-approval safety judge for a permission request. Present only in assisted mode; its absence means the judge did not evaluate the request. /// ///
/// @@ -6475,14 +6507,14 @@ pub enum AutoApprovalJudgeFailureReason { /// ///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum AutoApprovalRecommendation { +pub enum AssistedApprovalRecommendation { /// The judge evaluated the request and recommends automatically approving it. #[serde(rename = "approve")] Approve, - /// The judge evaluated the request and does not recommend auto-approving it; explicit approval is required. Whether that means prompting, denying, or something else is the consumer's decision. + /// The judge evaluated the request and does not recommend automatically approving it; explicit approval is required. Whether that means prompting, denying, or something else is the consumer's decision. #[serde(rename = "requireApproval")] RequireApproval, - /// Auto mode is enabled, but this request category is never auto-approvable (for example, sandbox-bypass requests), so the judge was not consulted. + /// Assisted mode is enabled, but this request category is never automatically approvable (for example, sandbox-bypass requests), so the judge was not consulted. #[serde(rename = "excluded")] Excluded, /// The judge was consulted but did not return a usable recommendation, so the request requires explicit approval. @@ -7187,15 +7219,15 @@ pub enum ManagedSettingsEnforcedAction { /// For a `bypass_permissions_blocked` action, which permission-escalation primitive was refused #[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] pub enum ManagedSettingsEnforcedEscalation { - /// Full allow-all ("/allow-all on") permissions — auto-approving tools, paths, and URLs. + /// Full allow-all permissions — automatically approving tools, paths, and URLs. #[serde(rename = "allow_all")] AllowAll, - /// Auto-approval of all tool permission requests. + /// Automatic approval of all tool permission requests. #[serde(rename = "approve_all")] ApproveAll, - /// Advisory auto-approval ("/allow-all auto") mode — keeps normal prompt paths and adds LLM-advised approval, distinct from full allow-all. - #[serde(rename = "auto_approval")] - AutoApproval, + /// Assisted mode — keeps normal prompt paths and adds an LLM recommendation, distinct from allow-all. + #[serde(rename = "assisted_approval")] + AssistedApproval, /// Unrestricted filesystem access outside the session's allowed directories. #[serde(rename = "unrestricted_paths")] UnrestrictedPaths, diff --git a/rust/src/session.rs b/rust/src/session.rs index dff7b4c457..2505a2377d 100644 --- a/rust/src/session.rs +++ b/rust/src/session.rs @@ -2612,7 +2612,7 @@ mod tests { fn attribution_context() -> PermissionDecisionContext { PermissionDecisionContext { outcome: PermissionDecisionOutcome::AutoApproved, - source: PermissionDecisionSource::JudgeRecommendation, + source: PermissionDecisionSource::AssistedApproval, surface: PermissionDecisionSurface::CopilotApp, } } @@ -2667,7 +2667,7 @@ mod tests { "result": { "kind": "approve-once" }, "decisionContext": { "outcome": "auto_approved", - "source": "judge_recommendation", + "source": "assisted_approval", "surface": "copilot_app", }, }) diff --git a/rust/tests/e2e/rpc_mcp_and_skills.rs b/rust/tests/e2e/rpc_mcp_and_skills.rs index d5a295e073..8cf3efd998 100644 --- a/rust/tests/e2e/rpc_mcp_and_skills.rs +++ b/rust/tests/e2e/rpc_mcp_and_skills.rs @@ -9,9 +9,9 @@ use github_copilot_sdk::rpc::{ McpAppsSetHostContextRequest, McpCancelSamplingExecutionParams, McpDisableRequest, McpEnableRequest, McpExecuteSamplingParams, McpExecuteSamplingRequest, McpOauthLoginRequest, McpResourcesReadRequest, McpSamplingExecutionAction, McpSetEnvValueModeDetails, - McpSetEnvValueModeParams, PermissionsAllowAllMode, PermissionsSetAllowAllRequest, - SkillsDisableRequest, SkillsEnableRequest, + McpSetEnvValueModeParams, PermissionsSetModeRequest, SkillsDisableRequest, SkillsEnableRequest, }; +use github_copilot_sdk::session_events::PermissionMode; use github_copilot_sdk::{IndexMap, McpServerConfig, McpStdioServerConfig}; #[tokio::test] @@ -361,10 +361,9 @@ async fn should_list_extensions() { session .rpc() .permissions() - .set_allow_all(PermissionsSetAllowAllRequest { - enabled: None, - mode: Some(PermissionsAllowAllMode::On), - model: None, + .set_mode(PermissionsSetModeRequest { + assisted_approval_model: None, + mode: PermissionMode::AllowAll, source: None, }) .await @@ -715,10 +714,9 @@ async fn should_report_error_when_extensions_are_not_available() { session .rpc() .permissions() - .set_allow_all(PermissionsSetAllowAllRequest { - enabled: None, - mode: Some(PermissionsAllowAllMode::On), - model: None, + .set_mode(PermissionsSetModeRequest { + assisted_approval_model: None, + mode: PermissionMode::AllowAll, source: None, }) .await diff --git a/rust/tests/e2e/rpc_session_state_extras.rs b/rust/tests/e2e/rpc_session_state_extras.rs index 16d276e03f..81901d06ae 100644 --- a/rust/tests/e2e/rpc_session_state_extras.rs +++ b/rust/tests/e2e/rpc_session_state_extras.rs @@ -3,11 +3,12 @@ use std::collections::HashMap; use github_copilot_sdk::Client; use github_copilot_sdk::rpc::{ CompletionsRequestRequest, MetadataContextHeaviestMessagesRequest, ModelSwitchToRequest, - NamedProviderConfig, PermissionsSetAllowAllRequest, ProviderAddRequest, ProviderConfigType, + NamedProviderConfig, PermissionsSetModeRequest, ProviderAddRequest, ProviderConfigType, ProviderConfigWireApi, ProviderModelConfig, SessionVisibilityStatus, SubagentSettingsEntry, SubagentSettingsEntryContextTier, UpdateSubagentSettingsRequest, UpdateSubagentSettingsRequestSubagents, VisibilitySetRequest, }; +use github_copilot_sdk::session_events::PermissionMode; use super::support::{assistant_message_content, with_e2e_context}; @@ -103,55 +104,55 @@ async fn should_get_and_set_allowall_permissions() { let initial = session .rpc() .permissions() - .get_allow_all() + .get_mode() .await - .expect("get initial allow-all"); - assert!(!initial.enabled); + .expect("get initial permission mode"); + assert_eq!(initial.mode, PermissionMode::Manual); let enable = session .rpc() .permissions() - .set_allow_all(PermissionsSetAllowAllRequest { - enabled: Some(true), - mode: None, - model: None, + .set_mode(PermissionsSetModeRequest { + assisted_approval_model: None, + mode: PermissionMode::AllowAll, source: None, }) .await - .expect("enable allow-all"); + .expect("set allow-all mode"); assert!(enable.success); - assert!(enable.enabled); - assert!( + assert_eq!(enable.mode, PermissionMode::AllowAll); + assert_eq!( session .rpc() .permissions() - .get_allow_all() + .get_mode() .await - .expect("get enabled allow-all") - .enabled + .expect("get allow-all mode") + .mode, + PermissionMode::AllowAll ); let disable = session .rpc() .permissions() - .set_allow_all(PermissionsSetAllowAllRequest { - enabled: Some(false), - mode: None, - model: None, + .set_mode(PermissionsSetModeRequest { + assisted_approval_model: None, + mode: PermissionMode::Manual, source: None, }) .await - .expect("disable allow-all"); + .expect("set manual mode"); assert!(disable.success); - assert!(!disable.enabled); - assert!( - !session + assert_eq!(disable.mode, PermissionMode::Manual); + assert_eq!( + session .rpc() .permissions() - .get_allow_all() + .get_mode() .await - .expect("get disabled allow-all") - .enabled + .expect("get manual mode") + .mode, + PermissionMode::Manual ); session.disconnect().await.expect("disconnect session"); diff --git a/rust/tests/e2e/rpc_ui_ephemeral_query.rs b/rust/tests/e2e/rpc_ui_ephemeral_query.rs index 98199520d0..90cffae36c 100644 --- a/rust/tests/e2e/rpc_ui_ephemeral_query.rs +++ b/rust/tests/e2e/rpc_ui_ephemeral_query.rs @@ -1,9 +1,9 @@ use github_copilot_sdk::rpc::UIEphemeralQueryRequest; -// TODO(cli-1.0.81-2): CLI 1.0.81-2 fails session.ui.ephemeralQuery against the recorded -// snapshot ("Failed to get response from the AI model"). Re-enable once the runtime -// fix ships. -#[ignore = "blocked on CLI 1.0.81-2 session.ui.ephemeralQuery regression"] +// TODO(cli-1.0.81-2): CLI 1.0.81-4 still fails session.ui.ephemeralQuery against the +// recorded snapshot ("Failed to get response from the AI model"). Re-enable once the +// runtime fix ships. +#[ignore = "blocked on CLI 1.0.81-4 session.ui.ephemeralQuery regression"] #[tokio::test] async fn should_answer_ephemeral_query() { super::support::with_shared_e2e_context( diff --git a/scripts/codegen/go.ts b/scripts/codegen/go.ts index a0c81b870e..acdea09727 100644 --- a/scripts/codegen/go.ts +++ b/scripts/codegen/go.ts @@ -560,6 +560,7 @@ interface GoCodegenCtx { discriminatedUnionRawVariantSuffix?: string; skipDefinitionTypeNames?: Set; encodingBlocks?: Set; + unionVariantMarshalers?: Set; packageName?: string; } @@ -1975,18 +1976,22 @@ function emitGoFlatDiscriminatedUnion( lines.push(`\treturn ${discGoType}(r.Discriminator)`); } lines.push(`}`); - pushGoEncodingBlock([ - `func (r ${variantTypeName}) MarshalJSON() ([]byte, error) {`, - `\ttype alias ${variantTypeName}`, - `\treturn json.Marshal(struct {`, - `\t\t${discGoName} ${discGoType} \`json:"${discriminatorProp}"\``, - `\t\talias`, - `\t}{`, - `\t\t${discGoName}: r.${discriminatorMethodName}(),`, - `\t\talias: alias(r),`, - `\t})`, - `}`, - ], ctx); + ctx.unionVariantMarshalers ??= new Set(); + if (!ctx.unionVariantMarshalers.has(variantTypeName)) { + ctx.unionVariantMarshalers.add(variantTypeName); + pushGoEncodingBlock([ + `func (r ${variantTypeName}) MarshalJSON() ([]byte, error) {`, + `\ttype alias ${variantTypeName}`, + `\treturn json.Marshal(struct {`, + `\t\t${discGoName} ${discGoType} \`json:"${discriminatorProp}"\``, + `\t\talias`, + `\t}{`, + `\t\t${discGoName}: r.${discriminatorMethodName}(),`, + `\t\talias: alias(r),`, + `\t})`, + `}`, + ], ctx); + } } ctx.structs.push(lines.join("\n")); diff --git a/test/harness/package-lock.json b/test/harness/package-lock.json index 01cf297589..76ae782aa9 100644 --- a/test/harness/package-lock.json +++ b/test/harness/package-lock.json @@ -9,7 +9,7 @@ "version": "1.0.0", "license": "ISC", "devDependencies": { - "@github/copilot": "^1.0.81-2", + "@github/copilot": "^1.0.81-4", "@modelcontextprotocol/sdk": "^1.26.0", "@types/node": "^25.3.3", "@types/node-forge": "^1.3.14", @@ -472,8 +472,8 @@ } }, "node_modules/@github/copilot": { - "version": "1.0.81-2", - "integrity": "sha512-FeeCKM0Pcm1mwC6uJQ/nkI5Bc33xe10dn3rtvYl3+ZzyKtAS7I8IeGvGrA773bsAgiHiyfj+KEQQlqKsBCgtPQ==", + "version": "1.0.81-4", + "integrity": "sha512-XSHSlWqDhoajHMjRouZv0gqPfG3MVJvLFCoWToT8/fbQ7rmE9rB4w0sefzmh30CrQANCWd+uiIUOe9H3QL32WA==", "dev": true, "license": "SEE LICENSE IN LICENSE.md", "dependencies": { @@ -483,19 +483,19 @@ "copilot": "npm-loader.js" }, "optionalDependencies": { - "@github/copilot-darwin-arm64": "1.0.81-2", - "@github/copilot-darwin-x64": "1.0.81-2", - "@github/copilot-linux-arm64": "1.0.81-2", - "@github/copilot-linux-x64": "1.0.81-2", - "@github/copilot-linuxmusl-arm64": "1.0.81-2", - "@github/copilot-linuxmusl-x64": "1.0.81-2", - "@github/copilot-win32-arm64": "1.0.81-2", - "@github/copilot-win32-x64": "1.0.81-2" + "@github/copilot-darwin-arm64": "1.0.81-4", + "@github/copilot-darwin-x64": "1.0.81-4", + "@github/copilot-linux-arm64": "1.0.81-4", + "@github/copilot-linux-x64": "1.0.81-4", + "@github/copilot-linuxmusl-arm64": "1.0.81-4", + "@github/copilot-linuxmusl-x64": "1.0.81-4", + "@github/copilot-win32-arm64": "1.0.81-4", + "@github/copilot-win32-x64": "1.0.81-4" } }, "node_modules/@github/copilot-darwin-arm64": { - "version": "1.0.81-2", - "integrity": "sha512-BS7LPiXvOYd8H4VoD7BCOJ/R+JGIO9JxFMYn/ICXGpL/405s8eX+QXj6GNtFIOAEXPWr0fBweIVi9ExrKMiimQ==", + "version": "1.0.81-4", + "integrity": "sha512-6XEOnrQdqdZ/tbhKU2D37tk0PGwKdNT5LGLvjjrWx+TDCFO/xZSu85+Rxl4AZP1SHKwWJRZdamDmETj4vn4VWQ==", "cpu": [ "arm64" ], @@ -510,8 +510,8 @@ } }, "node_modules/@github/copilot-darwin-x64": { - "version": "1.0.81-2", - "integrity": "sha512-geVSBY7KlT4je8Xct1DTiisWQmfvj2Mjf1kWim81bp9W4Z18MEsEGXFeHAeYE2ZSwhdfMZCJprDF66orrHJ92w==", + "version": "1.0.81-4", + "integrity": "sha512-o1ghvv7EUGO3CGbZyGyQJgu9mCFEyXq9FUUmvcxsBXxfjk7PR1CywK4cJVeZxac8LL//DQ/q42JzkaSfXU29Wg==", "cpu": [ "x64" ], @@ -526,8 +526,8 @@ } }, "node_modules/@github/copilot-linux-arm64": { - "version": "1.0.81-2", - "integrity": "sha512-uov9YOKlhyiaQfbgi6SzyAGjBLXegYRNJkgckG/7Xq/TbxF0Bmve3/lSuzve+p/EOnzPVwR1kGPDEuGU3g97Rw==", + "version": "1.0.81-4", + "integrity": "sha512-pHCwhBe+IVtliSxOEiwhS+GQXRvLuJxOQzdqAZYhbaEJKWeqWTw40LnhqaQFaGhOp1GAJF+6FodG/SfUZYAx5g==", "cpu": [ "arm64" ], @@ -542,8 +542,8 @@ } }, "node_modules/@github/copilot-linux-x64": { - "version": "1.0.81-2", - "integrity": "sha512-wsuXQDnMBdc0Q/hoO5+n+GaBPClzmgcxD2pVvM7i8JxgDAOm3NxHxGF9eYt1h5I+42/Y16t23n12PGARGupfAA==", + "version": "1.0.81-4", + "integrity": "sha512-icy4c4jfQzXNShlGptRiUPKpHUhGX9qBxc+118WBv3H68o38Pi//6UP/ZRq9PvcVrPwxbA9HkFASNwBiEzshdA==", "cpu": [ "x64" ], @@ -558,8 +558,8 @@ } }, "node_modules/@github/copilot-linuxmusl-arm64": { - "version": "1.0.81-2", - "integrity": "sha512-Wi0u31vhBqxajGqpjODhTEwzzqDnfS1mRhKJ/FflH5ieMKsS8YLVHiCUaZFNFZtN1FIFU0ixIQqgUXCvaBP+0Q==", + "version": "1.0.81-4", + "integrity": "sha512-k54g1q9Umz7eFGTpOqG5H1l1m2eNSs8jqFLuEpvGGdu7SU5g6Cz0aWq2VM27l+HcChyjp2dGenhQe/s7KxLSMw==", "cpu": [ "arm64" ], @@ -574,8 +574,8 @@ } }, "node_modules/@github/copilot-linuxmusl-x64": { - "version": "1.0.81-2", - "integrity": "sha512-wbb1+aM/jSTE3tDCqwiADe/aUqosGsPzQZIliG/CMsByT02nbwl0CMZGocnsYyDcoKragGmAHqHxgD6sWsJB1g==", + "version": "1.0.81-4", + "integrity": "sha512-ETjiiuMGDdO6ZdytQ3w8u7wvtkDQCLc0zSnZXXYWxnG4y9qLut8VHFoTJ+P07lBrHKXo7tZsJ6W0d1gOQTBnvw==", "cpu": [ "x64" ], @@ -590,8 +590,8 @@ } }, "node_modules/@github/copilot-win32-arm64": { - "version": "1.0.81-2", - "integrity": "sha512-gyONPnQf3Im0lTkC+1NW79P6p8A1F4Cs7dO3ruVBbtDG8SPFJXWNs4LkKIIN/laIa28xYQPraD+hdM/qLZ4E6w==", + "version": "1.0.81-4", + "integrity": "sha512-/Md1/LN56gORjyGwHXjZ6suY6om7NVL8+j9D/X/xb6Ar2acagyivL8Dm3tesgUMYLniLgn7dyEXPVYS/bqkpmQ==", "cpu": [ "arm64" ], @@ -606,8 +606,8 @@ } }, "node_modules/@github/copilot-win32-x64": { - "version": "1.0.81-2", - "integrity": "sha512-+EcwzwOmJvQ1t2HpDEe93hyMLzvQTUkINnfy/v7EIJu9i2i49m144DyHIafGPcwiEW+AzYpY+6aRqSnNwrGx7Q==", + "version": "1.0.81-4", + "integrity": "sha512-CrHbH0fRl2tlreKbDbm6+NmK/3HwMZR7BE86WTmYHJMXt3PcEWRtklU/fQuH0qjURtW4wX6PWrdmjcyVOkRJcA==", "cpu": [ "x64" ], diff --git a/test/harness/package.json b/test/harness/package.json index 80a9210cbd..0ece92de45 100644 --- a/test/harness/package.json +++ b/test/harness/package.json @@ -14,7 +14,7 @@ "node": "^20.19.0 || >=22.12.0" }, "devDependencies": { - "@github/copilot": "^1.0.81-2", + "@github/copilot": "^1.0.81-4", "@modelcontextprotocol/sdk": "^1.26.0", "@types/node": "^25.3.3", "@types/node-forge": "^1.3.14", diff --git a/test/harness/replayingCapiProxy.test.ts b/test/harness/replayingCapiProxy.test.ts index cb9aaccc96..59f8fc6f17 100644 --- a/test/harness/replayingCapiProxy.test.ts +++ b/test/harness/replayingCapiProxy.test.ts @@ -546,6 +546,48 @@ Always include PINEAPPLE_COCONUT_42. expect(toolMessage?.content).toBe("Tool 'report_intent' does not exist."); }); + test("normalizes aborted tool execution results", async () => { + const requestBody = JSON.stringify({ + messages: [ + { role: "user", content: "Run a slow analysis" }, + { + role: "assistant", + tool_calls: [ + { + id: "tc1", + type: "function", + function: { + name: "slow_analysis", + arguments: '{"value":"test_abort"}', + }, + }, + ], + }, + { + role: "tool", + tool_call_id: "tc1", + content: + 'Failed to execute `slow_analysis` tool with arguments: {"value":"test_abort"} due to error: Error: Session aborted', + }, + ], + }); + const responseBody = JSON.stringify({ + choices: [{ message: { role: "assistant", content: "Done" } }], + }); + + const outputPath = await createProxy([ + { url: "/chat/completions", requestBody, responseBody }, + ]); + + const result = await readYamlOutput(outputPath); + const toolMessage = result.conversations[0].messages.find( + (m) => m.role === "tool", + ); + expect(toolMessage?.content).toBe( + "The execution of this tool, or a previous tool was interrupted.", + ); + }); + test("normalizes background agent IDs and removes runtime advisories", async () => { const stableResult = "Agent started in background with agent_id: background-agent. You'll be notified when it completes. Tell the user you're waiting and end your response, or continue unrelated work until notified."; diff --git a/test/harness/replayingCapiProxy.ts b/test/harness/replayingCapiProxy.ts index 6ba45c3684..4ed8e06ccd 100644 --- a/test/harness/replayingCapiProxy.ts +++ b/test/harness/replayingCapiProxy.ts @@ -126,6 +126,7 @@ export class ReplayingCapiProxy extends CapturingHttpProxy { private startPromise: Promise | null = null; private defaultToolResultNormalizers: ToolResultNormalizer[] = [ { toolName: "*", normalizer: normalizeLargeOutputFilepaths }, + { toolName: "*", normalizer: normalizeInterruptedToolResult }, { toolName: "${shell}", normalizer: normalizeShellExitMarkers }, { toolName: "*", normalizer: normalizeGhAuthMessages }, { toolName: "*", normalizer: normalizeAvailableToolNames }, @@ -1429,6 +1430,7 @@ function normalizeStoredToolMessages(conversations: NormalizedConversation[]) { for (const conversation of conversations) { for (const message of conversation.messages) { if (message.role === "tool" && typeof message.content === "string") { + message.content = normalizeInterruptedToolResult(message.content); message.content = normalizeAvailableToolNames(message.content); message.content = normalizeBackgroundAgentStartMessage(message.content); message.content = normalizeReadAgentResult(message.content); @@ -1552,6 +1554,13 @@ function normalizeAvailableToolNames(result: string): string { ); } +function normalizeInterruptedToolResult(result: string): string { + return result.replace( + /^Failed to execute `[^`]+` tool(?: with arguments: [\s\S]*?)? due to error: (?:Error: )?Session aborted$/, + "The execution of this tool, or a previous tool was interrupted.", + ); +} + function normalizeBackgroundAgentStartMessage(result: string): string { return normalizeBackgroundAgentStartMessageWithId(result); }