V8 / 34b774036cd1
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);
return commands;
}
partial void RegisterScenarioCommands(ChatCommandRegistry commands);
partial void RegisterWorkspaceCommands(ChatCommandRegistry commands);
partial void RegisterScheduleCommands(ChatCommandRegistry commands);
partial void RegisterWebResearchCommands(ChatCommandRegistry commands);
}