diff --git a/CHANGELOG.md b/CHANGELOG.md index ac265cb..a5caf8b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Unreleased +- Show the model variant of a running subagent in the `spawn_agent` tool call details table when the server sends one. - Bugfix: kill commands not covered by the deletion guards (`backward-kill-sentence`, `backward-kill-sexp`, `kill-line`, `kill-region`, etc.) could cross the prompt/context markup and corrupt the chat prompt area, making RET fail with `args-out-of-range` (#305). Kills are now clamped to the prompt field (and blocked above it), the transient-area refresh skips instead of signaling on a corrupted block, and `eca-chat-clear-prompt` (`C-c C-d`) rebuilds the prompt markup when it is broken. - Perf: cache the pending tool call approval status instead of rescanning the whole chat buffer on every mode-line/tab-line/header-line redisplay, which made Emacs sluggish on long chats (#307). diff --git a/eca-chat.el b/eca-chat.el index cd17c57..5e716cd 100644 --- a/eca-chat.el +++ b/eca-chat.el @@ -3960,6 +3960,7 @@ Append STATUS symbol. Optional PARENT-ID for nested rendering." (-let* ((agent-name (plist-get args :agent)) (task (plist-get args :task)) (model (plist-get details :model)) + (variant (plist-get details :variant)) (step (plist-get details :step)) (max-steps (plist-get details :maxSteps)) (usage-str (eca-chat--subagent-usage-str id)) @@ -4013,6 +4014,7 @@ Append STATUS symbol. Optional PARENT-ID for nested rendering." (eca-chat--content-table `(("Agent" . ,agent-name) ("Model" . ,model) + ,@(when variant `(("Variant" . ,variant))) ,@(when task `(("Task" . ,(concat task "\n\n")))) ,@(when output-text `(("Output" . ,(concat "\n" output-text)))))) nil diff --git a/test/eca-chat-test.el b/test/eca-chat-test.el index d623346..22c9b6a 100644 --- a/test/eca-chat-test.el +++ b/test/eca-chat-test.el @@ -233,6 +233,33 @@ When MANUAL is non-nil the tool call requires manual approval." (expect (overlay-get (eca-chat--get-expandable-content "parent-1") 'eca-chat--tool-call-status) :to-equal eca-chat-mcp-tool-call-loading-symbol)) + (kill-buffer buf)))) + + (it "shows the subagent variant row when details carry one" + (let ((buf (eca-chat-test--make-render-buffer))) + (unwind-protect + (eca-chat--with-current-buffer buf + (eca-chat--tool-call-subagent-details + "sub-1" (list :agent "test-agent" :task "task") + "Calling subagent" nil nil + eca-chat-mcp-tool-call-loading-symbol nil + (list :type "subagent" :model "test-model" :variant "high")) + (eca-chat--expandable-content-toggle "sub-1" t nil) + (expect (buffer-string) :to-match "Variant") + (expect (buffer-string) :to-match "high")) + (kill-buffer buf)))) + + (it "omits the subagent variant row when details have none" + (let ((buf (eca-chat-test--make-render-buffer))) + (unwind-protect + (eca-chat--with-current-buffer buf + (eca-chat--tool-call-subagent-details + "sub-2" (list :agent "test-agent" :task "task") + "Calling subagent" nil nil + eca-chat-mcp-tool-call-loading-symbol nil + (list :type "subagent" :model "test-model")) + (eca-chat--expandable-content-toggle "sub-2" t nil) + (expect (buffer-string) :not :to-match "Variant")) (kill-buffer buf))))) (describe "eca-chat--apply-markdown-markup-visibility"