.NET: Upgrade AG-UI SDK packages to 0.0.5 (#7742)

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 425c405b-1fd3-4ba6-b332-a195598374b4
This commit is contained in:
Javier Calvarro Nelson
2026-08-19 10:53:56 +00:00
committed by GitHub
parent 10bf8d7d9e
commit 064751c5f3
2 changed files with 46 additions and 8 deletions
+5 -5
View File
@@ -54,11 +54,11 @@
<PackageVersion Include="System.Net.Http.Json" Version="10.0.0" />
<PackageVersion Include="System.Net.ServerSentEvents" Version="10.0.8" />
<!-- AG-UI .NET SDK packages (published by the AG-UI team). -->
<PackageVersion Include="AGUI.Abstractions" Version="0.0.4" />
<PackageVersion Include="AGUI.Formatting" Version="0.0.4" />
<PackageVersion Include="AGUI.Protobuf" Version="0.0.4" />
<PackageVersion Include="AGUI.Client" Version="0.0.4" />
<PackageVersion Include="AGUI.Server" Version="0.0.4" />
<PackageVersion Include="AGUI.Abstractions" Version="0.0.5" />
<PackageVersion Include="AGUI.Formatting" Version="0.0.5" />
<PackageVersion Include="AGUI.Protobuf" Version="0.0.5" />
<PackageVersion Include="AGUI.Client" Version="0.0.5" />
<PackageVersion Include="AGUI.Server" Version="0.0.5" />
<PackageVersion Include="System.Text.Json" Version="10.0.11" />
<PackageVersion Include="System.Threading.Channels" Version="10.0.11" />
<PackageVersion Include="System.Threading.Tasks.Extensions" Version="4.6.3" />
@@ -13,6 +13,7 @@ using System.Text.Json.Serialization;
using System.Threading;
using System.Threading.Tasks;
using AGUI.Abstractions;
using AGUI.Client;
using AGUI.Server;
using FluentAssertions;
using Microsoft.AspNetCore.Builder;
@@ -28,6 +29,37 @@ public sealed class ForwardedPropertiesTests : IAsyncDisposable
private WebApplication? _app;
private HttpClient? _client;
[Fact]
public async Task ChatClient_ForwardsContextAndForwardedPropsFromRawRepresentationFactoryAsync()
{
// Arrange
FakeForwardedPropsAgent fakeAgent = new();
await this.SetupTestServerAsync(fakeAgent);
var chatClient = new AGUIChatClient(new(this._client!, "/agent"));
JsonElement forwardedProperties = JsonSerializer.SerializeToElement(new { tenantId = "tenant-123" });
ChatOptions options = new()
{
RawRepresentationFactory = _ => new RunAgentInput
{
Context = [new AGUIContext { Description = "Current user", Value = "Ada Lovelace" }],
ForwardedProperties = forwardedProperties,
},
};
// Act
await foreach (ChatResponseUpdate _ in chatClient.GetStreamingResponseAsync(
[new ChatMessage(ChatRole.User, "test client forwarding")],
options))
{
}
// Assert
fakeAgent.ReceivedContext.Should().ContainSingle();
fakeAgent.ReceivedContext![0].Description.Should().Be("Current user");
fakeAgent.ReceivedContext[0].Value.Should().Be("Ada Lovelace");
fakeAgent.ReceivedForwardedProperties.GetProperty("tenantId").GetString().Should().Be("tenant-123");
}
[Fact]
public async Task ForwardedProps_AreParsedAndPassedToAgent_WhenProvidedInRequestAsync()
{
@@ -304,6 +336,8 @@ internal sealed class FakeForwardedPropsAgent : AIAgent
public override string? Description => "Agent for forwarded properties testing";
public IList<AGUIContext>? ReceivedContext { get; private set; }
public JsonElement ReceivedForwardedProperties { get; private set; }
protected override Task<AgentResponse> RunCoreAsync(IEnumerable<ChatMessage> messages, AgentSession? session = null, AgentRunOptions? options = null, CancellationToken cancellationToken = default)
@@ -319,10 +353,14 @@ internal sealed class FakeForwardedPropsAgent : AIAgent
{
// Recover the originating AG-UI input from the request options (set by the hosting layer).
if (options is ChatClientAgentRunOptions { ChatOptions: { } chatOptions } &&
chatOptions.TryGetRunAgentInput(out RunAgentInput? agentInput) &&
agentInput.ForwardedProperties is { ValueKind: not JsonValueKind.Undefined } forwardedProps)
chatOptions.TryGetRunAgentInput(out RunAgentInput? agentInput))
{
this.ReceivedForwardedProperties = forwardedProps;
this.ReceivedContext = agentInput.Context;
if (agentInput.ForwardedProperties is { ValueKind: not JsonValueKind.Undefined } forwardedProps)
{
this.ReceivedForwardedProperties = forwardedProps;
}
}
// Always return a text response