V16 / 6df58cd3ed86
Lilith.Commands.cs
Lilith/Agent/Lilith.Commands.cs
Changed in this versionCS
using Lilith.Core.Commands;
namespace Lilith.Agent;
public partial class Lilith
{
private readonly object _commandSync = new();
private ChatCommandRegistry? _chatCommands;
public ChatCommandRegistry ChatCommands { get { lock (_commandSync) return _chatCommands ??= CreateCommands(); } }
private ChatCommandRegistry CreateCommands()
{
var commands = new ChatCommandRegistry();
commands.Register("help", "List available chat commands.", context => { context.RequireNoArguments(); return commands.Help(); });
commands.Register("new", "Start a new conversation.", context => { context.RequireNoArguments(); NewConversation(); return null; });
commands.Register("history", "List saved chats or load one with /history <index>.", context => { HandleHistoryCommand("/history " + context.Arguments); return null; });
commands.RegisterAsync("exit", "Save and exit the chat host.", context => { context.RequireNoArguments(); return Task.FromResult(new ChatCommandResult(true, ExitRequested: true)); });
RegisterScenarioCommands(commands);
RegisterWorkspaceCommands(commands);
RegisterScheduleCommands(commands);
RegisterWebResearchCommands(commands);
RegisterPersonalityCommands(commands);
global::Lilith.Core.Calendar.CalendarCommands.Register(commands, () => Client);
global::Lilith.Core.Projects.ProjectCommands.Register(commands, () => Client);
global::Lilith.Core.Projects.WebsitePreviewCommands.Register(commands, () => Client);
global::Lilith.Core.Kanban.KanbanCommands.Register(commands, () => Client);
global::Lilith.Core.Email.EmailCommands.Register(commands, () => Client);
global::Lilith.Core.Messaging.MessageCommands.Register(commands, () => Client);
global::Lilith.Core.HomeAutomation.HomeCommands.Register(commands, () => Client);
return commands;
}
partial void RegisterScenarioCommands(ChatCommandRegistry commands);
partial void RegisterWorkspaceCommands(ChatCommandRegistry commands);
partial void RegisterScheduleCommands(ChatCommandRegistry commands);
partial void RegisterWebResearchCommands(ChatCommandRegistry commands);
partial void RegisterPersonalityCommands(ChatCommandRegistry commands);
}