diff --git a/.github/agents/docs-maintenance.agent.md b/.github/agents/docs-maintenance.agent.md index b1bf95ae8..bf7fa8518 100644 --- a/.github/agents/docs-maintenance.agent.md +++ b/.github/agents/docs-maintenance.agent.md @@ -377,7 +377,7 @@ cat go/types.go | grep -A 15 "type SessionHooks struct" ``` **Must match (PascalCase for exported):** -- `ClientOptions` fields: `CLIPath`, `CLIUrl`, `UseStdio`, `Port`, `LogLevel`, `AutoStart`, `Env`, `GithubToken`, `UseLoggedInUser` +- `ClientOptions` fields: `CLIPath`, `CLIUrl`, `UseStdio`, `Port`, `LogLevel`, `AutoStart`, `Env`, `GitHubToken`, `UseLoggedInUser` - `SessionConfig` fields: `Model`, `Tools`, `Hooks`, `SystemMessage`, `MCPServers`, `AvailableTools`, `ExcludedTools`, `Streaming`, `ReasoningEffort`, `Provider`, `InfiniteSessions`, `CustomAgents`, `WorkingDirectory` - `Session` methods: `Send()`, `SendAndWait()`, `GetMessages()`, `Disconnect()`, `Abort()`, `ExportSession()` - Hook fields: `OnPreToolUse`, `OnPostToolUse`, `OnPostToolUseFailure`, `OnUserPromptSubmitted`, `OnSessionStart`, `OnSessionEnd`, `OnErrorOccurred` @@ -395,7 +395,7 @@ cat dotnet/src/Types.cs | grep -A 15 "public class SessionHooks" ``` **Must match (PascalCase):** -- `CopilotClientOptions` properties: `CliPath`, `CliUrl`, `UseStdio`, `Port`, `LogLevel`, `AutoStart`, `Environment`, `GithubToken`, `UseLoggedInUser` +- `CopilotClientOptions` properties: `CliPath`, `CliUrl`, `UseStdio`, `Port`, `LogLevel`, `AutoStart`, `Environment`, `GitHubToken`, `UseLoggedInUser` - `SessionConfig` properties: `Model`, `Tools`, `Hooks`, `SystemMessage`, `McpServers`, `AvailableTools`, `ExcludedTools`, `Streaming`, `ReasoningEffort`, `Provider`, `InfiniteSessions`, `CustomAgents`, `WorkingDirectory` - `CopilotSession` methods: `SendAsync()`, `SendAndWaitAsync()`, `GetMessagesAsync()`, `DisposeAsync()`, `AbortAsync()`, `ExportSessionAsync()` - Hook properties: `OnPreToolUse`, `OnPostToolUse`, `OnPostToolUseFailure`, `OnUserPromptSubmitted`, `OnSessionStart`, `OnSessionEnd`, `OnErrorOccurred` diff --git a/docs/auth/authenticate.md b/docs/auth/authenticate.md index d45e3569b..0c4d70699 100644 --- a/docs/auth/authenticate.md +++ b/docs/auth/authenticate.md @@ -167,7 +167,7 @@ func main() { import copilot "github.com/github/copilot-sdk/go" client := copilot.NewClient(&copilot.ClientOptions{ - GithubToken: userAccessToken, // Token from OAuth flow + GitHubToken: userAccessToken, // Token from OAuth flow UseLoggedInUser: copilot.Bool(false), // Don't use stored CLI credentials }) ``` diff --git a/docs/setup/github-oauth.md b/docs/setup/github-oauth.md index aea6b22b9..25b6aa80e 100644 --- a/docs/setup/github-oauth.md +++ b/docs/setup/github-oauth.md @@ -206,7 +206,7 @@ func main() { ```go func createClientForUser(userToken string) *copilot.Client { return copilot.NewClient(&copilot.ClientOptions{ - GithubToken: userToken, + GitHubToken: userToken, UseLoggedInUser: copilot.Bool(false), }) } diff --git a/docs/troubleshooting/debugging.md b/docs/troubleshooting/debugging.md index 77f950552..588049f0d 100644 --- a/docs/troubleshooting/debugging.md +++ b/docs/troubleshooting/debugging.md @@ -292,7 +292,7 @@ var client = new CopilotClient(new CopilotClientOptions ```go client := copilot.NewClient(&copilot.ClientOptions{ - GithubToken: os.Getenv("GITHUB_TOKEN"), + GitHubToken: os.Getenv("GITHUB_TOKEN"), }) ``` @@ -303,7 +303,7 @@ var client = new CopilotClient(new CopilotClientOptions ```csharp var client = new CopilotClient(new CopilotClientOptions { - GithubToken = Environment.GetEnvironmentVariable("GITHUB_TOKEN") + GitHubToken = Environment.GetEnvironmentVariable("GITHUB_TOKEN") }); ``` diff --git a/dotnet/src/Generated/Rpc.cs b/dotnet/src/Generated/Rpc.cs index 88463e73b..e142c95e7 100644 --- a/dotnet/src/Generated/Rpc.cs +++ b/dotnet/src/Generated/Rpc.cs @@ -4645,7 +4645,7 @@ internal sealed class SessionExtensionsReloadRequest [JsonDerivedType(typeof(PushAttachmentFile), "file")] [JsonDerivedType(typeof(PushAttachmentDirectory), "directory")] [JsonDerivedType(typeof(PushAttachmentSelection), "selection")] -[JsonDerivedType(typeof(PushAttachmentGithubReference), "github_reference")] +[JsonDerivedType(typeof(PushAttachmentGitHubReference), "github_reference")] [JsonDerivedType(typeof(PushAttachmentBlob), "blob")] [JsonDerivedType(typeof(PushAttachmentExtensionContext), "extension_context")] public partial class PushAttachment @@ -4778,7 +4778,7 @@ public partial class PushAttachmentSelection : PushAttachment /// GitHub issue, pull request, or discussion reference. /// The github_reference variant of . [Experimental(Diagnostics.Experimental)] -public partial class PushAttachmentGithubReference : PushAttachment +public partial class PushAttachmentGitHubReference : PushAttachment { /// [JsonIgnore] @@ -4790,7 +4790,7 @@ public partial class PushAttachmentGithubReference : PushAttachment /// Type of GitHub reference. [JsonPropertyName("referenceType")] - public required PushAttachmentGithubReferenceType ReferenceType { get; set; } + public required PushAttachmentGitHubReferenceType ReferenceType { get; set; } /// Current state of the referenced item (e.g., open, closed, merged). [JsonPropertyName("state")] @@ -8789,7 +8789,7 @@ public SessionContextHostType(string value) public string Value => _value ?? string.Empty; /// Session repository is hosted on GitHub. - public static SessionContextHostType Github { get; } = new("github"); + public static SessionContextHostType GitHub { get; } = new("github"); /// Session repository is hosted on Azure DevOps. public static SessionContextHostType Ado { get; } = new("ado"); @@ -9734,7 +9734,7 @@ public WorkspacesWorkspaceDetailsHostType(string value) public string Value => _value ?? string.Empty; /// Workspace repository is hosted on GitHub. - public static WorkspacesWorkspaceDetailsHostType Github { get; } = new("github"); + public static WorkspacesWorkspaceDetailsHostType GitHub { get; } = new("github"); /// Workspace repository is hosted on Azure DevOps. public static WorkspacesWorkspaceDetailsHostType Ado { get; } = new("ado"); @@ -11241,42 +11241,42 @@ public override void Write(Utf8JsonWriter writer, ExtensionStatus value, JsonSer [Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] -public readonly struct PushAttachmentGithubReferenceType : IEquatable +public readonly struct PushAttachmentGitHubReferenceType : IEquatable { private readonly string? _value; - /// Initializes a new instance of the struct. - /// The value to associate with this . + /// Initializes a new instance of the struct. + /// The value to associate with this . [JsonConstructor] - public PushAttachmentGithubReferenceType(string value) + public PushAttachmentGitHubReferenceType(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } - /// Gets the value associated with this . + /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// GitHub issue reference. - public static PushAttachmentGithubReferenceType Issue { get; } = new("issue"); + public static PushAttachmentGitHubReferenceType Issue { get; } = new("issue"); /// GitHub pull request reference. - public static PushAttachmentGithubReferenceType Pr { get; } = new("pr"); + public static PushAttachmentGitHubReferenceType Pr { get; } = new("pr"); /// GitHub discussion reference. - public static PushAttachmentGithubReferenceType Discussion { get; } = new("discussion"); + public static PushAttachmentGitHubReferenceType Discussion { get; } = new("discussion"); - /// Returns a value indicating whether two instances are equivalent. - public static bool operator ==(PushAttachmentGithubReferenceType left, PushAttachmentGithubReferenceType right) => left.Equals(right); + /// Returns a value indicating whether two instances are equivalent. + public static bool operator ==(PushAttachmentGitHubReferenceType left, PushAttachmentGitHubReferenceType right) => left.Equals(right); - /// Returns a value indicating whether two instances are not equivalent. - public static bool operator !=(PushAttachmentGithubReferenceType left, PushAttachmentGithubReferenceType right) => !(left == right); + /// Returns a value indicating whether two instances are not equivalent. + public static bool operator !=(PushAttachmentGitHubReferenceType left, PushAttachmentGitHubReferenceType right) => !(left == right); /// - public override bool Equals(object? obj) => obj is PushAttachmentGithubReferenceType other && Equals(other); + public override bool Equals(object? obj) => obj is PushAttachmentGitHubReferenceType other && Equals(other); /// - public bool Equals(PushAttachmentGithubReferenceType other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); + public bool Equals(PushAttachmentGitHubReferenceType other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); /// public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); @@ -11284,20 +11284,20 @@ public PushAttachmentGithubReferenceType(string value) /// public override string ToString() => Value; - /// Provides a for serializing instances. + /// Provides a for serializing instances. [EditorBrowsable(EditorBrowsableState.Never)] - public sealed class Converter : JsonConverter + public sealed class Converter : JsonConverter { /// - public override PushAttachmentGithubReferenceType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override PushAttachmentGitHubReferenceType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// - public override void Write(Utf8JsonWriter writer, PushAttachmentGithubReferenceType value, JsonSerializerOptions options) + public override void Write(Utf8JsonWriter writer, PushAttachmentGitHubReferenceType value, JsonSerializerOptions options) { - GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(PushAttachmentGithubReferenceType)); + GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(PushAttachmentGitHubReferenceType)); } } } @@ -12107,7 +12107,7 @@ public WorkspaceSummaryHostType(string value) public string Value => _value ?? string.Empty; /// Workspace summary repository is hosted on GitHub. - public static WorkspaceSummaryHostType Github { get; } = new("github"); + public static WorkspaceSummaryHostType GitHub { get; } = new("github"); /// Workspace summary repository is hosted on Azure DevOps. public static WorkspaceSummaryHostType Ado { get; } = new("ado"); @@ -12170,7 +12170,7 @@ public SessionWorkingDirectoryContextHostType(string value) public string Value => _value ?? string.Empty; /// The working directory repository is hosted on GitHub. - public static SessionWorkingDirectoryContextHostType Github { get; } = new("github"); + public static SessionWorkingDirectoryContextHostType GitHub { get; } = new("github"); /// The working directory repository is hosted on Azure DevOps. public static SessionWorkingDirectoryContextHostType Ado { get; } = new("ado"); @@ -16206,8 +16206,8 @@ public static void RegisterClientSessionApiHandlers(JsonRpc rpc, FuncGitHub issue, pull request, or discussion reference. /// The github_reference variant of . -public sealed partial class AttachmentGithubReference : Attachment +public sealed partial class AttachmentGitHubReference : Attachment { /// [JsonIgnore] @@ -3785,7 +3785,7 @@ public sealed partial class AttachmentGithubReference : Attachment /// Type of GitHub reference. [JsonPropertyName("referenceType")] - public required AttachmentGithubReferenceType ReferenceType { get; set; } + public required AttachmentGitHubReferenceType ReferenceType { get; set; } /// Current state of the referenced item (e.g., open, closed, merged). [JsonPropertyName("state")] @@ -3869,7 +3869,7 @@ public sealed partial class AttachmentExtensionContext : Attachment [JsonDerivedType(typeof(AttachmentFile), "file")] [JsonDerivedType(typeof(AttachmentDirectory), "directory")] [JsonDerivedType(typeof(AttachmentSelection), "selection")] -[JsonDerivedType(typeof(AttachmentGithubReference), "github_reference")] +[JsonDerivedType(typeof(AttachmentGitHubReference), "github_reference")] [JsonDerivedType(typeof(AttachmentBlob), "blob")] [JsonDerivedType(typeof(AttachmentExtensionContext), "extension_context")] public partial class Attachment @@ -5975,7 +5975,7 @@ public WorkingDirectoryContextHostType(string value) public string Value => _value ?? string.Empty; /// Repository is hosted on GitHub. - public static WorkingDirectoryContextHostType Github { get; } = new("github"); + public static WorkingDirectoryContextHostType GitHub { get; } = new("github"); /// Repository is hosted on Azure DevOps. public static WorkingDirectoryContextHostType Ado { get; } = new("ado"); @@ -6653,42 +6653,42 @@ public override void Write(Utf8JsonWriter writer, UserMessageAgentMode value, Js /// Type of GitHub reference. [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] -public readonly struct AttachmentGithubReferenceType : IEquatable +public readonly struct AttachmentGitHubReferenceType : IEquatable { private readonly string? _value; - /// Initializes a new instance of the struct. - /// The value to associate with this . + /// Initializes a new instance of the struct. + /// The value to associate with this . [JsonConstructor] - public AttachmentGithubReferenceType(string value) + public AttachmentGitHubReferenceType(string value) { ArgumentException.ThrowIfNullOrWhiteSpace(value); _value = value; } - /// Gets the value associated with this . + /// Gets the value associated with this . public string Value => _value ?? string.Empty; /// GitHub issue reference. - public static AttachmentGithubReferenceType Issue { get; } = new("issue"); + public static AttachmentGitHubReferenceType Issue { get; } = new("issue"); /// GitHub pull request reference. - public static AttachmentGithubReferenceType Pr { get; } = new("pr"); + public static AttachmentGitHubReferenceType Pr { get; } = new("pr"); /// GitHub discussion reference. - public static AttachmentGithubReferenceType Discussion { get; } = new("discussion"); + public static AttachmentGitHubReferenceType Discussion { get; } = new("discussion"); - /// Returns a value indicating whether two instances are equivalent. - public static bool operator ==(AttachmentGithubReferenceType left, AttachmentGithubReferenceType right) => left.Equals(right); + /// Returns a value indicating whether two instances are equivalent. + public static bool operator ==(AttachmentGitHubReferenceType left, AttachmentGitHubReferenceType right) => left.Equals(right); - /// Returns a value indicating whether two instances are not equivalent. - public static bool operator !=(AttachmentGithubReferenceType left, AttachmentGithubReferenceType right) => !(left == right); + /// Returns a value indicating whether two instances are not equivalent. + public static bool operator !=(AttachmentGitHubReferenceType left, AttachmentGitHubReferenceType right) => !(left == right); /// - public override bool Equals(object? obj) => obj is AttachmentGithubReferenceType other && Equals(other); + public override bool Equals(object? obj) => obj is AttachmentGitHubReferenceType other && Equals(other); /// - public bool Equals(AttachmentGithubReferenceType other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); + public bool Equals(AttachmentGitHubReferenceType other) => string.Equals(Value, other.Value, StringComparison.OrdinalIgnoreCase); /// public override int GetHashCode() => StringComparer.OrdinalIgnoreCase.GetHashCode(Value); @@ -6696,20 +6696,20 @@ public AttachmentGithubReferenceType(string value) /// public override string ToString() => Value; - /// Provides a for serializing instances. + /// Provides a for serializing instances. [EditorBrowsable(EditorBrowsableState.Never)] - public sealed class Converter : JsonConverter + public sealed class Converter : JsonConverter { /// - public override AttachmentGithubReferenceType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + public override AttachmentGitHubReferenceType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return new(GeneratedStringEnumJson.ReadValue(ref reader, typeToConvert)); } /// - public override void Write(Utf8JsonWriter writer, AttachmentGithubReferenceType value, JsonSerializerOptions options) + public override void Write(Utf8JsonWriter writer, AttachmentGitHubReferenceType value, JsonSerializerOptions options) { - GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(AttachmentGithubReferenceType)); + GeneratedStringEnumJson.WriteValue(writer, value.Value, typeof(AttachmentGitHubReferenceType)); } } } @@ -8229,7 +8229,7 @@ public override void Write(Utf8JsonWriter writer, CanvasOpenedAvailability value [JsonSerializable(typeof(AttachmentExtensionContext))] [JsonSerializable(typeof(AttachmentFile))] [JsonSerializable(typeof(AttachmentFileLineRange))] -[JsonSerializable(typeof(AttachmentGithubReference))] +[JsonSerializable(typeof(AttachmentGitHubReference))] [JsonSerializable(typeof(AttachmentSelection))] [JsonSerializable(typeof(AttachmentSelectionDetails))] [JsonSerializable(typeof(AttachmentSelectionDetailsEnd))] diff --git a/dotnet/test/E2E/RpcSessionStateE2ETests.cs b/dotnet/test/E2E/RpcSessionStateE2ETests.cs index 1f35a9173..41c08cbd1 100644 --- a/dotnet/test/E2E/RpcSessionStateE2ETests.cs +++ b/dotnet/test/E2E/RpcSessionStateE2ETests.cs @@ -314,7 +314,7 @@ await TestHelper.WaitForConditionAsync( Branch = branch, Repository = "github/copilot-sdk-e2e", RepositoryHost = "github.com", - HostType = SessionWorkingDirectoryContextHostType.Github, + HostType = SessionWorkingDirectoryContextHostType.GitHub, BaseCommit = "0000000000000000000000000000000000000000", HeadCommit = "1111111111111111111111111111111111111111", }; diff --git a/dotnet/test/E2E/SessionE2ETests.cs b/dotnet/test/E2E/SessionE2ETests.cs index a610ae923..979144b6e 100644 --- a/dotnet/test/E2E/SessionE2ETests.cs +++ b/dotnet/test/E2E/SessionE2ETests.cs @@ -824,7 +824,7 @@ await session.SendAndWaitAsync(new MessageOptions } [Fact] - public async Task Should_Send_With_Github_Reference_Attachment() + public async Task Should_Send_With_GitHub_Reference_Attachment() { var session = await CreateSessionAsync(); @@ -833,10 +833,10 @@ await session.SendAndWaitAsync(new MessageOptions Prompt = "Using only the GitHub reference metadata in this message, summarize the reference. Do not call any tools.", Attachments = [ - new AttachmentGithubReference + new AttachmentGitHubReference { Number = 1234, - ReferenceType = AttachmentGithubReferenceType.Issue, + ReferenceType = AttachmentGitHubReferenceType.Issue, State = "open", Title = "Add E2E attachment coverage", Url = "https://github.com/github/copilot-sdk/issues/1234", @@ -845,9 +845,9 @@ await session.SendAndWaitAsync(new MessageOptions }); var userMessage = (await session.GetEventsAsync()).OfType().Last(); - var attachment = Assert.IsType(Assert.Single(userMessage.Data.Attachments!)); + var attachment = Assert.IsType(Assert.Single(userMessage.Data.Attachments!)); Assert.Equal(1234, attachment.Number); - Assert.Equal(AttachmentGithubReferenceType.Issue, attachment.ReferenceType); + Assert.Equal(AttachmentGitHubReferenceType.Issue, attachment.ReferenceType); Assert.Equal("open", attachment.State); Assert.Equal("Add E2E attachment coverage", attachment.Title); Assert.Equal("https://github.com/github/copilot-sdk/issues/1234", attachment.Url); diff --git a/go/internal/e2e/rpc_session_state_e2e_test.go b/go/internal/e2e/rpc_session_state_e2e_test.go index b7bb51106..f6698f082 100644 --- a/go/internal/e2e/rpc_session_state_e2e_test.go +++ b/go/internal/e2e/rpc_session_state_e2e_test.go @@ -515,7 +515,7 @@ func TestRPCSessionStateE2E(t *testing.T) { repo := "github/copilot-sdk-e2e" repoHost := "github.com" - hostType := rpc.SessionWorkingDirectoryContextHostTypeGithub + hostType := rpc.SessionWorkingDirectoryContextHostTypeGitHub baseCommit := "0000000000000000000000000000000000000000" headCommit := "1111111111111111111111111111111111111111" if _, err := session.RPC.Metadata.RecordContextChange(t.Context(), &rpc.MetadataRecordContextChangeRequest{ diff --git a/go/internal/e2e/session_e2e_test.go b/go/internal/e2e/session_e2e_test.go index 26707bdb3..dc2d54ca8 100644 --- a/go/internal/e2e/session_e2e_test.go +++ b/go/internal/e2e/session_e2e_test.go @@ -1420,13 +1420,13 @@ func TestSessionAttachmentsE2E(t *testing.T) { } number := int64(1234) - referenceType := copilot.AttachmentGithubReferenceTypeIssue + referenceType := copilot.AttachmentGitHubReferenceTypeIssue state := "open" title := "Add E2E attachment coverage" url := "https://github.com/github/copilot-sdk/issues/1234" _, err = session.SendAndWait(t.Context(), copilot.MessageOptions{ Prompt: "Using only the GitHub reference metadata in this message, summarize the reference. Do not call any tools.", - Attachments: []copilot.Attachment{&copilot.AttachmentGithubReference{ + Attachments: []copilot.Attachment{&copilot.AttachmentGitHubReference{ Number: number, ReferenceType: referenceType, State: state, @@ -1438,14 +1438,14 @@ func TestSessionAttachmentsE2E(t *testing.T) { t.Fatalf("SendAndWait failed: %v", err) } - attachment, ok := lastUserAttachment(t, session).(*copilot.AttachmentGithubReference) + attachment, ok := lastUserAttachment(t, session).(*copilot.AttachmentGitHubReference) if !ok { t.Fatalf("Expected GitHub reference attachment, got %T", lastUserAttachment(t, session)) } if attachment.Number != 1234 { t.Errorf("Expected Number=1234, got %v", attachment.Number) } - if attachment.ReferenceType != copilot.AttachmentGithubReferenceTypeIssue { + if attachment.ReferenceType != copilot.AttachmentGitHubReferenceTypeIssue { t.Errorf("Expected ReferenceType=Issue, got %v", attachment.ReferenceType) } if attachment.State != "open" { diff --git a/go/rpc/zrpc.go b/go/rpc/zrpc.go index 4fa6f49f9..534c527a7 100644 --- a/go/rpc/zrpc.go +++ b/go/rpc/zrpc.go @@ -421,13 +421,13 @@ func (AttachmentFile) Type() AttachmentType { } // GitHub issue, pull request, or discussion reference -// Experimental: AttachmentGithubReference is part of an experimental API and may change or +// Experimental: AttachmentGitHubReference is part of an experimental API and may change or // be removed. -type AttachmentGithubReference struct { +type AttachmentGitHubReference struct { // Issue, pull request, or discussion number Number int64 `json:"number"` // Type of GitHub reference - ReferenceType AttachmentGithubReferenceType `json:"referenceType"` + ReferenceType AttachmentGitHubReferenceType `json:"referenceType"` // Current state of the referenced item (e.g., open, closed, merged) State string `json:"state"` // Title of the referenced item @@ -436,9 +436,9 @@ type AttachmentGithubReference struct { URL string `json:"url"` } -func (AttachmentGithubReference) attachment() {} -func (AttachmentGithubReference) Type() AttachmentType { - return AttachmentTypeGithubReference +func (AttachmentGitHubReference) attachment() {} +func (AttachmentGitHubReference) Type() AttachmentType { + return AttachmentTypeGitHubReference } // Code selection attachment from an editor @@ -1700,21 +1700,21 @@ type InstalledPlugin struct { // Experimental: InstalledPluginSource is part of an experimental API and may change or be // removed. type InstalledPluginSource struct { - InstalledPluginSourceGithub *InstalledPluginSourceGithub + InstalledPluginSourceGitHub *InstalledPluginSourceGitHub InstalledPluginSourceLocal *InstalledPluginSourceLocal InstalledPluginSourceURL *InstalledPluginSourceURL String *string } -// Schema for the `InstalledPluginSourceGithub` type. -// Experimental: InstalledPluginSourceGithub is part of an experimental API and may change +// Schema for the `InstalledPluginSourceGitHub` type. +// Experimental: InstalledPluginSourceGitHub is part of an experimental API and may change // or be removed. -type InstalledPluginSourceGithub struct { +type InstalledPluginSourceGitHub struct { Path *string `json:"path,omitempty"` Ref *string `json:"ref,omitempty"` Repo string `json:"repo"` // Constant value. Always "github". - Source InstalledPluginSourceGithubSource `json:"source"` + Source InstalledPluginSourceGitHubSource `json:"source"` } // Schema for the `InstalledPluginSourceLocal` type. @@ -3952,13 +3952,13 @@ func (PushAttachmentFile) Type() PushAttachmentType { } // GitHub issue, pull request, or discussion reference -// Experimental: PushAttachmentGithubReference is part of an experimental API and may change +// Experimental: PushAttachmentGitHubReference is part of an experimental API and may change // or be removed. -type PushAttachmentGithubReference struct { +type PushAttachmentGitHubReference struct { // Issue, pull request, or discussion number Number int64 `json:"number"` // Type of GitHub reference - ReferenceType PushAttachmentGithubReferenceType `json:"referenceType"` + ReferenceType PushAttachmentGitHubReferenceType `json:"referenceType"` // Current state of the referenced item (e.g., open, closed, merged) State string `json:"state"` // Title of the referenced item @@ -3967,9 +3967,9 @@ type PushAttachmentGithubReference struct { URL string `json:"url"` } -func (PushAttachmentGithubReference) pushAttachment() {} -func (PushAttachmentGithubReference) Type() PushAttachmentType { - return PushAttachmentTypeGithubReference +func (PushAttachmentGitHubReference) pushAttachment() {} +func (PushAttachmentGitHubReference) Type() PushAttachmentType { + return PushAttachmentTypeGitHubReference } // Code selection attachment from an editor @@ -4738,21 +4738,21 @@ type SessionInstalledPlugin struct { // Experimental: SessionInstalledPluginSource is part of an experimental API and may change // or be removed. type SessionInstalledPluginSource struct { - SessionInstalledPluginSourceGithub *SessionInstalledPluginSourceGithub + SessionInstalledPluginSourceGitHub *SessionInstalledPluginSourceGitHub SessionInstalledPluginSourceLocal *SessionInstalledPluginSourceLocal SessionInstalledPluginSourceURL *SessionInstalledPluginSourceURL String *string } -// Schema for the `SessionInstalledPluginSourceGithub` type. -// Experimental: SessionInstalledPluginSourceGithub is part of an experimental API and may +// Schema for the `SessionInstalledPluginSourceGitHub` type. +// Experimental: SessionInstalledPluginSourceGitHub is part of an experimental API and may // change or be removed. -type SessionInstalledPluginSourceGithub struct { +type SessionInstalledPluginSourceGitHub struct { Path *string `json:"path,omitempty"` Ref *string `json:"ref,omitempty"` Repo string `json:"repo"` // Constant value. Always "github". - Source SessionInstalledPluginSourceGithubSource `json:"source"` + Source SessionInstalledPluginSourceGitHubSource `json:"source"` } // Schema for the `SessionInstalledPluginSourceLocal` type. @@ -7068,17 +7068,17 @@ const ( ) // Type of GitHub reference -// Experimental: AttachmentGithubReferenceType is part of an experimental API and may change +// Experimental: AttachmentGitHubReferenceType is part of an experimental API and may change // or be removed. -type AttachmentGithubReferenceType string +type AttachmentGitHubReferenceType string const ( // GitHub discussion reference. - AttachmentGithubReferenceTypeDiscussion AttachmentGithubReferenceType = "discussion" + AttachmentGitHubReferenceTypeDiscussion AttachmentGitHubReferenceType = "discussion" // GitHub issue reference. - AttachmentGithubReferenceTypeIssue AttachmentGithubReferenceType = "issue" + AttachmentGitHubReferenceTypeIssue AttachmentGitHubReferenceType = "issue" // GitHub pull request reference. - AttachmentGithubReferenceTypePr AttachmentGithubReferenceType = "pr" + AttachmentGitHubReferenceTypePr AttachmentGitHubReferenceType = "pr" ) // Type discriminator for Attachment. @@ -7089,7 +7089,7 @@ const ( AttachmentTypeDirectory AttachmentType = "directory" AttachmentTypeExtensionContext AttachmentType = "extension_context" AttachmentTypeFile AttachmentType = "file" - AttachmentTypeGithubReference AttachmentType = "github_reference" + AttachmentTypeGitHubReference AttachmentType = "github_reference" AttachmentTypeSelection AttachmentType = "selection" ) @@ -7162,7 +7162,7 @@ const ( type CopilotAPITokenAuthInfoHost string const ( - CopilotAPITokenAuthInfoHostHTTPSGithubCom CopilotAPITokenAuthInfoHost = "https://github.com" + CopilotAPITokenAuthInfoHostHTTPSGitHubCom CopilotAPITokenAuthInfoHost = "https://github.com" ) // Server transport type: stdio, http, sse (deprecated), or memory @@ -7281,14 +7281,14 @@ const ( type HMACAuthInfoHost string const ( - HMACAuthInfoHostHTTPSGithubCom HMACAuthInfoHost = "https://github.com" + HMACAuthInfoHostHTTPSGitHubCom HMACAuthInfoHost = "https://github.com" ) // Constant value. Always "github". -type InstalledPluginSourceGithubSource string +type InstalledPluginSourceGitHubSource string const ( - InstalledPluginSourceGithubSourceGithub InstalledPluginSourceGithubSource = "github" + InstalledPluginSourceGitHubSourceGitHub InstalledPluginSourceGitHubSource = "github" ) // Constant value. Always "local". @@ -7767,17 +7767,17 @@ const ( ) // Type of GitHub reference -// Experimental: PushAttachmentGithubReferenceType is part of an experimental API and may +// Experimental: PushAttachmentGitHubReferenceType is part of an experimental API and may // change or be removed. -type PushAttachmentGithubReferenceType string +type PushAttachmentGitHubReferenceType string const ( // GitHub discussion reference. - PushAttachmentGithubReferenceTypeDiscussion PushAttachmentGithubReferenceType = "discussion" + PushAttachmentGitHubReferenceTypeDiscussion PushAttachmentGitHubReferenceType = "discussion" // GitHub issue reference. - PushAttachmentGithubReferenceTypeIssue PushAttachmentGithubReferenceType = "issue" + PushAttachmentGitHubReferenceTypeIssue PushAttachmentGitHubReferenceType = "issue" // GitHub pull request reference. - PushAttachmentGithubReferenceTypePr PushAttachmentGithubReferenceType = "pr" + PushAttachmentGitHubReferenceTypePr PushAttachmentGitHubReferenceType = "pr" ) // Type discriminator for PushAttachment. @@ -7788,7 +7788,7 @@ const ( PushAttachmentTypeDirectory PushAttachmentType = "directory" PushAttachmentTypeExtensionContext PushAttachmentType = "extension_context" PushAttachmentTypeFile PushAttachmentType = "file" - PushAttachmentTypeGithubReference PushAttachmentType = "github_reference" + PushAttachmentTypeGitHubReference PushAttachmentType = "github_reference" PushAttachmentTypeSelection PushAttachmentType = "selection" ) @@ -7870,7 +7870,7 @@ const ( // Session repository is hosted on Azure DevOps. SessionContextHostTypeADO SessionContextHostType = "ado" // Session repository is hosted on GitHub. - SessionContextHostTypeGithub SessionContextHostType = "github" + SessionContextHostTypeGitHub SessionContextHostType = "github" ) // Error classification @@ -7923,10 +7923,10 @@ const ( ) // Constant value. Always "github". -type SessionInstalledPluginSourceGithubSource string +type SessionInstalledPluginSourceGitHubSource string const ( - SessionInstalledPluginSourceGithubSourceGithub SessionInstalledPluginSourceGithubSource = "github" + SessionInstalledPluginSourceGitHubSourceGitHub SessionInstalledPluginSourceGitHubSource = "github" ) // Constant value. Always "local". @@ -7979,7 +7979,7 @@ const ( // The working directory repository is hosted on Azure DevOps. SessionWorkingDirectoryContextHostTypeADO SessionWorkingDirectoryContextHostType = "ado" // The working directory repository is hosted on GitHub. - SessionWorkingDirectoryContextHostTypeGithub SessionWorkingDirectoryContextHostType = "github" + SessionWorkingDirectoryContextHostTypeGitHub SessionWorkingDirectoryContextHostType = "github" ) // Signal to send (default: SIGTERM) @@ -8269,7 +8269,7 @@ const ( // Workspace summary repository is hosted on Azure DevOps. WorkspaceSummaryHostTypeADO WorkspaceSummaryHostType = "ado" // Workspace summary repository is hosted on GitHub. - WorkspaceSummaryHostTypeGithub WorkspaceSummaryHostType = "github" + WorkspaceSummaryHostTypeGitHub WorkspaceSummaryHostType = "github" ) // Allowed values for the `WorkspacesWorkspaceDetailsHostType` enumeration. @@ -8281,7 +8281,7 @@ const ( // Workspace repository is hosted on Azure DevOps. WorkspacesWorkspaceDetailsHostTypeADO WorkspacesWorkspaceDetailsHostType = "ado" // Workspace repository is hosted on GitHub. - WorkspacesWorkspaceDetailsHostTypeGithub WorkspacesWorkspaceDetailsHostType = "github" + WorkspacesWorkspaceDetailsHostTypeGitHub WorkspacesWorkspaceDetailsHostType = "github" ) type serverAPI struct { diff --git a/go/rpc/zrpc_encoding.go b/go/rpc/zrpc_encoding.go index 85548862f..0d192c600 100644 --- a/go/rpc/zrpc_encoding.go +++ b/go/rpc/zrpc_encoding.go @@ -142,8 +142,8 @@ func unmarshalAttachment(data []byte) (Attachment, error) { return nil, err } return &d, nil - case AttachmentTypeGithubReference: - var d AttachmentGithubReference + case AttachmentTypeGitHubReference: + var d AttachmentGitHubReference if err := json.Unmarshal(data, &d); err != nil { return nil, err } @@ -214,8 +214,8 @@ func (r AttachmentFile) MarshalJSON() ([]byte, error) { }) } -func (r AttachmentGithubReference) MarshalJSON() ([]byte, error) { - type alias AttachmentGithubReference +func (r AttachmentGitHubReference) MarshalJSON() ([]byte, error) { + type alias AttachmentGitHubReference return json.Marshal(struct { Type AttachmentType `json:"type"` alias @@ -789,8 +789,8 @@ func (r *HandlePendingToolCallRequest) UnmarshalJSON(data []byte) error { } func (r InstalledPluginSource) MarshalJSON() ([]byte, error) { - if r.InstalledPluginSourceGithub != nil { - return json.Marshal(r.InstalledPluginSourceGithub) + if r.InstalledPluginSourceGitHub != nil { + return json.Marshal(r.InstalledPluginSourceGitHub) } if r.InstalledPluginSourceLocal != nil { return json.Marshal(r.InstalledPluginSourceLocal) @@ -810,9 +810,9 @@ func (r *InstalledPluginSource) UnmarshalJSON(data []byte) error { return nil } { - var value InstalledPluginSourceGithub + var value InstalledPluginSourceGitHub if err := json.Unmarshal(data, &value); err == nil { - *r = InstalledPluginSource{InstalledPluginSourceGithub: &value} + *r = InstalledPluginSource{InstalledPluginSourceGitHub: &value} return nil } } @@ -2226,8 +2226,8 @@ func unmarshalPushAttachment(data []byte) (PushAttachment, error) { return nil, err } return &d, nil - case PushAttachmentTypeGithubReference: - var d PushAttachmentGithubReference + case PushAttachmentTypeGitHubReference: + var d PushAttachmentGitHubReference if err := json.Unmarshal(data, &d); err != nil { return nil, err } @@ -2298,8 +2298,8 @@ func (r PushAttachmentFile) MarshalJSON() ([]byte, error) { }) } -func (r PushAttachmentGithubReference) MarshalJSON() ([]byte, error) { - type alias PushAttachmentGithubReference +func (r PushAttachmentGitHubReference) MarshalJSON() ([]byte, error) { + type alias PushAttachmentGitHubReference return json.Marshal(struct { Type PushAttachmentType `json:"type"` alias @@ -2389,8 +2389,8 @@ func (r *SendRequest) UnmarshalJSON(data []byte) error { } func (r SessionInstalledPluginSource) MarshalJSON() ([]byte, error) { - if r.SessionInstalledPluginSourceGithub != nil { - return json.Marshal(r.SessionInstalledPluginSourceGithub) + if r.SessionInstalledPluginSourceGitHub != nil { + return json.Marshal(r.SessionInstalledPluginSourceGitHub) } if r.SessionInstalledPluginSourceLocal != nil { return json.Marshal(r.SessionInstalledPluginSourceLocal) @@ -2410,9 +2410,9 @@ func (r *SessionInstalledPluginSource) UnmarshalJSON(data []byte) error { return nil } { - var value SessionInstalledPluginSourceGithub + var value SessionInstalledPluginSourceGitHub if err := json.Unmarshal(data, &value); err == nil { - *r = SessionInstalledPluginSource{SessionInstalledPluginSourceGithub: &value} + *r = SessionInstalledPluginSource{SessionInstalledPluginSourceGitHub: &value} return nil } } diff --git a/go/rpc/zsession_events.go b/go/rpc/zsession_events.go index e489fb011..69feec604 100644 --- a/go/rpc/zsession_events.go +++ b/go/rpc/zsession_events.go @@ -3251,7 +3251,7 @@ const ( // Repository is hosted on Azure DevOps. WorkingDirectoryContextHostTypeADO WorkingDirectoryContextHostType = "ado" // Repository is hosted on GitHub. - WorkingDirectoryContextHostTypeGithub WorkingDirectoryContextHostType = "github" + WorkingDirectoryContextHostTypeGitHub WorkingDirectoryContextHostType = "github" ) // Whether the file was newly created or updated diff --git a/go/zsession_events.go b/go/zsession_events.go index a4331308c..70ce3e6d5 100644 --- a/go/zsession_events.go +++ b/go/zsession_events.go @@ -29,8 +29,8 @@ type ( AttachmentExtensionContext = rpc.AttachmentExtensionContext AttachmentFile = rpc.AttachmentFile AttachmentFileLineRange = rpc.AttachmentFileLineRange - AttachmentGithubReference = rpc.AttachmentGithubReference - AttachmentGithubReferenceType = rpc.AttachmentGithubReferenceType + AttachmentGitHubReference = rpc.AttachmentGitHubReference + AttachmentGitHubReferenceType = rpc.AttachmentGitHubReferenceType AttachmentSelection = rpc.AttachmentSelection AttachmentSelectionDetails = rpc.AttachmentSelectionDetails AttachmentSelectionDetailsEnd = rpc.AttachmentSelectionDetailsEnd @@ -284,14 +284,14 @@ const ( AssistantUsageAPIEndpointResponses = rpc.AssistantUsageAPIEndpointResponses AssistantUsageAPIEndpointV1Messages = rpc.AssistantUsageAPIEndpointV1Messages AssistantUsageAPIEndpointWsResponses = rpc.AssistantUsageAPIEndpointWsResponses - AttachmentGithubReferenceTypeDiscussion = rpc.AttachmentGithubReferenceTypeDiscussion - AttachmentGithubReferenceTypeIssue = rpc.AttachmentGithubReferenceTypeIssue - AttachmentGithubReferenceTypePr = rpc.AttachmentGithubReferenceTypePr + AttachmentGitHubReferenceTypeDiscussion = rpc.AttachmentGitHubReferenceTypeDiscussion + AttachmentGitHubReferenceTypeIssue = rpc.AttachmentGitHubReferenceTypeIssue + AttachmentGitHubReferenceTypePr = rpc.AttachmentGitHubReferenceTypePr AttachmentTypeBlob = rpc.AttachmentTypeBlob AttachmentTypeDirectory = rpc.AttachmentTypeDirectory AttachmentTypeExtensionContext = rpc.AttachmentTypeExtensionContext AttachmentTypeFile = rpc.AttachmentTypeFile - AttachmentTypeGithubReference = rpc.AttachmentTypeGithubReference + AttachmentTypeGitHubReference = rpc.AttachmentTypeGitHubReference AttachmentTypeSelection = rpc.AttachmentTypeSelection AutoModeSwitchResponseNo = rpc.AutoModeSwitchResponseNo AutoModeSwitchResponseYes = rpc.AutoModeSwitchResponseYes @@ -522,7 +522,7 @@ const ( UserToolSessionApprovalKindRead = rpc.UserToolSessionApprovalKindRead UserToolSessionApprovalKindWrite = rpc.UserToolSessionApprovalKindWrite WorkingDirectoryContextHostTypeADO = rpc.WorkingDirectoryContextHostTypeADO - WorkingDirectoryContextHostTypeGithub = rpc.WorkingDirectoryContextHostTypeGithub + WorkingDirectoryContextHostTypeGitHub = rpc.WorkingDirectoryContextHostTypeGitHub WorkspaceFileChangedOperationCreate = rpc.WorkspaceFileChangedOperationCreate WorkspaceFileChangedOperationUpdate = rpc.WorkspaceFileChangedOperationUpdate ) diff --git a/java/scripts/codegen/java.ts b/java/scripts/codegen/java.ts index 535af044f..7f73a93c9 100644 --- a/java/scripts/codegen/java.ts +++ b/java/scripts/codegen/java.ts @@ -29,12 +29,96 @@ const COPYRIGHT = `/*----------------------------------------------------------- // ── Naming utilities ───────────────────────────────────────────────────────── +/** + * Correct the GitHub brand casing in a generated identifier or documentation + * string. Schema titles/definition names and value-derived identifiers may + * render the brand as "Github"; the correct casing is "GitHub". Lowercase + * wire/protocol values (e.g. "github") are left untouched. Idempotent. + */ +function fixBrandCasing(value: string): string { + return value.replace(/Github/g, "GitHub"); +} + +const BRAND_NORMALIZED_STRING_KEYS = new Set(["title", "description", "markdownDescription"]); + +/** + * Recursively normalize GitHub brand casing within a parsed JSON schema: + * definition-map keys, `$ref` pointers (definition-name segment only), and + * documentation strings. Wire-level values (`const`, `enum`, `default`, ...) are + * left untouched. Mutates in place and returns the schema. + */ +function normalizeSchemaBrandCasing(schema: T): T { + normalizeBrandCasingNode(schema); + return schema; +} + +function normalizeBrandCasingNode(node: unknown): void { + if (Array.isArray(node)) { + for (const item of node) normalizeBrandCasingNode(item); + return; + } + if (node === null || typeof node !== "object") return; + const obj = node as Record; + + for (const defsKey of ["definitions", "$defs"] as const) { + const defs = obj[defsKey]; + if (defs && typeof defs === "object" && !Array.isArray(defs)) { + renameBrandDefinitionKeys(defs as Record); + } + } + + for (const [key, value] of Object.entries(obj)) { + if (typeof value === "string") { + if (key === "$ref") { + obj[key] = fixBrandRef(value); + } else if (BRAND_NORMALIZED_STRING_KEYS.has(key)) { + obj[key] = fixBrandCasing(value); + } + } else { + normalizeBrandCasingNode(value); + } + } +} + +function fixBrandRef(ref: string): string { + const lastSlash = ref.lastIndexOf("/"); + if (lastSlash === -1) return ref; + return `${ref.slice(0, lastSlash + 1)}${fixBrandCasing(ref.slice(lastSlash + 1))}`; +} + +function stableStringify(value: unknown): string { + if (Array.isArray(value)) { + return `[${value.map((item) => stableStringify(item)).join(",")}]`; + } + + if (value && typeof value === "object") { + const entries = Object.entries(value as Record).sort(([a], [b]) => a.localeCompare(b)); + return `{${entries.map(([key, entryValue]) => `${JSON.stringify(key)}:${stableStringify(entryValue)}`).join(",")}}`; + } + + return JSON.stringify(value) ?? "undefined"; +} + +function renameBrandDefinitionKeys(defs: Record): void { + for (const oldKey of Object.keys(defs)) { + const newKey = fixBrandCasing(oldKey); + if (newKey === oldKey) continue; + if (newKey in defs && stableStringify(defs[newKey]) !== stableStringify(defs[oldKey])) { + throw new Error( + `Brand-casing normalization collision: "${oldKey}" -> "${newKey}" but a different definition already exists under "${newKey}".` + ); + } + defs[newKey] = defs[oldKey]; + delete defs[oldKey]; + } +} + function toPascalCase(name: string): string { - return name.split(/[-_.]/).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(""); + return fixBrandCasing(name.split(/[-_.]/).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join("")); } function toJavaClassName(typeName: string): string { - return typeName.split(/[._]/).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join(""); + return fixBrandCasing(typeName.split(/[._]/).map((p) => p.charAt(0).toUpperCase() + p.slice(1)).join("")); } /** Java reserved keywords and Object method names that cannot be used as record component names. */ @@ -618,7 +702,7 @@ function extractEventVariants(schema: JSONSchema7): EventVariant[] { async function generateSessionEvents(schemaPath: string): Promise { console.log("\n📋 Generating session event classes..."); const schemaContent = await fs.readFile(schemaPath, "utf-8"); - const schema = JSON.parse(schemaContent) as JSONSchema7; + const schema = normalizeSchemaBrandCasing(JSON.parse(schemaContent) as JSONSchema7); // Set module-level definitions for $ref resolution currentDefinitions = (schema.definitions ?? {}) as Record; @@ -1190,7 +1274,7 @@ function generateRpcClass( async function generateRpcTypes(schemaPath: string): Promise { console.log("\n🔌 Generating RPC types..."); const schemaContent = await fs.readFile(schemaPath, "utf-8"); - const schema = JSON.parse(schemaContent) as Record & { + const schema = normalizeSchemaBrandCasing(JSON.parse(schemaContent)) as Record & { server?: Record; session?: Record; clientSession?: Record; @@ -1207,7 +1291,7 @@ async function generateRpcTypes(schemaPath: string): Promise { try { const sessionEventsSchemaPath = await getSessionEventsSchemaPath(); const sessionEventsContent = await fs.readFile(sessionEventsSchemaPath, "utf-8"); - const sessionEventsSchema = JSON.parse(sessionEventsContent) as JSONSchema7; + const sessionEventsSchema = normalizeSchemaBrandCasing(JSON.parse(sessionEventsContent) as JSONSchema7); crossSchemaDefinitions.set("session-events.schema.json", (sessionEventsSchema.definitions ?? {}) as Record); } catch (e) { @@ -1904,7 +1988,7 @@ async function generateRpcWrappers(schemaPath: string): Promise { console.log("\n🔧 Generating RPC wrapper classes..."); const schemaContent = await fs.readFile(schemaPath, "utf-8"); - const schema = JSON.parse(schemaContent) as { + const schema = normalizeSchemaBrandCasing(JSON.parse(schemaContent)) as { server?: Record; session?: Record; clientSession?: Record; diff --git a/java/src/generated/java/com/github/copilot/generated/UserMessageAttachment.java b/java/src/generated/java/com/github/copilot/generated/UserMessageAttachment.java index aebfd2177..08f0bdfb5 100644 --- a/java/src/generated/java/com/github/copilot/generated/UserMessageAttachment.java +++ b/java/src/generated/java/com/github/copilot/generated/UserMessageAttachment.java @@ -22,7 +22,7 @@ @JsonSubTypes.Type(value = UserMessageAttachmentFile.class, name = "file"), @JsonSubTypes.Type(value = UserMessageAttachmentDirectory.class, name = "directory"), @JsonSubTypes.Type(value = UserMessageAttachmentSelection.class, name = "selection"), - @JsonSubTypes.Type(value = UserMessageAttachmentGithubReference.class, name = "github_reference"), + @JsonSubTypes.Type(value = UserMessageAttachmentGitHubReference.class, name = "github_reference"), @JsonSubTypes.Type(value = UserMessageAttachmentBlob.class, name = "blob") }) @JsonIgnoreProperties(ignoreUnknown = true) diff --git a/java/src/generated/java/com/github/copilot/generated/UserMessageAttachmentGithubReference.java b/java/src/generated/java/com/github/copilot/generated/UserMessageAttachmentGitHubReference.java similarity index 88% rename from java/src/generated/java/com/github/copilot/generated/UserMessageAttachmentGithubReference.java rename to java/src/generated/java/com/github/copilot/generated/UserMessageAttachmentGitHubReference.java index 69ae1ecf1..381b970e2 100644 --- a/java/src/generated/java/com/github/copilot/generated/UserMessageAttachmentGithubReference.java +++ b/java/src/generated/java/com/github/copilot/generated/UserMessageAttachmentGitHubReference.java @@ -20,7 +20,7 @@ @JsonIgnoreProperties(ignoreUnknown = true) @JsonInclude(JsonInclude.Include.NON_NULL) @javax.annotation.processing.Generated("copilot-sdk-codegen") -public final class UserMessageAttachmentGithubReference extends UserMessageAttachment { +public final class UserMessageAttachmentGitHubReference extends UserMessageAttachment { @JsonProperty("type") private final String type = "github_reference"; @@ -38,7 +38,7 @@ public final class UserMessageAttachmentGithubReference extends UserMessageAttac /** Type of GitHub reference */ @JsonProperty("referenceType") - private UserMessageAttachmentGithubReferenceType referenceType; + private UserMessageAttachmentGitHubReferenceType referenceType; /** Current state of the referenced item (e.g., open, closed, merged) */ @JsonProperty("state") @@ -54,8 +54,8 @@ public final class UserMessageAttachmentGithubReference extends UserMessageAttac public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } - public UserMessageAttachmentGithubReferenceType getReferenceType() { return referenceType; } - public void setReferenceType(UserMessageAttachmentGithubReferenceType referenceType) { this.referenceType = referenceType; } + public UserMessageAttachmentGitHubReferenceType getReferenceType() { return referenceType; } + public void setReferenceType(UserMessageAttachmentGitHubReferenceType referenceType) { this.referenceType = referenceType; } public String getState() { return state; } public void setState(String state) { this.state = state; } diff --git a/java/src/generated/java/com/github/copilot/generated/UserMessageAttachmentGithubReferenceType.java b/java/src/generated/java/com/github/copilot/generated/UserMessageAttachmentGitHubReferenceType.java similarity index 78% rename from java/src/generated/java/com/github/copilot/generated/UserMessageAttachmentGithubReferenceType.java rename to java/src/generated/java/com/github/copilot/generated/UserMessageAttachmentGitHubReferenceType.java index 470de9316..11a8e3b5f 100644 --- a/java/src/generated/java/com/github/copilot/generated/UserMessageAttachmentGithubReferenceType.java +++ b/java/src/generated/java/com/github/copilot/generated/UserMessageAttachmentGitHubReferenceType.java @@ -15,7 +15,7 @@ * @since 1.0.0 */ @javax.annotation.processing.Generated("copilot-sdk-codegen") -public enum UserMessageAttachmentGithubReferenceType { +public enum UserMessageAttachmentGitHubReferenceType { /** The {@code issue} variant. */ ISSUE("issue"), /** The {@code pr} variant. */ @@ -24,14 +24,14 @@ public enum UserMessageAttachmentGithubReferenceType { DISCUSSION("discussion"); private final String value; - UserMessageAttachmentGithubReferenceType(String value) { this.value = value; } + UserMessageAttachmentGitHubReferenceType(String value) { this.value = value; } @com.fasterxml.jackson.annotation.JsonValue public String getValue() { return value; } @com.fasterxml.jackson.annotation.JsonCreator - public static UserMessageAttachmentGithubReferenceType fromValue(String value) { - for (UserMessageAttachmentGithubReferenceType v : values()) { + public static UserMessageAttachmentGitHubReferenceType fromValue(String value) { + for (UserMessageAttachmentGitHubReferenceType v : values()) { if (v.value.equals(value)) return v; } - throw new IllegalArgumentException("Unknown UserMessageAttachmentGithubReferenceType value: " + value); + throw new IllegalArgumentException("Unknown UserMessageAttachmentGitHubReferenceType value: " + value); } } diff --git a/java/src/generated/java/com/github/copilot/generated/rpc/SendAttachment.java b/java/src/generated/java/com/github/copilot/generated/rpc/SendAttachment.java index 7b925407b..1d1044270 100644 --- a/java/src/generated/java/com/github/copilot/generated/rpc/SendAttachment.java +++ b/java/src/generated/java/com/github/copilot/generated/rpc/SendAttachment.java @@ -22,7 +22,7 @@ @JsonSubTypes.Type(value = SendAttachmentFile.class, name = "file"), @JsonSubTypes.Type(value = SendAttachmentDirectory.class, name = "directory"), @JsonSubTypes.Type(value = SendAttachmentSelection.class, name = "selection"), - @JsonSubTypes.Type(value = SendAttachmentGithubReference.class, name = "github_reference"), + @JsonSubTypes.Type(value = SendAttachmentGitHubReference.class, name = "github_reference"), @JsonSubTypes.Type(value = SendAttachmentBlob.class, name = "blob") }) @JsonIgnoreProperties(ignoreUnknown = true) diff --git a/java/src/generated/java/com/github/copilot/generated/rpc/SendAttachmentGithubReference.java b/java/src/generated/java/com/github/copilot/generated/rpc/SendAttachmentGitHubReference.java similarity index 88% rename from java/src/generated/java/com/github/copilot/generated/rpc/SendAttachmentGithubReference.java rename to java/src/generated/java/com/github/copilot/generated/rpc/SendAttachmentGitHubReference.java index a782f7c11..ce4f0363a 100644 --- a/java/src/generated/java/com/github/copilot/generated/rpc/SendAttachmentGithubReference.java +++ b/java/src/generated/java/com/github/copilot/generated/rpc/SendAttachmentGitHubReference.java @@ -20,7 +20,7 @@ @JsonIgnoreProperties(ignoreUnknown = true) @JsonInclude(JsonInclude.Include.NON_NULL) @javax.annotation.processing.Generated("copilot-sdk-codegen") -public final class SendAttachmentGithubReference extends SendAttachment { +public final class SendAttachmentGitHubReference extends SendAttachment { @JsonProperty("type") private final String type = "github_reference"; @@ -38,7 +38,7 @@ public final class SendAttachmentGithubReference extends SendAttachment { /** Type of GitHub reference */ @JsonProperty("referenceType") - private SendAttachmentGithubReferenceType referenceType; + private SendAttachmentGitHubReferenceType referenceType; /** Current state of the referenced item (e.g., open, closed, merged) */ @JsonProperty("state") @@ -54,8 +54,8 @@ public final class SendAttachmentGithubReference extends SendAttachment { public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } - public SendAttachmentGithubReferenceType getReferenceType() { return referenceType; } - public void setReferenceType(SendAttachmentGithubReferenceType referenceType) { this.referenceType = referenceType; } + public SendAttachmentGitHubReferenceType getReferenceType() { return referenceType; } + public void setReferenceType(SendAttachmentGitHubReferenceType referenceType) { this.referenceType = referenceType; } public String getState() { return state; } public void setState(String state) { this.state = state; } diff --git a/java/src/generated/java/com/github/copilot/generated/rpc/SendAttachmentGithubReferenceType.java b/java/src/generated/java/com/github/copilot/generated/rpc/SendAttachmentGitHubReferenceType.java similarity index 78% rename from java/src/generated/java/com/github/copilot/generated/rpc/SendAttachmentGithubReferenceType.java rename to java/src/generated/java/com/github/copilot/generated/rpc/SendAttachmentGitHubReferenceType.java index d0e757e83..18c9cdca4 100644 --- a/java/src/generated/java/com/github/copilot/generated/rpc/SendAttachmentGithubReferenceType.java +++ b/java/src/generated/java/com/github/copilot/generated/rpc/SendAttachmentGitHubReferenceType.java @@ -15,7 +15,7 @@ * @since 1.0.0 */ @javax.annotation.processing.Generated("copilot-sdk-codegen") -public enum SendAttachmentGithubReferenceType { +public enum SendAttachmentGitHubReferenceType { /** The {@code issue} variant. */ ISSUE("issue"), /** The {@code pr} variant. */ @@ -24,14 +24,14 @@ public enum SendAttachmentGithubReferenceType { DISCUSSION("discussion"); private final String value; - SendAttachmentGithubReferenceType(String value) { this.value = value; } + SendAttachmentGitHubReferenceType(String value) { this.value = value; } @com.fasterxml.jackson.annotation.JsonValue public String getValue() { return value; } @com.fasterxml.jackson.annotation.JsonCreator - public static SendAttachmentGithubReferenceType fromValue(String value) { - for (SendAttachmentGithubReferenceType v : values()) { + public static SendAttachmentGitHubReferenceType fromValue(String value) { + for (SendAttachmentGitHubReferenceType v : values()) { if (v.value.equals(value)) return v; } - throw new IllegalArgumentException("Unknown SendAttachmentGithubReferenceType value: " + value); + throw new IllegalArgumentException("Unknown SendAttachmentGitHubReferenceType value: " + value); } } diff --git a/nodejs/src/generated/rpc.ts b/nodejs/src/generated/rpc.ts index 9c6ea74df..331f1f8cc 100644 --- a/nodejs/src/generated/rpc.ts +++ b/nodejs/src/generated/rpc.ts @@ -416,7 +416,7 @@ export type FilterMapping = /** @experimental */ export type InstalledPluginSource = | string - | InstalledPluginSourceGithub + | InstalledPluginSourceGitHub | InstalledPluginSourceUrl | InstalledPluginSourceLocal; /** @@ -946,17 +946,17 @@ export type PushAttachment = | PushAttachmentFile | PushAttachmentDirectory | PushAttachmentSelection - | PushAttachmentGithubReference + | PushAttachmentGitHubReference | PushAttachmentBlob | ExtensionContextPushInput; /** * Type of GitHub reference * * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema - * via the `definition` "PushAttachmentGithubReferenceType". + * via the `definition` "PushAttachmentGitHubReferenceType". */ /** @experimental */ -export type PushAttachmentGithubReferenceType = +export type PushAttachmentGitHubReferenceType = /** GitHub issue reference. */ | "issue" /** GitHub pull request reference. */ @@ -1087,7 +1087,7 @@ export type SessionFsSqliteQueryType = /** @experimental */ export type SessionInstalledPluginSource = | string - | SessionInstalledPluginSourceGithub + | SessionInstalledPluginSourceGitHub | SessionInstalledPluginSourceUrl | SessionInstalledPluginSourceLocal; /** @@ -3598,13 +3598,13 @@ export interface InstalledPlugin { source?: InstalledPluginSource; } /** - * Schema for the `InstalledPluginSourceGithub` type. + * Schema for the `InstalledPluginSourceGitHub` type. * * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema - * via the `definition` "InstalledPluginSourceGithub". + * via the `definition` "InstalledPluginSourceGitHub". */ /** @experimental */ -export interface InstalledPluginSourceGithub { +export interface InstalledPluginSourceGitHub { /** * Constant value. Always "github". */ @@ -6577,10 +6577,10 @@ export interface PushAttachmentSelectionDetailsEnd { * GitHub issue, pull request, or discussion reference * * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema - * via the `definition` "PushAttachmentGithubReference". + * via the `definition` "PushAttachmentGitHubReference". */ /** @experimental */ -export interface PushAttachmentGithubReference { +export interface PushAttachmentGitHubReference { /** * Attachment type discriminator */ @@ -6593,7 +6593,7 @@ export interface PushAttachmentGithubReference { * Title of the referenced item */ title: string; - referenceType: PushAttachmentGithubReferenceType; + referenceType: PushAttachmentGitHubReferenceType; /** * Current state of the referenced item (e.g., open, closed, merged) */ @@ -7593,13 +7593,13 @@ export interface SessionInstalledPlugin { source?: SessionInstalledPluginSource; } /** - * Schema for the `SessionInstalledPluginSourceGithub` type. + * Schema for the `SessionInstalledPluginSourceGitHub` type. * * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema - * via the `definition` "SessionInstalledPluginSourceGithub". + * via the `definition` "SessionInstalledPluginSourceGitHub". */ /** @experimental */ -export interface SessionInstalledPluginSourceGithub { +export interface SessionInstalledPluginSourceGitHub { /** * Constant value. Always "github". */ diff --git a/nodejs/src/generated/session-events.ts b/nodejs/src/generated/session-events.ts index 2351bcd2a..22a68ed9c 100644 --- a/nodejs/src/generated/session-events.ts +++ b/nodejs/src/generated/session-events.ts @@ -206,13 +206,13 @@ export type Attachment = | AttachmentFile | AttachmentDirectory | AttachmentSelection - | AttachmentGithubReference + | AttachmentGitHubReference | AttachmentBlob | AttachmentExtensionContext; /** * Type of GitHub reference */ -export type AttachmentGithubReferenceType = +export type AttachmentGitHubReferenceType = /** GitHub issue reference. */ | "issue" /** GitHub pull request reference. */ @@ -2278,12 +2278,12 @@ export interface AttachmentSelectionDetailsStart { /** * GitHub issue, pull request, or discussion reference */ -export interface AttachmentGithubReference { +export interface AttachmentGitHubReference { /** * Issue, pull request, or discussion number */ number: number; - referenceType: AttachmentGithubReferenceType; + referenceType: AttachmentGitHubReferenceType; /** * Current state of the referenced item (e.g., open, closed, merged) */ diff --git a/python/copilot/generated/rpc.py b/python/copilot/generated/rpc.py index 12bff9e7f..90385b7b0 100644 --- a/python/copilot/generated/rpc.py +++ b/python/copilot/generated/rpc.py @@ -3847,7 +3847,7 @@ def to_dict(self) -> dict: result["start"] = from_int(self.start) return result -class PushAttachmentGithubReferenceTypeEnum(Enum): +class PushAttachmentGitHubReferenceTypeEnum(Enum): """Type of GitHub reference""" DISCUSSION = "discussion" @@ -3917,7 +3917,7 @@ class PushAttachmentFileType(Enum): FILE = "file" # Experimental: this type is part of an experimental API and may change or be removed. -class PushAttachmentGithubReferenceType(Enum): +class PushAttachmentGitHubReferenceType(Enum): GITHUB_REFERENCE = "github_reference" class PushAttachmentSelectionType(Enum): @@ -8031,8 +8031,8 @@ def to_dict(self) -> dict: # Experimental: this type is part of an experimental API and may change or be removed. @dataclass -class InstalledPluginSourceGithub: - """Schema for the `InstalledPluginSourceGithub` type.""" +class InstalledPluginSourceGitHub: + """Schema for the `InstalledPluginSourceGitHub` type.""" repo: str source: FluffySource @@ -8042,13 +8042,13 @@ class InstalledPluginSourceGithub: ref: str | None = None @staticmethod - def from_dict(obj: Any) -> 'InstalledPluginSourceGithub': + def from_dict(obj: Any) -> 'InstalledPluginSourceGitHub': assert isinstance(obj, dict) repo = from_str(obj.get("repo")) source = FluffySource(obj.get("source")) path = from_union([from_str, from_none], obj.get("path")) ref = from_union([from_str, from_none], obj.get("ref")) - return InstalledPluginSourceGithub(repo, source, path, ref) + return InstalledPluginSourceGitHub(repo, source, path, ref) def to_dict(self) -> dict: result: dict = {} @@ -8062,8 +8062,8 @@ def to_dict(self) -> dict: # Experimental: this type is part of an experimental API and may change or be removed. @dataclass -class SessionInstalledPluginSourceGithub: - """Schema for the `SessionInstalledPluginSourceGithub` type.""" +class SessionInstalledPluginSourceGitHub: + """Schema for the `SessionInstalledPluginSourceGitHub` type.""" repo: str source: FluffySource @@ -8073,13 +8073,13 @@ class SessionInstalledPluginSourceGithub: ref: str | None = None @staticmethod - def from_dict(obj: Any) -> 'SessionInstalledPluginSourceGithub': + def from_dict(obj: Any) -> 'SessionInstalledPluginSourceGitHub': assert isinstance(obj, dict) repo = from_str(obj.get("repo")) source = FluffySource(obj.get("source")) path = from_union([from_str, from_none], obj.get("path")) ref = from_union([from_str, from_none], obj.get("ref")) - return SessionInstalledPluginSourceGithub(repo, source, path, ref) + return SessionInstalledPluginSourceGitHub(repo, source, path, ref) def to_dict(self) -> dict: result: dict = {} @@ -10412,13 +10412,13 @@ def to_dict(self) -> dict: # Experimental: this type is part of an experimental API and may change or be removed. @dataclass -class PushAttachmentGithubReference: +class PushAttachmentGitHubReference: """GitHub issue, pull request, or discussion reference""" number: int """Issue, pull request, or discussion number""" - reference_type: PushAttachmentGithubReferenceTypeEnum + reference_type: PushAttachmentGitHubReferenceTypeEnum """Type of GitHub reference""" state: str @@ -10434,19 +10434,19 @@ class PushAttachmentGithubReference: """URL to the referenced item on GitHub""" @staticmethod - def from_dict(obj: Any) -> 'PushAttachmentGithubReference': + def from_dict(obj: Any) -> 'PushAttachmentGitHubReference': assert isinstance(obj, dict) number = from_int(obj.get("number")) - reference_type = PushAttachmentGithubReferenceTypeEnum(obj.get("referenceType")) + reference_type = PushAttachmentGitHubReferenceTypeEnum(obj.get("referenceType")) state = from_str(obj.get("state")) title = from_str(obj.get("title")) url = from_str(obj.get("url")) - return PushAttachmentGithubReference(number, reference_type, state, title, url) + return PushAttachmentGitHubReference(number, reference_type, state, title, url) def to_dict(self) -> dict: result: dict = {} result["number"] = from_int(self.number) - result["referenceType"] = to_enum(PushAttachmentGithubReferenceTypeEnum, self.reference_type) + result["referenceType"] = to_enum(PushAttachmentGitHubReferenceTypeEnum, self.reference_type) result["state"] = from_str(self.state) result["title"] = from_str(self.title) result["type"] = self.type @@ -12354,7 +12354,7 @@ def to_dict(self) -> dict: # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class InstalledPluginSource: - """Schema for the `InstalledPluginSourceGithub` type. + """Schema for the `InstalledPluginSourceGitHub` type. Schema for the `InstalledPluginSourceUrl` type. @@ -12398,7 +12398,7 @@ def to_dict(self) -> dict: # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionInstalledPluginSource: - """Schema for the `SessionInstalledPluginSourceGithub` type. + """Schema for the `SessionInstalledPluginSourceGitHub` type. Schema for the `SessionInstalledPluginSourceUrl` type. @@ -15818,7 +15818,7 @@ class RPC: hmac_auth_info: HMACAuthInfo installed_plugin: InstalledPlugin installed_plugin_source: InstalledPluginSource | str - installed_plugin_source_github: InstalledPluginSourceGithub + installed_plugin_source_git_hub: InstalledPluginSourceGitHub installed_plugin_source_local: InstalledPluginSourceLocal installed_plugin_source_url: InstalledPluginSourceURL instructions_get_sources_result: InstructionsGetSourcesResult @@ -16032,8 +16032,8 @@ class RPC: push_attachment_directory: PushAttachmentDirectory push_attachment_file: PushAttachmentFile push_attachment_file_line_range: PushAttachmentFileLineRange - push_attachment_github_reference: PushAttachmentGithubReference - push_attachment_github_reference_type: PushAttachmentGithubReferenceTypeEnum + push_attachment_git_hub_reference: PushAttachmentGitHubReference + push_attachment_git_hub_reference_type: PushAttachmentGitHubReferenceTypeEnum push_attachment_selection: PushAttachmentSelection push_attachment_selection_details: PushAttachmentSelectionDetails push_attachment_selection_details_end: PushAttachmentSelectionDetailsEnd @@ -16102,7 +16102,7 @@ class RPC: session_fs_write_file_request: SessionFSWriteFileRequest session_installed_plugin: SessionInstalledPlugin session_installed_plugin_source: SessionInstalledPluginSource | str - session_installed_plugin_source_github: SessionInstalledPluginSourceGithub + session_installed_plugin_source_git_hub: SessionInstalledPluginSourceGitHub session_installed_plugin_source_local: SessionInstalledPluginSourceLocal session_installed_plugin_source_url: SessionInstalledPluginSourceURL session_list: SessionList @@ -16405,7 +16405,7 @@ def from_dict(obj: Any) -> 'RPC': hmac_auth_info = HMACAuthInfo.from_dict(obj.get("HMACAuthInfo")) installed_plugin = InstalledPlugin.from_dict(obj.get("InstalledPlugin")) installed_plugin_source = from_union([InstalledPluginSource.from_dict, from_str], obj.get("InstalledPluginSource")) - installed_plugin_source_github = InstalledPluginSourceGithub.from_dict(obj.get("InstalledPluginSourceGithub")) + installed_plugin_source_git_hub = InstalledPluginSourceGitHub.from_dict(obj.get("InstalledPluginSourceGitHub")) installed_plugin_source_local = InstalledPluginSourceLocal.from_dict(obj.get("InstalledPluginSourceLocal")) installed_plugin_source_url = InstalledPluginSourceURL.from_dict(obj.get("InstalledPluginSourceUrl")) instructions_get_sources_result = InstructionsGetSourcesResult.from_dict(obj.get("InstructionsGetSourcesResult")) @@ -16619,8 +16619,8 @@ def from_dict(obj: Any) -> 'RPC': push_attachment_directory = PushAttachmentDirectory.from_dict(obj.get("PushAttachmentDirectory")) push_attachment_file = PushAttachmentFile.from_dict(obj.get("PushAttachmentFile")) push_attachment_file_line_range = PushAttachmentFileLineRange.from_dict(obj.get("PushAttachmentFileLineRange")) - push_attachment_github_reference = PushAttachmentGithubReference.from_dict(obj.get("PushAttachmentGithubReference")) - push_attachment_github_reference_type = PushAttachmentGithubReferenceTypeEnum(obj.get("PushAttachmentGithubReferenceType")) + push_attachment_git_hub_reference = PushAttachmentGitHubReference.from_dict(obj.get("PushAttachmentGitHubReference")) + push_attachment_git_hub_reference_type = PushAttachmentGitHubReferenceTypeEnum(obj.get("PushAttachmentGitHubReferenceType")) push_attachment_selection = PushAttachmentSelection.from_dict(obj.get("PushAttachmentSelection")) push_attachment_selection_details = PushAttachmentSelectionDetails.from_dict(obj.get("PushAttachmentSelectionDetails")) push_attachment_selection_details_end = PushAttachmentSelectionDetailsEnd.from_dict(obj.get("PushAttachmentSelectionDetailsEnd")) @@ -16689,7 +16689,7 @@ def from_dict(obj: Any) -> 'RPC': session_fs_write_file_request = SessionFSWriteFileRequest.from_dict(obj.get("SessionFsWriteFileRequest")) session_installed_plugin = SessionInstalledPlugin.from_dict(obj.get("SessionInstalledPlugin")) session_installed_plugin_source = from_union([SessionInstalledPluginSource.from_dict, from_str], obj.get("SessionInstalledPluginSource")) - session_installed_plugin_source_github = SessionInstalledPluginSourceGithub.from_dict(obj.get("SessionInstalledPluginSourceGithub")) + session_installed_plugin_source_git_hub = SessionInstalledPluginSourceGitHub.from_dict(obj.get("SessionInstalledPluginSourceGitHub")) session_installed_plugin_source_local = SessionInstalledPluginSourceLocal.from_dict(obj.get("SessionInstalledPluginSourceLocal")) session_installed_plugin_source_url = SessionInstalledPluginSourceURL.from_dict(obj.get("SessionInstalledPluginSourceUrl")) session_list = SessionList.from_dict(obj.get("SessionList")) @@ -16860,7 +16860,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_registry_live_target_entry, agent_registry_live_target_entry_attention_kind, agent_registry_live_target_entry_kind, agent_registry_live_target_entry_last_terminal_event, agent_registry_live_target_entry_status, agent_registry_log_capture, agent_registry_log_capture_open_error_reason, agent_registry_spawn_error, agent_registry_spawn_permission_mode, agent_registry_spawn_registry_timeout, agent_registry_spawn_request, agent_registry_spawn_result, agent_registry_spawn_spawned, agent_registry_spawn_validation_error, agent_registry_spawn_validation_error_field, agent_registry_spawn_validation_error_reason, agent_reload_result, agent_select_request, agent_select_result, allow_all_permission_set_result, allow_all_permission_state, api_key_auth_info, auth_info, auth_info_type, canvas_action, canvas_action_invoke_request, canvas_action_invoke_result, canvas_close_request, canvas_host_context, canvas_host_context_capabilities, canvas_instance_availability, canvas_json_schema, canvas_list, canvas_list_open_result, canvas_open_request, canvas_provider_close_request, canvas_provider_invoke_action_request, canvas_provider_open_request, canvas_provider_open_result, canvas_session_context, 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, current_tool_metadata, 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_context_push_input, 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_auth_config, mcp_server_auth_config_redirect_port, mcp_server_config, mcp_server_config_http, 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_list_request, 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, options_update_tool_filter_precedence, pending_permission_request, pending_permission_request_list, permission_decision, permission_decision_approved, permission_decision_approved_for_location, permission_decision_approved_for_session, permission_decision_approve_for_location, permission_decision_approve_for_location_approval, permission_decision_approve_for_location_approval_commands, permission_decision_approve_for_location_approval_custom_tool, permission_decision_approve_for_location_approval_extension_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_get_allow_all_request, permissions_locations_add_tool_approval_details, permissions_locations_add_tool_approval_details_commands, permissions_locations_add_tool_approval_details_custom_tool, permissions_locations_add_tool_approval_details_extension_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_allow_all_request, permissions_set_allow_all_source, permissions_set_approve_all_request, permissions_set_approve_all_result, permissions_set_approve_all_source, permissions_set_required_request, permissions_set_required_result, permissions_urls_set_unrestricted_mode_result, permission_urls_config, permission_urls_set_unrestricted_mode_params, ping_request, ping_result, plan_read_result, plan_update_request, plugin, plugin_list, push_attachment, push_attachment_blob, push_attachment_directory, push_attachment_file, push_attachment_file_line_range, push_attachment_github_reference, push_attachment_github_reference_type, push_attachment_selection, push_attachment_selection_details, push_attachment_selection_details_end, push_attachment_selection_details_start, 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_attachments_to_message_params, 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_model_list, 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_get_current_metadata_result, 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, workspace_diff_file_change, workspace_diff_file_change_type, workspace_diff_mode, workspace_diff_result, workspaces_checkpoints, workspaces_create_file_request, workspaces_diff_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_registry_live_target_entry, agent_registry_live_target_entry_attention_kind, agent_registry_live_target_entry_kind, agent_registry_live_target_entry_last_terminal_event, agent_registry_live_target_entry_status, agent_registry_log_capture, agent_registry_log_capture_open_error_reason, agent_registry_spawn_error, agent_registry_spawn_permission_mode, agent_registry_spawn_registry_timeout, agent_registry_spawn_request, agent_registry_spawn_result, agent_registry_spawn_spawned, agent_registry_spawn_validation_error, agent_registry_spawn_validation_error_field, agent_registry_spawn_validation_error_reason, agent_reload_result, agent_select_request, agent_select_result, allow_all_permission_set_result, allow_all_permission_state, api_key_auth_info, auth_info, auth_info_type, canvas_action, canvas_action_invoke_request, canvas_action_invoke_result, canvas_close_request, canvas_host_context, canvas_host_context_capabilities, canvas_instance_availability, canvas_json_schema, canvas_list, canvas_list_open_result, canvas_open_request, canvas_provider_close_request, canvas_provider_invoke_action_request, canvas_provider_open_request, canvas_provider_open_result, canvas_session_context, 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, current_tool_metadata, 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_context_push_input, 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_git_hub, 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_auth_config, mcp_server_auth_config_redirect_port, mcp_server_config, mcp_server_config_http, 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_list_request, 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, options_update_tool_filter_precedence, pending_permission_request, pending_permission_request_list, permission_decision, permission_decision_approved, permission_decision_approved_for_location, permission_decision_approved_for_session, permission_decision_approve_for_location, permission_decision_approve_for_location_approval, permission_decision_approve_for_location_approval_commands, permission_decision_approve_for_location_approval_custom_tool, permission_decision_approve_for_location_approval_extension_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_get_allow_all_request, permissions_locations_add_tool_approval_details, permissions_locations_add_tool_approval_details_commands, permissions_locations_add_tool_approval_details_custom_tool, permissions_locations_add_tool_approval_details_extension_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_allow_all_request, permissions_set_allow_all_source, permissions_set_approve_all_request, permissions_set_approve_all_result, permissions_set_approve_all_source, permissions_set_required_request, permissions_set_required_result, permissions_urls_set_unrestricted_mode_result, permission_urls_config, permission_urls_set_unrestricted_mode_params, ping_request, ping_result, plan_read_result, plan_update_request, plugin, plugin_list, push_attachment, push_attachment_blob, push_attachment_directory, push_attachment_file, push_attachment_file_line_range, push_attachment_git_hub_reference, push_attachment_git_hub_reference_type, push_attachment_selection, push_attachment_selection_details, push_attachment_selection_details_end, push_attachment_selection_details_start, 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_attachments_to_message_params, 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_git_hub, 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_model_list, 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_get_current_metadata_result, 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, workspace_diff_file_change, workspace_diff_file_change_type, workspace_diff_mode, workspace_diff_result, workspaces_checkpoints, workspaces_create_file_request, workspaces_diff_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 = {} @@ -16992,7 +16992,7 @@ def to_dict(self) -> dict: result["HMACAuthInfo"] = to_class(HMACAuthInfo, self.hmac_auth_info) result["InstalledPlugin"] = to_class(InstalledPlugin, self.installed_plugin) result["InstalledPluginSource"] = from_union([lambda x: to_class(InstalledPluginSource, x), from_str], self.installed_plugin_source) - result["InstalledPluginSourceGithub"] = to_class(InstalledPluginSourceGithub, self.installed_plugin_source_github) + result["InstalledPluginSourceGitHub"] = to_class(InstalledPluginSourceGitHub, self.installed_plugin_source_git_hub) result["InstalledPluginSourceLocal"] = to_class(InstalledPluginSourceLocal, self.installed_plugin_source_local) result["InstalledPluginSourceUrl"] = to_class(InstalledPluginSourceURL, self.installed_plugin_source_url) result["InstructionsGetSourcesResult"] = to_class(InstructionsGetSourcesResult, self.instructions_get_sources_result) @@ -17206,8 +17206,8 @@ def to_dict(self) -> dict: result["PushAttachmentDirectory"] = to_class(PushAttachmentDirectory, self.push_attachment_directory) result["PushAttachmentFile"] = to_class(PushAttachmentFile, self.push_attachment_file) result["PushAttachmentFileLineRange"] = to_class(PushAttachmentFileLineRange, self.push_attachment_file_line_range) - result["PushAttachmentGithubReference"] = to_class(PushAttachmentGithubReference, self.push_attachment_github_reference) - result["PushAttachmentGithubReferenceType"] = to_enum(PushAttachmentGithubReferenceTypeEnum, self.push_attachment_github_reference_type) + result["PushAttachmentGitHubReference"] = to_class(PushAttachmentGitHubReference, self.push_attachment_git_hub_reference) + result["PushAttachmentGitHubReferenceType"] = to_enum(PushAttachmentGitHubReferenceTypeEnum, self.push_attachment_git_hub_reference_type) result["PushAttachmentSelection"] = to_class(PushAttachmentSelection, self.push_attachment_selection) result["PushAttachmentSelectionDetails"] = to_class(PushAttachmentSelectionDetails, self.push_attachment_selection_details) result["PushAttachmentSelectionDetailsEnd"] = to_class(PushAttachmentSelectionDetailsEnd, self.push_attachment_selection_details_end) @@ -17276,7 +17276,7 @@ def to_dict(self) -> dict: result["SessionFsWriteFileRequest"] = to_class(SessionFSWriteFileRequest, self.session_fs_write_file_request) result["SessionInstalledPlugin"] = to_class(SessionInstalledPlugin, self.session_installed_plugin) result["SessionInstalledPluginSource"] = from_union([lambda x: to_class(SessionInstalledPluginSource, x), from_str], self.session_installed_plugin_source) - result["SessionInstalledPluginSourceGithub"] = to_class(SessionInstalledPluginSourceGithub, self.session_installed_plugin_source_github) + result["SessionInstalledPluginSourceGitHub"] = to_class(SessionInstalledPluginSourceGitHub, self.session_installed_plugin_source_git_hub) result["SessionInstalledPluginSourceLocal"] = to_class(SessionInstalledPluginSourceLocal, self.session_installed_plugin_source_local) result["SessionInstalledPluginSourceUrl"] = to_class(SessionInstalledPluginSourceURL, self.session_installed_plugin_source_url) result["SessionList"] = to_class(SessionList, self.session_list) @@ -17578,7 +17578,7 @@ def _load_PermissionsLocationsAddToolApprovalDetails(obj: Any) -> "PermissionsLo case _: raise ValueError(f"Unknown PermissionsLocationsAddToolApprovalDetails kind: {kind!r}") # Schema for the `PushAttachment` type. -PushAttachment = PushAttachmentFile | PushAttachmentDirectory | PushAttachmentSelection | PushAttachmentGithubReference | PushAttachmentBlob | ExtensionContextPushInput +PushAttachment = PushAttachmentFile | PushAttachmentDirectory | PushAttachmentSelection | PushAttachmentGitHubReference | PushAttachmentBlob | ExtensionContextPushInput def _load_PushAttachment(obj: Any) -> "PushAttachment": assert isinstance(obj, dict) @@ -17587,7 +17587,7 @@ def _load_PushAttachment(obj: Any) -> "PushAttachment": case "file": return PushAttachmentFile.from_dict(obj) case "directory": return PushAttachmentDirectory.from_dict(obj) case "selection": return PushAttachmentSelection.from_dict(obj) - case "github_reference": return PushAttachmentGithubReference.from_dict(obj) + case "github_reference": return PushAttachmentGitHubReference.from_dict(obj) case "blob": return PushAttachmentBlob.from_dict(obj) case "extension_context": return ExtensionContextPushInput.from_dict(obj) case _: raise ValueError(f"Unknown PushAttachment type: {kind!r}") diff --git a/python/copilot/generated/session_events.py b/python/copilot/generated/session_events.py index 77149d7a3..915a7bc22 100644 --- a/python/copilot/generated/session_events.py +++ b/python/copilot/generated/session_events.py @@ -1008,24 +1008,24 @@ def to_dict(self) -> dict: @dataclass -class AttachmentGithubReference: +class AttachmentGitHubReference: "GitHub issue, pull request, or discussion reference" number: int - reference_type: AttachmentGithubReferenceType + reference_type: AttachmentGitHubReferenceType state: str title: str type: ClassVar[str] = "github_reference" url: str @staticmethod - def from_dict(obj: Any) -> "AttachmentGithubReference": + def from_dict(obj: Any) -> "AttachmentGitHubReference": assert isinstance(obj, dict) number = from_int(obj.get("number")) - reference_type = parse_enum(AttachmentGithubReferenceType, obj.get("referenceType")) + reference_type = parse_enum(AttachmentGitHubReferenceType, obj.get("referenceType")) state = from_str(obj.get("state")) title = from_str(obj.get("title")) url = from_str(obj.get("url")) - return AttachmentGithubReference( + return AttachmentGitHubReference( number=number, reference_type=reference_type, state=state, @@ -1036,7 +1036,7 @@ def from_dict(obj: Any) -> "AttachmentGithubReference": def to_dict(self) -> dict: result: dict = {} result["number"] = to_int(self.number) - result["referenceType"] = to_enum(AttachmentGithubReferenceType, self.reference_type) + result["referenceType"] = to_enum(AttachmentGitHubReferenceType, self.reference_type) result["state"] = from_str(self.state) result["title"] = from_str(self.title) result["type"] = self.type @@ -6625,7 +6625,7 @@ def _load_Attachment(obj: Any) -> "Attachment": case "file": return AttachmentFile.from_dict(obj) case "directory": return AttachmentDirectory.from_dict(obj) case "selection": return AttachmentSelection.from_dict(obj) - case "github_reference": return AttachmentGithubReference.from_dict(obj) + case "github_reference": return AttachmentGitHubReference.from_dict(obj) case "blob": return AttachmentBlob.from_dict(obj) case "extension_context": return AttachmentExtensionContext.from_dict(obj) case _: raise ValueError(f"Unknown Attachment type: {kind!r}") @@ -6728,7 +6728,7 @@ def _load_UserToolSessionApproval(obj: Any) -> "UserToolSessionApproval": # A user message attachment — a file, directory, code selection, blob, GitHub reference, or extension-supplied context payload -Attachment = AttachmentFile | AttachmentDirectory | AttachmentSelection | AttachmentGithubReference | AttachmentBlob | AttachmentExtensionContext +Attachment = AttachmentFile | AttachmentDirectory | AttachmentSelection | AttachmentGitHubReference | AttachmentBlob | AttachmentExtensionContext # Derived user-facing permission prompt details for UI consumers @@ -6785,7 +6785,7 @@ class AssistantUsageApiEndpoint(Enum): WS_RESPONSES = "ws:/responses" -class AttachmentGithubReferenceType(Enum): +class AttachmentGitHubReferenceType(Enum): "Type of GitHub reference" # GitHub issue reference. ISSUE = "issue" diff --git a/python/test_event_forward_compatibility.py b/python/test_event_forward_compatibility.py index 92aa1ff4f..086bebe81 100644 --- a/python/test_event_forward_compatibility.py +++ b/python/test_event_forward_compatibility.py @@ -13,7 +13,7 @@ import pytest from copilot.generated.session_events import ( - AttachmentGithubReferenceType, + AttachmentGitHubReferenceType, Data, ElicitationCompletedAction, ElicitationRequestedMode, @@ -115,7 +115,7 @@ def test_explicit_generated_symbols_remain_available(self): assert ElicitationCompletedAction.ACCEPT.value == "accept" assert UserMessageAgentMode.INTERACTIVE.value == "interactive" assert ElicitationRequestedMode.FORM.value == "form" - assert AttachmentGithubReferenceType.PR.value == "pr" + assert AttachmentGitHubReferenceType.PR.value == "pr" schema = ElicitationRequestedSchema( properties={"answer": {"type": "string"}}, type="object" diff --git a/rust/src/generated/api_types.rs b/rust/src/generated/api_types.rs index d70291a79..07a82c7c0 100644 --- a/rust/src/generated/api_types.rs +++ b/rust/src/generated/api_types.rs @@ -1257,31 +1257,6 @@ pub struct AttachmentFile { pub r#type: AttachmentFileType, } -/// GitHub issue, pull request, or discussion reference -/// -///
-/// -/// **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 AttachmentGithubReference { - /// Issue, pull request, or discussion number - pub number: i64, - /// Type of GitHub reference - pub reference_type: AttachmentGithubReferenceType, - /// Current state of the referenced item (e.g., open, closed, merged) - pub state: String, - /// Title of the referenced item - pub title: String, - /// Attachment type discriminator - pub r#type: AttachmentGithubReferenceType, - /// URL to the referenced item on GitHub - pub url: String, -} - /// End position of the selection /// ///
@@ -2868,26 +2843,6 @@ pub struct InstalledPlugin { pub version: Option, } -/// Schema for the `InstalledPluginSourceGithub` type. -/// -///
-/// -/// **Experimental.** This type is part of an experimental wire-protocol surface -/// and may change or be removed in future SDK or CLI releases. -/// -///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct InstalledPluginSourceGithub { - #[serde(skip_serializing_if = "Option::is_none")] - pub path: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub r#ref: Option, - pub repo: String, - /// Constant value. Always "github". - pub source: InstalledPluginSourceGithubSource, -} - /// Schema for the `InstalledPluginSourceLocal` type. /// ///
@@ -6003,31 +5958,6 @@ pub struct PushAttachmentFile { pub r#type: PushAttachmentFileType, } -/// GitHub issue, pull request, or discussion reference -/// -///
-/// -/// **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 PushAttachmentGithubReference { - /// Issue, pull request, or discussion number - pub number: i64, - /// Type of GitHub reference - pub reference_type: PushAttachmentGithubReferenceType, - /// Current state of the referenced item (e.g., open, closed, merged) - pub state: String, - /// Title of the referenced item - pub title: String, - /// Attachment type discriminator - pub r#type: PushAttachmentGithubReferenceType, - /// URL to the referenced item on GitHub - pub url: String, -} - /// End position of the selection /// ///
@@ -7118,26 +7048,6 @@ pub struct SessionInstalledPlugin { pub version: Option, } -/// Schema for the `SessionInstalledPluginSourceGithub` type. -/// -///
-/// -/// **Experimental.** This type is part of an experimental wire-protocol surface -/// and may change or be removed in future SDK or CLI releases. -/// -///
-#[derive(Debug, Clone, Default, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct SessionInstalledPluginSourceGithub { - #[serde(skip_serializing_if = "Option::is_none")] - pub path: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub r#ref: Option, - pub repo: String, - /// Constant value. Always "github". - pub source: SessionInstalledPluginSourceGithubSource, -} - /// Schema for the `SessionInstalledPluginSourceLocal` type. /// ///
@@ -9954,6 +9864,96 @@ pub struct WorkspaceSummary { pub updated_at: Option, } +/// GitHub issue, pull request, or discussion reference +/// +///
+/// +/// **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 AttachmentGitHubReference { + /// Issue, pull request, or discussion number + pub number: i64, + /// Type of GitHub reference + pub reference_type: AttachmentGitHubReferenceType, + /// Current state of the referenced item (e.g., open, closed, merged) + pub state: String, + /// Title of the referenced item + pub title: String, + /// Attachment type discriminator + pub r#type: AttachmentGitHubReferenceType, + /// URL to the referenced item on GitHub + pub url: String, +} + +/// Schema for the `InstalledPluginSourceGitHub` type. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct InstalledPluginSourceGitHub { + #[serde(skip_serializing_if = "Option::is_none")] + pub path: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub r#ref: Option, + pub repo: String, + /// Constant value. Always "github". + pub source: InstalledPluginSourceGitHubSource, +} + +/// GitHub issue, pull request, or discussion reference +/// +///
+/// +/// **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 PushAttachmentGitHubReference { + /// Issue, pull request, or discussion number + pub number: i64, + /// Type of GitHub reference + pub reference_type: PushAttachmentGitHubReferenceType, + /// Current state of the referenced item (e.g., open, closed, merged) + pub state: String, + /// Title of the referenced item + pub title: String, + /// Attachment type discriminator + pub r#type: PushAttachmentGitHubReferenceType, + /// URL to the referenced item on GitHub + pub url: String, +} + +/// Schema for the `SessionInstalledPluginSourceGitHub` type. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
+#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SessionInstalledPluginSourceGitHub { + #[serde(skip_serializing_if = "Option::is_none")] + pub path: Option, + #[serde(skip_serializing_if = "Option::is_none")] + pub r#ref: Option, + pub repo: String, + /// Constant value. Always "github". + pub source: SessionInstalledPluginSourceGitHubSource, +} + /// List of Copilot models available to the resolved user, including capabilities and billing metadata. #[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] @@ -13280,31 +13280,6 @@ pub enum AttachmentFileType { File, } -/// Type of GitHub reference -/// -///
-/// -/// **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 AttachmentGithubReferenceType { - /// GitHub issue reference. - #[serde(rename = "issue")] - Issue, - /// GitHub pull request reference. - #[serde(rename = "pr")] - Pr, - /// GitHub discussion reference. - #[serde(rename = "discussion")] - Discussion, - /// Unknown variant for forward compatibility. - #[default] - #[serde(other)] - Unknown, -} - /// Attachment type discriminator #[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] pub enum AttachmentSelectionType { @@ -13461,7 +13436,7 @@ pub enum ContentFilterMode { pub enum CopilotApiTokenAuthInfoHost { #[serde(rename = "https://github.com")] #[default] - HttpsGithubCom, + HttpsGitHubCom, } /// Direct Copilot API authentication via the `GITHUB_COPILOT_API_TOKEN` + `COPILOT_API_URL` environment-variable pair. The token itself is read from the environment by the runtime, not carried in this struct. @@ -13708,7 +13683,7 @@ pub enum GhCliAuthInfoType { pub enum HMACAuthInfoHost { #[serde(rename = "https://github.com")] #[default] - HttpsGithubCom, + HttpsGitHubCom, } /// HMAC-based authentication used by GitHub-internal services. @@ -13719,14 +13694,6 @@ pub enum HMACAuthInfoType { Hmac, } -/// Constant value. Always "github". -#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum InstalledPluginSourceGithubSource { - #[serde(rename = "github")] - #[default] - Github, -} - /// Constant value. Always "local". #[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] pub enum InstalledPluginSourceLocalSource { @@ -14116,7 +14083,7 @@ pub enum McpSetEnvValueModeDetails { pub enum SessionWorkingDirectoryContextHostType { /// The working directory repository is hosted on GitHub. #[serde(rename = "github")] - Github, + GitHub, /// The working directory repository is hosted on Azure DevOps. #[serde(rename = "ado")] Ado, @@ -14854,31 +14821,6 @@ pub enum PushAttachmentFileType { File, } -/// Type of GitHub reference -/// -///
-/// -/// **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 PushAttachmentGithubReferenceType { - /// GitHub issue reference. - #[serde(rename = "issue")] - Issue, - /// GitHub pull request reference. - #[serde(rename = "pr")] - Pr, - /// GitHub discussion reference. - #[serde(rename = "discussion")] - Discussion, - /// Unknown variant for forward compatibility. - #[default] - #[serde(other)] - Unknown, -} - /// Attachment type discriminator #[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] pub enum PushAttachmentSelectionType { @@ -14996,7 +14938,7 @@ pub enum SendMode { pub enum SessionContextHostType { /// Session repository is hosted on GitHub. #[serde(rename = "github")] - Github, + GitHub, /// Session repository is hosted on Azure DevOps. #[serde(rename = "ado")] Ado, @@ -15088,14 +15030,6 @@ pub enum SessionFsSqliteQueryType { Unknown, } -/// Constant value. Always "github". -#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] -pub enum SessionInstalledPluginSourceGithubSource { - #[serde(rename = "github")] - #[default] - Github, -} - /// Constant value. Always "local". #[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] pub enum SessionInstalledPluginSourceLocalSource { @@ -15124,7 +15058,7 @@ pub enum SessionInstalledPluginSourceUrlSource { pub enum WorkspaceSummaryHostType { /// Workspace summary repository is hosted on GitHub. #[serde(rename = "github")] - Github, + GitHub, /// Workspace summary repository is hosted on Azure DevOps. #[serde(rename = "ado")] Ado, @@ -15582,7 +15516,7 @@ pub enum WorkspaceDiffMode { pub enum WorkspacesWorkspaceDetailsHostType { /// Workspace repository is hosted on GitHub. #[serde(rename = "github")] - Github, + GitHub, /// Workspace repository is hosted on Azure DevOps. #[serde(rename = "ado")] Ado, @@ -15591,3 +15525,69 @@ pub enum WorkspacesWorkspaceDetailsHostType { #[serde(other)] Unknown, } + +/// Type of GitHub reference +/// +///
+/// +/// **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 AttachmentGitHubReferenceType { + /// GitHub issue reference. + #[serde(rename = "issue")] + Issue, + /// GitHub pull request reference. + #[serde(rename = "pr")] + Pr, + /// GitHub discussion reference. + #[serde(rename = "discussion")] + Discussion, + /// Unknown variant for forward compatibility. + #[default] + #[serde(other)] + Unknown, +} + +/// Constant value. Always "github". +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum InstalledPluginSourceGitHubSource { + #[serde(rename = "github")] + #[default] + GitHub, +} + +/// Type of GitHub reference +/// +///
+/// +/// **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 PushAttachmentGitHubReferenceType { + /// GitHub issue reference. + #[serde(rename = "issue")] + Issue, + /// GitHub pull request reference. + #[serde(rename = "pr")] + Pr, + /// GitHub discussion reference. + #[serde(rename = "discussion")] + Discussion, + /// Unknown variant for forward compatibility. + #[default] + #[serde(other)] + Unknown, +} + +/// Constant value. Always "github". +#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] +pub enum SessionInstalledPluginSourceGitHubSource { + #[serde(rename = "github")] + #[default] + GitHub, +} diff --git a/rust/src/generated/session_events.rs b/rust/src/generated/session_events.rs index 1828a3e41..e889cf942 100644 --- a/rust/src/generated/session_events.rs +++ b/rust/src/generated/session_events.rs @@ -3336,7 +3336,7 @@ pub struct McpAppToolCallCompleteData { pub enum WorkingDirectoryContextHostType { /// Repository is hosted on GitHub. #[serde(rename = "github")] - Github, + GitHub, /// Repository is hosted on Azure DevOps. #[serde(rename = "ado")] Ado, diff --git a/rust/tests/e2e/rpc_session_state.rs b/rust/tests/e2e/rpc_session_state.rs index 956a8c90e..785752f1f 100644 --- a/rust/tests/e2e/rpc_session_state.rs +++ b/rust/tests/e2e/rpc_session_state.rs @@ -691,7 +691,7 @@ async fn should_call_metadata_snapshot_setworkingdirectory_and_recordcontextchan cwd: subdir.display().to_string(), git_root: Some(ctx.repo_root().display().to_string()), head_commit: None, - host_type: Some(SessionWorkingDirectoryContextHostType::Github), + host_type: Some(SessionWorkingDirectoryContextHostType::GitHub), repository: Some("github/copilot-sdk".to_string()), repository_host: Some("github.com".to_string()), }, diff --git a/scripts/codegen/csharp.ts b/scripts/codegen/csharp.ts index 883895cde..7b0f64a77 100644 --- a/scripts/codegen/csharp.ts +++ b/scripts/codegen/csharp.ts @@ -46,6 +46,8 @@ import { getSessionEventVariantSchemas, getSharedSessionEventEnvelopeProperties, rewriteSharedDefinitionReferences, + loadSchemaJson, + fixBrandCasing, REPO_ROOT, type ApiSchema, type DefinitionCollections, @@ -217,7 +219,7 @@ function xmlDocEnumMemberComment(enumValueDescriptions: EnumValueDescriptions | function toPascalCase(name: string): string { const parts = splitCSharpIdentifierParts(name); if (parts.length > 1) return parts.map(toPascalCasePart).join(""); - return name.charAt(0).toUpperCase() + name.slice(1); + return fixBrandCasing(name.charAt(0).toUpperCase() + name.slice(1)); } function stripDurationMillisecondsSuffix(name: string): string { @@ -244,7 +246,7 @@ function splitCSharpIdentifierParts(value: string): string[] { } function toPascalCasePart(value: string): string { - return value.charAt(0).toUpperCase() + value.slice(1); + return fixBrandCasing(value.charAt(0).toUpperCase() + value.slice(1)); } function toCSharpIdentifier(value: string, fallback: string): string { @@ -1408,7 +1410,7 @@ namespace GitHub.Copilot; export async function generateSessionEvents(schemaPath?: string): Promise { console.log("C#: generating session-events..."); const resolvedPath = schemaPath ?? (await getSessionEventsSchemaPath()); - const schema = cloneSchemaForCodegen(JSON.parse(await fs.readFile(resolvedPath, "utf-8")) as JSONSchema7); + const schema = cloneSchemaForCodegen((await loadSchemaJson(resolvedPath)) as JSONSchema7); const processed = propagateInternalVisibility(postProcessSchema(schema)); const code = generateSessionEventsCode(processed); const outPath = await writeGeneratedFile("dotnet/src/Generated/SessionEvents.cs", code); @@ -2392,7 +2394,7 @@ namespace GitHub.Copilot.Rpc; export async function generateRpc(schemaPath?: string, sessionEventsSchema?: JSONSchema7): Promise { console.log("C#: generating RPC types..."); const resolvedPath = schemaPath ?? (await getApiSchemaPath()); - let schema = fixNullableRequiredRefsInApiSchema(cloneSchemaForCodegen(JSON.parse(await fs.readFile(resolvedPath, "utf-8")) as ApiSchema)); + let schema = fixNullableRequiredRefsInApiSchema(cloneSchemaForCodegen((await loadSchemaJson(resolvedPath)) as ApiSchema)); if (sessionEventsSchema) { const sharedDefinitions = findSharedSchemaDefinitions( schema as unknown as Record, @@ -2449,7 +2451,7 @@ async function generate(sessionSchemaPath?: string, apiSchemaPath?: string): Pro await generateSessionEvents(sessionSchemaPath); try { const resolvedSessionPath = sessionSchemaPath ?? (await getSessionEventsSchemaPath()); - const sessionSchema = propagateInternalVisibility(postProcessSchema(cloneSchemaForCodegen(JSON.parse(await fs.readFile(resolvedSessionPath, "utf-8")) as JSONSchema7))); + const sessionSchema = propagateInternalVisibility(postProcessSchema(cloneSchemaForCodegen((await loadSchemaJson(resolvedSessionPath)) as JSONSchema7))); await generateRpc(apiSchemaPath, sessionSchema); } catch (err) { if ((err as NodeJS.ErrnoException).code === "ENOENT" && !apiSchemaPath) { diff --git a/scripts/codegen/go.ts b/scripts/codegen/go.ts index 86182a52c..69556d094 100644 --- a/scripts/codegen/go.ts +++ b/scripts/codegen/go.ts @@ -40,6 +40,7 @@ import { isSchemaExperimental, isSchemaInternal, isVoidSchema, + loadSchemaJson, parseExternalSchemaRef, postProcessSchema, propagateInternalVisibility, @@ -78,6 +79,7 @@ const goIdentifierCasingOverrides = new Map([ ["urls", "URLs"], ["uris", "URIs"], ["ids", "IDs"], + ["github", "GitHub"], ]); const goCommentTextWrapLength = 90; const wrapGoCommentText = wordwrap(goCommentTextWrapLength); @@ -3628,7 +3630,7 @@ async function generateSessionEvents(schemaPath?: string, apiSchema?: ApiSchema) console.log("Go: generating session-events..."); const resolvedPath = schemaPath ?? (await getSessionEventsSchemaPath()); - const schema = cloneSchemaForCodegen(JSON.parse(await fs.readFile(resolvedPath, "utf-8")) as JSONSchema7); + const schema = cloneSchemaForCodegen((await loadSchemaJson(resolvedPath)) as JSONSchema7); const processed = propagateInternalVisibility(postProcessSchema(schema)); const processedApiSchema = apiSchema ? propagateInternalVisibility(postProcessSchema(cloneSchemaForCodegen(apiSchema as JSONSchema7)) as JSONSchema7) @@ -3728,7 +3730,7 @@ async function generateRpc(schemaPath?: string): Promise { console.log("Go: generating RPC types..."); const resolvedPath = schemaPath ?? (await getApiSchemaPath()); - const schema = propagateInternalVisibility(fixNullableRequiredRefsInApiSchema(cloneSchemaForCodegen(JSON.parse(await fs.readFile(resolvedPath, "utf-8")) as ApiSchema)) as JSONSchema7) as unknown as ApiSchema; + const schema = propagateInternalVisibility(fixNullableRequiredRefsInApiSchema(cloneSchemaForCodegen((await loadSchemaJson(resolvedPath)) as ApiSchema)) as JSONSchema7) as unknown as ApiSchema; const allMethods = [ ...collectRpcMethods(schema.server || {}), @@ -4304,7 +4306,7 @@ async function generate(sessionSchemaPath?: string, apiSchemaPath?: string): Pro let apiSchemaForSharing: ApiSchema | undefined; try { const resolvedApiPath = apiSchemaPath ?? (await getApiSchemaPath()); - apiSchemaForSharing = fixNullableRequiredRefsInApiSchema(cloneSchemaForCodegen(JSON.parse(await fs.readFile(resolvedApiPath, "utf-8")) as ApiSchema)); + apiSchemaForSharing = fixNullableRequiredRefsInApiSchema(cloneSchemaForCodegen((await loadSchemaJson(resolvedApiPath)) as ApiSchema)); } catch (err) { if ((err as NodeJS.ErrnoException).code !== "ENOENT" || apiSchemaPath) { throw err; diff --git a/scripts/codegen/python.ts b/scripts/codegen/python.ts index 9e54dcc45..08a37945f 100644 --- a/scripts/codegen/python.ts +++ b/scripts/codegen/python.ts @@ -50,6 +50,8 @@ import { getSessionEventVariantSchemas, getSharedSessionEventEnvelopeProperties, getEnumValueDescriptions, + loadSchemaJson, + fixBrandCasing, type ApiSchema, type DefinitionCollections, type EnumValueDescriptions, @@ -1176,10 +1178,12 @@ function removeRequiredAnyDefaultsForPython( } function toPascalCase(s: string): string { - return s - .split(/[._]/) - .map((w) => w.charAt(0).toUpperCase() + w.slice(1)) - .join(""); + return fixBrandCasing( + s + .split(/[._]/) + .map((w) => w.charAt(0).toUpperCase() + w.slice(1)) + .join("") + ); } function collectRpcMethods(node: Record): RpcMethod[] { @@ -2682,7 +2686,7 @@ async function generateSessionEvents(schemaPath?: string): Promise { console.log("Python: generating session-events..."); const resolvedPath = schemaPath ?? (await getSessionEventsSchemaPath()); - const schema = JSON.parse(await fs.readFile(resolvedPath, "utf-8")) as JSONSchema7; + const schema = (await loadSchemaJson(resolvedPath)) as JSONSchema7; const processed = propagateInternalVisibility(postProcessSchema(schema)); let code = generatePythonSessionEventsCode(processed); const { typeNames } = collectInternalSymbols(processed); @@ -2699,7 +2703,7 @@ async function generateRpc(schemaPath?: string, sessionEventsSchema?: JSONSchema const { FetchingJSONSchemaStore, InputData, JSONSchemaInput, quicktype } = await import("quicktype-core"); const resolvedPath = schemaPath ?? (await getApiSchemaPath()); - let schema = fixNullableRequiredRefsInApiSchema(cloneSchemaForCodegen(JSON.parse(await fs.readFile(resolvedPath, "utf-8")) as ApiSchema)); + let schema = fixNullableRequiredRefsInApiSchema(cloneSchemaForCodegen((await loadSchemaJson(resolvedPath)) as ApiSchema)); if (sessionEventsSchema) { const sharedDefinitions = findSharedSchemaDefinitions( schema as unknown as Record, @@ -3500,7 +3504,7 @@ async function generate(sessionSchemaPath?: string, apiSchemaPath?: string): Pro await generateSessionEvents(sessionSchemaPath); try { const resolvedSessionPath = sessionSchemaPath ?? (await getSessionEventsSchemaPath()); - const sessionSchema = postProcessSchema(cloneSchemaForCodegen(JSON.parse(await fs.readFile(resolvedSessionPath, "utf-8")) as JSONSchema7)); + const sessionSchema = postProcessSchema(cloneSchemaForCodegen((await loadSchemaJson(resolvedSessionPath)) as JSONSchema7)); await generateRpc(apiSchemaPath, sessionSchema); } catch (err) { if ((err as NodeJS.ErrnoException).code === "ENOENT" && !apiSchemaPath) { diff --git a/scripts/codegen/rust.ts b/scripts/codegen/rust.ts index 0f732dd60..8fea4e35a 100644 --- a/scripts/codegen/rust.ts +++ b/scripts/codegen/rust.ts @@ -40,6 +40,8 @@ import { isSchemaExperimental, isSchemaInternal, isVoidSchema, + normalizeSchemaBrandCasing, + fixBrandCasing, parseExternalSchemaRef, postProcessSchema, propagateInternalVisibility, @@ -85,11 +87,13 @@ const STRING_NEWTYPE_OVERRIDES: Record = { // ── Naming helpers ────────────────────────────────────────────────────────── function toPascalCase(s: string): string { - const name = s - .split(/[^A-Za-z0-9]+/) - .filter(Boolean) - .map((w) => w.charAt(0).toUpperCase() + w.slice(1)) - .join(""); + const name = fixBrandCasing( + s + .split(/[^A-Za-z0-9]+/) + .filter(Boolean) + .map((w) => w.charAt(0).toUpperCase() + w.slice(1)) + .join(""), + ); if (!name) return "Value"; return /^[0-9]/.test(name) ? `Value${name}` : name; } @@ -2081,12 +2085,12 @@ async function generate(): Promise { schemaArgs.sessionEventsSchemaPath || (await getSessionEventsSchemaPath()); const apiSchemaPath = await getApiSchemaPath(schemaArgs.apiSchemaPath); - const sessionEventsRaw = JSON.parse( - await fs.readFile(sessionEventsSchemaPath, "utf-8"), + const sessionEventsRaw = normalizeSchemaBrandCasing( + JSON.parse(await fs.readFile(sessionEventsSchemaPath, "utf-8")), + ); + const apiRaw = normalizeSchemaBrandCasing( + JSON.parse(await fs.readFile(apiSchemaPath, "utf-8")) as ApiSchema, ); - const apiRaw = JSON.parse( - await fs.readFile(apiSchemaPath, "utf-8"), - ) as ApiSchema; const sessionEventsSchema = propagateInternalVisibility( postProcessSchema( diff --git a/scripts/codegen/typescript.ts b/scripts/codegen/typescript.ts index f3a4bd192..bba360b47 100644 --- a/scripts/codegen/typescript.ts +++ b/scripts/codegen/typescript.ts @@ -40,6 +40,8 @@ import { appendPropertyMarkerTagsToDescriptions, getEnumValueDescriptions, stripOpaqueJsonMarker, + loadSchemaJson, + fixBrandCasing, type ApiSchema, type DefinitionCollections, type RpcMethod, @@ -121,7 +123,7 @@ function pushTsRpcMethodJsDoc( } function toPascalCase(s: string): string { - return s.charAt(0).toUpperCase() + s.slice(1); + return fixBrandCasing(s.charAt(0).toUpperCase() + s.slice(1)); } function escapeRegExp(value: string): string { @@ -339,7 +341,7 @@ async function generateSessionEvents(schemaPath?: string): Promise { console.log("TypeScript: generating session-events..."); const resolvedPath = schemaPath ?? (await getSessionEventsSchemaPath()); - const schema = JSON.parse(await fs.readFile(resolvedPath, "utf-8")) as JSONSchema7; + const schema = (await loadSchemaJson(resolvedPath)) as JSONSchema7; const processed = propagateInternalVisibility(postProcessSchema(schema)); const definitionCollections = collectDefinitionCollections(processed as Record); const sessionEvent = @@ -477,7 +479,7 @@ async function generateRpc(schemaPath?: string, sessionEventsSchema?: JSONSchema console.log("TypeScript: generating RPC types..."); const resolvedPath = schemaPath ?? (await getApiSchemaPath()); - let schema = fixNullableRequiredRefsInApiSchema(JSON.parse(await fs.readFile(resolvedPath, "utf-8")) as ApiSchema); + let schema = fixNullableRequiredRefsInApiSchema((await loadSchemaJson(resolvedPath)) as ApiSchema); if (sessionEventsSchema) { const sharedDefinitions = findSharedSchemaDefinitions( schema as unknown as Record, @@ -930,7 +932,7 @@ async function generate(sessionSchemaPath?: string, apiSchemaPath?: string): Pro await generateSessionEvents(sessionSchemaPath); try { const resolvedSessionPath = sessionSchemaPath ?? (await getSessionEventsSchemaPath()); - const sessionSchema = propagateInternalVisibility(postProcessSchema(JSON.parse(await fs.readFile(resolvedSessionPath, "utf-8")) as JSONSchema7)); + const sessionSchema = propagateInternalVisibility(postProcessSchema((await loadSchemaJson(resolvedSessionPath)) as JSONSchema7)); await generateRpc(apiSchemaPath, sessionSchema); } catch (err) { if ((err as NodeJS.ErrnoException).code === "ENOENT" && !apiSchemaPath) { diff --git a/scripts/codegen/utils.ts b/scripts/codegen/utils.ts index 4d04bae9a..3917dad44 100644 --- a/scripts/codegen/utils.ts +++ b/scripts/codegen/utils.ts @@ -64,6 +64,94 @@ export async function getApiSchemaPath(cliArg?: string): Promise { return schemaPath; } +// ── Brand casing normalization ────────────────────────────────────────────── + +/** + * Correct the GitHub brand casing in a generated identifier or documentation + * string. Some schema titles/definition names and value-derived identifiers + * render the brand as "Github"; the correct casing is "GitHub". Wire/protocol + * values (e.g. "github", "github_reference") are lowercase and therefore left + * untouched. The replacement is idempotent: already-correct "GitHub" contains a + * capital "H" and no "Github" substring, so it is unaffected. + */ +export function fixBrandCasing(value: string): string { + return value.replace(/Github/g, "GitHub"); +} + +const BRAND_NORMALIZED_STRING_KEYS = new Set(["title", "description", "markdownDescription"]); + +/** + * Recursively normalize GitHub brand casing within a parsed JSON schema: + * - keys of `definitions` / `$defs` maps, + * - `$ref` pointers (definition-name segment only), + * - documentation strings (`title`, `description`, `markdownDescription`). + * + * Wire-level string values (`const`, `enum`, `default`, examples, etc.) are left + * untouched so protocol values such as "github" remain lowercase. The schema is + * mutated in place and also returned for convenience. + */ +export function normalizeSchemaBrandCasing(schema: T): T { + normalizeBrandCasingNode(schema); + return schema; +} + +function normalizeBrandCasingNode(node: unknown): void { + if (Array.isArray(node)) { + for (const item of node) normalizeBrandCasingNode(item); + return; + } + if (node === null || typeof node !== "object") return; + const obj = node as Record; + + for (const defsKey of ["definitions", "$defs"] as const) { + const defs = obj[defsKey]; + if (defs && typeof defs === "object" && !Array.isArray(defs)) { + renameBrandDefinitionKeys(defs as Record); + } + } + + for (const [key, value] of Object.entries(obj)) { + if (typeof value === "string") { + if (key === "$ref") { + obj[key] = fixBrandRef(value); + } else if (BRAND_NORMALIZED_STRING_KEYS.has(key)) { + obj[key] = fixBrandCasing(value); + } + } else { + normalizeBrandCasingNode(value); + } + } +} + +/** Apply brand-casing only to the definition-name segment of a `$ref`. */ +function fixBrandRef(ref: string): string { + const lastSlash = ref.lastIndexOf("/"); + if (lastSlash === -1) return ref; + const prefix = ref.slice(0, lastSlash + 1); + const name = ref.slice(lastSlash + 1); + return `${prefix}${fixBrandCasing(name)}`; +} + +function renameBrandDefinitionKeys(defs: Record): void { + for (const oldKey of Object.keys(defs)) { + const newKey = fixBrandCasing(oldKey); + if (newKey === oldKey) continue; + if (newKey in defs && stableStringify(defs[newKey]) !== stableStringify(defs[oldKey])) { + throw new Error( + `Brand-casing normalization collision: "${oldKey}" -> "${newKey}" but a different definition already exists under "${newKey}".` + ); + } + defs[newKey] = defs[oldKey]; + delete defs[oldKey]; + } +} + +/** Load a JSON schema file and normalize GitHub brand casing in titles, refs, and definition keys. */ +export async function loadSchemaJson(filePath: string): Promise { + const parsed = JSON.parse(await fs.readFile(filePath, "utf-8")) as T; + return normalizeSchemaBrandCasing(parsed); +} + // ── Schema processing ─────────────────────────────────────────────────────── /**