Skip to content

Commit 10f2dc7

Browse files
devm33Copilot
andcommitted
Add remote_session field to Go, Node, Python, and .NET SDKs
Expose per-session remote behavior control (Off/Export/On) in all remaining SDK languages, matching the Rust implementation. Each SDK adds the field to SessionConfig and ResumeSessionConfig, wires it into the JSON-RPC create/resume payloads, and exports the type. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent fc66e75 commit 10f2dc7

8 files changed

Lines changed: 58 additions & 0 deletions

File tree

dotnet/src/Client.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,7 @@ public async Task<CopilotSession> CreateSessionAsync(SessionConfig config, Cance
629629
Tracestate: tracestate,
630630
ModelCapabilities: config.ModelCapabilities,
631631
GitHubToken: config.GitHubToken,
632+
RemoteSession: config.RemoteSession,
632633
InstructionDirectories: config.InstructionDirectories);
633634

634635
var rpcTimestamp = Stopwatch.GetTimestamp();
@@ -786,6 +787,7 @@ public async Task<CopilotSession> ResumeSessionAsync(string sessionId, ResumeSes
786787
Tracestate: tracestate,
787788
ModelCapabilities: config.ModelCapabilities,
788789
GitHubToken: config.GitHubToken,
790+
RemoteSession: config.RemoteSession,
789791
ContinuePendingWork: config.ContinuePendingWork,
790792
InstructionDirectories: config.InstructionDirectories);
791793

@@ -1981,6 +1983,7 @@ internal record CreateSessionRequest(
19811983
string? Tracestate = null,
19821984
ModelCapabilitiesOverride? ModelCapabilities = null,
19831985
string? GitHubToken = null,
1986+
RemoteSessionMode? RemoteSession = null,
19841987
IList<string>? InstructionDirectories = null);
19851988

