V12 / ea1357ad1734
Lilith.Commands.Schedules.cs
Lilith/Agent/Lilith.Commands.Schedules.cs
Unchanged from the preceding versionCS
using System.Text.Json;
using Lilith.Core.Commands;
namespace Lilith.Agent;
public partial class Lilith
{
partial void RegisterScheduleCommands(ChatCommandRegistry commands)
{
commands.Register("schedules", "List schedules; use pending or review <id> for proposals.", context => context.Arguments switch
{
"" => JsonSerializer.Serialize(Schedules.Execute(new("list"))),
"pending" => JsonSerializer.Serialize(Schedules.Execute(new("pending"))),
var args when args.StartsWith("review ", StringComparison.OrdinalIgnoreCase) => JsonSerializer.Serialize(Schedules.Review(args[7..].Trim()), new JsonSerializerOptions { WriteIndented = true }),
_ => "Use /schedules, /schedules pending or /schedules review <id>."
});
commands.RegisterAsync("schedule-approve", "Approve a schedule proposal: /schedule-approve <id>.", async context => { await ApproveScheduleAsync(context.Arguments, context.CancellationToken); return new(true); });
commands.Register("schedule-reject", "Reject a schedule proposal: /schedule-reject <id>.", context => { RejectSchedule(context.Arguments); return null; });
}
}