Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/acp/observer.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,11 @@
(defmethod agent-observer-text ((observer acp-observer) text)
"Stream assistant text and retain its length for nonstreamed response reconciliation."
(acp-session-check-cancelled (acp-observer-session observer))
(with-lock-held ((acp-observer-lock observer))
(text-buffer-append (acp-observer-streamed-text observer) text)
(acp-observer--send observer
(agentcomms:acp-update-agent-message (agentcomms:acp-text-content text))))
(when (plusp (length text))
(with-lock-held ((acp-observer-lock observer))
(text-buffer-append (acp-observer-streamed-text observer) text)
(acp-observer--send observer
(agentcomms:acp-update-agent-message (agentcomms:acp-text-content text)))))
nil)

(defmethod agent-observer-reasoning ((observer acp-observer) text)
Expand Down
6 changes: 5 additions & 1 deletion tests/acp-observer-tests.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,9 @@
(agent-observer-status observer ':provider-request-started nil)
(agent-observer-reasoning observer "before ")
(agent-observer-reasoning observer "approval")
(agent-observer-reasoning observer "continued ")
(agent-observer-text observer "")
(agent-observer-reasoning observer "thought")
(test-assert
(acp-observer--approval observer "shell.run" (json-object "command" "pwd") '(:command))
"the editor can approve after receiving pending thoughts")
Expand All @@ -209,7 +212,8 @@
(mapcar #'agentcomms:acp-update-kind updates))
"thought batches precede the next message and permission request")
(test-assert
(equal (list (format nil "first thought~2%next thought") "answer" "before approval")
(equal (list (format nil "first thought~2%next thought") "answer"
(format nil "before approvalcontinued thought"))
(mapcar (lambda (update)
(agentcomms:acp-content-text (agentcomms:json-get update "content")))
updates))
Expand Down