Forge
csharp6dd9109c
1#nullable enable
2using CascadeIDE.Cockpit.Channels;
3
4namespace CascadeIDE.Cockpit.Channels.TraceFlow;
5
6/// <summary>
7/// Aggregates multiple trace-flow channels into one combined semantic payload.
8/// </summary>
9public sealed class TraceFlowChannelCoordinator : IChannelCoordinator<TraceFlowChannelContext, TraceFlowChannelSnapshot>
10{
11 private readonly IReadOnlyList<ITraceFlowChannel> _channels;
12
13 public TraceFlowChannelCoordinator(IEnumerable<ITraceFlowChannel> channels)
14 {
15 _channels = channels.ToArray();
16 }
17
18 public TraceFlowChannelSnapshot Build(in TraceFlowChannelContext context)
19 {
20 var nodes = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
21 var edges = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
22 foreach (var channel in _channels)
23 {
24 var snapshot = channel.Build(context);
25 nodes.UnionWith(snapshot.HighlightedNodeIds);
26 edges.UnionWith(snapshot.HighlightedEdgeKeys);
27 }
28
29 return new TraceFlowChannelSnapshot(nodes, edges);
30 }
31}
32
View only · write via MCP/CIDE