Skip to content

Commit 26bd0b1

Browse files
committed
Support hooks in chat
1 parent 9005c83 commit 26bd0b1

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

eca-chat.el

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,10 +274,15 @@ Must be a positive integer."
274274
:group 'eca)
275275

276276
(defface eca-chat-reason-label-face
277-
'((t :inherit font-lock-comment-face :underline t))
277+
'((t :inherit font-lock-comment-face))
278278
"Face for the reason messages in chat."
279279
:group 'eca)
280280

281+
(defface eca-chat-hook-label-face
282+
'((t :inherit font-lock-keyword-face))
283+
"Face for the hook messages in chat."
284+
:group 'eca)
285+
281286
(defface eca-chat-time-face
282287
'((t :inherit font-lock-comment-face :slant italic :height 0.8))
283288
"Face for times spent in chat."
@@ -1729,6 +1734,23 @@ Calls CB with the resulting message."
17291734
(concat " " (eca-chat--time->presentable-time ms))))
17301735
(label (concat base time)))
17311736
(eca-chat--update-expandable-content id label "" t)))
1737+
("hookActionStarted"
1738+
(let* ((id (plist-get content :id))
1739+
(name (plist-get content :name))
1740+
(label (propertize (format "Running hook '%s'..." name) 'font-lock-face 'eca-chat-hook-label-face)))
1741+
(eca-chat--add-expandable-content id label "")))
1742+
("hookActionFinished"
1743+
(let* ((id (plist-get content :id))
1744+
(name (plist-get content :name))
1745+
(status (number-to-string (plist-get content :status)))
1746+
(output (plist-get content :output))
1747+
(error (plist-get content :error))
1748+
(label (propertize (format "Executed hook '%s'" name) 'font-lock-face 'eca-chat-hook-label-face)))
1749+
(eca-chat--update-expandable-content id label (eca-chat--content-table
1750+
`(("Name" . ,name)
1751+
("Status" . ,status)
1752+
("Output" . ,output)
1753+
("Error" . ,error))))))
17321754
("toolCallPrepare"
17331755
(let* ((id (plist-get content :id))
17341756
(name (plist-get content :name))

0 commit comments

Comments
 (0)