diff --git a/dotnet/Directory.Packages.props b/dotnet/Directory.Packages.props index a07bde035b..a91ae973da 100644 --- a/dotnet/Directory.Packages.props +++ b/dotnet/Directory.Packages.props @@ -98,7 +98,7 @@ - + diff --git a/dotnet/samples/02-agents/AgentProviders/Agent_With_GitHubCopilot/Program.cs b/dotnet/samples/02-agents/AgentProviders/Agent_With_GitHubCopilot/Program.cs index b233259dcc..149cbbe029 100644 --- a/dotnet/samples/02-agents/AgentProviders/Agent_With_GitHubCopilot/Program.cs +++ b/dotnet/samples/02-agents/AgentProviders/Agent_With_GitHubCopilot/Program.cs @@ -12,7 +12,9 @@ static Task PromptPermission(PermissionRequest request, Console.Write("Approve? (y/n): "); string? input = Console.ReadLine()?.Trim().ToUpperInvariant(); - string kind = input is "Y" or "YES" ? "approved" : "denied-interactively-by-user"; + PermissionRequestResultKind kind = input is "Y" or "YES" + ? PermissionRequestResultKind.Approved + : PermissionRequestResultKind.Rejected; return Task.FromResult(new PermissionRequestResult { Kind = kind }); } diff --git a/dotnet/src/Microsoft.Agents.AI.GitHub.Copilot/GitHubCopilotAgent.cs b/dotnet/src/Microsoft.Agents.AI.GitHub.Copilot/GitHubCopilotAgent.cs index bbebd7a312..c8a4ffe028 100644 --- a/dotnet/src/Microsoft.Agents.AI.GitHub.Copilot/GitHubCopilotAgent.cs +++ b/dotnet/src/Microsoft.Agents.AI.GitHub.Copilot/GitHubCopilotAgent.cs @@ -210,7 +210,7 @@ protected override async IAsyncEnumerable RunCoreStreamingA string prompt = string.Join("\n", messages.Select(m => m.Text)); // Handle DataContent as attachments - (List? attachments, tempDir) = await ProcessDataContentAttachmentsAsync( + (List? attachments, tempDir) = await ProcessDataContentAttachmentsAsync( messages, cancellationToken).ConfigureAwait(false); @@ -443,11 +443,11 @@ private AgentResponseUpdate ConvertToAgentResponseUpdate(SessionEvent sessionEve return new SessionConfig { Tools = mappedTools, SystemMessage = systemMessage }; } - private static async Task<(List? Attachments, string? TempDir)> ProcessDataContentAttachmentsAsync( + private static async Task<(List? Attachments, string? TempDir)> ProcessDataContentAttachmentsAsync( IEnumerable messages, CancellationToken cancellationToken) { - List? attachments = null; + List? attachments = null; string? tempDir = null; foreach (ChatMessage message in messages) { @@ -461,7 +461,7 @@ private AgentResponseUpdate ConvertToAgentResponseUpdate(SessionEvent sessionEve string tempFilePath = await dataContent.SaveToAsync(tempDir, cancellationToken).ConfigureAwait(false); attachments ??= []; - attachments.Add(new UserMessageDataAttachmentsItemFile + attachments.Add(new UserMessageAttachmentFile { Path = tempFilePath, DisplayName = Path.GetFileName(tempFilePath) diff --git a/dotnet/tests/Microsoft.Agents.AI.GitHub.Copilot.IntegrationTests/GitHubCopilotAgentTests.cs b/dotnet/tests/Microsoft.Agents.AI.GitHub.Copilot.IntegrationTests/GitHubCopilotAgentTests.cs index 855e9b4037..f8b5210c89 100644 --- a/dotnet/tests/Microsoft.Agents.AI.GitHub.Copilot.IntegrationTests/GitHubCopilotAgentTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.GitHub.Copilot.IntegrationTests/GitHubCopilotAgentTests.cs @@ -14,7 +14,7 @@ public class GitHubCopilotAgentTests private const string SkipReason = "Integration tests require GitHub Copilot CLI installed. For local execution only."; private static Task OnPermissionRequestAsync(PermissionRequest request, PermissionInvocation invocation) - => Task.FromResult(new PermissionRequestResult { Kind = "approved" }); + => Task.FromResult(new PermissionRequestResult { Kind = PermissionRequestResultKind.Approved }); [Fact(Skip = SkipReason)] public async Task RunAsync_WithSimplePrompt_ReturnsResponseAsync() @@ -201,11 +201,10 @@ public async Task RunAsync_WithLocalMcpServer_UsesServerToolsAsync() SessionConfig sessionConfig = new() { OnPermissionRequest = OnPermissionRequestAsync, - McpServers = new Dictionary + McpServers = new Dictionary { - ["filesystem"] = new McpLocalServerConfig + ["filesystem"] = new McpStdioServerConfig { - Type = "stdio", Command = "npx", Args = ["-y", "@modelcontextprotocol/server-filesystem", "."], Tools = ["*"], @@ -234,11 +233,10 @@ public async Task RunAsync_WithRemoteMcpServer_UsesServerToolsAsync() SessionConfig sessionConfig = new() { OnPermissionRequest = OnPermissionRequestAsync, - McpServers = new Dictionary + McpServers = new Dictionary { - ["microsoft-learn"] = new McpRemoteServerConfig + ["microsoft-learn"] = new McpHttpServerConfig { - Type = "http", Url = "https://learn.microsoft.com/api/mcp", Tools = ["*"], }, diff --git a/dotnet/tests/Microsoft.Agents.AI.GitHub.Copilot.UnitTests/GitHubCopilotAgentTests.cs b/dotnet/tests/Microsoft.Agents.AI.GitHub.Copilot.UnitTests/GitHubCopilotAgentTests.cs index 52ea0026dc..e2d63b4fc5 100644 --- a/dotnet/tests/Microsoft.Agents.AI.GitHub.Copilot.UnitTests/GitHubCopilotAgentTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.GitHub.Copilot.UnitTests/GitHubCopilotAgentTests.cs @@ -111,7 +111,7 @@ public void CopySessionConfig_CopiesAllProperties() var systemMessage = new SystemMessageConfig { Mode = SystemMessageMode.Append, Content = "Be helpful" }; PermissionRequestHandler permissionHandler = (_, _) => Task.FromResult(new PermissionRequestResult()); UserInputHandler userInputHandler = (_, _) => Task.FromResult(new UserInputResponse { Answer = "input" }); - var mcpServers = new Dictionary { ["server1"] = new McpLocalServerConfig() }; + var mcpServers = new Dictionary { ["server1"] = new McpStdioServerConfig() }; var source = new SessionConfig { @@ -162,7 +162,7 @@ public void CopyResumeSessionConfig_CopiesAllProperties() var systemMessage = new SystemMessageConfig { Mode = SystemMessageMode.Append, Content = "Be helpful" }; PermissionRequestHandler permissionHandler = (_, _) => Task.FromResult(new PermissionRequestResult()); UserInputHandler userInputHandler = (_, _) => Task.FromResult(new UserInputResponse { Answer = "input" }); - var mcpServers = new Dictionary { ["server1"] = new McpLocalServerConfig() }; + var mcpServers = new Dictionary { ["server1"] = new McpStdioServerConfig() }; var source = new SessionConfig {