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

@@ -10,7 +10,7 @@ namespace MoShiro.Backend.Gateway;
public static class GatewayServiceCollectionExtensions
{
/// <summary>
/// 在 Fleet.Server 之上接入 MoShiro:期望状态(TaskSet)、RawChunk 收件箱、<c>moshiro.*</c> 方法、注册挂钩和节点事件。
/// 在 Fleet.Server 之上接入 MoShiro:期望状态(TaskSet、DialTargets)、RawChunk 收件箱、<c>moshiro.*</c> 方法、注册挂钩和节点事件。
/// 需要事先注册 <see cref="IFleetStore"/> 和 <see cref="TimeProvider"/>,并在 <c>AddMoShiroApplication</c> 之后调用。
/// </summary>
public static IServiceCollection AddMoShiroGateway(this IServiceCollection services)
@@ -18,15 +18,11 @@ public static class GatewayServiceCollectionExtensions
services.AddSingleton<IAgentGateway, FleetGateway>();
services.AddHostedService<ConnectionShutdown>();
services.AddFleetEnrollment();
services.AddFleetServer(options =>
{
options.NodeIdPrefix = AgentIds.Prefix;
options.NodeIdPrefixes[JoinTokenService.ProbeRole] = ProbeId.Prefix;
})
services.AddFleetServer(options => options.NodeIdPrefix = AgentIds.Prefix)
.AddState<TaskSetStateProvider>()
.AddState<ProbeAgentsStateProvider>()
.AddState<DialTargetsStateProvider>()
.AddInbox<RawChunkInbox>()
.WithMethods(MoShiroMethodTable.Table, node => NodeRoles.Of(node.Id.Value))
.WithMethods(MoShiroMethodTable.Table)
.MapMethods(MapMoShiroMethods);
return services;
}