diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 0c213e61c0..c6959d3089 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1 +1 @@ -* @github/copilot-sdk-java +* @github/copilot-sdk diff --git a/.github/workflows/copilot-setup-steps.yml b/.github/workflows/copilot-setup-steps.yml index 0d7e4f9a6c..9522a64923 100644 --- a/.github/workflows/copilot-setup-steps.yml +++ b/.github/workflows/copilot-setup-steps.yml @@ -24,7 +24,7 @@ jobs: # Install GitHub CLI and gh-aw extension for Copilot Agent interaction - name: Install gh-aw extension - uses: github/gh-aw/actions/setup-cli@19ac811a4a85389c33b15128e1d7b7d4507f814a # v0.71.5 + uses: github/gh-aw/actions/setup-cli@4d44d0e89851a877f4ddc0cb6c0197e42b1016c5 # v0.73.0 with: version: v0.68.3 diff --git a/.lastmerge b/.lastmerge index b28867a960..bc05f25edc 100644 --- a/.lastmerge +++ b/.lastmerge @@ -1 +1 @@ -4a0437bb03a0b60a1867f14ae8e3faf053afa5aa +81bb92b65ae418f769e696fdbba4cfb49165e709 diff --git a/pom.xml b/pom.xml index 4e3273cf41..41b71f4486 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-1 diff --git a/scripts/codegen/package-lock.json b/scripts/codegen/package-lock.json index 0846fc42e6..be4782edc6 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-1", "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..fddfb01db0 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-1", "json-schema": "^0.4.0", "tsx": "^4.20.6" } 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); + } +} diff --git a/src/main/java/com/github/copilot/sdk/json/InputOptions.java b/src/main/java/com/github/copilot/sdk/json/InputOptions.java index 9b0b6c8dd8..43b29c53b9 100644 --- a/src/main/java/com/github/copilot/sdk/json/InputOptions.java +++ b/src/main/java/com/github/copilot/sdk/json/InputOptions.java @@ -4,12 +4,15 @@ package com.github.copilot.sdk.json; +import com.fasterxml.jackson.annotation.JsonInclude; + /** * Options for the {@link SessionUiApi#input(String, InputOptions)} convenience * method. * * @since 1.0.0 */ +@JsonInclude(JsonInclude.Include.NON_NULL) public class InputOptions { private String title; diff --git a/src/main/java/com/github/copilot/sdk/json/SessionUiCapabilities.java b/src/main/java/com/github/copilot/sdk/json/SessionUiCapabilities.java index 9b8e0b5872..8df70c0502 100644 --- a/src/main/java/com/github/copilot/sdk/json/SessionUiCapabilities.java +++ b/src/main/java/com/github/copilot/sdk/json/SessionUiCapabilities.java @@ -4,11 +4,14 @@ package com.github.copilot.sdk.json; +import com.fasterxml.jackson.annotation.JsonInclude; + /** * UI-specific capability flags for a session. * * @since 1.0.0 */ +@JsonInclude(JsonInclude.Include.NON_NULL) public class SessionUiCapabilities { private Boolean elicitation; diff --git a/src/main/java/com/github/copilot/sdk/json/TelemetryConfig.java b/src/main/java/com/github/copilot/sdk/json/TelemetryConfig.java index 8407ab6098..d387128696 100644 --- a/src/main/java/com/github/copilot/sdk/json/TelemetryConfig.java +++ b/src/main/java/com/github/copilot/sdk/json/TelemetryConfig.java @@ -4,6 +4,8 @@ package com.github.copilot.sdk.json; +import com.fasterxml.jackson.annotation.JsonInclude; + /** * OpenTelemetry configuration for the Copilot CLI server. *

