From c85099db57ed457ae366e1d6c64e559117eb4aa6 Mon Sep 17 00:00:00 2001 From: Robert Good Date: Sat, 7 Feb 2026 09:59:19 -0800 Subject: [PATCH] Plugin to tool --- .../{IActorsPlugin.cs => IActorsTool.cs} | 2 +- ...MessagesPlugin.cs => IChatMessagesTool.cs} | 2 +- ...SessionsPlugin.cs => IChatSessionsTool.cs} | 2 +- .../Tools/ActorsTool.cs | 4 ++-- .../Tools/ChatMessagesTool.cs | 4 ++-- .../Tools/ChatSessionsTool.cs | 4 ++-- .../CreateChatMessageCommand.feature | 6 +++--- .../CreateChatMessageCommand.feature.cs | 20 +++++++++---------- 8 files changed, 22 insertions(+), 22 deletions(-) rename src/Core.Application/Abstractions/{IActorsPlugin.cs => IActorsTool.cs} (90%) rename src/Core.Application/Abstractions/{IChatMessagesPlugin.cs => IChatMessagesTool.cs} (89%) rename src/Core.Application/Abstractions/{IChatSessionsPlugin.cs => IChatSessionsTool.cs} (89%) diff --git a/src/Core.Application/Abstractions/IActorsPlugin.cs b/src/Core.Application/Abstractions/IActorsTool.cs similarity index 90% rename from src/Core.Application/Abstractions/IActorsPlugin.cs rename to src/Core.Application/Abstractions/IActorsTool.cs index 419a81d..e042c28 100644 --- a/src/Core.Application/Abstractions/IActorsPlugin.cs +++ b/src/Core.Application/Abstractions/IActorsTool.cs @@ -1,6 +1,6 @@ namespace Goodtocode.AgentFramework.Core.Application.Abstractions; -public interface IActorsPlugin +public interface IActorsTool { Task GetActorByIdAsync(Guid actorId, CancellationToken cancellationToken); Task> GetActorsByNameAsync(string name, CancellationToken cancellationToken); diff --git a/src/Core.Application/Abstractions/IChatMessagesPlugin.cs b/src/Core.Application/Abstractions/IChatMessagesTool.cs similarity index 89% rename from src/Core.Application/Abstractions/IChatMessagesPlugin.cs rename to src/Core.Application/Abstractions/IChatMessagesTool.cs index cde237b..494d7c8 100644 --- a/src/Core.Application/Abstractions/IChatMessagesPlugin.cs +++ b/src/Core.Application/Abstractions/IChatMessagesTool.cs @@ -1,6 +1,6 @@ namespace Goodtocode.AgentFramework.Core.Application.Abstractions; -public interface IChatMessagesPlugin +public interface IChatMessagesTool { Task> ListRecentMessagesAsync(DateTime? startDate, DateTime? endDate, CancellationToken cancellationToken); Task> GetChatMessagesAsync(Guid sessionId, CancellationToken cancellationToken); diff --git a/src/Core.Application/Abstractions/IChatSessionsPlugin.cs b/src/Core.Application/Abstractions/IChatSessionsTool.cs similarity index 89% rename from src/Core.Application/Abstractions/IChatSessionsPlugin.cs rename to src/Core.Application/Abstractions/IChatSessionsTool.cs index 2b6b700..8a5c185 100644 --- a/src/Core.Application/Abstractions/IChatSessionsPlugin.cs +++ b/src/Core.Application/Abstractions/IChatSessionsTool.cs @@ -1,6 +1,6 @@ namespace Goodtocode.AgentFramework.Core.Application.Abstractions; -public interface IChatSessionsPlugin +public interface IChatSessionsTool { Task> ListRecentSessionsAsync(DateTime? startDate, DateTime? endDate, CancellationToken cancellationToken); Task UpdateChatSessionTitleAsync(Guid sessionId, string newTitle, CancellationToken cancellationToken); diff --git a/src/Infrastructure.AgentFramework/Tools/ActorsTool.cs b/src/Infrastructure.AgentFramework/Tools/ActorsTool.cs index cecb990..6122e40 100644 --- a/src/Infrastructure.AgentFramework/Tools/ActorsTool.cs +++ b/src/Infrastructure.AgentFramework/Tools/ActorsTool.cs @@ -15,11 +15,11 @@ public class ActorResponse : IActorResponse } -public sealed class ActorsTool(IServiceProvider serviceProvider) : AITool, IActorsPlugin +public sealed class ActorsTool(IServiceProvider serviceProvider) : AITool, IActorsTool { private readonly IServiceProvider _serviceProvider = serviceProvider; - public static string PluginName => "AuthorsPlugin"; + public static string ToolName => "AuthorsTool"; public string FunctionName => _currentFunctionName; public Dictionary Parameters => _currentParameters; diff --git a/src/Infrastructure.AgentFramework/Tools/ChatMessagesTool.cs b/src/Infrastructure.AgentFramework/Tools/ChatMessagesTool.cs index c092118..63d4ff0 100644 --- a/src/Infrastructure.AgentFramework/Tools/ChatMessagesTool.cs +++ b/src/Infrastructure.AgentFramework/Tools/ChatMessagesTool.cs @@ -6,11 +6,11 @@ namespace Goodtocode.AgentFramework.Infrastructure.AgentFramework.Tools; -public sealed class ChatMessagesTool(IServiceProvider serviceProvider) : AITool, IChatMessagesPlugin +public sealed class ChatMessagesTool(IServiceProvider serviceProvider) : AITool, IChatMessagesTool { private readonly IServiceProvider _serviceProvider = serviceProvider; - public static string PluginName => "ChatMessagesPlugin"; + public static string ToolName => "ChatMessagesTool"; public string FunctionName => _currentFunctionName; public Dictionary Parameters => _currentParameters; diff --git a/src/Infrastructure.AgentFramework/Tools/ChatSessionsTool.cs b/src/Infrastructure.AgentFramework/Tools/ChatSessionsTool.cs index 3421da3..e14d677 100644 --- a/src/Infrastructure.AgentFramework/Tools/ChatSessionsTool.cs +++ b/src/Infrastructure.AgentFramework/Tools/ChatSessionsTool.cs @@ -6,11 +6,11 @@ namespace Goodtocode.AgentFramework.Infrastructure.AgentFramework.Tools; -public sealed class ChatSessionsTool(IServiceProvider serviceProvider) : AITool, IChatSessionsPlugin +public sealed class ChatSessionsTool(IServiceProvider serviceProvider) : AITool, IChatSessionsTool { private readonly IServiceProvider _serviceProvider = serviceProvider; - public static string PluginName => "ChatSessionsPlugin"; + public static string ToolName => "ChatSessionsTool"; public string FunctionName => _currentFunctionName; public Dictionary Parameters => _currentParameters; diff --git a/src/Tests.Integration/ChatCompletion/CreateChatMessageCommand.feature b/src/Tests.Integration/ChatCompletion/CreateChatMessageCommand.feature index 29acf8d..88e136a 100644 --- a/src/Tests.Integration/ChatCompletion/CreateChatMessageCommand.feature +++ b/src/Tests.Integration/ChatCompletion/CreateChatMessageCommand.feature @@ -16,8 +16,8 @@ Scenario: Create Chat Message Examples: | def | response | responseErrors | id | ChatMessageExists | message | | success | Success | | 00000000-0000-0000-0000-000000000000 | true | Hello, I am interested in an interactive Chat Message. | - | success actor plugin | Success | | 00000000-0000-0000-0000-000000000000 | true | Please call get_author that Returns the actor's name for the specified actor ID, or 'Actor not found' if no match exists | - | success session plugin | Success | | 00000000-0000-0000-0000-000000000000 | true | Please call list_sessions that Lists all sessions, optionally by date | - | success messages plugin | Success | | 00000000-0000-0000-0000-000000000000 | true | Please call list_messages that Lists all sessions, optionally by date | + | success actor tool | Success | | 00000000-0000-0000-0000-000000000000 | true | Please call get_author that Returns the actor's name for the specified actor ID, or 'Actor not found' if no match exists | + | success session tool | Success | | 00000000-0000-0000-0000-000000000000 | true | Please call list_sessions that Lists all sessions, optionally by date | + | success messages tool | Success | | 00000000-0000-0000-0000-000000000000 | true | Please call list_messages that Lists all sessions, optionally by date | | bad request: empty message | BadRequest | Message | 00000000-0000-0000-0000-000000000000 | false | | | already exists | Error | | 038d8e7f-f18f-4a8e-8b3c-3b6a6889fed9 | true | Hello, I am interested in an interactive Chat Message. | \ No newline at end of file diff --git a/src/Tests.Integration/ChatCompletion/CreateChatMessageCommand.feature.cs b/src/Tests.Integration/ChatCompletion/CreateChatMessageCommand.feature.cs index 923cf4d..fd9be68 100644 --- a/src/Tests.Integration/ChatCompletion/CreateChatMessageCommand.feature.cs +++ b/src/Tests.Integration/ChatCompletion/CreateChatMessageCommand.feature.cs @@ -128,16 +128,16 @@ public void ScenarioInitialize(global::Reqnroll.ScenarioInfo scenarioInfo, globa [global::Microsoft.VisualStudio.TestTools.UnitTesting.TestCategoryAttribute("createChatMessageCommand")] [global::Microsoft.VisualStudio.TestTools.UnitTesting.DataRowAttribute("success", "Success", "", "00000000-0000-0000-0000-000000000000", "true", "Hello, I am interested in an interactive Chat Message.", "0", null, DisplayName="Create Chat Message(success,Success,,00000000-0000-0000-0000-000000000000,true,He" + "llo, I am interested in an interactive Chat Message.,0)")] - [global::Microsoft.VisualStudio.TestTools.UnitTesting.DataRowAttribute("success actor plugin", "Success", "", "00000000-0000-0000-0000-000000000000", "true", "Please call get_author that Returns the actor\'s name for the specified actor ID, " + - "or \'Actor not found\' if no match exists", "1", null, DisplayName="Create Chat Message(success actor plugin,Success,,00000000-0000-0000-0000-0000000" + - "00000,true,Please call get_author that Returns the actor\'s name for the specifie" + - "d actor ID, or \'Actor not found\' if no match exists,1)")] - [global::Microsoft.VisualStudio.TestTools.UnitTesting.DataRowAttribute("success session plugin", "Success", "", "00000000-0000-0000-0000-000000000000", "true", "Please call list_sessions that Lists all sessions, optionally by date", "2", null, DisplayName="Create Chat Message(success session plugin,Success,,00000000-0000-0000-0000-00000" + - "0000000,true,Please call list_sessions that Lists all sessions, optionally by da" + - "te,2)")] - [global::Microsoft.VisualStudio.TestTools.UnitTesting.DataRowAttribute("success messages plugin", "Success", "", "00000000-0000-0000-0000-000000000000", "true", "Please call list_messages that Lists all sessions, optionally by date", "3", null, DisplayName="Create Chat Message(success messages plugin,Success,,00000000-0000-0000-0000-0000" + - "00000000,true,Please call list_messages that Lists all sessions, optionally by d" + - "ate,3)")] + [global::Microsoft.VisualStudio.TestTools.UnitTesting.DataRowAttribute("success actor tool", "Success", "", "00000000-0000-0000-0000-000000000000", "true", "Please call get_author that Returns the actor\'s name for the specified actor ID, " + + "or \'Actor not found\' if no match exists", "1", null, DisplayName="Create Chat Message(success actor tool,Success,,00000000-0000-0000-0000-000000000" + + "000,true,Please call get_author that Returns the actor\'s name for the specified " + + "actor ID, or \'Actor not found\' if no match exists,1)")] + [global::Microsoft.VisualStudio.TestTools.UnitTesting.DataRowAttribute("success session tool", "Success", "", "00000000-0000-0000-0000-000000000000", "true", "Please call list_sessions that Lists all sessions, optionally by date", "2", null, DisplayName="Create Chat Message(success session tool,Success,,00000000-0000-0000-0000-0000000" + + "00000,true,Please call list_sessions that Lists all sessions, optionally by date" + + ",2)")] + [global::Microsoft.VisualStudio.TestTools.UnitTesting.DataRowAttribute("success messages tool", "Success", "", "00000000-0000-0000-0000-000000000000", "true", "Please call list_messages that Lists all sessions, optionally by date", "3", null, DisplayName="Create Chat Message(success messages tool,Success,,00000000-0000-0000-0000-000000" + + "000000,true,Please call list_messages that Lists all sessions, optionally by dat" + + "e,3)")] [global::Microsoft.VisualStudio.TestTools.UnitTesting.DataRowAttribute("bad request: empty message", "BadRequest", "Message", "00000000-0000-0000-0000-000000000000", "false", "", "4", null, DisplayName="Create Chat Message(bad request: empty message,BadRequest,Message,00000000-0000-0" + "000-0000-000000000000,false,,4)")] [global::Microsoft.VisualStudio.TestTools.UnitTesting.DataRowAttribute("already exists", "Error", "", "038d8e7f-f18f-4a8e-8b3c-3b6a6889fed9", "true", "Hello, I am interested in an interactive Chat Message.", "5", null, DisplayName="Create Chat Message(already exists,Error,,038d8e7f-f18f-4a8e-8b3c-3b6a6889fed9,tr" +