feat(a2a-client): scaffold the A2A client extension behind A2AClient__Enabled

This commit is contained in:
EugeneTes
2026-10-08 12:35:26 +00:00
parent e70557725a
commit 76e465ed2a
6 changed files with 70 additions and 0 deletions

View File

@@ -1,5 +1,6 @@
<Solution> <Solution>
<Folder Name="/extensions/"> <Folder Name="/extensions/">
<Project Path="extensions/Volcanic.AgenticCore.Extensions.A2A/Volcanic.AgenticCore.Extensions.A2A.csproj" />
<Project Path="extensions/Volcanic.AgenticCore.Extensions.Anthropic/Volcanic.AgenticCore.Extensions.Anthropic.csproj" /> <Project Path="extensions/Volcanic.AgenticCore.Extensions.Anthropic/Volcanic.AgenticCore.Extensions.Anthropic.csproj" />
<Project Path="extensions/Volcanic.AgenticCore.Extensions.ClaudeCode.Bridge/Volcanic.AgenticCore.Extensions.ClaudeCode.Bridge.csproj" /> <Project Path="extensions/Volcanic.AgenticCore.Extensions.ClaudeCode.Bridge/Volcanic.AgenticCore.Extensions.ClaudeCode.Bridge.csproj" />
<Project Path="extensions/Volcanic.AgenticCore.Extensions.ClaudeCode/Volcanic.AgenticCore.Extensions.ClaudeCode.csproj" /> <Project Path="extensions/Volcanic.AgenticCore.Extensions.ClaudeCode/Volcanic.AgenticCore.Extensions.ClaudeCode.csproj" />

View File

@@ -0,0 +1,23 @@
namespace Volcanic.AgenticCore.Extensions.A2A;
/// <summary>Section <c>A2AClient</c> (env <c>A2AClient__…</c>). Named so it doesn't clash with the SDK's <c>A2AClientOptions</c>.</summary>
public sealed class A2AClientSettings
{
public const string SectionName = "A2AClient";
/// <summary>Off by default: no <c>a2a</c> tool, no watches. Independent of the server's <c>A2A:Enabled</c>.</summary>
public bool Enabled { get; set; }
/// <summary>How long <c>send</c> waits for a result before a watch takes over. 0 hands over at once.</summary>
public int WaitSeconds { get; set; } = 60;
public TimeSpan WatchTimeout { get; set; } = TimeSpan.FromDays(1);
public int CardTimeoutSeconds { get; set; } = 10;
public long MaxFileBytes { get; set; } = 10 * 1024 * 1024;
/// <summary>
/// Our public base URL for push webhooks (<c>{PushBaseUrl}/a2a/push/{watchId}</c>). Set by the host from the server's
/// <c>A2A:PublicUrl</c> only while the server (and so the push receiver) is on; null = subscribe or poll.
/// </summary>
public string? PushBaseUrl { get; set; }
}

View File

@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Description>A2A client extension: the a2a tool, remote agents in agents.json, watches for long tasks.</Description>
</PropertyGroup>
<ItemGroup>
<!-- Private="false": the host already ships Abstractions; an extension must not bring its own copy (docs/extensions.md). -->
<ProjectReference Include="../../src/Volcanic.AgenticCore.Abstractions/Volcanic.AgenticCore.Abstractions.csproj" Private="false" />
<PackageReference Include="A2A" Version="1.0.0-preview2" />
</ItemGroup>
<ItemGroup>
<InternalsVisibleTo Include="Volcanic.AgenticCore.Extensions.Tests" />
<InternalsVisibleTo Include="Volcanic.AgenticCore.Telegram.Tests" />
</ItemGroup>
</Project>

View File

@@ -9,6 +9,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<InternalsVisibleTo Include="Volcanic.AgenticCore.A2A.Server.Tests" /> <InternalsVisibleTo Include="Volcanic.AgenticCore.A2A.Server.Tests" />
<InternalsVisibleTo Include="Volcanic.AgenticCore.Extensions.Tests" />
<InternalsVisibleTo Include="Volcanic.AgenticCore.Telegram.Tests" /> <InternalsVisibleTo Include="Volcanic.AgenticCore.Telegram.Tests" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@@ -0,0 +1,19 @@
using Volcanic.AgenticCore.Extensions.A2A;
namespace Volcanic.AgenticCore.Extensions.Tests.A2A;
public class A2AClientSettingsTests
{
[Fact]
public void Defaults_OffWithSpecValues()
{
var s = new A2AClientSettings();
Assert.False(s.Enabled);
Assert.Equal(60, s.WaitSeconds);
Assert.Equal(TimeSpan.FromDays(1), s.WatchTimeout);
Assert.Equal(10, s.CardTimeoutSeconds);
Assert.Equal(10 * 1024 * 1024, s.MaxFileBytes);
Assert.Null(s.PushBaseUrl);
Assert.Equal("A2AClient", A2AClientSettings.SectionName);
}
}

