Skip to content
Prev Previous commit
Next Next commit
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>
  • Loading branch information
Copilot and edburns authored May 15, 2026
commit 920b1dfbbcf5d09c4246013bf87274aabebe2aee
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ static CreateSessionRequest buildCreateRequest(SessionConfig config, String sess
request.setRequestAutoModeSwitch(true);
}
request.setGitHubToken(config.getGitHubToken());
request.setRemoteSession(config.getRemoteSession());

return request;
}
Expand Down Expand Up @@ -243,6 +244,7 @@ static ResumeSessionRequest buildResumeRequest(String sessionId, ResumeSessionCo
request.setRequestAutoModeSwitch(true);
}
request.setGitHubToken(config.getGitHubToken());
request.setRemoteSession(config.getRemoteSession());

return request;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ public final class CreateSessionRequest {
@JsonProperty("gitHubToken")
private String gitHubToken;

@JsonProperty("remoteSession")
private String remoteSession;

/** Gets the model name. @return the model */
public String getModel() {
return model;
Expand Down Expand Up @@ -528,4 +531,16 @@ public String getGitHubToken() {
public void setGitHubToken(String gitHubToken) {
this.gitHubToken = gitHubToken;
}

/** Gets the remote session mode. @return the remote session mode */
public String getRemoteSession() {
return remoteSession;
}

/**
* Sets the remote session mode. @param remoteSession the remote session mode
*/
public void setRemoteSession(String remoteSession) {
this.remoteSession = remoteSession;
}
}
30 changes: 30 additions & 0 deletions src/main/java/com/github/copilot/sdk/json/ResumeSessionConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public class ResumeSessionConfig {
private ExitPlanModeHandler onExitPlanMode;
private AutoModeSwitchHandler onAutoModeSwitch;
private String gitHubToken;
private String remoteSession;

/**
* Gets the AI model to use.
Expand Down Expand Up @@ -886,6 +887,34 @@ public ResumeSessionConfig setGitHubToken(String gitHubToken) {
return this;
}

/**
* Gets the per-session remote behavior control.
* <p>
* See {@link SessionConfig#getRemoteSession()} for details on possible values.
*
* @return the remote session mode, or {@code null} if not set
* @since 1.4.0
*/
public String getRemoteSession() {
return remoteSession;
}

/**
* Sets the per-session remote behavior control.
* <p>
* See {@link SessionConfig#setRemoteSession(String)} for details on possible
* values.
*
* @param remoteSession
* the remote session mode
* @return this config for method chaining
* @since 1.4.0
*/
public ResumeSessionConfig setRemoteSession(String remoteSession) {
this.remoteSession = remoteSession;
return this;
}

/**
* Creates a shallow clone of this {@code ResumeSessionConfig} instance.
* <p>
Expand Down Expand Up @@ -935,6 +964,7 @@ public ResumeSessionConfig clone() {
copy.onExitPlanMode = this.onExitPlanMode;
copy.onAutoModeSwitch = this.onAutoModeSwitch;
copy.gitHubToken = this.gitHubToken;
copy.remoteSession = this.remoteSession;
return copy;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ public final class ResumeSessionRequest {
@JsonProperty("gitHubToken")
private String gitHubToken;

@JsonProperty("remoteSession")
private String remoteSession;

/** Gets the session ID. @return the session ID */
public String getSessionId() {
return sessionId;
Expand Down Expand Up @@ -555,4 +558,16 @@ public String getGitHubToken() {
public void setGitHubToken(String gitHubToken) {
this.gitHubToken = gitHubToken;
}

/** Gets the remote session mode. @return the remote session mode */
public String getRemoteSession() {
return remoteSession;
}

/**
* Sets the remote session mode. @param remoteSession the remote session mode
*/
public void setRemoteSession(String remoteSession) {
this.remoteSession = remoteSession;
}
}
41 changes: 41 additions & 0 deletions src/main/java/com/github/copilot/sdk/json/SessionConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public class SessionConfig {
private ExitPlanModeHandler onExitPlanMode;
private AutoModeSwitchHandler onAutoModeSwitch;
private String gitHubToken;
private String remoteSession;

/**
* Gets the custom session ID.
Expand Down Expand Up @@ -939,6 +940,45 @@ public SessionConfig setGitHubToken(String gitHubToken) {
return this;
}

/**
* Gets the per-session remote behavior control.
* <p>
* Possible values:
* <ul>
* <li>{@code "off"} — local only, no remote export (default)</li>
* <li>{@code "export"} — export session events to GitHub without enabling
* remote steering</li>
* <li>{@code "on"} — export to GitHub AND enable remote steering</li>
* </ul>
*
* @return the remote session mode, or {@code null} if not set
* @since 1.4.0
*/
public String getRemoteSession() {
return remoteSession;
}

/**
* Sets the per-session remote behavior control.
* <p>
* Possible values:
* <ul>
* <li>{@code "off"} — local only, no remote export (default)</li>
* <li>{@code "export"} — export session events to GitHub without enabling
* remote steering</li>
* <li>{@code "on"} — export to GitHub AND enable remote steering</li>
* </ul>
*
* @param remoteSession
* the remote session mode
* @return this config instance for method chaining
* @since 1.4.0
*/
public SessionConfig setRemoteSession(String remoteSession) {
this.remoteSession = remoteSession;
return this;
}

/**
* Creates a shallow clone of this {@code SessionConfig} instance.
* <p>
Expand Down Expand Up @@ -988,6 +1028,7 @@ public SessionConfig clone() {
copy.onExitPlanMode = this.onExitPlanMode;
copy.onAutoModeSwitch = this.onAutoModeSwitch;
copy.gitHubToken = this.gitHubToken;
copy.remoteSession = this.remoteSession;
return copy;
}
}