Function: eca-chat--set-agent
eca-chat--set-agent is a natively compiled function defined in
eca-chat.el.
Signature
(eca-chat--set-agent SESSION NEW-AGENT &optional BUFFER)
Documentation
Set new agent to NEW-AGENT notifying server for SESSION.
When BUFFER is provided, set the agent in that buffer instead of the last chat buffer of SESSION.
Source Code
;; Defined in /nix/store/jklqzw6pzz6j4jrbv8wy0iwgi7jlrbld-emacs-packages-deps/share/emacs/site-lisp/elpa/eca-20260928.1827/eca-chat.el
(defun eca-chat--set-agent (session new-agent &optional buffer)
"Set new agent to NEW-AGENT notifying server for SESSION.
When BUFFER is provided, set the agent in that buffer instead of
the last chat buffer of SESSION."
(let* ((target (or buffer (eca-chat--get-last-buffer session)))
(chat-id (when (buffer-live-p target)
(buffer-local-value 'eca-chat--id target))))
(eca-chat--with-current-buffer target
(setq-local eca-chat--selected-agent new-agent))
(setf (eca--session-chat-default-agent session) new-agent)
(eca-api-notify session
:method "chat/selectedAgentChanged"
:params (append (list :agent new-agent)
(when chat-id (list :chatId chat-id))))
(eca-chat--notify-status-changed session)))