diff --git a/.lastmerge b/.lastmerge index 473fef56d..97be84d7e 100644 --- a/.lastmerge +++ b/.lastmerge @@ -1 +1 @@ -f4d22d70016c377881d86e4c77f8a3f93746ffae +60104052cd914949ddf8c7a31e1856cd6db0a57c diff --git a/pom.xml b/pom.xml index b8ba9ef0e..a318842bc 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ com.github copilot-sdk-java - 1.0.0-beta-java.5-SNAPSHOT + 1.0.0-beta-8-java.0-SNAPSHOT jar GitHub Copilot SDK :: Java @@ -94,7 +94,7 @@ reference-impl-sync workflow and deal with the subsequent PR. --> - ^1.0.52-1 + ^1.0.55-5 diff --git a/scripts/codegen/package-lock.json b/scripts/codegen/package-lock.json index 436d4f19a..a0c6c648f 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.52-1", + "@github/copilot": "^1.0.55-5", "json-schema": "^0.4.0", "tsx": "^4.20.6" } @@ -428,9 +428,9 @@ } }, "node_modules/@github/copilot": { - "version": "1.0.52-1", - "resolved": "https://registry.npmjs.org/@github/copilot/-/copilot-1.0.52-1.tgz", - "integrity": "sha512-oz6m/dOpTU+FaCWXqYZj5JkJmRT+/RYcrmtGal39V+gOxTA2Nc9wIeLH1SMwMoOXC9Q6DN6keiY0wqWcHirPVg==", + "version": "1.0.55-5", + "resolved": "https://registry.npmjs.org/@github/copilot/-/copilot-1.0.55-5.tgz", + "integrity": "sha512-n6Vr876Iz41PW8pSpOa7SbrNCqaV+6HDLNf/n8V4gIwwlOlIz7Jb00r/fboXZFIT+0dyAGGLoGgd7xUujVL/Xw==", "license": "SEE LICENSE IN LICENSE.md", "dependencies": { "detect-libc": "^2.1.2" @@ -439,20 +439,20 @@ "copilot": "npm-loader.js" }, "optionalDependencies": { - "@github/copilot-darwin-arm64": "1.0.52-1", - "@github/copilot-darwin-x64": "1.0.52-1", - "@github/copilot-linux-arm64": "1.0.52-1", - "@github/copilot-linux-x64": "1.0.52-1", - "@github/copilot-linuxmusl-arm64": "1.0.52-1", - "@github/copilot-linuxmusl-x64": "1.0.52-1", - "@github/copilot-win32-arm64": "1.0.52-1", - "@github/copilot-win32-x64": "1.0.52-1" + "@github/copilot-darwin-arm64": "1.0.55-5", + "@github/copilot-darwin-x64": "1.0.55-5", + "@github/copilot-linux-arm64": "1.0.55-5", + "@github/copilot-linux-x64": "1.0.55-5", + "@github/copilot-linuxmusl-arm64": "1.0.55-5", + "@github/copilot-linuxmusl-x64": "1.0.55-5", + "@github/copilot-win32-arm64": "1.0.55-5", + "@github/copilot-win32-x64": "1.0.55-5" } }, "node_modules/@github/copilot-darwin-arm64": { - "version": "1.0.52-1", - "resolved": "https://registry.npmjs.org/@github/copilot-darwin-arm64/-/copilot-darwin-arm64-1.0.52-1.tgz", - "integrity": "sha512-DWXtC/yItZVtkSQhPyRMEkFwa2mcY2rg2cu/uwJ15L9ReiYvlKYEZQDe1TMqkT+U6+k9KjA2L2HQfXVm14/vTw==", + "version": "1.0.55-5", + "resolved": "https://registry.npmjs.org/@github/copilot-darwin-arm64/-/copilot-darwin-arm64-1.0.55-5.tgz", + "integrity": "sha512-Mult62GJVnxR3MOP2QNiVU5RRGXPJ+7BpjEMIvkoaMuWX6J7F4bz7N+HUXVHJUiGUp3hnL3M16kjkewWfNdoNg==", "cpu": [ "arm64" ], @@ -466,9 +466,9 @@ } }, "node_modules/@github/copilot-darwin-x64": { - "version": "1.0.52-1", - "resolved": "https://registry.npmjs.org/@github/copilot-darwin-x64/-/copilot-darwin-x64-1.0.52-1.tgz", - "integrity": "sha512-NFTJkzzlTALMfbj9CDJ7N09PRPTVFq1+71hk+zoNx1uT/pi954liV6tKSaNAihPIXTMQKfJXGwEdjtvACpc8Vg==", + "version": "1.0.55-5", + "resolved": "https://registry.npmjs.org/@github/copilot-darwin-x64/-/copilot-darwin-x64-1.0.55-5.tgz", + "integrity": "sha512-IfY3WhNvHwXHldI2ARsiAYuPlKWlI07Fo1ALq+SViHhn0Zfp2yIr9laJRofyj0G1EbyUxkbNlqQm7UrXhkEVeg==", "cpu": [ "x64" ], @@ -482,9 +482,9 @@ } }, "node_modules/@github/copilot-linux-arm64": { - "version": "1.0.52-1", - "resolved": "https://registry.npmjs.org/@github/copilot-linux-arm64/-/copilot-linux-arm64-1.0.52-1.tgz", - "integrity": "sha512-CZE29v+RPJClHgVE1rU+RpRWSG8lm48koRZ0taKVopqLRD6NWKjBOwFKYJojk08H8/K+BWr/paM5+R8hEZHxZw==", + "version": "1.0.55-5", + "resolved": "https://registry.npmjs.org/@github/copilot-linux-arm64/-/copilot-linux-arm64-1.0.55-5.tgz", + "integrity": "sha512-UPZ5Y5QotcZvo3f4yFwJVOtAgUT3mq+q2fim82kWa/MA0+EkkADZ3kb+R4OnV1Nqv5EaoZiCFh0Ukk++IMSYwQ==", "cpu": [ "arm64" ], @@ -498,9 +498,9 @@ } }, "node_modules/@github/copilot-linux-x64": { - "version": "1.0.52-1", - "resolved": "https://registry.npmjs.org/@github/copilot-linux-x64/-/copilot-linux-x64-1.0.52-1.tgz", - "integrity": "sha512-tJhLQV70TJLq3hPXg7P6pHPfE4vaT2nENIXZsHu6fBkOcsSAxX1APSv6Bkyfsiod8EfFHkcG2+n7VXiVg8WqFw==", + "version": "1.0.55-5", + "resolved": "https://registry.npmjs.org/@github/copilot-linux-x64/-/copilot-linux-x64-1.0.55-5.tgz", + "integrity": "sha512-Fdwiir53Ogg8C9xv6sTc7/C4vFfQHt6VWFB74kojbDgIbYEpm57wNygQVwJvrwtVW3w/b1MLtGGTp7pEvUBACQ==", "cpu": [ "x64" ], @@ -514,9 +514,9 @@ } }, "node_modules/@github/copilot-linuxmusl-arm64": { - "version": "1.0.52-1", - "resolved": "https://registry.npmjs.org/@github/copilot-linuxmusl-arm64/-/copilot-linuxmusl-arm64-1.0.52-1.tgz", - "integrity": "sha512-u24wHsUumldUEPWX/5z5IEuJvixiQEYF82N04P1g65dvOknq+89dpj+GND4Rh3Vr5u13drgj5AJqkJbWB8N+EQ==", + "version": "1.0.55-5", + "resolved": "https://registry.npmjs.org/@github/copilot-linuxmusl-arm64/-/copilot-linuxmusl-arm64-1.0.55-5.tgz", + "integrity": "sha512-NqPmeAA1+iI8Xd4wJUHNNCmVTmHCl+R3nqdXhEVQDLIau9ouGqGGay/91d2ZIgFXJn7J0UTAEdHbdBcfhbnhvg==", "cpu": [ "arm64" ], @@ -530,9 +530,9 @@ } }, "node_modules/@github/copilot-linuxmusl-x64": { - "version": "1.0.52-1", - "resolved": "https://registry.npmjs.org/@github/copilot-linuxmusl-x64/-/copilot-linuxmusl-x64-1.0.52-1.tgz", - "integrity": "sha512-wM22FxcHL8NlnesKKQPPvtk4ojqefN7irU5tQcX+IunpD1izVQl7AOXhZyHoQ21zQnN0De8EapxOUc+WnvlxpA==", + "version": "1.0.55-5", + "resolved": "https://registry.npmjs.org/@github/copilot-linuxmusl-x64/-/copilot-linuxmusl-x64-1.0.55-5.tgz", + "integrity": "sha512-bOB4vKw1R7Mekn8z34xpNViYUQ4LQAEFzpkyxhc0uOliFmfku/YcIgo42aMWFzf/Bi3iBazBNfCN+L2lz/Jc9A==", "cpu": [ "x64" ], @@ -546,9 +546,9 @@ } }, "node_modules/@github/copilot-win32-arm64": { - "version": "1.0.52-1", - "resolved": "https://registry.npmjs.org/@github/copilot-win32-arm64/-/copilot-win32-arm64-1.0.52-1.tgz", - "integrity": "sha512-ecvfl9N7DPSwpiT2ZNUSXR1ZrSKwpkByOU6VcNphh4RptPZ0iNfyRNLhFCwSfFz+FvB6z2LZi+F7jSzQ3SaT3w==", + "version": "1.0.55-5", + "resolved": "https://registry.npmjs.org/@github/copilot-win32-arm64/-/copilot-win32-arm64-1.0.55-5.tgz", + "integrity": "sha512-pR2KaiXUanjxolaWgRPlFdeTEpb7jcN1Rk8xVnBCD2ORwERXdYrqXaLCyDbgdplI9mI6IjM+kkUbyXzXoWz/HQ==", "cpu": [ "arm64" ], @@ -562,9 +562,9 @@ } }, "node_modules/@github/copilot-win32-x64": { - "version": "1.0.52-1", - "resolved": "https://registry.npmjs.org/@github/copilot-win32-x64/-/copilot-win32-x64-1.0.52-1.tgz", - "integrity": "sha512-a9Ct7krktP+/pfPdh/K57deYzzmL13e5Tb1pf5E152u4o/5xKzfgroNFUOzotFfFhs1jFhdzKCm3WHNLIvVEHA==", + "version": "1.0.55-5", + "resolved": "https://registry.npmjs.org/@github/copilot-win32-x64/-/copilot-win32-x64-1.0.55-5.tgz", + "integrity": "sha512-EuQBgqSnRFjavgeFifbnSYUJ4elTQBLC/kf+WHolrHR2oUGyiqCQZz/cV2DYVSLP1TGxDKAV4AQCM1AdUT1xEA==", "cpu": [ "x64" ], diff --git a/scripts/codegen/package.json b/scripts/codegen/package.json index 672b42d65..6664dd8f2 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.52-1", + "@github/copilot": "^1.0.55-5", "json-schema": "^0.4.0", "tsx": "^4.20.6" } diff --git a/src/generated/java/com/github/copilot/generated/AssistantMessageEvent.java b/src/generated/java/com/github/copilot/generated/AssistantMessageEvent.java index 74d531008..de966758c 100644 --- a/src/generated/java/com/github/copilot/generated/AssistantMessageEvent.java +++ b/src/generated/java/com/github/copilot/generated/AssistantMessageEvent.java @@ -58,6 +58,8 @@ public record AssistantMessageEventData( @JsonProperty("interactionId") String interactionId, /** GitHub request tracing ID (x-github-request-id header) for correlating with server-side logs */ @JsonProperty("requestId") String requestId, + /** Copilot service request ID (x-copilot-service-request-id header) for CAPI log correlation */ + @JsonProperty("serviceRequestId") String serviceRequestId, /** Raw Anthropic content array with advisor blocks (server_tool_use, advisor_tool_result) for verbatim round-tripping */ @JsonProperty("anthropicAdvisorBlocks") List anthropicAdvisorBlocks, /** Anthropic advisor model ID used for this response, for timeline display on replay */ diff --git a/src/generated/java/com/github/copilot/generated/AssistantUsageEvent.java b/src/generated/java/com/github/copilot/generated/AssistantUsageEvent.java index 24b74c54f..2c19c150b 100644 --- a/src/generated/java/com/github/copilot/generated/AssistantUsageEvent.java +++ b/src/generated/java/com/github/copilot/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, + /** Copilot service request ID (x-copilot-service-request-id header) for CAPI log correlation */ + @JsonProperty("serviceRequestId") String serviceRequestId, /** 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 */ diff --git a/src/generated/java/com/github/copilot/generated/AutopilotObjectiveChangedOperation.java b/src/generated/java/com/github/copilot/generated/AutopilotObjectiveChangedOperation.java new file mode 100644 index 000000000..9a6211d49 --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/AutopilotObjectiveChangedOperation.java @@ -0,0 +1,37 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.generated; + +import javax.annotation.processing.Generated; + +/** + * The type of operation performed on the autopilot objective state file + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum AutopilotObjectiveChangedOperation { + /** The {@code create} variant. */ + CREATE("create"), + /** The {@code update} variant. */ + UPDATE("update"), + /** The {@code delete} variant. */ + DELETE("delete"); + + private final String value; + AutopilotObjectiveChangedOperation(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static AutopilotObjectiveChangedOperation fromValue(String value) { + for (AutopilotObjectiveChangedOperation v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown AutopilotObjectiveChangedOperation value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/generated/AutopilotObjectiveChangedStatus.java b/src/generated/java/com/github/copilot/generated/AutopilotObjectiveChangedStatus.java new file mode 100644 index 000000000..c8b4187f7 --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/AutopilotObjectiveChangedStatus.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.generated; + +import javax.annotation.processing.Generated; + +/** + * Current autopilot objective status, if one exists + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum AutopilotObjectiveChangedStatus { + /** The {@code active} variant. */ + ACTIVE("active"), + /** The {@code paused} variant. */ + PAUSED("paused"), + /** The {@code cap_reached} variant. */ + CAP_REACHED("cap_reached"), + /** The {@code completed} variant. */ + COMPLETED("completed"); + + private final String value; + AutopilotObjectiveChangedStatus(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static AutopilotObjectiveChangedStatus fromValue(String value) { + for (AutopilotObjectiveChangedStatus v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown AutopilotObjectiveChangedStatus value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/generated/CanvasOpenedAvailability.java b/src/generated/java/com/github/copilot/generated/CanvasOpenedAvailability.java new file mode 100644 index 000000000..1e65c1a2d --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/CanvasOpenedAvailability.java @@ -0,0 +1,35 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.generated; + +import javax.annotation.processing.Generated; + +/** + * Runtime-controlled routing state for the instance. "ready" when the provider connection is live; "stale" when the provider has gone away and the instance is awaiting rebinding. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum CanvasOpenedAvailability { + /** The {@code ready} variant. */ + READY("ready"), + /** The {@code stale} variant. */ + STALE("stale"); + + private final String value; + CanvasOpenedAvailability(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static CanvasOpenedAvailability fromValue(String value) { + for (CanvasOpenedAvailability v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown CanvasOpenedAvailability value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/generated/CanvasRegistryChangedCanvas.java b/src/generated/java/com/github/copilot/generated/CanvasRegistryChangedCanvas.java new file mode 100644 index 000000000..17d1477c1 --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/CanvasRegistryChangedCanvas.java @@ -0,0 +1,41 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.generated; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; +import javax.annotation.processing.Generated; + +/** + * Schema for the `CanvasRegistryChangedCanvas` type. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record CanvasRegistryChangedCanvas( + /** Owning provider identifier */ + @JsonProperty("extensionId") String extensionId, + /** Owning extension display name, when available */ + @JsonProperty("extensionName") String extensionName, + /** Provider-local canvas identifier */ + @JsonProperty("canvasId") String canvasId, + /** Human-readable canvas name */ + @JsonProperty("displayName") String displayName, + /** Short, single-sentence description shown to the agent in canvas catalogs. */ + @JsonProperty("description") String description, + /** JSON Schema for canvas open input */ + @JsonProperty("inputSchema") Map inputSchema, + /** Actions the agent or host may invoke */ + @JsonProperty("actions") List actions +) { +} diff --git a/src/generated/java/com/github/copilot/generated/CanvasRegistryChangedCanvasAction.java b/src/generated/java/com/github/copilot/generated/CanvasRegistryChangedCanvasAction.java new file mode 100644 index 000000000..34e30d3f2 --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/CanvasRegistryChangedCanvasAction.java @@ -0,0 +1,32 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.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; + +/** + * Schema for the `CanvasRegistryChangedCanvasAction` type. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record CanvasRegistryChangedCanvasAction( + /** Action name */ + @JsonProperty("name") String name, + /** Action description */ + @JsonProperty("description") String description, + /** JSON Schema for action input */ + @JsonProperty("inputSchema") Map inputSchema +) { +} diff --git a/src/generated/java/com/github/copilot/generated/CapabilitiesChangedUI.java b/src/generated/java/com/github/copilot/generated/CapabilitiesChangedUI.java index 89c211f6c..83be6ad09 100644 --- a/src/generated/java/com/github/copilot/generated/CapabilitiesChangedUI.java +++ b/src/generated/java/com/github/copilot/generated/CapabilitiesChangedUI.java @@ -22,6 +22,10 @@ @JsonIgnoreProperties(ignoreUnknown = true) public record CapabilitiesChangedUI( /** Whether elicitation is now supported */ - @JsonProperty("elicitation") Boolean elicitation + @JsonProperty("elicitation") Boolean elicitation, + /** Whether MCP Apps (SEP-1865) UI passthrough is now supported */ + @JsonProperty("mcpApps") Boolean mcpApps, + /** Whether canvas rendering is now supported */ + @JsonProperty("canvases") Boolean canvases ) { } diff --git a/src/generated/java/com/github/copilot/generated/ExternalToolRequestedEvent.java b/src/generated/java/com/github/copilot/generated/ExternalToolRequestedEvent.java index 1f5a3a205..39eacd44f 100644 --- a/src/generated/java/com/github/copilot/generated/ExternalToolRequestedEvent.java +++ b/src/generated/java/com/github/copilot/generated/ExternalToolRequestedEvent.java @@ -45,6 +45,8 @@ public record ExternalToolRequestedEventData( @JsonProperty("toolName") String toolName, /** Arguments to pass to the external tool */ @JsonProperty("arguments") Object arguments, + /** Active session working directory, when known. */ + @JsonProperty("workingDirectory") String workingDirectory, /** W3C Trace Context traceparent header for the execute_tool span */ @JsonProperty("traceparent") String traceparent, /** W3C Trace Context tracestate header for the execute_tool span */ diff --git a/src/generated/java/com/github/copilot/generated/HookProgressEvent.java b/src/generated/java/com/github/copilot/generated/HookProgressEvent.java new file mode 100644 index 000000000..4ea3bd2ea --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/HookProgressEvent.java @@ -0,0 +1,42 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.generated; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Session event "hook.progress". Ephemeral progress update from a running hook process + * + * @since 1.0.0 + */ +@JsonIgnoreProperties(ignoreUnknown = true) +@JsonInclude(JsonInclude.Include.NON_NULL) +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public final class HookProgressEvent extends SessionEvent { + + @Override + public String getType() { return "hook.progress"; } + + @JsonProperty("data") + private HookProgressEventData data; + + public HookProgressEventData getData() { return data; } + public void setData(HookProgressEventData data) { this.data = data; } + + /** Data payload for {@link HookProgressEvent}. */ + @JsonIgnoreProperties(ignoreUnknown = true) + @JsonInclude(JsonInclude.Include.NON_NULL) + public record HookProgressEventData( + /** Human-readable progress message from the hook process */ + @JsonProperty("message") String message + ) { + } +} diff --git a/src/generated/java/com/github/copilot/generated/McpAppToolCallCompleteError.java b/src/generated/java/com/github/copilot/generated/McpAppToolCallCompleteError.java new file mode 100644 index 000000000..d718d3377 --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/McpAppToolCallCompleteError.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.generated; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Set when the underlying tools/call threw an error before returning a CallToolResult + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record McpAppToolCallCompleteError( + /** Human-readable error message */ + @JsonProperty("message") String message +) { +} diff --git a/src/generated/java/com/github/copilot/generated/McpAppToolCallCompleteEvent.java b/src/generated/java/com/github/copilot/generated/McpAppToolCallCompleteEvent.java new file mode 100644 index 000000000..ea4f517c4 --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/McpAppToolCallCompleteEvent.java @@ -0,0 +1,57 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.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; + +/** + * Session event "mcp_app.tool_call_complete". MCP App view called a tool on a connected MCP server (SEP-1865) + * + * @since 1.0.0 + */ +@JsonIgnoreProperties(ignoreUnknown = true) +@JsonInclude(JsonInclude.Include.NON_NULL) +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public final class McpAppToolCallCompleteEvent extends SessionEvent { + + @Override + public String getType() { return "mcp_app.tool_call_complete"; } + + @JsonProperty("data") + private McpAppToolCallCompleteEventData data; + + public McpAppToolCallCompleteEventData getData() { return data; } + public void setData(McpAppToolCallCompleteEventData data) { this.data = data; } + + /** Data payload for {@link McpAppToolCallCompleteEvent}. */ + @JsonIgnoreProperties(ignoreUnknown = true) + @JsonInclude(JsonInclude.Include.NON_NULL) + public record McpAppToolCallCompleteEventData( + /** Name of the MCP server hosting the tool */ + @JsonProperty("serverName") String serverName, + /** MCP tool name that was invoked */ + @JsonProperty("toolName") String toolName, + /** Arguments passed to the tool by the app view, if any */ + @JsonProperty("arguments") Map arguments, + /** True when the call completed without throwing AND the MCP CallToolResult did not set isError */ + @JsonProperty("success") Boolean success, + /** Wall-clock duration of the underlying tools/call in milliseconds */ + @JsonProperty("durationMs") Double durationMs, + /** Standard MCP CallToolResult returned by the server. Present whether or not the call set isError. */ + @JsonProperty("result") Map result, + /** Set when the underlying tools/call threw an error before returning a CallToolResult */ + @JsonProperty("error") McpAppToolCallCompleteError error, + /** The tool's `_meta.ui` block at the time of the call, so consumers can decide whether to forward the result to the model without re-listing tools. */ + @JsonProperty("toolMeta") McpAppToolCallCompleteToolMeta toolMeta + ) { + } +} diff --git a/src/generated/java/com/github/copilot/generated/McpAppToolCallCompleteToolMeta.java b/src/generated/java/com/github/copilot/generated/McpAppToolCallCompleteToolMeta.java new file mode 100644 index 000000000..33b9a3725 --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/McpAppToolCallCompleteToolMeta.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.generated; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * The tool's `_meta.ui` block at the time of the call, so consumers can decide whether to forward the result to the model without re-listing tools. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record McpAppToolCallCompleteToolMeta( + /** Schema for the `McpAppToolCallCompleteToolMetaUI` type. */ + @JsonProperty("ui") McpAppToolCallCompleteToolMetaUI ui +) { +} diff --git a/src/generated/java/com/github/copilot/generated/McpAppToolCallCompleteToolMetaUI.java b/src/generated/java/com/github/copilot/generated/McpAppToolCallCompleteToolMetaUI.java new file mode 100644 index 000000000..eb960434a --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/McpAppToolCallCompleteToolMetaUI.java @@ -0,0 +1,30 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.generated; + +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; + +/** + * Schema for the `McpAppToolCallCompleteToolMetaUI` type. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record McpAppToolCallCompleteToolMetaUI( + /** `ui://` URI declared by the tool's `_meta.ui.resourceUri` */ + @JsonProperty("resourceUri") String resourceUri, + /** Tool visibility per SEP-1865 (typically a subset of `["model","app"]`) */ + @JsonProperty("visibility") List visibility +) { +} diff --git a/src/generated/java/com/github/copilot/generated/McpServerTransport.java b/src/generated/java/com/github/copilot/generated/McpServerTransport.java new file mode 100644 index 000000000..21211c4e2 --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/McpServerTransport.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.generated; + +import javax.annotation.processing.Generated; + +/** + * Transport mechanism: stdio, http, sse (deprecated), or memory (in-process MCP server) + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum McpServerTransport { + /** The {@code stdio} variant. */ + STDIO("stdio"), + /** The {@code http} variant. */ + HTTP("http"), + /** The {@code sse} variant. */ + SSE("sse"), + /** The {@code memory} variant. */ + MEMORY("memory"); + + private final String value; + McpServerTransport(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static McpServerTransport fromValue(String value) { + for (McpServerTransport v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown McpServerTransport value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/generated/McpServersLoadedServer.java b/src/generated/java/com/github/copilot/generated/McpServersLoadedServer.java index aba91bdef..9c5d52081 100644 --- a/src/generated/java/com/github/copilot/generated/McpServersLoadedServer.java +++ b/src/generated/java/com/github/copilot/generated/McpServersLoadedServer.java @@ -28,6 +28,12 @@ public record McpServersLoadedServer( /** Configuration source: user, workspace, plugin, or builtin */ @JsonProperty("source") McpServerSource source, /** Error message if the server failed to connect */ - @JsonProperty("error") String error + @JsonProperty("error") String error, + /** Transport mechanism: stdio, http, sse (deprecated), or memory (in-process MCP server) */ + @JsonProperty("transport") McpServerTransport transport, + /** Name of the plugin that supplied the effective MCP server config, only when source is plugin */ + @JsonProperty("pluginName") String pluginName, + /** Version of the plugin that supplied the effective MCP server config, only when source is plugin */ + @JsonProperty("pluginVersion") String pluginVersion ) { } diff --git a/src/generated/java/com/github/copilot/generated/ModelCallFailureEvent.java b/src/generated/java/com/github/copilot/generated/ModelCallFailureEvent.java index e4df71384..8a516065b 100644 --- a/src/generated/java/com/github/copilot/generated/ModelCallFailureEvent.java +++ b/src/generated/java/com/github/copilot/generated/ModelCallFailureEvent.java @@ -43,6 +43,8 @@ public record ModelCallFailureEventData( @JsonProperty("apiCallId") String apiCallId, /** GitHub request tracing ID (x-github-request-id header) for server-side log correlation */ @JsonProperty("providerCallId") String providerCallId, + /** Copilot service request ID (x-copilot-service-request-id header) for CAPI log correlation */ + @JsonProperty("serviceRequestId") String serviceRequestId, /** HTTP status code from the failed request */ @JsonProperty("statusCode") Long statusCode, /** Duration of the failed API call in milliseconds */ diff --git a/src/generated/java/com/github/copilot/generated/SessionAutopilotObjectiveChangedEvent.java b/src/generated/java/com/github/copilot/generated/SessionAutopilotObjectiveChangedEvent.java new file mode 100644 index 000000000..62f49184c --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/SessionAutopilotObjectiveChangedEvent.java @@ -0,0 +1,46 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.generated; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Session event "session.autopilot_objective_changed". Autopilot objective state file operation details indicating what changed + * + * @since 1.0.0 + */ +@JsonIgnoreProperties(ignoreUnknown = true) +@JsonInclude(JsonInclude.Include.NON_NULL) +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public final class SessionAutopilotObjectiveChangedEvent extends SessionEvent { + + @Override + public String getType() { return "session.autopilot_objective_changed"; } + + @JsonProperty("data") + private SessionAutopilotObjectiveChangedEventData data; + + public SessionAutopilotObjectiveChangedEventData getData() { return data; } + public void setData(SessionAutopilotObjectiveChangedEventData data) { this.data = data; } + + /** Data payload for {@link SessionAutopilotObjectiveChangedEvent}. */ + @JsonIgnoreProperties(ignoreUnknown = true) + @JsonInclude(JsonInclude.Include.NON_NULL) + public record SessionAutopilotObjectiveChangedEventData( + /** The type of operation performed on the autopilot objective state file */ + @JsonProperty("operation") AutopilotObjectiveChangedOperation operation, + /** Current autopilot objective id, if one exists */ + @JsonProperty("id") Long id, + /** Current autopilot objective status, if one exists */ + @JsonProperty("status") AutopilotObjectiveChangedStatus status + ) { + } +} diff --git a/src/generated/java/com/github/copilot/generated/SessionCanvasOpenedEvent.java b/src/generated/java/com/github/copilot/generated/SessionCanvasOpenedEvent.java new file mode 100644 index 000000000..ea32bd479 --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/SessionCanvasOpenedEvent.java @@ -0,0 +1,60 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.generated; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Session event "session.canvas.opened". + * + * @since 1.0.0 + */ +@JsonIgnoreProperties(ignoreUnknown = true) +@JsonInclude(JsonInclude.Include.NON_NULL) +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public final class SessionCanvasOpenedEvent extends SessionEvent { + + @Override + public String getType() { return "session.canvas.opened"; } + + @JsonProperty("data") + private SessionCanvasOpenedEventData data; + + public SessionCanvasOpenedEventData getData() { return data; } + public void setData(SessionCanvasOpenedEventData data) { this.data = data; } + + /** Data payload for {@link SessionCanvasOpenedEvent}. */ + @JsonIgnoreProperties(ignoreUnknown = true) + @JsonInclude(JsonInclude.Include.NON_NULL) + public record SessionCanvasOpenedEventData( + /** Stable caller-supplied canvas instance identifier */ + @JsonProperty("instanceId") String instanceId, + /** Owning provider identifier */ + @JsonProperty("extensionId") String extensionId, + /** Owning extension display name, when available */ + @JsonProperty("extensionName") String extensionName, + /** Provider-local canvas identifier */ + @JsonProperty("canvasId") String canvasId, + /** Rendered title */ + @JsonProperty("title") String title, + /** Provider-supplied status text */ + @JsonProperty("status") String status, + /** URL for web-rendered canvases */ + @JsonProperty("url") String url, + /** Input supplied when the instance was opened */ + @JsonProperty("input") Object input, + /** Whether this notification represents an idempotent reopen */ + @JsonProperty("reopen") Boolean reopen, + /** Runtime-controlled routing state for the instance. "ready" when the provider connection is live; "stale" when the provider has gone away and the instance is awaiting rebinding. */ + @JsonProperty("availability") CanvasOpenedAvailability availability + ) { + } +} diff --git a/src/generated/java/com/github/copilot/generated/SessionCanvasRegistryChangedEvent.java b/src/generated/java/com/github/copilot/generated/SessionCanvasRegistryChangedEvent.java new file mode 100644 index 000000000..4fb2a034b --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/SessionCanvasRegistryChangedEvent.java @@ -0,0 +1,43 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.generated; + +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; + +/** + * Session event "session.canvas.registry_changed". + * + * @since 1.0.0 + */ +@JsonIgnoreProperties(ignoreUnknown = true) +@JsonInclude(JsonInclude.Include.NON_NULL) +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public final class SessionCanvasRegistryChangedEvent extends SessionEvent { + + @Override + public String getType() { return "session.canvas.registry_changed"; } + + @JsonProperty("data") + private SessionCanvasRegistryChangedEventData data; + + public SessionCanvasRegistryChangedEventData getData() { return data; } + public void setData(SessionCanvasRegistryChangedEventData data) { this.data = data; } + + /** Data payload for {@link SessionCanvasRegistryChangedEvent}. */ + @JsonIgnoreProperties(ignoreUnknown = true) + @JsonInclude(JsonInclude.Include.NON_NULL) + public record SessionCanvasRegistryChangedEventData( + /** Canvas declarations currently available */ + @JsonProperty("canvases") List canvases + ) { + } +} diff --git a/src/generated/java/com/github/copilot/generated/SessionCompactionCompleteEvent.java b/src/generated/java/com/github/copilot/generated/SessionCompactionCompleteEvent.java index a1e418d9c..d64979195 100644 --- a/src/generated/java/com/github/copilot/generated/SessionCompactionCompleteEvent.java +++ b/src/generated/java/com/github/copilot/generated/SessionCompactionCompleteEvent.java @@ -61,6 +61,8 @@ public record SessionCompactionCompleteEventData( @JsonProperty("compactionTokensUsed") CompactionCompleteCompactionTokensUsed compactionTokensUsed, /** GitHub request tracing ID (x-github-request-id header) for the compaction LLM call */ @JsonProperty("requestId") String requestId, + /** Copilot service request ID (x-copilot-service-request-id header) for the compaction LLM call */ + @JsonProperty("serviceRequestId") String serviceRequestId, /** Token count from system message(s) after compaction */ @JsonProperty("systemTokens") Long systemTokens, /** Token count from non-system messages (user, assistant, tool) after compaction */ diff --git a/src/generated/java/com/github/copilot/generated/SessionErrorEvent.java b/src/generated/java/com/github/copilot/generated/SessionErrorEvent.java index c644adcef..12fa20ac1 100644 --- a/src/generated/java/com/github/copilot/generated/SessionErrorEvent.java +++ b/src/generated/java/com/github/copilot/generated/SessionErrorEvent.java @@ -49,6 +49,8 @@ public record SessionErrorEventData( @JsonProperty("statusCode") Long statusCode, /** GitHub request tracing ID (x-github-request-id header) for correlating with server-side logs */ @JsonProperty("providerCallId") String providerCallId, + /** Copilot service request ID (x-copilot-service-request-id header) for CAPI log correlation */ + @JsonProperty("serviceRequestId") String serviceRequestId, /** Optional URL associated with this error that the user can open in a browser */ @JsonProperty("url") String url ) { diff --git a/src/generated/java/com/github/copilot/generated/SessionEvent.java b/src/generated/java/com/github/copilot/generated/SessionEvent.java index e27096264..570fe3a9e 100644 --- a/src/generated/java/com/github/copilot/generated/SessionEvent.java +++ b/src/generated/java/com/github/copilot/generated/SessionEvent.java @@ -33,10 +33,12 @@ @JsonSubTypes.Type(value = SessionTitleChangedEvent.class, name = "session.title_changed"), @JsonSubTypes.Type(value = SessionScheduleCreatedEvent.class, name = "session.schedule_created"), @JsonSubTypes.Type(value = SessionScheduleCancelledEvent.class, name = "session.schedule_cancelled"), + @JsonSubTypes.Type(value = SessionAutopilotObjectiveChangedEvent.class, name = "session.autopilot_objective_changed"), @JsonSubTypes.Type(value = SessionInfoEvent.class, name = "session.info"), @JsonSubTypes.Type(value = SessionWarningEvent.class, name = "session.warning"), @JsonSubTypes.Type(value = SessionModelChangeEvent.class, name = "session.model_change"), @JsonSubTypes.Type(value = SessionModeChangedEvent.class, name = "session.mode_changed"), + @JsonSubTypes.Type(value = SessionPermissionsChangedEvent.class, name = "session.permissions_changed"), @JsonSubTypes.Type(value = SessionPlanChangedEvent.class, name = "session.plan_changed"), @JsonSubTypes.Type(value = SessionWorkspaceFileChangedEvent.class, name = "session.workspace_file_changed"), @JsonSubTypes.Type(value = SessionHandoffEvent.class, name = "session.handoff"), @@ -75,6 +77,7 @@ @JsonSubTypes.Type(value = SubagentDeselectedEvent.class, name = "subagent.deselected"), @JsonSubTypes.Type(value = HookStartEvent.class, name = "hook.start"), @JsonSubTypes.Type(value = HookEndEvent.class, name = "hook.end"), + @JsonSubTypes.Type(value = HookProgressEvent.class, name = "hook.progress"), @JsonSubTypes.Type(value = SystemMessageEvent.class, name = "system.message"), @JsonSubTypes.Type(value = SystemNotificationEvent.class, name = "system.notification"), @JsonSubTypes.Type(value = PermissionRequestedEvent.class, name = "permission.requested"), @@ -105,7 +108,10 @@ @JsonSubTypes.Type(value = SessionCustomAgentsUpdatedEvent.class, name = "session.custom_agents_updated"), @JsonSubTypes.Type(value = SessionMcpServersLoadedEvent.class, name = "session.mcp_servers_loaded"), @JsonSubTypes.Type(value = SessionMcpServerStatusChangedEvent.class, name = "session.mcp_server_status_changed"), - @JsonSubTypes.Type(value = SessionExtensionsLoadedEvent.class, name = "session.extensions_loaded") + @JsonSubTypes.Type(value = SessionExtensionsLoadedEvent.class, name = "session.extensions_loaded"), + @JsonSubTypes.Type(value = SessionCanvasOpenedEvent.class, name = "session.canvas.opened"), + @JsonSubTypes.Type(value = SessionCanvasRegistryChangedEvent.class, name = "session.canvas.registry_changed"), + @JsonSubTypes.Type(value = McpAppToolCallCompleteEvent.class, name = "mcp_app.tool_call_complete") }) @javax.annotation.processing.Generated("copilot-sdk-codegen") public abstract sealed class SessionEvent permits @@ -117,10 +123,12 @@ public abstract sealed class SessionEvent permits SessionTitleChangedEvent, SessionScheduleCreatedEvent, SessionScheduleCancelledEvent, + SessionAutopilotObjectiveChangedEvent, SessionInfoEvent, SessionWarningEvent, SessionModelChangeEvent, SessionModeChangedEvent, + SessionPermissionsChangedEvent, SessionPlanChangedEvent, SessionWorkspaceFileChangedEvent, SessionHandoffEvent, @@ -159,6 +167,7 @@ public abstract sealed class SessionEvent permits SubagentDeselectedEvent, HookStartEvent, HookEndEvent, + HookProgressEvent, SystemMessageEvent, SystemNotificationEvent, PermissionRequestedEvent, @@ -190,6 +199,9 @@ public abstract sealed class SessionEvent permits SessionMcpServersLoadedEvent, SessionMcpServerStatusChangedEvent, SessionExtensionsLoadedEvent, + SessionCanvasOpenedEvent, + SessionCanvasRegistryChangedEvent, + McpAppToolCallCompleteEvent, UnknownSessionEvent { /** Unique event identifier (UUID v4), generated when the event is emitted. */ diff --git a/src/generated/java/com/github/copilot/generated/SessionMcpServerStatusChangedEvent.java b/src/generated/java/com/github/copilot/generated/SessionMcpServerStatusChangedEvent.java index 345e9ab2e..1567a2f35 100644 --- a/src/generated/java/com/github/copilot/generated/SessionMcpServerStatusChangedEvent.java +++ b/src/generated/java/com/github/copilot/generated/SessionMcpServerStatusChangedEvent.java @@ -38,7 +38,9 @@ public record SessionMcpServerStatusChangedEventData( /** Name of the MCP server whose status changed */ @JsonProperty("serverName") String serverName, /** Connection status: connected, failed, needs-auth, pending, disabled, or not_configured */ - @JsonProperty("status") McpServerStatus status + @JsonProperty("status") McpServerStatus status, + /** Error message if the server entered a failed state */ + @JsonProperty("error") String error ) { } } diff --git a/src/generated/java/com/github/copilot/generated/SessionModelChangeEvent.java b/src/generated/java/com/github/copilot/generated/SessionModelChangeEvent.java index 0c408e0b3..e0d8785b9 100644 --- a/src/generated/java/com/github/copilot/generated/SessionModelChangeEvent.java +++ b/src/generated/java/com/github/copilot/generated/SessionModelChangeEvent.java @@ -47,8 +47,29 @@ public record SessionModelChangeEventData( @JsonProperty("previousReasoningSummary") ReasoningSummary previousReasoningSummary, /** Reasoning summary mode after the model change, if applicable */ @JsonProperty("reasoningSummary") ReasoningSummary reasoningSummary, + /** Context tier after the model change; null explicitly clears a previously selected tier */ + @JsonProperty("contextTier") SessionModelChangeEventDataContextTier contextTier, /** Reason the change happened, when not user-initiated. Currently `"rate_limit_auto_switch"` for changes triggered by the auto-mode-switch rate-limit recovery path. UI clients can use this to render contextual copy. */ @JsonProperty("cause") String cause ) { + + public enum SessionModelChangeEventDataContextTier { + /** The {@code default} variant. */ + DEFAULT("default"), + /** The {@code long_context} variant. */ + LONG_CONTEXT("long_context"); + + private final String value; + SessionModelChangeEventDataContextTier(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static SessionModelChangeEventDataContextTier fromValue(String value) { + for (SessionModelChangeEventDataContextTier v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown SessionModelChangeEventDataContextTier value: " + value); + } + } } } diff --git a/src/generated/java/com/github/copilot/generated/SessionPermissionsChangedEvent.java b/src/generated/java/com/github/copilot/generated/SessionPermissionsChangedEvent.java new file mode 100644 index 000000000..91ac1d3c8 --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/SessionPermissionsChangedEvent.java @@ -0,0 +1,44 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.generated; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Session event "session.permissions_changed". Permissions change details carrying the aggregate allow-all boolean transition. + * + * @since 1.0.0 + */ +@JsonIgnoreProperties(ignoreUnknown = true) +@JsonInclude(JsonInclude.Include.NON_NULL) +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public final class SessionPermissionsChangedEvent extends SessionEvent { + + @Override + public String getType() { return "session.permissions_changed"; } + + @JsonProperty("data") + private SessionPermissionsChangedEventData data; + + public SessionPermissionsChangedEventData getData() { return data; } + public void setData(SessionPermissionsChangedEventData data) { this.data = data; } + + /** Data payload for {@link SessionPermissionsChangedEvent}. */ + @JsonIgnoreProperties(ignoreUnknown = true) + @JsonInclude(JsonInclude.Include.NON_NULL) + public record SessionPermissionsChangedEventData( + /** Aggregate allow-all flag before the change */ + @JsonProperty("previousAllowAllPermissions") Boolean previousAllowAllPermissions, + /** Aggregate allow-all flag after the change */ + @JsonProperty("allowAllPermissions") Boolean allowAllPermissions + ) { + } +} diff --git a/src/generated/java/com/github/copilot/generated/SkillInvokedEvent.java b/src/generated/java/com/github/copilot/generated/SkillInvokedEvent.java index 5be080a64..681ad3f0a 100644 --- a/src/generated/java/com/github/copilot/generated/SkillInvokedEvent.java +++ b/src/generated/java/com/github/copilot/generated/SkillInvokedEvent.java @@ -44,12 +44,16 @@ public record SkillInvokedEventData( @JsonProperty("content") String content, /** Tool names that should be auto-approved when this skill is active */ @JsonProperty("allowedTools") List allowedTools, + /** Source identifier for where the skill was discovered. Known values include: project (workspace skill), inherited (parent-directory skill), personal-copilot (~/.copilot/skills), personal-agents (~/.agents/skills), personal-claude (~/.claude/skills), custom (configured directory), plugin (installed plugin), builtin (bundled runtime skill), and remote (org/enterprise skill) */ + @JsonProperty("source") String source, /** Name of the plugin this skill originated from, when applicable */ @JsonProperty("pluginName") String pluginName, /** Version of the plugin this skill originated from, when applicable */ @JsonProperty("pluginVersion") String pluginVersion, /** Description of the skill from its SKILL.md frontmatter */ - @JsonProperty("description") String description + @JsonProperty("description") String description, + /** What triggered the skill invocation: `user-invoked` (explicit user action, such as via a slash command or UI affordance), `agent-invoked` (agent requested the skill), or `context-load` (loaded as part of another context, such as preloading skills configured on a custom agent or subagent) */ + @JsonProperty("trigger") SkillInvokedTrigger trigger ) { } } diff --git a/src/generated/java/com/github/copilot/generated/SkillInvokedTrigger.java b/src/generated/java/com/github/copilot/generated/SkillInvokedTrigger.java new file mode 100644 index 000000000..50ce54f7c --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/SkillInvokedTrigger.java @@ -0,0 +1,37 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.generated; + +import javax.annotation.processing.Generated; + +/** + * What triggered the skill invocation: `user-invoked` (explicit user action, such as via a slash command or UI affordance), `agent-invoked` (agent requested the skill), or `context-load` (loaded as part of another context, such as preloading skills configured on a custom agent or subagent) + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum SkillInvokedTrigger { + /** The {@code user-invoked} variant. */ + USER_INVOKED("user-invoked"), + /** The {@code agent-invoked} variant. */ + AGENT_INVOKED("agent-invoked"), + /** The {@code context-load} variant. */ + CONTEXT_LOAD("context-load"); + + private final String value; + SkillInvokedTrigger(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static SkillInvokedTrigger fromValue(String value) { + for (SkillInvokedTrigger v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown SkillInvokedTrigger value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/generated/ToolExecutionCompleteEvent.java b/src/generated/java/com/github/copilot/generated/ToolExecutionCompleteEvent.java index 36284b472..3cfa45189 100644 --- a/src/generated/java/com/github/copilot/generated/ToolExecutionCompleteEvent.java +++ b/src/generated/java/com/github/copilot/generated/ToolExecutionCompleteEvent.java @@ -54,6 +54,8 @@ public record ToolExecutionCompleteEventData( @JsonProperty("toolTelemetry") Map toolTelemetry, /** Identifier for the agent loop turn this tool was invoked in, matching the corresponding assistant.turn_start event */ @JsonProperty("turnId") String turnId, + /** Tool definition metadata, present for MCP tools with MCP Apps support */ + @JsonProperty("toolDescription") ToolExecutionCompleteToolDescription toolDescription, /** Whether this tool execution ran inside a sandbox container */ @JsonProperty("sandboxed") Boolean sandboxed, /** Tool call ID of the parent tool invocation when this event originates from a sub-agent */ diff --git a/src/generated/java/com/github/copilot/generated/ToolExecutionCompleteResult.java b/src/generated/java/com/github/copilot/generated/ToolExecutionCompleteResult.java index 4792ec8da..4ff3d2de0 100644 --- a/src/generated/java/com/github/copilot/generated/ToolExecutionCompleteResult.java +++ b/src/generated/java/com/github/copilot/generated/ToolExecutionCompleteResult.java @@ -27,6 +27,8 @@ public record ToolExecutionCompleteResult( /** Full detailed tool result for UI/timeline display, preserving complete content such as diffs. Falls back to content when absent. */ @JsonProperty("detailedContent") String detailedContent, /** Structured content blocks (text, images, audio, resources) returned by the tool in their native format */ - @JsonProperty("contents") List contents + @JsonProperty("contents") List contents, + /** MCP Apps UI resource content for rendering in a sandboxed iframe */ + @JsonProperty("uiResource") ToolExecutionCompleteUIResource uiResource ) { } diff --git a/src/generated/java/com/github/copilot/generated/ToolExecutionCompleteToolDescription.java b/src/generated/java/com/github/copilot/generated/ToolExecutionCompleteToolDescription.java new file mode 100644 index 000000000..53e614454 --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/ToolExecutionCompleteToolDescription.java @@ -0,0 +1,31 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.generated; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Tool definition metadata, present for MCP tools with MCP Apps support + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record ToolExecutionCompleteToolDescription( + /** Tool name */ + @JsonProperty("name") String name, + /** Tool description */ + @JsonProperty("description") String description, + /** MCP Apps metadata for UI resource association */ + @JsonProperty("_meta") ToolExecutionCompleteToolDescriptionMeta meta +) { +} diff --git a/src/generated/java/com/github/copilot/generated/ToolExecutionCompleteToolDescriptionMeta.java b/src/generated/java/com/github/copilot/generated/ToolExecutionCompleteToolDescriptionMeta.java new file mode 100644 index 000000000..563358cfa --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/ToolExecutionCompleteToolDescriptionMeta.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.generated; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * MCP Apps metadata for UI resource association + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record ToolExecutionCompleteToolDescriptionMeta( + /** Schema for the `ToolExecutionCompleteToolDescriptionMetaUI` type. */ + @JsonProperty("ui") ToolExecutionCompleteToolDescriptionMetaUI ui +) { +} diff --git a/src/generated/java/com/github/copilot/generated/ToolExecutionCompleteToolDescriptionMetaUI.java b/src/generated/java/com/github/copilot/generated/ToolExecutionCompleteToolDescriptionMetaUI.java new file mode 100644 index 000000000..9acf435bc --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/ToolExecutionCompleteToolDescriptionMetaUI.java @@ -0,0 +1,30 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.generated; + +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; + +/** + * Schema for the `ToolExecutionCompleteToolDescriptionMetaUI` type. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record ToolExecutionCompleteToolDescriptionMetaUI( + /** URI of the UI resource */ + @JsonProperty("resourceUri") String resourceUri, + /** Who can access this tool */ + @JsonProperty("visibility") List visibility +) { +} diff --git a/src/generated/java/com/github/copilot/generated/ToolExecutionCompleteToolDescriptionMetaUIVisibility.java b/src/generated/java/com/github/copilot/generated/ToolExecutionCompleteToolDescriptionMetaUIVisibility.java new file mode 100644 index 000000000..2510ddc0b --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/ToolExecutionCompleteToolDescriptionMetaUIVisibility.java @@ -0,0 +1,35 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.generated; + +import javax.annotation.processing.Generated; + +/** + * Allowed values for the `ToolExecutionCompleteToolDescriptionMetaUIVisibility` enumeration. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum ToolExecutionCompleteToolDescriptionMetaUIVisibility { + /** The {@code model} variant. */ + MODEL("model"), + /** The {@code app} variant. */ + APP("app"); + + private final String value; + ToolExecutionCompleteToolDescriptionMetaUIVisibility(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static ToolExecutionCompleteToolDescriptionMetaUIVisibility fromValue(String value) { + for (ToolExecutionCompleteToolDescriptionMetaUIVisibility v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown ToolExecutionCompleteToolDescriptionMetaUIVisibility value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/generated/ToolExecutionCompleteUIResource.java b/src/generated/java/com/github/copilot/generated/ToolExecutionCompleteUIResource.java new file mode 100644 index 000000000..0d29bd400 --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/ToolExecutionCompleteUIResource.java @@ -0,0 +1,35 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.generated; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * MCP Apps UI resource content for rendering in a sandboxed iframe + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record ToolExecutionCompleteUIResource( + /** The ui:// URI of the resource */ + @JsonProperty("uri") String uri, + /** MIME type of the content */ + @JsonProperty("mimeType") String mimeType, + /** HTML content as a string */ + @JsonProperty("text") String text, + /** Base64-encoded HTML content */ + @JsonProperty("blob") String blob, + /** Resource-level UI metadata (CSP, permissions, visual preferences) */ + @JsonProperty("_meta") ToolExecutionCompleteUIResourceMeta meta +) { +} diff --git a/src/generated/java/com/github/copilot/generated/ToolExecutionCompleteUIResourceMeta.java b/src/generated/java/com/github/copilot/generated/ToolExecutionCompleteUIResourceMeta.java new file mode 100644 index 000000000..6375222cc --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/ToolExecutionCompleteUIResourceMeta.java @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.generated; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Resource-level UI metadata (CSP, permissions, visual preferences) + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record ToolExecutionCompleteUIResourceMeta( + /** Schema for the `ToolExecutionCompleteUIResourceMetaUI` type. */ + @JsonProperty("ui") ToolExecutionCompleteUIResourceMetaUI ui +) { +} diff --git a/src/generated/java/com/github/copilot/generated/ToolExecutionCompleteUIResourceMetaUI.java b/src/generated/java/com/github/copilot/generated/ToolExecutionCompleteUIResourceMetaUI.java new file mode 100644 index 000000000..3b9548a8c --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/ToolExecutionCompleteUIResourceMetaUI.java @@ -0,0 +1,31 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.generated; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Schema for the `ToolExecutionCompleteUIResourceMetaUI` type. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record ToolExecutionCompleteUIResourceMetaUI( + /** Schema for the `ToolExecutionCompleteUIResourceMetaUICsp` type. */ + @JsonProperty("csp") ToolExecutionCompleteUIResourceMetaUICsp csp, + /** Schema for the `ToolExecutionCompleteUIResourceMetaUIPermissions` type. */ + @JsonProperty("permissions") ToolExecutionCompleteUIResourceMetaUIPermissions permissions, + @JsonProperty("domain") String domain, + @JsonProperty("prefersBorder") Boolean prefersBorder +) { +} diff --git a/src/generated/java/com/github/copilot/generated/ToolExecutionCompleteUIResourceMetaUICsp.java b/src/generated/java/com/github/copilot/generated/ToolExecutionCompleteUIResourceMetaUICsp.java new file mode 100644 index 000000000..0ccb8a3db --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/ToolExecutionCompleteUIResourceMetaUICsp.java @@ -0,0 +1,30 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.generated; + +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; + +/** + * Schema for the `ToolExecutionCompleteUIResourceMetaUICsp` type. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record ToolExecutionCompleteUIResourceMetaUICsp( + @JsonProperty("connectDomains") List connectDomains, + @JsonProperty("resourceDomains") List resourceDomains, + @JsonProperty("frameDomains") List frameDomains, + @JsonProperty("baseUriDomains") List baseUriDomains +) { +} diff --git a/src/generated/java/com/github/copilot/generated/ToolExecutionCompleteUIResourceMetaUIPermissions.java b/src/generated/java/com/github/copilot/generated/ToolExecutionCompleteUIResourceMetaUIPermissions.java new file mode 100644 index 000000000..8b1fc5dc9 --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/ToolExecutionCompleteUIResourceMetaUIPermissions.java @@ -0,0 +1,33 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.generated; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Schema for the `ToolExecutionCompleteUIResourceMetaUIPermissions` type. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record ToolExecutionCompleteUIResourceMetaUIPermissions( + /** Schema for the `ToolExecutionCompleteUIResourceMetaUIPermissionsCamera` type. */ + @JsonProperty("camera") ToolExecutionCompleteUIResourceMetaUIPermissionsCamera camera, + /** Schema for the `ToolExecutionCompleteUIResourceMetaUIPermissionsMicrophone` type. */ + @JsonProperty("microphone") ToolExecutionCompleteUIResourceMetaUIPermissionsMicrophone microphone, + /** Schema for the `ToolExecutionCompleteUIResourceMetaUIPermissionsGeolocation` type. */ + @JsonProperty("geolocation") ToolExecutionCompleteUIResourceMetaUIPermissionsGeolocation geolocation, + /** Schema for the `ToolExecutionCompleteUIResourceMetaUIPermissionsClipboardWrite` type. */ + @JsonProperty("clipboardWrite") ToolExecutionCompleteUIResourceMetaUIPermissionsClipboardWrite clipboardWrite +) { +} diff --git a/src/generated/java/com/github/copilot/generated/ToolExecutionCompleteUIResourceMetaUIPermissionsCamera.java b/src/generated/java/com/github/copilot/generated/ToolExecutionCompleteUIResourceMetaUIPermissionsCamera.java new file mode 100644 index 000000000..300967e8c --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/ToolExecutionCompleteUIResourceMetaUIPermissionsCamera.java @@ -0,0 +1,24 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.generated; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Schema for the `ToolExecutionCompleteUIResourceMetaUIPermissionsCamera` type. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record ToolExecutionCompleteUIResourceMetaUIPermissionsCamera() { +} diff --git a/src/generated/java/com/github/copilot/generated/ToolExecutionCompleteUIResourceMetaUIPermissionsClipboardWrite.java b/src/generated/java/com/github/copilot/generated/ToolExecutionCompleteUIResourceMetaUIPermissionsClipboardWrite.java new file mode 100644 index 000000000..485a6946c --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/ToolExecutionCompleteUIResourceMetaUIPermissionsClipboardWrite.java @@ -0,0 +1,24 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.generated; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Schema for the `ToolExecutionCompleteUIResourceMetaUIPermissionsClipboardWrite` type. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record ToolExecutionCompleteUIResourceMetaUIPermissionsClipboardWrite() { +} diff --git a/src/generated/java/com/github/copilot/generated/ToolExecutionCompleteUIResourceMetaUIPermissionsGeolocation.java b/src/generated/java/com/github/copilot/generated/ToolExecutionCompleteUIResourceMetaUIPermissionsGeolocation.java new file mode 100644 index 000000000..30ed9bb54 --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/ToolExecutionCompleteUIResourceMetaUIPermissionsGeolocation.java @@ -0,0 +1,24 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.generated; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Schema for the `ToolExecutionCompleteUIResourceMetaUIPermissionsGeolocation` type. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record ToolExecutionCompleteUIResourceMetaUIPermissionsGeolocation() { +} diff --git a/src/generated/java/com/github/copilot/generated/ToolExecutionCompleteUIResourceMetaUIPermissionsMicrophone.java b/src/generated/java/com/github/copilot/generated/ToolExecutionCompleteUIResourceMetaUIPermissionsMicrophone.java new file mode 100644 index 000000000..1748ccb48 --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/ToolExecutionCompleteUIResourceMetaUIPermissionsMicrophone.java @@ -0,0 +1,24 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: session-events.schema.json + +package com.github.copilot.generated; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import javax.annotation.processing.Generated; + +/** + * Schema for the `ToolExecutionCompleteUIResourceMetaUIPermissionsMicrophone` type. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record ToolExecutionCompleteUIResourceMetaUIPermissionsMicrophone() { +} diff --git a/src/generated/java/com/github/copilot/generated/ToolExecutionStartEvent.java b/src/generated/java/com/github/copilot/generated/ToolExecutionStartEvent.java index 782f185f7..7a46ea88c 100644 --- a/src/generated/java/com/github/copilot/generated/ToolExecutionStartEvent.java +++ b/src/generated/java/com/github/copilot/generated/ToolExecutionStartEvent.java @@ -47,6 +47,8 @@ public record ToolExecutionStartEventData( @JsonProperty("mcpToolName") String mcpToolName, /** Identifier for the agent loop turn this tool was invoked in, matching the corresponding assistant.turn_start event */ @JsonProperty("turnId") String turnId, + /** When true, the tool output should be displayed expanded (verbatim) in the CLI timeline */ + @JsonProperty("displayVerbatim") Boolean displayVerbatim, /** Tool call ID of the parent tool invocation when this event originates from a sub-agent */ @JsonProperty("parentToolCallId") String parentToolCallId ) { diff --git a/src/generated/java/com/github/copilot/generated/rpc/AgentRegistrySpawnParams.java b/src/generated/java/com/github/copilot/generated/rpc/AgentRegistrySpawnParams.java new file mode 100644 index 000000000..964aaede6 --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/rpc/AgentRegistrySpawnParams.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.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; + +/** + * Inputs to spawn a managed-server child via the controller's spawn delegate. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record AgentRegistrySpawnParams( + /** Working directory for the spawned child (must be an existing directory) */ + @JsonProperty("cwd") String cwd, + /** Custom or built-in agent name (e.g. 'explore'). When omitted, the child uses its own default. */ + @JsonProperty("agentName") String agentName, + /** Model identifier to apply to the new session */ + @JsonProperty("model") String model, + /** Friendly session name. Must satisfy validateSessionName: non-empty, no leading/trailing whitespace, <=100 chars, no control chars, no double quotes. */ + @JsonProperty("name") String name, + /** Permission posture for the new session. 'yolo' requires the controller-local session to currently be in allow-all mode. */ + @JsonProperty("permissionMode") AgentRegistrySpawnPermissionMode permissionMode, + /** Optional first user message. Forwarded to the caller (the CLI's spawn wrapper sends it post-attach via the standard LocalRpcSession.send path). */ + @JsonProperty("initialPrompt") String initialPrompt +) { +} diff --git a/src/generated/java/com/github/copilot/generated/rpc/AgentRegistrySpawnPermissionMode.java b/src/generated/java/com/github/copilot/generated/rpc/AgentRegistrySpawnPermissionMode.java new file mode 100644 index 000000000..1d5b21fe0 --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/rpc/AgentRegistrySpawnPermissionMode.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.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Permission posture for the new session. 'yolo' requires the controller-local session to currently be in allow-all mode. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum AgentRegistrySpawnPermissionMode { + /** The {@code default} variant. */ + DEFAULT("default"), + /** The {@code yolo} variant. */ + YOLO("yolo"); + + private final String value; + AgentRegistrySpawnPermissionMode(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static AgentRegistrySpawnPermissionMode fromValue(String value) { + for (AgentRegistrySpawnPermissionMode v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown AgentRegistrySpawnPermissionMode value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/generated/rpc/CanvasAction.java b/src/generated/java/com/github/copilot/generated/rpc/CanvasAction.java new file mode 100644 index 000000000..36554ed76 --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/rpc/CanvasAction.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.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; + +/** + * Canvas action that the agent or host can invoke. To discover the input schema for a particular action, call the list_canvas_capabilities tool. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record CanvasAction( + /** Action name exposed by the canvas provider */ + @JsonProperty("name") String name, + /** Description of the action */ + @JsonProperty("description") String description, + /** JSON Schema for the action input */ + @JsonProperty("inputSchema") Object inputSchema +) { +} diff --git a/src/generated/java/com/github/copilot/generated/rpc/CanvasCloseParams.java b/src/generated/java/com/github/copilot/generated/rpc/CanvasCloseParams.java new file mode 100644 index 000000000..d692c07e7 --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/rpc/CanvasCloseParams.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.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; + +/** + * Canvas close parameters sent to the provider. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record CanvasCloseParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** Owning provider identifier */ + @JsonProperty("extensionId") String extensionId, + /** Provider-local canvas identifier */ + @JsonProperty("canvasId") String canvasId, + /** Canvas instance identifier */ + @JsonProperty("instanceId") String instanceId, + /** Host context supplied by the runtime. */ + @JsonProperty("host") CanvasHostContext host, + /** Session context supplied by the runtime. */ + @JsonProperty("session") CanvasSessionContext session +) { +} diff --git a/src/generated/java/com/github/copilot/generated/rpc/CanvasHostContext.java b/src/generated/java/com/github/copilot/generated/rpc/CanvasHostContext.java new file mode 100644 index 000000000..8dba8156e --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/rpc/CanvasHostContext.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.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; + +/** + * Host context supplied by the runtime. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record CanvasHostContext( + /** Host capabilities */ + @JsonProperty("capabilities") CanvasHostContextCapabilities capabilities +) { +} diff --git a/src/generated/java/com/github/copilot/generated/rpc/CanvasHostContextCapabilities.java b/src/generated/java/com/github/copilot/generated/rpc/CanvasHostContextCapabilities.java new file mode 100644 index 000000000..a8118eeeb --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/rpc/CanvasHostContextCapabilities.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.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; + +/** + * Host capabilities + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record CanvasHostContextCapabilities( + /** Whether canvas rendering is supported */ + @JsonProperty("canvases") Boolean canvases +) { +} diff --git a/src/generated/java/com/github/copilot/generated/rpc/CanvasInstanceAvailability.java b/src/generated/java/com/github/copilot/generated/rpc/CanvasInstanceAvailability.java new file mode 100644 index 000000000..aef2d8126 --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/rpc/CanvasInstanceAvailability.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.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Runtime-controlled routing state for an open canvas instance. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum CanvasInstanceAvailability { + /** The {@code ready} variant. */ + READY("ready"), + /** The {@code stale} variant. */ + STALE("stale"); + + private final String value; + CanvasInstanceAvailability(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static CanvasInstanceAvailability fromValue(String value) { + for (CanvasInstanceAvailability v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown CanvasInstanceAvailability value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/generated/rpc/CanvasInvokeActionParams.java b/src/generated/java/com/github/copilot/generated/rpc/CanvasInvokeActionParams.java new file mode 100644 index 000000000..8843a3bf0 --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/rpc/CanvasInvokeActionParams.java @@ -0,0 +1,41 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.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; + +/** + * Canvas action invocation parameters sent to the provider. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record CanvasInvokeActionParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** Owning provider identifier */ + @JsonProperty("extensionId") String extensionId, + /** Provider-local canvas identifier */ + @JsonProperty("canvasId") String canvasId, + /** Canvas instance identifier */ + @JsonProperty("instanceId") String instanceId, + /** Action name to invoke */ + @JsonProperty("actionName") String actionName, + /** Action input */ + @JsonProperty("input") Object input, + /** Host context supplied by the runtime. */ + @JsonProperty("host") CanvasHostContext host, + /** Session context supplied by the runtime. */ + @JsonProperty("session") CanvasSessionContext session +) { +} diff --git a/src/generated/java/com/github/copilot/generated/rpc/CanvasOpenParams.java b/src/generated/java/com/github/copilot/generated/rpc/CanvasOpenParams.java new file mode 100644 index 000000000..95b0d8e64 --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/rpc/CanvasOpenParams.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.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; + +/** + * Canvas open parameters sent to the provider. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record CanvasOpenParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** Owning provider identifier */ + @JsonProperty("extensionId") String extensionId, + /** Provider-local canvas identifier */ + @JsonProperty("canvasId") String canvasId, + /** Stable caller-supplied canvas instance identifier */ + @JsonProperty("instanceId") String instanceId, + /** Canvas open input */ + @JsonProperty("input") Object input, + /** Host context supplied by the runtime. */ + @JsonProperty("host") CanvasHostContext host, + /** Session context supplied by the runtime. */ + @JsonProperty("session") CanvasSessionContext session +) { +} diff --git a/src/generated/java/com/github/copilot/generated/rpc/CanvasOpenResult.java b/src/generated/java/com/github/copilot/generated/rpc/CanvasOpenResult.java new file mode 100644 index 000000000..9ce3aeede --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/rpc/CanvasOpenResult.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.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; + +/** + * Canvas open result returned by the provider. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record CanvasOpenResult( + /** URL for web-rendered canvases */ + @JsonProperty("url") String url, + /** Provider-supplied title */ + @JsonProperty("title") String title, + /** Provider-supplied status text */ + @JsonProperty("status") String status +) { +} diff --git a/src/generated/java/com/github/copilot/generated/rpc/CanvasSessionContext.java b/src/generated/java/com/github/copilot/generated/rpc/CanvasSessionContext.java new file mode 100644 index 000000000..422d32e54 --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/rpc/CanvasSessionContext.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.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; + +/** + * Session context supplied by the runtime. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record CanvasSessionContext( + /** Active session working directory, when known. */ + @JsonProperty("workingDirectory") String workingDirectory +) { +} diff --git a/src/generated/java/com/github/copilot/generated/rpc/DiscoveredCanvas.java b/src/generated/java/com/github/copilot/generated/rpc/DiscoveredCanvas.java new file mode 100644 index 000000000..e6e02745c --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/rpc/DiscoveredCanvas.java @@ -0,0 +1,40 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.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; + +/** + * Canvas available in the current session. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record DiscoveredCanvas( + /** Human-readable canvas name */ + @JsonProperty("displayName") String displayName, + /** Short, single-sentence description shown to the agent in canvas catalogs. */ + @JsonProperty("description") String description, + /** JSON Schema for canvas open input */ + @JsonProperty("inputSchema") Object inputSchema, + /** Actions the agent or host may invoke on an open instance */ + @JsonProperty("actions") List actions, + /** Owning provider identifier */ + @JsonProperty("extensionId") String extensionId, + /** Owning extension display name, when available */ + @JsonProperty("extensionName") String extensionName, + /** Provider-local canvas identifier */ + @JsonProperty("canvasId") String canvasId +) { +} diff --git a/src/generated/java/com/github/copilot/generated/rpc/DiscoveredMcpServer.java b/src/generated/java/com/github/copilot/generated/rpc/DiscoveredMcpServer.java index 73095ef61..4f8fb22ac 100644 --- a/src/generated/java/com/github/copilot/generated/rpc/DiscoveredMcpServer.java +++ b/src/generated/java/com/github/copilot/generated/rpc/DiscoveredMcpServer.java @@ -23,7 +23,7 @@ public record DiscoveredMcpServer( /** Server name (config key) */ @JsonProperty("name") String name, - /** Server transport type: stdio, http, sse, or memory */ + /** Server transport type: stdio, http, sse (deprecated), or memory */ @JsonProperty("type") DiscoveredMcpServerType type, /** Configuration source: user, workspace, plugin, or builtin */ @JsonProperty("source") McpServerSource source, diff --git a/src/generated/java/com/github/copilot/generated/rpc/DiscoveredMcpServerType.java b/src/generated/java/com/github/copilot/generated/rpc/DiscoveredMcpServerType.java index 8e6c1417a..bc9b9cefd 100644 --- a/src/generated/java/com/github/copilot/generated/rpc/DiscoveredMcpServerType.java +++ b/src/generated/java/com/github/copilot/generated/rpc/DiscoveredMcpServerType.java @@ -10,7 +10,7 @@ import javax.annotation.processing.Generated; /** - * Server transport type: stdio, http, sse, or memory + * Server transport type: stdio, http, sse (deprecated), or memory * * @since 1.0.0 */ diff --git a/src/generated/java/com/github/copilot/generated/rpc/McpAppsDiagnoseCapability.java b/src/generated/java/com/github/copilot/generated/rpc/McpAppsDiagnoseCapability.java new file mode 100644 index 000000000..c4da1ff72 --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/rpc/McpAppsDiagnoseCapability.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.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; + +/** + * Capability negotiation snapshot + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record McpAppsDiagnoseCapability( + /** Whether the session has the `mcp-apps` capability */ + @JsonProperty("sessionHasMcpApps") Boolean sessionHasMcpApps, + /** Whether the MCP_APPS feature flag (or COPILOT_MCP_APPS env override) is on */ + @JsonProperty("featureFlagEnabled") Boolean featureFlagEnabled, + /** Whether the runtime advertises `extensions.io.modelcontextprotocol/ui` to MCP servers */ + @JsonProperty("advertised") Boolean advertised +) { +} diff --git a/src/generated/java/com/github/copilot/generated/rpc/McpAppsDiagnoseServer.java b/src/generated/java/com/github/copilot/generated/rpc/McpAppsDiagnoseServer.java new file mode 100644 index 000000000..c63ef75bb --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/rpc/McpAppsDiagnoseServer.java @@ -0,0 +1,34 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.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; + +/** + * What the server returned for this session + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record McpAppsDiagnoseServer( + /** Whether the named server is currently connected */ + @JsonProperty("connected") Boolean connected, + /** Total tools returned by the server's tools/list */ + @JsonProperty("toolCount") Double toolCount, + /** Tools whose `_meta.ui` is populated (resourceUri and/or visibility set) */ + @JsonProperty("toolsWithUiMeta") Double toolsWithUiMeta, + /** Up to 5 tool names with `_meta.ui` for quick inspection */ + @JsonProperty("sampleToolNames") List sampleToolNames +) { +} diff --git a/src/generated/java/com/github/copilot/generated/rpc/McpAppsHostContextDetails.java b/src/generated/java/com/github/copilot/generated/rpc/McpAppsHostContextDetails.java new file mode 100644 index 000000000..dd98b2c35 --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/rpc/McpAppsHostContextDetails.java @@ -0,0 +1,40 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.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; + +/** + * Current host context + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record McpAppsHostContextDetails( + /** UI theme preference per SEP-1865 */ + @JsonProperty("theme") McpAppsHostContextDetailsTheme theme, + /** BCP-47 locale, e.g. 'en-US' */ + @JsonProperty("locale") String locale, + /** IANA timezone, e.g. 'America/New_York' */ + @JsonProperty("timeZone") String timeZone, + /** Current display mode (SEP-1865) */ + @JsonProperty("displayMode") McpAppsHostContextDetailsDisplayMode displayMode, + /** Display modes the host supports */ + @JsonProperty("availableDisplayModes") List availableDisplayModes, + /** Platform type for responsive design */ + @JsonProperty("platform") McpAppsHostContextDetailsPlatform platform, + /** Host application identifier */ + @JsonProperty("userAgent") String userAgent +) { +} diff --git a/src/generated/java/com/github/copilot/generated/rpc/McpAppsHostContextDetailsAvailableDisplayMode.java b/src/generated/java/com/github/copilot/generated/rpc/McpAppsHostContextDetailsAvailableDisplayMode.java new file mode 100644 index 000000000..b5588d611 --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/rpc/McpAppsHostContextDetailsAvailableDisplayMode.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.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Allowed values for the `McpAppsHostContextDetailsAvailableDisplayMode` enumeration. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum McpAppsHostContextDetailsAvailableDisplayMode { + /** The {@code inline} variant. */ + INLINE("inline"), + /** The {@code fullscreen} variant. */ + FULLSCREEN("fullscreen"), + /** The {@code pip} variant. */ + PIP("pip"); + + private final String value; + McpAppsHostContextDetailsAvailableDisplayMode(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static McpAppsHostContextDetailsAvailableDisplayMode fromValue(String value) { + for (McpAppsHostContextDetailsAvailableDisplayMode v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown McpAppsHostContextDetailsAvailableDisplayMode value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/generated/rpc/McpAppsHostContextDetailsDisplayMode.java b/src/generated/java/com/github/copilot/generated/rpc/McpAppsHostContextDetailsDisplayMode.java new file mode 100644 index 000000000..56a03b007 --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/rpc/McpAppsHostContextDetailsDisplayMode.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.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Current display mode (SEP-1865) + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum McpAppsHostContextDetailsDisplayMode { + /** The {@code inline} variant. */ + INLINE("inline"), + /** The {@code fullscreen} variant. */ + FULLSCREEN("fullscreen"), + /** The {@code pip} variant. */ + PIP("pip"); + + private final String value; + McpAppsHostContextDetailsDisplayMode(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static McpAppsHostContextDetailsDisplayMode fromValue(String value) { + for (McpAppsHostContextDetailsDisplayMode v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown McpAppsHostContextDetailsDisplayMode value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/generated/rpc/McpAppsHostContextDetailsPlatform.java b/src/generated/java/com/github/copilot/generated/rpc/McpAppsHostContextDetailsPlatform.java new file mode 100644 index 000000000..4c03c3aec --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/rpc/McpAppsHostContextDetailsPlatform.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.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Platform type for responsive design + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum McpAppsHostContextDetailsPlatform { + /** The {@code web} variant. */ + WEB("web"), + /** The {@code desktop} variant. */ + DESKTOP("desktop"), + /** The {@code mobile} variant. */ + MOBILE("mobile"); + + private final String value; + McpAppsHostContextDetailsPlatform(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static McpAppsHostContextDetailsPlatform fromValue(String value) { + for (McpAppsHostContextDetailsPlatform v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown McpAppsHostContextDetailsPlatform value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/generated/rpc/McpAppsHostContextDetailsTheme.java b/src/generated/java/com/github/copilot/generated/rpc/McpAppsHostContextDetailsTheme.java new file mode 100644 index 000000000..e80e3b554 --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/rpc/McpAppsHostContextDetailsTheme.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.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * UI theme preference per SEP-1865 + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum McpAppsHostContextDetailsTheme { + /** The {@code light} variant. */ + LIGHT("light"), + /** The {@code dark} variant. */ + DARK("dark"); + + private final String value; + McpAppsHostContextDetailsTheme(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static McpAppsHostContextDetailsTheme fromValue(String value) { + for (McpAppsHostContextDetailsTheme v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown McpAppsHostContextDetailsTheme value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/generated/rpc/McpAppsResourceContent.java b/src/generated/java/com/github/copilot/generated/rpc/McpAppsResourceContent.java new file mode 100644 index 000000000..25850f372 --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/rpc/McpAppsResourceContent.java @@ -0,0 +1,36 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.generated.rpc; + +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; + +/** + * Schema for the `McpAppsResourceContent` type. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record McpAppsResourceContent( + /** The resource URI (typically ui://...) */ + @JsonProperty("uri") String uri, + /** MIME type of the content */ + @JsonProperty("mimeType") String mimeType, + /** Text content (e.g. HTML) */ + @JsonProperty("text") String text, + /** Base64-encoded binary content */ + @JsonProperty("blob") String blob, + /** Resource-level metadata (CSP, permissions, etc.) */ + @JsonProperty("_meta") Map meta +) { +} diff --git a/src/generated/java/com/github/copilot/generated/rpc/McpAppsSetHostContextDetails.java b/src/generated/java/com/github/copilot/generated/rpc/McpAppsSetHostContextDetails.java new file mode 100644 index 000000000..bb37e8d94 --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/rpc/McpAppsSetHostContextDetails.java @@ -0,0 +1,40 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.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; + +/** + * Host context advertised to MCP App guests + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record McpAppsSetHostContextDetails( + /** UI theme preference per SEP-1865 */ + @JsonProperty("theme") McpAppsSetHostContextDetailsTheme theme, + /** BCP-47 locale, e.g. 'en-US' */ + @JsonProperty("locale") String locale, + /** IANA timezone, e.g. 'America/New_York' */ + @JsonProperty("timeZone") String timeZone, + /** Current display mode (SEP-1865) */ + @JsonProperty("displayMode") McpAppsSetHostContextDetailsDisplayMode displayMode, + /** Display modes the host supports */ + @JsonProperty("availableDisplayModes") List availableDisplayModes, + /** Platform type for responsive design */ + @JsonProperty("platform") McpAppsSetHostContextDetailsPlatform platform, + /** Host application identifier */ + @JsonProperty("userAgent") String userAgent +) { +} diff --git a/src/generated/java/com/github/copilot/generated/rpc/McpAppsSetHostContextDetailsAvailableDisplayMode.java b/src/generated/java/com/github/copilot/generated/rpc/McpAppsSetHostContextDetailsAvailableDisplayMode.java new file mode 100644 index 000000000..e207f5416 --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/rpc/McpAppsSetHostContextDetailsAvailableDisplayMode.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.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Allowed values for the `McpAppsSetHostContextDetailsAvailableDisplayMode` enumeration. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum McpAppsSetHostContextDetailsAvailableDisplayMode { + /** The {@code inline} variant. */ + INLINE("inline"), + /** The {@code fullscreen} variant. */ + FULLSCREEN("fullscreen"), + /** The {@code pip} variant. */ + PIP("pip"); + + private final String value; + McpAppsSetHostContextDetailsAvailableDisplayMode(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static McpAppsSetHostContextDetailsAvailableDisplayMode fromValue(String value) { + for (McpAppsSetHostContextDetailsAvailableDisplayMode v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown McpAppsSetHostContextDetailsAvailableDisplayMode value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/generated/rpc/McpAppsSetHostContextDetailsDisplayMode.java b/src/generated/java/com/github/copilot/generated/rpc/McpAppsSetHostContextDetailsDisplayMode.java new file mode 100644 index 000000000..a42a88a4a --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/rpc/McpAppsSetHostContextDetailsDisplayMode.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.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Current display mode (SEP-1865) + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum McpAppsSetHostContextDetailsDisplayMode { + /** The {@code inline} variant. */ + INLINE("inline"), + /** The {@code fullscreen} variant. */ + FULLSCREEN("fullscreen"), + /** The {@code pip} variant. */ + PIP("pip"); + + private final String value; + McpAppsSetHostContextDetailsDisplayMode(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static McpAppsSetHostContextDetailsDisplayMode fromValue(String value) { + for (McpAppsSetHostContextDetailsDisplayMode v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown McpAppsSetHostContextDetailsDisplayMode value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/generated/rpc/McpAppsSetHostContextDetailsPlatform.java b/src/generated/java/com/github/copilot/generated/rpc/McpAppsSetHostContextDetailsPlatform.java new file mode 100644 index 000000000..306b717d6 --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/rpc/McpAppsSetHostContextDetailsPlatform.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.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Platform type for responsive design + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum McpAppsSetHostContextDetailsPlatform { + /** The {@code web} variant. */ + WEB("web"), + /** The {@code desktop} variant. */ + DESKTOP("desktop"), + /** The {@code mobile} variant. */ + MOBILE("mobile"); + + private final String value; + McpAppsSetHostContextDetailsPlatform(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static McpAppsSetHostContextDetailsPlatform fromValue(String value) { + for (McpAppsSetHostContextDetailsPlatform v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown McpAppsSetHostContextDetailsPlatform value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/generated/rpc/McpAppsSetHostContextDetailsTheme.java b/src/generated/java/com/github/copilot/generated/rpc/McpAppsSetHostContextDetailsTheme.java new file mode 100644 index 000000000..09e15319e --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/rpc/McpAppsSetHostContextDetailsTheme.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.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * UI theme preference per SEP-1865 + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum McpAppsSetHostContextDetailsTheme { + /** The {@code light} variant. */ + LIGHT("light"), + /** The {@code dark} variant. */ + DARK("dark"); + + private final String value; + McpAppsSetHostContextDetailsTheme(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static McpAppsSetHostContextDetailsTheme fromValue(String value) { + for (McpAppsSetHostContextDetailsTheme v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown McpAppsSetHostContextDetailsTheme value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/generated/rpc/ModelBillingTokenPrices.java b/src/generated/java/com/github/copilot/generated/rpc/ModelBillingTokenPrices.java index 7477b8526..756ccaa02 100644 --- a/src/generated/java/com/github/copilot/generated/rpc/ModelBillingTokenPrices.java +++ b/src/generated/java/com/github/copilot/generated/rpc/ModelBillingTokenPrices.java @@ -21,13 +21,17 @@ @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, + /** AI Credits cost per billing batch of input tokens */ + @JsonProperty("inputPrice") Double inputPrice, + /** AI Credits cost per billing batch of output tokens */ + @JsonProperty("outputPrice") Double outputPrice, + /** AI Credits cost per billing batch of cached tokens */ + @JsonProperty("cachePrice") Double cachePrice, /** Number of tokens per standard billing batch */ - @JsonProperty("batchSize") Long batchSize + @JsonProperty("batchSize") Long batchSize, + /** Maximum context window tokens for the default tier */ + @JsonProperty("contextMax") Long contextMax, + /** Long context tier pricing (available for models with extended context windows) */ + @JsonProperty("longContext") ModelBillingTokenPricesLongContext longContext ) { } diff --git a/src/generated/java/com/github/copilot/generated/rpc/ModelBillingTokenPricesLongContext.java b/src/generated/java/com/github/copilot/generated/rpc/ModelBillingTokenPricesLongContext.java new file mode 100644 index 000000000..983742c19 --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/rpc/ModelBillingTokenPricesLongContext.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.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; + +/** + * Long context tier pricing (available for models with extended context windows) + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record ModelBillingTokenPricesLongContext( + /** AI Credits cost per billing batch of input tokens */ + @JsonProperty("inputPrice") Double inputPrice, + /** AI Credits cost per billing batch of output tokens */ + @JsonProperty("outputPrice") Double outputPrice, + /** AI Credits cost per billing batch of cached tokens */ + @JsonProperty("cachePrice") Double cachePrice, + /** Maximum context window tokens for the long context tier */ + @JsonProperty("contextMax") Long contextMax +) { +} diff --git a/src/generated/java/com/github/copilot/generated/rpc/OpenCanvasInstance.java b/src/generated/java/com/github/copilot/generated/rpc/OpenCanvasInstance.java new file mode 100644 index 000000000..5b373ee23 --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/rpc/OpenCanvasInstance.java @@ -0,0 +1,45 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.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; + +/** + * Open canvas instance snapshot. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record OpenCanvasInstance( + /** Stable caller-supplied canvas instance identifier */ + @JsonProperty("instanceId") String instanceId, + /** Owning provider identifier */ + @JsonProperty("extensionId") String extensionId, + /** Owning extension display name, when available */ + @JsonProperty("extensionName") String extensionName, + /** Provider-local canvas identifier */ + @JsonProperty("canvasId") String canvasId, + /** Rendered title */ + @JsonProperty("title") String title, + /** Provider-supplied status text */ + @JsonProperty("status") String status, + /** URL for web-rendered canvases */ + @JsonProperty("url") String url, + /** Input supplied when the instance was opened */ + @JsonProperty("input") Object input, + /** Whether this snapshot came from an idempotent reopen */ + @JsonProperty("reopen") Boolean reopen, + /** Runtime-controlled routing state for an open canvas instance. */ + @JsonProperty("availability") CanvasInstanceAvailability availability +) { +} diff --git a/src/generated/java/com/github/copilot/generated/rpc/OptionsUpdateToolFilterPrecedence.java b/src/generated/java/com/github/copilot/generated/rpc/OptionsUpdateToolFilterPrecedence.java new file mode 100644 index 000000000..57fdc6dae --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/rpc/OptionsUpdateToolFilterPrecedence.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.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Controls how availableTools (allowlist) and excludedTools (denylist) combine when both are set. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum OptionsUpdateToolFilterPrecedence { + /** The {@code available} variant. */ + AVAILABLE("available"), + /** The {@code excluded} variant. */ + EXCLUDED("excluded"); + + private final String value; + OptionsUpdateToolFilterPrecedence(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static OptionsUpdateToolFilterPrecedence fromValue(String value) { + for (OptionsUpdateToolFilterPrecedence v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown OptionsUpdateToolFilterPrecedence value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/generated/rpc/ServerAgentRegistryApi.java b/src/generated/java/com/github/copilot/generated/rpc/ServerAgentRegistryApi.java new file mode 100644 index 000000000..f1a0d4bb5 --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/rpc/ServerAgentRegistryApi.java @@ -0,0 +1,38 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.generated.rpc; + +import java.util.concurrent.CompletableFuture; +import javax.annotation.processing.Generated; + +/** + * API methods for the {@code agentRegistry} namespace. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public final class ServerAgentRegistryApi { + + private final RpcCaller caller; + + /** @param caller the RPC transport function */ + ServerAgentRegistryApi(RpcCaller caller) { + this.caller = caller; + } + + /** + * Inputs to spawn a managed-server child via the controller's spawn delegate. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture spawn(AgentRegistrySpawnParams params) { + return caller.invoke("agentRegistry.spawn", params, Void.class); + } + +} diff --git a/src/generated/java/com/github/copilot/generated/rpc/ServerRpc.java b/src/generated/java/com/github/copilot/generated/rpc/ServerRpc.java index 707e998d0..8d9767658 100644 --- a/src/generated/java/com/github/copilot/generated/rpc/ServerRpc.java +++ b/src/generated/java/com/github/copilot/generated/rpc/ServerRpc.java @@ -40,6 +40,8 @@ public final class ServerRpc { public final ServerSessionFsApi sessionFs; /** API methods for the {@code sessions} namespace. */ public final ServerSessionsApi sessions; + /** API methods for the {@code agentRegistry} namespace. */ + public final ServerAgentRegistryApi agentRegistry; /** * Creates a new server RPC client. @@ -56,6 +58,7 @@ public ServerRpc(RpcCaller caller) { this.skills = new ServerSkillsApi(caller); this.sessionFs = new ServerSessionFsApi(caller); this.sessions = new ServerSessionsApi(caller); + this.agentRegistry = new ServerAgentRegistryApi(caller); } /** diff --git a/src/generated/java/com/github/copilot/generated/rpc/ServerSessionsApi.java b/src/generated/java/com/github/copilot/generated/rpc/ServerSessionsApi.java index c4b25a649..ece70c84a 100644 --- a/src/generated/java/com/github/copilot/generated/rpc/ServerSessionsApi.java +++ b/src/generated/java/com/github/copilot/generated/rpc/ServerSessionsApi.java @@ -46,7 +46,7 @@ public CompletableFuture connect() { } /** - * Optional metadata-load limit and context filter applied to the returned sessions. + * Optional metadata-load limit and filters applied to the returned sessions. * * @apiNote This method is experimental and may change in a future version. * @since 1.0.0 diff --git a/src/generated/java/com/github/copilot/generated/rpc/SessionCanvasApi.java b/src/generated/java/com/github/copilot/generated/rpc/SessionCanvasApi.java new file mode 100644 index 000000000..8388c82a2 --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/rpc/SessionCanvasApi.java @@ -0,0 +1,97 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.generated.rpc; + +import java.util.concurrent.CompletableFuture; +import javax.annotation.processing.Generated; + +/** + * API methods for the {@code canvas} namespace. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public final class SessionCanvasApi { + + private static final com.fasterxml.jackson.databind.ObjectMapper MAPPER = RpcMapper.INSTANCE; + + private final RpcCaller caller; + private final String sessionId; + + /** @param caller the RPC transport function */ + SessionCanvasApi(RpcCaller caller, String sessionId) { + this.caller = caller; + this.sessionId = sessionId; + } + + /** + * Identifies the target session. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture list() { + return caller.invoke("session.canvas.list", java.util.Map.of("sessionId", this.sessionId), SessionCanvasListResult.class); + } + + /** + * Identifies the target session. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture listOpen() { + return caller.invoke("session.canvas.listOpen", java.util.Map.of("sessionId", this.sessionId), SessionCanvasListOpenResult.class); + } + + /** + * Canvas open parameters. + *

