mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
.NET: Add support for Subworkflows and many threading fixes (#1066)
* feat: Add support for Workflow-as-Executor * Fixes routing of 'object' compile-typed variables to properly take in type information * Fixes a concurrency issue in StepTracer * fix: Make Subworkflow ExternalRequests work properly * fix: Threading and Concurrency fixes; prep for OffThread Mode * refactor: Remove dead code around OffStreamRunEventStream Currently not used, and will be replaced with a rewrite when brought back, so having it in the change is not valuable. * ci: Work around issues with dotnet-format not properly analyzing the source * fix: Fix the logic of AsyncCoordinator and AsyncBarrier * Prevent individual wait cancellations from canceling the entire barrier * Propagate information about whether the wait was completed or cancelled, and whether any waiters were present when released * fix: Remove superfluous acces to .Keys in InProcStepTracer * refactor: Clean up AsyncCoordinator's use of AsyncBarrier
This commit is contained in:
@@ -12,9 +12,9 @@ internal sealed class EdgeMap
|
||||
{
|
||||
private readonly Dictionary<EdgeId, EdgeRunner> _edgeRunners = [];
|
||||
private readonly Dictionary<EdgeId, IStatefulEdgeRunner> _statefulRunners = [];
|
||||
private readonly Dictionary<string, InputEdgeRunner> _portEdgeRunners;
|
||||
private readonly Dictionary<string, ResponseEdgeRunner> _portEdgeRunners;
|
||||
|
||||
private readonly InputEdgeRunner _inputRunner;
|
||||
private readonly ResponseEdgeRunner _inputRunner;
|
||||
private readonly IStepTracer? _stepTracer;
|
||||
|
||||
public EdgeMap(IRunnerContext runContext,
|
||||
@@ -29,7 +29,7 @@ internal sealed class EdgeMap
|
||||
|
||||
public EdgeMap(IRunnerContext runContext,
|
||||
Dictionary<string, HashSet<Edge>> workflowEdges,
|
||||
IEnumerable<InputPort> workflowPorts,
|
||||
IEnumerable<RequestPort> workflowPorts,
|
||||
string startExecutorId,
|
||||
IStepTracer? stepTracer = null)
|
||||
{
|
||||
@@ -53,10 +53,10 @@ internal sealed class EdgeMap
|
||||
|
||||
this._portEdgeRunners = workflowPorts.ToDictionary(
|
||||
port => port.Id,
|
||||
port => InputEdgeRunner.ForPort(runContext, port)
|
||||
port => ResponseEdgeRunner.ForPort(runContext, port)
|
||||
);
|
||||
|
||||
this._inputRunner = new InputEdgeRunner(runContext, startExecutorId);
|
||||
this._inputRunner = new ResponseEdgeRunner(runContext, startExecutorId);
|
||||
this._stepTracer = stepTracer;
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ internal sealed class EdgeMap
|
||||
|
||||
public ValueTask<DeliveryMapping?> PrepareDeliveryForResponseAsync(ExternalResponse response)
|
||||
{
|
||||
if (!this._portEdgeRunners.TryGetValue(response.PortInfo.PortId, out InputEdgeRunner? portRunner))
|
||||
if (!this._portEdgeRunners.TryGetValue(response.PortInfo.PortId, out ResponseEdgeRunner? portRunner))
|
||||
{
|
||||
throw new InvalidOperationException($"Port {response.PortInfo.PortId} not found in the edge map.");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user