db620d33df
dotnet-build-and-test / dotnet-test-functions (push) Has been cancelled
dotnet-build-and-test / paths-filter (push) Has been cancelled
dotnet-build-and-test / dotnet-build (Debug, windows-latest, net9.0) (push) Has been cancelled
dotnet-build-and-test / dotnet-build (Release, ubuntu-latest, net10.0) (push) Has been cancelled
dotnet-build-and-test / dotnet-build (Release, ubuntu-latest, net8.0) (push) Has been cancelled
dotnet-build-and-test / dotnet-build (Release, windows-latest, net472) (push) Has been cancelled
dotnet-build-and-test / dotnet-test (Release, integration, true, ubuntu-latest, net10.0) (push) Has been cancelled
dotnet-build-and-test / dotnet-test (Release, integration, true, windows-latest, net472) (push) Has been cancelled
dotnet-build-and-test / dotnet-foundry-hosted-it (push) Has been cancelled
dotnet-build-and-test / dotnet-build-and-test-check (push) Has been cancelled
dotnet-build-and-test / Integration Test Report (push) Has been cancelled
CodeQL / Analyze (csharp) (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
60 lines
2.2 KiB
C#
60 lines
2.2 KiB
C#
// Copyright (c) Microsoft. All rights reserved.
|
|
|
|
using Microsoft.Agents.AI.Workflows;
|
|
|
|
namespace Microsoft.Agents.AI.DurableTask.Workflows;
|
|
|
|
/// <summary>
|
|
/// Live status payload written to the orchestration via <c>SetCustomStatus</c>.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// This is the only orchestration state readable by external clients while the workflow
|
|
/// is still running. It is written after each superstep so that
|
|
/// <see cref="DurableStreamingWorkflowRun"/> can poll for new events.
|
|
/// On completion the framework clears it, so events are also
|
|
/// embedded in the output via <see cref="DurableWorkflowResult"/>.
|
|
/// </para>
|
|
/// <para>
|
|
/// When the workflow is paused at one or more <see cref="RequestPort"/> nodes,
|
|
/// <see cref="PendingEvents"/> contains the request data for each.
|
|
/// </para>
|
|
/// </remarks>
|
|
internal sealed class DurableWorkflowLiveStatus
|
|
{
|
|
/// <summary>
|
|
/// Gets or sets the pending request ports the workflow is waiting on. Empty when no input is needed.
|
|
/// </summary>
|
|
public List<PendingRequestPortStatus> PendingEvents { get; set; } = [];
|
|
|
|
/// <summary>
|
|
/// Gets or sets the serialized workflow events emitted so far.
|
|
/// </summary>
|
|
public List<string> Events { get; set; } = [];
|
|
|
|
/// <summary>
|
|
/// Attempts to deserialize a serialized custom status string into a <see cref="DurableWorkflowLiveStatus"/>.
|
|
/// </summary>
|
|
[System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage("AOT", "IL3050", Justification = "Deserializing durable workflow status.")]
|
|
[System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "Deserializing durable workflow status.")]
|
|
internal static bool TryParse(string? serializedStatus, out DurableWorkflowLiveStatus result)
|
|
{
|
|
if (serializedStatus is null)
|
|
{
|
|
result = default!;
|
|
return false;
|
|
}
|
|
|
|
try
|
|
{
|
|
result = System.Text.Json.JsonSerializer.Deserialize<DurableWorkflowLiveStatus>(serializedStatus, DurableSerialization.Options)!;
|
|
return result is not null;
|
|
}
|
|
catch (System.Text.Json.JsonException)
|
|
{
|
|
result = default!;
|
|
return false;
|
|
}
|
|
}
|
|
}
|