+ * 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 open(SessionCanvasOpenParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.canvas.open", _p, SessionCanvasOpenResult.class); + } + + /** + * Canvas close parameters. + *

+ * 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 close(SessionCanvasCloseParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.canvas.close", _p, Void.class); + } + + /** + * Canvas action invocation parameters. + *

+ * 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 invokeAction(SessionCanvasInvokeActionParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.canvas.invokeAction", _p, SessionCanvasInvokeActionResult.class); + } + +} diff --git a/src/generated/java/com/github/copilot/generated/rpc/SessionCanvasCloseParams.java b/src/generated/java/com/github/copilot/generated/rpc/SessionCanvasCloseParams.java new file mode 100644 index 000000000..d87e83770 --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/rpc/SessionCanvasCloseParams.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.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; + +/** + * Canvas close parameters. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionCanvasCloseParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** Open canvas instance identifier */ + @JsonProperty("instanceId") String instanceId +) { +} diff --git a/src/generated/java/com/github/copilot/generated/rpc/SessionCanvasInvokeActionParams.java b/src/generated/java/com/github/copilot/generated/rpc/SessionCanvasInvokeActionParams.java new file mode 100644 index 000000000..3696e3e3e --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/rpc/SessionCanvasInvokeActionParams.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.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; + +/** + * Canvas action invocation parameters. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionCanvasInvokeActionParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** Open canvas instance identifier */ + @JsonProperty("instanceId") String instanceId, + /** Action name to invoke */ + @JsonProperty("actionName") String actionName, + /** Action input */ + @JsonProperty("input") Object input +) { +} diff --git a/src/generated/java/com/github/copilot/generated/rpc/SessionCanvasInvokeActionResult.java b/src/generated/java/com/github/copilot/generated/rpc/SessionCanvasInvokeActionResult.java new file mode 100644 index 000000000..117b618ae --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/rpc/SessionCanvasInvokeActionResult.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.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; + +/** + * Canvas action invocation result. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionCanvasInvokeActionResult( + /** Provider-supplied action result */ + @JsonProperty("result") Object result +) { +} diff --git a/src/generated/java/com/github/copilot/generated/rpc/SessionCanvasListOpenParams.java b/src/generated/java/com/github/copilot/generated/rpc/SessionCanvasListOpenParams.java new file mode 100644 index 000000000..6015d9bd6 --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/rpc/SessionCanvasListOpenParams.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.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; + +/** + * Identifies the target session. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionCanvasListOpenParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId +) { +} diff --git a/src/generated/java/com/github/copilot/generated/rpc/SessionCanvasListOpenResult.java b/src/generated/java/com/github/copilot/generated/rpc/SessionCanvasListOpenResult.java new file mode 100644 index 000000000..f9af151e2 --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/rpc/SessionCanvasListOpenResult.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.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; + +/** + * Live open-canvas snapshot. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionCanvasListOpenResult( + /** Currently open canvas instances */ + @JsonProperty("openCanvases") List openCanvases +) { +} diff --git a/src/generated/java/com/github/copilot/generated/rpc/SessionCanvasListParams.java b/src/generated/java/com/github/copilot/generated/rpc/SessionCanvasListParams.java new file mode 100644 index 000000000..d49d90e6c --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/rpc/SessionCanvasListParams.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.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; + +/** + * Identifies the target session. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionCanvasListParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId +) { +} diff --git a/src/generated/java/com/github/copilot/generated/rpc/SessionCanvasListResult.java b/src/generated/java/com/github/copilot/generated/rpc/SessionCanvasListResult.java new file mode 100644 index 000000000..a4d33998a --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/rpc/SessionCanvasListResult.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.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; + +/** + * Declared canvases available in this session. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionCanvasListResult( + /** Declared canvases available in this session */ + @JsonProperty("canvases") List canvases +) { +} diff --git a/src/generated/java/com/github/copilot/generated/rpc/SessionCanvasOpenParams.java b/src/generated/java/com/github/copilot/generated/rpc/SessionCanvasOpenParams.java new file mode 100644 index 000000000..8b56ad50a --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/rpc/SessionCanvasOpenParams.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.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; + +/** + * Canvas open parameters. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionCanvasOpenParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** Owning provider identifier. Optional when the canvasId is unique across providers; required to disambiguate when multiple providers register the same canvasId. */ + @JsonProperty("extensionId") String extensionId, + /** Provider-local canvas identifier */ + @JsonProperty("canvasId") String canvasId, + /** Caller-supplied stable instance identifier */ + @JsonProperty("instanceId") String instanceId, + /** Canvas open input */ + @JsonProperty("input") Object input +) { +} diff --git a/src/generated/java/com/github/copilot/generated/rpc/SessionCanvasOpenResult.java b/src/generated/java/com/github/copilot/generated/rpc/SessionCanvasOpenResult.java new file mode 100644 index 000000000..38f3a5f55 --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/rpc/SessionCanvasOpenResult.java @@ -0,0 +1,45 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.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; + +/** + * Open canvas instance snapshot. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionCanvasOpenResult( + /** Stable caller-supplied canvas instance identifier */ + @JsonProperty("instanceId") String instanceId, + /** Owning provider identifier */ + @JsonProperty("extensionId") String extensionId, + /** Owning extension display name, when available */ + @JsonProperty("extensionName") String extensionName, + /** Provider-local canvas identifier */ + @JsonProperty("canvasId") String canvasId, + /** Rendered title */ + @JsonProperty("title") String title, + /** Provider-supplied status text */ + @JsonProperty("status") String status, + /** URL for web-rendered canvases */ + @JsonProperty("url") String url, + /** Input supplied when the instance was opened */ + @JsonProperty("input") Object input, + /** Whether this snapshot came from an idempotent reopen */ + @JsonProperty("reopen") Boolean reopen, + /** Runtime-controlled routing state for an open canvas instance. */ + @JsonProperty("availability") CanvasInstanceAvailability availability +) { +} diff --git a/src/generated/java/com/github/copilot/generated/rpc/SessionMcpApi.java b/src/generated/java/com/github/copilot/generated/rpc/SessionMcpApi.java index 4282a2334..c9e577fd5 100644 --- a/src/generated/java/com/github/copilot/generated/rpc/SessionMcpApi.java +++ b/src/generated/java/com/github/copilot/generated/rpc/SessionMcpApi.java @@ -25,12 +25,15 @@ public final class SessionMcpApi { /** API methods for the {@code mcp.oauth} sub-namespace. */ public final SessionMcpOauthApi oauth; + /** API methods for the {@code mcp.apps} sub-namespace. */ + public final SessionMcpAppsApi apps; /** @param caller the RPC transport function */ SessionMcpApi(RpcCaller caller, String sessionId) { this.caller = caller; this.sessionId = sessionId; this.oauth = new SessionMcpOauthApi(caller, sessionId); + this.apps = new SessionMcpAppsApi(caller, sessionId); } /** diff --git a/src/generated/java/com/github/copilot/generated/rpc/SessionMcpAppsApi.java b/src/generated/java/com/github/copilot/generated/rpc/SessionMcpAppsApi.java new file mode 100644 index 000000000..b6c131a6a --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/rpc/SessionMcpAppsApi.java @@ -0,0 +1,117 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.generated.rpc; + +import java.util.concurrent.CompletableFuture; +import javax.annotation.processing.Generated; + +/** + * API methods for the {@code mcp.apps} namespace. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public final class SessionMcpAppsApi { + + private static final com.fasterxml.jackson.databind.ObjectMapper MAPPER = RpcMapper.INSTANCE; + + private final RpcCaller caller; + private final String sessionId; + + /** @param caller the RPC transport function */ + SessionMcpAppsApi(RpcCaller caller, String sessionId) { + this.caller = caller; + this.sessionId = sessionId; + } + + /** + * MCP server and resource URI to fetch. + *

+ * 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 readResource(SessionMcpAppsReadResourceParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.mcp.apps.readResource", _p, SessionMcpAppsReadResourceResult.class); + } + + /** + * MCP server to list app-callable tools for. + *

+ * 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 listTools(SessionMcpAppsListToolsParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.mcp.apps.listTools", _p, SessionMcpAppsListToolsResult.class); + } + + /** + * MCP server, tool name, and arguments to invoke from an MCP App view. + *

+ * 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 callTool(SessionMcpAppsCallToolParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.mcp.apps.callTool", _p, Void.class); + } + + /** + * Host context to advertise to MCP App guests. + *

+ * 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 setHostContext(SessionMcpAppsSetHostContextParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.mcp.apps.setHostContext", _p, Void.class); + } + + /** + * Identifies the target session. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture getHostContext() { + return caller.invoke("session.mcp.apps.getHostContext", java.util.Map.of("sessionId", this.sessionId), SessionMcpAppsGetHostContextResult.class); + } + + /** + * MCP server to diagnose MCP Apps wiring for. + *

+ * 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 diagnose(SessionMcpAppsDiagnoseParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.mcp.apps.diagnose", _p, SessionMcpAppsDiagnoseResult.class); + } + +} diff --git a/src/generated/java/com/github/copilot/generated/rpc/SessionMcpAppsCallToolParams.java b/src/generated/java/com/github/copilot/generated/rpc/SessionMcpAppsCallToolParams.java new file mode 100644 index 000000000..8c4788e47 --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/rpc/SessionMcpAppsCallToolParams.java @@ -0,0 +1,36 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.generated.rpc; + +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; + +/** + * MCP server, tool name, and arguments to invoke from an MCP App view. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionMcpAppsCallToolParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** MCP server hosting the tool */ + @JsonProperty("serverName") String serverName, + /** MCP tool name */ + @JsonProperty("toolName") String toolName, + /** Tool arguments */ + @JsonProperty("arguments") Map arguments, + /** **Required.** Server whose ui:// view issued the request. Per SEP-1865 ('callable by the app from this server only'), the call is rejected when this differs from `serverName`, and rejected outright when missing. */ + @JsonProperty("originServerName") String originServerName +) { +} diff --git a/src/generated/java/com/github/copilot/generated/rpc/SessionMcpAppsDiagnoseParams.java b/src/generated/java/com/github/copilot/generated/rpc/SessionMcpAppsDiagnoseParams.java new file mode 100644 index 000000000..cf700a341 --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/rpc/SessionMcpAppsDiagnoseParams.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.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; + +/** + * MCP server to diagnose MCP Apps wiring for. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionMcpAppsDiagnoseParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** MCP server to probe */ + @JsonProperty("serverName") String serverName +) { +} diff --git a/src/generated/java/com/github/copilot/generated/rpc/SessionMcpAppsDiagnoseResult.java b/src/generated/java/com/github/copilot/generated/rpc/SessionMcpAppsDiagnoseResult.java new file mode 100644 index 000000000..144081f48 --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/rpc/SessionMcpAppsDiagnoseResult.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.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; + +/** + * Diagnostic snapshot of MCP Apps wiring for the named server. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionMcpAppsDiagnoseResult( + /** Capability negotiation snapshot */ + @JsonProperty("capability") McpAppsDiagnoseCapability capability, + /** What the server returned for this session */ + @JsonProperty("server") McpAppsDiagnoseServer server +) { +} diff --git a/src/generated/java/com/github/copilot/generated/rpc/SessionMcpAppsGetHostContextParams.java b/src/generated/java/com/github/copilot/generated/rpc/SessionMcpAppsGetHostContextParams.java new file mode 100644 index 000000000..380164b3c --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/rpc/SessionMcpAppsGetHostContextParams.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.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; + +/** + * Identifies the target session. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionMcpAppsGetHostContextParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId +) { +} diff --git a/src/generated/java/com/github/copilot/generated/rpc/SessionMcpAppsGetHostContextResult.java b/src/generated/java/com/github/copilot/generated/rpc/SessionMcpAppsGetHostContextResult.java new file mode 100644 index 000000000..a543b4820 --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/rpc/SessionMcpAppsGetHostContextResult.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.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; + +/** + * Current host context advertised to MCP App guests. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionMcpAppsGetHostContextResult( + /** Current host context */ + @JsonProperty("context") McpAppsHostContextDetails context +) { +} diff --git a/src/generated/java/com/github/copilot/generated/rpc/SessionMcpAppsListToolsParams.java b/src/generated/java/com/github/copilot/generated/rpc/SessionMcpAppsListToolsParams.java new file mode 100644 index 000000000..d5e0c578a --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/rpc/SessionMcpAppsListToolsParams.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.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; + +/** + * MCP server to list app-callable tools for. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionMcpAppsListToolsParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** MCP server hosting the app */ + @JsonProperty("serverName") String serverName, + /** **Required.** Server whose ui:// view issued the request. Per SEP-1865 ('callable by the app from this server only'), the call is rejected when this differs from `serverName`, and rejected outright when missing. */ + @JsonProperty("originServerName") String originServerName +) { +} diff --git a/src/generated/java/com/github/copilot/generated/rpc/SessionMcpAppsListToolsResult.java b/src/generated/java/com/github/copilot/generated/rpc/SessionMcpAppsListToolsResult.java new file mode 100644 index 000000000..054ce56a8 --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/rpc/SessionMcpAppsListToolsResult.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.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 java.util.Map; +import javax.annotation.processing.Generated; + +/** + * App-callable tools from the named MCP server. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionMcpAppsListToolsResult( + /** App-callable tools from the server */ + @JsonProperty("tools") List> tools +) { +} diff --git a/src/generated/java/com/github/copilot/generated/rpc/SessionMcpAppsReadResourceParams.java b/src/generated/java/com/github/copilot/generated/rpc/SessionMcpAppsReadResourceParams.java new file mode 100644 index 000000000..26b29ee3d --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/rpc/SessionMcpAppsReadResourceParams.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.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; + +/** + * MCP server and resource URI to fetch. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionMcpAppsReadResourceParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** Name of the MCP server hosting the resource */ + @JsonProperty("serverName") String serverName, + /** Resource URI (typically ui://...) */ + @JsonProperty("uri") String uri +) { +} diff --git a/src/generated/java/com/github/copilot/generated/rpc/SessionMcpAppsReadResourceResult.java b/src/generated/java/com/github/copilot/generated/rpc/SessionMcpAppsReadResourceResult.java new file mode 100644 index 000000000..e0f9810a3 --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/rpc/SessionMcpAppsReadResourceResult.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.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; + +/** + * Resource contents returned by the MCP server. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionMcpAppsReadResourceResult( + /** Resource contents returned by the server */ + @JsonProperty("contents") List contents +) { +} diff --git a/src/generated/java/com/github/copilot/generated/rpc/SessionMcpAppsSetHostContextParams.java b/src/generated/java/com/github/copilot/generated/rpc/SessionMcpAppsSetHostContextParams.java new file mode 100644 index 000000000..19c9347b7 --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/rpc/SessionMcpAppsSetHostContextParams.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.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; + +/** + * Host context to advertise to MCP App guests. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionMcpAppsSetHostContextParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** Host context advertised to MCP App guests */ + @JsonProperty("context") McpAppsSetHostContextDetails context +) { +} diff --git a/src/generated/java/com/github/copilot/generated/rpc/SessionMetadata.java b/src/generated/java/com/github/copilot/generated/rpc/SessionMetadata.java index c1d3e75eb..03a9e3280 100644 --- a/src/generated/java/com/github/copilot/generated/rpc/SessionMetadata.java +++ b/src/generated/java/com/github/copilot/generated/rpc/SessionMetadata.java @@ -31,8 +31,12 @@ public record SessionMetadata( @JsonProperty("summary") String summary, /** Optional human-friendly name set via /rename */ @JsonProperty("name") String name, + /** Runtime client name that created/last resumed this session */ + @JsonProperty("clientName") String clientName, /** True for remote (GitHub) sessions; false for local */ @JsonProperty("isRemote") Boolean isRemote, + /** True for detached maintenance sessions that should be hidden from normal resume lists. */ + @JsonProperty("isDetached") Boolean isDetached, /** Schema for the `SessionContext` type. */ @JsonProperty("context") SessionContext context, /** GitHub task ID, when this local session is bound to one. Only present for local sessions exported to remote control. */ diff --git a/src/generated/java/com/github/copilot/generated/rpc/SessionMetadataSnapshotResult.java b/src/generated/java/com/github/copilot/generated/rpc/SessionMetadataSnapshotResult.java index ec905f078..5b6ae7b8c 100644 --- a/src/generated/java/com/github/copilot/generated/rpc/SessionMetadataSnapshotResult.java +++ b/src/generated/java/com/github/copilot/generated/rpc/SessionMetadataSnapshotResult.java @@ -36,6 +36,8 @@ public record SessionMetadataSnapshotResult( @JsonProperty("workspacePath") String workspacePath, /** User-provided name supplied at session construction (via `--name`), if any. Immutable after construction. */ @JsonProperty("initialName") String initialName, + /** Runtime client name associated with the session (telemetry identifier). */ + @JsonProperty("clientName") String clientName, /** Remote-session-specific metadata. Populated only when `isRemote` is true. Fields are immutable for the lifetime of the session. */ @JsonProperty("remoteMetadata") MetadataSnapshotRemoteMetadata remoteMetadata, /** Short human-readable summary of the session, if known. Omitted when no summary has been generated. */ diff --git a/src/generated/java/com/github/copilot/generated/rpc/SessionOptionsUpdateParams.java b/src/generated/java/com/github/copilot/generated/rpc/SessionOptionsUpdateParams.java index 081817f3a..8f9a06a4f 100644 --- a/src/generated/java/com/github/copilot/generated/rpc/SessionOptionsUpdateParams.java +++ b/src/generated/java/com/github/copilot/generated/rpc/SessionOptionsUpdateParams.java @@ -47,6 +47,8 @@ public record SessionOptionsUpdateParams( @JsonProperty("availableTools") List availableTools, /** Denylist of tool names for this session. */ @JsonProperty("excludedTools") List excludedTools, + /** Controls how availableTools (allowlist) and excludedTools (denylist) combine when both are set. */ + @JsonProperty("toolFilterPrecedence") OptionsUpdateToolFilterPrecedence toolFilterPrecedence, /** Whether shell-script safety heuristics are enabled. */ @JsonProperty("enableScriptSafety") Boolean enableScriptSafety, /** Shell init profile (`None` or `NonInteractive`). */ diff --git a/src/generated/java/com/github/copilot/generated/rpc/SessionPermissionsApi.java b/src/generated/java/com/github/copilot/generated/rpc/SessionPermissionsApi.java index 42d947954..506f1ce31 100644 --- a/src/generated/java/com/github/copilot/generated/rpc/SessionPermissionsApi.java +++ b/src/generated/java/com/github/copilot/generated/rpc/SessionPermissionsApi.java @@ -97,6 +97,31 @@ public CompletableFuture setApproveAll(Se return caller.invoke("session.permissions.setApproveAll", _p, SessionPermissionsSetApproveAllResult.class); } + /** + * Whether to enable full allow-all permissions for the session. + *

+ * 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 setAllowAll(SessionPermissionsSetAllowAllParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.permissions.setAllowAll", _p, SessionPermissionsSetAllowAllResult.class); + } + + /** + * No parameters. + * + * @apiNote This method is experimental and may change in a future version. + * @since 1.0.0 + */ + public CompletableFuture getAllowAll() { + return caller.invoke("session.permissions.getAllowAll", java.util.Map.of("sessionId", this.sessionId), SessionPermissionsGetAllowAllResult.class); + } + /** * Scope and add/remove instructions for modifying session- or location-scoped permission rules. *

diff --git a/src/generated/java/com/github/copilot/generated/rpc/SessionPermissionsGetAllowAllParams.java b/src/generated/java/com/github/copilot/generated/rpc/SessionPermissionsGetAllowAllParams.java new file mode 100644 index 000000000..ff74dc08d --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/rpc/SessionPermissionsGetAllowAllParams.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.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; + +/** + * No parameters. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionPermissionsGetAllowAllParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId +) { +} diff --git a/src/generated/java/com/github/copilot/generated/rpc/SessionPermissionsGetAllowAllResult.java b/src/generated/java/com/github/copilot/generated/rpc/SessionPermissionsGetAllowAllResult.java new file mode 100644 index 000000000..84b7cfbf0 --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/rpc/SessionPermissionsGetAllowAllResult.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.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; + +/** + * Current full allow-all permission state. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionPermissionsGetAllowAllResult( + /** Whether full allow-all permissions are currently active */ + @JsonProperty("enabled") Boolean enabled +) { +} diff --git a/src/generated/java/com/github/copilot/generated/rpc/SessionPermissionsSetAllowAllParams.java b/src/generated/java/com/github/copilot/generated/rpc/SessionPermissionsSetAllowAllParams.java new file mode 100644 index 000000000..e6335f45b --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/rpc/SessionPermissionsSetAllowAllParams.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.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; + +/** + * Whether to enable full allow-all permissions for the session. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionPermissionsSetAllowAllParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** Whether to enable full allow-all permissions */ + @JsonProperty("enabled") Boolean enabled +) { +} diff --git a/src/generated/java/com/github/copilot/generated/rpc/SessionPermissionsSetAllowAllResult.java b/src/generated/java/com/github/copilot/generated/rpc/SessionPermissionsSetAllowAllResult.java new file mode 100644 index 000000000..5026dd78b --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/rpc/SessionPermissionsSetAllowAllResult.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.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; + +/** + * Indicates whether the operation succeeded and reports the post-mutation state. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionPermissionsSetAllowAllResult( + /** Whether the operation succeeded */ + @JsonProperty("success") Boolean success, + /** Authoritative allow-all state after the mutation */ + @JsonProperty("enabled") Boolean enabled +) { +} diff --git a/src/generated/java/com/github/copilot/generated/rpc/SessionRpc.java b/src/generated/java/com/github/copilot/generated/rpc/SessionRpc.java index ff66aeef3..37567e7a7 100644 --- a/src/generated/java/com/github/copilot/generated/rpc/SessionRpc.java +++ b/src/generated/java/com/github/copilot/generated/rpc/SessionRpc.java @@ -30,6 +30,8 @@ public final class SessionRpc { /** API methods for the {@code auth} namespace. */ public final SessionAuthApi auth; + /** API methods for the {@code canvas} namespace. */ + public final SessionCanvasApi canvas; /** API methods for the {@code model} namespace. */ public final SessionModelApi model; /** API methods for the {@code mode} namespace. */ @@ -97,6 +99,7 @@ public SessionRpc(RpcCaller caller, String sessionId) { this.caller = caller; this.sessionId = sessionId; this.auth = new SessionAuthApi(caller, sessionId); + this.canvas = new SessionCanvasApi(caller, sessionId); this.model = new SessionModelApi(caller, sessionId); this.mode = new SessionModeApi(caller, sessionId); this.name = new SessionNameApi(caller, sessionId); diff --git a/src/generated/java/com/github/copilot/generated/rpc/SessionWorkspacesApi.java b/src/generated/java/com/github/copilot/generated/rpc/SessionWorkspacesApi.java index df0e690a8..54a79c0c5 100644 --- a/src/generated/java/com/github/copilot/generated/rpc/SessionWorkspacesApi.java +++ b/src/generated/java/com/github/copilot/generated/rpc/SessionWorkspacesApi.java @@ -119,4 +119,19 @@ public CompletableFuture saveLargePaste(S return caller.invoke("session.workspaces.saveLargePaste", _p, SessionWorkspacesSaveLargePasteResult.class); } + /** + * Parameters for computing a workspace diff. + *

+ * 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 diff(SessionWorkspacesDiffParams params) { + com.fasterxml.jackson.databind.node.ObjectNode _p = MAPPER.valueToTree(params); + _p.put("sessionId", this.sessionId); + return caller.invoke("session.workspaces.diff", _p, SessionWorkspacesDiffResult.class); + } + } diff --git a/src/generated/java/com/github/copilot/generated/rpc/SessionWorkspacesDiffParams.java b/src/generated/java/com/github/copilot/generated/rpc/SessionWorkspacesDiffParams.java new file mode 100644 index 000000000..02a2668c3 --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/rpc/SessionWorkspacesDiffParams.java @@ -0,0 +1,29 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.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; + +/** + * Parameters for computing a workspace diff. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionWorkspacesDiffParams( + /** Target session identifier */ + @JsonProperty("sessionId") String sessionId, + /** Diff mode requested by the client. */ + @JsonProperty("mode") WorkspaceDiffMode mode +) { +} diff --git a/src/generated/java/com/github/copilot/generated/rpc/SessionWorkspacesDiffResult.java b/src/generated/java/com/github/copilot/generated/rpc/SessionWorkspacesDiffResult.java new file mode 100644 index 000000000..2800f24e3 --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/rpc/SessionWorkspacesDiffResult.java @@ -0,0 +1,36 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +// AUTO-GENERATED FILE - DO NOT EDIT +// Generated from: api.schema.json + +package com.github.copilot.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; + +/** + * Workspace diff result for the requested mode. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record SessionWorkspacesDiffResult( + /** Diff mode requested by the client. */ + @JsonProperty("requestedMode") WorkspaceDiffMode requestedMode, + /** Effective mode used for the returned changes. */ + @JsonProperty("mode") WorkspaceDiffMode mode, + /** Changed files and their unified diffs. */ + @JsonProperty("changes") List changes, + /** Default branch used for a branch diff, when branch mode was requested. */ + @JsonProperty("baseBranch") String baseBranch, + /** Whether a requested branch diff fell back to unstaged changes because branch diff failed. */ + @JsonProperty("isFallback") Boolean isFallback +) { +} diff --git a/src/generated/java/com/github/copilot/generated/rpc/SessionWorkspacesGetWorkspaceResult.java b/src/generated/java/com/github/copilot/generated/rpc/SessionWorkspacesGetWorkspaceResult.java index 6beb5d453..8e79a82a1 100644 --- a/src/generated/java/com/github/copilot/generated/rpc/SessionWorkspacesGetWorkspaceResult.java +++ b/src/generated/java/com/github/copilot/generated/rpc/SessionWorkspacesGetWorkspaceResult.java @@ -39,6 +39,7 @@ public record SessionWorkspacesGetWorkspaceResultWorkspace( @JsonProperty("host_type") WorkspacesWorkspaceDetailsHostType hostType, @JsonProperty("branch") String branch, @JsonProperty("name") String name, + @JsonProperty("client_name") String clientName, @JsonProperty("user_named") Boolean userNamed, @JsonProperty("summary_count") Long summaryCount, @JsonProperty("created_at") OffsetDateTime createdAt, diff --git a/src/generated/java/com/github/copilot/generated/rpc/SessionsEnrichMetadataResult.java b/src/generated/java/com/github/copilot/generated/rpc/SessionsEnrichMetadataResult.java index 864eed23d..7457b8489 100644 --- a/src/generated/java/com/github/copilot/generated/rpc/SessionsEnrichMetadataResult.java +++ b/src/generated/java/com/github/copilot/generated/rpc/SessionsEnrichMetadataResult.java @@ -14,7 +14,7 @@ import javax.annotation.processing.Generated; /** - * The same metadata records, with summary and context fields backfilled where available. + * The enriched metadata records, with summary and context fields backfilled where available. Sessions confirmed empty and unnamed are omitted. * * @since 1.0.0 */ @@ -22,7 +22,7 @@ @JsonInclude(JsonInclude.Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) public record SessionsEnrichMetadataResult( - /** Same records, with summary and context backfilled */ + /** Enriched records, with summary and context backfilled. Sessions confirmed empty and unnamed may be omitted. */ @JsonProperty("sessions") List sessions ) { } diff --git a/src/generated/java/com/github/copilot/generated/rpc/WorkspaceDiffFileChange.java b/src/generated/java/com/github/copilot/generated/rpc/WorkspaceDiffFileChange.java new file mode 100644 index 000000000..f091bc279 --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/rpc/WorkspaceDiffFileChange.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.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; + +/** + * A single changed file and its unified diff. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public record WorkspaceDiffFileChange( + /** Path to the changed file, relative to the workspace root. */ + @JsonProperty("path") String path, + /** Unified diff content for the file. Empty when the diff was truncated. */ + @JsonProperty("diff") String diff, + /** Type of change represented by this file diff. */ + @JsonProperty("changeType") WorkspaceDiffFileChangeType changeType, + /** Original file path for renamed files. */ + @JsonProperty("oldPath") String oldPath, + /** Whether the diff content was omitted because it exceeded the per-file size limit. */ + @JsonProperty("isTruncated") Boolean isTruncated +) { +} diff --git a/src/generated/java/com/github/copilot/generated/rpc/WorkspaceDiffFileChangeType.java b/src/generated/java/com/github/copilot/generated/rpc/WorkspaceDiffFileChangeType.java new file mode 100644 index 000000000..678ecd187 --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/rpc/WorkspaceDiffFileChangeType.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.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Type of change represented by this file diff. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum WorkspaceDiffFileChangeType { + /** The {@code added} variant. */ + ADDED("added"), + /** The {@code modified} variant. */ + MODIFIED("modified"), + /** The {@code deleted} variant. */ + DELETED("deleted"), + /** The {@code renamed} variant. */ + RENAMED("renamed"); + + private final String value; + WorkspaceDiffFileChangeType(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static WorkspaceDiffFileChangeType fromValue(String value) { + for (WorkspaceDiffFileChangeType v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown WorkspaceDiffFileChangeType value: " + value); + } +} diff --git a/src/generated/java/com/github/copilot/generated/rpc/WorkspaceDiffMode.java b/src/generated/java/com/github/copilot/generated/rpc/WorkspaceDiffMode.java new file mode 100644 index 000000000..a2762954b --- /dev/null +++ b/src/generated/java/com/github/copilot/generated/rpc/WorkspaceDiffMode.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.generated.rpc; + +import javax.annotation.processing.Generated; + +/** + * Diff mode requested by the client. + * + * @since 1.0.0 + */ +@javax.annotation.processing.Generated("copilot-sdk-codegen") +public enum WorkspaceDiffMode { + /** The {@code unstaged} variant. */ + UNSTAGED("unstaged"), + /** The {@code branch} variant. */ + BRANCH("branch"); + + private final String value; + WorkspaceDiffMode(String value) { this.value = value; } + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { return value; } + @com.fasterxml.jackson.annotation.JsonCreator + public static WorkspaceDiffMode fromValue(String value) { + for (WorkspaceDiffMode v : values()) { + if (v.value.equals(value)) return v; + } + throw new IllegalArgumentException("Unknown WorkspaceDiffMode value: " + value); + } +} diff --git a/src/main/java/com/github/copilot/CopilotClient.java b/src/main/java/com/github/copilot/CopilotClient.java index 20c7a7e7d..0379b97e6 100644 --- a/src/main/java/com/github/copilot/CopilotClient.java +++ b/src/main/java/com/github/copilot/CopilotClient.java @@ -19,8 +19,11 @@ import java.util.logging.Level; import java.util.logging.Logger; +import com.github.copilot.rpc.CopilotClientMode; import com.github.copilot.rpc.CopilotClientOptions; import com.github.copilot.rpc.CreateSessionResponse; +import com.github.copilot.generated.rpc.SessionOptionsUpdateParams; +import com.github.copilot.generated.rpc.SessionInstalledPlugin; import com.github.copilot.generated.rpc.ConnectParams; import com.github.copilot.generated.rpc.ServerRpc; import com.github.copilot.rpc.DeleteSessionResponse; @@ -143,6 +146,18 @@ public CopilotClient(CopilotClientOptions options) { ? this.options.getTcpConnectionToken() : (sdkSpawnsCli ? java.util.UUID.randomUUID().toString() : null); + // Empty mode: validate at construction time that the app supplied a + // per-session persistence location. + if (this.options.getMode() == CopilotClientMode.EMPTY) { + boolean hasPersistence = (this.options.getCopilotHome() != null && !this.options.getCopilotHome().isEmpty()) + || (this.options.getCliUrl() != null && !this.options.getCliUrl().isEmpty()); + if (!hasPersistence) { + throw new IllegalArgumentException( + "CopilotClient was created with Mode = EMPTY but neither CopilotHome nor CliUrl was set. " + + "Empty mode requires an explicit per-session persistence location."); + } + } + // Parse CliUrl if provided if (this.options.getCliUrl() != null && !this.options.getCliUrl().isEmpty()) { URI uri = CliServerManager.parseCliUrl(this.options.getCliUrl()); @@ -459,31 +474,52 @@ public CompletableFuture createSession(SessionConfig config) { request.setSystemMessage(extracted.wireSystemMessage()); } - long rpcNanos = System.nanoTime(); - return connection.rpc.invoke("session.create", request, CreateSessionResponse.class).thenApply(response -> { - LoggingHelpers.logTiming(LOG, Level.FINE, - "CopilotClient.createSession session creation request completed. Elapsed={Elapsed}, SessionId=" - + sessionId, - rpcNanos); - session.setWorkspacePath(response.workspacePath()); - session.setCapabilities(response.capabilities()); - // If the server returned a different sessionId (e.g. a v2 CLI that ignores - // the client-supplied ID), re-key the sessions map. - String returnedId = response.sessionId(); - if (returnedId != null && !returnedId.equals(sessionId)) { - sessions.remove(sessionId); - session.setActiveSessionId(returnedId); - sessions.put(returnedId, session); + // Empty mode: validate availableTools and set toolFilterPrecedence + if (options.getMode() == CopilotClientMode.EMPTY) { + if (config.getAvailableTools() == null) { + throw new IllegalArgumentException( + "CopilotClient is in Mode = EMPTY but the session config did not specify " + + "availableTools. Empty mode requires every session to explicitly opt into " + + "the tools it wants — e.g. setAvailableTools(new ToolSet().addBuiltIn(BuiltInTools.ISOLATED))."); } - LoggingHelpers.logTiming(LOG, Level.FINE, - "CopilotClient.createSession complete. Elapsed={Elapsed}, SessionId=" + sessionId, totalNanos); - return session; - }).exceptionally(ex -> { - sessions.remove(sessionId); - LoggingHelpers.logTiming(LOG, Level.WARNING, ex, - "CopilotClient.createSession failed. Elapsed={Elapsed}, SessionId=" + sessionId, totalNanos); - throw ex instanceof RuntimeException re ? re : new RuntimeException(ex); - }); + request.setToolFilterPrecedence("excluded"); + } + + long rpcNanos = System.nanoTime(); + return connection.rpc.invoke("session.create", request, CreateSessionResponse.class) + .thenCompose(response -> { + LoggingHelpers.logTiming(LOG, Level.FINE, + "CopilotClient.createSession session creation request completed. Elapsed={Elapsed}, SessionId=" + + sessionId, + rpcNanos); + session.setWorkspacePath(response.workspacePath()); + session.setCapabilities(response.capabilities()); + // If the server returned a different sessionId (e.g. a v2 CLI that ignores + // the client-supplied ID), re-key the sessions map. + String returnedId = response.sessionId(); + if (returnedId != null && !returnedId.equals(sessionId)) { + sessions.remove(sessionId); + session.setActiveSessionId(returnedId); + sessions.put(returnedId, session); + } + + return updateSessionOptionsForMode(session, config.getSkipCustomInstructions().orElse(null), + config.getCustomAgentsLocalOnly().orElse(null), + config.getCoauthorEnabled().orElse(null), + config.getManageScheduleEnabled().orElse(null)).thenApply(v -> { + LoggingHelpers.logTiming(LOG, Level.FINE, + "CopilotClient.createSession complete. Elapsed={Elapsed}, SessionId=" + + sessionId, + totalNanos); + return session; + }); + }).exceptionally(ex -> { + sessions.remove(sessionId); + LoggingHelpers.logTiming(LOG, Level.WARNING, ex, + "CopilotClient.createSession failed. Elapsed={Elapsed}, SessionId=" + sessionId, + totalNanos); + throw ex instanceof RuntimeException re ? re : new RuntimeException(ex); + }); }); } @@ -544,30 +580,171 @@ public CompletableFuture resumeSession(String sessionId, ResumeS request.setSystemMessage(extracted.wireSystemMessage()); } - long rpcNanos = System.nanoTime(); - return connection.rpc.invoke("session.resume", request, ResumeSessionResponse.class).thenApply(response -> { - LoggingHelpers.logTiming(LOG, Level.FINE, - "CopilotClient.resumeSession session resume request completed. Elapsed={Elapsed}, SessionId=" - + sessionId, - rpcNanos); - session.setWorkspacePath(response.workspacePath()); - session.setCapabilities(response.capabilities()); - // If the server returned a different sessionId than what was requested, re-key. - String returnedId = response.sessionId(); - if (returnedId != null && !returnedId.equals(sessionId)) { - sessions.remove(sessionId); - session.setActiveSessionId(returnedId); - sessions.put(returnedId, session); + // Empty mode: validate availableTools and set toolFilterPrecedence for resume + // path + if (options.getMode() == CopilotClientMode.EMPTY) { + if (config.getAvailableTools() == null) { + throw new IllegalArgumentException( + "CopilotClient is in Mode = EMPTY but the resume session config did not specify " + + "availableTools. Empty mode requires every session to explicitly opt into " + + "the tools it wants — e.g. setAvailableTools(new ToolSet().addBuiltIn(BuiltInTools.ISOLATED))."); } - LoggingHelpers.logTiming(LOG, Level.FINE, - "CopilotClient.resumeSession complete. Elapsed={Elapsed}, SessionId=" + sessionId, totalNanos); - return session; - }).exceptionally(ex -> { - sessions.remove(sessionId); - LoggingHelpers.logTiming(LOG, Level.WARNING, ex, - "CopilotClient.resumeSession failed. Elapsed={Elapsed}, SessionId=" + sessionId, totalNanos); - throw ex instanceof RuntimeException re ? re : new RuntimeException(ex); - }); + request.setToolFilterPrecedence("excluded"); + } + + long rpcNanos = System.nanoTime(); + return connection.rpc.invoke("session.resume", request, ResumeSessionResponse.class) + .thenCompose(response -> { + LoggingHelpers.logTiming(LOG, Level.FINE, + "CopilotClient.resumeSession session resume request completed. Elapsed={Elapsed}, SessionId=" + + sessionId, + rpcNanos); + session.setWorkspacePath(response.workspacePath()); + session.setCapabilities(response.capabilities()); + // If the server returned a different sessionId than what was requested, + // re-key. + String returnedId = response.sessionId(); + if (returnedId != null && !returnedId.equals(sessionId)) { + sessions.remove(sessionId); + session.setActiveSessionId(returnedId); + sessions.put(returnedId, session); + } + + return updateSessionOptionsForMode(session, config.getSkipCustomInstructions().orElse(null), + config.getCustomAgentsLocalOnly().orElse(null), + config.getCoauthorEnabled().orElse(null), + config.getManageScheduleEnabled().orElse(null)).thenApply(v -> { + LoggingHelpers.logTiming(LOG, Level.FINE, + "CopilotClient.resumeSession complete. Elapsed={Elapsed}, SessionId=" + + sessionId, + totalNanos); + return session; + }); + }).exceptionally(ex -> { + sessions.remove(sessionId); + LoggingHelpers.logTiming(LOG, Level.WARNING, ex, + "CopilotClient.resumeSession failed. Elapsed={Elapsed}, SessionId=" + sessionId, + totalNanos); + throw ex instanceof RuntimeException re ? re : new RuntimeException(ex); + }); + }); + } + + /** + * Applies the post-create / post-resume {@code session.options.update} patch. + *

+ * In {@link CopilotClientMode#EMPTY EMPTY} mode this defaults the four + * overridable feature flags to safe values (caller values from the config win); + * {@code installedPlugins=[]} is unconditional under empty mode so apps that + * need plugins must switch modes. In {@link CopilotClientMode#COPILOT_CLI + * COPILOT_CLI} mode only explicitly-set fields are forwarded. + * + * @param session + * the session to patch + * @param skipCustomInstructions + * caller-supplied value, or {@code null} if not set + * @param customAgentsLocalOnly + * caller-supplied value, or {@code null} if not set + * @param coauthorEnabled + * caller-supplied value, or {@code null} if not set + * @param manageScheduleEnabled + * caller-supplied value, or {@code null} if not set + * @return a future that completes when the patch has been applied + */ + CompletableFuture updateSessionOptionsForMode(CopilotSession session, Boolean skipCustomInstructions, + Boolean customAgentsLocalOnly, Boolean coauthorEnabled, Boolean manageScheduleEnabled) { + + Boolean patchSkip = null; + Boolean patchAgents = null; + Boolean patchCoauthor = null; + Boolean patchSchedule = null; + List patchPlugins = null; + boolean hasAnyPatch = false; + + if (options.getMode() == CopilotClientMode.EMPTY) { + patchSkip = skipCustomInstructions != null ? skipCustomInstructions : true; + patchAgents = customAgentsLocalOnly != null ? customAgentsLocalOnly : true; + patchCoauthor = coauthorEnabled != null ? coauthorEnabled : false; + patchSchedule = manageScheduleEnabled != null ? manageScheduleEnabled : false; + patchPlugins = List.of(); + hasAnyPatch = true; + } else { + if (skipCustomInstructions != null) { + patchSkip = skipCustomInstructions; + hasAnyPatch = true; + } + if (customAgentsLocalOnly != null) { + patchAgents = customAgentsLocalOnly; + hasAnyPatch = true; + } + if (coauthorEnabled != null) { + patchCoauthor = coauthorEnabled; + hasAnyPatch = true; + } + if (manageScheduleEnabled != null) { + patchSchedule = manageScheduleEnabled; + hasAnyPatch = true; + } + } + + if (!hasAnyPatch) { + return CompletableFuture.completedFuture(null); + } + + var params = new SessionOptionsUpdateParams(null, // sessionId — set by SessionOptionsApi + null, // model + null, // reasoningEffort + null, // clientName + null, // lspClientName + null, // integrationId + null, // featureFlags + null, // isExperimentalMode + null, // provider + null, // workingDirectory + null, // availableTools + null, // excludedTools + null, // toolFilterPrecedence + null, // enableScriptSafety + null, // shellInitProfile + null, // shellProcessFlags + null, // sandboxConfig + null, // logInteractiveShells + null, // envValueMode + null, // skillDirectories + null, // disabledSkills + null, // enableOnDemandInstructionDiscovery + patchPlugins, // installedPlugins + patchAgents, // customAgentsLocalOnly + patchSkip, // skipCustomInstructions + null, // disabledInstructionSources + patchCoauthor, // coauthorEnabled + null, // trajectoryFile + null, // enableStreaming + null, // copilotUrl + null, // askUserDisabled + null, // continueOnAutoMode + null, // runningInInteractiveMode + null, // enableReasoningSummaries + null, // agentContext + null, // eventsLogDirectory + null, // additionalContentExclusionPolicies + patchSchedule // manageScheduleEnabled + ); + + return session.getRpc().options.update(params).thenCompose(result -> { + LOG.fine("session.options.update applied for session " + session.getSessionId()); + return CompletableFuture.completedFuture(null); + }).exceptionally(ex -> { + // The runtime session exists but the post-create options patch failed. + // Best-effort disconnect so we don't leak it (in empty mode it would + // otherwise stay alive with permissive defaults). + LOG.log(Level.WARNING, "session.options.update failed for session " + session.getSessionId(), ex); + try { + session.close(); + } catch (Exception closeEx) { + // Swallow: original error is the one the caller needs. + } + throw ex instanceof RuntimeException re ? re : new RuntimeException(ex); }); } diff --git a/src/main/java/com/github/copilot/CopilotSession.java b/src/main/java/com/github/copilot/CopilotSession.java index 5b4035959..2651edb0b 100644 --- a/src/main/java/com/github/copilot/CopilotSession.java +++ b/src/main/java/com/github/copilot/CopilotSession.java @@ -81,6 +81,7 @@ import com.github.copilot.rpc.PermissionRequestResult; import com.github.copilot.rpc.PermissionRequestResultKind; import com.github.copilot.rpc.PostToolUseHookInput; +import com.github.copilot.rpc.PostToolUseFailureHookInput; import com.github.copilot.rpc.PreMcpToolCallHookInput; import com.github.copilot.rpc.PreToolUseHookInput; import com.github.copilot.rpc.SendMessageRequest; @@ -1545,44 +1546,73 @@ CompletableFuture handleHooksInvoke(String hookType, JsonNode input) { case "preToolUse" : if (hooks.getOnPreToolUse() != null) { PreToolUseHookInput preInput = MAPPER.treeToValue(input, PreToolUseHookInput.class); - return hooks.getOnPreToolUse().handle(preInput, invocation) - .thenApply(output -> (Object) output); + var preResult = hooks.getOnPreToolUse().handle(preInput, invocation); + if (preResult == null) { + return CompletableFuture.completedFuture(null); + } + return preResult.thenApply(output -> (Object) output); } break; case "preMcpToolCall" : if (hooks.getOnPreMcpToolCall() != null) { PreMcpToolCallHookInput mcpInput = MAPPER.treeToValue(input, PreMcpToolCallHookInput.class); - return hooks.getOnPreMcpToolCall().handle(mcpInput, invocation) - .thenApply(output -> (Object) output); + var mcpResult = hooks.getOnPreMcpToolCall().handle(mcpInput, invocation); + if (mcpResult == null) { + return CompletableFuture.completedFuture(null); + } + return mcpResult.thenApply(output -> (Object) output); } break; case "postToolUse" : if (hooks.getOnPostToolUse() != null) { PostToolUseHookInput postInput = MAPPER.treeToValue(input, PostToolUseHookInput.class); - return hooks.getOnPostToolUse().handle(postInput, invocation) - .thenApply(output -> (Object) output); + var postResult = hooks.getOnPostToolUse().handle(postInput, invocation); + if (postResult == null) { + return CompletableFuture.completedFuture(null); + } + return postResult.thenApply(output -> (Object) output); + } + break; + case "postToolUseFailure" : + if (hooks.getOnPostToolUseFailure() != null) { + PostToolUseFailureHookInput failureInput = MAPPER.treeToValue(input, + PostToolUseFailureHookInput.class); + var failureResult = hooks.getOnPostToolUseFailure().handle(failureInput, invocation); + if (failureResult == null) { + return CompletableFuture.completedFuture(null); + } + return failureResult.thenApply(output -> (Object) output); } break; case "userPromptSubmitted" : if (hooks.getOnUserPromptSubmitted() != null) { UserPromptSubmittedHookInput promptInput = MAPPER.treeToValue(input, UserPromptSubmittedHookInput.class); - return hooks.getOnUserPromptSubmitted().handle(promptInput, invocation) - .thenApply(output -> (Object) output); + var promptResult = hooks.getOnUserPromptSubmitted().handle(promptInput, invocation); + if (promptResult == null) { + return CompletableFuture.completedFuture(null); + } + return promptResult.thenApply(output -> (Object) output); } break; case "sessionStart" : if (hooks.getOnSessionStart() != null) { SessionStartHookInput startInput = MAPPER.treeToValue(input, SessionStartHookInput.class); - return hooks.getOnSessionStart().handle(startInput, invocation) - .thenApply(output -> (Object) output); + var startResult = hooks.getOnSessionStart().handle(startInput, invocation); + if (startResult == null) { + return CompletableFuture.completedFuture(null); + } + return startResult.thenApply(output -> (Object) output); } break; case "sessionEnd" : if (hooks.getOnSessionEnd() != null) { SessionEndHookInput endInput = MAPPER.treeToValue(input, SessionEndHookInput.class); - return hooks.getOnSessionEnd().handle(endInput, invocation) - .thenApply(output -> (Object) output); + var endResult = hooks.getOnSessionEnd().handle(endInput, invocation); + if (endResult == null) { + return CompletableFuture.completedFuture(null); + } + return endResult.thenApply(output -> (Object) output); } break; default : diff --git a/src/main/java/com/github/copilot/rpc/AgentMode.java b/src/main/java/com/github/copilot/rpc/AgentMode.java index 84054e35b..4a286dca3 100644 --- a/src/main/java/com/github/copilot/rpc/AgentMode.java +++ b/src/main/java/com/github/copilot/rpc/AgentMode.java @@ -14,7 +14,7 @@ * specific mode; defaults to the session's current mode when unset. * * @see MessageOptions - * @since 1.1.0 + * @since 1.0.0 */ public enum AgentMode { @@ -67,6 +67,6 @@ public static AgentMode fromValue(String value) { return mode; } } - throw new IllegalArgumentException("Unknown AgentMode: " + value); + throw new IllegalArgumentException("Unknown AgentMode value: " + value); } } diff --git a/src/main/java/com/github/copilot/rpc/BuiltInTools.java b/src/main/java/com/github/copilot/rpc/BuiltInTools.java new file mode 100644 index 000000000..090c362ce --- /dev/null +++ b/src/main/java/com/github/copilot/rpc/BuiltInTools.java @@ -0,0 +1,37 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +package com.github.copilot.rpc; + +import java.util.Collections; +import java.util.List; + +/** + * Curated sets of built-in tool names for common scenarios. Each constant is + * meant to be passed to {@link ToolSet#addBuiltIn(java.util.Collection)}. + * + * @since 1.3.0 + */ +public final class BuiltInTools { + + /** + * Built-in tools that operate only within the bounds of a single session — no + * host filesystem access outside the session, no cross-session state, no host + * environment access, no network. Safe to enable in + * {@link CopilotClientMode#EMPTY} scenarios (e.g. multi-tenant servers) without + * leaking host capabilities. + *

+ * Contract: tools in this set MUST NOT be extended (even behind options + * or args) to read or write state outside the session boundary. Adding + * cross-session or host-state behavior to one of these tools is a breaking + * change that requires removing it from this set. + */ + public static final List ISOLATED = Collections + .unmodifiableList(List.of("ask_user", "task_complete", "exit_plan_mode", "task", "read_agent", + "write_agent", "list_agents", "send_inbox", "context_board", "skill")); + + private BuiltInTools() { + // utility class + } +} diff --git a/src/main/java/com/github/copilot/rpc/CopilotClientMode.java b/src/main/java/com/github/copilot/rpc/CopilotClientMode.java new file mode 100644 index 000000000..9298f76b5 --- /dev/null +++ b/src/main/java/com/github/copilot/rpc/CopilotClientMode.java @@ -0,0 +1,45 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +package com.github.copilot.rpc; + +/** + * Selects the defaulting strategy used by + * {@link com.github.copilot.CopilotClient}. + * + * @since 1.3.0 + */ +public enum CopilotClientMode { + + /** + * Disables optional features by default. The app must explicitly opt into + * anything it needs. Required for any scenario where CLI-like ambient behavior + * is unsafe (e.g., multi-user servers). + *

+ * When this mode is selected: + *

    + *
  • The client constructor requires + * {@link CopilotClientOptions#getCopilotHome()} or + * {@link CopilotClientOptions#getCliUrl()} to be set.
  • + *
  • {@link SessionConfig#getAvailableTools()} must be supplied on every + * session — no tools are exposed by default.
  • + *
  • {@code session.create} always sets + * {@code toolFilterPrecedence: "excluded"} so the allowlist and denylist + * compose naturally.
  • + *
  • The SDK injects safe defaults for ambient session features (telemetry, + * custom instructions, plugins, environment context, etc.).
  • + *
+ */ + EMPTY, + + /** + * Uses defaults equivalent to GitHub Copilot CLI. The default. Useful when + * building a coding agent that shares sessions with Copilot CLI. + *

+ * Do not use this mode for server-based multi-user applications — the + * default coding agent has tools and capabilities that operate across sessions + * and can access the host OS environment. + */ + COPILOT_CLI +} diff --git a/src/main/java/com/github/copilot/rpc/CopilotClientOptions.java b/src/main/java/com/github/copilot/rpc/CopilotClientOptions.java index cb372d914..69464aa72 100644 --- a/src/main/java/com/github/copilot/rpc/CopilotClientOptions.java +++ b/src/main/java/com/github/copilot/rpc/CopilotClientOptions.java @@ -53,6 +53,7 @@ public class CopilotClientOptions { private Executor executor; private String gitHubToken; private String logLevel = "info"; + private CopilotClientMode mode = CopilotClientMode.COPILOT_CLI; private Supplier>> onListModels; private int port; private TelemetryConfig telemetry; @@ -391,6 +392,35 @@ public CopilotClientOptions setLogLevel(String logLevel) { return this; } + /** + * Gets the SDK defaulting strategy. + * + * @return the client mode (never {@code null}) + * @since 1.3.0 + */ + public CopilotClientMode getMode() { + return mode; + } + + /** + * Sets the SDK defaulting strategy. + *

+ * When set to {@link CopilotClientMode#EMPTY}, the SDK validates that the app + * has supplied the required configuration (e.g. + * {@link #setCopilotHome(String)}) and translates session creation requests + * into runtime options that flip tool filter precedence to + * {@code excluded}-wins so exclusions are expressible. + * + * @param mode + * the client mode + * @return this options instance for method chaining + * @since 1.3.0 + */ + public CopilotClientOptions setMode(CopilotClientMode mode) { + this.mode = Objects.requireNonNull(mode, "mode must not be null"); + return this; + } + /** * Gets the custom handler for listing available models. * diff --git a/src/main/java/com/github/copilot/rpc/CreateSessionRequest.java b/src/main/java/com/github/copilot/rpc/CreateSessionRequest.java index ae353f8e4..1354e8c33 100644 --- a/src/main/java/com/github/copilot/rpc/CreateSessionRequest.java +++ b/src/main/java/com/github/copilot/rpc/CreateSessionRequest.java @@ -48,6 +48,9 @@ public final class CreateSessionRequest { @JsonProperty("excludedTools") private List excludedTools; + @JsonProperty("toolFilterPrecedence") + private String toolFilterPrecedence; + @JsonProperty("provider") private ProviderConfig provider; @@ -211,6 +214,19 @@ public void setExcludedTools(List excludedTools) { this.excludedTools = excludedTools; } + /** Gets the tool filter precedence. @return the precedence value */ + public String getToolFilterPrecedence() { + return toolFilterPrecedence; + } + + /** + * Sets the tool filter precedence. @param toolFilterPrecedence the precedence + * ("excluded" or null) + */ + public void setToolFilterPrecedence(String toolFilterPrecedence) { + this.toolFilterPrecedence = toolFilterPrecedence; + } + /** Gets the provider config. @return the provider */ public ProviderConfig getProvider() { return provider; diff --git a/src/main/java/com/github/copilot/rpc/PermissionRequestResult.java b/src/main/java/com/github/copilot/rpc/PermissionRequestResult.java index 6c611a064..2e5c60100 100644 --- a/src/main/java/com/github/copilot/rpc/PermissionRequestResult.java +++ b/src/main/java/com/github/copilot/rpc/PermissionRequestResult.java @@ -39,6 +39,56 @@ public final class PermissionRequestResult { @JsonProperty("rules") private List rules; + @JsonProperty("feedback") + private String feedback; + + /** + * Creates a result that approves this single request. + * + * @return a new approved result + * @since 1.3.0 + */ + public static PermissionRequestResult approveOnce() { + return new PermissionRequestResult().setKind(PermissionRequestResultKind.APPROVED); + } + + /** + * Creates a result that rejects the request, optionally forwarding feedback to + * the LLM. + * + * @param feedback + * optional feedback message, or {@code null} + * @return a new rejected result + * @since 1.3.0 + */ + public static PermissionRequestResult reject(String feedback) { + var result = new PermissionRequestResult().setKind(PermissionRequestResultKind.REJECTED); + result.setFeedback(feedback); + return result; + } + + /** + * Creates a result denying the request because no user is available to confirm + * it. + * + * @return a new user-not-available result + * @since 1.3.0 + */ + public static PermissionRequestResult userNotAvailable() { + return new PermissionRequestResult().setKind(PermissionRequestResultKind.USER_NOT_AVAILABLE); + } + + /** + * Creates a result that declines to respond to this permission request, + * allowing another connected client to answer instead. + * + * @return a new no-result result + * @since 1.3.0 + */ + public static PermissionRequestResult noResult() { + return new PermissionRequestResult().setKind(PermissionRequestResultKind.NO_RESULT); + } + /** * Gets the result kind as a string. * @@ -93,4 +143,29 @@ public PermissionRequestResult setRules(List rules) { this.rules = rules; return this; } + + /** + * Gets optional human-readable feedback to forward to the LLM along with the + * decision. + * + * @return the feedback message, or {@code null} + * @since 1.3.0 + */ + public String getFeedback() { + return feedback; + } + + /** + * Sets optional human-readable feedback to forward to the LLM along with the + * decision. + * + * @param feedback + * the feedback message + * @return this result for method chaining + * @since 1.3.0 + */ + public PermissionRequestResult setFeedback(String feedback) { + this.feedback = feedback; + return this; + } } diff --git a/src/main/java/com/github/copilot/rpc/PostToolUseFailureHandler.java b/src/main/java/com/github/copilot/rpc/PostToolUseFailureHandler.java new file mode 100644 index 000000000..0b648ecbf --- /dev/null +++ b/src/main/java/com/github/copilot/rpc/PostToolUseFailureHandler.java @@ -0,0 +1,33 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +package com.github.copilot.rpc; + +import java.util.concurrent.CompletableFuture; + +/** + * Handler for post-tool-use-failure hooks. + *

+ * This hook is called after a tool execution whose result was a failure. + * {@link PostToolUseHandler} only fires for successful tool executions; + * register this handler in addition to observe failed tool calls. + * + * @since 1.3.0 + */ +@FunctionalInterface +public interface PostToolUseFailureHandler { + + /** + * Handles a post-tool-use-failure hook invocation. + * + * @param input + * the hook input containing tool name, arguments, and error message + * @param invocation + * context information about the invocation + * @return a future that resolves with the hook output, or {@code null} to use + * defaults + */ + CompletableFuture handle(PostToolUseFailureHookInput input, + HookInvocation invocation); +} diff --git a/src/main/java/com/github/copilot/rpc/PostToolUseFailureHookInput.java b/src/main/java/com/github/copilot/rpc/PostToolUseFailureHookInput.java new file mode 100644 index 000000000..820976b96 --- /dev/null +++ b/src/main/java/com/github/copilot/rpc/PostToolUseFailureHookInput.java @@ -0,0 +1,166 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +package com.github.copilot.rpc; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.JsonNode; + +/** + * Input for a post-tool-use-failure hook. + *

+ * Fires after a tool execution whose result was "failure". The CLI extracts the + * failure message from the tool result and passes it as the {@link #getError()} + * field (rather than passing the full result object). + * + * @since 1.3.0 + */ +@JsonIgnoreProperties(ignoreUnknown = true) +public class PostToolUseFailureHookInput { + + @JsonProperty("sessionId") + private String sessionId; + + @JsonProperty("timestamp") + private long timestamp; + + @JsonProperty("cwd") + private String cwd; + + @JsonProperty("toolName") + private String toolName; + + @JsonProperty("toolArgs") + private JsonNode toolArgs; + + @JsonProperty("error") + private String error; + + /** + * Gets the runtime session ID of the session that triggered the hook. + * + * @return the session ID + */ + public String getSessionId() { + return sessionId; + } + + /** + * Sets the runtime session ID of the session that triggered the hook. + * + * @param sessionId + * the session ID + * @return this instance for method chaining + */ + public PostToolUseFailureHookInput setSessionId(String sessionId) { + this.sessionId = sessionId; + return this; + } + + /** + * Gets the timestamp of the hook invocation. + * + * @return the timestamp in milliseconds + */ + public long getTimestamp() { + return timestamp; + } + + /** + * Sets the timestamp of the hook invocation. + * + * @param timestamp + * the timestamp in milliseconds + * @return this instance for method chaining + */ + public PostToolUseFailureHookInput setTimestamp(long timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + * Gets the current working directory. + * + * @return the working directory path + */ + public String getCwd() { + return cwd; + } + + /** + * Sets the current working directory. + * + * @param cwd + * the working directory path + * @return this instance for method chaining + */ + public PostToolUseFailureHookInput setCwd(String cwd) { + this.cwd = cwd; + return this; + } + + /** + * Gets the name of the tool that failed. + * + * @return the tool name + */ + public String getToolName() { + return toolName; + } + + /** + * Sets the name of the tool that failed. + * + * @param toolName + * the tool name + * @return this instance for method chaining + */ + public PostToolUseFailureHookInput setToolName(String toolName) { + this.toolName = toolName; + return this; + } + + /** + * Gets the arguments passed to the tool. + * + * @return the tool arguments as a JSON node + */ + public JsonNode getToolArgs() { + return toolArgs; + } + + /** + * Sets the arguments passed to the tool. + * + * @param toolArgs + * the tool arguments as a JSON node + * @return this instance for method chaining + */ + public PostToolUseFailureHookInput setToolArgs(JsonNode toolArgs) { + this.toolArgs = toolArgs; + return this; + } + + /** + * Gets the failure message extracted from the tool's result. + * + * @return the error message + */ + public String getError() { + return error; + } + + /** + * Sets the failure message extracted from the tool's result. + * + * @param error + * the error message + * @return this instance for method chaining + */ + public PostToolUseFailureHookInput setError(String error) { + this.error = error; + return this; + } +} diff --git a/src/main/java/com/github/copilot/rpc/PostToolUseFailureHookOutput.java b/src/main/java/com/github/copilot/rpc/PostToolUseFailureHookOutput.java new file mode 100644 index 000000000..ec37cc2f3 --- /dev/null +++ b/src/main/java/com/github/copilot/rpc/PostToolUseFailureHookOutput.java @@ -0,0 +1,45 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +package com.github.copilot.rpc; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Output for a post-tool-use-failure hook. + *

+ * Only {@link #getAdditionalContext()} is consumed by the host CLI — it is + * appended as hidden guidance to the model alongside the failed tool result. + * + * @since 1.3.0 + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +public class PostToolUseFailureHookOutput { + + @JsonProperty("additionalContext") + private String additionalContext; + + /** + * Gets the additional context to inject into the conversation. + * + * @return the additional context, or {@code null} + */ + public String getAdditionalContext() { + return additionalContext; + } + + /** + * Sets the additional context to inject into the conversation for the language + * model. + * + * @param additionalContext + * the additional context + * @return this instance for method chaining + */ + public PostToolUseFailureHookOutput setAdditionalContext(String additionalContext) { + this.additionalContext = additionalContext; + return this; + } +} diff --git a/src/main/java/com/github/copilot/rpc/ResumeSessionConfig.java b/src/main/java/com/github/copilot/rpc/ResumeSessionConfig.java index e110af3ff..fa28258b3 100644 --- a/src/main/java/com/github/copilot/rpc/ResumeSessionConfig.java +++ b/src/main/java/com/github/copilot/rpc/ResumeSessionConfig.java @@ -46,6 +46,10 @@ public class ResumeSessionConfig { private List excludedTools; private ProviderConfig provider; private Boolean enableSessionTelemetry; + private Boolean skipCustomInstructions; + private Boolean customAgentsLocalOnly; + private Boolean coauthorEnabled; + private Boolean manageScheduleEnabled; private String reasoningEffort; private ModelCapabilitiesOverride modelCapabilities; private PermissionHandler onPermissionRequest; @@ -279,6 +283,168 @@ public ResumeSessionConfig clearEnableSessionTelemetry() { return this; } + /** + * Gets whether custom instruction file loading is suppressed. + * + * @return {@code true} to suppress, or empty if not explicitly set + * @since 1.3.0 + */ + @JsonIgnore + public Optional getSkipCustomInstructions() { + return Optional.ofNullable(skipCustomInstructions); + } + + /** + * Sets whether to suppress loading of custom instruction files. + *

+ * This option is sent to the server via a {@code session.options.update} + * JSON-RPC call immediately after session resume. In + * {@link CopilotClientMode#EMPTY EMPTY} mode the default is {@code true} + * (skip); in {@link CopilotClientMode#COPILOT_CLI COPILOT_CLI} mode the value + * is forwarded only when explicitly set. + * + * @param skipCustomInstructions + * whether to skip custom instructions + * @return this config instance for method chaining + * @since 1.3.0 + */ + public ResumeSessionConfig setSkipCustomInstructions(boolean skipCustomInstructions) { + this.skipCustomInstructions = skipCustomInstructions; + return this; + } + + /** + * Clears the skipCustomInstructions setting. + * + * @return this instance for method chaining + */ + public ResumeSessionConfig clearSkipCustomInstructions() { + this.skipCustomInstructions = null; + return this; + } + + /** + * Gets whether custom-agent discovery is restricted to local only. + * + * @return {@code true} for local only, or empty if not explicitly set + * @since 1.3.0 + */ + @JsonIgnore + public Optional getCustomAgentsLocalOnly() { + return Optional.ofNullable(customAgentsLocalOnly); + } + + /** + * Sets whether custom-agent discovery is restricted to the session's local + * working directory. + *

+ * This option is sent to the server via a {@code session.options.update} + * JSON-RPC call immediately after session resume. In + * {@link CopilotClientMode#EMPTY EMPTY} mode the default is {@code true} (local + * only); in {@link CopilotClientMode#COPILOT_CLI COPILOT_CLI} mode the value is + * forwarded only when explicitly set. + * + * @param customAgentsLocalOnly + * whether to restrict to local agents + * @return this config instance for method chaining + * @since 1.3.0 + */ + public ResumeSessionConfig setCustomAgentsLocalOnly(boolean customAgentsLocalOnly) { + this.customAgentsLocalOnly = customAgentsLocalOnly; + return this; + } + + /** + * Clears the customAgentsLocalOnly setting. + * + * @return this instance for method chaining + */ + public ResumeSessionConfig clearCustomAgentsLocalOnly() { + this.customAgentsLocalOnly = null; + return this; + } + + /** + * Gets whether the runtime may append a Co-authored-by trailer. + * + * @return the coauthor enabled flag, or empty if not explicitly set + * @since 1.3.0 + */ + @JsonIgnore + public Optional getCoauthorEnabled() { + return Optional.ofNullable(coauthorEnabled); + } + + /** + * Sets whether the runtime is allowed to append a {@code Co-authored-by} + * trailer. + *

+ * This option is sent to the server via a {@code session.options.update} + * JSON-RPC call immediately after session resume. In + * {@link CopilotClientMode#EMPTY EMPTY} mode the default is {@code false} + * (disabled); in {@link CopilotClientMode#COPILOT_CLI COPILOT_CLI} mode the + * value is forwarded only when explicitly set. + * + * @param coauthorEnabled + * whether coauthor is enabled + * @return this config instance for method chaining + * @since 1.3.0 + */ + public ResumeSessionConfig setCoauthorEnabled(boolean coauthorEnabled) { + this.coauthorEnabled = coauthorEnabled; + return this; + } + + /** + * Clears the coauthorEnabled setting. + * + * @return this instance for method chaining + */ + public ResumeSessionConfig clearCoauthorEnabled() { + this.coauthorEnabled = null; + return this; + } + + /** + * Gets whether the manage_schedule tool is enabled. + * + * @return the manage schedule flag, or empty if not explicitly set + * @since 1.3.0 + */ + @JsonIgnore + public Optional getManageScheduleEnabled() { + return Optional.ofNullable(manageScheduleEnabled); + } + + /** + * Sets whether to enable the {@code manage_schedule} tool. + *

+ * This option is sent to the server via a {@code session.options.update} + * JSON-RPC call immediately after session resume. In + * {@link CopilotClientMode#EMPTY EMPTY} mode the default is {@code false} + * (disabled); in {@link CopilotClientMode#COPILOT_CLI COPILOT_CLI} mode the + * value is forwarded only when explicitly set. + * + * @param manageScheduleEnabled + * whether manage schedule is enabled + * @return this config instance for method chaining + * @since 1.3.0 + */ + public ResumeSessionConfig setManageScheduleEnabled(boolean manageScheduleEnabled) { + this.manageScheduleEnabled = manageScheduleEnabled; + return this; + } + + /** + * Clears the manageScheduleEnabled setting. + * + * @return this instance for method chaining + */ + public ResumeSessionConfig clearManageScheduleEnabled() { + this.manageScheduleEnabled = null; + return this; + } + /** * Gets the reasoning effort level. * diff --git a/src/main/java/com/github/copilot/rpc/ResumeSessionRequest.java b/src/main/java/com/github/copilot/rpc/ResumeSessionRequest.java index bd8613d54..4321a24aa 100644 --- a/src/main/java/com/github/copilot/rpc/ResumeSessionRequest.java +++ b/src/main/java/com/github/copilot/rpc/ResumeSessionRequest.java @@ -50,6 +50,9 @@ public final class ResumeSessionRequest { @JsonProperty("excludedTools") private List excludedTools; + @JsonProperty("toolFilterPrecedence") + private String toolFilterPrecedence; + @JsonProperty("provider") private ProviderConfig provider; @@ -216,6 +219,19 @@ public void setExcludedTools(List excludedTools) { this.excludedTools = excludedTools; } + /** Gets the tool filter precedence. @return the precedence value */ + public String getToolFilterPrecedence() { + return toolFilterPrecedence; + } + + /** + * Sets the tool filter precedence. @param toolFilterPrecedence the precedence + * ("excluded" or null) + */ + public void setToolFilterPrecedence(String toolFilterPrecedence) { + this.toolFilterPrecedence = toolFilterPrecedence; + } + /** Gets the provider config. @return the provider */ public ProviderConfig getProvider() { return provider; diff --git a/src/main/java/com/github/copilot/rpc/SessionConfig.java b/src/main/java/com/github/copilot/rpc/SessionConfig.java index 3ba19d8c2..2a42df610 100644 --- a/src/main/java/com/github/copilot/rpc/SessionConfig.java +++ b/src/main/java/com/github/copilot/rpc/SessionConfig.java @@ -48,6 +48,10 @@ public class SessionConfig { private List excludedTools; private ProviderConfig provider; private Boolean enableSessionTelemetry; + private Boolean skipCustomInstructions; + private Boolean customAgentsLocalOnly; + private Boolean coauthorEnabled; + private Boolean manageScheduleEnabled; private PermissionHandler onPermissionRequest; private UserInputHandler onUserInputRequest; private SessionHooks hooks; @@ -334,6 +338,175 @@ public SessionConfig clearEnableSessionTelemetry() { return this; } + /** + * Gets whether custom instruction file loading is suppressed. + * + * @return {@code true} to suppress, or empty if not explicitly set + * @since 1.3.0 + */ + @JsonIgnore + public Optional getSkipCustomInstructions() { + return Optional.ofNullable(skipCustomInstructions); + } + + /** + * Sets whether to suppress loading of custom instruction files (e.g. + * {@code .github/copilot-instructions.md}, {@code AGENTS.md}) from the working + * directory. + *

+ * This option is sent to the server via a {@code session.options.update} + * JSON-RPC call immediately after session creation. In + * {@link CopilotClientMode#EMPTY EMPTY} mode the default is {@code true} + * (skip); in {@link CopilotClientMode#COPILOT_CLI COPILOT_CLI} mode the value + * is forwarded only when explicitly set. + * + * @param skipCustomInstructions + * whether to skip custom instructions + * @return this config instance for method chaining + * @since 1.3.0 + */ + public SessionConfig setSkipCustomInstructions(boolean skipCustomInstructions) { + this.skipCustomInstructions = skipCustomInstructions; + return this; + } + + /** + * Clears the skipCustomInstructions setting. + * + * @return this instance for method chaining + * @since 1.3.0 + */ + public SessionConfig clearSkipCustomInstructions() { + this.skipCustomInstructions = null; + return this; + } + + /** + * Gets whether custom-agent discovery is restricted to local only. + * + * @return {@code true} for local only, or empty if not explicitly set + * @since 1.3.0 + */ + @JsonIgnore + public Optional getCustomAgentsLocalOnly() { + return Optional.ofNullable(customAgentsLocalOnly); + } + + /** + * Sets whether custom-agent discovery is restricted to the session's local + * working directory (no organisation-level discovery). + *

+ * This option is sent to the server via a {@code session.options.update} + * JSON-RPC call immediately after session creation. In + * {@link CopilotClientMode#EMPTY EMPTY} mode the default is {@code true} (local + * only); in {@link CopilotClientMode#COPILOT_CLI COPILOT_CLI} mode the value is + * forwarded only when explicitly set. + * + * @param customAgentsLocalOnly + * whether to restrict to local agents + * @return this config instance for method chaining + * @since 1.3.0 + */ + public SessionConfig setCustomAgentsLocalOnly(boolean customAgentsLocalOnly) { + this.customAgentsLocalOnly = customAgentsLocalOnly; + return this; + } + + /** + * Clears the customAgentsLocalOnly setting. + * + * @return this instance for method chaining + * @since 1.3.0 + */ + public SessionConfig clearCustomAgentsLocalOnly() { + this.customAgentsLocalOnly = null; + return this; + } + + /** + * Gets whether the runtime may append a Co-authored-by trailer. + * + * @return the coauthor enabled flag, or empty if not explicitly set + * @since 1.3.0 + */ + @JsonIgnore + public Optional getCoauthorEnabled() { + return Optional.ofNullable(coauthorEnabled); + } + + /** + * Sets whether the runtime is allowed to append a {@code Co-authored-by} + * trailer when it commits on behalf of the user. + *

+ * This option is sent to the server via a {@code session.options.update} + * JSON-RPC call immediately after session creation. In + * {@link CopilotClientMode#EMPTY EMPTY} mode the default is {@code false} + * (disabled); in {@link CopilotClientMode#COPILOT_CLI COPILOT_CLI} mode the + * value is forwarded only when explicitly set. + * + * @param coauthorEnabled + * whether coauthor is enabled + * @return this config instance for method chaining + * @since 1.3.0 + */ + public SessionConfig setCoauthorEnabled(boolean coauthorEnabled) { + this.coauthorEnabled = coauthorEnabled; + return this; + } + + /** + * Clears the coauthorEnabled setting. + * + * @return this instance for method chaining + * @since 1.3.0 + */ + public SessionConfig clearCoauthorEnabled() { + this.coauthorEnabled = null; + return this; + } + + /** + * Gets whether the manage_schedule tool is enabled. + * + * @return the manage schedule flag, or empty if not explicitly set + * @since 1.3.0 + */ + @JsonIgnore + public Optional getManageScheduleEnabled() { + return Optional.ofNullable(manageScheduleEnabled); + } + + /** + * Sets whether to enable the {@code manage_schedule} tool (host scheduler + * integration). + *

+ * This option is sent to the server via a {@code session.options.update} + * JSON-RPC call immediately after session creation. In + * {@link CopilotClientMode#EMPTY EMPTY} mode the default is {@code false} + * (disabled); in {@link CopilotClientMode#COPILOT_CLI COPILOT_CLI} mode the + * value is forwarded only when explicitly set. + * + * @param manageScheduleEnabled + * whether manage schedule is enabled + * @return this config instance for method chaining + * @since 1.3.0 + */ + public SessionConfig setManageScheduleEnabled(boolean manageScheduleEnabled) { + this.manageScheduleEnabled = manageScheduleEnabled; + return this; + } + + /** + * Clears the manageScheduleEnabled setting. + * + * @return this instance for method chaining + * @since 1.3.0 + */ + public SessionConfig clearManageScheduleEnabled() { + this.manageScheduleEnabled = null; + return this; + } + /** * Gets the permission request handler. * @@ -1033,6 +1206,10 @@ public SessionConfig clone() { copy.excludedTools = this.excludedTools != null ? new ArrayList<>(this.excludedTools) : null; copy.provider = this.provider; copy.enableSessionTelemetry = this.enableSessionTelemetry; + copy.skipCustomInstructions = this.skipCustomInstructions; + copy.customAgentsLocalOnly = this.customAgentsLocalOnly; + copy.coauthorEnabled = this.coauthorEnabled; + copy.manageScheduleEnabled = this.manageScheduleEnabled; copy.onPermissionRequest = this.onPermissionRequest; copy.onUserInputRequest = this.onUserInputRequest; copy.hooks = this.hooks; diff --git a/src/main/java/com/github/copilot/rpc/SessionHooks.java b/src/main/java/com/github/copilot/rpc/SessionHooks.java index ebfeffe33..f13e08131 100644 --- a/src/main/java/com/github/copilot/rpc/SessionHooks.java +++ b/src/main/java/com/github/copilot/rpc/SessionHooks.java @@ -40,6 +40,7 @@ public class SessionHooks { private PreToolUseHandler onPreToolUse; private PreMcpToolCallHandler onPreMcpToolCall; private PostToolUseHandler onPostToolUse; + private PostToolUseFailureHandler onPostToolUseFailure; private UserPromptSubmittedHandler onUserPromptSubmitted; private SessionStartHandler onSessionStart; private SessionEndHandler onSessionEnd; @@ -110,6 +111,32 @@ public SessionHooks setOnPostToolUse(PostToolUseHandler onPostToolUse) { return this; } + /** + * Gets the post-tool-use-failure handler. + * + * @return the handler, or {@code null} if not set + * @since 1.3.0 + */ + public PostToolUseFailureHandler getOnPostToolUseFailure() { + return onPostToolUseFailure; + } + + /** + * Sets the handler called after a tool execution whose result was a failure. + *

+ * {@link #getOnPostToolUse()} only fires for successful tool executions; + * register this handler in addition to observe failed tool calls. + * + * @param onPostToolUseFailure + * the handler + * @return this instance for method chaining + * @since 1.3.0 + */ + public SessionHooks setOnPostToolUseFailure(PostToolUseFailureHandler onPostToolUseFailure) { + this.onPostToolUseFailure = onPostToolUseFailure; + return this; + } + /** * Gets the user-prompt-submitted handler. * @@ -185,7 +212,7 @@ public SessionHooks setOnSessionEnd(SessionEndHandler onSessionEnd) { * @return {@code true} if at least one hook handler is set */ public boolean hasHooks() { - return onPreToolUse != null || onPreMcpToolCall != null || onPostToolUse != null + return onPreToolUse != null || onPreMcpToolCall != null || onPostToolUse != null || onPostToolUseFailure != null || onUserPromptSubmitted != null || onSessionStart != null || onSessionEnd != null; } } diff --git a/src/main/java/com/github/copilot/rpc/SystemPromptSections.java b/src/main/java/com/github/copilot/rpc/SystemPromptSections.java index c68fcbe0c..0aaf0113e 100644 --- a/src/main/java/com/github/copilot/rpc/SystemPromptSections.java +++ b/src/main/java/com/github/copilot/rpc/SystemPromptSections.java @@ -54,6 +54,15 @@ public final class SystemPromptSections { /** Repository and organization custom instructions. */ public static final String CUSTOM_INSTRUCTIONS = "custom_instructions"; + /** + * Runtime-provided context and instructions (e.g. system notifications, + * memories, workspace context, mode-specific instructions, content-exclusion + * policy). + * + * @since 1.3.0 + */ + public static final String RUNTIME_INSTRUCTIONS = "runtime_instructions"; + /** * End-of-prompt instructions: parallel tool calling, persistence, task * completion. diff --git a/src/main/java/com/github/copilot/rpc/ToolSet.java b/src/main/java/com/github/copilot/rpc/ToolSet.java new file mode 100644 index 000000000..5009223a1 --- /dev/null +++ b/src/main/java/com/github/copilot/rpc/ToolSet.java @@ -0,0 +1,122 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +package com.github.copilot.rpc; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Objects; +import java.util.regex.Pattern; + +/** + * Builder for {@link SessionConfig#setAvailableTools(java.util.List)} / + * {@link SessionConfig#setExcludedTools(java.util.List)} using source-qualified + * filter patterns ({@code builtin:*}, {@code mcp:}, {@code custom:*}, + * etc.). + *

+ * Tools are classified by the runtime at registration time (not from name + * parsing), so {@link #addBuiltIn(String)} matches only tools the runtime + * registered as built-in, even if an MCP server or custom-agent extension + * happens to register a tool with the same wire name. + *

+ * {@code ToolSet} extends {@link ArrayList} so instances can be passed directly + * to {@link SessionConfig#setAvailableTools(java.util.List)} or + * {@link SessionConfig#setExcludedTools(java.util.List)}. + * + *

Example

+ * + *
{@code
+ * var session = client
+ * 		.createSession(new SessionConfig()
+ * 				.setAvailableTools(new ToolSet().addBuiltIn(BuiltInTools.ISOLATED).addMcp("*").addCustom("*")))
+ * 		.get();
+ * }
+ * + * @since 1.3.0 + */ +public class ToolSet extends ArrayList { + + private static final Pattern VALID_TOOL_NAME = Pattern.compile("^[a-zA-Z0-9_-]+$"); + + /** + * Adds a built-in tool pattern. + * + * @param name + * a specific built-in tool name (e.g. {@code "bash"}) or {@code "*"} + * to match all built-in tools + * @return this {@code ToolSet} for chaining + * @throws IllegalArgumentException + * if name is null, empty, or contains invalid characters + */ + public ToolSet addBuiltIn(String name) { + validateName("builtin", name); + add("builtin:" + name); + return this; + } + + /** + * Adds a list of built-in tool patterns (e.g. {@link BuiltInTools#ISOLATED}). + * + * @param names + * built-in tool names to add + * @return this {@code ToolSet} for chaining + * @throws NullPointerException + * if names is null + */ + public ToolSet addBuiltIn(Collection names) { + Objects.requireNonNull(names, "names must not be null"); + for (String name : names) { + addBuiltIn(name); + } + return this; + } + + /** + * Adds a custom tool pattern. Matches tools registered via the SDK's + * {@link SessionConfig#setTools(java.util.List)} option or via custom agents. + * + * @param name + * a specific custom tool name or {@code "*"} to match all custom + * tools + * @return this {@code ToolSet} for chaining + * @throws IllegalArgumentException + * if name is null, empty, or contains invalid characters + */ + public ToolSet addCustom(String name) { + validateName("custom", name); + add("custom:" + name); + return this; + } + + /** + * Adds an MCP tool pattern. Matches tools advertised by any configured MCP + * server. + * + * @param toolName + * the runtime's canonical wire name for the MCP tool (e.g. + * {@code "github-list_issues"}), or {@code "*"} to match all MCP + * tools from any server + * @return this {@code ToolSet} for chaining + * @throws IllegalArgumentException + * if toolName is null, empty, or contains invalid characters + */ + public ToolSet addMcp(String toolName) { + validateName("mcp", toolName); + add("mcp:" + toolName); + return this; + } + + private static void validateName(String kind, String name) { + if (name == null || name.isEmpty()) { + throw new IllegalArgumentException("Invalid " + kind + " tool name: must not be null or empty."); + } + if ("*".equals(name)) { + return; + } + if (!VALID_TOOL_NAME.matcher(name).matches()) { + throw new IllegalArgumentException("Invalid " + kind + " tool name '" + name + + "': tool names must match /^[a-zA-Z0-9_-]+$/ or be the wildcard '*'."); + } + } +} diff --git a/src/test/java/com/github/copilot/AgentModeTest.java b/src/test/java/com/github/copilot/AgentModeTest.java new file mode 100644 index 000000000..dd1aa01de --- /dev/null +++ b/src/test/java/com/github/copilot/AgentModeTest.java @@ -0,0 +1,70 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +package com.github.copilot; + +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.EnumSource; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.github.copilot.rpc.AgentMode; + +/** + * Unit tests for {@link AgentMode} serialization, deserialization, and + * unknown-value behavior. + */ +public class AgentModeTest { + + private final ObjectMapper mapper = new ObjectMapper(); + + @ParameterizedTest + @EnumSource(AgentMode.class) + void jsonRoundTrip_allValues(AgentMode mode) throws Exception { + String json = mapper.writeValueAsString(mode); + AgentMode deserialized = mapper.readValue(json, AgentMode.class); + assertEquals(mode, deserialized); + } + + @Test + void getValue_returnsExpectedStrings() { + assertEquals("interactive", AgentMode.INTERACTIVE.getValue()); + assertEquals("plan", AgentMode.PLAN.getValue()); + assertEquals("autopilot", AgentMode.AUTOPILOT.getValue()); + assertEquals("shell", AgentMode.SHELL.getValue()); + } + + @Test + void fromValue_knownValues_returnsCorrectEnum() { + assertEquals(AgentMode.INTERACTIVE, AgentMode.fromValue("interactive")); + assertEquals(AgentMode.PLAN, AgentMode.fromValue("plan")); + assertEquals(AgentMode.AUTOPILOT, AgentMode.fromValue("autopilot")); + assertEquals(AgentMode.SHELL, AgentMode.fromValue("shell")); + } + + @Test + void fromValue_null_returnsNull() { + assertNull(AgentMode.fromValue(null)); + } + + @Test + void fromValue_unknownValue_throwsWithConsistentMessage() { + var ex = assertThrows(IllegalArgumentException.class, () -> AgentMode.fromValue("unknown")); + assertEquals("Unknown AgentMode value: unknown", ex.getMessage()); + } + + @Test + void jsonDeserialize_unknownValue_throws() { + String json = "\"not-a-mode\""; + assertThrows(Exception.class, () -> mapper.readValue(json, AgentMode.class)); + } + + @Test + void jsonSerialize_writesStringValue() throws Exception { + String json = mapper.writeValueAsString(AgentMode.AUTOPILOT); + assertEquals("\"autopilot\"", json); + } +} diff --git a/src/test/java/com/github/copilot/CopilotClientModeTest.java b/src/test/java/com/github/copilot/CopilotClientModeTest.java new file mode 100644 index 000000000..3b7017405 --- /dev/null +++ b/src/test/java/com/github/copilot/CopilotClientModeTest.java @@ -0,0 +1,63 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +package com.github.copilot; + +import static org.junit.jupiter.api.Assertions.*; + +import org.junit.jupiter.api.Test; + +import com.github.copilot.rpc.CopilotClientMode; +import com.github.copilot.rpc.CopilotClientOptions; + +/** + * Tests for {@link CopilotClientMode} and Empty mode validation. + */ +public class CopilotClientModeTest { + + @Test + void testDefaultModeIsCopilotCli() { + var opts = new CopilotClientOptions(); + assertEquals(CopilotClientMode.COPILOT_CLI, opts.getMode()); + } + + @Test + void testSetModeEmpty() { + var opts = new CopilotClientOptions(); + opts.setMode(CopilotClientMode.EMPTY); + assertEquals(CopilotClientMode.EMPTY, opts.getMode()); + } + + @Test + void testEmptyModeRequiresCopilotHome() { + var opts = new CopilotClientOptions().setMode(CopilotClientMode.EMPTY).setAutoStart(false); + // Empty mode without copilotHome should throw + var ex = assertThrows(IllegalArgumentException.class, () -> new CopilotClient(opts)); + assertTrue(ex.getMessage().contains("Empty mode")); + } + + @Test + void testEmptyModeWithCopilotHome() { + var opts = new CopilotClientOptions().setMode(CopilotClientMode.EMPTY).setCopilotHome("/tmp/copilot-home") + .setAutoStart(false); + // Should not throw - copilotHome is set + var client = new CopilotClient(opts); + assertEquals(ConnectionState.DISCONNECTED, client.getState()); + client.close(); + } + + @Test + void testCopilotClientModeEnumValues() { + assertEquals(2, CopilotClientMode.values().length); + assertEquals(CopilotClientMode.EMPTY, CopilotClientMode.valueOf("EMPTY")); + assertEquals(CopilotClientMode.COPILOT_CLI, CopilotClientMode.valueOf("COPILOT_CLI")); + } + + @Test + void testEnumSerializationNames() { + // CopilotClientMode is a plain enum; verify the values exist + assertNotNull(CopilotClientMode.EMPTY); + assertNotNull(CopilotClientMode.COPILOT_CLI); + } +} diff --git a/src/test/java/com/github/copilot/PermissionRequestResultTest.java b/src/test/java/com/github/copilot/PermissionRequestResultTest.java new file mode 100644 index 000000000..4a1ff0313 --- /dev/null +++ b/src/test/java/com/github/copilot/PermissionRequestResultTest.java @@ -0,0 +1,73 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +package com.github.copilot; + +import static org.junit.jupiter.api.Assertions.*; + +import org.junit.jupiter.api.Test; + +import com.github.copilot.rpc.PermissionRequestResult; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.json.JsonMapper; +import com.fasterxml.jackson.annotation.JsonInclude; + +/** + * Tests for {@link PermissionRequestResult} factory methods and feedback field. + */ +public class PermissionRequestResultTest { + + private static final ObjectMapper MAPPER = JsonMapper.builder().serializationInclusion(JsonInclude.Include.NON_NULL) + .build(); + + @Test + void testApproveOnce() { + var result = PermissionRequestResult.approveOnce(); + assertEquals("approve-once", result.getKind()); + assertNull(result.getFeedback()); + } + + @Test + void testRejectWithFeedback() { + var result = PermissionRequestResult.reject("Not allowed"); + assertEquals("reject", result.getKind()); + assertEquals("Not allowed", result.getFeedback()); + } + + @Test + void testRejectWithoutFeedback() { + var result = PermissionRequestResult.reject(null); + assertEquals("reject", result.getKind()); + assertNull(result.getFeedback()); + } + + @Test + void testUserNotAvailable() { + var result = PermissionRequestResult.userNotAvailable(); + assertEquals("user-not-available", result.getKind()); + assertNull(result.getFeedback()); + } + + @Test + void testNoResult() { + var result = PermissionRequestResult.noResult(); + assertEquals("no-result", result.getKind()); + assertNull(result.getFeedback()); + } + + @Test + void testFeedbackSerialized() throws Exception { + var result = PermissionRequestResult.reject("Unsafe operation"); + var json = MAPPER.writeValueAsString(result); + assertTrue(json.contains("\"feedback\":\"Unsafe operation\"")); + assertTrue(json.contains("\"kind\":\"reject\"")); + } + + @Test + void testFeedbackNotSerializedWhenNull() throws Exception { + var result = PermissionRequestResult.approveOnce(); + var json = MAPPER.writeValueAsString(result); + assertFalse(json.contains("feedback")); + } +} diff --git a/src/test/java/com/github/copilot/SessionEventDeserializationTest.java b/src/test/java/com/github/copilot/SessionEventDeserializationTest.java index 06c3ef02a..07b4c2eed 100644 --- a/src/test/java/com/github/copilot/SessionEventDeserializationTest.java +++ b/src/test/java/com/github/copilot/SessionEventDeserializationTest.java @@ -2399,7 +2399,8 @@ void testParseCapabilitiesChangedEvent() throws Exception { assertTrue(castedEvent.getData().ui().elicitation()); // Verify setData round-trip - var newData = new CapabilitiesChangedEvent.CapabilitiesChangedEventData(new CapabilitiesChangedUI(false)); + var newData = new CapabilitiesChangedEvent.CapabilitiesChangedEventData( + new CapabilitiesChangedUI(false, null, null)); castedEvent.setData(newData); assertFalse(castedEvent.getData().ui().elicitation()); } diff --git a/src/test/java/com/github/copilot/SessionEventHandlingTest.java b/src/test/java/com/github/copilot/SessionEventHandlingTest.java index e3a415b8b..8ab6f9bfe 100644 --- a/src/test/java/com/github/copilot/SessionEventHandlingTest.java +++ b/src/test/java/com/github/copilot/SessionEventHandlingTest.java @@ -865,7 +865,7 @@ private SessionStartEvent createSessionStartEvent(String sessionId) { private AssistantMessageEvent createAssistantMessageEvent(String content) { var event = new AssistantMessageEvent(); var data = new AssistantMessageEvent.AssistantMessageEventData(null, null, content, null, null, null, null, - null, null, null, null, null, null, null, null); + null, null, null, null, null, null, null, null, null); event.setData(data); return event; } diff --git a/src/test/java/com/github/copilot/ToolSetTest.java b/src/test/java/com/github/copilot/ToolSetTest.java new file mode 100644 index 000000000..0415a74fa --- /dev/null +++ b/src/test/java/com/github/copilot/ToolSetTest.java @@ -0,0 +1,100 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +package com.github.copilot; + +import static org.junit.jupiter.api.Assertions.*; + +import java.util.Collection; +import java.util.List; + +import org.junit.jupiter.api.Test; + +import com.github.copilot.rpc.BuiltInTools; +import com.github.copilot.rpc.ToolSet; + +/** + * Tests for {@link ToolSet} and {@link BuiltInTools}. + */ +public class ToolSetTest { + + @Test + void testAddBuiltIn() { + var ts = new ToolSet().addBuiltIn("bash"); + assertEquals(1, ts.size()); + assertEquals("builtin:bash", ts.get(0)); + } + + @Test + void testAddBuiltInWildcard() { + var ts = new ToolSet().addBuiltIn("*"); + assertEquals("builtin:*", ts.get(0)); + } + + @Test + void testAddCustom() { + var ts = new ToolSet().addCustom("my_tool"); + assertEquals("custom:my_tool", ts.get(0)); + } + + @Test + void testAddMcp() { + var ts = new ToolSet().addMcp("github-list_issues"); + assertEquals("mcp:github-list_issues", ts.get(0)); + } + + @Test + void testAddMcpWildcard() { + var ts = new ToolSet().addMcp("*"); + assertEquals("mcp:*", ts.get(0)); + } + + @Test + void testChaining() { + var ts = new ToolSet().addBuiltIn("bash").addMcp("*").addCustom("my_tool"); + assertEquals(3, ts.size()); + assertEquals("builtin:bash", ts.get(0)); + assertEquals("mcp:*", ts.get(1)); + assertEquals("custom:my_tool", ts.get(2)); + } + + @Test + void testAddBuiltInCollection() { + var ts = new ToolSet(); + ts.addBuiltIn((Collection) BuiltInTools.ISOLATED); + assertEquals(BuiltInTools.ISOLATED.size(), ts.size()); + assertTrue(ts.contains("builtin:ask_user")); + assertTrue(ts.contains("builtin:task_complete")); + } + + @Test + void testInvalidNameThrows() { + assertThrows(IllegalArgumentException.class, () -> new ToolSet().addBuiltIn("")); + assertThrows(IllegalArgumentException.class, () -> new ToolSet().addBuiltIn((String) null)); + assertThrows(IllegalArgumentException.class, () -> new ToolSet().addBuiltIn("bad/name")); + assertThrows(IllegalArgumentException.class, () -> new ToolSet().addBuiltIn("bad name")); + assertThrows(IllegalArgumentException.class, () -> new ToolSet().addMcp("bad.name")); + assertThrows(IllegalArgumentException.class, () -> new ToolSet().addCustom("bad:name")); + } + + @Test + void testValidNamePatterns() { + // Names with letters, digits, hyphens, underscores are valid + assertDoesNotThrow(() -> new ToolSet().addBuiltIn("my-tool_123")); + assertDoesNotThrow(() -> new ToolSet().addMcp("github-list_issues")); + } + + @Test + void testBuiltInToolsIsolatedIsUnmodifiable() { + assertThrows(UnsupportedOperationException.class, () -> BuiltInTools.ISOLATED.add("new_tool")); + } + + @Test + void testToolSetIsListOfStrings() { + var ts = new ToolSet().addBuiltIn("bash").addMcp("*"); + // ToolSet extends ArrayList, so it is a List + List list = ts; + assertEquals(2, list.size()); + } +} diff --git a/src/test/java/com/github/copilot/UpdateSessionOptionsForModeTest.java b/src/test/java/com/github/copilot/UpdateSessionOptionsForModeTest.java new file mode 100644 index 000000000..d02ea3097 --- /dev/null +++ b/src/test/java/com/github/copilot/UpdateSessionOptionsForModeTest.java @@ -0,0 +1,260 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +package com.github.copilot; + +import static org.junit.jupiter.api.Assertions.*; + +import java.io.OutputStream; +import java.net.ServerSocket; +import java.net.Socket; +import java.nio.charset.StandardCharsets; + +import org.junit.jupiter.api.Test; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.github.copilot.rpc.CopilotClientMode; +import com.github.copilot.rpc.CopilotClientOptions; + +/** + * Tests for {@link CopilotClient#updateSessionOptionsForMode}. + */ +class UpdateSessionOptionsForModeTest { + + private static final ObjectMapper MAPPER = JsonRpcClient.getObjectMapper(); + + /** + * A connected socket pair where the "server" side auto-replies to every + * JSON-RPC request with {@code {"success": true}}. + */ + private static final class AutoReplyPair implements AutoCloseable { + + final Socket clientSocket; + final Socket serverSocket; + final JsonRpcClient rpcClient; + private volatile boolean running = true; + private final Thread replyThread; + /** The last JSON-RPC params node received by the stub server. */ + volatile JsonNode lastParams; + /** The last JSON-RPC method received by the stub server. */ + volatile String lastMethod; + + AutoReplyPair() throws Exception { + try (var ss = new ServerSocket(0)) { + clientSocket = new Socket("localhost", ss.getLocalPort()); + serverSocket = ss.accept(); + } + serverSocket.setSoTimeout(5000); + rpcClient = JsonRpcClient.fromSocket(clientSocket); + + // Background thread that reads requests and sends back success responses + replyThread = new Thread(() -> { + try { + var in = serverSocket.getInputStream(); + var out = serverSocket.getOutputStream(); + while (running) { + // Read Content-Length header + var header = new StringBuilder(); + int b; + while ((b = in.read()) != -1) { + if (b == '\n' && header.toString().endsWith("\r")) { + break; + } + header.append((char) b); + } + if (b == -1) + break; + // Skip blank line + in.read(); // '\r' + in.read(); // '\n' + + String hdr = header.toString().trim(); + int colon = hdr.indexOf(':'); + int len = Integer.parseInt(hdr.substring(colon + 1).trim()); + byte[] body = in.readNBytes(len); + JsonNode msg = MAPPER.readTree(body); + + lastMethod = msg.get("method").asText(); + lastParams = msg.get("params"); + long id = msg.get("id").asLong(); + + // Send back a success response + String response = MAPPER.writeValueAsString(MAPPER.createObjectNode().put("jsonrpc", "2.0") + .put("id", id).set("result", MAPPER.createObjectNode().put("success", true))); + sendRpcMessage(out, response); + } + } catch (Exception e) { + if (running) { + // Ignore expected exceptions on shutdown + } + } + }); + replyThread.setDaemon(true); + replyThread.start(); + } + + private static void sendRpcMessage(OutputStream out, String json) throws Exception { + byte[] bytes = json.getBytes(StandardCharsets.UTF_8); + String header = "Content-Length: " + bytes.length + "\r\n\r\n"; + out.write(header.getBytes(StandardCharsets.UTF_8)); + out.write(bytes); + out.flush(); + } + + @Override + public void close() throws Exception { + running = false; + rpcClient.close(); + clientSocket.close(); + serverSocket.close(); + replyThread.join(3000); + } + } + + // ── COPILOT_CLI mode tests ──────────────────────────────────────────────── + + @Test + void copilotCliMode_noFieldsSet_noPatchSent() throws Exception { + try (var pair = new AutoReplyPair()) { + var session = new CopilotSession("sess-1", pair.rpcClient); + var client = new CopilotClient(new CopilotClientOptions().setAutoStart(false)); + + client.updateSessionOptionsForMode(session, null, null, null, null).get(); + + assertNull(pair.lastMethod, "No RPC call should be made when no fields are set in COPILOT_CLI mode"); + client.close(); + } + } + + @Test + void copilotCliMode_skipCustomInstructionsSet_patchContainsOnlyThatField() throws Exception { + try (var pair = new AutoReplyPair()) { + var session = new CopilotSession("sess-1", pair.rpcClient); + var client = new CopilotClient(new CopilotClientOptions().setAutoStart(false)); + + client.updateSessionOptionsForMode(session, true, null, null, null).get(); + + assertEquals("session.options.update", pair.lastMethod); + assertTrue(pair.lastParams.get("skipCustomInstructions").asBoolean()); + assertTrue(pair.lastParams.path("customAgentsLocalOnly").isMissingNode(), + "customAgentsLocalOnly should be absent"); + assertTrue(pair.lastParams.path("coauthorEnabled").isMissingNode(), "coauthorEnabled should be absent"); + assertTrue(pair.lastParams.path("manageScheduleEnabled").isMissingNode(), + "manageScheduleEnabled should be absent"); + assertTrue(pair.lastParams.path("installedPlugins").isMissingNode(), "installedPlugins should be absent"); + client.close(); + } + } + + @Test + void copilotCliMode_allFieldsSet_allPropagated() throws Exception { + try (var pair = new AutoReplyPair()) { + var session = new CopilotSession("sess-1", pair.rpcClient); + var client = new CopilotClient(new CopilotClientOptions().setAutoStart(false)); + + client.updateSessionOptionsForMode(session, false, true, true, false).get(); + + assertEquals("session.options.update", pair.lastMethod); + assertFalse(pair.lastParams.get("skipCustomInstructions").asBoolean()); + assertTrue(pair.lastParams.get("customAgentsLocalOnly").asBoolean()); + assertTrue(pair.lastParams.get("coauthorEnabled").asBoolean()); + assertFalse(pair.lastParams.get("manageScheduleEnabled").asBoolean()); + client.close(); + } + } + + @Test + void copilotCliMode_onlyCoauthorEnabled_patchSent() throws Exception { + try (var pair = new AutoReplyPair()) { + var session = new CopilotSession("sess-1", pair.rpcClient); + var client = new CopilotClient(new CopilotClientOptions().setAutoStart(false)); + + client.updateSessionOptionsForMode(session, null, null, true, null).get(); + + assertEquals("session.options.update", pair.lastMethod); + assertTrue(pair.lastParams.get("coauthorEnabled").asBoolean()); + client.close(); + } + } + + // ── EMPTY mode tests ────────────────────────────────────────────────────── + + @Test + void emptyMode_noFieldsSet_safeDefaultsSent() throws Exception { + try (var pair = new AutoReplyPair()) { + var session = new CopilotSession("sess-1", pair.rpcClient); + var client = new CopilotClient(new CopilotClientOptions().setMode(CopilotClientMode.EMPTY) + .setCopilotHome("/tmp/copilot-home").setAutoStart(false)); + + client.updateSessionOptionsForMode(session, null, null, null, null).get(); + + assertEquals("session.options.update", pair.lastMethod); + assertTrue(pair.lastParams.get("skipCustomInstructions").asBoolean(), "default: skip custom instructions"); + assertTrue(pair.lastParams.get("customAgentsLocalOnly").asBoolean(), "default: local agents only"); + assertFalse(pair.lastParams.get("coauthorEnabled").asBoolean(), "default: coauthor disabled"); + assertFalse(pair.lastParams.get("manageScheduleEnabled").asBoolean(), "default: schedule disabled"); + assertTrue(pair.lastParams.get("installedPlugins").isArray(), "installedPlugins should be empty array"); + assertEquals(0, pair.lastParams.get("installedPlugins").size()); + client.close(); + } + } + + @Test + void emptyMode_callerOverridesWin() throws Exception { + try (var pair = new AutoReplyPair()) { + var session = new CopilotSession("sess-1", pair.rpcClient); + var client = new CopilotClient(new CopilotClientOptions().setMode(CopilotClientMode.EMPTY) + .setCopilotHome("/tmp/copilot-home").setAutoStart(false)); + + client.updateSessionOptionsForMode(session, false, false, true, true).get(); + + assertEquals("session.options.update", pair.lastMethod); + assertFalse(pair.lastParams.get("skipCustomInstructions").asBoolean(), "caller override: don't skip"); + assertFalse(pair.lastParams.get("customAgentsLocalOnly").asBoolean(), "caller override: not local only"); + assertTrue(pair.lastParams.get("coauthorEnabled").asBoolean(), "caller override: coauthor enabled"); + assertTrue(pair.lastParams.get("manageScheduleEnabled").asBoolean(), "caller override: schedule enabled"); + assertTrue(pair.lastParams.get("installedPlugins").isArray(), + "installedPlugins always empty in EMPTY mode"); + assertEquals(0, pair.lastParams.get("installedPlugins").size()); + client.close(); + } + } + + @Test + void emptyMode_partialOverrides_restGetDefaults() throws Exception { + try (var pair = new AutoReplyPair()) { + var session = new CopilotSession("sess-1", pair.rpcClient); + var client = new CopilotClient(new CopilotClientOptions().setMode(CopilotClientMode.EMPTY) + .setCopilotHome("/tmp/copilot-home").setAutoStart(false)); + + // Only override coauthorEnabled, rest should use safe defaults + client.updateSessionOptionsForMode(session, null, null, true, null).get(); + + assertEquals("session.options.update", pair.lastMethod); + assertTrue(pair.lastParams.get("skipCustomInstructions").asBoolean(), "default: skip"); + assertTrue(pair.lastParams.get("customAgentsLocalOnly").asBoolean(), "default: local only"); + assertTrue(pair.lastParams.get("coauthorEnabled").asBoolean(), "override: coauthor enabled"); + assertFalse(pair.lastParams.get("manageScheduleEnabled").asBoolean(), "default: schedule disabled"); + client.close(); + } + } + + // ── SessionId injection ─────────────────────────────────────────────────── + + @Test + void sessionIdInjectedBySessionOptionsApi() throws Exception { + try (var pair = new AutoReplyPair()) { + var session = new CopilotSession("my-session-id", pair.rpcClient); + var client = new CopilotClient(new CopilotClientOptions().setAutoStart(false)); + + client.updateSessionOptionsForMode(session, true, null, null, null).get(); + + assertEquals("session.options.update", pair.lastMethod); + assertEquals("my-session-id", pair.lastParams.get("sessionId").asText(), + "SessionOptionsApi should inject sessionId"); + client.close(); + } + } +}