45 lines
1.2 KiB
C#
45 lines
1.2 KiB
C#
namespace Nexus.Api.Services;
|
|
|
|
public static class AgentIdentityCatalog
|
|
{
|
|
public static readonly string[] DefaultConfiguredAgentIds =
|
|
[
|
|
"main",
|
|
"iris",
|
|
"product-owner",
|
|
"programmer",
|
|
"programmer-fast",
|
|
"reviewer",
|
|
"architekt",
|
|
"researcher",
|
|
"executor"
|
|
];
|
|
|
|
private static readonly string[] WorkflowActorIds =
|
|
[
|
|
"bao",
|
|
"nexus-system"
|
|
];
|
|
|
|
public static IReadOnlySet<string> BuildAllowedActorIds(IEnumerable<string> configuredAgentIds)
|
|
{
|
|
var ids = new HashSet<string>(WorkflowActorIds, StringComparer.OrdinalIgnoreCase);
|
|
foreach (var configuredAgentId in configuredAgentIds)
|
|
{
|
|
if (!string.IsNullOrWhiteSpace(configuredAgentId))
|
|
ids.Add(configuredAgentId.Trim().ToLowerInvariant());
|
|
}
|
|
|
|
return ids;
|
|
}
|
|
|
|
public static string? NormalizeActorId(string? actorId, IReadOnlySet<string> allowedActorIds)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(actorId))
|
|
return null;
|
|
|
|
var normalized = actorId.Trim().ToLowerInvariant();
|
|
return allowedActorIds.Contains(normalized) ? normalized : null;
|
|
}
|
|
}
|