branch: externals/ellama
commit 14dd1dc8b6fd085ac7ed84a030a07723a4c88894
Author: Sergey Kostyaev <[email protected]>
Commit: Sergey Kostyaev <[email protected]>
Add reply option to approval prompt
Extend the approval prompt to include a “reply” choice, allowing the user to
provide a custom string response. Updated the read‑char-choice options and
added
a new cond branch to handle the ‘r’ input by invoking read-string.
---
ellama-tools.el | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/ellama-tools.el b/ellama-tools.el
index f69a209847..39121d486f 100644
--- a/ellama-tools.el
+++ b/ellama-tools.el
@@ -155,8 +155,8 @@ FUNCTION if approved, \"Forbidden by the user\" otherwise."
function-name
(mapconcat #'identity args-display ", ")))
(answer (read-char-choice
- (format "%s (y)es, (a)lways, (n)o: " prompt)
- '(?y ?a ?n)))
+ (format "%s (y)es, (a)lways, (n)o, (r)eply: " prompt)
+ '(?y ?a ?n ?r)))
(result (cond
;; Yes - execute function once
((eq answer ?y)
@@ -167,7 +167,9 @@ FUNCTION if approved, \"Forbidden by the user\" otherwise."
(apply function args))
;; No - return nil
((eq answer ?n)
- "Forbidden by the user"))))
+ "Forbidden by the user")
+ ((eq answer ?r)
+ (read-string "Answer to the agent: ")))))
(when result (if (stringp result)
result
(json-encode result))))))))