mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
Python: .NET: Executor source gen for workflow executor routing (#3131)
* Roslyn Source Generators for Workflow Executor Routing. * Update dotnet/src/Microsoft.Agents.AI.Workflows.Generators/ExecutorRouteGenerator.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * WIP. * All fixed up except dangling sends/yields attriutes, working on that next. * Add protocol-only generation for SendsMessage/YieldsOutput attributes * Ensuring collections that can change order are sorted to enable pipeline caching. * Improvents per PR feedback. --------- Co-authored-by: alliscode <bentho@microsoft.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
co-authored by
Copilot
alliscode
parent
4940d0ef36
commit
ea7818d390
@@ -0,0 +1,51 @@
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
|
||||
namespace Microsoft.Agents.AI.Workflows.Generators.Models;
|
||||
|
||||
/// <summary>
|
||||
/// Represents the result of analyzing a single method with [MessageHandler].
|
||||
/// Contains both the method's handler info and class context for grouping.
|
||||
/// Uses value-equatable types to support incremental generator caching.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Class-level validation (IsPartialClass, DerivesFromExecutor, HasManualConfigureRoutes)
|
||||
/// is extracted here but validated once per class in CombineMethodResults to avoid
|
||||
/// redundant validation work when a class has multiple handlers.
|
||||
/// </remarks>
|
||||
internal sealed record MethodAnalysisResult(
|
||||
// Class identification for grouping
|
||||
string ClassKey,
|
||||
|
||||
// Class-level info (extracted once per method, will be same for all methods in class)
|
||||
string? Namespace,
|
||||
string ClassName,
|
||||
string? GenericParameters,
|
||||
bool IsNested,
|
||||
string ContainingTypeChain,
|
||||
bool BaseHasConfigureRoutes,
|
||||
ImmutableEquatableArray<string> ClassSendTypes,
|
||||
ImmutableEquatableArray<string> ClassYieldTypes,
|
||||
|
||||
// Class-level facts (used for validation in CombineMethodResults)
|
||||
bool IsPartialClass,
|
||||
bool DerivesFromExecutor,
|
||||
bool HasManualConfigureRoutes,
|
||||
|
||||
// Class location for diagnostics (value-equatable)
|
||||
DiagnosticLocationInfo? ClassLocation,
|
||||
|
||||
// Method-level info (null if method validation failed)
|
||||
HandlerInfo? Handler,
|
||||
|
||||
// Method-level diagnostics only (class-level diagnostics created in CombineMethodResults)
|
||||
ImmutableEquatableArray<DiagnosticInfo> Diagnostics)
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets an empty result for invalid targets (e.g., attribute on non-method).
|
||||
/// </summary>
|
||||
public static MethodAnalysisResult Empty { get; } = new(
|
||||
string.Empty, null, string.Empty, null, false, string.Empty,
|
||||
false, ImmutableEquatableArray<string>.Empty, ImmutableEquatableArray<string>.Empty,
|
||||
false, false, false,
|
||||
null, null, ImmutableEquatableArray<DiagnosticInfo>.Empty);
|
||||
}
|
||||
Reference in New Issue
Block a user