@@ -21,6 +23,7 @@ * @see CopilotClientOptions#setTelemetry(TelemetryConfig) * @since 1.2.0 */ +@JsonInclude(JsonInclude.Include.NON_NULL) public class TelemetryConfig { private String otlpEndpoint; diff --git a/src/main/java/com/github/copilot/sdk/json/UserInputRequest.java b/src/main/java/com/github/copilot/sdk/json/UserInputRequest.java index 9b466f866c..85e0b26bdc 100644 --- a/src/main/java/com/github/copilot/sdk/json/UserInputRequest.java +++ b/src/main/java/com/github/copilot/sdk/json/UserInputRequest.java @@ -8,6 +8,7 @@ import java.util.List; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; /** @@ -19,6 +20,7 @@ * @since 1.0.6 */ @JsonIgnoreProperties(ignoreUnknown = true) +@JsonInclude(JsonInclude.Include.NON_NULL) public class UserInputRequest { @JsonProperty("question") diff --git a/src/test/java/com/github/copilot/sdk/JsonIncludeNonNullTest.java b/src/test/java/com/github/copilot/sdk/JsonIncludeNonNullTest.java new file mode 100644 index 0000000000..7465507f50 --- /dev/null +++ b/src/test/java/com/github/copilot/sdk/JsonIncludeNonNullTest.java @@ -0,0 +1,159 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +package com.github.copilot.sdk; + +import static org.junit.jupiter.api.Assertions.*; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +import org.junit.jupiter.api.Test; + +import com.github.copilot.sdk.json.CopilotClientOptions; +import com.github.copilot.sdk.json.CustomAgentConfig; +import com.github.copilot.sdk.json.InfiniteSessionConfig; +import com.github.copilot.sdk.json.InputOptions; +import com.github.copilot.sdk.json.ModelCapabilitiesOverride; +import com.github.copilot.sdk.json.ProviderConfig; +import com.github.copilot.sdk.json.ResumeSessionConfig; +import com.github.copilot.sdk.json.SessionConfig; +import com.github.copilot.sdk.json.SessionUiCapabilities; +import com.github.copilot.sdk.json.TelemetryConfig; +import com.github.copilot.sdk.json.UserInputRequest; + +/** + * Verifies that public DTO classes in the {@code com.github.copilot.sdk.json} + * package are annotated with {@code @JsonInclude(JsonInclude.Include.NON_NULL)} + * so that null-valued fields are omitted during JSON serialization. + */ +class JsonIncludeNonNullTest { + + private static final ObjectMapper MAPPER = new ObjectMapper(); + + // --- Annotation presence checks --- + + @Test + void copilotClientOptionsHasNonNullAnnotation() { + assertHasNonNullInclude(CopilotClientOptions.class); + } + + @Test + void sessionConfigHasNonNullAnnotation() { + assertHasNonNullInclude(SessionConfig.class); + } + + @Test + void resumeSessionConfigHasNonNullAnnotation() { + assertHasNonNullInclude(ResumeSessionConfig.class); + } + + @Test + void infiniteSessionConfigHasNonNullAnnotation() { + assertHasNonNullInclude(InfiniteSessionConfig.class); + } + + @Test + void inputOptionsHasNonNullAnnotation() { + assertHasNonNullInclude(InputOptions.class); + } + + @Test + void modelCapabilitiesOverrideHasNonNullAnnotation() { + assertHasNonNullInclude(ModelCapabilitiesOverride.class); + } + + @Test + void providerConfigHasNonNullAnnotation() { + assertHasNonNullInclude(ProviderConfig.class); + } + + @Test + void telemetryConfigHasNonNullAnnotation() { + assertHasNonNullInclude(TelemetryConfig.class); + } + + @Test + void sessionUiCapabilitiesHasNonNullAnnotation() { + assertHasNonNullInclude(SessionUiCapabilities.class); + } + + @Test + void customAgentConfigHasNonNullAnnotation() { + assertHasNonNullInclude(CustomAgentConfig.class); + } + + @Test + void userInputRequestHasNonNullAnnotation() { + assertHasNonNullInclude(UserInputRequest.class); + } + + // --- Serialization tests: null fields are omitted --- + + @Test + void inputOptionsOmitsNullFieldsInJson() throws JsonProcessingException { + var opts = new InputOptions(); + String json = MAPPER.writeValueAsString(opts); + assertEquals("{}", json, "All-null InputOptions should serialize to empty JSON"); + } + + @Test + void telemetryConfigOmitsNullFieldsInJson() throws JsonProcessingException { + var config = new TelemetryConfig(); + String json = MAPPER.writeValueAsString(config); + assertEquals("{}", json, "All-null TelemetryConfig should serialize to empty JSON"); + } + + @Test + void sessionUiCapabilitiesOmitsNullFieldsInJson() throws JsonProcessingException { + var caps = new SessionUiCapabilities(); + String json = MAPPER.writeValueAsString(caps); + assertEquals("{}", json, "All-null SessionUiCapabilities should serialize to empty JSON"); + } + + @Test + void userInputRequestOmitsNullFieldsInJson() throws JsonProcessingException { + var req = new UserInputRequest(); + String json = MAPPER.writeValueAsString(req); + assertFalse(json.contains("null"), "UserInputRequest with no fields set should not contain 'null' values"); + } + + @Test + void inputOptionsIncludesSetFieldsInJson() throws JsonProcessingException { + var opts = new InputOptions(); + opts.setMinLength(5); + opts.setMaxLength(100); + String json = MAPPER.writeValueAsString(opts); + assertTrue(json.contains("\"minLength\":5"), "Set minLength should appear in JSON"); + assertTrue(json.contains("\"maxLength\":100"), "Set maxLength should appear in JSON"); + assertFalse(json.contains("\"title\""), "Unset title should be omitted from JSON"); + } + + @Test + void telemetryConfigIncludesSetFieldsInJson() throws JsonProcessingException { + var config = new TelemetryConfig(); + config.setOtlpEndpoint("http://localhost:4318"); + String json = MAPPER.writeValueAsString(config); + assertTrue(json.contains("\"otlpEndpoint\":\"http://localhost:4318\""), + "Set otlpEndpoint should appear in JSON"); + assertFalse(json.contains("\"filePath\""), "Unset filePath should be omitted from JSON"); + } + + @Test + void sessionUiCapabilitiesIncludesSetFieldsInJson() throws JsonProcessingException { + var caps = new SessionUiCapabilities(); + caps.setElicitation(true); + String json = MAPPER.writeValueAsString(caps); + assertTrue(json.contains("\"elicitation\":true"), "Set elicitation should appear in JSON"); + } + + private void assertHasNonNullInclude(Class clazz) { + JsonInclude annotation = clazz.getAnnotation(JsonInclude.class); + assertNotNull(annotation, clazz.getSimpleName() + " should be annotated with @JsonInclude"); + assertEquals(JsonInclude.Include.NON_NULL, annotation.value(), + clazz.getSimpleName() + " @JsonInclude should use Include.NON_NULL"); + } + +}