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