| | | 1 | | // Copyright (c) NexusLabs. All rights reserved. |
| | | 2 | | // Licensed under the MIT License. |
| | | 3 | | |
| | | 4 | | namespace NexusLabs.Needlr.AgentFramework; |
| | | 5 | | |
| | | 6 | | /// <summary> |
| | | 7 | | /// Compile-time graph topology data registered by the source generator. |
| | | 8 | | /// Each instance captures the entry point, edges, nodes, and optional reducer |
| | | 9 | | /// for one named graph. |
| | | 10 | | /// </summary> |
| | | 11 | | public sealed class GraphTopologyRegistration |
| | | 12 | | { |
| | | 13 | | /// <summary> |
| | | 14 | | /// Initializes a new instance of <see cref="GraphTopologyRegistration"/>. |
| | | 15 | | /// </summary> |
| | | 16 | | /// <param name="entryType">The entry-point agent type for this graph, or <c>null</c> if none was declared.</param> |
| | | 17 | | /// <param name="routingMode">The graph-level routing mode (cast from <c>GraphRoutingMode</c>).</param> |
| | | 18 | | /// <param name="edges">All edges in this graph with source, target, optional condition, required flag, and optional |
| | | 19 | | /// <param name="nodes">All explicitly declared nodes with their join mode.</param> |
| | | 20 | | /// <param name="reducer">The reducer type and static method name, or <c>null</c> if no reducer was declared.</param |
| | 0 | 21 | | public GraphTopologyRegistration( |
| | 0 | 22 | | Type? entryType, |
| | 0 | 23 | | int routingMode, |
| | 0 | 24 | | IReadOnlyList<(Type Source, Type Target, string? Condition, bool IsRequired, int? NodeRoutingMode)> edges, |
| | 0 | 25 | | IReadOnlyList<(Type NodeType, int JoinMode)> nodes, |
| | 0 | 26 | | (Type ReducerType, string ReducerMethod)? reducer) |
| | | 27 | | { |
| | 0 | 28 | | EntryType = entryType; |
| | 0 | 29 | | RoutingMode = routingMode; |
| | 0 | 30 | | Edges = edges; |
| | 0 | 31 | | Nodes = nodes; |
| | 0 | 32 | | Reducer = reducer; |
| | 0 | 33 | | } |
| | | 34 | | |
| | | 35 | | /// <summary>The entry-point agent type for this graph.</summary> |
| | 0 | 36 | | public Type? EntryType { get; } |
| | | 37 | | |
| | | 38 | | /// <summary>The graph-level routing mode as an integer (maps to <c>GraphRoutingMode</c>).</summary> |
| | 0 | 39 | | public int RoutingMode { get; } |
| | | 40 | | |
| | | 41 | | /// <summary>All declared edges: source agent type, target agent type, optional condition string, required flag, and |
| | 0 | 42 | | public IReadOnlyList<(Type Source, Type Target, string? Condition, bool IsRequired, int? NodeRoutingMode)> Edges { g |
| | | 43 | | |
| | | 44 | | /// <summary>All explicitly declared node join modes.</summary> |
| | 0 | 45 | | public IReadOnlyList<(Type NodeType, int JoinMode)> Nodes { get; } |
| | | 46 | | |
| | | 47 | | /// <summary>The reducer type and static method name, if declared.</summary> |
| | 0 | 48 | | public (Type ReducerType, string ReducerMethod)? Reducer { get; } |
| | | 49 | | } |