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
53 lines
1.7 KiB
C#
53 lines
1.7 KiB
C#
// Copyright (c) Microsoft. All rights reserved.
|
|
|
|
using System.ComponentModel;
|
|
|
|
namespace AGUIDojoServer.AgenticUI;
|
|
|
|
internal static class AgenticPlanningTools
|
|
{
|
|
[Description("Create a plan with multiple steps.")]
|
|
public static Plan CreatePlan([Description("List of step descriptions to create the plan.")] List<string> steps)
|
|
{
|
|
return new Plan
|
|
{
|
|
Steps = [.. steps.Select(s => new Step { Description = s, Status = StepStatus.Pending })]
|
|
};
|
|
}
|
|
|
|
[Description("Update a step in the plan with new description or status.")]
|
|
public static async Task<List<JsonPatchOperation>> UpdatePlanStepAsync(
|
|
[Description("The index of the step to update.")] int index,
|
|
[Description("The new description for the step (optional).")] string? description = null,
|
|
[Description("The new status for the step (optional).")] StepStatus? status = null)
|
|
{
|
|
var changes = new List<JsonPatchOperation>();
|
|
|
|
if (description is not null)
|
|
{
|
|
changes.Add(new JsonPatchOperation
|
|
{
|
|
Op = "replace",
|
|
Path = $"/steps/{index}/description",
|
|
Value = description
|
|
});
|
|
}
|
|
|
|
if (status.HasValue)
|
|
{
|
|
// Status must be lowercase to match AG-UI frontend expectations: "pending" or "completed"
|
|
string statusValue = status.Value == StepStatus.Pending ? "pending" : "completed";
|
|
changes.Add(new JsonPatchOperation
|
|
{
|
|
Op = "replace",
|
|
Path = $"/steps/{index}/status",
|
|
Value = statusValue
|
|
});
|
|
}
|
|
|
|
await Task.Delay(1000);
|
|
|
|
return changes;
|
|
}
|
|
}
|