fix(reason): Automatically convert :response plists to :CHAT messages
Some checks failed
Deploy-Agent-V15-Stdin / JOB-V15-STDIN (push) Failing after 2s

This commit is contained in:
2026-04-19 17:41:21 -04:00
parent 63e7e9ce32
commit bbc32a62b8
2 changed files with 10 additions and 2 deletions

View File

@@ -66,7 +66,11 @@ The Reason stage is the cognitive engine of the OpenCortex. It bridges the gap b
(cleaned (if (stringp thought) (string-trim '(#\Space #\Newline #\Tab) thought) thought)))
(if (stringp cleaned)
(let ((*read-eval* nil))
(handler-case (read-from-string cleaned)
(handler-case
(let ((parsed (read-from-string cleaned)))
(if (and (listp parsed) (getf parsed :response))
(list :TYPE :CHAT :TEXT (getf parsed :response))
parsed))
(error (c) (list :type :EVENT :payload (list :sensor :syntax-error :code cleaned :error (format nil "~a" c))))))
cleaned)))))
#+end_src