Files
memex/test-chat-wait.lisp
Amr Gharbeia fdb55c616d feat: stabilized org-agent two-way communication and UX
- Fixed kernel-to-Emacs communication bridge.
- Resolved boot-time crashes in multiple skeletal skills.
- Refined Chat skill prompt to eliminate conversational filler.
- Updated Emacs UI to automatically clean up status markers.
- Synchronized all fixes via Literate Org-mode documents.
- Verified physical two-way interaction via simulation.
2026-04-03 17:25:01 -04:00

25 lines
930 B
Common Lisp

(require :usocket)
(defun test-chat-and-wait ()
(let* ((socket (usocket:socket-connect "127.0.0.1" 9105))
(stream (usocket:socket-stream socket))
(msg "(:type :event :payload (:sensor :chat-message :text \"ping\"))")
(len (length msg))
(framed (format nil "~6,'0x~a" len msg)))
(format t "Sending: ~a~%" framed)
(write-string framed stream)
(finish-output stream)
(handler-case
(loop
(let* ((len-prefix (make-string 6)))
(read-sequence len-prefix stream)
(let* ((msg-len (parse-integer len-prefix :radix 16))
(payload (make-string msg-len)))
(read-sequence payload stream)
(format t "AGENT RESPONSE: ~a~%" payload)
(when (search ":insert-at-end" payload) (return)))))
(error (c) (format t "ERROR: ~a~%" c)))
(usocket:socket-close socket)))
(test-chat-and-wait)