using BotSharp.Abstraction.Agents.Options; using BotSharp.Abstraction.Functions.Models; using BotSharp.Abstraction.Plugins.Models; using BotSharp.Abstraction.Repositories.Filters; namespace BotSharp.Abstraction.Agents; /// /// Agent management service /// public interface IAgentService { Task CreateAgent(Agent agent); Task RefreshAgents(IEnumerable? agentIds = null); Task> GetAgents(AgentFilter filter); Task> GetAgentOptions(List? agentIds = null, bool byName = false); Task> GetAgentUtilityOptions(); /// /// Load agent configurations and trigger hooks /// /// /// Task LoadAgent(string id, bool loadUtility = true); /// /// Inherit from an agent /// /// /// Task InheritAgent(Agent agent); string RenderInstruction(Agent agent, Dictionary? renderData = null); string RenderTemplate(Agent agent, string templateName, Dictionary? renderData = null); bool RenderFunction(Agent agent, FunctionDef def, Dictionary? renderData = null); FunctionParametersDef? RenderFunctionProperty(Agent agent, FunctionDef def, Dictionary? renderData = null); (string, IEnumerable) PrepareInstructionAndFunctions(Agent agent, Dictionary? renderData = null, StringComparer? comparer = null); bool RenderVisibility(string? visibilityExpression, Dictionary dict); Dictionary CollectRenderData(Agent agent); /// /// Get agent detail without trigger any hook. /// /// /// Original agent information Task GetAgent(string id); Task DeleteAgent(string id); Task UpdateAgent(Agent agent, AgentField updateField); /// /// Path existing templates of agent, cannot create new or delete templates /// /// /// Task PatchAgentTemplate(Agent agent); string GetDataDir(); string GetAgentDataDir(string agentId); Task> GetUserAgents(string userId); PluginDef GetPlugin(string agentId); Task> GetAgentCodeScripts(string agentId, AgentCodeScriptFilter? filter = null) => Task.FromResult(new List()); Task GetAgentCodeScript(string agentId, string scriptName, string scriptType = AgentCodeScriptType.Src) => Task.FromResult(string.Empty); Task UpdateAgentCodeScripts(string agentId, List codeScripts, AgentCodeScriptUpdateOptions? options = null) => Task.FromResult(false); }