agent: unify listening and dialing with directed mutual measurements

Replace Probe with Agent across node runtime, Fleet contracts, backend state, API and storage. Report incoming sessions and outgoing link health through each Agent uplink, and retain directed link controls and retry.

Update protocol fixtures and end-to-end coverage for the unified model; accept requested cancellation during the Fleet timeout test cleanup.
This commit is contained in:
justme committed 2026-10-21 11:55:36 +08:00
1 parent d5ebf29e57
commit ad5efc62ff
206 files changed
+4202 -4964

No files matched your search

@@ -2,7 +2,7 @@ using System.Reflection;
using Fleet.Rpc;
using Fleet.Server;
using Microsoft.Extensions.DependencyInjection;
using MoShiro.Probe;
using MoShiro.Agent;
using MoShiro.Protocol;
namespace MoShiro.Backend.Tests;
@@ -55,29 +55,13 @@ public sealed class ProtocolDeclarationTests : IClassFixture<BackendFixture>
}
[Fact]
public async Task Agent_HandlesEveryMethodItShould_OnBothPlanes()
public async Task Node_HandlesEveryMethodItShould_OnBothPlanes()
{
await using AgentHarness agent = await AgentHarness.StartAsync(_backend);
Assert.Empty(s_table.MissingHandlers(RpcSide.Node, NodeRoles.Agent, agent.App.Link.Router.Methods));
// 对等面:Agent 是监听方,要处理 Probe 发来的方法
Assert.Empty(s_table.MissingHandlers(RpcSide.Node, null, agent.App.Link.Router.Methods));
// 对等面:节点作为监听方处理拨号方发来的方法,作为拨号方处理监听方发来的方法
Assert.Empty(s_table.MissingHandlers(RpcSide.Listener, null, agent.App.PeerRouter.Methods));
}
[Fact]
public async Task Probe_HandlesEveryMethodItShould_OnBothPlanes()
{
await using ProbeHarness probe = await ProbeHarness.StartAsync(_backend);
Assert.Empty(s_table.MissingHandlers(RpcSide.Node, NodeRoles.Probe, probe.App.Link.Router.Methods));
// 对等面:Probe 是拨号方,要处理 Agent 发来的方法
Assert.Empty(s_table.MissingHandlers(RpcSide.Dialer, null, AgentConnection.Router.Methods));
}
[Fact]
public void RolesOfNodeIds_FollowThePrefix()
{
Assert.Equal(NodeRoles.Agent, NodeRoles.Of(AgentIds.Prefix + "_01ABC"));
Assert.Equal(NodeRoles.Probe, NodeRoles.Of(ProbeId.Prefix + "_01ABC"));
Assert.Null(NodeRoles.Of("usr_01ABC"));
Assert.Empty(s_table.MissingHandlers(RpcSide.Dialer, null, DialConnection.Router.Methods));
}
private static string FindRoot()