Skip to content

Commit 920b1df

Browse files
Copilotedburns
andauthored
Port remoteSession field from reference implementation
Add remoteSession field to SessionConfig, ResumeSessionConfig, CreateSessionRequest, and ResumeSessionRequest. Wire it through SessionRequestBuilder for both create and resume paths. Reference implementation commit: 0159731 (Add remote_session field to all SDK SessionConfig types) Co-authored-by: edburns <75821+edburns@users.noreply.github.com>
1 parent 963543a commit 920b1df

5 files changed

Lines changed: 103 additions & 0 deletions

File tree

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ static CreateSessionRequest buildCreateRequest(SessionConfig config, String sess
151151
request.setRequestAutoModeSwitch(true);
152152
}
153153
request.setGitHubToken(config.getGitHubToken());
154+
request.setRemoteSession(config.getRemoteSession());
154155

155156
return request;
156157
}
@@ -243,6 +244,7 @@ static ResumeSessionRequest buildResumeRequest(String sessionId, ResumeSessionCo
243244
request.setRequestAutoModeSwitch(true);
244245
}
245246
request.setGitHubToken(config.getGitHubToken());
247+
request.setRemoteSession(config.getRemoteSession());
246248

247249
return request;
248250
}

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@ public final class CreateSessionRequest {
124124
@JsonProperty("gitHubToken")
125125
private String gitHubToken;
126126

127+
@JsonProperty("remoteSession")
128+
private String remoteSession;
129+
127130
/** Gets the model name. @return the model */
128131
public String getModel() {
129132
return model;
@@ -528,4 +531,16 @@ public String getGitHubToken() {
528531
public void setGitHubToken(String gitHubToken) {
529532
this.gitHubToken = gitHubToken;
530533
}
534+
535+
/** Gets the remote session mode. @return the remote session mode */
536+
public String getRemoteSession() {
537+
return remoteSession;
538+
}
539+
540+
/**
541+
* Sets the remote session mode. @param remoteSession the remote session mode
542+
*/
543+
public void setRemoteSession(String remoteSession) {
544+
this.remoteSession = remoteSession;
545+
}
531546
}

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

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ public class ResumeSessionConfig {
7171
private ExitPlanModeHandler onExitPlanMode;
7272
private AutoModeSwitchHandler onAutoModeSwitch;
7373
private String gitHubToken;
74+
private String remoteSession;
7475

7576
/**
7677
* Gets the AI model to use.
@@ -886,6 +887,34 @@ public ResumeSessionConfig setGitHubToken(String gitHubToken) {
886887
return this;
887888
}
888889

890+
/**
891+
* Gets the per-session remote behavior control.
892+
* <p>
893+
* See {@link SessionConfig#getRemoteSession()} for details on possible values.
894+
*
895+
* @return the remote session mode, or {@code null} if not set
896+
* @since 1.4.0
897+
*/
898+
public String getRemoteSession() {
899+
return remoteSession;
900+
}
901+
902+
/**
903+
* Sets the per-session remote behavior control.
904+
* <p>
905+
* See {@link SessionConfig#setRemoteSession(String)} for details on possible
906+
* values.
907+
*
908+
* @param remoteSession
909+
* the remote session mode
910+
* @return this config for method chaining
911+
* @since 1.4.0
912+
*/
913+
public ResumeSessionConfig setRemoteSession(String remoteSession) {
914+
this.remoteSession = remoteSession;
915+
return this;
916+
}
917+
889918
/**
890919
* Creates a shallow clone of this {@code ResumeSessionConfig} instance.
891920
* <p>
@@ -935,6 +964,7 @@ public ResumeSessionConfig clone() {
935964
copy.onExitPlanMode = this.onExitPlanMode;
936965
copy.onAutoModeSwitch = this.onAutoModeSwitch;
937966
copy.gitHubToken = this.gitHubToken;
967+
copy.remoteSession = this.remoteSession;
938968
return copy;
939969
}
940970
}

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,9 @@ public final class ResumeSessionRequest {
128128
@JsonProperty("gitHubToken")
129129
private String gitHubToken;
130130

131+
@JsonProperty("remoteSession")
132+
private String remoteSession;
133+
131134
/** Gets the session ID. @return the session ID */
132135
public String getSessionId() {
133136
return sessionId;
@@ -555,4 +558,16 @@ public String getGitHubToken() {
555558
public void setGitHubToken(String gitHubToken) {
556559
this.gitHubToken = gitHubToken;
557560
}
561+
562+
/** Gets the remote session mode. @return the remote session mode */
563+
public String getRemoteSession() {
564+
return remoteSession;
565+
}
566+
567+
/**
568+
* Sets the remote session mode. @param remoteSession the remote session mode
569+
*/
570+
public void setRemoteSession(String remoteSession) {
571+
this.remoteSession = remoteSession;
572+
}
558573
}

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

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ public class SessionConfig {
7171
private ExitPlanModeHandler onExitPlanMode;
7272
private AutoModeSwitchHandler onAutoModeSwitch;
7373
private String gitHubToken;
74+
private String remoteSession;
7475

7576
/**
7677
* Gets the custom session ID.
@@ -939,6 +940,45 @@ public SessionConfig setGitHubToken(String gitHubToken) {
939940
return this;
940941
}
941942

943+
/**
944+
* Gets the per-session remote behavior control.
945+
* <p>
946+
* Possible values:
947+
* <ul>
948+
* <li>{@code "off"} — local only, no remote export (default)</li>
949+
* <li>{@code "export"} — export session events to GitHub without enabling
950+
* remote steering</li>
951+
* <li>{@code "on"} — export to GitHub AND enable remote steering</li>
952+
* </ul>
953+
*
954+
* @return the remote session mode, or {@code null} if not set
955+
* @since 1.4.0
956+
*/
957+
public String getRemoteSession() {
958+
return remoteSession;
959+
}
960+
961+
/**
962+
* Sets the per-session remote behavior control.
963+
* <p>
964+
* Possible values:
965+
* <ul>
966+
* <li>{@code "off"} — local only, no remote export (default)</li>
967+
* <li>{@code "export"} — export session events to GitHub without enabling
968+
* remote steering</li>
969+
* <li>{@code "on"} — export to GitHub AND enable remote steering</li>
970+
* </ul>
971+
*
972+
* @param remoteSession
973+
* the remote session mode
974+
* @return this config instance for method chaining
975+
* @since 1.4.0
976+
*/
977+
public SessionConfig setRemoteSession(String remoteSession) {
978+
this.remoteSession = remoteSession;
979+
return this;
980+
}
981+
942982
/**
943983
* Creates a shallow clone of this {@code SessionConfig} instance.
944984
* <p>
@@ -988,6 +1028,7 @@ public SessionConfig clone() {
9881028
copy.onExitPlanMode = this.onExitPlanMode;
9891029
copy.onAutoModeSwitch = this.onAutoModeSwitch;
9901030
copy.gitHubToken = this.gitHubToken;
1031+
copy.remoteSession = this.remoteSession;
9911032
return copy;
9921033
}
9931034
}

0 commit comments

Comments
 (0)