Function: eca-chat--tool-call-shell-command-details

eca-chat--tool-call-shell-command-details is a natively compiled function defined in eca-chat.el.

Signature

(eca-chat--tool-call-shell-command-details CONTENT LABEL APPROVAL-TEXT TIME STATUS &optional PARENT-ID OUTPUT-TEXT APPROVED?)

Documentation

Update tool call UI showing the shell command breakdown details.

CONTENT is the tool call content, LABEL is the label. The raw command is always shown verbatim; the derived per-command breakdown lines are added only when they help: chained commands or always-asks annotations while pending approval. Can include optional APPROVAL-TEXT and TIME. Append STATUS and optional PARENT-ID and OUTPUT-TEXT. APPROVED? is non-nil when the tool call is already approved (trusted, auto-allowed or manually approved), coloring commands accordingly.

Source Code

;; Defined in /nix/store/jklqzw6pzz6j4jrbv8wy0iwgi7jlrbld-emacs-packages-deps/share/emacs/site-lisp/elpa/eca-20260928.1827/eca-chat.el
(defun eca-chat--tool-call-shell-command-details (content label approval-text time status &optional parent-id output-text approved?)
  "Update tool call UI showing the shell command breakdown details.
CONTENT is the tool call content, LABEL is the label.
The raw command is always shown verbatim; the derived per-command
breakdown lines are added only when they help: chained commands or
always-asks annotations while pending approval.
Can include optional APPROVAL-TEXT and TIME.
Append STATUS and optional PARENT-ID and OUTPUT-TEXT.
APPROVED? is non-nil when the tool call is already approved (trusted,
auto-allowed or manually approved), coloring commands accordingly."
  (-let* (((&plist :arguments args :details details :id id) content)
          (commands (plist-get details :commands))
          (raw-command (or (plist-get args :command) ""))
          (work-dir (plist-get args :working_directory))
          (background (plist-get args :background))
          (annotate? (and approval-text t))
          (show-breakdown? (or (> (length commands) 1)
                               (and annotate?
                                    (seq-some (lambda (cmd) (not (plist-get cmd :approvalKey)))
                                              commands))))
          (raw-face (if (= 1 (length commands))
                        ;; Single command: the raw line is the command itself,
                        ;; so it carries the approval-state color directly.
                        (eca-chat--shell-command-state-face (elt commands 0) approved?)
                      'eca-chat--tool-call-argument-value-face))
          (body (concat (propertize "$ " 'font-lock-face 'eca-chat-shell-command-breakdown-prefix-face)
                        (propertize raw-command
                                    'font-lock-face raw-face
                                    'eca-no-fontify t)
                        (when show-breakdown?
                          (concat "\n\n"
                                  (mapconcat #'identity
                                             (seq-map-indexed
                                              (lambda (cmd idx)
                                                (eca-chat--shell-command-breakdown-line
                                                 cmd (if (zerop idx) "$ " "↳ ") annotate? approved?))
                                              commands)
                                             "\n")))
                        (when (and work-dir (not (string-empty-p work-dir)))
                          (concat "\n" (propertize (concat "in " work-dir)
                                                   'font-lock-face 'eca-chat--tool-call-table-key-face)))
                        (when background
                          (concat "\n" (propertize (format "background: %s" background)
                                                   'font-lock-face 'eca-chat--tool-call-table-key-face)))
                        (when (and output-text (not (string-empty-p output-text)))
                          (concat "\n" (eca-chat--content-table `(("Output" . ,output-text))))))))
    (eca-chat--update-expandable-content
     id
     (concat (propertize label 'font-lock-face 'eca-chat-mcp-tool-call-label-face)
             " " status time
             approval-text)
     body
     nil
     parent-id)))