2024-03-31 19:28:16 +00:00
|
|
|
using BotSharp.Abstraction.Functions.Models;
|
2024-01-13 21:17:40 +00:00
|
|
|
using BotSharp.Abstraction.Plugins.Models;
|
2023-12-28 15:20:18 +00:00
|
|
|
using BotSharp.Abstraction.Repositories.Filters;
|
|
|
|
|
|
2023-06-11 15:22:48 +00:00
|
|
|
namespace BotSharp.Abstraction.Agents;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Agent management service
|
|
|
|
|
/// </summary>
|
|
|
|
|
public interface IAgentService
|
|
|
|
|
{
|
2023-06-12 13:28:49 +00:00
|
|
|
Task<Agent> CreateAgent(Agent agent);
|
2024-04-11 07:00:17 +00:00
|
|
|
Task<string> RefreshAgents();
|
2024-01-23 05:04:06 +00:00
|
|
|
Task<PagedItems<Agent>> GetAgents(AgentFilter filter);
|
2023-08-14 17:00:01 +00:00
|
|
|
|
|
|
|
|
/// <summary>
|
2023-10-18 15:54:03 +00:00
|
|
|
/// Load agent configurations and trigger hooks
|
2023-08-14 17:00:01 +00:00
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="id"></param>
|
|
|
|
|
/// <returns></returns>
|
2024-12-22 22:36:18 +00:00
|
|
|
Task<Agent> LoadAgent(string id, bool loadUtility = true);
|
2023-08-14 17:00:01 +00:00
|
|
|
|
2024-08-13 21:36:12 +00:00
|
|
|
/// <summary>
|
2024-08-14 15:45:22 +00:00
|
|
|
/// Inherit from an agent
|
2024-08-13 21:36:12 +00:00
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="agent"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
Task InheritAgent(Agent agent);
|
|
|
|
|
|
2023-10-28 20:59:26 +00:00
|
|
|
string RenderedInstruction(Agent agent);
|
|
|
|
|
|
|
|
|
|
string RenderedTemplate(Agent agent, string templateName);
|
|
|
|
|
|
2024-03-31 19:28:16 +00:00
|
|
|
bool RenderFunction(Agent agent, FunctionDef def);
|
|
|
|
|
|
2024-04-09 20:52:21 +00:00
|
|
|
FunctionParametersDef? RenderFunctionProperty(Agent agent, FunctionDef def);
|
|
|
|
|
|
2023-10-18 11:58:36 +00:00
|
|
|
/// <summary>
|
|
|
|
|
/// Get agent detail without trigger any hook.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="id"></param>
|
|
|
|
|
/// <returns>Original agent information</returns>
|
2023-06-27 18:31:13 +00:00
|
|
|
Task<Agent> GetAgent(string id);
|
2024-01-23 05:04:06 +00:00
|
|
|
|
2023-06-11 23:46:02 +00:00
|
|
|
Task<bool> DeleteAgent(string id);
|
2023-09-15 20:19:44 +00:00
|
|
|
Task UpdateAgent(Agent agent, AgentField updateField);
|
2024-05-09 22:06:03 +00:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Path existing templates of agent, cannot create new or delete templates
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="agent"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
Task<string> PatchAgentTemplate(Agent agent);
|
2024-04-11 07:00:17 +00:00
|
|
|
Task<string> UpdateAgentFromFile(string id);
|
2023-08-09 21:49:55 +00:00
|
|
|
string GetDataDir();
|
2023-06-27 18:31:13 +00:00
|
|
|
string GetAgentDataDir(string agentId);
|
2024-01-13 21:17:40 +00:00
|
|
|
|
2024-10-31 19:36:26 +00:00
|
|
|
Task<List<UserAgent>> GetUserAgents(string userId);
|
2024-05-15 22:30:45 +00:00
|
|
|
|
2024-01-13 21:17:40 +00:00
|
|
|
PluginDef GetPlugin(string agentId);
|
2023-06-11 15:22:48 +00:00
|
|
|
}
|