Skip to content

Commit d505fc1

Browse files
Copilotedburns
andauthored
Initial plan
Co-authored-by: edburns <75821+edburns@users.noreply.github.com>
1 parent 3df4e75 commit d505fc1

13 files changed

Lines changed: 294 additions & 6 deletions

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ static CreateSessionRequest buildCreateRequest(SessionConfig config, String sess
152152
}
153153
request.setGitHubToken(config.getGitHubToken());
154154
request.setRemoteSession(config.getRemoteSession());
155+
request.setCloud(config.getCloud());
155156

156157
return request;
157158
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
*--------------------------------------------------------------------------------------------*/
4+
5+
package com.github.copilot.sdk.json;
6+
7+
import com.fasterxml.jackson.annotation.JsonInclude;
8+
import com.fasterxml.jackson.annotation.JsonProperty;
9+
10+
/**
11+
* Options for creating a remote session in the cloud.
12+
*
13+
* @since 1.5.0
14+
*/
15+
@JsonInclude(JsonInclude.Include.NON_NULL)
16+
public class CloudSessionOptions {
17+
18+
@JsonProperty("repository")
19+
private CloudSessionRepository repository;
20+
21+
/**
22+
* Gets the optional GitHub repository metadata to associate with the cloud
23+
* session.
24+
*
25+
* @return the repository metadata, or {@code null} if not set
26+
*/
27+
public CloudSessionRepository getRepository() {
28+
return repository;
29+
}
30+
31+
/**
32+
* Sets the optional GitHub repository metadata to associate with the cloud
33+
* session.
34+
*
35+
* @param repository
36+
* the repository metadata
37+
* @return this instance for method chaining
38+
*/
39+
public CloudSessionOptions setRepository(CloudSessionRepository repository) {
40+
this.repository = repository;
41+
return this;
42+
}
43+
}
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
*--------------------------------------------------------------------------------------------*/
4+
5+
package com.github.copilot.sdk.json;
6+
7+
import com.fasterxml.jackson.annotation.JsonInclude;
8+
import com.fasterxml.jackson.annotation.JsonProperty;
9+
10+
/**
11+
* GitHub repository metadata to associate with a cloud session.
12+
*
13+
* @since 1.5.0
14+
*/
15+
@JsonInclude(JsonInclude.Include.NON_NULL)
16+
public class CloudSessionRepository {
17+
18+
@JsonProperty("owner")
19+
private String owner;
20+
21+
@JsonProperty("name")
22+
private String name;
23+
24+
@JsonProperty("branch")
25+
private String branch;
26+
27+
/**
28+
* Gets the repository owner.
29+
*
30+
* @return the repository owner
31+
*/
32+
public String getOwner() {
33+
return owner;
34+
}
35+
36+
/**
37+
* Sets the repository owner.
38+
*
39+
* @param owner
40+
* the repository owner
41+
* @return this instance for method chaining
42+
*/
43+
public CloudSessionRepository setOwner(String owner) {
44+
this.owner = owner;
45+
return this;
46+
}
47+
48+
/**
49+
* Gets the repository name.
50+
*
51+
* @return the repository name
52+
*/
53+
public String getName() {
54+
return name;
55+
}
56+
57+
/**
58+
* Sets the repository name.
59+
*
60+
* @param name
61+
* the repository name
62+
* @return this instance for method chaining
63+
*/
64+
public CloudSessionRepository setName(String name) {
65+
this.name = name;
66+
return this;
67+
}
68+
69+
/**
70+
* Gets the optional branch name.
71+
*
72+
* @return the branch name, or {@code null} if not set
73+
*/
74+
public String getBranch() {
75+
return branch;
76+
}
77+
78+
/**
79+
* Sets the optional branch name.
80+
*
81+
* @param branch
82+
* the branch name
83+
* @return this instance for method chaining
84+
*/
85+
public CloudSessionRepository setBranch(String branch) {
86+
this.branch = branch;
87+
return this;
88+
}
89+
}

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,9 @@ public final class CreateSessionRequest {
127127
@JsonProperty("remoteSession")
128128
private String remoteSession;
129129

130+
@JsonProperty("cloud")
131+
private CloudSessionOptions cloud;
132+
130133
/** Gets the model name. @return the model */
131134
public String getModel() {
132135
return model;
@@ -543,4 +546,14 @@ public String getRemoteSession() {
543546
public void setRemoteSession(String remoteSession) {
544547
this.remoteSession = remoteSession;
545548
}
549+
550+
/** Gets the cloud session options. @return the cloud session options */
551+
public CloudSessionOptions getCloud() {
552+
return cloud;
553+
}
554+
555+
/** Sets the cloud session options. @param cloud the cloud session options */
556+
public void setCloud(CloudSessionOptions cloud) {
557+
this.cloud = cloud;
558+
}
546559
}

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

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ public class CustomAgentConfig {
6060
@JsonProperty("skills")
6161
private List<String> skills;
6262

63+
@JsonProperty("model")
64+
private String model;
65+
6366
/**
6467
* Gets the unique identifier name for this agent.
6568
*
@@ -255,4 +258,28 @@ public CustomAgentConfig setSkills(List<String> skills) {
255258
this.skills = skills;
256259
return this;
257260
}
261+
262+
/**
263+
* Gets the model identifier for this agent.
264+
*
265+
* @return the model identifier, or {@code null} if not set
266+
*/
267+
public String getModel() {
268+
return model;
269+
}
270+
271+
/**
272+
* Sets the model identifier for this agent.
273+
* <p>
274+
* When set, the runtime will attempt to use this model for the agent, falling
275+
* back to the parent session model if unavailable.
276+
*
277+
* @param model
278+
* the model identifier (e.g., "claude-haiku-4.5")
279+
* @return this config for method chaining
280+
*/
281+
public CustomAgentConfig setModel(String model) {
282+
this.model = model;
283+
return this;
284+
}
258285
}

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
@JsonIgnoreProperties(ignoreUnknown = true)
1717
public class PostToolUseHookInput {
1818

19+
@JsonProperty("sessionId")
20+
private String sessionId;
21+
1922
@JsonProperty("timestamp")
2023
private long timestamp;
2124

@@ -31,6 +34,27 @@ public class PostToolUseHookInput {
3134
@JsonProperty("toolResult")
3235
private JsonNode toolResult;
3336

37+
/**
38+
* Gets the runtime session ID of the session that triggered the hook.
39+
*
40+
* @return the session ID
41+
*/
42+
public String getSessionId() {
43+
return sessionId;
44+
}
45+
46+
/**
47+
* Sets the runtime session ID of the session that triggered the hook.
48+
*
49+
* @param sessionId
50+
* the session ID
51+
* @return this instance for method chaining
52+
*/
53+
public PostToolUseHookInput setSessionId(String sessionId) {
54+
this.sessionId = sessionId;
55+
return this;
56+
}
57+
3458
/**
3559
* Gets the timestamp of the hook invocation.
3660
*

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
@JsonIgnoreProperties(ignoreUnknown = true)
1717
public class PreToolUseHookInput {
1818

19+
@JsonProperty("sessionId")
20+
private String sessionId;
21+
1922
@JsonProperty("timestamp")
2023
private long timestamp;
2124

@@ -28,6 +31,27 @@ public class PreToolUseHookInput {
2831
@JsonProperty("toolArgs")
2932
private JsonNode toolArgs;
3033

34+
/**
35+
* Gets the runtime session ID of the session that triggered the hook.
36+
*
37+
* @return the session ID
38+
*/
39+
public String getSessionId() {
40+
return sessionId;
41+
}
42+
43+
/**
44+
* Sets the runtime session ID of the session that triggered the hook.
45+
*
46+
* @param sessionId
47+
* the session ID
48+
* @return this instance for method chaining
49+
*/
50+
public PreToolUseHookInput setSessionId(String sessionId) {
51+
this.sessionId = sessionId;
52+
return this;
53+
}
54+
3155
/**
3256
* Gets the timestamp of the hook invocation.
3357
*

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

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ public class SessionConfig {
7272
private AutoModeSwitchHandler onAutoModeSwitch;
7373
private String gitHubToken;
7474
private String remoteSession;
75+
private CloudSessionOptions cloud;
7576

7677
/**
7778
* Gets the custom session ID.
@@ -979,6 +980,35 @@ public SessionConfig setRemoteSession(String remoteSession) {
979980
return this;
980981
}
981982

983+
/**
984+
* Gets the cloud session options.
985+
* <p>
986+
* When set, creates a remote session in the cloud instead of a local session.
987+
* The optional repository is associated with the cloud session.
988+
*
989+
* @return the cloud session options, or {@code null} if not set
990+
* @since 1.5.0
991+
*/
992+
public CloudSessionOptions getCloud() {
993+
return cloud;
994+
}
995+
996+
/**
997+
* Sets the cloud session options.
998+
* <p>
999+
* When set, creates a remote session in the cloud instead of a local session.
1000+
* The optional repository is associated with the cloud session.
1001+
*
1002+
* @param cloud
1003+
* the cloud session options
1004+
* @return this config instance for method chaining
1005+
* @since 1.5.0
1006+
*/
1007+
public SessionConfig setCloud(CloudSessionOptions cloud) {
1008+
this.cloud = cloud;
1009+
return this;
1010+
}
1011+
9821012
/**
9831013
* Creates a shallow clone of this {@code SessionConfig} instance.
9841014
* <p>
@@ -1029,6 +1059,7 @@ public SessionConfig clone() {
10291059
copy.onAutoModeSwitch = this.onAutoModeSwitch;
10301060
copy.gitHubToken = this.gitHubToken;
10311061
copy.remoteSession = this.remoteSession;
1062+
copy.cloud = this.cloud;
10321063
return copy;
10331064
}
10341065
}

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
* This hook is invoked when a session ends, allowing you to perform cleanup or
1414
* logging.
1515
*
16+
* @param sessionId
17+
* the runtime session ID of the session that triggered the hook
1618
* @param timestamp
1719
* the timestamp in milliseconds since epoch when the session ended
1820
* @param cwd
@@ -27,7 +29,8 @@
2729
* @since 1.0.7
2830
*/
2931
@JsonIgnoreProperties(ignoreUnknown = true)
30-
public record SessionEndHookInput(@JsonProperty("timestamp") long timestamp, @JsonProperty("cwd") String cwd,
32+
public record SessionEndHookInput(@JsonProperty("sessionId") String sessionId,
33+
@JsonProperty("timestamp") long timestamp, @JsonProperty("cwd") String cwd,
3134
@JsonProperty("reason") String reason, @JsonProperty("finalMessage") String finalMessage,
3235
@JsonProperty("error") String error) {
3336
}

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
* This hook is invoked when a session starts, allowing you to perform
1414
* initialization or modify the session configuration.
1515
*
16+
* @param sessionId
17+
* the runtime session ID of the session that triggered the hook
1618
* @param timestamp
1719
* the timestamp in milliseconds since epoch when the session started
1820
* @param cwd
@@ -24,6 +26,7 @@
2426
* @since 1.0.7
2527
*/
2628
@JsonIgnoreProperties(ignoreUnknown = true)
27-
public record SessionStartHookInput(@JsonProperty("timestamp") long timestamp, @JsonProperty("cwd") String cwd,
29+
public record SessionStartHookInput(@JsonProperty("sessionId") String sessionId,
30+
@JsonProperty("timestamp") long timestamp, @JsonProperty("cwd") String cwd,
2831
@JsonProperty("source") String source, @JsonProperty("initialPrompt") String initialPrompt) {
2932
}

0 commit comments

Comments
 (0)