From 963543ad4256220b70a19d936fd548c81b73ff98 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 15 May 2026 16:51:11 +0000 Subject: [PATCH 1/7] Initial plan From 920b1dfbbcf5d09c4246013bf87274aabebe2aee Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 15 May 2026 17:18:38 +0000 Subject: [PATCH 2/7] Port remoteSession field from reference implementation Add remoteSession field to SessionConfig, ResumeSessionConfig, CreateSessionRequest, and ResumeSessionRequest. Wire it through SessionRequestBuilder for both create and resume paths. Reference implementation commit: 0159731 (Add remote_session field to all SDK SessionConfig types) Co-authored-by: edburns <75821+edburns@users.noreply.github.com> --- .../copilot/sdk/SessionRequestBuilder.java | 2 + .../sdk/json/CreateSessionRequest.java | 15 +++++++ .../copilot/sdk/json/ResumeSessionConfig.java | 30 ++++++++++++++ .../sdk/json/ResumeSessionRequest.java | 15 +++++++ .../copilot/sdk/json/SessionConfig.java | 41 +++++++++++++++++++ 5 files changed, 103 insertions(+) diff --git a/src/main/java/com/github/copilot/sdk/SessionRequestBuilder.java b/src/main/java/com/github/copilot/sdk/SessionRequestBuilder.java index 1bd3a50cb7..52bfb3337f 100644 --- a/src/main/java/com/github/copilot/sdk/SessionRequestBuilder.java +++ b/src/main/java/com/github/copilot/sdk/SessionRequestBuilder.java @@ -151,6 +151,7 @@ static CreateSessionRequest buildCreateRequest(SessionConfig config, String sess request.setRequestAutoModeSwitch(true); } request.setGitHubToken(config.getGitHubToken()); + request.setRemoteSession(config.getRemoteSession()); return request; } @@ -243,6 +244,7 @@ static ResumeSessionRequest buildResumeRequest(String sessionId, ResumeSessionCo request.setRequestAutoModeSwitch(true); } request.setGitHubToken(config.getGitHubToken()); + request.setRemoteSession(config.getRemoteSession()); return request; } diff --git a/src/main/java/com/github/copilot/sdk/json/CreateSessionRequest.java b/src/main/java/com/github/copilot/sdk/json/CreateSessionRequest.java index 0160724bef..d6bcc7b2b7 100644 --- a/src/main/java/com/github/copilot/sdk/json/CreateSessionRequest.java +++ b/src/main/java/com/github/copilot/sdk/json/CreateSessionRequest.java @@ -124,6 +124,9 @@ public final class CreateSessionRequest { @JsonProperty("gitHubToken") private String gitHubToken; + @JsonProperty("remoteSession") + private String remoteSession; + /** Gets the model name. @return the model */ public String getModel() { return model; @@ -528,4 +531,16 @@ public String getGitHubToken() { public void setGitHubToken(String gitHubToken) { this.gitHubToken = gitHubToken; } + + /** Gets the remote session mode. @return the remote session mode */ + public String getRemoteSession() { + return remoteSession; + } + + /** + * Sets the remote session mode. @param remoteSession the remote session mode + */ + public void setRemoteSession(String remoteSession) { + this.remoteSession = remoteSession; + } } diff --git a/src/main/java/com/github/copilot/sdk/json/ResumeSessionConfig.java b/src/main/java/com/github/copilot/sdk/json/ResumeSessionConfig.java index d8c3bf43b1..72c9f6f47a 100644 --- a/src/main/java/com/github/copilot/sdk/json/ResumeSessionConfig.java +++ b/src/main/java/com/github/copilot/sdk/json/ResumeSessionConfig.java @@ -71,6 +71,7 @@ public class ResumeSessionConfig { private ExitPlanModeHandler onExitPlanMode; private AutoModeSwitchHandler onAutoModeSwitch; private String gitHubToken; + private String remoteSession; /** * Gets the AI model to use. @@ -886,6 +887,34 @@ public ResumeSessionConfig setGitHubToken(String gitHubToken) { return this; } + /** + * Gets the per-session remote behavior control. + *

+ * See {@link SessionConfig#getRemoteSession()} for details on possible values. + * + * @return the remote session mode, or {@code null} if not set + * @since 1.4.0 + */ + public String getRemoteSession() { + return remoteSession; + } + + /** + * Sets the per-session remote behavior control. + *

+ * See {@link SessionConfig#setRemoteSession(String)} for details on possible + * values. + * + * @param remoteSession + * the remote session mode + * @return this config for method chaining + * @since 1.4.0 + */ + public ResumeSessionConfig setRemoteSession(String remoteSession) { + this.remoteSession = remoteSession; + return this; + } + /** * Creates a shallow clone of this {@code ResumeSessionConfig} instance. *

@@ -935,6 +964,7 @@ public ResumeSessionConfig clone() { copy.onExitPlanMode = this.onExitPlanMode; copy.onAutoModeSwitch = this.onAutoModeSwitch; copy.gitHubToken = this.gitHubToken; + copy.remoteSession = this.remoteSession; return copy; } } diff --git a/src/main/java/com/github/copilot/sdk/json/ResumeSessionRequest.java b/src/main/java/com/github/copilot/sdk/json/ResumeSessionRequest.java index 054fc8fba9..8aca77b7d2 100644 --- a/src/main/java/com/github/copilot/sdk/json/ResumeSessionRequest.java +++ b/src/main/java/com/github/copilot/sdk/json/ResumeSessionRequest.java @@ -128,6 +128,9 @@ public final class ResumeSessionRequest { @JsonProperty("gitHubToken") private String gitHubToken; + @JsonProperty("remoteSession") + private String remoteSession; + /** Gets the session ID. @return the session ID */ public String getSessionId() { return sessionId; @@ -555,4 +558,16 @@ public String getGitHubToken() { public void setGitHubToken(String gitHubToken) { this.gitHubToken = gitHubToken; } + + /** Gets the remote session mode. @return the remote session mode */ + public String getRemoteSession() { + return remoteSession; + } + + /** + * Sets the remote session mode. @param remoteSession the remote session mode + */ + public void setRemoteSession(String remoteSession) { + this.remoteSession = remoteSession; + } } diff --git a/src/main/java/com/github/copilot/sdk/json/SessionConfig.java b/src/main/java/com/github/copilot/sdk/json/SessionConfig.java index 53a84aa721..f1a383402f 100644 --- a/src/main/java/com/github/copilot/sdk/json/SessionConfig.java +++ b/src/main/java/com/github/copilot/sdk/json/SessionConfig.java @@ -71,6 +71,7 @@ public class SessionConfig { private ExitPlanModeHandler onExitPlanMode; private AutoModeSwitchHandler onAutoModeSwitch; private String gitHubToken; + private String remoteSession; /** * Gets the custom session ID. @@ -939,6 +940,45 @@ public SessionConfig setGitHubToken(String gitHubToken) { return this; } + /** + * Gets the per-session remote behavior control. + *

+ * Possible values: + *

+ * + * @return the remote session mode, or {@code null} if not set + * @since 1.4.0 + */ + public String getRemoteSession() { + return remoteSession; + } + + /** + * Sets the per-session remote behavior control. + *

+ * Possible values: + *

+ * + * @param remoteSession + * the remote session mode + * @return this config instance for method chaining + * @since 1.4.0 + */ + public SessionConfig setRemoteSession(String remoteSession) { + this.remoteSession = remoteSession; + return this; + } + /** * Creates a shallow clone of this {@code SessionConfig} instance. *

@@ -988,6 +1028,7 @@ public SessionConfig clone() { copy.onExitPlanMode = this.onExitPlanMode; copy.onAutoModeSwitch = this.onAutoModeSwitch; copy.gitHubToken = this.gitHubToken; + copy.remoteSession = this.remoteSession; return copy; } } From efd6c36ccc150cc947fe06beca18065c019aea1d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 15 May 2026 17:19:07 +0000 Subject: [PATCH 3/7] Update .lastmerge to e20f5bef125860accb30c60d1b35109371a77f16, sync pom.xml CLI version, and update scripts/codegen @github/copilot version Co-authored-by: edburns <75821+edburns@users.noreply.github.com> --- .lastmerge | 2 +- pom.xml | 2 +- scripts/codegen/package-lock.json | 56 +++++++++++++++---------------- scripts/codegen/package.json | 2 +- 4 files changed, 31 insertions(+), 31 deletions(-) diff --git a/.lastmerge b/.lastmerge index b28867a960..600b63a547 100644 --- a/.lastmerge +++ b/.lastmerge @@ -1 +1 @@ -4a0437bb03a0b60a1867f14ae8e3faf053afa5aa +e20f5bef125860accb30c60d1b35109371a77f16 diff --git a/pom.xml b/pom.xml index 4e3273cf41..447ffea53f 100644 --- a/pom.xml +++ b/pom.xml @@ -94,7 +94,7 @@ reference-impl-sync workflow and deal with the subsequent PR. --> - ^1.0.44-3 + ^1.0.48 diff --git a/scripts/codegen/package-lock.json b/scripts/codegen/package-lock.json index 0846fc42e6..36d7689a71 100644 --- a/scripts/codegen/package-lock.json +++ b/scripts/codegen/package-lock.json @@ -6,7 +6,7 @@ "": { "name": "copilot-sdk-java-codegen", "dependencies": { - "@github/copilot": "^1.0.44-3", + "@github/copilot": "^1.0.48", "json-schema": "^0.4.0", "tsx": "^4.20.6" } @@ -428,26 +428,26 @@ } }, "node_modules/@github/copilot": { - "version": "1.0.45", - "resolved": "https://registry.npmjs.org/@github/copilot/-/copilot-1.0.45.tgz", - "integrity": "sha512-2QADgQcw/d0GFqTq2+nHwX152ZRvZxW0CHONG5d1RCs6YJtdr/GdbnMYYeRH2BiBIhnfkcvF50ImCRvsS5Tnwg==", + "version": "1.0.48", + "resolved": "https://registry.npmjs.org/@github/copilot/-/copilot-1.0.48.tgz", + "integrity": "sha512-U5SzyTEq376UU9A4Sd3TEKz+Y2nRUd90cLO4Hc1otaB8yFSy9Ur2UVGcI2/wCoodL3a39k6WbdgNzFxr0gWFRQ==", "license": "SEE LICENSE IN LICENSE.md", "bin": { "copilot": "npm-loader.js" }, "optionalDependencies": { - "@github/copilot-darwin-arm64": "1.0.45", - "@github/copilot-darwin-x64": "1.0.45", - "@github/copilot-linux-arm64": "1.0.45", - "@github/copilot-linux-x64": "1.0.45", - "@github/copilot-win32-arm64": "1.0.45", - "@github/copilot-win32-x64": "1.0.45" + "@github/copilot-darwin-arm64": "1.0.48", + "@github/copilot-darwin-x64": "1.0.48", + "@github/copilot-linux-arm64": "1.0.48", + "@github/copilot-linux-x64": "1.0.48", + "@github/copilot-win32-arm64": "1.0.48", + "@github/copilot-win32-x64": "1.0.48" } }, "node_modules/@github/copilot-darwin-arm64": { - "version": "1.0.45", - "resolved": "https://registry.npmjs.org/@github/copilot-darwin-arm64/-/copilot-darwin-arm64-1.0.45.tgz", - "integrity": "sha512-gCJy1nOIWL5lpLFJTRk2Kz7bS30emkA4p4gM+PJ5/dOwNRBOyUO0/2f03/m5vYL4DNd/T47cFIN6s82gISAIYQ==", + "version": "1.0.48", + "resolved": "https://registry.npmjs.org/@github/copilot-darwin-arm64/-/copilot-darwin-arm64-1.0.48.tgz", + "integrity": "sha512-82MLoMQwPVVFM8EYssihFxSEPUYtZADE8rMzQ3jG9HgRg2qjQSfnHQS1mKe64dlXswZUK/onw6/8kjnW5I4pPg==", "cpu": [ "arm64" ], @@ -461,9 +461,9 @@ } }, "node_modules/@github/copilot-darwin-x64": { - "version": "1.0.45", - "resolved": "https://registry.npmjs.org/@github/copilot-darwin-x64/-/copilot-darwin-x64-1.0.45.tgz", - "integrity": "sha512-nLzC7C0i/WAY+4FukHuONBDNeKUAqBBab3n36aEdpqxVDP5h2Tbzg2yShqav2blR7KDJL7YMcYTVFxmwfQj+yQ==", + "version": "1.0.48", + "resolved": "https://registry.npmjs.org/@github/copilot-darwin-x64/-/copilot-darwin-x64-1.0.48.tgz", + "integrity": "sha512-1VQ5r5F0h8GwboXmZTcutqcJT+iCpPXAF27QqodmpKEvW9aYfG8g9X2kFJOzDZoX+SA3Uaka9qXdYKF2xT6Uog==", "cpu": [ "x64" ], @@ -477,9 +477,9 @@ } }, "node_modules/@github/copilot-linux-arm64": { - "version": "1.0.45", - "resolved": "https://registry.npmjs.org/@github/copilot-linux-arm64/-/copilot-linux-arm64-1.0.45.tgz", - "integrity": "sha512-MdRNZUNMrI0dpQ+DiDoZQ7AbitQp9eN7ir176Za2Kf7dkUxPwmio32yhRbBS81McU6vBw8cCzEZviwv/jc8buQ==", + "version": "1.0.48", + "resolved": "https://registry.npmjs.org/@github/copilot-linux-arm64/-/copilot-linux-arm64-1.0.48.tgz", + "integrity": "sha512-PmsGnb0DZlI+Bf53l9HM1PAHHkUcMyB4y8v/7tnC/jDOV5dGF124n0HnDNfJLOLiJGiQGodthIif6QtPaAxpeA==", "cpu": [ "arm64" ], @@ -493,9 +493,9 @@ } }, "node_modules/@github/copilot-linux-x64": { - "version": "1.0.45", - "resolved": "https://registry.npmjs.org/@github/copilot-linux-x64/-/copilot-linux-x64-1.0.45.tgz", - "integrity": "sha512-xSRUjWA+wrSSjktJSjNtiS/47Cy0PviPejj7RUmtChsPfDJB8wW2iZ6NfpdiAomtxAz5xx4AjbjT1I4b1FqnwA==", + "version": "1.0.48", + "resolved": "https://registry.npmjs.org/@github/copilot-linux-x64/-/copilot-linux-x64-1.0.48.tgz", + "integrity": "sha512-b2cc4euSlke9fYHXXsS2EL9UYbctN0h4lZvtAcKUDY+RCnpYAQOVBZK+c1R9dQrtsT6Z/yUv7PuFPSs8qdtc2Q==", "cpu": [ "x64" ], @@ -509,9 +509,9 @@ } }, "node_modules/@github/copilot-win32-arm64": { - "version": "1.0.45", - "resolved": "https://registry.npmjs.org/@github/copilot-win32-arm64/-/copilot-win32-arm64-1.0.45.tgz", - "integrity": "sha512-lhcTlKs7MWMzIXv21hUSpL4aFW49jqVhNrQKaB8sYk2nzvGRJvNwTcBS1Tn5ndXlPzQ9P/p9B6B5uwwmZ1vHHw==", + "version": "1.0.48", + "resolved": "https://registry.npmjs.org/@github/copilot-win32-arm64/-/copilot-win32-arm64-1.0.48.tgz", + "integrity": "sha512-VEEOwddtpJ3DTbXGhnK6K8im4ofl9m08q1m/K++sNvWV8wkkOSOQBTiPdyUsuU/TXAoFhb8tZMIJv+6NnMBtMw==", "cpu": [ "arm64" ], @@ -525,9 +525,9 @@ } }, "node_modules/@github/copilot-win32-x64": { - "version": "1.0.45", - "resolved": "https://registry.npmjs.org/@github/copilot-win32-x64/-/copilot-win32-x64-1.0.45.tgz", - "integrity": "sha512-XYZ983NQmooVr/n+pCnHIorBmf1hd3o1rMlSAodwG/VFlQaydGoOs1F1NntxWBoFAND+eM6N4PZfw8M8sRayfA==", + "version": "1.0.48", + "resolved": "https://registry.npmjs.org/@github/copilot-win32-x64/-/copilot-win32-x64-1.0.48.tgz", + "integrity": "sha512-93BzvXLPHTyy1gWBXQY/IWIHor4IAwZuuo7/obG80/Qa6U0WeaN9slz/FBJvrsgVNrrRfEID5Xm3At+S6Kj67Q==", "cpu": [ "x64" ], diff --git a/scripts/codegen/package.json b/scripts/codegen/package.json index 6dde795791..82454e774e 100644 --- a/scripts/codegen/package.json +++ b/scripts/codegen/package.json @@ -7,7 +7,7 @@ "generate:java": "tsx java.ts" }, "dependencies": { - "@github/copilot": "^1.0.44-3", + "@github/copilot": "^1.0.48", "json-schema": "^0.4.0", "tsx": "^4.20.6" } From 9de400aa796ca268d576487e16a5fcf9fd535424 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 15 May 2026 20:53:09 +0000 Subject: [PATCH 4/7] Regenerate codegen output Auto-committed by codegen-check workflow. --- .../generated/AssistantUsageApiEndpoint.java | 39 ++++++++++++++ .../sdk/generated/AssistantUsageEvent.java | 2 + .../SessionCustomNotificationEvent.java | 51 +++++++++++++++++++ .../sdk/generated/SessionErrorEvent.java | 2 +- .../copilot/sdk/generated/SessionEvent.java | 2 + .../SessionScheduleCreatedEvent.java | 4 +- .../sdk/generated/UserMessageEvent.java | 2 + .../copilot/sdk/generated/rpc/Model.java | 6 ++- .../sdk/generated/rpc/ModelBilling.java | 4 +- .../rpc/ModelBillingTokenPrices.java | 33 ++++++++++++ .../generated/rpc/ModelPickerCategory.java | 37 ++++++++++++++ .../rpc/ModelPickerPriceCategory.java | 39 ++++++++++++++ .../sdk/generated/rpc/RemoteSessionMode.java | 37 ++++++++++++++ .../sdk/generated/rpc/SessionCommandsApi.java | 21 ++++++++ .../rpc/SessionCommandsInvokeParams.java | 31 +++++++++++ .../rpc/SessionCommandsListParams.java | 27 ++++++++++ .../rpc/SessionCommandsListResult.java | 28 ++++++++++ .../sdk/generated/rpc/SessionRemoteApi.java | 11 +++- .../rpc/SessionRemoteEnableParams.java | 4 +- .../sdk/generated/rpc/SessionSkillsApi.java | 4 +- .../rpc/SessionSkillsReloadResult.java | 8 ++- .../sdk/generated/rpc/SessionsForkParams.java | 4 +- .../sdk/generated/rpc/SessionsForkResult.java | 4 +- .../sdk/generated/rpc/SlashCommandInfo.java | 35 +++++++++++++ .../sdk/generated/rpc/SlashCommandInput.java | 33 ++++++++++++ .../rpc/SlashCommandInputCompletion.java | 33 ++++++++++++ .../sdk/generated/rpc/SlashCommandKind.java | 37 ++++++++++++++ 27 files changed, 526 insertions(+), 12 deletions(-) create mode 100644 src/generated/java/com/github/copilot/sdk/generated/AssistantUsageApiEndpoint.java create mode 100644 src/generated/java/com/github/copilot/sdk/generated/SessionCustomNotificationEvent.java create mode 100644 src/generated/java/com/github/copilot/sdk/generated/rpc/ModelBillingTokenPrices.java create mode 100644 src/generated/java/com/github/copilot/sdk/generated/rpc/ModelPickerCategory.java create mode 100644 src/generated/java/com/github/copilot/sdk/generated/rpc/ModelPickerPriceCategory.java create mode 100644 src/generated/java/com/github/copilot/sdk/generated/rpc/RemoteSessionMode.java create mode 100644 src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCommandsInvokeParams.java create mode 100644 src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCommandsListParams.java create mode 100644 src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCommandsListResult.java create mode 100644 src/generated/java/com/github/copilot/sdk/generated/rpc/SlashCommandInfo.java create mode 100644 src/generated/java/com/github/copilot/sdk/generated/rpc/SlashCommandInput.java create mode 100644 src/generated/java/com/github/copilot/sdk/generated/rpc/SlashCommandInputCompletion.java create mode 100644 src/generated/java/com/github/copilot/sdk/generated/rpc/SlashCommandKind.java diff --git a/src/generated/java/com/github/copilot/sdk/generated/AssistantUsageApiEndpoint.java b/src/generated/java/com/github/copilot/sdk/generated/AssistantUsageApiEndpoint.java new file mode 100644 index 0000000000..bbcd619fbb --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/AssistantUsageApiEndpoint.java @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.sdk.generated; + +import javax.annotation.processing.Generated; + +/** + * API endpoint used for this model call, matching CAPI supported_endpoints vocabulary + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum AssistantUsageApiEndpoint { + /** The {@code /chat/completions} variant. */ + /CHAT/COMPLETIONS("/chat/completions"), + /** The {@code /v1/messages} variant. */ + /V1/MESSAGES("/v1/messages"), + /** The {@code /responses} variant. */ + /RESPONSES("/responses"), + /** The {@code ws:/responses} variant. */ + WS:/RESPONSES("ws:/responses"); + + private final String value; + AssistantUsageApiEndpoint(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static AssistantUsageApiEndpoint fromValue(String value) { + for (AssistantUsageApiEndpoint v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown AssistantUsageApiEndpoint value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/AssistantUsageEvent.java b/src/generated/java/com/github/copilot/sdk/generated/AssistantUsageEvent.java index 4613d520e7..ba97e03958 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/AssistantUsageEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/AssistantUsageEvent.java @@ -62,6 +62,8 @@ public record AssistantUsageEventData( @JsonProperty("apiCallId") String apiCallId, /** GitHub request tracing ID (x-github-request-id header) for server-side log correlation */ @JsonProperty("providerCallId") String providerCallId, + /** API endpoint used for this model call, matching CAPI supported_endpoints vocabulary */ + @JsonProperty("apiEndpoint") AssistantUsageApiEndpoint apiEndpoint, /** Parent tool call ID when this usage originates from a sub-agent */ @JsonProperty("parentToolCallId") String parentToolCallId, /** Per-quota resource usage snapshots, keyed by quota identifier */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/SessionCustomNotificationEvent.java b/src/generated/java/com/github/copilot/sdk/generated/SessionCustomNotificationEvent.java new file mode 100644 index 0000000000..8d3e3b68ac --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/SessionCustomNotificationEvent.java @@ -0,0 +1,51 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.sdk.generated; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; +import javax.annotation.processing.Generated; + +/** + * The {@code session.custom_notification} session event. + * + * @since 1.0.0 + */ +@JsonIgnoreProperties(ignoreUnknown = true) +@JsonInclude(JsonInclude.Include.NON_NULL) +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public final class SessionCustomNotificationEvent extends SessionEvent { + + @Override + public String getType() { return "session.custom_notification"; } + + @JsonProperty("data") + private SessionCustomNotificationEventData data; + + public SessionCustomNotificationEventData getData() { return data; } + public void setData(SessionCustomNotificationEventData data) { this.data = data; } + + /** Data payload for {@link SessionCustomNotificationEvent}. */ + @JsonIgnoreProperties(ignoreUnknown = true) + @JsonInclude(JsonInclude.Include.NON_NULL) + public record SessionCustomNotificationEventData( + /** Namespace for the custom notification producer */ + @JsonProperty("source") String source, + /** Source-defined custom notification name */ + @JsonProperty("name") String name, + /** Optional source-defined payload schema version */ + @JsonProperty("version") Long version, + /** Optional source-defined string identifiers describing the payload subject */ + @JsonProperty("subject") Map subject, + /** Source-defined JSON payload for the custom notification */ + @JsonProperty("payload") Object payload + ) { + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/SessionErrorEvent.java b/src/generated/java/com/github/copilot/sdk/generated/SessionErrorEvent.java index ecb85aacf0..5c174c4357 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/SessionErrorEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/SessionErrorEvent.java @@ -37,7 +37,7 @@ public final class SessionErrorEvent extends SessionEvent { public record SessionErrorEventData( /** Category of error (e.g., "authentication", "authorization", "quota", "rate_limit", "context_limit", "query") */ @JsonProperty("errorType") String errorType, - /** Fine-grained error code from the upstream provider, when available. For `errorType: "rate_limit"`, this is one of the `RateLimitErrorCode` values (e.g., `"user_weekly_rate_limited"`, `"user_global_rate_limited"`, `"rate_limited"`, `"user_model_rate_limited"`, `"integration_rate_limited"`). */ + /** Fine-grained error code from the upstream provider, when available. For `errorType: "rate_limit"`, this is one of the `RateLimitErrorCode` values (e.g., `"user_weekly_rate_limited"`, `"user_global_rate_limited"`, `"rate_limited"`, `"user_model_rate_limited"`, `"integration_rate_limited"`). For `errorType: "quota"`, this is the CAPI quota error code (e.g., `"quota_exceeded"`, `"session_quota_exceeded"`, `"billing_not_configured"`). */ @JsonProperty("errorCode") String errorCode, /** Only set on `errorType: "rate_limit"`. When `true`, the runtime will follow this error with an `auto_mode_switch.requested` event (or silently switch if `continueOnAutoMode` is enabled). UI clients can use this flag to suppress duplicate rendering of the rate-limit error when they show their own auto-mode-switch prompt. */ @JsonProperty("eligibleForAutoSwitch") Boolean eligibleForAutoSwitch, diff --git a/src/generated/java/com/github/copilot/sdk/generated/SessionEvent.java b/src/generated/java/com/github/copilot/sdk/generated/SessionEvent.java index 0f348fe863..2181be1972 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/SessionEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/SessionEvent.java @@ -87,6 +87,7 @@ @JsonSubTypes.Type(value = SamplingCompletedEvent.class, name = "sampling.completed"), @JsonSubTypes.Type(value = McpOauthRequiredEvent.class, name = "mcp.oauth_required"), @JsonSubTypes.Type(value = McpOauthCompletedEvent.class, name = "mcp.oauth_completed"), + @JsonSubTypes.Type(value = SessionCustomNotificationEvent.class, name = "session.custom_notification"), @JsonSubTypes.Type(value = ExternalToolRequestedEvent.class, name = "external_tool.requested"), @JsonSubTypes.Type(value = ExternalToolCompletedEvent.class, name = "external_tool.completed"), @JsonSubTypes.Type(value = CommandQueuedEvent.class, name = "command.queued"), @@ -170,6 +171,7 @@ public abstract sealed class SessionEvent permits SamplingCompletedEvent, McpOauthRequiredEvent, McpOauthCompletedEvent, + SessionCustomNotificationEvent, ExternalToolRequestedEvent, ExternalToolCompletedEvent, CommandQueuedEvent, diff --git a/src/generated/java/com/github/copilot/sdk/generated/SessionScheduleCreatedEvent.java b/src/generated/java/com/github/copilot/sdk/generated/SessionScheduleCreatedEvent.java index aba8650c84..bf0be67caf 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/SessionScheduleCreatedEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/SessionScheduleCreatedEvent.java @@ -40,7 +40,9 @@ public record SessionScheduleCreatedEventData( /** Interval between ticks in milliseconds */ @JsonProperty("intervalMs") Long intervalMs, /** Prompt text that gets enqueued on every tick */ - @JsonProperty("prompt") String prompt + @JsonProperty("prompt") String prompt, + /** Whether the schedule re-arms after each tick (`/every`) or fires once (`/after`) */ + @JsonProperty("recurring") Boolean recurring ) { } } diff --git a/src/generated/java/com/github/copilot/sdk/generated/UserMessageEvent.java b/src/generated/java/com/github/copilot/sdk/generated/UserMessageEvent.java index ec5f382463..fa680d3e64 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/UserMessageEvent.java +++ b/src/generated/java/com/github/copilot/sdk/generated/UserMessageEvent.java @@ -50,6 +50,8 @@ public record UserMessageEventData( @JsonProperty("source") String source, /** The agent mode that was active when this message was sent */ @JsonProperty("agentMode") UserMessageAgentMode agentMode, + /** True when this user message was auto-injected by autopilot's continuation loop rather than typed by the user; used to distinguish autopilot-driven turns in telemetry. */ + @JsonProperty("isAutopilotContinuation") Boolean isAutopilotContinuation, /** CAPI interaction ID for correlating this user message with its turn */ @JsonProperty("interactionId") String interactionId, /** Parent agent task ID for background telemetry correlated to this user turn */ diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/Model.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/Model.java index 9ba457cecb..9bda6a3007 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/Model.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/Model.java @@ -30,6 +30,10 @@ public record Model( /** Supported reasoning effort levels (only present if model supports reasoning effort) */ @JsonProperty("supportedReasoningEfforts") List supportedReasoningEfforts, /** Default reasoning effort level (only present if model supports reasoning effort) */ - @JsonProperty("defaultReasoningEffort") String defaultReasoningEffort + @JsonProperty("defaultReasoningEffort") String defaultReasoningEffort, + /** Model capability category for grouping in the model picker */ + @JsonProperty("modelPickerCategory") ModelPickerCategory modelPickerCategory, + /** Relative cost tier for token-based billing users */ + @JsonProperty("modelPickerPriceCategory") ModelPickerPriceCategory modelPickerPriceCategory ) { } diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/ModelBilling.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/ModelBilling.java index 656f5383d5..9e634bb79a 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/ModelBilling.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/ModelBilling.java @@ -22,6 +22,8 @@ @JsonIgnoreProperties(ignoreUnknown = true) public record ModelBilling( /** Billing cost multiplier relative to the base rate */ - @JsonProperty("multiplier") Double multiplier + @JsonProperty("multiplier") Double multiplier, + /** Token-level pricing information for this model */ + @JsonProperty("tokenPrices") ModelBillingTokenPrices tokenPrices ) { } diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/ModelBillingTokenPrices.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/ModelBillingTokenPrices.java new file mode 100644 index 0000000000..34005daf1b --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/ModelBillingTokenPrices.java @@ -0,0 +1,33 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Token-level pricing information for this model + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record ModelBillingTokenPrices( + /** Price per billing batch of input tokens in nano-AIUs (1 nano-AIU = 0.000000001 AIU, 1 AIU = $0.01 USD) */ + @JsonProperty("inputPrice") Long inputPrice, + /** Price per billing batch of output tokens in nano-AIUs (1 nano-AIU = 0.000000001 AIU, 1 AIU = $0.01 USD) */ + @JsonProperty("outputPrice") Long outputPrice, + /** Price per billing batch of cached tokens in nano-AIUs (1 nano-AIU = 0.000000001 AIU, 1 AIU = $0.01 USD) */ + @JsonProperty("cachePrice") Long cachePrice, + /** Number of tokens per standard billing batch */ + @JsonProperty("batchSize") Long batchSize +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/ModelPickerCategory.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/ModelPickerCategory.java new file mode 100644 index 0000000000..ba0bdddfd1 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/ModelPickerCategory.java @@ -0,0 +1,37 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Model capability category for grouping in the model picker + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum ModelPickerCategory { + /** The {@code lightweight} variant. */ + LIGHTWEIGHT("lightweight"), + /** The {@code versatile} variant. */ + VERSATILE("versatile"), + /** The {@code powerful} variant. */ + POWERFUL("powerful"); + + private final String value; + ModelPickerCategory(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static ModelPickerCategory fromValue(String value) { + for (ModelPickerCategory v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown ModelPickerCategory value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/ModelPickerPriceCategory.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/ModelPickerPriceCategory.java new file mode 100644 index 0000000000..cf722e4968 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/ModelPickerPriceCategory.java @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Relative cost tier for token-based billing users + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum ModelPickerPriceCategory { + /** The {@code low} variant. */ + LOW("low"), + /** The {@code medium} variant. */ + MEDIUM("medium"), + /** The {@code high} variant. */ + HIGH("high"), + /** The {@code very_high} variant. */ + VERY_HIGH("very_high"); + + private final String value; + ModelPickerPriceCategory(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static ModelPickerPriceCategory fromValue(String value) { + for (ModelPickerPriceCategory v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown ModelPickerPriceCategory value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/RemoteSessionMode.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/RemoteSessionMode.java new file mode 100644 index 0000000000..4f659bb6b6 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/RemoteSessionMode.java @@ -0,0 +1,37 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Per-session remote mode. "off" disables remote, "export" exports session events to Mission Control without enabling remote steering, "on" enables both export and remote steering. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum RemoteSessionMode { + /** The {@code off} variant. */ + OFF("off"), + /** The {@code export} variant. */ + EXPORT("export"), + /** The {@code on} variant. */ + ON("on"); + + private final String value; + RemoteSessionMode(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static RemoteSessionMode fromValue(String value) { + for (RemoteSessionMode v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown RemoteSessionMode value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCommandsApi.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCommandsApi.java index 0d3599a1cc..6366af794a 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCommandsApi.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCommandsApi.java @@ -29,6 +29,27 @@ public final class SessionCommandsApi { this.sessionId = sessionId; } + /** + * Invokes {@code session.commands.list}. + * @since 1.0.0 + */ + public CompletableFuture list() { + return caller.invoke("session.commands.list", java.util.Map.of("sessionId", this.sessionId), SessionCommandsListResult.class); + } + + /** + * Invokes {@code session.commands.invoke}. + *

+ * Note: the {@code sessionId} field in the params record is overridden + * by the session-scoped wrapper; any value provided is ignored. + * @since 1.0.0 + */ + public CompletableFuture invoke(SessionCommandsInvokeParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.commands.invoke", _p, Void.class); + } + /** * Invokes {@code session.commands.handlePendingCommand}. *

diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCommandsInvokeParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCommandsInvokeParams.java new file mode 100644 index 0000000000..141ec9524d --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCommandsInvokeParams.java @@ -0,0 +1,31 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Request parameters for the {@code session.commands.invoke} RPC method. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionCommandsInvokeParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** Command name. Leading slashes are stripped and the name is matched case-insensitively. */ + @JsonProperty("name") String name, + /** Raw input after the command name */ + @JsonProperty("input") String input +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCommandsListParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCommandsListParams.java new file mode 100644 index 0000000000..dd51f0e768 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCommandsListParams.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Request parameters for the {@code session.commands.list} RPC method. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionCommandsListParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCommandsListResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCommandsListResult.java new file mode 100644 index 0000000000..e819ba64c1 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionCommandsListResult.java @@ -0,0 +1,28 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import javax.annotation.processing.Generated; + +/** + * Result for the {@code session.commands.list} RPC method. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionCommandsListResult( + /** Commands available in this session */ + @JsonProperty("commands") List commands +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionRemoteApi.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionRemoteApi.java index df458acda5..790e1a7255 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionRemoteApi.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionRemoteApi.java @@ -18,6 +18,8 @@ @javax.annotation.processing.Generated("copilot-sdk-codegen") public final class SessionRemoteApi { + private static final com.fasterxml.jackson.databind.ObjectMapper MAPPER = RpcMapper.INSTANCE; + private final RpcCaller caller; private final String sessionId; @@ -29,12 +31,17 @@ public final class SessionRemoteApi { /** * Invokes {@code session.remote.enable}. + *

+ * Note: the {@code sessionId} field in the params record is overridden + * by the session-scoped wrapper; any value provided is ignored. * * @apiNote This method is experimental and may change in a future version. * @since 1.0.0 */ - public CompletableFuture enable() { - return caller.invoke("session.remote.enable", java.util.Map.of("sessionId", this.sessionId), SessionRemoteEnableResult.class); + public CompletableFuture enable(SessionRemoteEnableParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.remote.enable", _p, SessionRemoteEnableResult.class); } /** diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionRemoteEnableParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionRemoteEnableParams.java index d8b7917b78..aa1fff7a23 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionRemoteEnableParams.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionRemoteEnableParams.java @@ -22,6 +22,8 @@ @JsonIgnoreProperties(ignoreUnknown = true) public record SessionRemoteEnableParams( /** Target session identifier */ - @JsonProperty("sessionId") String sessionId + @JsonProperty("sessionId") String sessionId, + /** Per-session remote mode. "off" disables remote, "export" exports session events to Mission Control without enabling remote steering, "on" enables both export and remote steering. */ + @JsonProperty("mode") RemoteSessionMode mode ) { } diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionSkillsApi.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionSkillsApi.java index b32419a3e6..6f46d19d75 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionSkillsApi.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionSkillsApi.java @@ -75,8 +75,8 @@ public CompletableFuture disable(SessionSkillsDisableParams params) { * @apiNote This method is experimental and may change in a future version. * @since 1.0.0 */ - public CompletableFuture reload() { - return caller.invoke("session.skills.reload", java.util.Map.of("sessionId", this.sessionId), Void.class); + public CompletableFuture reload() { + return caller.invoke("session.skills.reload", java.util.Map.of("sessionId", this.sessionId), SessionSkillsReloadResult.class); } } diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionSkillsReloadResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionSkillsReloadResult.java index 1bfca46e1a..1333d57cc1 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionSkillsReloadResult.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionSkillsReloadResult.java @@ -10,6 +10,7 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; import javax.annotation.processing.Generated; /** @@ -20,5 +21,10 @@ @javax.annotation.processing.Generated("copilot-sdk-codegen") @JsonInclude(JsonInclude.Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) -public record SessionSkillsReloadResult() { +public record SessionSkillsReloadResult( + /** Warnings emitted while loading skills (e.g. skills that loaded but had issues) */ + @JsonProperty("warnings") List warnings, + /** Errors emitted while loading skills (e.g. skills that failed to load entirely) */ + @JsonProperty("errors") List errors +) { } diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsForkParams.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsForkParams.java index 06ea46c932..644be05ee0 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsForkParams.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsForkParams.java @@ -24,6 +24,8 @@ public record SessionsForkParams( /** Source session ID to fork from */ @JsonProperty("sessionId") String sessionId, /** Optional event ID boundary. When provided, the fork includes only events before this ID (exclusive). When omitted, all events are included. */ - @JsonProperty("toEventId") String toEventId + @JsonProperty("toEventId") String toEventId, + /** Optional friendly name to assign to the forked session. */ + @JsonProperty("name") String name ) { } diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsForkResult.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsForkResult.java index 911574f568..77543916ec 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsForkResult.java +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SessionsForkResult.java @@ -22,6 +22,8 @@ @JsonIgnoreProperties(ignoreUnknown = true) public record SessionsForkResult( /** The new forked session's ID */ - @JsonProperty("sessionId") String sessionId + @JsonProperty("sessionId") String sessionId, + /** Friendly name assigned to the forked session, if any. */ + @JsonProperty("name") String name ) { } diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SlashCommandInfo.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SlashCommandInfo.java new file mode 100644 index 0000000000..e494f4894c --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SlashCommandInfo.java @@ -0,0 +1,35 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import javax.annotation.processing.Generated; + +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SlashCommandInfo( + /** Canonical command name without a leading slash */ + @JsonProperty("name") String name, + /** Canonical aliases without leading slashes */ + @JsonProperty("aliases") List aliases, + /** Human-readable command description */ + @JsonProperty("description") String description, + /** Coarse command category for grouping and behavior: runtime built-in, skill-backed command, or SDK/client-owned command */ + @JsonProperty("kind") SlashCommandKind kind, + /** Optional unstructured input hint */ + @JsonProperty("input") SlashCommandInput input, + /** Whether the command may run while an agent turn is active */ + @JsonProperty("allowDuringAgentExecution") Boolean allowDuringAgentExecution, + /** Whether the command is experimental */ + @JsonProperty("experimental") Boolean experimental +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SlashCommandInput.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SlashCommandInput.java new file mode 100644 index 0000000000..186dec5a81 --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SlashCommandInput.java @@ -0,0 +1,33 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Optional unstructured input hint + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SlashCommandInput( + /** Hint to display when command input has not been provided */ + @JsonProperty("hint") String hint, + /** When true, the command requires non-empty input; clients should render the input hint as required */ + @JsonProperty("required") Boolean required, + /** Optional completion hint for the input (e.g. 'directory' for filesystem path completion) */ + @JsonProperty("completion") SlashCommandInputCompletion completion, + /** When true, clients should pass the full text after the command name as a single argument rather than splitting on whitespace */ + @JsonProperty("preserveMultilineInput") Boolean preserveMultilineInput +) { +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SlashCommandInputCompletion.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SlashCommandInputCompletion.java new file mode 100644 index 0000000000..c192fa9c0f --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SlashCommandInputCompletion.java @@ -0,0 +1,33 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Optional completion hint for the input (e.g. 'directory' for filesystem path completion) + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum SlashCommandInputCompletion { + /** The {@code directory} variant. */ + DIRECTORY("directory"); + + private final String value; + SlashCommandInputCompletion(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static SlashCommandInputCompletion fromValue(String value) { + for (SlashCommandInputCompletion v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown SlashCommandInputCompletion value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/sdk/generated/rpc/SlashCommandKind.java b/src/generated/java/com/github/copilot/sdk/generated/rpc/SlashCommandKind.java new file mode 100644 index 0000000000..1f08c4efcd --- /dev/null +++ b/src/generated/java/com/github/copilot/sdk/generated/rpc/SlashCommandKind.java @@ -0,0 +1,37 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.sdk.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Coarse command category for grouping and behavior: runtime built-in, skill-backed command, or SDK/client-owned command + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum SlashCommandKind { + /** The {@code builtin} variant. */ + BUILTIN("builtin"), + /** The {@code skill} variant. */ + SKILL("skill"), + /** The {@code client} variant. */ + CLIENT("client"); + + private final String value; + SlashCommandKind(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static SlashCommandKind fromValue(String value) { + for (SlashCommandKind v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown SlashCommandKind value: " + value); + } +} From 2509ed149b559570880cbe55da07a1ebfef0ce23 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 15 May 2026 21:13:20 +0000 Subject: [PATCH 5/7] Add comprehensive RemoteSession tests and fix generated code compilation errors Co-authored-by: edburns <75821+edburns@users.noreply.github.com> --- .../generated/AssistantUsageApiEndpoint.java | 8 +- .../github/copilot/sdk/RemoteSessionTest.java | 399 ++++++++++++++++++ .../rpc/GeneratedRpcApiCoverageTest.java | 4 +- .../rpc/GeneratedRpcRecordsCoverageTest.java | 10 +- 4 files changed, 410 insertions(+), 11 deletions(-) create mode 100644 src/test/java/com/github/copilot/sdk/RemoteSessionTest.java diff --git a/src/generated/java/com/github/copilot/sdk/generated/AssistantUsageApiEndpoint.java b/src/generated/java/com/github/copilot/sdk/generated/AssistantUsageApiEndpoint.java index bbcd619fbb..e69e4ef868 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/AssistantUsageApiEndpoint.java +++ b/src/generated/java/com/github/copilot/sdk/generated/AssistantUsageApiEndpoint.java @@ -17,13 +17,13 @@ @javax.annotation.processing.Generated("copilot-sdk-codegen") public enum AssistantUsageApiEndpoint { /** The {@code /chat/completions} variant. */ - /CHAT/COMPLETIONS("/chat/completions"), + CHAT_COMPLETIONS("/chat/completions"), /** The {@code /v1/messages} variant. */ - /V1/MESSAGES("/v1/messages"), + V1_MESSAGES("/v1/messages"), /** The {@code /responses} variant. */ - /RESPONSES("/responses"), + RESPONSES("/responses"), /** The {@code ws:/responses} variant. */ - WS:/RESPONSES("ws:/responses"); + WS_RESPONSES("ws:/responses"); private final String value; AssistantUsageApiEndpoint(String value) { this.value = value; } diff --git a/src/test/java/com/github/copilot/sdk/RemoteSessionTest.java b/src/test/java/com/github/copilot/sdk/RemoteSessionTest.java new file mode 100644 index 0000000000..6e093db6ca --- /dev/null +++ b/src/test/java/com/github/copilot/sdk/RemoteSessionTest.java @@ -0,0 +1,399 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +package com.github.copilot.sdk; + +import static org.junit.jupiter.api.Assertions.*; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.github.copilot.sdk.json.CreateSessionRequest; +import com.github.copilot.sdk.json.ResumeSessionConfig; +import com.github.copilot.sdk.json.ResumeSessionRequest; +import com.github.copilot.sdk.json.SessionConfig; + +/** + * Tests for the {@code remoteSession} feature across all session config types. + *

+ * Validates the complete lifecycle of the remote session mode: + *

+ */ +class RemoteSessionTest { + + private static final ObjectMapper MAPPER = JsonRpcClient.getObjectMapper(); + + // ========================================================================= + // SessionConfig getter/setter/copy + // ========================================================================= + + @Test + void sessionConfig_remoteSessionDefaultsToNull() { + var cfg = new SessionConfig(); + assertNull(cfg.getRemoteSession(), "remoteSession should be null when not set"); + } + + @ParameterizedTest + @ValueSource(strings = {"off", "export", "on"}) + void sessionConfig_setRemoteSessionReturnsSelf(String mode) { + var cfg = new SessionConfig(); + SessionConfig result = cfg.setRemoteSession(mode); + assertSame(cfg, result, "setRemoteSession should return the same instance for chaining"); + assertEquals(mode, cfg.getRemoteSession()); + } + + @Test + void sessionConfig_copyPreservesRemoteSession() { + var original = new SessionConfig().setRemoteSession("export"); + var copy = original.clone(); + assertEquals("export", copy.getRemoteSession()); + } + + @Test + void sessionConfig_copyPreservesNullRemoteSession() { + var original = new SessionConfig(); + var copy = original.clone(); + assertNull(copy.getRemoteSession()); + } + + @Test + void sessionConfig_setRemoteSessionToNullClearsValue() { + var cfg = new SessionConfig().setRemoteSession("on"); + cfg.setRemoteSession(null); + assertNull(cfg.getRemoteSession()); + } + + // ========================================================================= + // ResumeSessionConfig getter/setter/copy + // ========================================================================= + + @Test + void resumeSessionConfig_remoteSessionDefaultsToNull() { + var cfg = new ResumeSessionConfig(); + assertNull(cfg.getRemoteSession(), "remoteSession should be null when not set"); + } + + @ParameterizedTest + @ValueSource(strings = {"off", "export", "on"}) + void resumeSessionConfig_setRemoteSessionReturnsSelf(String mode) { + var cfg = new ResumeSessionConfig(); + ResumeSessionConfig result = cfg.setRemoteSession(mode); + assertSame(cfg, result, "setRemoteSession should return the same instance for chaining"); + assertEquals(mode, cfg.getRemoteSession()); + } + + @Test + void resumeSessionConfig_copyPreservesRemoteSession() { + var original = new ResumeSessionConfig().setRemoteSession("on"); + var copy = original.clone(); + assertEquals("on", copy.getRemoteSession()); + } + + // ========================================================================= + // SessionRequestBuilder – CreateSessionRequest wiring + // ========================================================================= + + @ParameterizedTest + @ValueSource(strings = {"off", "export", "on"}) + void buildCreateRequest_propagatesRemoteSession(String mode) { + var config = new SessionConfig().setRemoteSession(mode); + CreateSessionRequest request = SessionRequestBuilder.buildCreateRequest(config); + assertEquals(mode, request.getRemoteSession()); + } + + @Test + void buildCreateRequest_nullConfig_remoteSessionIsNull() { + CreateSessionRequest request = SessionRequestBuilder.buildCreateRequest(null); + assertNull(request.getRemoteSession()); + } + + @Test + void buildCreateRequest_unsetRemoteSession_isNull() { + var config = new SessionConfig(); + CreateSessionRequest request = SessionRequestBuilder.buildCreateRequest(config); + assertNull(request.getRemoteSession()); + } + + // ========================================================================= + // SessionRequestBuilder – ResumeSessionRequest wiring + // ========================================================================= + + @ParameterizedTest + @ValueSource(strings = {"off", "export", "on"}) + void buildResumeRequest_propagatesRemoteSession(String mode) { + var config = new ResumeSessionConfig().setRemoteSession(mode); + ResumeSessionRequest request = SessionRequestBuilder.buildResumeRequest("sid-1", config); + assertEquals(mode, request.getRemoteSession()); + } + + @Test + void buildResumeRequest_nullConfig_remoteSessionIsNull() { + ResumeSessionRequest request = SessionRequestBuilder.buildResumeRequest("sid-1", null); + assertNull(request.getRemoteSession()); + } + + @Test + void buildResumeRequest_unsetRemoteSession_isNull() { + var config = new ResumeSessionConfig(); + ResumeSessionRequest request = SessionRequestBuilder.buildResumeRequest("sid-1", config); + assertNull(request.getRemoteSession()); + } + + // ========================================================================= + // JSON wire-format: CreateSessionRequest + // ========================================================================= + + @ParameterizedTest + @ValueSource(strings = {"off", "export", "on"}) + void createRequest_serializesRemoteSessionCorrectly(String mode) throws Exception { + var config = new SessionConfig().setRemoteSession(mode); + CreateSessionRequest request = SessionRequestBuilder.buildCreateRequest(config); + + String json = MAPPER.writeValueAsString(request); + JsonNode tree = MAPPER.readTree(json); + + assertTrue(tree.has("remoteSession"), "Serialized JSON should contain 'remoteSession' field for mode: " + mode); + assertEquals(mode, tree.get("remoteSession").asText()); + } + + @Test + void createRequest_omitsRemoteSessionWhenNull() throws Exception { + var config = new SessionConfig(); + CreateSessionRequest request = SessionRequestBuilder.buildCreateRequest(config); + + String json = MAPPER.writeValueAsString(request); + JsonNode tree = MAPPER.readTree(json); + + assertFalse(tree.has("remoteSession"), "Serialized JSON should omit 'remoteSession' when not set"); + } + + // ========================================================================= + // JSON wire-format: ResumeSessionRequest + // ========================================================================= + + @ParameterizedTest + @ValueSource(strings = {"off", "export", "on"}) + void resumeRequest_serializesRemoteSessionCorrectly(String mode) throws Exception { + var config = new ResumeSessionConfig().setRemoteSession(mode); + ResumeSessionRequest request = SessionRequestBuilder.buildResumeRequest("sid-1", config); + + String json = MAPPER.writeValueAsString(request); + JsonNode tree = MAPPER.readTree(json); + + assertTrue(tree.has("remoteSession"), "Serialized JSON should contain 'remoteSession' field for mode: " + mode); + assertEquals(mode, tree.get("remoteSession").asText()); + } + + @Test + void resumeRequest_omitsRemoteSessionWhenNull() throws Exception { + var config = new ResumeSessionConfig(); + ResumeSessionRequest request = SessionRequestBuilder.buildResumeRequest("sid-1", config); + + String json = MAPPER.writeValueAsString(request); + JsonNode tree = MAPPER.readTree(json); + + assertFalse(tree.has("remoteSession"), "Serialized JSON should omit 'remoteSession' when not set"); + } + + // ========================================================================= + // JSON round-trip: CreateSessionRequest + // ========================================================================= + + @ParameterizedTest + @ValueSource(strings = {"off", "export", "on"}) + void createRequest_roundTripsRemoteSession(String mode) throws Exception { + var config = new SessionConfig().setRemoteSession(mode); + CreateSessionRequest request = SessionRequestBuilder.buildCreateRequest(config); + + String json = MAPPER.writeValueAsString(request); + CreateSessionRequest deserialized = MAPPER.readValue(json, CreateSessionRequest.class); + assertEquals(mode, deserialized.getRemoteSession()); + } + + @Test + void createRequest_roundTripsNullRemoteSession() throws Exception { + var config = new SessionConfig(); + CreateSessionRequest request = SessionRequestBuilder.buildCreateRequest(config); + + String json = MAPPER.writeValueAsString(request); + CreateSessionRequest deserialized = MAPPER.readValue(json, CreateSessionRequest.class); + assertNull(deserialized.getRemoteSession()); + } + + // ========================================================================= + // JSON round-trip: ResumeSessionRequest + // ========================================================================= + + @ParameterizedTest + @ValueSource(strings = {"off", "export", "on"}) + void resumeRequest_roundTripsRemoteSession(String mode) throws Exception { + var config = new ResumeSessionConfig().setRemoteSession(mode); + ResumeSessionRequest request = SessionRequestBuilder.buildResumeRequest("sid-1", config); + + String json = MAPPER.writeValueAsString(request); + ResumeSessionRequest deserialized = MAPPER.readValue(json, ResumeSessionRequest.class); + assertEquals(mode, deserialized.getRemoteSession()); + } + + // ========================================================================= + // Fluent chaining: remoteSession composes with other config options + // ========================================================================= + + @Test + void sessionConfig_remoteSessionComposesWithOtherFields() { + var config = new SessionConfig().setModel("gpt-4o").setRemoteSession("export").setReasoningEffort("high"); + + assertEquals("gpt-4o", config.getModel()); + assertEquals("export", config.getRemoteSession()); + assertEquals("high", config.getReasoningEffort()); + } + + @Test + void resumeSessionConfig_remoteSessionComposesWithOtherFields() { + var config = new ResumeSessionConfig().setModel("gpt-4o").setRemoteSession("on").setReasoningEffort("medium"); + + assertEquals("gpt-4o", config.getModel()); + assertEquals("on", config.getRemoteSession()); + assertEquals("medium", config.getReasoningEffort()); + } + + @Test + void createRequest_remoteSessionDoesNotAffectOtherFields() throws Exception { + var config = new SessionConfig().setModel("gpt-4o").setRemoteSession("export").setReasoningEffort("high") + .setGitHubToken("ghp_test"); + + CreateSessionRequest request = SessionRequestBuilder.buildCreateRequest(config); + String json = MAPPER.writeValueAsString(request); + JsonNode tree = MAPPER.readTree(json); + + assertEquals("export", tree.get("remoteSession").asText()); + assertEquals("gpt-4o", tree.get("model").asText()); + assertEquals("high", tree.get("reasoningEffort").asText()); + assertEquals("ghp_test", tree.get("gitHubToken").asText()); + } + + @Test + void resumeRequest_remoteSessionDoesNotAffectOtherFields() throws Exception { + var config = new ResumeSessionConfig().setModel("gpt-4o").setRemoteSession("on").setReasoningEffort("medium") + .setGitHubToken("ghp_test"); + + ResumeSessionRequest request = SessionRequestBuilder.buildResumeRequest("sid-1", config); + String json = MAPPER.writeValueAsString(request); + JsonNode tree = MAPPER.readTree(json); + + assertEquals("on", tree.get("remoteSession").asText()); + assertEquals("gpt-4o", tree.get("model").asText()); + assertEquals("medium", tree.get("reasoningEffort").asText()); + assertEquals("ghp_test", tree.get("gitHubToken").asText()); + } + + // ========================================================================= + // Deserialization from raw JSON (simulates CLI response ingestion) + // ========================================================================= + + @Test + void createRequest_deserializesRemoteSessionFromRawJson() throws Exception { + String json = """ + { + "sessionId": "test-session", + "remoteSession": "export", + "model": "gpt-4o" + } + """; + CreateSessionRequest request = MAPPER.readValue(json, CreateSessionRequest.class); + assertEquals("export", request.getRemoteSession()); + assertEquals("test-session", request.getSessionId()); + } + + @Test + void resumeRequest_deserializesRemoteSessionFromRawJson() throws Exception { + String json = """ + { + "sessionId": "resume-session", + "remoteSession": "on", + "model": "gpt-4o" + } + """; + ResumeSessionRequest request = MAPPER.readValue(json, ResumeSessionRequest.class); + assertEquals("on", request.getRemoteSession()); + assertEquals("resume-session", request.getSessionId()); + } + + @Test + void createRequest_deserializesWithMissingRemoteSession() throws Exception { + String json = """ + { + "sessionId": "test-session", + "model": "gpt-4o" + } + """; + CreateSessionRequest request = MAPPER.readValue(json, CreateSessionRequest.class); + assertNull(request.getRemoteSession()); + } + + // ========================================================================= + // Handoff event with remoteSessionId (remote session lifecycle) + // ========================================================================= + + @Test + void handoffEvent_withRemoteSourceType_containsRemoteSessionId() throws Exception { + String json = """ + { + "type": "session.handoff", + "data": { + "handoffTime": "2025-06-01T12:00:00Z", + "sourceType": "remote", + "remoteSessionId": "remote-sess-42", + "summary": "Session exported for remote execution", + "repository": { + "owner": "test-org", + "name": "test-repo", + "branch": "feature-branch" + } + } + } + """; + + var event = (com.github.copilot.sdk.generated.SessionHandoffEvent) MAPPER.readValue(json, + com.github.copilot.sdk.generated.SessionEvent.class); + assertNotNull(event); + var data = event.getData(); + assertEquals("remote-sess-42", data.remoteSessionId()); + assertEquals(com.github.copilot.sdk.generated.HandoffSourceType.REMOTE, data.sourceType()); + assertEquals("Session exported for remote execution", data.summary()); + assertEquals("test-org", data.repository().owner()); + assertEquals("test-repo", data.repository().name()); + assertEquals("feature-branch", data.repository().branch()); + } + + @Test + void handoffEvent_withoutRemoteSessionId_fieldIsNull() throws Exception { + String json = """ + { + "type": "session.handoff", + "data": { + "targetAgent": "local-agent" + } + } + """; + + var event = (com.github.copilot.sdk.generated.SessionHandoffEvent) MAPPER.readValue(json, + com.github.copilot.sdk.generated.SessionEvent.class); + assertNotNull(event); + assertNull(event.getData().remoteSessionId()); + } +} diff --git a/src/test/java/com/github/copilot/sdk/generated/rpc/GeneratedRpcApiCoverageTest.java b/src/test/java/com/github/copilot/sdk/generated/rpc/GeneratedRpcApiCoverageTest.java index 89943e3758..10393abe09 100644 --- a/src/test/java/com/github/copilot/sdk/generated/rpc/GeneratedRpcApiCoverageTest.java +++ b/src/test/java/com/github/copilot/sdk/generated/rpc/GeneratedRpcApiCoverageTest.java @@ -71,7 +71,7 @@ void serverRpc_sessions_fork_invokes_correct_method() { var stub = new StubCaller(); var server = new ServerRpc(stub); - var params = new SessionsForkParams("parent-session-id", null); + var params = new SessionsForkParams("parent-session-id", null, null); server.sessions.fork(params); assertEquals(1, stub.calls.size()); @@ -657,7 +657,7 @@ void serverRpc_sessionFs_setProvider_params_record() { @Test void sessionsForkParams_record() { - var params = new SessionsForkParams("parent-id", "event-123"); + var params = new SessionsForkParams("parent-id", "event-123", null); assertEquals("parent-id", params.sessionId()); assertEquals("event-123", params.toEventId()); } diff --git a/src/test/java/com/github/copilot/sdk/generated/rpc/GeneratedRpcRecordsCoverageTest.java b/src/test/java/com/github/copilot/sdk/generated/rpc/GeneratedRpcRecordsCoverageTest.java index 48ade8ce11..50e65d3779 100644 --- a/src/test/java/com/github/copilot/sdk/generated/rpc/GeneratedRpcRecordsCoverageTest.java +++ b/src/test/java/com/github/copilot/sdk/generated/rpc/GeneratedRpcRecordsCoverageTest.java @@ -67,7 +67,7 @@ void toolsListParams_record() { @Test void sessionsForkParams_record() { - var params = new SessionsForkParams("sess-1", "event-abc"); + var params = new SessionsForkParams("sess-1", "event-abc", null); assertEquals("sess-1", params.sessionId()); assertEquals("event-abc", params.toEventId()); } @@ -795,7 +795,7 @@ void sessionSkillsListResult_nested() { @Test void sessionSkillsReloadResult_empty() { - assertNotNull(new SessionSkillsReloadResult()); + assertNotNull(new SessionSkillsReloadResult(null, null)); } @Test @@ -863,7 +863,7 @@ void sessionWorkspaceReadFileResult_record() { @Test void sessionsForkResult_record() { - var result = new SessionsForkResult("forked-sess-id"); + var result = new SessionsForkResult("forked-sess-id", null); assertEquals("forked-sess-id", result.sessionId()); } @@ -917,8 +917,8 @@ void modelsListResult_nested() { var limits = new ModelCapabilitiesLimits(100000L, 8192L, 128000L, null); var capabilities = new ModelCapabilities(supports, limits); var policy = new ModelPolicy("active", null); - var billing = new ModelBilling(1.0); - var modelItem = new Model("gpt-5", "GPT-5", capabilities, policy, billing, null, null); + var billing = new ModelBilling(1.0, null); + var modelItem = new Model("gpt-5", "GPT-5", capabilities, policy, billing, null, null, null, null); var result = new ModelsListResult(List.of(modelItem)); assertEquals(1, result.models().size()); From a8c5fa368e1809fbee88131505fcb5b4dad2c0c5 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 15 May 2026 21:22:41 +0000 Subject: [PATCH 6/7] Regenerate codegen output Auto-committed by codegen-check workflow. --- .../copilot/sdk/generated/AssistantUsageApiEndpoint.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/generated/java/com/github/copilot/sdk/generated/AssistantUsageApiEndpoint.java b/src/generated/java/com/github/copilot/sdk/generated/AssistantUsageApiEndpoint.java index e69e4ef868..bbcd619fbb 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/AssistantUsageApiEndpoint.java +++ b/src/generated/java/com/github/copilot/sdk/generated/AssistantUsageApiEndpoint.java @@ -17,13 +17,13 @@ @javax.annotation.processing.Generated("copilot-sdk-codegen") public enum AssistantUsageApiEndpoint { /** The {@code /chat/completions} variant. */ - CHAT_COMPLETIONS("/chat/completions"), + /CHAT/COMPLETIONS("/chat/completions"), /** The {@code /v1/messages} variant. */ - V1_MESSAGES("/v1/messages"), + /V1/MESSAGES("/v1/messages"), /** The {@code /responses} variant. */ - RESPONSES("/responses"), + /RESPONSES("/responses"), /** The {@code ws:/responses} variant. */ - WS_RESPONSES("ws:/responses"); + WS:/RESPONSES("ws:/responses"); private final String value; AssistantUsageApiEndpoint(String value) { this.value = value; } From 5c5a64db328a847051ab361efa5b38d71a9bab4f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 15 May 2026 22:56:48 +0000 Subject: [PATCH 7/7] Merge main (#204), fix codegen toEnumConstant for slash/colon chars, regenerate Co-authored-by: edburns <75821+edburns@users.noreply.github.com> --- scripts/codegen/java.ts | 2 +- .../copilot/sdk/generated/AssistantUsageApiEndpoint.java | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/codegen/java.ts b/scripts/codegen/java.ts index 909fe296c6..0a96ab9f14 100644 --- a/scripts/codegen/java.ts +++ b/scripts/codegen/java.ts @@ -43,7 +43,7 @@ function toCamelCase(name: string): string { } function toEnumConstant(value: string): string { - return value.toUpperCase().replace(/[-. ]/g, "_"); + return value.toUpperCase().replace(/[-. /:]/g, "_").replace(/^_+/, "").replace(/_+/g, "_"); } // ── Schema path resolution ─────────────────────────────────────────────────── diff --git a/src/generated/java/com/github/copilot/sdk/generated/AssistantUsageApiEndpoint.java b/src/generated/java/com/github/copilot/sdk/generated/AssistantUsageApiEndpoint.java index bbcd619fbb..e69e4ef868 100644 --- a/src/generated/java/com/github/copilot/sdk/generated/AssistantUsageApiEndpoint.java +++ b/src/generated/java/com/github/copilot/sdk/generated/AssistantUsageApiEndpoint.java @@ -17,13 +17,13 @@ @javax.annotation.processing.Generated("copilot-sdk-codegen") public enum AssistantUsageApiEndpoint { /** The {@code /chat/completions} variant. */ - /CHAT/COMPLETIONS("/chat/completions"), + CHAT_COMPLETIONS("/chat/completions"), /** The {@code /v1/messages} variant. */ - /V1/MESSAGES("/v1/messages"), + V1_MESSAGES("/v1/messages"), /** The {@code /responses} variant. */ - /RESPONSES("/responses"), + RESPONSES("/responses"), /** The {@code ws:/responses} variant. */ - WS:/RESPONSES("ws:/responses"); + WS_RESPONSES("ws:/responses"); private final String value; AssistantUsageApiEndpoint(String value) { this.value = value; }