Recover <tool>NAME</tool> wrappers in batch

ober

9c90475e067f6390d81189ee5f9f1744a40a96d1

diff --git a/src/jcode/core/agent.ss b/src/jcode/core/agent.ss
index 8684b29..a46b992 100644
--- a/src/jcode/core/agent.ss
+++ b/src/jcode/core/agent.ss
@@ -621,8 +621,24 @@ Be concise. Prefer edit over write for modifying existing files.
                      (loop next
                            (cons (make-tool-call name (xml->json-args name attrs body))
                                  acc)))
+                    ((equal? name "tool")
+                     ;; <tool>NAME</tool> or <tool>NAME(k="v")</tool> wrapper.
+                     ;; The body IS the call; parse it as bare name or paren-style.
+                     (let ((tc (parse-tool-wrapper-body body)))
+                       (loop next (if tc (cons tc acc) acc))))
                     (else (loop next acc)))))))))))))
 
+(def (parse-tool-wrapper-body body)
+  ;; Body of a <tool>...</tool> wrapper: either 'name' or 'name(args)'.
+  (let ((trimmed (string-trim body)))
+    (cond
+      ((string=? trimmed "") #f)
+      ((string-contains trimmed "(")
+       (parse-one-text-tool-call trimmed))
+      ((tool-exists? trimmed)
+       (make-tool-call trimmed "{}"))
+      (else #f))))
+
 (def (batch-body->tool-calls body)
   ;; Recognise <batch>{json}</batch> shapes that some models emit instead of
   ;; nested tags. Accepts: