-
Notifications
You must be signed in to change notification settings - Fork 3
Upstream sync: Port Commands, Elicitation, Session Capabilities, and getSessionMetadata (27 commits) #52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Upstream sync: Port Commands, Elicitation, Session Capabilities, and getSessionMetadata (27 commits) #52
Changes from 3 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
844f3cf
Initial plan
Copilot cc84fab
Port Commands, Elicitation, and Capabilities features from upstream
Copilot 4001135
Add tests, documentation, and update .lastmerge to f7fd757
Copilot 2da6b5a
Fix code review issues: duplicate assertion, copyright header, Javado…
Copilot 7060eed
Update src/main/java/com/github/copilot/sdk/CopilotSession.java
brunoborges 8cb5827
Update README.md
brunoborges e365e05
Fix invalid Java ?. operator in SessionUiApi Javadoc prose
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| 40887393a9e687dacc141a645799441b0313ff15 | ||
| f7fd7577109d64e261456b16c49baa56258eae4e |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
373 changes: 373 additions & 0 deletions
373
src/main/java/com/github/copilot/sdk/CopilotSession.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
src/main/java/com/github/copilot/sdk/events/CapabilitiesChangedEvent.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| /*--------------------------------------------------------------------------------------------- | ||
| * Copyright (c) Microsoft Corporation. All rights reserved. | ||
| *--------------------------------------------------------------------------------------------*/ | ||
|
|
||
| package com.github.copilot.sdk.events; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
| import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
|
||
| /** | ||
| * Event: capabilities.changed | ||
| * <p> | ||
| * Broadcast when the host's session capabilities change. The SDK updates | ||
| * {@link com.github.copilot.sdk.CopilotSession#getCapabilities()} accordingly. | ||
| * | ||
| * @since 1.0.0 | ||
| */ | ||
| @JsonIgnoreProperties(ignoreUnknown = true) | ||
| public final class CapabilitiesChangedEvent extends AbstractSessionEvent { | ||
|
|
||
| @JsonProperty("data") | ||
| private CapabilitiesChangedData data; | ||
|
|
||
| @Override | ||
| public String getType() { | ||
| return "capabilities.changed"; | ||
| } | ||
|
|
||
| public CapabilitiesChangedData getData() { | ||
| return data; | ||
| } | ||
|
|
||
| public void setData(CapabilitiesChangedData data) { | ||
| this.data = data; | ||
| } | ||
|
|
||
| @JsonIgnoreProperties(ignoreUnknown = true) | ||
| public record CapabilitiesChangedData(@JsonProperty("ui") CapabilitiesChangedUi ui) { | ||
| } | ||
|
|
||
| @JsonIgnoreProperties(ignoreUnknown = true) | ||
| public record CapabilitiesChangedUi(@JsonProperty("elicitation") Boolean elicitation) { | ||
| } | ||
| } |
43 changes: 43 additions & 0 deletions
43
src/main/java/com/github/copilot/sdk/events/CommandExecuteEvent.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| /*--------------------------------------------------------------------------------------------- | ||
| * Copyright (c) Microsoft Corporation. All rights reserved. | ||
| *--------------------------------------------------------------------------------------------*/ | ||
|
|
||
| package com.github.copilot.sdk.events; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
| import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
|
||
| /** | ||
| * Event: command.execute | ||
| * <p> | ||
| * Broadcast when the user executes a slash command registered by this client. | ||
| * Clients that have a matching command handler should respond via | ||
| * {@code session.commands.handlePendingCommand}. | ||
| * | ||
| * @since 1.0.0 | ||
| */ | ||
| @JsonIgnoreProperties(ignoreUnknown = true) | ||
| public final class CommandExecuteEvent extends AbstractSessionEvent { | ||
|
|
||
| @JsonProperty("data") | ||
| private CommandExecuteData data; | ||
|
|
||
| @Override | ||
| public String getType() { | ||
| return "command.execute"; | ||
| } | ||
|
|
||
| public CommandExecuteData getData() { | ||
| return data; | ||
| } | ||
|
|
||
| public void setData(CommandExecuteData data) { | ||
| this.data = data; | ||
| } | ||
|
|
||
| @JsonIgnoreProperties(ignoreUnknown = true) | ||
| public record CommandExecuteData(@JsonProperty("requestId") String requestId, | ||
| @JsonProperty("command") String command, @JsonProperty("commandName") String commandName, | ||
| @JsonProperty("args") String args) { | ||
| } | ||
| } |
54 changes: 54 additions & 0 deletions
54
src/main/java/com/github/copilot/sdk/events/ElicitationRequestedEvent.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| /*--------------------------------------------------------------------------------------------- | ||
| * Copyright (c) Microsoft Corporation. All rights reserved. | ||
| *--------------------------------------------------------------------------------------------*/ | ||
|
|
||
| package com.github.copilot.sdk.events; | ||
|
|
||
| import java.util.List; | ||
| import java.util.Map; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
| import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
|
||
| /** | ||
| * Event: elicitation.requested | ||
| * <p> | ||
| * Broadcast when the server or an MCP tool requests structured input from the | ||
| * user. Clients that have an elicitation handler should respond via | ||
| * {@code session.ui.handlePendingElicitation}. | ||
| * | ||
| * @since 1.0.0 | ||
| */ | ||
| @JsonIgnoreProperties(ignoreUnknown = true) | ||
| public final class ElicitationRequestedEvent extends AbstractSessionEvent { | ||
|
|
||
| @JsonProperty("data") | ||
| private ElicitationRequestedData data; | ||
|
|
||
| @Override | ||
| public String getType() { | ||
| return "elicitation.requested"; | ||
| } | ||
|
|
||
| public ElicitationRequestedData getData() { | ||
| return data; | ||
| } | ||
|
|
||
| public void setData(ElicitationRequestedData data) { | ||
| this.data = data; | ||
| } | ||
|
|
||
| @JsonIgnoreProperties(ignoreUnknown = true) | ||
| public record ElicitationRequestedData(@JsonProperty("requestId") String requestId, | ||
| @JsonProperty("toolCallId") String toolCallId, @JsonProperty("elicitationSource") String elicitationSource, | ||
| @JsonProperty("message") String message, @JsonProperty("mode") String mode, | ||
| @JsonProperty("requestedSchema") ElicitationRequestedSchema requestedSchema, | ||
| @JsonProperty("url") String url) { | ||
| } | ||
|
|
||
| @JsonIgnoreProperties(ignoreUnknown = true) | ||
| public record ElicitationRequestedSchema(@JsonProperty("type") String type, | ||
| @JsonProperty("properties") Map<String, Object> properties, | ||
| @JsonProperty("required") List<String> required) { | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
src/main/java/com/github/copilot/sdk/json/CommandContext.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| /*--------------------------------------------------------------------------------------------- | ||
| * Copyright (c) Microsoft Corporation. All rights reserved. | ||
| *--------------------------------------------------------------------------------------------*/ | ||
|
|
||
| package com.github.copilot.sdk.json; | ||
|
|
||
| /** | ||
| * Context passed to a {@link CommandHandler} when a slash command is executed. | ||
| * | ||
| * @since 1.0.0 | ||
| */ | ||
| public class CommandContext { | ||
|
|
||
| private String sessionId; | ||
| private String command; | ||
| private String commandName; | ||
| private String args; | ||
|
|
||
| /** Gets the session ID where the command was invoked. @return the session ID */ | ||
| public String getSessionId() { | ||
| return sessionId; | ||
| } | ||
|
|
||
| /** Sets the session ID. @param sessionId the session ID @return this */ | ||
| public CommandContext setSessionId(String sessionId) { | ||
| this.sessionId = sessionId; | ||
| return this; | ||
| } | ||
|
|
||
| /** | ||
| * Gets the full command text (e.g., {@code /deploy production}). | ||
| * | ||
| * @return the full command text | ||
| */ | ||
| public String getCommand() { | ||
| return command; | ||
| } | ||
|
|
||
| /** Sets the full command text. @param command the command text @return this */ | ||
| public CommandContext setCommand(String command) { | ||
| this.command = command; | ||
| return this; | ||
| } | ||
|
|
||
| /** | ||
| * Gets the command name without the leading {@code /}. | ||
| * | ||
| * @return the command name | ||
| */ | ||
| public String getCommandName() { | ||
| return commandName; | ||
| } | ||
|
|
||
| /** Sets the command name. @param commandName the command name @return this */ | ||
| public CommandContext setCommandName(String commandName) { | ||
| this.commandName = commandName; | ||
| return this; | ||
| } | ||
|
|
||
| /** | ||
| * Gets the raw argument string after the command name. | ||
| * | ||
| * @return the argument string | ||
| */ | ||
| public String getArgs() { | ||
| return args; | ||
| } | ||
|
|
||
| /** Sets the argument string. @param args the argument string @return this */ | ||
| public CommandContext setArgs(String args) { | ||
| this.args = args; | ||
| return this; | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.