branch: externals/ellama
commit 35e5d7dabfdc72a9c23ffd1fc88b5a416a9e07c7
Author: Sergey Kostyaev <[email protected]>
Commit: Sergey Kostyaev <[email protected]>
Add role-based tool resolution
Added a new helper function to determine which tools are available to
subagent
roles based on their configuration, filtering available tools from the
role's
tool list or returning all tools when marked as :all.
---
ellama.el | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/ellama.el b/ellama.el
index 823221aea0..5eba4ee4cc 100644
--- a/ellama.el
+++ b/ellama.el
@@ -502,6 +502,20 @@ It should be a function with single argument generated
text string."
:type '(alist :key-type string :value-type plist)
:group 'ellama)
+(defun ellama--tools-for-role (role)
+ "Resolve tools allowed for ROLE."
+ (let* ((cfg (cdr (assoc role ellama-subagent-roles)))
+ (tools (plist-get cfg :tools)))
+ (cond
+ ((eq tools :all)
+ ellama-tools-available)
+ ((listp tools)
+ (cl-remove-if-not
+ (lambda (tool) (member (llm-tool-name tool) tools))
+ ellama-tools-available))
+ (t
+ nil))))
+
(defun ellama--set-file-name-and-save ()
"Set buffer file name and save buffer."
(interactive)