Function: eca-chat--render-task-widget

eca-chat--render-task-widget is a natively compiled function defined in eca-chat.el.

Signature

(eca-chat--render-task-widget &optional LOADING?)

Documentation

Render the task area widget from eca-chat--task-state.

Without tasks the widget is removed, unless LOADING? is non-nil: a placeholder label is then shown while a task tool call is in flight.

Source Code

;; Defined in /nix/store/jklqzw6pzz6j4jrbv8wy0iwgi7jlrbld-emacs-packages-deps/share/emacs/site-lisp/elpa/eca-20260928.1827/eca-chat.el
(defun eca-chat--render-task-widget (&optional loading?)
  "Render the task area widget from `eca-chat--task-state'.
Without tasks the widget is removed, unless LOADING? is non-nil: a
placeholder label is then shown while a task tool call is in flight."
  (let ((tasks (append (plist-get eca-chat--task-state :tasks) nil)))
    (cond
     (tasks
      (let* ((active-summary (plist-get eca-chat--task-state :activeSummary))
             (done-count (length (-filter (lambda (task) (string= "done" (plist-get task :status))) tasks)))
             (total-count (length tasks))
             (in-progress-task (-first (lambda (task) (string= "in-progress" (plist-get task :status))) tasks))
             (label-text (or active-summary
                             (when in-progress-task (plist-get in-progress-task :subject))
                             ""))
             (prefix-text (if active-summary "Task: " "Tasks "))
             (progress-text (format " (%d/%d)" done-count total-count))
             (label-face (if in-progress-task 'eca-chat-task-label-in-progress-face 'eca-chat-task-label-face))
             (label (concat
                     (propertize prefix-text 'font-lock-face 'eca-chat-task-prefix-face)
                     (propertize label-text 'font-lock-face label-face)
                     (propertize progress-text 'font-lock-face 'eca-chat-task-progress-face))))
        (eca-chat--set-task-widget label (eca-chat--task-build-content tasks))))
     (loading?
      (eca-chat--set-task-widget
       (concat (propertize "Creating tasks... " 'font-lock-face 'eca-chat-task-prefix-face)
               eca-chat-mcp-tool-call-loading-symbol)
       ""))
     (t
      (eca-chat--remove-expandable-content eca-chat--task-block-id)))))