Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions dotnet/src/Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,7 @@ public async Task<CopilotSession> CreateSessionAsync(SessionConfig config, Cance
config.CustomAgents,
config.Agent,
config.ConfigDir,
config.EnableConfigDiscovery,
config.SkillDirectories,
config.DisabledSkills,
config.InfiniteSessions,
Expand Down Expand Up @@ -618,6 +619,7 @@ public async Task<CopilotSession> ResumeSessionAsync(string sessionId, ResumeSes
hasHooks ? true : null,
config.WorkingDirectory,
config.ConfigDir,
config.EnableConfigDiscovery,
config.DisableResume is true ? true : null,
config.Streaming is true ? true : null,
config.McpServers,
Expand Down Expand Up @@ -1640,6 +1642,7 @@ internal record CreateSessionRequest(
List<CustomAgentConfig>? CustomAgents,
string? Agent,
string? ConfigDir,
bool? EnableConfigDiscovery,
List<string>? SkillDirectories,
List<string>? DisabledSkills,
InfiniteSessionConfig? InfiniteSessions,
Expand Down Expand Up @@ -1686,6 +1689,7 @@ internal record ResumeSessionRequest(
bool? Hooks,
string? WorkingDirectory,
string? ConfigDir,
bool? EnableConfigDiscovery,
bool? DisableResume,
bool? Streaming,
Dictionary<string, object>? McpServers,
Expand Down
28 changes: 28 additions & 0 deletions dotnet/src/Types.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1603,6 +1603,7 @@ protected SessionConfig(SessionConfig? other)
CustomAgents = other.CustomAgents is not null ? [.. other.CustomAgents] : null;
Agent = other.Agent;
DisabledSkills = other.DisabledSkills is not null ? [.. other.DisabledSkills] : null;
EnableConfigDiscovery = other.EnableConfigDiscovery;
ExcludedTools = other.ExcludedTools is not null ? [.. other.ExcludedTools] : null;
Comment thread
stephentoub marked this conversation as resolved.
Hooks = other.Hooks;
InfiniteSessions = other.InfiniteSessions;
Expand Down Expand Up @@ -1660,6 +1661,19 @@ protected SessionConfig(SessionConfig? other)
/// </summary>
public string? ConfigDir { get; set; }

/// <summary>
/// When <see langword="true"/>, automatically discovers MCP server configurations
/// (e.g. <c>.mcp.json</c>, <c>.vscode/mcp.json</c>) and skill directories from
/// the working directory and merges them with any explicitly provided
/// <see cref="McpServers"/> and <see cref="SkillDirectories"/>, with explicit
/// values taking precedence on name collision.
/// <para>
/// Custom instruction files (<c>.github/copilot-instructions.md</c>, <c>AGENTS.md</c>, etc.)
/// are always loaded from the working directory regardless of this setting.
/// </para>
/// </summary>
public bool? EnableConfigDiscovery { get; set; }

/// <summary>
/// Custom tool functions available to the language model during the session.
/// </summary>
Expand Down Expand Up @@ -1817,6 +1831,7 @@ protected ResumeSessionConfig(ResumeSessionConfig? other)
Agent = other.Agent;
DisabledSkills = other.DisabledSkills is not null ? [.. other.DisabledSkills] : null;
DisableResume = other.DisableResume;
EnableConfigDiscovery = other.EnableConfigDiscovery;
ExcludedTools = other.ExcludedTools is not null ? [.. other.ExcludedTools] : null;
Hooks = other.Hooks;
InfiniteSessions = other.InfiniteSessions;
Expand Down Expand Up @@ -1929,6 +1944,19 @@ protected ResumeSessionConfig(ResumeSessionConfig? other)
/// </summary>
public string? ConfigDir { get; set; }

/// <summary>
/// When <see langword="true"/>, automatically discovers MCP server configurations
/// (e.g. <c>.mcp.json</c>, <c>.vscode/mcp.json</c>) and skill directories from
/// the working directory and merges them with any explicitly provided
/// <see cref="McpServers"/> and <see cref="SkillDirectories"/>, with explicit
/// values taking precedence on name collision.
/// <para>
/// Custom instruction files (<c>.github/copilot-instructions.md</c>, <c>AGENTS.md</c>, etc.)
/// are always loaded from the working directory regardless of this setting.
/// </para>
/// </summary>
public bool? EnableConfigDiscovery { get; set; }

/// <summary>
/// When true, the session.resume event is not emitted.
/// Default: false (resume event is emitted).
Expand Down
6 changes: 6 additions & 0 deletions go/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,9 @@ func (c *Client) CreateSession(ctx context.Context, config *SessionConfig) (*Ses
req.ClientName = config.ClientName
req.ReasoningEffort = config.ReasoningEffort
req.ConfigDir = config.ConfigDir
if config.EnableConfigDiscovery {
req.EnableConfigDiscovery = Bool(true)
}
req.Tools = config.Tools
wireSystemMessage, transformCallbacks := extractTransformCallbacks(config.SystemMessage)
req.SystemMessage = wireSystemMessage
Expand Down Expand Up @@ -754,6 +757,9 @@ func (c *Client) ResumeSessionWithOptions(ctx context.Context, sessionID string,
}
req.WorkingDirectory = config.WorkingDirectory
req.ConfigDir = config.ConfigDir
if config.EnableConfigDiscovery {
req.EnableConfigDiscovery = Bool(true)
}
if config.DisableResume {
req.DisableResume = Bool(true)
}
Expand Down
16 changes: 16 additions & 0 deletions go/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,13 @@ type SessionConfig struct {
// ConfigDir overrides the default configuration directory location.
// When specified, the session will use this directory for storing config and state.
ConfigDir string
// EnableConfigDiscovery, when true, automatically discovers MCP server configurations
// (e.g. .mcp.json, .vscode/mcp.json) and skill directories from the working directory
// and merges them with any explicitly provided MCPServers and SkillDirectories, with
// explicit values taking precedence on name collision.
// Custom instruction files (.github/copilot-instructions.md, AGENTS.md, etc.) are
// always loaded from the working directory regardless of this setting.
EnableConfigDiscovery bool
// Tools exposes caller-implemented tools to the CLI
Tools []Tool
// SystemMessage configures system message customization
Expand Down Expand Up @@ -692,6 +699,13 @@ type ResumeSessionConfig struct {
WorkingDirectory string
// ConfigDir overrides the default configuration directory location.
ConfigDir string
// EnableConfigDiscovery, when true, automatically discovers MCP server configurations
// (e.g. .mcp.json, .vscode/mcp.json) and skill directories from the working directory
// and merges them with any explicitly provided MCPServers and SkillDirectories, with
// explicit values taking precedence on name collision.
// Custom instruction files (.github/copilot-instructions.md, AGENTS.md, etc.) are
// always loaded from the working directory regardless of this setting.
EnableConfigDiscovery bool
// Streaming enables streaming of assistant message and reasoning chunks.
// When true, assistant.message_delta and assistant.reasoning_delta events
// with deltaContent are sent as the response is generated.
Expand Down Expand Up @@ -909,6 +923,7 @@ type createSessionRequest struct {
CustomAgents []CustomAgentConfig `json:"customAgents,omitempty"`
Agent string `json:"agent,omitempty"`
ConfigDir string `json:"configDir,omitempty"`
EnableConfigDiscovery *bool `json:"enableConfigDiscovery,omitempty"`
SkillDirectories []string `json:"skillDirectories,omitempty"`
DisabledSkills []string `json:"disabledSkills,omitempty"`
InfiniteSessions *InfiniteSessionConfig `json:"infiniteSessions,omitempty"`
Expand Down Expand Up @@ -948,6 +963,7 @@ type resumeSessionRequest struct {
Hooks *bool `json:"hooks,omitempty"`
WorkingDirectory string `json:"workingDirectory,omitempty"`
ConfigDir string `json:"configDir,omitempty"`
EnableConfigDiscovery *bool `json:"enableConfigDiscovery,omitempty"`
DisableResume *bool `json:"disableResume,omitempty"`
Streaming *bool `json:"streaming,omitempty"`
MCPServers map[string]MCPServerConfig `json:"mcpServers,omitempty"`
Expand Down
2 changes: 2 additions & 0 deletions nodejs/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,7 @@ export class CopilotClient {
customAgents: config.customAgents,
agent: config.agent,
configDir: config.configDir,
enableConfigDiscovery: config.enableConfigDiscovery,
skillDirectories: config.skillDirectories,
Comment thread
stephentoub marked this conversation as resolved.
disabledSkills: config.disabledSkills,
infiniteSessions: config.infiniteSessions,
Expand Down Expand Up @@ -873,6 +874,7 @@ export class CopilotClient {
hooks: !!(config.hooks && Object.values(config.hooks).some(Boolean)),
workingDirectory: config.workingDirectory,
configDir: config.configDir,
enableConfigDiscovery: config.enableConfigDiscovery,
streaming: config.streaming,
mcpServers: config.mcpServers,
envValueMode: "direct",
Expand Down
14 changes: 14 additions & 0 deletions nodejs/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1074,6 +1074,19 @@ export interface SessionConfig {
*/
configDir?: string;

/**
* When true, automatically discovers MCP server configurations (e.g. `.mcp.json`,
* `.vscode/mcp.json`) and skill directories from the working directory and merges
* them with any explicitly provided `mcpServers` and `skillDirectories`, with
* explicit values taking precedence on name collision.
*
* Note: custom instruction files (`.github/copilot-instructions.md`, `AGENTS.md`, etc.)
* are always loaded from the working directory regardless of this setting.
*
* @default false
*/
enableConfigDiscovery?: boolean;

/**
* Tools exposed to the CLI server
*/
Expand Down Expand Up @@ -1226,6 +1239,7 @@ export type ResumeSessionConfig = Pick<
| "hooks"
| "workingDirectory"
| "configDir"
| "enableConfigDiscovery"
| "mcpServers"
| "customAgents"
| "agent"
Expand Down
22 changes: 22 additions & 0 deletions python/copilot/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1202,6 +1202,7 @@ async def create_session(
custom_agents: list[CustomAgentConfig] | None = None,
agent: str | None = None,
config_dir: str | None = None,
enable_config_discovery: bool | None = None,
skill_directories: list[str] | None = None,
disabled_skills: list[str] | None = None,
infinite_sessions: InfiniteSessionConfig | None = None,
Expand Down Expand Up @@ -1238,6 +1239,13 @@ async def create_session(
custom_agents: Custom agent configurations.
agent: Agent to use for the session.
config_dir: Override for the configuration directory.
enable_config_discovery: When True, automatically discovers MCP server
configurations (e.g. ``.mcp.json``, ``.vscode/mcp.json``) and skill
directories from the working directory and merges them with any
explicitly provided ``mcp_servers`` and ``skill_directories``, with
explicit values taking precedence on name collision. Custom instruction
files (``.github/copilot-instructions.md``, ``AGENTS.md``, etc.) are
always loaded regardless of this setting.
skill_directories: Directories to search for skills.
disabled_skills: Skills to disable.
infinite_sessions: Infinite session configuration.
Expand Down Expand Up @@ -1362,6 +1370,10 @@ async def create_session(
if config_dir:
payload["configDir"] = config_dir

# Add config discovery flag if provided
if enable_config_discovery is not None:
payload["enableConfigDiscovery"] = enable_config_discovery

Comment thread
stephentoub marked this conversation as resolved.
# Add skill directories configuration if provided
if skill_directories:
payload["skillDirectories"] = skill_directories
Expand Down Expand Up @@ -1455,6 +1467,7 @@ async def resume_session(
custom_agents: list[CustomAgentConfig] | None = None,
agent: str | None = None,
config_dir: str | None = None,
enable_config_discovery: bool | None = None,
skill_directories: list[str] | None = None,
disabled_skills: list[str] | None = None,
infinite_sessions: InfiniteSessionConfig | None = None,
Expand Down Expand Up @@ -1491,6 +1504,13 @@ async def resume_session(
custom_agents: Custom agent configurations.
agent: Agent to use for the session.
config_dir: Override for the configuration directory.
enable_config_discovery: When True, automatically discovers MCP server
configurations (e.g. ``.mcp.json``, ``.vscode/mcp.json``) and skill
directories from the working directory and merges them with any
explicitly provided ``mcp_servers`` and ``skill_directories``, with
explicit values taking precedence on name collision. Custom instruction
files (``.github/copilot-instructions.md``, ``AGENTS.md``, etc.) are
always loaded regardless of this setting.
skill_directories: Directories to search for skills.
disabled_skills: Skills to disable.
infinite_sessions: Infinite session configuration.
Expand Down Expand Up @@ -1588,6 +1608,8 @@ async def resume_session(
payload["workingDirectory"] = working_directory
if config_dir:
payload["configDir"] = config_dir
if enable_config_discovery is not None:
payload["enableConfigDiscovery"] = enable_config_discovery

# TODO: disable_resume is not a keyword arg yet; keeping for future use
if mcp_servers:
Expand Down
Loading