19861989
internal record ToolDefinition(
@@ -2041,6 +2044,7 @@ internal record ResumeSessionRequest(
20412044
string? Tracestate = null,
20422045
ModelCapabilitiesOverride? ModelCapabilities = null,
20432046
string? GitHubToken = null,
2047+
RemoteSessionMode? RemoteSession = null,
20442048
bool? ContinuePendingWork = null,
20452049
IList<string>? InstructionDirectories = null);
20462050

dotnet/src/Types.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2028,6 +2028,7 @@ protected SessionConfig(SessionConfig? other)
20282028
ReasoningEffort = other.ReasoningEffort;
20292029
CreateSessionFsHandler = other.CreateSessionFsHandler;
20302030
GitHubToken = other.GitHubToken;
2031+
RemoteSession = other.RemoteSession;
20312032
SessionId = other.SessionId;
20322033
SkillDirectories = other.SkillDirectories is not null ? [.. other.SkillDirectories] : null;
20332034
InstructionDirectories = other.InstructionDirectories is not null ? [.. other.InstructionDirectories] : null;
@@ -2253,6 +2254,16 @@ protected SessionConfig(SessionConfig? other)
22532254
/// </summary>
22542255
public string? GitHubToken { get; set; }
22552256

2257+
/// <summary>
2258+
/// Per-session remote behavior control:
2259+
/// <list type="bullet">
2260+
/// <item><description><c>"off"</c> — local only, no remote export (default)</description></item>
2261+
/// <item><description><c>"export"</c> — export session events to Mission Control without enabling remote steering</description></item>
2262+
/// <item><description><c>"on"</c> — export to Mission Control AND enable remote steering</description></item>
2263+
/// </list>
2264+
/// </summary>
2265+
public RemoteSessionMode? RemoteSession { get; set; }
2266+
22562267
/// <summary>
22572268
/// Creates a shallow clone of this <see cref="SessionConfig"/> instance.
22582269
/// </summary>
@@ -2319,6 +2330,7 @@ protected ResumeSessionConfig(ResumeSessionConfig? other)
23192330
ReasoningEffort = other.ReasoningEffort;
23202331
CreateSessionFsHandler = other.CreateSessionFsHandler;
23212332
GitHubToken = other.GitHubToken;
2333+
RemoteSession = other.RemoteSession;
23222334
SkillDirectories = other.SkillDirectories is not null ? [.. other.SkillDirectories] : null;
23232335
InstructionDirectories = other.InstructionDirectories is not null ? [.. other.InstructionDirectories] : null;
23242336
Streaming = other.Streaming;
@@ -2555,6 +2567,12 @@ protected ResumeSessionConfig(ResumeSessionConfig? other)
25552567
/// </summary>
25562568
public string? GitHubToken { get; set; }
25572569

2570+
/// <summary>
2571+
/// Per-session remote behavior control.
2572+
/// See <see cref="SessionConfig.RemoteSession"/> for details.
2573+
/// </summary>
2574+
public RemoteSessionMode? RemoteSession { get; set; }
2575+
25582576
/// <summary>
25592577
/// Creates a shallow clone of this <see cref="ResumeSessionConfig"/> instance.
25602578
/// </summary>

go/client.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,7 @@ func (c *Client) CreateSession(ctx context.Context, config *SessionConfig) (*Ses
645645
req.DisabledSkills = config.DisabledSkills
646646
req.InfiniteSessions = config.InfiniteSessions
647647
req.GitHubToken = config.GitHubToken
648+
req.RemoteSession = config.RemoteSession
648649

649650
if len(config.Commands) > 0 {
650651
cmds := make([]wireCommand, 0, len(config.Commands))
@@ -848,6 +849,7 @@ func (c *Client) ResumeSessionWithOptions(ctx context.Context, sessionID string,
848849
req.DisabledSkills = config.DisabledSkills
849850
req.InfiniteSessions = config.InfiniteSessions
850851
req.GitHubToken = config.GitHubToken
852+
req.RemoteSession = config.RemoteSession
851853
req.RequestPermission = Bool(true)
852854

853855
if len(config.Commands) > 0 {

go/types.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -680,6 +680,11 @@ type SessionConfig struct {
680680
// When provided, the session authenticates as the token's owner instead of
681681
// using the global client-level auth.
682682
GitHubToken string `json:"-"`
683+
// RemoteSession controls per-session remote behavior:
684+
// - "off" — local only, no remote export (default)
685+
// - "export" — export session events to Mission Control without enabling remote steering
686+
// - "on" — export to Mission Control AND enable remote steering
687+
RemoteSession rpc.RemoteSessionMode
683688
}
684689
type Tool struct {
685690
Name string `json:"name"`
@@ -891,6 +896,9 @@ type ResumeSessionConfig struct {
891896
// When provided, the session authenticates as the token's owner instead of
892897
// using the global client-level auth.
893898
GitHubToken string `json:"-"`
899+
// RemoteSession controls per-session remote behavior.
900+
// See SessionConfig.RemoteSession for details.
901+
RemoteSession rpc.RemoteSessionMode
894902
// DisableResume, when true, skips emitting the session.resume event.
895903
// Useful for reconnecting to a session without triggering resume-related side effects.
896904
DisableResume bool
@@ -1142,6 +1150,7 @@ type createSessionRequest struct {
11421150
Commands []wireCommand `json:"commands,omitempty"`
11431151
RequestElicitation *bool `json:"requestElicitation,omitempty"`
11441152
GitHubToken string `json:"gitHubToken,omitempty"`
1153+
RemoteSession rpc.RemoteSessionMode `json:"remoteSession,omitempty"`
11451154
Traceparent string `json:"traceparent,omitempty"`
11461155
Tracestate string `json:"tracestate,omitempty"`
11471156
}
@@ -1196,6 +1205,7 @@ type resumeSessionRequest struct {
11961205
Commands []wireCommand `json:"commands,omitempty"`
11971206
RequestElicitation *bool `json:"requestElicitation,omitempty"`
11981207
GitHubToken string `json:"gitHubToken,omitempty"`
1208+
RemoteSession rpc.RemoteSessionMode `json:"remoteSession,omitempty"`
11991209
Traceparent string `json:"traceparent,omitempty"`
12001210
Tracestate string `json:"tracestate,omitempty"`
12011211
}

nodejs/src/client.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -835,6 +835,7 @@ export class CopilotClient {
835835
disabledSkills: config.disabledSkills,
836836
infiniteSessions: config.infiniteSessions,
837837
gitHubToken: config.gitHubToken,
838+
remoteSession: config.remoteSession,
838839
});
839840

840841
const { workspacePath, capabilities } = response as {
@@ -990,6 +991,7 @@ export class CopilotClient {
990991
disableResume: config.disableResume,
991992
continuePendingWork: config.continuePendingWork,
992993
gitHubToken: config.gitHubToken,
994+
remoteSession: config.remoteSession,
993995
});
994996

995997
const { workspacePath, capabilities } = response as {

nodejs/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ export type {
5656
PermissionRequest,
5757
PermissionRequestResult,
5858
ProviderConfig,
59+
RemoteSessionMode,
5960
ResumeSessionConfig,
6061
SectionOverride,
6162
SectionOverrideAction,

nodejs/src/types.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
import type { SessionFsProvider } from "./sessionFsProvider.js";
1111
import type { SessionEvent as GeneratedSessionEvent } from "./generated/session-events.js";
1212
import type { CopilotSession } from "./session.js";
13+
import type { RemoteSessionMode } from "./generated/rpc.js";
14+
export type { RemoteSessionMode } from "./generated/rpc.js";
1315
export type SessionEvent = GeneratedSessionEvent;
1416
export type { SessionFsProvider } from "./sessionFsProvider.js";
1517
export { createSessionFsAdapter } from "./sessionFsProvider.js";
@@ -1477,6 +1479,14 @@ export interface SessionConfig {
14771479
*/
14781480
gitHubToken?: string;
14791481

1482+
/**
1483+
* Per-session remote behavior control:
1484+
* - `"off"` — local only, no remote export (default)
1485+
* - `"export"` — export session events to Mission Control without enabling remote steering
1486+
* - `"on"` — export to Mission Control AND enable remote steering
1487+
*/
1488+
remoteSession?: RemoteSessionMode;
1489+
14801490
/**
14811491
* Optional event handler that is registered on the session before the
14821492
* session.create RPC is issued. This guarantees that early events emitted
@@ -1531,6 +1541,7 @@ export type ResumeSessionConfig = Pick<
15311541
| "disabledSkills"
15321542
| "infiniteSessions"
15331543
| "gitHubToken"
1544+
| "remoteSession"
15341545
| "onEvent"
15351546
| "createSessionFsHandler"
15361547
> & {

python/copilot/client.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1326,6 +1326,7 @@ async def create_session(
13261326
on_auto_mode_switch: AutoModeSwitchHandler | None = None,
13271327
create_session_fs_handler: CreateSessionFsHandler | None = None,
13281328
github_token: str | None = None,
1329+
remote_session: str | None = None,
13291330
) -> CopilotSession:
13301331
"""
13311332
Create a new conversation session with the Copilot CLI.
@@ -1479,6 +1480,10 @@ async def create_session(
14791480
if github_token is not None:
14801481
payload["gitHubToken"] = github_token
14811482

1483+
# Add remote session mode if provided
1484+
if remote_session is not None:
1485+
payload["remoteSession"] = remote_session
1486+
14821487
# Add working directory if provided
14831488
if working_directory:
14841489
payload["workingDirectory"] = working_directory
@@ -1686,6 +1691,7 @@ async def resume_session(
16861691
on_auto_mode_switch: AutoModeSwitchHandler | None = None,
16871692
create_session_fs_handler: CreateSessionFsHandler | None = None,
16881693
github_token: str | None = None,
1694+
remote_session: str | None = None,
16891695
continue_pending_work: bool | None = None,
16901696
) -> CopilotSession:
16911697
"""
@@ -1857,6 +1863,10 @@ async def resume_session(
18571863
if github_token is not None:
18581864
payload["gitHubToken"] = github_token
18591865

1866+
# Add remote session mode if provided
1867+
if remote_session is not None:
1868+
payload["remoteSession"] = remote_session
1869+
18601870
if working_directory:
18611871
payload["workingDirectory"] = working_directory
18621872
if config_dir:

0 commit comments

Comments
 (0)