Skip to content

Commit 0ef4ce9

Browse files
stephentoubCopilot
andcommitted
Revert Java SDK changes
Remove Java preMcpToolCall hook implementation from this PR to be handled separately. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 404055c commit 0ef4ce9

17 files changed

Lines changed: 31 additions & 547 deletions

java/.lastmerge

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
553e662b83b2ba502d8a346cf898fb63bb3b12dc
1+
f6c1adf8329ad4206e5ed2e8d12fb8082bc841a2

java/src/main/java/com/github/copilot/sdk/CopilotSession.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@
8181
import com.github.copilot.sdk.json.PermissionRequestResult;
8282
import com.github.copilot.sdk.json.PermissionRequestResultKind;
8383
import com.github.copilot.sdk.json.PostToolUseHookInput;
84-
import com.github.copilot.sdk.json.PreMcpToolCallHookInput;
8584
import com.github.copilot.sdk.json.PreToolUseHookInput;
8685
import com.github.copilot.sdk.json.SendMessageRequest;
8786
import com.github.copilot.sdk.json.SendMessageResponse;
@@ -1555,13 +1554,6 @@ CompletableFuture<Object> handleHooksInvoke(String hookType, JsonNode input) {
15551554
.thenApply(output -> (Object) output);
15561555
}
15571556
break;
1558-
case "preMcpToolCall" :
1559-
if (hooks.getOnPreMcpToolCall() != null) {
1560-
PreMcpToolCallHookInput mcpInput = MAPPER.treeToValue(input, PreMcpToolCallHookInput.class);
1561-
return hooks.getOnPreMcpToolCall().handle(mcpInput, invocation)
1562-
.thenApply(output -> (Object) output);
1563-
}
1564-
break;
15651557
case "userPromptSubmitted" :
15661558
if (hooks.getOnUserPromptSubmitted() != null) {
15671559
UserPromptSubmittedHookInput promptInput = MAPPER.treeToValue(input,

java/src/main/java/com/github/copilot/sdk/json/PingResponse.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
public record PingResponse(
2121
/** The echo message from the server. */
2222
@JsonProperty("message") String message,
23-
/** The server timestamp as an ISO-8601 string. */
24-
@JsonProperty("timestamp") String timestamp,
23+
/** The server timestamp in milliseconds since epoch. */
24+
@JsonProperty("timestamp") long timestamp,
2525
/**
2626
* The SDK protocol version supported by the server. The SDK validates that this
2727
* version matches the expected version to ensure compatibility.

java/src/main/java/com/github/copilot/sdk/json/PostToolUseHookInput.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public class PostToolUseHookInput {
2323
private long timestamp;
2424

2525
@JsonProperty("cwd")
26-
private String workingDirectory;
26+
private String cwd;
2727

2828
@JsonProperty("toolName")
2929
private String toolName;
@@ -81,19 +81,19 @@ public PostToolUseHookInput setTimestamp(long timestamp) {
8181
*
8282
* @return the working directory path
8383
*/
84-
public String getWorkingDirectory() {
85-
return workingDirectory;
84+
public String getCwd() {
85+
return cwd;
8686
}
8787

8888
/**
8989
* Sets the current working directory.
9090
*
91-
* @param workingDirectory
91+
* @param cwd
9292
* the working directory path
9393
* @return this instance for method chaining
9494
*/
95-
public PostToolUseHookInput setWorkingDirectory(String workingDirectory) {
96-
this.workingDirectory = workingDirectory;
95+
public PostToolUseHookInput setCwd(String cwd) {
96+
this.cwd = cwd;
9797
return this;
9898
}
9999

java/src/main/java/com/github/copilot/sdk/json/PreMcpToolCallHandler.java

Lines changed: 0 additions & 32 deletions
This file was deleted.

java/src/main/java/com/github/copilot/sdk/json/PreMcpToolCallHookInput.java

Lines changed: 0 additions & 213 deletions
This file was deleted.

java/src/main/java/com/github/copilot/sdk/json/PreMcpToolCallHookOutput.java

Lines changed: 0 additions & 30 deletions
This file was deleted.

java/src/main/java/com/github/copilot/sdk/json/PreToolUseHookInput.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public class PreToolUseHookInput {
2323
private long timestamp;
2424

2525
@JsonProperty("cwd")
26-
private String workingDirectory;
26+
private String cwd;
2727

2828
@JsonProperty("toolName")
2929
private String toolName;
@@ -78,19 +78,19 @@ public PreToolUseHookInput setTimestamp(long timestamp) {
7878
*
7979
* @return the working directory path
8080
*/
81-
public String getWorkingDirectory() {
82-
return workingDirectory;
81+
public String getCwd() {
82+
return cwd;
8383
}
8484

8585
/**
8686
* Sets the current working directory.
8787
*
88-
* @param workingDirectory
88+
* @param cwd
8989
* the working directory path
9090
* @return this instance for method chaining
9191
*/
92-
public PreToolUseHookInput setWorkingDirectory(String workingDirectory) {
93-
this.workingDirectory = workingDirectory;
92+
public PreToolUseHookInput setCwd(String cwd) {
93+
this.cwd = cwd;
9494
return this;
9595
}
9696

java/src/main/java/com/github/copilot/sdk/json/SessionEndHookInput.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* the runtime session ID of the session that triggered the hook
1818
* @param timestamp
1919
* the timestamp in milliseconds since epoch when the session ended
20-
* @param workingDirectory
20+
* @param cwd
2121
* the current working directory
2222
* @param reason
2323
* the reason: "complete", "error", "abort", "timeout", or
@@ -30,7 +30,7 @@
3030
*/
3131
@JsonIgnoreProperties(ignoreUnknown = true)
3232
public record SessionEndHookInput(@JsonProperty("sessionId") String sessionId,
33-
@JsonProperty("timestamp") long timestamp, @JsonProperty("cwd") String workingDirectory,
33+
@JsonProperty("timestamp") long timestamp, @JsonProperty("cwd") String cwd,
3434
@JsonProperty("reason") String reason, @JsonProperty("finalMessage") String finalMessage,
3535
@JsonProperty("error") String error) {
3636
}

0 commit comments

Comments
 (0)