@@ -206,6 +206,48 @@ internal UriRuntimeConnection() { }
206206 public string ? ConnectionToken { get ; set ; }
207207}
208208
209+ /// <summary>
210+ /// Selects the defaulting strategy used by <see cref="CopilotClient"/>.
211+ /// </summary>
212+ public enum CopilotClientMode
213+ {
214+ /// <summary>
215+ /// Disables optional features by default. The app must explicitly opt into
216+ /// anything it needs. Required for any scenario where CLI-like ambient
217+ /// behavior is unsafe (e.g., multi-user servers).
218+ /// <para>
219+ /// When this mode is selected:
220+ /// </para>
221+ /// <list type="bullet">
222+ /// <item>The client constructor requires
223+ /// <see cref="CopilotClientOptions.BaseDirectory"/> or
224+ /// <see cref="CopilotClientOptions.SessionFs"/> to be set.</item>
225+ /// <item><see cref="SessionConfigBase.AvailableTools"/> must be supplied on
226+ /// every session — no tools are exposed by default.</item>
227+ /// <item><c>session.create</c> always sets
228+ /// <c>toolFilterPrecedence: "excluded"</c> so the allowlist and denylist
229+ /// compose naturally.</item>
230+ /// <item>The SDK injects safe defaults for ambient session features
231+ /// (telemetry, custom instructions, plugins, environment context, etc.).</item>
232+ /// <item><c>COPILOT_DISABLE_KEYTAR=1</c> is set on the spawned runtime so
233+ /// credentials are persisted to <c>COPILOT_HOME</c> rather than a
234+ /// process-wide system keychain.</item>
235+ /// </list>
236+ /// </summary>
237+ Empty ,
238+
239+ /// <summary>
240+ /// Uses defaults equivalent to GitHub Copilot CLI. The default. Useful when
241+ /// building a coding agent that shares sessions with Copilot CLI.
242+ /// <para>
243+ /// <b>Do not use this mode for server-based multi-user applications</b> —
244+ /// the default coding agent has tools and capabilities that operate across
245+ /// sessions and can access the host OS environment.
246+ /// </para>
247+ /// </summary>
248+ CopilotCli ,
249+ }
250+
209251/// <summary>
210252/// Configuration options for creating a <see cref="CopilotClient"/> instance.
211253/// </summary>
@@ -237,8 +279,23 @@ private CopilotClientOptions(CopilotClientOptions? other)
237279 SessionFs = other . SessionFs ;
238280 SessionIdleTimeoutSeconds = other . SessionIdleTimeoutSeconds ;
239281 EnableRemoteSessions = other . EnableRemoteSessions ;
282+ Mode = other . Mode ;
240283 }
241284
285+ /// <summary>
286+ /// Selects the SDK defaulting strategy. See <see cref="CopilotClientMode"/>.
287+ /// </summary>
288+ /// <remarks>
289+ /// When set to <see cref="CopilotClientMode.Empty"/>, the SDK validates that
290+ /// the app has supplied the required configuration
291+ /// (<see cref="BaseDirectory"/> or <see cref="SessionFs"/>, plus
292+ /// <see cref="SessionConfigBase.AvailableTools"/> on each session) and
293+ /// translates session creation requests into runtime options that flip
294+ /// tool filter precedence to <c>excluded</c>-wins so exclusions are
295+ /// expressible.
296+ /// </remarks>
297+ public CopilotClientMode Mode { get ; set ; } = CopilotClientMode . CopilotCli ;
298+
242299 /// <summary>
243300 /// How to connect to the runtime. When <c>null</c>, the default is
244301 /// <see cref="RuntimeConnection.ForStdio(string?, IList{string}?)"/> with the bundled runtime.
@@ -2306,6 +2363,10 @@ protected SessionConfigBase(SessionConfigBase? other)
23062363 OnUserInputRequest = other . OnUserInputRequest ;
23072364 Provider = other . Provider ;
23082365 EnableSessionTelemetry = other . EnableSessionTelemetry ;
2366+ SkipCustomInstructions = other . SkipCustomInstructions ;
2367+ CustomAgentsLocalOnly = other . CustomAgentsLocalOnly ;
2368+ CoauthorEnabled = other . CoauthorEnabled ;
2369+ ManageScheduleEnabled = other . ManageScheduleEnabled ;
23092370 ReasoningEffort = other . ReasoningEffort ;
23102371 CreateSessionFsProvider = other . CreateSessionFsProvider ;
23112372 GitHubToken = other . GitHubToken ;
@@ -2391,6 +2452,42 @@ protected SessionConfigBase(SessionConfigBase? other)
23912452 /// </summary>
23922453 public bool ? EnableSessionTelemetry { get ; set ; }
23932454
2455+ /// <summary>
2456+ /// When <see langword="true"/>, suppresses loading of custom instruction files
2457+ /// (e.g. <c>.github/copilot-instructions.md</c>, <c>AGENTS.md</c>) from the working directory.
2458+ /// When <see langword="null"/>, the SDK chooses based on
2459+ /// <see cref="CopilotClientOptions.Mode"/>: <c>true</c> under
2460+ /// <see cref="CopilotClientMode.Empty"/> (instructions are not loaded
2461+ /// unless the app explicitly opts in), <c>null</c> otherwise.
2462+ /// </summary>
2463+ public bool ? SkipCustomInstructions { get ; set ; }
2464+
2465+ /// <summary>
2466+ /// When <see langword="true"/>, custom-agent discovery is restricted to the
2467+ /// session's local working directory (no organisation-level discovery).
2468+ /// When <see langword="null"/>, the SDK chooses based on
2469+ /// <see cref="CopilotClientOptions.Mode"/>: <c>true</c> under
2470+ /// <see cref="CopilotClientMode.Empty"/>, <c>null</c> otherwise.
2471+ /// </summary>
2472+ public bool ? CustomAgentsLocalOnly { get ; set ; }
2473+
2474+ /// <summary>
2475+ /// When <see langword="true"/>, allows the runtime to append a
2476+ /// <c>Co-authored-by</c> trailer when it commits on behalf of the user.
2477+ /// When <see langword="null"/>, the SDK chooses based on
2478+ /// <see cref="CopilotClientOptions.Mode"/>: <c>false</c> under
2479+ /// <see cref="CopilotClientMode.Empty"/>, <c>null</c> otherwise.
2480+ /// </summary>
2481+ public bool ? CoauthorEnabled { get ; set ; }
2482+
2483+ /// <summary>
2484+ /// When <see langword="true"/>, enables the <c>manage_schedule</c> tool
2485+ /// (host scheduler integration). When <see langword="null"/>, the SDK
2486+ /// chooses based on <see cref="CopilotClientOptions.Mode"/>: <c>false</c>
2487+ /// under <see cref="CopilotClientMode.Empty"/>, <c>null</c> otherwise.
2488+ /// </summary>
2489+ public bool ? ManageScheduleEnabled { get ; set ; }
2490+
23942491 /// <summary>Handler for permission requests from the server.</summary>
23952492 public Func < PermissionRequest , PermissionInvocation , Task < PermissionDecision > > ? OnPermissionRequest { get ; set ; }
23962493
0 commit comments