diff --git a/dotnet/src/Generated/Rpc.cs b/dotnet/src/Generated/Rpc.cs index 3fac45256..f8e0f314c 100644 --- a/dotnet/src/Generated/Rpc.cs +++ b/dotnet/src/Generated/Rpc.cs @@ -2036,6 +2036,207 @@ internal sealed class SessionSetCredentialsParams public string SessionId { get; set; } = string.Empty; } +/// Canvas action that the agent or host can invoke. To discover the input schema for a particular action, call the list_canvas_capabilities tool. +[Experimental(Diagnostics.Experimental)] +public sealed class CanvasAction +{ + /// Description of the action. + [JsonPropertyName("description")] + public string? Description { get; set; } + + /// JSON Schema for the action input. + [JsonPropertyName("inputSchema")] + public JsonElement? InputSchema { get; set; } + + /// Action name exposed by the canvas provider. + [JsonPropertyName("name")] + public string Name { get; set; } = string.Empty; +} + +/// Canvas available in the current session. +[Experimental(Diagnostics.Experimental)] +public sealed class DiscoveredCanvas +{ + /// Actions the agent or host may invoke on an open instance. + [JsonPropertyName("actions")] + public IList? Actions { get; set; } + + /// Provider-local canvas identifier. + [JsonPropertyName("canvasId")] + public string CanvasId { get; set; } = string.Empty; + + /// Short, single-sentence description shown to the agent in canvas catalogs. + [UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "Safe for generated string properties: JSON Schema minLength/maxLength map to string length validation, not reflection over trimmed Count members")] + [MinLength(1)] + [JsonPropertyName("description")] + public string Description { get; set; } = string.Empty; + + /// Human-readable canvas name. + [JsonPropertyName("displayName")] + public string DisplayName { get; set; } = string.Empty; + + /// Owning provider identifier. + [JsonPropertyName("extensionId")] + public string ExtensionId { get; set; } = string.Empty; + + /// Owning extension display name, when available. + [JsonPropertyName("extensionName")] + public string? ExtensionName { get; set; } + + /// JSON Schema for canvas open input. + [JsonPropertyName("inputSchema")] + public JsonElement? InputSchema { get; set; } +} + +/// Declared canvases available in this session. +[Experimental(Diagnostics.Experimental)] +public sealed class CanvasList +{ + /// Declared canvases available in this session. + [JsonPropertyName("canvases")] + public IList Canvases { get => field ??= []; set; } +} + +/// Identifies the target session. +[Experimental(Diagnostics.Experimental)] +internal sealed class SessionCanvasListRequest +{ + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// Open canvas instance snapshot. +[Experimental(Diagnostics.Experimental)] +public sealed class OpenCanvasInstance +{ + /// Runtime-controlled routing state for an open canvas instance. + [JsonPropertyName("availability")] + public CanvasInstanceAvailability Availability { get; set; } + + /// Provider-local canvas identifier. + [JsonPropertyName("canvasId")] + public string CanvasId { get; set; } = string.Empty; + + /// Owning provider identifier. + [JsonPropertyName("extensionId")] + public string ExtensionId { get; set; } = string.Empty; + + /// Owning extension display name, when available. + [JsonPropertyName("extensionName")] + public string? ExtensionName { get; set; } + + /// Input supplied when the instance was opened. + [JsonPropertyName("input")] + public JsonElement? Input { get; set; } + + /// Stable caller-supplied canvas instance identifier. + [JsonPropertyName("instanceId")] + public string InstanceId { get; set; } = string.Empty; + + /// Whether this snapshot came from an idempotent reopen. + [JsonPropertyName("reopen")] + public bool Reopen { get; set; } + + /// Provider-supplied status text. + [JsonPropertyName("status")] + public string? Status { get; set; } + + /// Rendered title. + [JsonPropertyName("title")] + public string? Title { get; set; } + + /// URL for web-rendered canvases. + [JsonPropertyName("url")] + public string? Url { get; set; } +} + +/// Live open-canvas snapshot. +[Experimental(Diagnostics.Experimental)] +public sealed class CanvasListOpenResult +{ + /// Currently open canvas instances. + [JsonPropertyName("openCanvases")] + public IList OpenCanvases { get => field ??= []; set; } +} + +/// Identifies the target session. +[Experimental(Diagnostics.Experimental)] +internal sealed class SessionCanvasListOpenRequest +{ + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// Canvas open parameters. +[Experimental(Diagnostics.Experimental)] +internal sealed class CanvasOpenRequest +{ + /// Provider-local canvas identifier. + [JsonPropertyName("canvasId")] + public string CanvasId { get; set; } = string.Empty; + + /// Owning provider identifier. Optional when the canvasId is unique across providers; required to disambiguate when multiple providers register the same canvasId. + [JsonPropertyName("extensionId")] + public string? ExtensionId { get; set; } + + /// Canvas open input. + [JsonPropertyName("input")] + public JsonElement? Input { get; set; } + + /// Caller-supplied stable instance identifier. + [JsonPropertyName("instanceId")] + public string InstanceId { get; set; } = string.Empty; + + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// Canvas close parameters. +[Experimental(Diagnostics.Experimental)] +internal sealed class CanvasCloseRequest +{ + /// Open canvas instance identifier. + [JsonPropertyName("instanceId")] + public string InstanceId { get; set; } = string.Empty; + + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// Canvas action invocation result. +[Experimental(Diagnostics.Experimental)] +public sealed class CanvasInvokeActionResult +{ + /// Provider-supplied action result. + [JsonPropertyName("result")] + public JsonElement? Result { get; set; } +} + +/// Canvas action invocation parameters. +[Experimental(Diagnostics.Experimental)] +internal sealed class CanvasInvokeActionRequest +{ + /// Action name to invoke. + [JsonPropertyName("actionName")] + public string ActionName { get; set; } = string.Empty; + + /// Action input. + [JsonPropertyName("input")] + public JsonElement? Input { get; set; } + + /// Open canvas instance identifier. + [JsonPropertyName("instanceId")] + public string InstanceId { get; set; } = string.Empty; + + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + /// The currently selected model and reasoning effort for the session. [Experimental(Diagnostics.Experimental)] public sealed class CurrentModel @@ -8292,6 +8493,69 @@ public override void Write(Utf8JsonWriter writer, AuthInfoType value, JsonSerial } +/// Runtime-controlled routing state for an open canvas instance. +[Experimental(Diagnostics.Experimental)] +[JsonConverter(typeof(Converter))] +[DebuggerDisplay("{Value,nq}")] +public readonly struct CanvasInstanceAvailability : IEquatable +{ + private readonly string? _value; + + /// Initializes a new instance of the struct. + /// The value to associate with this . + [JsonConstructor] + public CanvasInstanceAvailability(string value) + { + ArgumentException.ThrowIfNullOrWhiteSpace(value); + _value = value; + } + + /// Gets the value associated with this . + public string Value => _value ?? string.Empty; + + /// The owning provider is currently connected and routing calls will be dispatched normally. + public static CanvasInstanceAvailability Ready { get; } = new("ready"); + + /// The owning provider is not currently connected. Routing calls fail with canvas_provider_unavailable until the agent re-issues open_canvas (which rehydrates via a fresh canvas.open) or the provider reconnects. + public static CanvasInstanceAvailability Stale { get; } = new("stale"); + + /// Returns a value indicating whether two instances are equivalent. + public static bool operator ==(CanvasInstanceAvailability left, CanvasInstanceAvailability right) => left.Equals(right); + + /// Returns a value indicating whether two instances are not equivalent. + public static bool operator !=(CanvasInstanceAvailability left, CanvasInstanceAvailability right) => !(left == right); + + /// + public override bool Equals(object? obj) => obj is CanvasInstanceAvailability other && Equals(other); + + /// + public bool Equals(CanvasInstanceAvailability other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); + + /// + public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); + + /// + public override string ToString() => Value; + + /// Provides a for serializing instances. + [EditorBrowsable(EditorBrowsableState.Never)] + public sealed class Converter : JsonConverter + { + /// + public override CanvasInstanceAvailability Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); + } + + /// + public override void Write(Utf8JsonWriter writer, CanvasInstanceAvailability value, JsonSerializerOptions options) + { + GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(CanvasInstanceAvailability)); + } + } +} + + /// Allowed values for the `WorkspacesWorkspaceDetailsHostType` enumeration. [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] @@ -11573,6 +11837,12 @@ internal SessionRpc(CopilotSession session) Interlocked.CompareExchange(ref field, new(_session), null) ?? field; + /// Canvas APIs. + public CanvasApi Canvas => + field ?? + Interlocked.CompareExchange(ref field, new(_session), null) ?? + field; + /// Model APIs. public ModelApi Model => field ?? @@ -11859,6 +12129,85 @@ public async Task SetCredentialsAsync(AuthInfo? cre } } +/// Provides session-scoped Canvas APIs. +[Experimental(Diagnostics.Experimental)] +public sealed class CanvasApi +{ + private readonly CopilotSession _session; + + internal CanvasApi(CopilotSession session) + { + _session = session; + } + + /// Lists canvases declared for the session. + /// The to monitor for cancellation requests. The default is . + /// Declared canvases available in this session. + public async Task ListAsync(CancellationToken cancellationToken = default) + { + _session.ThrowIfDisposed(); + + var request = new SessionCanvasListRequest { SessionId = _session.SessionId }; + return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.canvas.list", [request], cancellationToken); + } + + /// Lists currently open canvas instances for the live session. + /// The to monitor for cancellation requests. The default is . + /// Live open-canvas snapshot. + public async Task ListOpenAsync(CancellationToken cancellationToken = default) + { + _session.ThrowIfDisposed(); + + var request = new SessionCanvasListOpenRequest { SessionId = _session.SessionId }; + return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.canvas.listOpen", [request], cancellationToken); + } + + /// Opens or focuses a canvas instance. + /// Provider-local canvas identifier. + /// Caller-supplied stable instance identifier. + /// Owning provider identifier. Optional when the canvasId is unique across providers; required to disambiguate when multiple providers register the same canvasId. + /// Canvas open input. + /// The to monitor for cancellation requests. The default is . + /// Open canvas instance snapshot. + public async Task OpenAsync(string canvasId, string instanceId, string? extensionId = null, object? input = null, CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(canvasId); + ArgumentNullException.ThrowIfNull(instanceId); + _session.ThrowIfDisposed(); + + var request = new CanvasOpenRequest { SessionId = _session.SessionId, CanvasId = canvasId, InstanceId = instanceId, ExtensionId = extensionId, Input = CopilotClient.ToJsonElementForWire(input) }; + return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.canvas.open", [request], cancellationToken); + } + + /// Closes an open canvas instance. + /// Open canvas instance identifier. + /// The to monitor for cancellation requests. The default is . + public async Task CloseAsync(string instanceId, CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(instanceId); + _session.ThrowIfDisposed(); + + var request = new CanvasCloseRequest { SessionId = _session.SessionId, InstanceId = instanceId }; + await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.canvas.close", [request], cancellationToken); + } + + /// Invokes an action on an open canvas instance. + /// Open canvas instance identifier. + /// Action name to invoke. + /// Action input. + /// The to monitor for cancellation requests. The default is . + /// Canvas action invocation result. + public async Task InvokeActionAsync(string instanceId, string actionName, object? input = null, CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(instanceId); + ArgumentNullException.ThrowIfNull(actionName); + _session.ThrowIfDisposed(); + + var request = new CanvasInvokeActionRequest { SessionId = _session.SessionId, InstanceId = instanceId, ActionName = actionName, Input = CopilotClient.ToJsonElementForWire(input) }; + return await CopilotClient.InvokeRpcAsync(_session.Rpc, "session.canvas.invokeAction", [request], cancellationToken); + } +} + /// Provides session-scoped Model APIs. [Experimental(Diagnostics.Experimental)] public sealed class ModelApi @@ -14118,6 +14467,9 @@ public static void RegisterClientSessionApiHandlers(JsonRpc rpc, FuncSchema for the `CanvasOpenedData` type. +/// Represents the session.canvas.opened event. +public sealed partial class SessionCanvasOpenedEvent : SessionEvent +{ + /// + [JsonIgnore] + public override string Type => "session.canvas.opened"; + + /// The session.canvas.opened event payload. + [JsonPropertyName("data")] + public required SessionCanvasOpenedData Data { get; set; } +} + +/// Schema for the `CanvasRegistryChangedData` type. +/// Represents the session.canvas.registry_changed event. +public sealed partial class SessionCanvasRegistryChangedEvent : SessionEvent +{ + /// + [JsonIgnore] + public override string Type => "session.canvas.registry_changed"; + + /// The session.canvas.registry_changed event payload. + [JsonPropertyName("data")] + public required SessionCanvasRegistryChangedData Data { get; set; } +} + /// MCP App view called a tool on a connected MCP server (SEP-1865). /// Represents the mcp_app.tool_call_complete event. public sealed partial class McpAppToolCallCompleteEvent : SessionEvent @@ -3168,6 +3196,63 @@ public sealed partial class SessionExtensionsLoadedData public required ExtensionsLoadedExtension[] Extensions { get; set; } } +/// Schema for the `CanvasOpenedData` type. +public sealed partial class SessionCanvasOpenedData +{ + /// Runtime-controlled routing state for the instance. "ready" when the provider connection is live; "stale" when the provider has gone away and the instance is awaiting rebinding. + [JsonPropertyName("availability")] + public required CanvasOpenedAvailability Availability { get; set; } + + /// Provider-local canvas identifier. + [JsonPropertyName("canvasId")] + public required string CanvasId { get; set; } + + /// Owning provider identifier. + [JsonPropertyName("extensionId")] + public required string ExtensionId { get; set; } + + /// Owning extension display name, when available. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("extensionName")] + public string? ExtensionName { get; set; } + + /// Input supplied when the instance was opened. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("input")] + public JsonElement? Input { get; set; } + + /// Stable caller-supplied canvas instance identifier. + [JsonPropertyName("instanceId")] + public required string InstanceId { get; set; } + + /// Whether this notification represents an idempotent reopen. + [JsonPropertyName("reopen")] + public required bool Reopen { get; set; } + + /// Provider-supplied status text. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("status")] + public string? Status { get; set; } + + /// Rendered title. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("title")] + public string? Title { get; set; } + + /// URL for web-rendered canvases. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("url")] + public string? Url { get; set; } +} + +/// Schema for the `CanvasRegistryChangedData` type. +public sealed partial class SessionCanvasRegistryChangedData +{ + /// Canvas declarations currently available. + [JsonPropertyName("canvases")] + public required CanvasRegistryChangedCanvas[] Canvases { get; set; } +} + /// MCP App view called a tool on a connected MCP server (SEP-1865). public sealed partial class McpAppToolCallCompleteData { @@ -5475,6 +5560,11 @@ public sealed partial class CommandsChangedCommand /// Nested data type for CapabilitiesChangedUI. public sealed partial class CapabilitiesChangedUI { + /// Whether canvas rendering is now supported. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("canvases")] + public bool? Canvases { get; set; } + /// Whether elicitation is now supported. [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] [JsonPropertyName("elicitation")] @@ -5613,6 +5703,63 @@ public sealed partial class ExtensionsLoadedExtension public required ExtensionsLoadedExtensionStatus Status { get; set; } } +/// Schema for the `CanvasRegistryChangedCanvasAction` type. +/// Nested data type for CanvasRegistryChangedCanvasAction. +public sealed partial class CanvasRegistryChangedCanvasAction +{ + /// Action description. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("description")] + public string? Description { get; set; } + + /// JSON Schema for action input. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("inputSchema")] + public JsonElement? InputSchema { get; set; } + + /// Action name. + [JsonPropertyName("name")] + public required string Name { get; set; } +} + +/// Schema for the `CanvasRegistryChangedCanvas` type. +/// Nested data type for CanvasRegistryChangedCanvas. +public sealed partial class CanvasRegistryChangedCanvas +{ + /// Actions the agent or host may invoke. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("actions")] + public CanvasRegistryChangedCanvasAction[]? Actions { get; set; } + + /// Provider-local canvas identifier. + [JsonPropertyName("canvasId")] + public required string CanvasId { get; set; } + + /// 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 required string Description { get; set; } + + /// Human-readable canvas name. + [JsonPropertyName("displayName")] + public required string DisplayName { get; set; } + + /// Owning provider identifier. + [JsonPropertyName("extensionId")] + public required string ExtensionId { get; set; } + + /// Owning extension display name, when available. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("extensionName")] + public string? ExtensionName { get; set; } + + /// JSON Schema for canvas open input. + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonPropertyName("inputSchema")] + public JsonElement? InputSchema { get; set; } +} + /// Set when the underlying tools/call threw an error before returning a CallToolResult. /// Nested data type for McpAppToolCallCompleteError. public sealed partial class McpAppToolCallCompleteError @@ -7692,6 +7839,67 @@ public override void Write(Utf8JsonWriter writer, ExtensionsLoadedExtensionStatu } } +/// Runtime-controlled routing state for the instance. "ready" when the provider connection is live; "stale" when the provider has gone away and the instance is awaiting rebinding. +[JsonConverter(typeof(Converter))] +[DebuggerDisplay("{Value,nq}")] +public readonly struct CanvasOpenedAvailability : IEquatable +{ + private readonly string? _value; + + /// Initializes a new instance of the struct. + /// The value to associate with this . + [JsonConstructor] + public CanvasOpenedAvailability(string value) + { + ArgumentException.ThrowIfNullOrWhiteSpace(value); + _value = value; + } + + /// Gets the value associated with this . + public string Value => _value ?? string.Empty; + + /// Provider connection is live; actions can be invoked. + public static CanvasOpenedAvailability Ready { get; } = new("ready"); + + /// Provider has gone away; the instance is awaiting rebinding. + public static CanvasOpenedAvailability Stale { get; } = new("stale"); + + /// Returns a value indicating whether two instances are equivalent. + public static bool operator ==(CanvasOpenedAvailability left, CanvasOpenedAvailability right) => left.Equals(right); + + /// Returns a value indicating whether two instances are not equivalent. + public static bool operator !=(CanvasOpenedAvailability left, CanvasOpenedAvailability right) => !(left == right); + + /// + public override bool Equals(object? obj) => obj is CanvasOpenedAvailability other && Equals(other); + + /// + public bool Equals(CanvasOpenedAvailability other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); + + /// + public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); + + /// + public override string ToString() => Value; + + /// Provides a for serializing instances. + [EditorBrowsable(EditorBrowsableState.Never)] + public sealed class Converter : JsonConverter + { + /// + public override CanvasOpenedAvailability Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); + } + + /// + public override void Write(Utf8JsonWriter writer, CanvasOpenedAvailability value, JsonSerializerOptions options) + { + GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(CanvasOpenedAvailability)); + } + } +} + [JsonSourceGenerationOptions( JsonSerializerDefaults.Web, AllowOutOfOrderMetadataProperties = true, @@ -7727,6 +7935,8 @@ public override void Write(Utf8JsonWriter writer, ExtensionsLoadedExtensionStatu [JsonSerializable(typeof(AutoModeSwitchCompletedEvent))] [JsonSerializable(typeof(AutoModeSwitchRequestedData))] [JsonSerializable(typeof(AutoModeSwitchRequestedEvent))] +[JsonSerializable(typeof(CanvasRegistryChangedCanvas))] +[JsonSerializable(typeof(CanvasRegistryChangedCanvasAction))] [JsonSerializable(typeof(CapabilitiesChangedData))] [JsonSerializable(typeof(CapabilitiesChangedEvent))] [JsonSerializable(typeof(CapabilitiesChangedUI))] @@ -7826,6 +8036,10 @@ public override void Write(Utf8JsonWriter writer, ExtensionsLoadedExtensionStatu [JsonSerializable(typeof(SamplingRequestedEvent))] [JsonSerializable(typeof(SessionBackgroundTasksChangedData))] [JsonSerializable(typeof(SessionBackgroundTasksChangedEvent))] +[JsonSerializable(typeof(SessionCanvasOpenedData))] +[JsonSerializable(typeof(SessionCanvasOpenedEvent))] +[JsonSerializable(typeof(SessionCanvasRegistryChangedData))] +[JsonSerializable(typeof(SessionCanvasRegistryChangedEvent))] [JsonSerializable(typeof(SessionCompactionCompleteData))] [JsonSerializable(typeof(SessionCompactionCompleteEvent))] [JsonSerializable(typeof(SessionCompactionStartData))] diff --git a/go/rpc/zrpc.go b/go/rpc/zrpc.go index 85d6e6364..fdd71f24b 100644 --- a/go/rpc/zrpc.go +++ b/go/rpc/zrpc.go @@ -285,6 +285,81 @@ func (UserAuthInfo) Type() AuthInfoType { return AuthInfoTypeUser } +// 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: CanvasAction is part of an experimental API and may change or be removed. +type CanvasAction struct { + // Description of the action + Description *string `json:"description,omitempty"` + // JSON Schema for the action input + InputSchema any `json:"inputSchema,omitempty"` + // Action name exposed by the canvas provider + Name string `json:"name"` +} + +// Canvas close parameters. +// Experimental: CanvasCloseRequest is part of an experimental API and may change or be +// removed. +type CanvasCloseRequest struct { + // Open canvas instance identifier + InstanceID string `json:"instanceId"` +} + +// Canvas action invocation parameters. +// Experimental: CanvasInvokeActionRequest is part of an experimental API and may change or +// be removed. +type CanvasInvokeActionRequest struct { + // Action name to invoke + ActionName string `json:"actionName"` + // Action input + Input any `json:"input,omitempty"` + // Open canvas instance identifier + InstanceID string `json:"instanceId"` +} + +// Canvas action invocation result. +// Experimental: CanvasInvokeActionResult is part of an experimental API and may change or +// be removed. +type CanvasInvokeActionResult struct { + // Provider-supplied action result + Result any `json:"result,omitempty"` +} + +// JSON Schema for canvas open input +// Experimental: CanvasJSONSchema is part of an experimental API and may change or be +// removed. +type CanvasJSONSchema any + +// Declared canvases available in this session. +// Experimental: CanvasList is part of an experimental API and may change or be removed. +type CanvasList struct { + // Declared canvases available in this session + Canvases []DiscoveredCanvas `json:"canvases"` +} + +// Live open-canvas snapshot. +// Experimental: CanvasListOpenResult is part of an experimental API and may change or be +// removed. +type CanvasListOpenResult struct { + // Currently open canvas instances + OpenCanvases []OpenCanvasInstance `json:"openCanvases"` +} + +// Canvas open parameters. +// Experimental: CanvasOpenRequest is part of an experimental API and may change or be +// removed. +type CanvasOpenRequest struct { + // Provider-local canvas identifier + CanvasID string `json:"canvasId"` + // Owning provider identifier. Optional when the canvasId is unique across providers; + // required to disambiguate when multiple providers register the same canvasId. + ExtensionID *string `json:"extensionId,omitempty"` + // Canvas open input + Input any `json:"input,omitempty"` + // Caller-supplied stable instance identifier + InstanceID string `json:"instanceId"` +} + // Slash commands available in the session, after applying any include/exclude filters. // Experimental: CommandList is part of an experimental API and may change or be removed. type CommandList struct { @@ -543,6 +618,26 @@ type CurrentModel struct { ReasoningEffort *string `json:"reasoningEffort,omitempty"` } +// Canvas available in the current session. +// Experimental: DiscoveredCanvas is part of an experimental API and may change or be +// removed. +type DiscoveredCanvas struct { + // Actions the agent or host may invoke on an open instance + Actions []CanvasAction `json:"actions,omitempty"` + // Provider-local canvas identifier + CanvasID string `json:"canvasId"` + // Short, single-sentence description shown to the agent in canvas catalogs. + Description string `json:"description"` + // Human-readable canvas name + DisplayName string `json:"displayName"` + // Owning provider identifier + ExtensionID string `json:"extensionId"` + // Owning extension display name, when available + ExtensionName *string `json:"extensionName,omitempty"` + // JSON Schema for canvas open input + InputSchema any `json:"inputSchema,omitempty"` +} + // Schema for the `DiscoveredMcpServer` type. type DiscoveredMcpServer struct { // Whether the server is enabled (not in the disabled list) @@ -2079,6 +2174,32 @@ type NameSetRequest struct { Name string `json:"name"` } +// Open canvas instance snapshot. +// Experimental: OpenCanvasInstance is part of an experimental API and may change or be +// removed. +type OpenCanvasInstance struct { + // Runtime-controlled routing state for an open canvas instance. + Availability CanvasInstanceAvailability `json:"availability"` + // Provider-local canvas identifier + CanvasID string `json:"canvasId"` + // Owning provider identifier + ExtensionID string `json:"extensionId"` + // Owning extension display name, when available + ExtensionName *string `json:"extensionName,omitempty"` + // Input supplied when the instance was opened + Input any `json:"input,omitempty"` + // Stable caller-supplied canvas instance identifier + InstanceID string `json:"instanceId"` + // Whether this snapshot came from an idempotent reopen + Reopen bool `json:"reopen"` + // Provider-supplied status text + Status *string `json:"status,omitempty"` + // Rendered title + Title *string `json:"title,omitempty"` + // URL for web-rendered canvases + URL *string `json:"url,omitempty"` +} + // Schema for the `PendingPermissionRequest` type. // Experimental: PendingPermissionRequest is part of an experimental API and may change or // be removed. @@ -3666,6 +3787,11 @@ type SessionBulkDeleteResult struct { FreedBytes map[string]int64 `json:"freedBytes"` } +// Experimental: SessionCanvasCloseResult is part of an experimental API and may change or +// be removed. +type SessionCanvasCloseResult struct { +} + // Schema for the `SessionContext` type. // Experimental: SessionContext is part of an experimental API and may change or be removed. type SessionContext struct { @@ -6103,6 +6229,20 @@ const ( AuthInfoTypeUser AuthInfoType = "user" ) +// Runtime-controlled routing state for an open canvas instance. +// Experimental: CanvasInstanceAvailability is part of an experimental API and may change or +// be removed. +type CanvasInstanceAvailability string + +const ( + // The owning provider is currently connected and routing calls will be dispatched normally. + CanvasInstanceAvailabilityReady CanvasInstanceAvailability = "ready" + // The owning provider is not currently connected. Routing calls fail with + // canvas_provider_unavailable until the agent re-issues open_canvas (which rehydrates via a + // fresh canvas.open) or the provider reconnects. + CanvasInstanceAvailabilityStale CanvasInstanceAvailability = "stale" +) + // Neutral SDK discriminator for the connected remote session kind. // Experimental: ConnectedRemoteSessionMetadataKind is part of an experimental API and may // change or be removed. @@ -8107,6 +8247,123 @@ func (a *AuthApi) SetCredentials(ctx context.Context, params *SessionSetCredenti return &result, nil } +// Experimental: CanvasApi contains experimental APIs that may change or be removed. +type CanvasApi sessionApi + +// Closes an open canvas instance. +// +// RPC method: session.canvas.close. +// +// Parameters: Canvas close parameters. +func (a *CanvasApi) Close(ctx context.Context, params *CanvasCloseRequest) (*SessionCanvasCloseResult, error) { + req := map[string]any{"sessionId": a.sessionID} + if params != nil { + req["instanceId"] = params.InstanceID + } + raw, err := a.client.Request("session.canvas.close", req) + if err != nil { + return nil, err + } + var result SessionCanvasCloseResult + if err := json.Unmarshal(raw, &result); err != nil { + return nil, err + } + return &result, nil +} + +// InvokeAction invokes an action on an open canvas instance. +// +// RPC method: session.canvas.invokeAction. +// +// Parameters: Canvas action invocation parameters. +// +// Returns: Canvas action invocation result. +func (a *CanvasApi) InvokeAction(ctx context.Context, params *CanvasInvokeActionRequest) (*CanvasInvokeActionResult, error) { + req := map[string]any{"sessionId": a.sessionID} + if params != nil { + req["actionName"] = params.ActionName + if params.Input != nil { + req["input"] = params.Input + } + req["instanceId"] = params.InstanceID + } + raw, err := a.client.Request("session.canvas.invokeAction", req) + if err != nil { + return nil, err + } + var result CanvasInvokeActionResult + if err := json.Unmarshal(raw, &result); err != nil { + return nil, err + } + return &result, nil +} + +// Lists canvases declared for the session. +// +// RPC method: session.canvas.list. +// +// Returns: Declared canvases available in this session. +func (a *CanvasApi) List(ctx context.Context) (*CanvasList, error) { + req := map[string]any{"sessionId": a.sessionID} + raw, err := a.client.Request("session.canvas.list", req) + if err != nil { + return nil, err + } + var result CanvasList + if err := json.Unmarshal(raw, &result); err != nil { + return nil, err + } + return &result, nil +} + +// ListOpen lists currently open canvas instances for the live session. +// +// RPC method: session.canvas.listOpen. +// +// Returns: Live open-canvas snapshot. +func (a *CanvasApi) ListOpen(ctx context.Context) (*CanvasListOpenResult, error) { + req := map[string]any{"sessionId": a.sessionID} + raw, err := a.client.Request("session.canvas.listOpen", req) + if err != nil { + return nil, err + } + var result CanvasListOpenResult + if err := json.Unmarshal(raw, &result); err != nil { + return nil, err + } + return &result, nil +} + +// Opens or focuses a canvas instance. +// +// RPC method: session.canvas.open. +// +// Parameters: Canvas open parameters. +// +// Returns: Open canvas instance snapshot. +func (a *CanvasApi) Open(ctx context.Context, params *CanvasOpenRequest) (*OpenCanvasInstance, error) { + req := map[string]any{"sessionId": a.sessionID} + if params != nil { + req["canvasId"] = params.CanvasID + if params.ExtensionID != nil { + req["extensionId"] = *params.ExtensionID + } + if params.Input != nil { + req["input"] = params.Input + } + req["instanceId"] = params.InstanceID + } + raw, err := a.client.Request("session.canvas.open", req) + if err != nil { + return nil, err + } + var result OpenCanvasInstance + if err := json.Unmarshal(raw, &result); err != nil { + return nil, err + } + return &result, nil +} + // Experimental: CommandsApi contains experimental APIs that may change or be removed. type CommandsApi sessionApi @@ -11160,6 +11417,7 @@ type SessionRpc struct { Agent *AgentApi Auth *AuthApi + Canvas *CanvasApi Commands *CommandsApi EventLog *EventLogApi Extensions *ExtensionsApi @@ -11369,6 +11627,7 @@ func NewSessionRpc(client *jsonrpc2.Client, sessionID string) *SessionRpc { r.common = sessionApi{client: client, sessionID: sessionID} r.Agent = (*AgentApi)(&r.common) r.Auth = (*AuthApi)(&r.common) + r.Canvas = (*CanvasApi)(&r.common) r.Commands = (*CommandsApi)(&r.common) r.EventLog = (*EventLogApi)(&r.common) r.Extensions = (*ExtensionsApi)(&r.common) diff --git a/go/rpc/zsession_encoding.go b/go/rpc/zsession_encoding.go index 155b53937..cc344851b 100644 --- a/go/rpc/zsession_encoding.go +++ b/go/rpc/zsession_encoding.go @@ -251,6 +251,18 @@ func (e *SessionEvent) UnmarshalJSON(data []byte) error { return err } e.Data = &d + case SessionEventTypeSessionCanvasOpened: + var d SessionCanvasOpenedData + if err := json.Unmarshal(raw.Data, &d); err != nil { + return err + } + e.Data = &d + case SessionEventTypeSessionCanvasRegistryChanged: + var d SessionCanvasRegistryChangedData + if err := json.Unmarshal(raw.Data, &d); err != nil { + return err + } + e.Data = &d case SessionEventTypeSessionCompactionComplete: var d SessionCompactionCompleteData if err := json.Unmarshal(raw.Data, &d); err != nil { diff --git a/go/rpc/zsession_events.go b/go/rpc/zsession_events.go index 10d79c37f..d56371750 100644 --- a/go/rpc/zsession_events.go +++ b/go/rpc/zsession_events.go @@ -89,6 +89,8 @@ const ( SessionEventTypeSamplingCompleted SessionEventType = "sampling.completed" SessionEventTypeSamplingRequested SessionEventType = "sampling.requested" SessionEventTypeSessionBackgroundTasksChanged SessionEventType = "session.background_tasks_changed" + SessionEventTypeSessionCanvasOpened SessionEventType = "session.canvas.opened" + SessionEventTypeSessionCanvasRegistryChanged SessionEventType = "session.canvas.registry_changed" SessionEventTypeSessionCompactionComplete SessionEventType = "session.compaction_complete" SessionEventTypeSessionCompactionStart SessionEventType = "session.compaction_start" SessionEventTypeSessionContextChanged SessionEventType = "session.context_changed" @@ -872,6 +874,44 @@ func (*SessionBackgroundTasksChangedData) Type() SessionEventType { return SessionEventTypeSessionBackgroundTasksChanged } +// Schema for the `CanvasOpenedData` type. +type SessionCanvasOpenedData struct { + // Runtime-controlled routing state for the instance. "ready" when the provider connection is live; "stale" when the provider has gone away and the instance is awaiting rebinding. + Availability CanvasOpenedAvailability `json:"availability"` + // Provider-local canvas identifier + CanvasID string `json:"canvasId"` + // Owning provider identifier + ExtensionID string `json:"extensionId"` + // Owning extension display name, when available + ExtensionName *string `json:"extensionName,omitempty"` + // Input supplied when the instance was opened + Input any `json:"input,omitempty"` + // Stable caller-supplied canvas instance identifier + InstanceID string `json:"instanceId"` + // Whether this notification represents an idempotent reopen + Reopen bool `json:"reopen"` + // Provider-supplied status text + Status *string `json:"status,omitempty"` + // Rendered title + Title *string `json:"title,omitempty"` + // URL for web-rendered canvases + URL *string `json:"url,omitempty"` +} + +func (*SessionCanvasOpenedData) sessionEventData() {} +func (*SessionCanvasOpenedData) Type() SessionEventType { return SessionEventTypeSessionCanvasOpened } + +// Schema for the `CanvasRegistryChangedData` type. +type SessionCanvasRegistryChangedData struct { + // Canvas declarations currently available + Canvases []CanvasRegistryChangedCanvas `json:"canvases"` +} + +func (*SessionCanvasRegistryChangedData) sessionEventData() {} +func (*SessionCanvasRegistryChangedData) Type() SessionEventType { + return SessionEventTypeSessionCanvasRegistryChanged +} + // Schema for the `CustomAgentsUpdatedData` type. type SessionCustomAgentsUpdatedData struct { // Array of loaded custom agent metadata @@ -1567,8 +1607,38 @@ type AssistantUsageQuotaSnapshot struct { UsedRequests int64 `json:"usedRequests"` } +// Schema for the `CanvasRegistryChangedCanvas` type. +type CanvasRegistryChangedCanvas struct { + // Actions the agent or host may invoke + Actions []CanvasRegistryChangedCanvasAction `json:"actions,omitempty"` + // Provider-local canvas identifier + CanvasID string `json:"canvasId"` + // Short, single-sentence description shown to the agent in canvas catalogs. + Description string `json:"description"` + // Human-readable canvas name + DisplayName string `json:"displayName"` + // Owning provider identifier + ExtensionID string `json:"extensionId"` + // Owning extension display name, when available + ExtensionName *string `json:"extensionName,omitempty"` + // JSON Schema for canvas open input + InputSchema map[string]any `json:"inputSchema,omitempty"` +} + +// Schema for the `CanvasRegistryChangedCanvasAction` type. +type CanvasRegistryChangedCanvasAction struct { + // Action description + Description *string `json:"description,omitempty"` + // JSON Schema for action input + InputSchema map[string]any `json:"inputSchema,omitempty"` + // Action name + Name string `json:"name"` +} + // UI capability changes type CapabilitiesChangedUI struct { + // Whether canvas rendering is now supported + Canvases *bool `json:"canvases,omitempty"` // Whether elicitation is now supported Elicitation *bool `json:"elicitation,omitempty"` // Whether MCP Apps (SEP-1865) UI passthrough is now supported @@ -2913,6 +2983,16 @@ const ( AutoModeSwitchResponseYesAlways AutoModeSwitchResponse = "yes_always" ) +// Runtime-controlled routing state for the instance. "ready" when the provider connection is live; "stale" when the provider has gone away and the instance is awaiting rebinding. +type CanvasOpenedAvailability string + +const ( + // Provider connection is live; actions can be invoked. + CanvasOpenedAvailabilityReady CanvasOpenedAvailability = "ready" + // Provider has gone away; the instance is awaiting rebinding. + CanvasOpenedAvailabilityStale CanvasOpenedAvailability = "stale" +) + // The user action: "accept" (submitted form), "decline" (explicitly refused), or "cancel" (dismissed) type ElicitationCompletedAction string diff --git a/go/zsession_events.go b/go/zsession_events.go index 25c002fcb..7f99e6eac 100644 --- a/go/zsession_events.go +++ b/go/zsession_events.go @@ -28,6 +28,9 @@ type ( AutoModeSwitchCompletedData = rpc.AutoModeSwitchCompletedData AutoModeSwitchRequestedData = rpc.AutoModeSwitchRequestedData AutoModeSwitchResponse = rpc.AutoModeSwitchResponse + CanvasOpenedAvailability = rpc.CanvasOpenedAvailability + CanvasRegistryChangedCanvas = rpc.CanvasRegistryChangedCanvas + CanvasRegistryChangedCanvasAction = rpc.CanvasRegistryChangedCanvasAction CapabilitiesChangedData = rpc.CapabilitiesChangedData CapabilitiesChangedUI = rpc.CapabilitiesChangedUI CommandCompletedData = rpc.CommandCompletedData @@ -138,6 +141,8 @@ type ( SamplingCompletedData = rpc.SamplingCompletedData SamplingRequestedData = rpc.SamplingRequestedData SessionBackgroundTasksChangedData = rpc.SessionBackgroundTasksChangedData + SessionCanvasOpenedData = rpc.SessionCanvasOpenedData + SessionCanvasRegistryChangedData = rpc.SessionCanvasRegistryChangedData SessionCompactionCompleteData = rpc.SessionCompactionCompleteData SessionCompactionStartData = rpc.SessionCompactionStartData SessionContextChangedData = rpc.SessionContextChangedData @@ -282,6 +287,8 @@ const ( AutoModeSwitchResponseNo = rpc.AutoModeSwitchResponseNo AutoModeSwitchResponseYes = rpc.AutoModeSwitchResponseYes AutoModeSwitchResponseYesAlways = rpc.AutoModeSwitchResponseYesAlways + CanvasOpenedAvailabilityReady = rpc.CanvasOpenedAvailabilityReady + CanvasOpenedAvailabilityStale = rpc.CanvasOpenedAvailabilityStale ElicitationCompletedActionAccept = rpc.ElicitationCompletedActionAccept ElicitationCompletedActionCancel = rpc.ElicitationCompletedActionCancel ElicitationCompletedActionDecline = rpc.ElicitationCompletedActionDecline @@ -397,6 +404,8 @@ const ( SessionEventTypeSamplingCompleted = rpc.SessionEventTypeSamplingCompleted SessionEventTypeSamplingRequested = rpc.SessionEventTypeSamplingRequested SessionEventTypeSessionBackgroundTasksChanged = rpc.SessionEventTypeSessionBackgroundTasksChanged + SessionEventTypeSessionCanvasOpened = rpc.SessionEventTypeSessionCanvasOpened + SessionEventTypeSessionCanvasRegistryChanged = rpc.SessionEventTypeSessionCanvasRegistryChanged SessionEventTypeSessionCompactionComplete = rpc.SessionEventTypeSessionCompactionComplete SessionEventTypeSessionCompactionStart = rpc.SessionEventTypeSessionCompactionStart SessionEventTypeSessionContextChanged = rpc.SessionEventTypeSessionContextChanged diff --git a/nodejs/package-lock.json b/nodejs/package-lock.json index c6ec63062..f93e4e02c 100644 --- a/nodejs/package-lock.json +++ b/nodejs/package-lock.json @@ -9,7 +9,7 @@ "version": "0.1.8", "license": "MIT", "dependencies": { - "@github/copilot": "^1.0.52", + "@github/copilot": "^1.0.53-2", "vscode-jsonrpc": "^8.2.1", "zod": "^4.3.6" }, @@ -663,9 +663,9 @@ } }, "node_modules/@github/copilot": { - "version": "1.0.52", - "resolved": "https://registry.npmjs.org/@github/copilot/-/copilot-1.0.52.tgz", - "integrity": "sha512-n6NAIVhosend+3UGYXW3Ltigeum2toUsV24RDgxjkdkLV1DVgp6+2OWCXdk3HTXZ0t/eWMvgBezRFbRr8N4Z6g==", + "version": "1.0.53-2", + "resolved": "https://registry.npmjs.org/@github/copilot/-/copilot-1.0.53-2.tgz", + "integrity": "sha512-SkISXco8PFyuOreaPIiBiyQHdXnw51wLmSvzW7yrdD02dH9qRBCcrxPXFS05iLrv3hLCnhhECKJUv1afTPtUBg==", "license": "SEE LICENSE IN LICENSE.md", "dependencies": { "detect-libc": "^2.1.2" @@ -674,20 +674,20 @@ "copilot": "npm-loader.js" }, "optionalDependencies": { - "@github/copilot-darwin-arm64": "1.0.52", - "@github/copilot-darwin-x64": "1.0.52", - "@github/copilot-linux-arm64": "1.0.52", - "@github/copilot-linux-x64": "1.0.52", - "@github/copilot-linuxmusl-arm64": "1.0.52", - "@github/copilot-linuxmusl-x64": "1.0.52", - "@github/copilot-win32-arm64": "1.0.52", - "@github/copilot-win32-x64": "1.0.52" + "@github/copilot-darwin-arm64": "1.0.53-2", + "@github/copilot-darwin-x64": "1.0.53-2", + "@github/copilot-linux-arm64": "1.0.53-2", + "@github/copilot-linux-x64": "1.0.53-2", + "@github/copilot-linuxmusl-arm64": "1.0.53-2", + "@github/copilot-linuxmusl-x64": "1.0.53-2", + "@github/copilot-win32-arm64": "1.0.53-2", + "@github/copilot-win32-x64": "1.0.53-2" } }, "node_modules/@github/copilot-darwin-arm64": { - "version": "1.0.52", - "resolved": "https://registry.npmjs.org/@github/copilot-darwin-arm64/-/copilot-darwin-arm64-1.0.52.tgz", - "integrity": "sha512-Jj0skAY5a9IQEaNHd1KdjkVhRSpmsSU4325BQ6XCgpo22pmg1Rk9Xc7cI29T6lCrn+KjksVvtPJq/lSNF2mHPw==", + "version": "1.0.53-2", + "resolved": "https://registry.npmjs.org/@github/copilot-darwin-arm64/-/copilot-darwin-arm64-1.0.53-2.tgz", + "integrity": "sha512-Ws+YLk9Gyix2IaqzFSuZe00fhX5IGAgNXyVNzkO1MvtnFSj9vGTAFslF94cf3VkpaI8VNf+O3MRGzaQohCpv4A==", "cpu": [ "arm64" ], @@ -701,9 +701,9 @@ } }, "node_modules/@github/copilot-darwin-x64": { - "version": "1.0.52", - "resolved": "https://registry.npmjs.org/@github/copilot-darwin-x64/-/copilot-darwin-x64-1.0.52.tgz", - "integrity": "sha512-vWzjLOKmwUTzyd3X8iR+I4c88EOH2r83Q6WN+0NgelqrzbhMHgMLJIbwTeKjN7egvribciYg6xeLFNo+0ClCkg==", + "version": "1.0.53-2", + "resolved": "https://registry.npmjs.org/@github/copilot-darwin-x64/-/copilot-darwin-x64-1.0.53-2.tgz", + "integrity": "sha512-3yHajiuz5UBsdpOlaZCLp2diveXJcIbXbjdjmovPIUrY/2h4yUbQSBEkFuxzV5CAuehQE9S7+NaZYMhUXRIl9Q==", "cpu": [ "x64" ], @@ -717,9 +717,9 @@ } }, "node_modules/@github/copilot-linux-arm64": { - "version": "1.0.52", - "resolved": "https://registry.npmjs.org/@github/copilot-linux-arm64/-/copilot-linux-arm64-1.0.52.tgz", - "integrity": "sha512-x6Pew1dMeKxNZMkaTC7VLxmD/X4zQiWQFTzMRYaqD2o5s0rqYYwy9ROP1+n3X6eaYWUp0FMKibdsiqjmZft+vw==", + "version": "1.0.53-2", + "resolved": "https://registry.npmjs.org/@github/copilot-linux-arm64/-/copilot-linux-arm64-1.0.53-2.tgz", + "integrity": "sha512-VgpKr1c7vw8lDqNPOIHYj7Qj6FJY2j3dTh6xaBcItUDLD7y45Pp36JJXrPiVjya7Upx4ThxR/kj9KSRxx4s5pg==", "cpu": [ "arm64" ], @@ -733,9 +733,9 @@ } }, "node_modules/@github/copilot-linux-x64": { - "version": "1.0.52", - "resolved": "https://registry.npmjs.org/@github/copilot-linux-x64/-/copilot-linux-x64-1.0.52.tgz", - "integrity": "sha512-dwZj/MeXNsLTYIp7A53xYTULvl+xspqZqqeiqhsW7KyGe8VT6QQ3bJj7qmOSEwOkmALuA4sPwBlTT3X0Ozbocw==", + "version": "1.0.53-2", + "resolved": "https://registry.npmjs.org/@github/copilot-linux-x64/-/copilot-linux-x64-1.0.53-2.tgz", + "integrity": "sha512-1mZUCQVeS2y5douEq8tCIEBr1XP8L0UM7fo4MmJHlLT+6ykZz1pyJPtnpO8OO4GGRvenOFd/XM0k2a+KpxYqtw==", "cpu": [ "x64" ], @@ -749,9 +749,9 @@ } }, "node_modules/@github/copilot-linuxmusl-arm64": { - "version": "1.0.52", - "resolved": "https://registry.npmjs.org/@github/copilot-linuxmusl-arm64/-/copilot-linuxmusl-arm64-1.0.52.tgz", - "integrity": "sha512-QBhLnWhtH8qjsfeDqE5Bn5KGCH3fLEIRHbHfOd3UPyapBKTA+pBA/6FQGjvOkzwMeKKtTBeRBQ9hCoQm+Vrr2A==", + "version": "1.0.53-2", + "resolved": "https://registry.npmjs.org/@github/copilot-linuxmusl-arm64/-/copilot-linuxmusl-arm64-1.0.53-2.tgz", + "integrity": "sha512-gf2wgQu8DuUZSz0Fdq2f13TvWOi6+xkkyQQM3mPtt841UV0K8eUV9MBSRvkv1zbd0RG9MgbPaBLE8TRpWezikg==", "cpu": [ "arm64" ], @@ -765,9 +765,9 @@ } }, "node_modules/@github/copilot-linuxmusl-x64": { - "version": "1.0.52", - "resolved": "https://registry.npmjs.org/@github/copilot-linuxmusl-x64/-/copilot-linuxmusl-x64-1.0.52.tgz", - "integrity": "sha512-mdA5VfgX0XfMU3zwnAg0Wf3lQ/vkRZOmm7h69N/1jgRftMghm5WW3xfrBDkANta9J7YLl8YBPwRZAPzw2TYZEg==", + "version": "1.0.53-2", + "resolved": "https://registry.npmjs.org/@github/copilot-linuxmusl-x64/-/copilot-linuxmusl-x64-1.0.53-2.tgz", + "integrity": "sha512-Zk/o40BOmuNUC6eLZnPRGE45dzdmrPbjusyGOdLKXFzlImHHW2SwYoFchnubzpz81Hzwur3/vCqYtGWjTSa8LA==", "cpu": [ "x64" ], @@ -781,9 +781,9 @@ } }, "node_modules/@github/copilot-win32-arm64": { - "version": "1.0.52", - "resolved": "https://registry.npmjs.org/@github/copilot-win32-arm64/-/copilot-win32-arm64-1.0.52.tgz", - "integrity": "sha512-Anl7/k4uudsE2Kc4nYFh4AJegcudt9I4od4OBwjQF6kR/VGXsgKtW6b15o8R4F3HWqXIcMwwyGq7Oov+NYVLqQ==", + "version": "1.0.53-2", + "resolved": "https://registry.npmjs.org/@github/copilot-win32-arm64/-/copilot-win32-arm64-1.0.53-2.tgz", + "integrity": "sha512-BBMC0QIOn+f61VGfyZbEiFupWJToZwftv9FhJ7xOh1utg3lwmBfjmaG9BKXdnaFqlOjP8mUKbgAkyBJHGZYNOA==", "cpu": [ "arm64" ], @@ -797,9 +797,9 @@ } }, "node_modules/@github/copilot-win32-x64": { - "version": "1.0.52", - "resolved": "https://registry.npmjs.org/@github/copilot-win32-x64/-/copilot-win32-x64-1.0.52.tgz", - "integrity": "sha512-rOTQk57EdhnoVKn5JlQBhurAJIRJ7GLm/jMGxrTktY2Le+bcdAyBzWZtIHiy5E9CXbpISBtUe63Coa5Tyumf6w==", + "version": "1.0.53-2", + "resolved": "https://registry.npmjs.org/@github/copilot-win32-x64/-/copilot-win32-x64-1.0.53-2.tgz", + "integrity": "sha512-ObuGJ/AGnhTl3kOPIjY9xj3BfucjpQNytmIPQGwgMDDBisSvtfdQ5WVbZlKG736VtQ1epZ1RmzS28bKTudBD/Q==", "cpu": [ "x64" ], diff --git a/nodejs/package.json b/nodejs/package.json index 996b7be14..7aa9076e7 100644 --- a/nodejs/package.json +++ b/nodejs/package.json @@ -56,7 +56,7 @@ "author": "GitHub", "license": "MIT", "dependencies": { - "@github/copilot": "^1.0.52", + "@github/copilot": "^1.0.53-2", "vscode-jsonrpc": "^8.2.1", "zod": "^4.3.6" }, diff --git a/nodejs/samples/package-lock.json b/nodejs/samples/package-lock.json index 2bdef0f58..3881c7288 100644 --- a/nodejs/samples/package-lock.json +++ b/nodejs/samples/package-lock.json @@ -18,7 +18,7 @@ "version": "0.1.8", "license": "MIT", "dependencies": { - "@github/copilot": "^1.0.52", + "@github/copilot": "^1.0.53-2", "vscode-jsonrpc": "^8.2.1", "zod": "^4.3.6" }, diff --git a/nodejs/src/generated/rpc.ts b/nodejs/src/generated/rpc.ts index 89d595497..f7e379637 100644 --- a/nodejs/src/generated/rpc.ts +++ b/nodejs/src/generated/rpc.ts @@ -64,6 +64,18 @@ export type AuthInfoType = | "token" /** Authentication from a Copilot API token. */ | "copilot-api-token"; +/** + * Runtime-controlled routing state for an open canvas instance. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "CanvasInstanceAvailability". + */ +/** @experimental */ +export type CanvasInstanceAvailability = + /** The owning provider is currently connected and routing calls will be dispatched normally. */ + | "ready" + /** The owning provider is not currently connected. Routing calls fail with canvas_provider_unavailable until the agent re-issues open_canvas (which rehydrates via a fresh canvas.open) or the provider reconnects. */ + | "stale"; /** * Coarse command category for grouping and behavior: runtime built-in, skill-backed command, or SDK/client-owned command * @@ -1694,6 +1706,220 @@ export interface GhCliAuthInfo { token: string; copilotUser?: CopilotUserResponse; } +/** + * Canvas action that the agent or host can invoke. To discover the input schema for a particular action, call the list_canvas_capabilities tool. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "CanvasAction". + */ +/** @experimental */ +export interface CanvasAction { + /** + * Action name exposed by the canvas provider + */ + name: string; + /** + * Description of the action + */ + description?: string; + inputSchema?: CanvasJsonSchema; +} +/** + * JSON Schema for canvas open input + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "CanvasJsonSchema". + */ +/** @experimental */ +export interface CanvasJsonSchema { + [k: string]: unknown | undefined; +} +/** + * Canvas close parameters. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "CanvasCloseRequest". + */ +/** @experimental */ +export interface CanvasCloseRequest { + /** + * Open canvas instance identifier + */ + instanceId: string; +} +/** + * Canvas action invocation parameters. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "CanvasInvokeActionRequest". + */ +/** @experimental */ +export interface CanvasInvokeActionRequest { + /** + * Open canvas instance identifier + */ + instanceId: string; + /** + * Action name to invoke + */ + actionName: string; + /** + * Action input + */ + input?: { + [k: string]: unknown | undefined; + }; +} +/** + * Canvas action invocation result. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "CanvasInvokeActionResult". + */ +/** @experimental */ +export interface CanvasInvokeActionResult { + /** + * Provider-supplied action result + */ + result?: { + [k: string]: unknown | undefined; + }; +} +/** + * Declared canvases available in this session. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "CanvasList". + */ +/** @experimental */ +export interface CanvasList { + /** + * Declared canvases available in this session + */ + canvases: DiscoveredCanvas[]; +} +/** + * Canvas available in the current session. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "DiscoveredCanvas". + */ +/** @experimental */ +export interface DiscoveredCanvas { + /** + * Human-readable canvas name + */ + displayName: string; + /** + * Short, single-sentence description shown to the agent in canvas catalogs. + */ + description: string; + inputSchema?: CanvasJsonSchema; + /** + * Actions the agent or host may invoke on an open instance + */ + actions?: CanvasAction[]; + /** + * Owning provider identifier + */ + extensionId: string; + /** + * Owning extension display name, when available + */ + extensionName?: string; + /** + * Provider-local canvas identifier + */ + canvasId: string; +} +/** + * Live open-canvas snapshot. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "CanvasListOpenResult". + */ +/** @experimental */ +export interface CanvasListOpenResult { + /** + * Currently open canvas instances + */ + openCanvases: OpenCanvasInstance[]; +} +/** + * Open canvas instance snapshot. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "OpenCanvasInstance". + */ +/** @experimental */ +export interface OpenCanvasInstance { + /** + * Stable caller-supplied canvas instance identifier + */ + instanceId: string; + /** + * Owning provider identifier + */ + extensionId: string; + /** + * Owning extension display name, when available + */ + extensionName?: string; + /** + * Provider-local canvas identifier + */ + canvasId: string; + /** + * Rendered title + */ + title?: string; + /** + * Provider-supplied status text + */ + status?: string; + /** + * URL for web-rendered canvases + */ + url?: string; + /** + * Input supplied when the instance was opened + */ + input?: { + [k: string]: unknown | undefined; + }; + /** + * Whether this snapshot came from an idempotent reopen + */ + reopen: boolean; + availability: CanvasInstanceAvailability; +} +/** + * Canvas open parameters. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "CanvasOpenRequest". + */ +/** @experimental */ +export interface CanvasOpenRequest { + /** + * Owning provider identifier. Optional when the canvasId is unique across providers; required to disambiguate when multiple providers register the same canvasId. + */ + extensionId?: string; + /** + * Provider-local canvas identifier + */ + canvasId: string; + /** + * Caller-supplied stable instance identifier + */ + instanceId: string; + /** + * Canvas open input + */ + input?: { + [k: string]: unknown | undefined; + }; +} /** * Slash commands available in the session, after applying any include/exclude filters. * @@ -9566,6 +9792,48 @@ export function createSessionRpc(connection: MessageConnection, sessionId: strin connection.sendRequest("session.auth.setCredentials", { sessionId, ...params }), }, /** @experimental */ + canvas: { + /** + * Lists canvases declared for the session. + * + * @returns Declared canvases available in this session. + */ + list: async (): Promise => + connection.sendRequest("session.canvas.list", { sessionId }), + /** + * Lists currently open canvas instances for the live session. + * + * @returns Live open-canvas snapshot. + */ + listOpen: async (): Promise => + connection.sendRequest("session.canvas.listOpen", { sessionId }), + /** + * Opens or focuses a canvas instance. + * + * @param params Canvas open parameters. + * + * @returns Open canvas instance snapshot. + */ + open: async (params: CanvasOpenRequest): Promise => + connection.sendRequest("session.canvas.open", { sessionId, ...params }), + /** + * Closes an open canvas instance. + * + * @param params Canvas close parameters. + */ + close: async (params: CanvasCloseRequest): Promise => + connection.sendRequest("session.canvas.close", { sessionId, ...params }), + /** + * Invokes an action on an open canvas instance. + * + * @param params Canvas action invocation parameters. + * + * @returns Canvas action invocation result. + */ + invokeAction: async (params: CanvasInvokeActionRequest): Promise => + connection.sendRequest("session.canvas.invokeAction", { sessionId, ...params }), + }, + /** @experimental */ model: { /** * Gets the currently selected model for the session. diff --git a/nodejs/src/generated/session-events.ts b/nodejs/src/generated/session-events.ts index da4333e55..506ed6ae2 100644 --- a/nodejs/src/generated/session-events.ts +++ b/nodejs/src/generated/session-events.ts @@ -88,6 +88,8 @@ export type SessionEvent = | McpServersLoadedEvent | McpServerStatusChangedEvent | ExtensionsLoadedEvent + | CanvasOpenedEvent + | CanvasRegistryChangedEvent | McpAppToolCallCompleteEvent; /** * Hosting platform type of the repository (github or ado) @@ -502,6 +504,14 @@ export type ExtensionsLoadedExtensionStatus = | "failed" /** The extension process is starting. */ | "starting"; +/** + * Runtime-controlled routing state for the instance. "ready" when the provider connection is live; "stale" when the provider has gone away and the instance is awaiting rebinding. + */ +export type CanvasOpenedAvailability = + /** Provider connection is live; actions can be invoked. */ + | "ready" + /** Provider has gone away; the instance is awaiting rebinding. */ + | "stale"; /** * Session event "session.start". Session initialization metadata including context and configuration @@ -6070,6 +6080,10 @@ export interface CapabilitiesChangedData { * UI capability changes */ export interface CapabilitiesChangedUI { + /** + * Whether canvas rendering is now supported + */ + canvases?: boolean; /** * Whether elicitation is now supported */ @@ -6566,6 +6580,173 @@ export interface ExtensionsLoadedExtension { source: ExtensionsLoadedExtensionSource; status: ExtensionsLoadedExtensionStatus; } +/** + * Session event "session.canvas.opened". + */ +export interface CanvasOpenedEvent { + /** + * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events. + */ + agentId?: string; + data: CanvasOpenedData; + /** + * Always true for events that are transient and not persisted to the session event log on disk. + */ + ephemeral: true; + /** + * Unique event identifier (UUID v4), generated when the event is emitted + */ + id: string; + /** + * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event. + */ + parentId: string | null; + /** + * ISO 8601 timestamp when the event was created + */ + timestamp: string; + /** + * Type discriminator. Always "session.canvas.opened". + */ + type: "session.canvas.opened"; +} +/** + * Schema for the `CanvasOpenedData` type. + */ +export interface CanvasOpenedData { + availability: CanvasOpenedAvailability; + /** + * Provider-local canvas identifier + */ + canvasId: string; + /** + * Owning provider identifier + */ + extensionId: string; + /** + * Owning extension display name, when available + */ + extensionName?: string; + /** + * Input supplied when the instance was opened + */ + input?: { + [k: string]: unknown | undefined; + }; + /** + * Stable caller-supplied canvas instance identifier + */ + instanceId: string; + /** + * Whether this notification represents an idempotent reopen + */ + reopen: boolean; + /** + * Provider-supplied status text + */ + status?: string; + /** + * Rendered title + */ + title?: string; + /** + * URL for web-rendered canvases + */ + url?: string; +} +/** + * Session event "session.canvas.registry_changed". + */ +export interface CanvasRegistryChangedEvent { + /** + * Sub-agent instance identifier. Absent for events from the root/main agent and session-level events. + */ + agentId?: string; + data: CanvasRegistryChangedData; + /** + * Always true for events that are transient and not persisted to the session event log on disk. + */ + ephemeral: true; + /** + * Unique event identifier (UUID v4), generated when the event is emitted + */ + id: string; + /** + * ID of the chronologically preceding event in the session, forming a linked chain. Null for the first event. + */ + parentId: string | null; + /** + * ISO 8601 timestamp when the event was created + */ + timestamp: string; + /** + * Type discriminator. Always "session.canvas.registry_changed". + */ + type: "session.canvas.registry_changed"; +} +/** + * Schema for the `CanvasRegistryChangedData` type. + */ +export interface CanvasRegistryChangedData { + /** + * Canvas declarations currently available + */ + canvases: CanvasRegistryChangedCanvas[]; +} +/** + * Schema for the `CanvasRegistryChangedCanvas` type. + */ +export interface CanvasRegistryChangedCanvas { + /** + * Actions the agent or host may invoke + */ + actions?: CanvasRegistryChangedCanvasAction[]; + /** + * Provider-local canvas identifier + */ + canvasId: string; + /** + * Short, single-sentence description shown to the agent in canvas catalogs. + */ + description: string; + /** + * Human-readable canvas name + */ + displayName: string; + /** + * Owning provider identifier + */ + extensionId: string; + /** + * Owning extension display name, when available + */ + extensionName?: string; + /** + * JSON Schema for canvas open input + */ + inputSchema?: { + [k: string]: unknown | undefined; + }; +} +/** + * Schema for the `CanvasRegistryChangedCanvasAction` type. + */ +export interface CanvasRegistryChangedCanvasAction { + /** + * Action description + */ + description?: string; + /** + * JSON Schema for action input + */ + inputSchema?: { + [k: string]: unknown | undefined; + }; + /** + * Action name + */ + name: string; +} /** * Session event "mcp_app.tool_call_complete". MCP App view called a tool on a connected MCP server (SEP-1865) */ diff --git a/python/copilot/generated/rpc.py b/python/copilot/generated/rpc.py index 6de758c09..7069d23c1 100644 --- a/python/copilot/generated/rpc.py +++ b/python/copilot/generated/rpc.py @@ -269,6 +269,151 @@ class AuthInfoType(Enum): TOKEN = "token" USER = "user" +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class CanvasAction: + """Canvas action that the agent or host can invoke. To discover the input schema for a + particular action, call the list_canvas_capabilities tool. + """ + name: str + """Action name exposed by the canvas provider""" + + description: str | None = None + """Description of the action""" + + input_schema: Any = None + """JSON Schema for the action input""" + + @staticmethod + def from_dict(obj: Any) -> 'CanvasAction': + assert isinstance(obj, dict) + name = from_str(obj.get("name")) + description = from_union([from_str, from_none], obj.get("description")) + input_schema = obj.get("inputSchema") + return CanvasAction(name, description, input_schema) + + def to_dict(self) -> dict: + result: dict = {} + result["name"] = from_str(self.name) + if self.description is not None: + result["description"] = from_union([from_str, from_none], self.description) + if self.input_schema is not None: + result["inputSchema"] = self.input_schema + return result + +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class CanvasCloseRequest: + """Canvas close parameters.""" + + instance_id: str + """Open canvas instance identifier""" + + @staticmethod + def from_dict(obj: Any) -> 'CanvasCloseRequest': + assert isinstance(obj, dict) + instance_id = from_str(obj.get("instanceId")) + return CanvasCloseRequest(instance_id) + + def to_dict(self) -> dict: + result: dict = {} + result["instanceId"] = from_str(self.instance_id) + return result + +# Experimental: this type is part of an experimental API and may change or be removed. +class CanvasInstanceAvailability(Enum): + """Runtime-controlled routing state for an open canvas instance.""" + + READY = "ready" + STALE = "stale" + +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class CanvasInvokeActionRequest: + """Canvas action invocation parameters.""" + + action_name: str + """Action name to invoke""" + + instance_id: str + """Open canvas instance identifier""" + + input: Any = None + """Action input""" + + @staticmethod + def from_dict(obj: Any) -> 'CanvasInvokeActionRequest': + assert isinstance(obj, dict) + action_name = from_str(obj.get("actionName")) + instance_id = from_str(obj.get("instanceId")) + input = obj.get("input") + return CanvasInvokeActionRequest(action_name, instance_id, input) + + def to_dict(self) -> dict: + result: dict = {} + result["actionName"] = from_str(self.action_name) + result["instanceId"] = from_str(self.instance_id) + if self.input is not None: + result["input"] = self.input + return result + +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class CanvasInvokeActionResult: + """Canvas action invocation result.""" + + result: Any = None + """Provider-supplied action result""" + + @staticmethod + def from_dict(obj: Any) -> 'CanvasInvokeActionResult': + assert isinstance(obj, dict) + result = obj.get("result") + return CanvasInvokeActionResult(result) + + def to_dict(self) -> dict: + result: dict = {} + if self.result is not None: + result["result"] = self.result + return result + +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class CanvasOpenRequest: + """Canvas open parameters.""" + + canvas_id: str + """Provider-local canvas identifier""" + + instance_id: str + """Caller-supplied stable instance identifier""" + + extension_id: str | None = None + """Owning provider identifier. Optional when the canvasId is unique across providers; + required to disambiguate when multiple providers register the same canvasId. + """ + input: Any = None + """Canvas open input""" + + @staticmethod + def from_dict(obj: Any) -> 'CanvasOpenRequest': + assert isinstance(obj, dict) + canvas_id = from_str(obj.get("canvasId")) + instance_id = from_str(obj.get("instanceId")) + extension_id = from_union([from_str, from_none], obj.get("extensionId")) + input = obj.get("input") + return CanvasOpenRequest(canvas_id, instance_id, extension_id, input) + + def to_dict(self) -> dict: + result: dict = {} + result["canvasId"] = from_str(self.canvas_id) + result["instanceId"] = from_str(self.instance_id) + if self.extension_id is not None: + result["extensionId"] = from_union([from_str, from_none], self.extension_id) + if self.input is not None: + result["input"] = self.input + return result + # Experimental: this type is part of an experimental API and may change or be removed. class SlashCommandInputCompletion(Enum): """Optional completion hint for the input (e.g. 'directory' for filesystem path completion)""" @@ -6612,6 +6757,127 @@ def to_dict(self) -> dict: result["statusMessage"] = from_union([from_str, from_none], self.status_message) return result +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class DiscoveredCanvas: + """Canvas available in the current session.""" + + canvas_id: str + """Provider-local canvas identifier""" + + description: str + """Short, single-sentence description shown to the agent in canvas catalogs.""" + + display_name: str + """Human-readable canvas name""" + + extension_id: str + """Owning provider identifier""" + + actions: list[CanvasAction] | None = None + """Actions the agent or host may invoke on an open instance""" + + extension_name: str | None = None + """Owning extension display name, when available""" + + input_schema: Any = None + """JSON Schema for canvas open input""" + + @staticmethod + def from_dict(obj: Any) -> 'DiscoveredCanvas': + assert isinstance(obj, dict) + canvas_id = from_str(obj.get("canvasId")) + description = from_str(obj.get("description")) + display_name = from_str(obj.get("displayName")) + extension_id = from_str(obj.get("extensionId")) + actions = from_union([lambda x: from_list(CanvasAction.from_dict, x), from_none], obj.get("actions")) + extension_name = from_union([from_str, from_none], obj.get("extensionName")) + input_schema = obj.get("inputSchema") + return DiscoveredCanvas(canvas_id, description, display_name, extension_id, actions, extension_name, input_schema) + + def to_dict(self) -> dict: + result: dict = {} + result["canvasId"] = from_str(self.canvas_id) + result["description"] = from_str(self.description) + result["displayName"] = from_str(self.display_name) + result["extensionId"] = from_str(self.extension_id) + if self.actions is not None: + result["actions"] = from_union([lambda x: from_list(lambda x: to_class(CanvasAction, x), x), from_none], self.actions) + if self.extension_name is not None: + result["extensionName"] = from_union([from_str, from_none], self.extension_name) + if self.input_schema is not None: + result["inputSchema"] = self.input_schema + return result + +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class OpenCanvasInstance: + """Open canvas instance snapshot.""" + + availability: CanvasInstanceAvailability + """Runtime-controlled routing state for an open canvas instance.""" + + canvas_id: str + """Provider-local canvas identifier""" + + extension_id: str + """Owning provider identifier""" + + instance_id: str + """Stable caller-supplied canvas instance identifier""" + + reopen: bool + """Whether this snapshot came from an idempotent reopen""" + + extension_name: str | None = None + """Owning extension display name, when available""" + + input: Any = None + """Input supplied when the instance was opened""" + + status: str | None = None + """Provider-supplied status text""" + + title: str | None = None + """Rendered title""" + + url: str | None = None + """URL for web-rendered canvases""" + + @staticmethod + def from_dict(obj: Any) -> 'OpenCanvasInstance': + assert isinstance(obj, dict) + availability = CanvasInstanceAvailability(obj.get("availability")) + canvas_id = from_str(obj.get("canvasId")) + extension_id = from_str(obj.get("extensionId")) + instance_id = from_str(obj.get("instanceId")) + reopen = from_bool(obj.get("reopen")) + extension_name = from_union([from_str, from_none], obj.get("extensionName")) + input = obj.get("input") + status = from_union([from_str, from_none], obj.get("status")) + title = from_union([from_str, from_none], obj.get("title")) + url = from_union([from_str, from_none], obj.get("url")) + return OpenCanvasInstance(availability, canvas_id, extension_id, instance_id, reopen, extension_name, input, status, title, url) + + def to_dict(self) -> dict: + result: dict = {} + result["availability"] = to_enum(CanvasInstanceAvailability, self.availability) + result["canvasId"] = from_str(self.canvas_id) + result["extensionId"] = from_str(self.extension_id) + result["instanceId"] = from_str(self.instance_id) + result["reopen"] = from_bool(self.reopen) + if self.extension_name is not None: + result["extensionName"] = from_union([from_str, from_none], self.extension_name) + if self.input is not None: + result["input"] = self.input + if self.status is not None: + result["status"] = from_union([from_str, from_none], self.status) + if self.title is not None: + result["title"] = from_union([from_str, from_none], self.title) + if self.url is not None: + result["url"] = from_union([from_str, from_none], self.url) + return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SlashCommandInput: @@ -11020,6 +11286,44 @@ def to_dict(self) -> dict: result["saved"] = from_union([lambda x: to_class(Saved, x), from_none], self.saved) return result +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class CanvasList: + """Declared canvases available in this session.""" + + canvases: list[DiscoveredCanvas] + """Declared canvases available in this session""" + + @staticmethod + def from_dict(obj: Any) -> 'CanvasList': + assert isinstance(obj, dict) + canvases = from_list(DiscoveredCanvas.from_dict, obj.get("canvases")) + return CanvasList(canvases) + + def to_dict(self) -> dict: + result: dict = {} + result["canvases"] = from_list(lambda x: to_class(DiscoveredCanvas, x), self.canvases) + return result + +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class CanvasListOpenResult: + """Live open-canvas snapshot.""" + + open_canvases: list[OpenCanvasInstance] + """Currently open canvas instances""" + + @staticmethod + def from_dict(obj: Any) -> 'CanvasListOpenResult': + assert isinstance(obj, dict) + open_canvases = from_list(OpenCanvasInstance.from_dict, obj.get("openCanvases")) + return CanvasListOpenResult(open_canvases) + + def to_dict(self) -> dict: + result: dict = {} + result["openCanvases"] = from_list(lambda x: to_class(OpenCanvasInstance, x), self.open_canvases) + return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SlashCommandInfo: @@ -14193,6 +14497,15 @@ class RPC: api_key_auth_info: APIKeyAuthInfo auth_info: AuthInfo auth_info_type: AuthInfoType + canvas_action: CanvasAction + canvas_close_request: CanvasCloseRequest + canvas_instance_availability: CanvasInstanceAvailability + canvas_invoke_action_request: CanvasInvokeActionRequest + canvas_invoke_action_result: CanvasInvokeActionResult + canvas_json_schema: Any + canvas_list: CanvasList + canvas_list_open_result: CanvasListOpenResult + canvas_open_request: CanvasOpenRequest command_list: CommandList commands_handle_pending_command_request: CommandsHandlePendingCommandRequest commands_handle_pending_command_result: CommandsHandlePendingCommandResult @@ -14215,6 +14528,7 @@ class RPC: copilot_user_response_quota_snapshots_completions: CopilotUserResponseQuotaSnapshotsCompletions copilot_user_response_quota_snapshots_premium_interactions: CopilotUserResponseQuotaSnapshotsPremiumInteractions current_model: CurrentModel + discovered_canvas: DiscoveredCanvas discovered_mcp_server: DiscoveredMCPServer discovered_mcp_server_type: DiscoveredMCPServerType enqueue_command_params: EnqueueCommandParams @@ -14372,6 +14686,7 @@ class RPC: name_set_auto_request: NameSetAutoRequest name_set_auto_result: NameSetAutoResult name_set_request: NameSetRequest + open_canvas_instance: OpenCanvasInstance options_update_env_value_mode: MCPSetEnvValueModeDetails pending_permission_request: PendingPermissionRequest pending_permission_request_list: PendingPermissionRequestList @@ -14728,6 +15043,15 @@ def from_dict(obj: Any) -> 'RPC': api_key_auth_info = APIKeyAuthInfo.from_dict(obj.get("ApiKeyAuthInfo")) auth_info = _load_AuthInfo(obj.get("AuthInfo")) auth_info_type = AuthInfoType(obj.get("AuthInfoType")) + canvas_action = CanvasAction.from_dict(obj.get("CanvasAction")) + canvas_close_request = CanvasCloseRequest.from_dict(obj.get("CanvasCloseRequest")) + canvas_instance_availability = CanvasInstanceAvailability(obj.get("CanvasInstanceAvailability")) + canvas_invoke_action_request = CanvasInvokeActionRequest.from_dict(obj.get("CanvasInvokeActionRequest")) + canvas_invoke_action_result = CanvasInvokeActionResult.from_dict(obj.get("CanvasInvokeActionResult")) + canvas_json_schema = obj.get("CanvasJsonSchema") + canvas_list = CanvasList.from_dict(obj.get("CanvasList")) + canvas_list_open_result = CanvasListOpenResult.from_dict(obj.get("CanvasListOpenResult")) + canvas_open_request = CanvasOpenRequest.from_dict(obj.get("CanvasOpenRequest")) command_list = CommandList.from_dict(obj.get("CommandList")) commands_handle_pending_command_request = CommandsHandlePendingCommandRequest.from_dict(obj.get("CommandsHandlePendingCommandRequest")) commands_handle_pending_command_result = CommandsHandlePendingCommandResult.from_dict(obj.get("CommandsHandlePendingCommandResult")) @@ -14750,6 +15074,7 @@ def from_dict(obj: Any) -> 'RPC': copilot_user_response_quota_snapshots_completions = CopilotUserResponseQuotaSnapshotsCompletions.from_dict(obj.get("CopilotUserResponseQuotaSnapshotsCompletions")) copilot_user_response_quota_snapshots_premium_interactions = CopilotUserResponseQuotaSnapshotsPremiumInteractions.from_dict(obj.get("CopilotUserResponseQuotaSnapshotsPremiumInteractions")) current_model = CurrentModel.from_dict(obj.get("CurrentModel")) + discovered_canvas = DiscoveredCanvas.from_dict(obj.get("DiscoveredCanvas")) discovered_mcp_server = DiscoveredMCPServer.from_dict(obj.get("DiscoveredMcpServer")) discovered_mcp_server_type = DiscoveredMCPServerType(obj.get("DiscoveredMcpServerType")) enqueue_command_params = EnqueueCommandParams.from_dict(obj.get("EnqueueCommandParams")) @@ -14907,6 +15232,7 @@ def from_dict(obj: Any) -> 'RPC': name_set_auto_request = NameSetAutoRequest.from_dict(obj.get("NameSetAutoRequest")) name_set_auto_result = NameSetAutoResult.from_dict(obj.get("NameSetAutoResult")) name_set_request = NameSetRequest.from_dict(obj.get("NameSetRequest")) + open_canvas_instance = OpenCanvasInstance.from_dict(obj.get("OpenCanvasInstance")) options_update_env_value_mode = MCPSetEnvValueModeDetails(obj.get("OptionsUpdateEnvValueMode")) pending_permission_request = PendingPermissionRequest.from_dict(obj.get("PendingPermissionRequest")) pending_permission_request_list = PendingPermissionRequestList.from_dict(obj.get("PendingPermissionRequestList")) @@ -15244,7 +15570,7 @@ def from_dict(obj: Any) -> 'RPC': session_context_info = from_union([SessionContextInfo.from_dict, from_none], obj.get("SessionContextInfo")) task_progress = from_union([TaskProgress.from_dict, from_none], obj.get("TaskProgress")) workspace_summary = from_union([WorkspaceSummary.from_dict, from_none], obj.get("WorkspaceSummary")) - return RPC(abort_request, abort_result, account_get_quota_request, account_get_quota_result, account_quota_snapshot, agent_get_current_result, agent_info, agent_info_source, agent_list, agent_reload_result, agent_select_request, agent_select_result, api_key_auth_info, auth_info, auth_info_type, command_list, commands_handle_pending_command_request, commands_handle_pending_command_result, commands_invoke_request, commands_list_request, commands_respond_to_queued_command_request, commands_respond_to_queued_command_result, connected_remote_session_metadata, connected_remote_session_metadata_kind, connected_remote_session_metadata_repository, connect_remote_session_params, connect_request, connect_result, content_filter_mode, copilot_api_token_auth_info, copilot_user_response, copilot_user_response_endpoints, copilot_user_response_quota_snapshots, copilot_user_response_quota_snapshots_chat, copilot_user_response_quota_snapshots_completions, copilot_user_response_quota_snapshots_premium_interactions, current_model, discovered_mcp_server, discovered_mcp_server_type, enqueue_command_params, enqueue_command_result, env_auth_info, event_log_read_request, event_log_release_interest_result, event_log_tail_result, event_log_types, events_agent_scope, events_cursor_status, events_read_result, execute_command_params, execute_command_result, extension, extension_list, extensions_disable_request, extensions_enable_request, extension_source, extension_status, external_tool_result, external_tool_text_result_for_llm, external_tool_text_result_for_llm_binary_results_for_llm, external_tool_text_result_for_llm_binary_results_for_llm_type, external_tool_text_result_for_llm_content, external_tool_text_result_for_llm_content_audio, external_tool_text_result_for_llm_content_image, external_tool_text_result_for_llm_content_resource, external_tool_text_result_for_llm_content_resource_details, external_tool_text_result_for_llm_content_resource_link, external_tool_text_result_for_llm_content_resource_link_icon, external_tool_text_result_for_llm_content_resource_link_icon_theme, external_tool_text_result_for_llm_content_terminal, external_tool_text_result_for_llm_content_text, filter_mapping, fleet_start_request, fleet_start_result, folder_trust_add_params, folder_trust_check_params, folder_trust_check_result, gh_cli_auth_info, handle_pending_tool_call_request, handle_pending_tool_call_result, history_abort_manual_compaction_result, history_cancel_background_compaction_result, history_compact_context_window, history_compact_request, history_compact_result, history_summarize_for_handoff_result, history_truncate_request, history_truncate_result, hmac_auth_info, installed_plugin, installed_plugin_source, installed_plugin_source_github, installed_plugin_source_local, installed_plugin_source_url, instructions_get_sources_result, instructions_sources, instructions_sources_location, instructions_sources_type, log_request, log_result, lsp_initialize_request, mcp_apps_call_tool_request, mcp_apps_diagnose_capability, mcp_apps_diagnose_request, mcp_apps_diagnose_result, mcp_apps_diagnose_server, mcp_apps_host_context, mcp_apps_host_context_details, mcp_apps_host_context_details_available_display_mode, mcp_apps_host_context_details_display_mode, mcp_apps_host_context_details_platform, mcp_apps_host_context_details_theme, mcp_apps_list_tools_request, mcp_apps_list_tools_result, mcp_apps_read_resource_request, mcp_apps_read_resource_result, mcp_apps_resource_content, mcp_apps_set_host_context_details, mcp_apps_set_host_context_details_available_display_mode, mcp_apps_set_host_context_details_display_mode, mcp_apps_set_host_context_details_platform, mcp_apps_set_host_context_details_theme, mcp_apps_set_host_context_request, mcp_cancel_sampling_execution_params, mcp_cancel_sampling_execution_result, mcp_config_add_request, mcp_config_disable_request, mcp_config_enable_request, mcp_config_list, mcp_config_remove_request, mcp_config_update_request, mcp_disable_request, mcp_discover_request, mcp_discover_result, mcp_enable_request, mcp_execute_sampling_params, mcp_execute_sampling_request, mcp_execute_sampling_result, mcp_oauth_login_request, mcp_oauth_login_result, mcp_remove_git_hub_result, mcp_sampling_execution_action, mcp_sampling_execution_result, mcp_server, mcp_server_config, mcp_server_config_http, mcp_server_config_http_auth, mcp_server_config_http_oauth_grant_type, mcp_server_config_http_type, mcp_server_config_stdio, mcp_server_list, mcp_set_env_value_mode_details, mcp_set_env_value_mode_params, mcp_set_env_value_mode_result, metadata_context_info_request, metadata_context_info_result, metadata_is_processing_result, metadata_recompute_context_tokens_request, metadata_recompute_context_tokens_result, metadata_record_context_change_request, metadata_record_context_change_result, metadata_set_working_directory_request, metadata_set_working_directory_result, metadata_snapshot_current_mode, metadata_snapshot_remote_metadata, metadata_snapshot_remote_metadata_repository, metadata_snapshot_remote_metadata_task_type, model, model_billing, model_billing_token_prices, model_billing_token_prices_long_context, model_capabilities, model_capabilities_limits, model_capabilities_limits_vision, model_capabilities_override, model_capabilities_override_limits, model_capabilities_override_limits_vision, model_capabilities_override_supports, model_capabilities_supports, model_list, model_picker_category, model_picker_price_category, model_policy, model_policy_state, model_set_reasoning_effort_request, model_set_reasoning_effort_result, models_list_request, model_switch_to_request, model_switch_to_result, mode_set_request, name_get_result, name_set_auto_request, name_set_auto_result, name_set_request, options_update_env_value_mode, pending_permission_request, pending_permission_request_list, permission_decision, permission_decision_approved, permission_decision_approved_for_location, permission_decision_approved_for_session, permission_decision_approve_for_location, permission_decision_approve_for_location_approval, permission_decision_approve_for_location_approval_commands, permission_decision_approve_for_location_approval_custom_tool, permission_decision_approve_for_location_approval_extension_management, permission_decision_approve_for_location_approval_extension_permission_access, permission_decision_approve_for_location_approval_mcp, permission_decision_approve_for_location_approval_mcp_sampling, permission_decision_approve_for_location_approval_memory, permission_decision_approve_for_location_approval_read, permission_decision_approve_for_location_approval_write, permission_decision_approve_for_session, permission_decision_approve_for_session_approval, permission_decision_approve_for_session_approval_commands, permission_decision_approve_for_session_approval_custom_tool, permission_decision_approve_for_session_approval_extension_management, permission_decision_approve_for_session_approval_extension_permission_access, permission_decision_approve_for_session_approval_mcp, permission_decision_approve_for_session_approval_mcp_sampling, permission_decision_approve_for_session_approval_memory, permission_decision_approve_for_session_approval_read, permission_decision_approve_for_session_approval_write, permission_decision_approve_once, permission_decision_approve_permanently, permission_decision_cancelled, permission_decision_denied_by_content_exclusion_policy, permission_decision_denied_by_permission_request_hook, permission_decision_denied_by_rules, permission_decision_denied_interactively_by_user, permission_decision_denied_no_approval_rule_and_could_not_request_from_user, permission_decision_reject, permission_decision_request, permission_decision_user_not_available, permission_location_add_tool_approval_params, permission_location_apply_params, permission_location_apply_result, permission_location_resolve_params, permission_location_resolve_result, permission_location_type, permission_paths_add_params, permission_paths_allowed_check_params, permission_paths_allowed_check_result, permission_paths_config, permission_paths_list, permission_paths_update_primary_params, permission_paths_workspace_check_params, permission_paths_workspace_check_result, permission_prompt_shown_notification, permission_request_result, permission_rules_set, permissions_configure_additional_content_exclusion_policy, permissions_configure_additional_content_exclusion_policy_rule, permissions_configure_additional_content_exclusion_policy_rule_source, permissions_configure_additional_content_exclusion_policy_scope, permissions_configure_params, permissions_configure_result, permissions_folder_trust_add_trusted_result, permissions_locations_add_tool_approval_details, permissions_locations_add_tool_approval_details_commands, permissions_locations_add_tool_approval_details_custom_tool, permissions_locations_add_tool_approval_details_extension_management, permissions_locations_add_tool_approval_details_extension_permission_access, permissions_locations_add_tool_approval_details_mcp, permissions_locations_add_tool_approval_details_mcp_sampling, permissions_locations_add_tool_approval_details_memory, permissions_locations_add_tool_approval_details_read, permissions_locations_add_tool_approval_details_write, permissions_locations_add_tool_approval_result, permissions_modify_rules_params, permissions_modify_rules_result, permissions_modify_rules_scope, permissions_notify_prompt_shown_result, permissions_paths_add_result, permissions_paths_list_request, permissions_paths_update_primary_result, permissions_pending_requests_request, permissions_reset_session_approvals_request, permissions_reset_session_approvals_result, permissions_set_approve_all_request, permissions_set_approve_all_result, permissions_set_approve_all_source, permissions_set_required_request, permissions_set_required_result, permissions_urls_set_unrestricted_mode_result, permission_urls_config, permission_urls_set_unrestricted_mode_params, ping_request, ping_result, plan_read_result, plan_update_request, plugin, plugin_list, queued_command_handled, queued_command_not_handled, queued_command_result, queue_pending_items, queue_pending_items_kind, queue_pending_items_result, queue_remove_most_recent_result, register_event_interest_params, register_event_interest_result, release_event_interest_params, remote_enable_request, remote_enable_result, remote_notify_steerable_changed_request, remote_notify_steerable_changed_result, remote_session_connection_result, remote_session_mode, schedule_entry, schedule_list, schedule_stop_request, schedule_stop_result, secrets_add_filter_values_request, secrets_add_filter_values_result, send_agent_mode, send_attachment, send_attachment_blob, send_attachment_directory, send_attachment_file, send_attachment_file_line_range, send_attachment_github_reference, send_attachment_github_reference_type, send_attachment_selection, send_attachment_selection_details, send_attachment_selection_details_end, send_attachment_selection_details_start, send_mode, send_request, send_result, server_skill, server_skill_list, session_auth_status, session_bulk_delete_result, session_context, session_context_host_type, session_enrich_metadata_result, session_fs_append_file_request, session_fs_error, session_fs_error_code, session_fs_exists_request, session_fs_exists_result, session_fs_mkdir_request, session_fs_readdir_request, session_fs_readdir_result, session_fs_readdir_with_types_entry, session_fs_readdir_with_types_entry_type, session_fs_readdir_with_types_request, session_fs_readdir_with_types_result, session_fs_read_file_request, session_fs_read_file_result, session_fs_rename_request, session_fs_rm_request, session_fs_set_provider_capabilities, session_fs_set_provider_conventions, session_fs_set_provider_request, session_fs_set_provider_result, session_fs_sqlite_exists_request, session_fs_sqlite_exists_result, session_fs_sqlite_query_request, session_fs_sqlite_query_result, session_fs_sqlite_query_type, session_fs_stat_request, session_fs_stat_result, session_fs_write_file_request, session_installed_plugin, session_installed_plugin_source, session_installed_plugin_source_github, session_installed_plugin_source_local, session_installed_plugin_source_url, session_list, session_list_filter, session_load_deferred_repo_hooks_result, session_log_level, session_mcp_apps_call_tool_result, session_metadata, session_metadata_snapshot, session_mode, session_prune_result, sessions_bulk_delete_request, sessions_check_in_use_request, sessions_check_in_use_result, sessions_close_request, sessions_close_result, sessions_enrich_metadata_request, session_set_credentials_params, session_set_credentials_result, sessions_find_by_prefix_request, sessions_find_by_prefix_result, sessions_find_by_task_id_request, sessions_find_by_task_id_result, sessions_fork_request, sessions_fork_result, sessions_get_event_file_path_request, sessions_get_event_file_path_result, sessions_get_last_for_context_request, sessions_get_last_for_context_result, sessions_get_persisted_remote_steerable_request, sessions_get_persisted_remote_steerable_result, session_sizes, sessions_list_request, sessions_load_deferred_repo_hooks_request, sessions_prune_old_request, sessions_release_lock_request, sessions_release_lock_result, sessions_reload_plugin_hooks_request, sessions_reload_plugin_hooks_result, sessions_save_request, sessions_save_result, sessions_set_additional_plugins_request, sessions_set_additional_plugins_result, session_update_options_params, session_update_options_result, session_working_directory_context, session_working_directory_context_host_type, shell_exec_request, shell_exec_result, shell_kill_request, shell_kill_result, shell_kill_signal, shutdown_request, skill, skill_list, skills_config_set_disabled_skills_request, skills_disable_request, skills_discover_request, skills_enable_request, skills_get_invoked_result, skills_invoked_skill, skills_load_diagnostics, slash_command_agent_prompt_result, slash_command_completed_result, slash_command_info, slash_command_input, slash_command_input_completion, slash_command_invocation_result, slash_command_kind, slash_command_select_subcommand_option, slash_command_select_subcommand_result, slash_command_text_result, task_agent_info, task_agent_progress, task_execution_mode, task_info, task_list, task_progress_line, tasks_cancel_request, tasks_cancel_result, tasks_get_current_promotable_result, tasks_get_progress_request, tasks_get_progress_result, task_shell_info, task_shell_info_attachment_mode, task_shell_progress, tasks_promote_current_to_background_result, tasks_promote_to_background_request, tasks_promote_to_background_result, tasks_refresh_result, tasks_remove_request, tasks_remove_result, tasks_send_message_request, tasks_send_message_result, tasks_start_agent_request, tasks_start_agent_result, task_status, tasks_wait_for_pending_result, telemetry_set_feature_overrides_request, token_auth_info, tool, tool_list, tools_initialize_and_validate_result, tools_list_request, ui_auto_mode_switch_response, ui_elicitation_array_any_of_field, ui_elicitation_array_any_of_field_items, ui_elicitation_array_any_of_field_items_any_of, ui_elicitation_array_enum_field, ui_elicitation_array_enum_field_items, ui_elicitation_field_value, ui_elicitation_request, ui_elicitation_response, ui_elicitation_response_action, ui_elicitation_response_content, ui_elicitation_result, ui_elicitation_schema, ui_elicitation_schema_property, ui_elicitation_schema_property_boolean, ui_elicitation_schema_property_number, ui_elicitation_schema_property_number_type, ui_elicitation_schema_property_string, ui_elicitation_schema_property_string_format, ui_elicitation_string_enum_field, ui_elicitation_string_one_of_field, ui_elicitation_string_one_of_field_one_of, ui_exit_plan_mode_action, ui_exit_plan_mode_response, ui_handle_pending_auto_mode_switch_request, ui_handle_pending_elicitation_request, ui_handle_pending_exit_plan_mode_request, ui_handle_pending_result, ui_handle_pending_sampling_request, ui_handle_pending_sampling_response, ui_handle_pending_user_input_request, ui_register_direct_auto_mode_switch_handler_result, ui_unregister_direct_auto_mode_switch_handler_request, ui_unregister_direct_auto_mode_switch_handler_result, ui_user_input_response, usage_get_metrics_result, usage_metrics_code_changes, usage_metrics_model_metric, usage_metrics_model_metric_requests, usage_metrics_model_metric_token_detail, usage_metrics_model_metric_usage, usage_metrics_token_detail, user_auth_info, workspaces_checkpoints, workspaces_create_file_request, workspaces_get_workspace_result, workspaces_list_checkpoints_result, workspaces_list_files_result, workspaces_read_checkpoint_request, workspaces_read_checkpoint_result, workspaces_read_file_request, workspaces_read_file_result, workspaces_save_large_paste_request, workspaces_save_large_paste_result, workspace_summary_host_type, workspaces_workspace_details_host_type, session_context_info, task_progress, workspace_summary) + return RPC(abort_request, abort_result, account_get_quota_request, account_get_quota_result, account_quota_snapshot, agent_get_current_result, agent_info, agent_info_source, agent_list, agent_reload_result, agent_select_request, agent_select_result, api_key_auth_info, auth_info, auth_info_type, canvas_action, canvas_close_request, canvas_instance_availability, canvas_invoke_action_request, canvas_invoke_action_result, canvas_json_schema, canvas_list, canvas_list_open_result, canvas_open_request, command_list, commands_handle_pending_command_request, commands_handle_pending_command_result, commands_invoke_request, commands_list_request, commands_respond_to_queued_command_request, commands_respond_to_queued_command_result, connected_remote_session_metadata, connected_remote_session_metadata_kind, connected_remote_session_metadata_repository, connect_remote_session_params, connect_request, connect_result, content_filter_mode, copilot_api_token_auth_info, copilot_user_response, copilot_user_response_endpoints, copilot_user_response_quota_snapshots, copilot_user_response_quota_snapshots_chat, copilot_user_response_quota_snapshots_completions, copilot_user_response_quota_snapshots_premium_interactions, current_model, discovered_canvas, discovered_mcp_server, discovered_mcp_server_type, enqueue_command_params, enqueue_command_result, env_auth_info, event_log_read_request, event_log_release_interest_result, event_log_tail_result, event_log_types, events_agent_scope, events_cursor_status, events_read_result, execute_command_params, execute_command_result, extension, extension_list, extensions_disable_request, extensions_enable_request, extension_source, extension_status, external_tool_result, external_tool_text_result_for_llm, external_tool_text_result_for_llm_binary_results_for_llm, external_tool_text_result_for_llm_binary_results_for_llm_type, external_tool_text_result_for_llm_content, external_tool_text_result_for_llm_content_audio, external_tool_text_result_for_llm_content_image, external_tool_text_result_for_llm_content_resource, external_tool_text_result_for_llm_content_resource_details, external_tool_text_result_for_llm_content_resource_link, external_tool_text_result_for_llm_content_resource_link_icon, external_tool_text_result_for_llm_content_resource_link_icon_theme, external_tool_text_result_for_llm_content_terminal, external_tool_text_result_for_llm_content_text, filter_mapping, fleet_start_request, fleet_start_result, folder_trust_add_params, folder_trust_check_params, folder_trust_check_result, gh_cli_auth_info, handle_pending_tool_call_request, handle_pending_tool_call_result, history_abort_manual_compaction_result, history_cancel_background_compaction_result, history_compact_context_window, history_compact_request, history_compact_result, history_summarize_for_handoff_result, history_truncate_request, history_truncate_result, hmac_auth_info, installed_plugin, installed_plugin_source, installed_plugin_source_github, installed_plugin_source_local, installed_plugin_source_url, instructions_get_sources_result, instructions_sources, instructions_sources_location, instructions_sources_type, log_request, log_result, lsp_initialize_request, mcp_apps_call_tool_request, mcp_apps_diagnose_capability, mcp_apps_diagnose_request, mcp_apps_diagnose_result, mcp_apps_diagnose_server, mcp_apps_host_context, mcp_apps_host_context_details, mcp_apps_host_context_details_available_display_mode, mcp_apps_host_context_details_display_mode, mcp_apps_host_context_details_platform, mcp_apps_host_context_details_theme, mcp_apps_list_tools_request, mcp_apps_list_tools_result, mcp_apps_read_resource_request, mcp_apps_read_resource_result, mcp_apps_resource_content, mcp_apps_set_host_context_details, mcp_apps_set_host_context_details_available_display_mode, mcp_apps_set_host_context_details_display_mode, mcp_apps_set_host_context_details_platform, mcp_apps_set_host_context_details_theme, mcp_apps_set_host_context_request, mcp_cancel_sampling_execution_params, mcp_cancel_sampling_execution_result, mcp_config_add_request, mcp_config_disable_request, mcp_config_enable_request, mcp_config_list, mcp_config_remove_request, mcp_config_update_request, mcp_disable_request, mcp_discover_request, mcp_discover_result, mcp_enable_request, mcp_execute_sampling_params, mcp_execute_sampling_request, mcp_execute_sampling_result, mcp_oauth_login_request, mcp_oauth_login_result, mcp_remove_git_hub_result, mcp_sampling_execution_action, mcp_sampling_execution_result, mcp_server, mcp_server_config, mcp_server_config_http, mcp_server_config_http_auth, mcp_server_config_http_oauth_grant_type, mcp_server_config_http_type, mcp_server_config_stdio, mcp_server_list, mcp_set_env_value_mode_details, mcp_set_env_value_mode_params, mcp_set_env_value_mode_result, metadata_context_info_request, metadata_context_info_result, metadata_is_processing_result, metadata_recompute_context_tokens_request, metadata_recompute_context_tokens_result, metadata_record_context_change_request, metadata_record_context_change_result, metadata_set_working_directory_request, metadata_set_working_directory_result, metadata_snapshot_current_mode, metadata_snapshot_remote_metadata, metadata_snapshot_remote_metadata_repository, metadata_snapshot_remote_metadata_task_type, model, model_billing, model_billing_token_prices, model_billing_token_prices_long_context, model_capabilities, model_capabilities_limits, model_capabilities_limits_vision, model_capabilities_override, model_capabilities_override_limits, model_capabilities_override_limits_vision, model_capabilities_override_supports, model_capabilities_supports, model_list, model_picker_category, model_picker_price_category, model_policy, model_policy_state, model_set_reasoning_effort_request, model_set_reasoning_effort_result, models_list_request, model_switch_to_request, model_switch_to_result, mode_set_request, name_get_result, name_set_auto_request, name_set_auto_result, name_set_request, open_canvas_instance, options_update_env_value_mode, pending_permission_request, pending_permission_request_list, permission_decision, permission_decision_approved, permission_decision_approved_for_location, permission_decision_approved_for_session, permission_decision_approve_for_location, permission_decision_approve_for_location_approval, permission_decision_approve_for_location_approval_commands, permission_decision_approve_for_location_approval_custom_tool, permission_decision_approve_for_location_approval_extension_management, permission_decision_approve_for_location_approval_extension_permission_access, permission_decision_approve_for_location_approval_mcp, permission_decision_approve_for_location_approval_mcp_sampling, permission_decision_approve_for_location_approval_memory, permission_decision_approve_for_location_approval_read, permission_decision_approve_for_location_approval_write, permission_decision_approve_for_session, permission_decision_approve_for_session_approval, permission_decision_approve_for_session_approval_commands, permission_decision_approve_for_session_approval_custom_tool, permission_decision_approve_for_session_approval_extension_management, permission_decision_approve_for_session_approval_extension_permission_access, permission_decision_approve_for_session_approval_mcp, permission_decision_approve_for_session_approval_mcp_sampling, permission_decision_approve_for_session_approval_memory, permission_decision_approve_for_session_approval_read, permission_decision_approve_for_session_approval_write, permission_decision_approve_once, permission_decision_approve_permanently, permission_decision_cancelled, permission_decision_denied_by_content_exclusion_policy, permission_decision_denied_by_permission_request_hook, permission_decision_denied_by_rules, permission_decision_denied_interactively_by_user, permission_decision_denied_no_approval_rule_and_could_not_request_from_user, permission_decision_reject, permission_decision_request, permission_decision_user_not_available, permission_location_add_tool_approval_params, permission_location_apply_params, permission_location_apply_result, permission_location_resolve_params, permission_location_resolve_result, permission_location_type, permission_paths_add_params, permission_paths_allowed_check_params, permission_paths_allowed_check_result, permission_paths_config, permission_paths_list, permission_paths_update_primary_params, permission_paths_workspace_check_params, permission_paths_workspace_check_result, permission_prompt_shown_notification, permission_request_result, permission_rules_set, permissions_configure_additional_content_exclusion_policy, permissions_configure_additional_content_exclusion_policy_rule, permissions_configure_additional_content_exclusion_policy_rule_source, permissions_configure_additional_content_exclusion_policy_scope, permissions_configure_params, permissions_configure_result, permissions_folder_trust_add_trusted_result, permissions_locations_add_tool_approval_details, permissions_locations_add_tool_approval_details_commands, permissions_locations_add_tool_approval_details_custom_tool, permissions_locations_add_tool_approval_details_extension_management, permissions_locations_add_tool_approval_details_extension_permission_access, permissions_locations_add_tool_approval_details_mcp, permissions_locations_add_tool_approval_details_mcp_sampling, permissions_locations_add_tool_approval_details_memory, permissions_locations_add_tool_approval_details_read, permissions_locations_add_tool_approval_details_write, permissions_locations_add_tool_approval_result, permissions_modify_rules_params, permissions_modify_rules_result, permissions_modify_rules_scope, permissions_notify_prompt_shown_result, permissions_paths_add_result, permissions_paths_list_request, permissions_paths_update_primary_result, permissions_pending_requests_request, permissions_reset_session_approvals_request, permissions_reset_session_approvals_result, permissions_set_approve_all_request, permissions_set_approve_all_result, permissions_set_approve_all_source, permissions_set_required_request, permissions_set_required_result, permissions_urls_set_unrestricted_mode_result, permission_urls_config, permission_urls_set_unrestricted_mode_params, ping_request, ping_result, plan_read_result, plan_update_request, plugin, plugin_list, queued_command_handled, queued_command_not_handled, queued_command_result, queue_pending_items, queue_pending_items_kind, queue_pending_items_result, queue_remove_most_recent_result, register_event_interest_params, register_event_interest_result, release_event_interest_params, remote_enable_request, remote_enable_result, remote_notify_steerable_changed_request, remote_notify_steerable_changed_result, remote_session_connection_result, remote_session_mode, schedule_entry, schedule_list, schedule_stop_request, schedule_stop_result, secrets_add_filter_values_request, secrets_add_filter_values_result, send_agent_mode, send_attachment, send_attachment_blob, send_attachment_directory, send_attachment_file, send_attachment_file_line_range, send_attachment_github_reference, send_attachment_github_reference_type, send_attachment_selection, send_attachment_selection_details, send_attachment_selection_details_end, send_attachment_selection_details_start, send_mode, send_request, send_result, server_skill, server_skill_list, session_auth_status, session_bulk_delete_result, session_context, session_context_host_type, session_enrich_metadata_result, session_fs_append_file_request, session_fs_error, session_fs_error_code, session_fs_exists_request, session_fs_exists_result, session_fs_mkdir_request, session_fs_readdir_request, session_fs_readdir_result, session_fs_readdir_with_types_entry, session_fs_readdir_with_types_entry_type, session_fs_readdir_with_types_request, session_fs_readdir_with_types_result, session_fs_read_file_request, session_fs_read_file_result, session_fs_rename_request, session_fs_rm_request, session_fs_set_provider_capabilities, session_fs_set_provider_conventions, session_fs_set_provider_request, session_fs_set_provider_result, session_fs_sqlite_exists_request, session_fs_sqlite_exists_result, session_fs_sqlite_query_request, session_fs_sqlite_query_result, session_fs_sqlite_query_type, session_fs_stat_request, session_fs_stat_result, session_fs_write_file_request, session_installed_plugin, session_installed_plugin_source, session_installed_plugin_source_github, session_installed_plugin_source_local, session_installed_plugin_source_url, session_list, session_list_filter, session_load_deferred_repo_hooks_result, session_log_level, session_mcp_apps_call_tool_result, session_metadata, session_metadata_snapshot, session_mode, session_prune_result, sessions_bulk_delete_request, sessions_check_in_use_request, sessions_check_in_use_result, sessions_close_request, sessions_close_result, sessions_enrich_metadata_request, session_set_credentials_params, session_set_credentials_result, sessions_find_by_prefix_request, sessions_find_by_prefix_result, sessions_find_by_task_id_request, sessions_find_by_task_id_result, sessions_fork_request, sessions_fork_result, sessions_get_event_file_path_request, sessions_get_event_file_path_result, sessions_get_last_for_context_request, sessions_get_last_for_context_result, sessions_get_persisted_remote_steerable_request, sessions_get_persisted_remote_steerable_result, session_sizes, sessions_list_request, sessions_load_deferred_repo_hooks_request, sessions_prune_old_request, sessions_release_lock_request, sessions_release_lock_result, sessions_reload_plugin_hooks_request, sessions_reload_plugin_hooks_result, sessions_save_request, sessions_save_result, sessions_set_additional_plugins_request, sessions_set_additional_plugins_result, session_update_options_params, session_update_options_result, session_working_directory_context, session_working_directory_context_host_type, shell_exec_request, shell_exec_result, shell_kill_request, shell_kill_result, shell_kill_signal, shutdown_request, skill, skill_list, skills_config_set_disabled_skills_request, skills_disable_request, skills_discover_request, skills_enable_request, skills_get_invoked_result, skills_invoked_skill, skills_load_diagnostics, slash_command_agent_prompt_result, slash_command_completed_result, slash_command_info, slash_command_input, slash_command_input_completion, slash_command_invocation_result, slash_command_kind, slash_command_select_subcommand_option, slash_command_select_subcommand_result, slash_command_text_result, task_agent_info, task_agent_progress, task_execution_mode, task_info, task_list, task_progress_line, tasks_cancel_request, tasks_cancel_result, tasks_get_current_promotable_result, tasks_get_progress_request, tasks_get_progress_result, task_shell_info, task_shell_info_attachment_mode, task_shell_progress, tasks_promote_current_to_background_result, tasks_promote_to_background_request, tasks_promote_to_background_result, tasks_refresh_result, tasks_remove_request, tasks_remove_result, tasks_send_message_request, tasks_send_message_result, tasks_start_agent_request, tasks_start_agent_result, task_status, tasks_wait_for_pending_result, telemetry_set_feature_overrides_request, token_auth_info, tool, tool_list, tools_initialize_and_validate_result, tools_list_request, ui_auto_mode_switch_response, ui_elicitation_array_any_of_field, ui_elicitation_array_any_of_field_items, ui_elicitation_array_any_of_field_items_any_of, ui_elicitation_array_enum_field, ui_elicitation_array_enum_field_items, ui_elicitation_field_value, ui_elicitation_request, ui_elicitation_response, ui_elicitation_response_action, ui_elicitation_response_content, ui_elicitation_result, ui_elicitation_schema, ui_elicitation_schema_property, ui_elicitation_schema_property_boolean, ui_elicitation_schema_property_number, ui_elicitation_schema_property_number_type, ui_elicitation_schema_property_string, ui_elicitation_schema_property_string_format, ui_elicitation_string_enum_field, ui_elicitation_string_one_of_field, ui_elicitation_string_one_of_field_one_of, ui_exit_plan_mode_action, ui_exit_plan_mode_response, ui_handle_pending_auto_mode_switch_request, ui_handle_pending_elicitation_request, ui_handle_pending_exit_plan_mode_request, ui_handle_pending_result, ui_handle_pending_sampling_request, ui_handle_pending_sampling_response, ui_handle_pending_user_input_request, ui_register_direct_auto_mode_switch_handler_result, ui_unregister_direct_auto_mode_switch_handler_request, ui_unregister_direct_auto_mode_switch_handler_result, ui_user_input_response, usage_get_metrics_result, usage_metrics_code_changes, usage_metrics_model_metric, usage_metrics_model_metric_requests, usage_metrics_model_metric_token_detail, usage_metrics_model_metric_usage, usage_metrics_token_detail, user_auth_info, workspaces_checkpoints, workspaces_create_file_request, workspaces_get_workspace_result, workspaces_list_checkpoints_result, workspaces_list_files_result, workspaces_read_checkpoint_request, workspaces_read_checkpoint_result, workspaces_read_file_request, workspaces_read_file_result, workspaces_save_large_paste_request, workspaces_save_large_paste_result, workspace_summary_host_type, workspaces_workspace_details_host_type, session_context_info, task_progress, workspace_summary) def to_dict(self) -> dict: result: dict = {} @@ -15263,6 +15589,15 @@ def to_dict(self) -> dict: result["ApiKeyAuthInfo"] = to_class(APIKeyAuthInfo, self.api_key_auth_info) result["AuthInfo"] = (self.auth_info).to_dict() result["AuthInfoType"] = to_enum(AuthInfoType, self.auth_info_type) + result["CanvasAction"] = to_class(CanvasAction, self.canvas_action) + result["CanvasCloseRequest"] = to_class(CanvasCloseRequest, self.canvas_close_request) + result["CanvasInstanceAvailability"] = to_enum(CanvasInstanceAvailability, self.canvas_instance_availability) + result["CanvasInvokeActionRequest"] = to_class(CanvasInvokeActionRequest, self.canvas_invoke_action_request) + result["CanvasInvokeActionResult"] = to_class(CanvasInvokeActionResult, self.canvas_invoke_action_result) + result["CanvasJsonSchema"] = self.canvas_json_schema + result["CanvasList"] = to_class(CanvasList, self.canvas_list) + result["CanvasListOpenResult"] = to_class(CanvasListOpenResult, self.canvas_list_open_result) + result["CanvasOpenRequest"] = to_class(CanvasOpenRequest, self.canvas_open_request) result["CommandList"] = to_class(CommandList, self.command_list) result["CommandsHandlePendingCommandRequest"] = to_class(CommandsHandlePendingCommandRequest, self.commands_handle_pending_command_request) result["CommandsHandlePendingCommandResult"] = to_class(CommandsHandlePendingCommandResult, self.commands_handle_pending_command_result) @@ -15285,6 +15620,7 @@ def to_dict(self) -> dict: result["CopilotUserResponseQuotaSnapshotsCompletions"] = to_class(CopilotUserResponseQuotaSnapshotsCompletions, self.copilot_user_response_quota_snapshots_completions) result["CopilotUserResponseQuotaSnapshotsPremiumInteractions"] = to_class(CopilotUserResponseQuotaSnapshotsPremiumInteractions, self.copilot_user_response_quota_snapshots_premium_interactions) result["CurrentModel"] = to_class(CurrentModel, self.current_model) + result["DiscoveredCanvas"] = to_class(DiscoveredCanvas, self.discovered_canvas) result["DiscoveredMcpServer"] = to_class(DiscoveredMCPServer, self.discovered_mcp_server) result["DiscoveredMcpServerType"] = to_enum(DiscoveredMCPServerType, self.discovered_mcp_server_type) result["EnqueueCommandParams"] = to_class(EnqueueCommandParams, self.enqueue_command_params) @@ -15442,6 +15778,7 @@ def to_dict(self) -> dict: result["NameSetAutoRequest"] = to_class(NameSetAutoRequest, self.name_set_auto_request) result["NameSetAutoResult"] = to_class(NameSetAutoResult, self.name_set_auto_result) result["NameSetRequest"] = to_class(NameSetRequest, self.name_set_request) + result["OpenCanvasInstance"] = to_class(OpenCanvasInstance, self.open_canvas_instance) result["OptionsUpdateEnvValueMode"] = to_enum(MCPSetEnvValueModeDetails, self.options_update_env_value_mode) result["PendingPermissionRequest"] = to_class(PendingPermissionRequest, self.pending_permission_request) result["PendingPermissionRequestList"] = to_class(PendingPermissionRequestList, self.pending_permission_request_list) @@ -15946,6 +16283,7 @@ def _load_TaskInfo(obj: Any) -> "TaskInfo": case _: raise ValueError(f"Unknown TaskInfo type: {kind!r}") +CanvasJsonSchema = Any ExternalToolResult = ExternalToolTextResultForLlm ExternalToolTextResultForLlmContentResourceLinkIconTheme = Theme FilterMapping = dict @@ -16258,6 +16596,39 @@ async def set_credentials(self, params: SessionSetCredentialsParams, *, timeout: return SessionSetCredentialsResult.from_dict(await self._client.request("session.auth.setCredentials", params_dict, **_timeout_kwargs(timeout))) +# Experimental: this API group is experimental and may change or be removed. +class CanvasApi: + def __init__(self, client: "JsonRpcClient", session_id: str): + self._client = client + self._session_id = session_id + + async def list(self, *, timeout: float | None = None) -> CanvasList: + "Lists canvases declared for the session.\n\nReturns:\n Declared canvases available in this session." + return CanvasList.from_dict(await self._client.request("session.canvas.list", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) + + async def list_open(self, *, timeout: float | None = None) -> CanvasListOpenResult: + "Lists currently open canvas instances for the live session.\n\nReturns:\n Live open-canvas snapshot." + return CanvasListOpenResult.from_dict(await self._client.request("session.canvas.listOpen", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) + + async def open(self, params: CanvasOpenRequest, *, timeout: float | None = None) -> OpenCanvasInstance: + "Opens or focuses a canvas instance.\n\nArgs:\n params: Canvas open parameters.\n\nReturns:\n Open canvas instance snapshot." + params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} + params_dict["sessionId"] = self._session_id + return OpenCanvasInstance.from_dict(await self._client.request("session.canvas.open", params_dict, **_timeout_kwargs(timeout))) + + async def close(self, params: CanvasCloseRequest, *, timeout: float | None = None) -> None: + "Closes an open canvas instance.\n\nArgs:\n params: Canvas close parameters." + params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} + params_dict["sessionId"] = self._session_id + await self._client.request("session.canvas.close", params_dict, **_timeout_kwargs(timeout)) + + async def invoke_action(self, params: CanvasInvokeActionRequest, *, timeout: float | None = None) -> CanvasInvokeActionResult: + "Invokes an action on an open canvas instance.\n\nArgs:\n params: Canvas action invocation parameters.\n\nReturns:\n Canvas action invocation result." + params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} + params_dict["sessionId"] = self._session_id + return CanvasInvokeActionResult.from_dict(await self._client.request("session.canvas.invokeAction", params_dict, **_timeout_kwargs(timeout))) + + # Experimental: this API group is experimental and may change or be removed. class ModelApi: def __init__(self, client: "JsonRpcClient", session_id: str): @@ -17172,6 +17543,7 @@ def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id self.auth = AuthApi(client, session_id) + self.canvas = CanvasApi(client, session_id) self.model = ModelApi(client, session_id) self.mode = ModeApi(client, session_id) self.name = NameApi(client, session_id) diff --git a/python/copilot/generated/session_events.py b/python/copilot/generated/session_events.py index 5839c34db..219e6a365 100644 --- a/python/copilot/generated/session_events.py +++ b/python/copilot/generated/session_events.py @@ -202,6 +202,8 @@ class SessionEventType(Enum): SESSION_MCP_SERVERS_LOADED = "session.mcp_servers_loaded" SESSION_MCP_SERVER_STATUS_CHANGED = "session.mcp_server_status_changed" SESSION_EXTENSIONS_LOADED = "session.extensions_loaded" + SESSION_CANVAS_OPENED = "session.canvas.opened" + SESSION_CANVAS_REGISTRY_CHANGED = "session.canvas.registry_changed" MCP_APP_TOOL_CALL_COMPLETE = "mcp_app.tool_call_complete" UNKNOWN = "unknown" @@ -901,6 +903,81 @@ def to_dict(self) -> dict: return result +@dataclass +class CanvasRegistryChangedCanvas: + "Schema for the `CanvasRegistryChangedCanvas` type." + canvas_id: str + description: str + display_name: str + extension_id: str + actions: list[CanvasRegistryChangedCanvasAction] | None = None + extension_name: str | None = None + input_schema: dict[str, Any] | None = None + + @staticmethod + def from_dict(obj: Any) -> "CanvasRegistryChangedCanvas": + assert isinstance(obj, dict) + canvas_id = from_str(obj.get("canvasId")) + description = from_str(obj.get("description")) + display_name = from_str(obj.get("displayName")) + extension_id = from_str(obj.get("extensionId")) + actions = from_union([from_none, lambda x: from_list(CanvasRegistryChangedCanvasAction.from_dict, x)], obj.get("actions")) + extension_name = from_union([from_none, from_str], obj.get("extensionName")) + input_schema = from_union([from_none, lambda x: from_dict(lambda x: x, x)], obj.get("inputSchema")) + return CanvasRegistryChangedCanvas( + canvas_id=canvas_id, + description=description, + display_name=display_name, + extension_id=extension_id, + actions=actions, + extension_name=extension_name, + input_schema=input_schema, + ) + + def to_dict(self) -> dict: + result: dict = {} + result["canvasId"] = from_str(self.canvas_id) + result["description"] = from_str(self.description) + result["displayName"] = from_str(self.display_name) + result["extensionId"] = from_str(self.extension_id) + if self.actions is not None: + result["actions"] = from_union([from_none, lambda x: from_list(lambda x: to_class(CanvasRegistryChangedCanvasAction, x), x)], self.actions) + if self.extension_name is not None: + result["extensionName"] = from_union([from_none, from_str], self.extension_name) + if self.input_schema is not None: + result["inputSchema"] = from_union([from_none, lambda x: from_dict(lambda x: x, x)], self.input_schema) + return result + + +@dataclass +class CanvasRegistryChangedCanvasAction: + "Schema for the `CanvasRegistryChangedCanvasAction` type." + name: str + description: str | None = None + input_schema: dict[str, Any] | None = None + + @staticmethod + def from_dict(obj: Any) -> "CanvasRegistryChangedCanvasAction": + assert isinstance(obj, dict) + name = from_str(obj.get("name")) + description = from_union([from_none, from_str], obj.get("description")) + input_schema = from_union([from_none, lambda x: from_dict(lambda x: x, x)], obj.get("inputSchema")) + return CanvasRegistryChangedCanvasAction( + name=name, + description=description, + input_schema=input_schema, + ) + + def to_dict(self) -> dict: + result: dict = {} + result["name"] = from_str(self.name) + if self.description is not None: + result["description"] = from_union([from_none, from_str], self.description) + if self.input_schema is not None: + result["inputSchema"] = from_union([from_none, lambda x: from_dict(lambda x: x, x)], self.input_schema) + return result + + @dataclass class CapabilitiesChangedData: "Session capability change notification" @@ -924,21 +1001,26 @@ def to_dict(self) -> dict: @dataclass class CapabilitiesChangedUI: "UI capability changes" + canvases: bool | None = None elicitation: bool | None = None mcp_apps: bool | None = None @staticmethod def from_dict(obj: Any) -> "CapabilitiesChangedUI": assert isinstance(obj, dict) + canvases = from_union([from_none, from_bool], obj.get("canvases")) elicitation = from_union([from_none, from_bool], obj.get("elicitation")) mcp_apps = from_union([from_none, from_bool], obj.get("mcpApps")) return CapabilitiesChangedUI( + canvases=canvases, elicitation=elicitation, mcp_apps=mcp_apps, ) def to_dict(self) -> dict: result: dict = {} + if self.canvases is not None: + result["canvases"] = from_union([from_none, from_bool], self.canvases) if self.elicitation is not None: result["elicitation"] = from_union([from_none, from_bool], self.elicitation) if self.mcp_apps is not None: @@ -3145,6 +3227,85 @@ def to_dict(self) -> dict: return {} +@dataclass +class SessionCanvasOpenedData: + "Schema for the `CanvasOpenedData` type." + availability: CanvasOpenedAvailability + canvas_id: str + extension_id: str + instance_id: str + reopen: bool + extension_name: str | None = None + input: Any = None + status: str | None = None + title: str | None = None + url: str | None = None + + @staticmethod + def from_dict(obj: Any) -> "SessionCanvasOpenedData": + assert isinstance(obj, dict) + availability = parse_enum(CanvasOpenedAvailability, obj.get("availability")) + canvas_id = from_str(obj.get("canvasId")) + extension_id = from_str(obj.get("extensionId")) + instance_id = from_str(obj.get("instanceId")) + reopen = from_bool(obj.get("reopen")) + extension_name = from_union([from_none, from_str], obj.get("extensionName")) + input = obj.get("input") + status = from_union([from_none, from_str], obj.get("status")) + title = from_union([from_none, from_str], obj.get("title")) + url = from_union([from_none, from_str], obj.get("url")) + return SessionCanvasOpenedData( + availability=availability, + canvas_id=canvas_id, + extension_id=extension_id, + instance_id=instance_id, + reopen=reopen, + extension_name=extension_name, + input=input, + status=status, + title=title, + url=url, + ) + + def to_dict(self) -> dict: + result: dict = {} + result["availability"] = to_enum(CanvasOpenedAvailability, self.availability) + result["canvasId"] = from_str(self.canvas_id) + result["extensionId"] = from_str(self.extension_id) + result["instanceId"] = from_str(self.instance_id) + result["reopen"] = from_bool(self.reopen) + if self.extension_name is not None: + result["extensionName"] = from_union([from_none, from_str], self.extension_name) + if self.input is not None: + result["input"] = self.input + if self.status is not None: + result["status"] = from_union([from_none, from_str], self.status) + if self.title is not None: + result["title"] = from_union([from_none, from_str], self.title) + if self.url is not None: + result["url"] = from_union([from_none, from_str], self.url) + return result + + +@dataclass +class SessionCanvasRegistryChangedData: + "Schema for the `CanvasRegistryChangedData` type." + canvases: list[CanvasRegistryChangedCanvas] + + @staticmethod + def from_dict(obj: Any) -> "SessionCanvasRegistryChangedData": + assert isinstance(obj, dict) + canvases = from_list(CanvasRegistryChangedCanvas.from_dict, obj.get("canvases")) + return SessionCanvasRegistryChangedData( + canvases=canvases, + ) + + def to_dict(self) -> dict: + result: dict = {} + result["canvases"] = from_list(lambda x: to_class(CanvasRegistryChangedCanvas, x), self.canvases) + return result + + @dataclass class SessionCompactionCompleteData: "Conversation compaction results including success status, metrics, and optional error details" @@ -6475,6 +6636,14 @@ class AutoModeSwitchResponse(Enum): NO = "no" +class CanvasOpenedAvailability(Enum): + "Runtime-controlled routing state for the instance. \"ready\" when the provider connection is live; \"stale\" when the provider has gone away and the instance is awaiting rebinding." + # Provider connection is live; actions can be invoked. + READY = "ready" + # Provider has gone away; the instance is awaiting rebinding. + STALE = "stale" + + class ElicitationCompletedAction(Enum): "The user action: \"accept\" (submitted form), \"decline\" (explicitly refused), or \"cancel\" (dismissed)" # The user submitted the requested form. @@ -6752,7 +6921,7 @@ class WorkspaceFileChangedOperation(Enum): UPDATE = "update" -SessionEventData = SessionStartData | SessionResumeData | SessionRemoteSteerableChangedData | SessionErrorData | SessionIdleData | SessionTitleChangedData | SessionScheduleCreatedData | SessionScheduleCancelledData | SessionInfoData | SessionWarningData | SessionModelChangeData | SessionModeChangedData | SessionPlanChangedData | SessionWorkspaceFileChangedData | SessionHandoffData | SessionTruncationData | SessionSnapshotRewindData | SessionShutdownData | SessionContextChangedData | SessionUsageInfoData | SessionCompactionStartData | SessionCompactionCompleteData | SessionTaskCompleteData | UserMessageData | PendingMessagesModifiedData | AssistantTurnStartData | AssistantIntentData | AssistantReasoningData | AssistantReasoningDeltaData | AssistantStreamingDeltaData | AssistantMessageData | AssistantMessageStartData | AssistantMessageDeltaData | AssistantTurnEndData | AssistantUsageData | ModelCallFailureData | AbortData | ToolUserRequestedData | ToolExecutionStartData | ToolExecutionPartialResultData | ToolExecutionProgressData | ToolExecutionCompleteData | SkillInvokedData | SubagentStartedData | SubagentCompletedData | SubagentFailedData | SubagentSelectedData | SubagentDeselectedData | HookStartData | HookEndData | SystemMessageData | SystemNotificationData | PermissionRequestedData | PermissionCompletedData | UserInputRequestedData | UserInputCompletedData | ElicitationRequestedData | ElicitationCompletedData | SamplingRequestedData | SamplingCompletedData | McpOauthRequiredData | McpOauthCompletedData | SessionCustomNotificationData | ExternalToolRequestedData | ExternalToolCompletedData | CommandQueuedData | CommandExecuteData | CommandCompletedData | AutoModeSwitchRequestedData | AutoModeSwitchCompletedData | CommandsChangedData | CapabilitiesChangedData | ExitPlanModeRequestedData | ExitPlanModeCompletedData | SessionToolsUpdatedData | SessionBackgroundTasksChangedData | SessionSkillsLoadedData | SessionCustomAgentsUpdatedData | SessionMcpServersLoadedData | SessionMcpServerStatusChangedData | SessionExtensionsLoadedData | McpAppToolCallCompleteData | RawSessionEventData | Data +SessionEventData = SessionStartData | SessionResumeData | SessionRemoteSteerableChangedData | SessionErrorData | SessionIdleData | SessionTitleChangedData | SessionScheduleCreatedData | SessionScheduleCancelledData | SessionInfoData | SessionWarningData | SessionModelChangeData | SessionModeChangedData | SessionPlanChangedData | SessionWorkspaceFileChangedData | SessionHandoffData | SessionTruncationData | SessionSnapshotRewindData | SessionShutdownData | SessionContextChangedData | SessionUsageInfoData | SessionCompactionStartData | SessionCompactionCompleteData | SessionTaskCompleteData | UserMessageData | PendingMessagesModifiedData | AssistantTurnStartData | AssistantIntentData | AssistantReasoningData | AssistantReasoningDeltaData | AssistantStreamingDeltaData | AssistantMessageData | AssistantMessageStartData | AssistantMessageDeltaData | AssistantTurnEndData | AssistantUsageData | ModelCallFailureData | AbortData | ToolUserRequestedData | ToolExecutionStartData | ToolExecutionPartialResultData | ToolExecutionProgressData | ToolExecutionCompleteData | SkillInvokedData | SubagentStartedData | SubagentCompletedData | SubagentFailedData | SubagentSelectedData | SubagentDeselectedData | HookStartData | HookEndData | SystemMessageData | SystemNotificationData | PermissionRequestedData | PermissionCompletedData | UserInputRequestedData | UserInputCompletedData | ElicitationRequestedData | ElicitationCompletedData | SamplingRequestedData | SamplingCompletedData | McpOauthRequiredData | McpOauthCompletedData | SessionCustomNotificationData | ExternalToolRequestedData | ExternalToolCompletedData | CommandQueuedData | CommandExecuteData | CommandCompletedData | AutoModeSwitchRequestedData | AutoModeSwitchCompletedData | CommandsChangedData | CapabilitiesChangedData | ExitPlanModeRequestedData | ExitPlanModeCompletedData | SessionToolsUpdatedData | SessionBackgroundTasksChangedData | SessionSkillsLoadedData | SessionCustomAgentsUpdatedData | SessionMcpServersLoadedData | SessionMcpServerStatusChangedData | SessionExtensionsLoadedData | SessionCanvasOpenedData | SessionCanvasRegistryChangedData | McpAppToolCallCompleteData | RawSessionEventData | Data @dataclass @@ -6859,6 +7028,8 @@ def from_dict(obj: Any) -> "SessionEvent": case SessionEventType.SESSION_MCP_SERVERS_LOADED: data = SessionMcpServersLoadedData.from_dict(data_obj) case SessionEventType.SESSION_MCP_SERVER_STATUS_CHANGED: data = SessionMcpServerStatusChangedData.from_dict(data_obj) case SessionEventType.SESSION_EXTENSIONS_LOADED: data = SessionExtensionsLoadedData.from_dict(data_obj) + case SessionEventType.SESSION_CANVAS_OPENED: data = SessionCanvasOpenedData.from_dict(data_obj) + case SessionEventType.SESSION_CANVAS_REGISTRY_CHANGED: data = SessionCanvasRegistryChangedData.from_dict(data_obj) case SessionEventType.MCP_APP_TOOL_CALL_COMPLETE: data = McpAppToolCallCompleteData.from_dict(data_obj) case _: data = RawSessionEventData.from_dict(data_obj) return SessionEvent( diff --git a/rust/src/generated/api_types.rs b/rust/src/generated/api_types.rs index 606ca4780..db57b293a 100644 --- a/rust/src/generated/api_types.rs +++ b/rust/src/generated/api_types.rs @@ -96,6 +96,16 @@ pub mod rpc_methods { pub const SESSION_AUTH_GETSTATUS: &str = "session.auth.getStatus"; /// `session.auth.setCredentials` pub const SESSION_AUTH_SETCREDENTIALS: &str = "session.auth.setCredentials"; + /// `session.canvas.list` + pub const SESSION_CANVAS_LIST: &str = "session.canvas.list"; + /// `session.canvas.listOpen` + pub const SESSION_CANVAS_LISTOPEN: &str = "session.canvas.listOpen"; + /// `session.canvas.open` + pub const SESSION_CANVAS_OPEN: &str = "session.canvas.open"; + /// `session.canvas.close` + pub const SESSION_CANVAS_CLOSE: &str = "session.canvas.close"; + /// `session.canvas.invokeAction` + pub const SESSION_CANVAS_INVOKEACTION: &str = "session.canvas.invokeAction"; /// `session.model.getCurrent` pub const SESSION_MODEL_GETCURRENT: &str = "session.model.getCurrent"; /// `session.model.switchTo` @@ -869,6 +879,199 @@ pub struct ApiKeyAuthInfo { pub r#type: ApiKeyAuthInfoType, } +/// 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.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct CanvasAction { + /// Description of the action + #[serde(skip_serializing_if = "Option::is_none")] + pub description: Option, + /// JSON Schema for the action input + #[serde(skip_serializing_if = "Option::is_none")] + pub input_schema: Option, + /// Action name exposed by the canvas provider + pub name: String, +} + +/// Canvas close parameters. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct CanvasCloseRequest { + /// Open canvas instance identifier + pub instance_id: String, +} + +/// Canvas action invocation parameters. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct CanvasInvokeActionRequest { + /// Action name to invoke + pub action_name: String, + /// Action input + #[serde(skip_serializing_if = "Option::is_none")] + pub input: Option, + /// Open canvas instance identifier + pub instance_id: String, +} + +/// Canvas action invocation result. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct CanvasInvokeActionResult { + /// Provider-supplied action result + #[serde(skip_serializing_if = "Option::is_none")] + pub result: Option, +} + +/// Canvas available in the current session. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct DiscoveredCanvas { + /// Actions the agent or host may invoke on an open instance + #[serde(default)] + pub actions: Vec, + /// Provider-local canvas identifier + pub canvas_id: String, + /// Short, single-sentence description shown to the agent in canvas catalogs. + pub description: String, + /// Human-readable canvas name + pub display_name: String, + /// Owning provider identifier + pub extension_id: String, + /// Owning extension display name, when available + #[serde(skip_serializing_if = "Option::is_none")] + pub extension_name: Option, + /// JSON Schema for canvas open input + #[serde(skip_serializing_if = "Option::is_none")] + pub input_schema: Option, +} + +/// Declared canvases available in this session. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct CanvasList { + /// Declared canvases available in this session + pub canvases: Vec, +} + +/// Open canvas instance snapshot. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct OpenCanvasInstance { + /// Runtime-controlled routing state for an open canvas instance. + pub availability: CanvasInstanceAvailability, + /// Provider-local canvas identifier + pub canvas_id: String, + /// Owning provider identifier + pub extension_id: String, + /// Owning extension display name, when available + #[serde(skip_serializing_if = "Option::is_none")] + pub extension_name: Option, + /// Input supplied when the instance was opened + #[serde(skip_serializing_if = "Option::is_none")] + pub input: Option, + /// Stable caller-supplied canvas instance identifier + pub instance_id: String, + /// Whether this snapshot came from an idempotent reopen + pub reopen: bool, + /// Provider-supplied status text + #[serde(skip_serializing_if = "Option::is_none")] + pub status: Option, + /// Rendered title + #[serde(skip_serializing_if = "Option::is_none")] + pub title: Option, + /// URL for web-rendered canvases + #[serde(skip_serializing_if = "Option::is_none")] + pub url: Option, +} + +/// Live open-canvas snapshot. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct CanvasListOpenResult { + /// Currently open canvas instances + pub open_canvases: Vec, +} + +/// Canvas open parameters. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct CanvasOpenRequest { + /// Provider-local canvas identifier + pub canvas_id: String, + /// Owning provider identifier. Optional when the canvasId is unique across providers; required to disambiguate when multiple providers register the same canvasId. + #[serde(skip_serializing_if = "Option::is_none")] + pub extension_id: Option, + /// Canvas open input + #[serde(skip_serializing_if = "Option::is_none")] + pub input: Option, + /// Caller-supplied stable instance identifier + pub instance_id: String, +} + /// Optional unstructured input hint /// ///
@@ -8979,6 +9182,120 @@ pub struct SessionAuthSetCredentialsResult { pub success: bool, } +/// Identifies the target session. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionCanvasListParams { + /// Target session identifier + pub session_id: SessionId, +} + +/// Declared canvases available in this session. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionCanvasListResult { + /// Declared canvases available in this session + pub canvases: Vec, +} + +/// Identifies the target session. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionCanvasListOpenParams { + /// Target session identifier + pub session_id: SessionId, +} + +/// Live open-canvas snapshot. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionCanvasListOpenResult { + /// Currently open canvas instances + pub open_canvases: Vec, +} + +/// Open canvas instance snapshot. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionCanvasOpenResult { + /// Runtime-controlled routing state for an open canvas instance. + pub availability: CanvasInstanceAvailability, + /// Provider-local canvas identifier + pub canvas_id: String, + /// Owning provider identifier + pub extension_id: String, + /// Owning extension display name, when available + #[serde(skip_serializing_if = "Option::is_none")] + pub extension_name: Option, + /// Input supplied when the instance was opened + #[serde(skip_serializing_if = "Option::is_none")] + pub input: Option, + /// Stable caller-supplied canvas instance identifier + pub instance_id: String, + /// Whether this snapshot came from an idempotent reopen + pub reopen: bool, + /// Provider-supplied status text + #[serde(skip_serializing_if = "Option::is_none")] + pub status: Option, + /// Rendered title + #[serde(skip_serializing_if = "Option::is_none")] + pub title: Option, + /// URL for web-rendered canvases + #[serde(skip_serializing_if = "Option::is_none")] + pub url: Option, +} + +/// Canvas action invocation result. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionCanvasInvokeActionResult { + /// Provider-supplied action result + #[serde(skip_serializing_if = "Option::is_none")] + pub result: Option, +} + /// Identifies the target session. /// ///
@@ -11516,6 +11833,28 @@ pub enum AuthInfoType { Unknown, } +/// Runtime-controlled routing state for an open canvas instance. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum CanvasInstanceAvailability { + /// The owning provider is currently connected and routing calls will be dispatched normally. + #[serde(rename = "ready")] + Ready, + /// The owning provider is not currently connected. Routing calls fail with canvas_provider_unavailable until the agent re-issues open_canvas (which rehydrates via a fresh canvas.open) or the provider reconnects. + #[serde(rename = "stale")] + Stale, + /// Unknown variant for forward compatibility. + #[default] + #[serde(other)] + Unknown, +} + /// Optional completion hint for the input (e.g. 'directory' for filesystem path completion) /// ///
diff --git a/rust/src/generated/rpc.rs b/rust/src/generated/rpc.rs index 20dc48e80..45011cf82 100644 --- a/rust/src/generated/rpc.rs +++ b/rust/src/generated/rpc.rs @@ -1137,6 +1137,13 @@ impl<'a> SessionRpc<'a> { } } + /// `session.canvas.*` sub-namespace. + pub fn canvas(&self) -> SessionRpcCanvas<'a> { + SessionRpcCanvas { + session: self.session, + } + } + /// `session.commands.*` sub-namespace. pub fn commands(&self) -> SessionRpcCommands<'a> { SessionRpcCommands { @@ -1664,6 +1671,153 @@ impl<'a> SessionRpcAuth<'a> { } } +/// `session.canvas.*` RPCs. +#[derive(Clone, Copy)] +pub struct SessionRpcCanvas<'a> { + pub(crate) session: &'a Session, +} + +impl<'a> SessionRpcCanvas<'a> { + /// Lists canvases declared for the session. + /// + /// Wire method: `session.canvas.list`. + /// + /// # Returns + /// + /// Declared canvases available in this session. + /// + ///
+ /// + /// **Experimental.** This API is part of an experimental wire-protocol surface + /// and may change or be removed in future SDK or CLI releases. Pin both the + /// SDK and CLI versions if your code depends on it. + /// + ///
+ pub async fn list(&self) -> Result { + let wire_params = serde_json::json!({ "sessionId": self.session.id() }); + let _value = self + .session + .client() + .call(rpc_methods::SESSION_CANVAS_LIST, Some(wire_params)) + .await?; + Ok(serde_json::from_value(_value)?) + } + + /// Lists currently open canvas instances for the live session. + /// + /// Wire method: `session.canvas.listOpen`. + /// + /// # Returns + /// + /// Live open-canvas snapshot. + /// + ///
+ /// + /// **Experimental.** This API is part of an experimental wire-protocol surface + /// and may change or be removed in future SDK or CLI releases. Pin both the + /// SDK and CLI versions if your code depends on it. + /// + ///
+ pub async fn list_open(&self) -> Result { + let wire_params = serde_json::json!({ "sessionId": self.session.id() }); + let _value = self + .session + .client() + .call(rpc_methods::SESSION_CANVAS_LISTOPEN, Some(wire_params)) + .await?; + Ok(serde_json::from_value(_value)?) + } + + /// Opens or focuses a canvas instance. + /// + /// Wire method: `session.canvas.open`. + /// + /// # Parameters + /// + /// * `params` - Canvas open parameters. + /// + /// # Returns + /// + /// Open canvas instance snapshot. + /// + ///
+ /// + /// **Experimental.** This API is part of an experimental wire-protocol surface + /// and may change or be removed in future SDK or CLI releases. Pin both the + /// SDK and CLI versions if your code depends on it. + /// + ///
+ pub async fn open(&self, params: CanvasOpenRequest) -> Result { + let mut wire_params = serde_json::to_value(params)?; + wire_params["sessionId"] = serde_json::Value::String(self.session.id().to_string()); + let _value = self + .session + .client() + .call(rpc_methods::SESSION_CANVAS_OPEN, Some(wire_params)) + .await?; + Ok(serde_json::from_value(_value)?) + } + + /// Closes an open canvas instance. + /// + /// Wire method: `session.canvas.close`. + /// + /// # Parameters + /// + /// * `params` - Canvas close parameters. + /// + ///
+ /// + /// **Experimental.** This API is part of an experimental wire-protocol surface + /// and may change or be removed in future SDK or CLI releases. Pin both the + /// SDK and CLI versions if your code depends on it. + /// + ///
+ pub async fn close(&self, params: CanvasCloseRequest) -> Result<(), Error> { + let mut wire_params = serde_json::to_value(params)?; + wire_params["sessionId"] = serde_json::Value::String(self.session.id().to_string()); + let _value = self + .session + .client() + .call(rpc_methods::SESSION_CANVAS_CLOSE, Some(wire_params)) + .await?; + Ok(()) + } + + /// Invokes an action on an open canvas instance. + /// + /// Wire method: `session.canvas.invokeAction`. + /// + /// # Parameters + /// + /// * `params` - Canvas action invocation parameters. + /// + /// # Returns + /// + /// Canvas action invocation result. + /// + ///
+ /// + /// **Experimental.** This API is part of an experimental wire-protocol surface + /// and may change or be removed in future SDK or CLI releases. Pin both the + /// SDK and CLI versions if your code depends on it. + /// + ///
+ pub async fn invoke_action( + &self, + params: CanvasInvokeActionRequest, + ) -> Result { + let mut wire_params = serde_json::to_value(params)?; + wire_params["sessionId"] = serde_json::Value::String(self.session.id().to_string()); + let _value = self + .session + .client() + .call(rpc_methods::SESSION_CANVAS_INVOKEACTION, Some(wire_params)) + .await?; + Ok(serde_json::from_value(_value)?) + } +} + /// `session.commands.*` RPCs. #[derive(Clone, Copy)] pub struct SessionRpcCommands<'a> { diff --git a/rust/src/generated/session_events.rs b/rust/src/generated/session_events.rs index 5e78c6932..6605ecbde 100644 --- a/rust/src/generated/session_events.rs +++ b/rust/src/generated/session_events.rs @@ -171,6 +171,10 @@ pub enum SessionEventType { SessionMcpServerStatusChanged, #[serde(rename = "session.extensions_loaded")] SessionExtensionsLoaded, + #[serde(rename = "session.canvas.opened")] + SessionCanvasOpened, + #[serde(rename = "session.canvas.registry_changed")] + SessionCanvasRegistryChanged, #[serde(rename = "mcp_app.tool_call_complete")] McpAppToolCallComplete, /// Unknown event type for forward compatibility. @@ -347,6 +351,10 @@ pub enum SessionEventData { SessionMcpServerStatusChanged(SessionMcpServerStatusChangedData), #[serde(rename = "session.extensions_loaded")] SessionExtensionsLoaded(SessionExtensionsLoadedData), + #[serde(rename = "session.canvas.opened")] + SessionCanvasOpened(SessionCanvasOpenedData), + #[serde(rename = "session.canvas.registry_changed")] + SessionCanvasRegistryChanged(SessionCanvasRegistryChangedData), #[serde(rename = "mcp_app.tool_call_complete")] McpAppToolCallComplete(McpAppToolCallCompleteData), } @@ -2925,6 +2933,9 @@ pub struct CommandsChangedData { #[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct CapabilitiesChangedUI { + /// Whether canvas rendering is now supported + #[serde(skip_serializing_if = "Option::is_none")] + pub canvases: Option, /// Whether elicitation is now supported #[serde(skip_serializing_if = "Option::is_none")] pub elicitation: Option, @@ -3121,6 +3132,82 @@ pub struct SessionExtensionsLoadedData { pub extensions: Vec, } +/// Session event "session.canvas.opened". +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionCanvasOpenedData { + /// Runtime-controlled routing state for the instance. "ready" when the provider connection is live; "stale" when the provider has gone away and the instance is awaiting rebinding. + pub availability: CanvasOpenedAvailability, + /// Provider-local canvas identifier + pub canvas_id: String, + /// Owning provider identifier + pub extension_id: String, + /// Owning extension display name, when available + #[serde(skip_serializing_if = "Option::is_none")] + pub extension_name: Option, + /// Input supplied when the instance was opened + #[serde(skip_serializing_if = "Option::is_none")] + pub input: Option, + /// Stable caller-supplied canvas instance identifier + pub instance_id: String, + /// Whether this notification represents an idempotent reopen + pub reopen: bool, + /// Provider-supplied status text + #[serde(skip_serializing_if = "Option::is_none")] + pub status: Option, + /// Rendered title + #[serde(skip_serializing_if = "Option::is_none")] + pub title: Option, + /// URL for web-rendered canvases + #[serde(skip_serializing_if = "Option::is_none")] + pub url: Option, +} + +/// Schema for the `CanvasRegistryChangedCanvasAction` type. +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct CanvasRegistryChangedCanvasAction { + /// Action description + #[serde(skip_serializing_if = "Option::is_none")] + pub description: Option, + /// JSON Schema for action input + #[serde(default)] + pub input_schema: HashMap, + /// Action name + pub name: String, +} + +/// Schema for the `CanvasRegistryChangedCanvas` type. +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct CanvasRegistryChangedCanvas { + /// Actions the agent or host may invoke + #[serde(default)] + pub actions: Vec, + /// Provider-local canvas identifier + pub canvas_id: String, + /// Short, single-sentence description shown to the agent in canvas catalogs. + pub description: String, + /// Human-readable canvas name + pub display_name: String, + /// Owning provider identifier + pub extension_id: String, + /// Owning extension display name, when available + #[serde(skip_serializing_if = "Option::is_none")] + pub extension_name: Option, + /// JSON Schema for canvas open input + #[serde(default)] + pub input_schema: HashMap, +} + +/// Session event "session.canvas.registry_changed". +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionCanvasRegistryChangedData { + /// Canvas declarations currently available + pub canvases: Vec, +} + /// Set when the underlying tools/call threw an error before returning a CallToolResult #[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] @@ -4166,3 +4253,18 @@ pub enum ExtensionsLoadedExtensionStatus { #[serde(other)] Unknown, } + +/// Runtime-controlled routing state for the instance. "ready" when the provider connection is live; "stale" when the provider has gone away and the instance is awaiting rebinding. +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum CanvasOpenedAvailability { + /// Provider connection is live; actions can be invoked. + #[serde(rename = "ready")] + Ready, + /// Provider has gone away; the instance is awaiting rebinding. + #[serde(rename = "stale")] + Stale, + /// Unknown variant for forward compatibility. + #[default] + #[serde(other)] + Unknown, +} diff --git a/scripts/codegen/python.ts b/scripts/codegen/python.ts index 7e7dc63b8..1af315eac 100644 --- a/scripts/codegen/python.ts +++ b/scripts/codegen/python.ts @@ -2776,8 +2776,22 @@ async function generateRpc(schemaPath?: string, sessionEventsSchema?: JSONSchema }); let typesCode = qtResult.lines.join("\n"); - // Fix dataclass field ordering + // Quicktype emits optional Any-typed fields without defaults; add them back. typesCode = typesCode.replace(/: Any$/gm, ": Any = None"); + // The synthesized root RPC dataclass includes one required field per schema definition. + // Keep Any-typed definition fields required so later required fields don't trip dataclass + // ordering rules at import time. + typesCode = typesCode.replace( + /(@dataclass\r?\nclass RPC:\r?\n)([\s\S]*?)(\r?\n @staticmethod)/, + (match, prefix: string, body: string, suffix: string) => { + let updatedBody = body; + for (const definitionName of Object.keys(allDefinitions)) { + const fieldName = toSnakeCase(definitionName); + updatedBody = updatedBody.replace(new RegExp(`^( ${fieldName}: Any) = None$`, "m"), "$1"); + } + return `${prefix}${updatedBody}${suffix}`; + } + ); // Fix bare except: to use Exception (required by ruff/pylint) typesCode = typesCode.replace(/except:/g, "except Exception:"); // Remove unnecessary pass when class has methods (quicktype generates pass for empty schemas) diff --git a/test/harness/package-lock.json b/test/harness/package-lock.json index 94d93f7bb..5182ce24a 100644 --- a/test/harness/package-lock.json +++ b/test/harness/package-lock.json @@ -9,7 +9,7 @@ "version": "1.0.0", "license": "ISC", "devDependencies": { - "@github/copilot": "^1.0.52", + "@github/copilot": "^1.0.53-2", "@modelcontextprotocol/sdk": "^1.26.0", "@types/node": "^25.3.3", "@types/node-forge": "^1.3.14", @@ -464,9 +464,9 @@ } }, "node_modules/@github/copilot": { - "version": "1.0.52", - "resolved": "https://registry.npmjs.org/@github/copilot/-/copilot-1.0.52.tgz", - "integrity": "sha512-n6NAIVhosend+3UGYXW3Ltigeum2toUsV24RDgxjkdkLV1DVgp6+2OWCXdk3HTXZ0t/eWMvgBezRFbRr8N4Z6g==", + "version": "1.0.53-2", + "resolved": "https://registry.npmjs.org/@github/copilot/-/copilot-1.0.53-2.tgz", + "integrity": "sha512-SkISXco8PFyuOreaPIiBiyQHdXnw51wLmSvzW7yrdD02dH9qRBCcrxPXFS05iLrv3hLCnhhECKJUv1afTPtUBg==", "dev": true, "license": "SEE LICENSE IN LICENSE.md", "dependencies": { @@ -476,20 +476,20 @@ "copilot": "npm-loader.js" }, "optionalDependencies": { - "@github/copilot-darwin-arm64": "1.0.52", - "@github/copilot-darwin-x64": "1.0.52", - "@github/copilot-linux-arm64": "1.0.52", - "@github/copilot-linux-x64": "1.0.52", - "@github/copilot-linuxmusl-arm64": "1.0.52", - "@github/copilot-linuxmusl-x64": "1.0.52", - "@github/copilot-win32-arm64": "1.0.52", - "@github/copilot-win32-x64": "1.0.52" + "@github/copilot-darwin-arm64": "1.0.53-2", + "@github/copilot-darwin-x64": "1.0.53-2", + "@github/copilot-linux-arm64": "1.0.53-2", + "@github/copilot-linux-x64": "1.0.53-2", + "@github/copilot-linuxmusl-arm64": "1.0.53-2", + "@github/copilot-linuxmusl-x64": "1.0.53-2", + "@github/copilot-win32-arm64": "1.0.53-2", + "@github/copilot-win32-x64": "1.0.53-2" } }, "node_modules/@github/copilot-darwin-arm64": { - "version": "1.0.52", - "resolved": "https://registry.npmjs.org/@github/copilot-darwin-arm64/-/copilot-darwin-arm64-1.0.52.tgz", - "integrity": "sha512-Jj0skAY5a9IQEaNHd1KdjkVhRSpmsSU4325BQ6XCgpo22pmg1Rk9Xc7cI29T6lCrn+KjksVvtPJq/lSNF2mHPw==", + "version": "1.0.53-2", + "resolved": "https://registry.npmjs.org/@github/copilot-darwin-arm64/-/copilot-darwin-arm64-1.0.53-2.tgz", + "integrity": "sha512-Ws+YLk9Gyix2IaqzFSuZe00fhX5IGAgNXyVNzkO1MvtnFSj9vGTAFslF94cf3VkpaI8VNf+O3MRGzaQohCpv4A==", "cpu": [ "arm64" ], @@ -504,9 +504,9 @@ } }, "node_modules/@github/copilot-darwin-x64": { - "version": "1.0.52", - "resolved": "https://registry.npmjs.org/@github/copilot-darwin-x64/-/copilot-darwin-x64-1.0.52.tgz", - "integrity": "sha512-vWzjLOKmwUTzyd3X8iR+I4c88EOH2r83Q6WN+0NgelqrzbhMHgMLJIbwTeKjN7egvribciYg6xeLFNo+0ClCkg==", + "version": "1.0.53-2", + "resolved": "https://registry.npmjs.org/@github/copilot-darwin-x64/-/copilot-darwin-x64-1.0.53-2.tgz", + "integrity": "sha512-3yHajiuz5UBsdpOlaZCLp2diveXJcIbXbjdjmovPIUrY/2h4yUbQSBEkFuxzV5CAuehQE9S7+NaZYMhUXRIl9Q==", "cpu": [ "x64" ], @@ -521,9 +521,9 @@ } }, "node_modules/@github/copilot-linux-arm64": { - "version": "1.0.52", - "resolved": "https://registry.npmjs.org/@github/copilot-linux-arm64/-/copilot-linux-arm64-1.0.52.tgz", - "integrity": "sha512-x6Pew1dMeKxNZMkaTC7VLxmD/X4zQiWQFTzMRYaqD2o5s0rqYYwy9ROP1+n3X6eaYWUp0FMKibdsiqjmZft+vw==", + "version": "1.0.53-2", + "resolved": "https://registry.npmjs.org/@github/copilot-linux-arm64/-/copilot-linux-arm64-1.0.53-2.tgz", + "integrity": "sha512-VgpKr1c7vw8lDqNPOIHYj7Qj6FJY2j3dTh6xaBcItUDLD7y45Pp36JJXrPiVjya7Upx4ThxR/kj9KSRxx4s5pg==", "cpu": [ "arm64" ], @@ -538,9 +538,9 @@ } }, "node_modules/@github/copilot-linux-x64": { - "version": "1.0.52", - "resolved": "https://registry.npmjs.org/@github/copilot-linux-x64/-/copilot-linux-x64-1.0.52.tgz", - "integrity": "sha512-dwZj/MeXNsLTYIp7A53xYTULvl+xspqZqqeiqhsW7KyGe8VT6QQ3bJj7qmOSEwOkmALuA4sPwBlTT3X0Ozbocw==", + "version": "1.0.53-2", + "resolved": "https://registry.npmjs.org/@github/copilot-linux-x64/-/copilot-linux-x64-1.0.53-2.tgz", + "integrity": "sha512-1mZUCQVeS2y5douEq8tCIEBr1XP8L0UM7fo4MmJHlLT+6ykZz1pyJPtnpO8OO4GGRvenOFd/XM0k2a+KpxYqtw==", "cpu": [ "x64" ], @@ -555,9 +555,9 @@ } }, "node_modules/@github/copilot-linuxmusl-arm64": { - "version": "1.0.52", - "resolved": "https://registry.npmjs.org/@github/copilot-linuxmusl-arm64/-/copilot-linuxmusl-arm64-1.0.52.tgz", - "integrity": "sha512-QBhLnWhtH8qjsfeDqE5Bn5KGCH3fLEIRHbHfOd3UPyapBKTA+pBA/6FQGjvOkzwMeKKtTBeRBQ9hCoQm+Vrr2A==", + "version": "1.0.53-2", + "resolved": "https://registry.npmjs.org/@github/copilot-linuxmusl-arm64/-/copilot-linuxmusl-arm64-1.0.53-2.tgz", + "integrity": "sha512-gf2wgQu8DuUZSz0Fdq2f13TvWOi6+xkkyQQM3mPtt841UV0K8eUV9MBSRvkv1zbd0RG9MgbPaBLE8TRpWezikg==", "cpu": [ "arm64" ], @@ -572,9 +572,9 @@ } }, "node_modules/@github/copilot-linuxmusl-x64": { - "version": "1.0.52", - "resolved": "https://registry.npmjs.org/@github/copilot-linuxmusl-x64/-/copilot-linuxmusl-x64-1.0.52.tgz", - "integrity": "sha512-mdA5VfgX0XfMU3zwnAg0Wf3lQ/vkRZOmm7h69N/1jgRftMghm5WW3xfrBDkANta9J7YLl8YBPwRZAPzw2TYZEg==", + "version": "1.0.53-2", + "resolved": "https://registry.npmjs.org/@github/copilot-linuxmusl-x64/-/copilot-linuxmusl-x64-1.0.53-2.tgz", + "integrity": "sha512-Zk/o40BOmuNUC6eLZnPRGE45dzdmrPbjusyGOdLKXFzlImHHW2SwYoFchnubzpz81Hzwur3/vCqYtGWjTSa8LA==", "cpu": [ "x64" ], @@ -589,9 +589,9 @@ } }, "node_modules/@github/copilot-win32-arm64": { - "version": "1.0.52", - "resolved": "https://registry.npmjs.org/@github/copilot-win32-arm64/-/copilot-win32-arm64-1.0.52.tgz", - "integrity": "sha512-Anl7/k4uudsE2Kc4nYFh4AJegcudt9I4od4OBwjQF6kR/VGXsgKtW6b15o8R4F3HWqXIcMwwyGq7Oov+NYVLqQ==", + "version": "1.0.53-2", + "resolved": "https://registry.npmjs.org/@github/copilot-win32-arm64/-/copilot-win32-arm64-1.0.53-2.tgz", + "integrity": "sha512-BBMC0QIOn+f61VGfyZbEiFupWJToZwftv9FhJ7xOh1utg3lwmBfjmaG9BKXdnaFqlOjP8mUKbgAkyBJHGZYNOA==", "cpu": [ "arm64" ], @@ -606,9 +606,9 @@ } }, "node_modules/@github/copilot-win32-x64": { - "version": "1.0.52", - "resolved": "https://registry.npmjs.org/@github/copilot-win32-x64/-/copilot-win32-x64-1.0.52.tgz", - "integrity": "sha512-rOTQk57EdhnoVKn5JlQBhurAJIRJ7GLm/jMGxrTktY2Le+bcdAyBzWZtIHiy5E9CXbpISBtUe63Coa5Tyumf6w==", + "version": "1.0.53-2", + "resolved": "https://registry.npmjs.org/@github/copilot-win32-x64/-/copilot-win32-x64-1.0.53-2.tgz", + "integrity": "sha512-ObuGJ/AGnhTl3kOPIjY9xj3BfucjpQNytmIPQGwgMDDBisSvtfdQ5WVbZlKG736VtQ1epZ1RmzS28bKTudBD/Q==", "cpu": [ "x64" ], diff --git a/test/harness/package.json b/test/harness/package.json index e8bc6376d..b1d70c9dc 100644 --- a/test/harness/package.json +++ b/test/harness/package.json @@ -11,7 +11,7 @@ "test": "vitest run" }, "devDependencies": { - "@github/copilot": "^1.0.52", + "@github/copilot": "^1.0.53-2", "@modelcontextprotocol/sdk": "^1.26.0", "@types/node": "^25.3.3", "@types/node-forge": "^1.3.14",