Function: eca-chat-inline--handle-content
eca-chat-inline--handle-content is a natively compiled function
defined in eca-chat-inline.el.
Signature
(eca-chat-inline--handle-content OV ROLE CONTENT)
Documentation
Update OV given chat CONTENT owned by ROLE.
Source Code
;; Defined in /nix/store/jklqzw6pzz6j4jrbv8wy0iwgi7jlrbld-emacs-packages-deps/share/emacs/site-lisp/elpa/eca-20260928.1827/eca-chat-inline.el
(defun eca-chat-inline--handle-content (ov role content)
"Update OV given chat CONTENT owned by ROLE."
(let ((type (plist-get content :type)))
(pcase type
("text"
(pcase role
;; A user message starts a turn: reset the answer area so the
;; overlay always shows the answer to the last question.
("user" (eca-chat-inline--start-turn ov))
("assistant"
(overlay-put ov 'eca-chat-inline--text-acc
(concat (overlay-get ov 'eca-chat-inline--text-acc)
(or (plist-get content :text) "")))
(eca-chat-inline--set-status ov "Streaming..." 'running))
;; System text carries errors and notices (e.g. provider
;; failures after the prompt started); surface it in the
;; answer area so failed turns don't render as a clean Done.
("system"
(overlay-put ov 'eca-chat-inline--text-acc
(concat (overlay-get ov 'eca-chat-inline--text-acc)
(or (plist-get content :text) "")))
(eca-chat-inline--refresh ov))
(_ nil)))
("progress"
(pcase (plist-get content :state)
("running"
;; While tool calls wait for approval, keep their summaries
;; as the status instead of the generic server progress text
;; ("Waiting for tool call approval").
(unless (overlay-get ov 'eca-chat-inline--pending-tools)
(eca-chat-inline--set-status
ov (or (plist-get content :text) "Running...") 'running)))
("finished" (eca-chat-inline--finalize ov))))
("reasonStarted"
(eca-chat-inline--set-status ov "Thinking..." 'running))
("reasonFinished"
(eca-chat-inline--set-status ov "Waiting model..." 'running))
("toolCallPrepare"
(eca-chat-inline--set-status
ov
(or (plist-get content :summary)
(format "Preparing tool %s..." (plist-get content :name)))
'running))
("toolCallRun"
(if (plist-get content :manualApproval)
(eca-chat-inline--set-status
ov (eca-chat-inline--track-pending-tool
ov (plist-get content :id)
(or (plist-get content :summary)
(format "Tool %s needs approval"
(plist-get content :name)))))
(eca-chat-inline--set-status
ov
(or (plist-get content :summary)
(format "Running tool %s..." (plist-get content :name)))
'running)))
("toolCallRunning"
;; Approved (possibly from another client): no longer pending.
(eca-chat-inline--drop-pending-tool ov (plist-get content :id))
(eca-chat-inline--set-status
ov
(or (plist-get content :summary)
(format "Running tool %s..." (plist-get content :name)))
'running))
("toolCalled"
(if-let* ((remaining (eca-chat-inline--drop-pending-tool
ov (plist-get content :id))))
(eca-chat-inline--set-status ov remaining)
(eca-chat-inline--set-status ov "Waiting model..." 'running)))
("toolCallRejected"
(if-let* ((remaining (eca-chat-inline--drop-pending-tool
ov (plist-get content :id))))
(eca-chat-inline--set-status ov remaining)
(eca-chat-inline--set-status ov "Tool call rejected")))
(_ nil))))