View File

@@ -11,6 +11,8 @@
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.0" /> <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="10.0.0" /> <PackageReference Include="Microsoft.Extensions.Logging" Version="10.0.0" />
<PackageReference Include="Microsoft.Extensions.TimeProvider.Testing" Version="10.9.0" /> <PackageReference Include="Microsoft.Extensions.TimeProvider.Testing" Version="10.9.0" />
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="10.0.0" />
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="ClaudeCode/Fixtures/*" CopyToOutputDirectory="PreserveNewest" /> <None Include="ClaudeCode/Fixtures/*" CopyToOutputDirectory="PreserveNewest" />
@@ -18,6 +20,8 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="../../src/Volcanic.AgenticCore/Volcanic.AgenticCore.csproj" /> <ProjectReference Include="../../src/Volcanic.AgenticCore/Volcanic.AgenticCore.csproj" />
<ProjectReference Include="../../src/Volcanic.AgenticCore.Abstractions/Volcanic.AgenticCore.Abstractions.csproj" /> <ProjectReference Include="../../src/Volcanic.AgenticCore.Abstractions/Volcanic.AgenticCore.Abstractions.csproj" />
<ProjectReference Include="../../extensions/Volcanic.AgenticCore.Extensions.A2A/Volcanic.AgenticCore.Extensions.A2A.csproj" />
<ProjectReference Include="../../src/Volcanic.AgenticCore.A2A.Server/Volcanic.AgenticCore.A2A.Server.csproj" />
<ProjectReference Include="../../extensions/Volcanic.AgenticCore.Extensions.Anthropic/Volcanic.AgenticCore.Extensions.Anthropic.csproj" /> <ProjectReference Include="../../extensions/Volcanic.AgenticCore.Extensions.Anthropic/Volcanic.AgenticCore.Extensions.Anthropic.csproj" />
<ProjectReference Include="../../extensions/Volcanic.AgenticCore.Extensions.OpenAI/Volcanic.AgenticCore.Extensions.OpenAI.csproj" /> <ProjectReference Include="../../extensions/Volcanic.AgenticCore.Extensions.OpenAI/Volcanic.AgenticCore.Extensions.OpenAI.csproj" />
<ProjectReference Include="../../extensions/Volcanic.AgenticCore.Extensions.ClaudeCode/Volcanic.AgenticCore.Extensions.ClaudeCode.csproj" /> <ProjectReference Include="../../extensions/Volcanic.AgenticCore.Extensions.ClaudeCode/Volcanic.AgenticCore.Extensions.ClaudeCode.csproj" />
@@ -27,4 +31,12 @@
<ProjectReference Include="../../extensions/Volcanic.AgenticCore.Extensions.Scheduler/Volcanic.AgenticCore.Extensions.Scheduler.csproj" /> <ProjectReference Include="../../extensions/Volcanic.AgenticCore.Extensions.Scheduler/Volcanic.AgenticCore.Extensions.Scheduler.csproj" />
<ProjectReference Include="../Volcanic.AgenticCore.Extensions.Tests.FakeMcpServer/Volcanic.AgenticCore.Extensions.Tests.FakeMcpServer.csproj" /> <ProjectReference Include="../Volcanic.AgenticCore.Extensions.Tests.FakeMcpServer/Volcanic.AgenticCore.Extensions.Tests.FakeMcpServer.csproj" />
</ItemGroup> </ItemGroup>
<!-- The ASP.NET shared framework (FrameworkReference above) makes the SDK skip copying Microsoft.Extensions.* assemblies,
but the fake MCP server runs on Microsoft.NETCore.App only and needs its own copies next to its dll. -->
<Target Name="CopyFakeMcpServerFrameworkAssemblies" AfterTargets="Build">
<ItemGroup>
<FakeMcpExtraDll Include="$(MSBuildProjectDirectory)/../Volcanic.AgenticCore.Extensions.Tests.FakeMcpServer/bin/$(Configuration)/$(TargetFramework)/Microsoft.Extensions.*.dll" />
</ItemGroup>
<Copy SourceFiles="@(FakeMcpExtraDll)" DestinationFolder="$(OutDir)" SkipUnchangedFiles="true" />
</Target>
</Project> </Project>