Some checks failed
Deploy-Agent-V15-Stdin / JOB-V15-STDIN (push) Failing after 3s
- Fixed background boot crash via --non-interactive flag. - Implemented robust protocol sanitization (stripped raw streams). - Refined TUI formatting to display human-readable tool results. - Fixed opencortex.sh variable shadowing and connection logic. - Resolved :target field schema validation errors.
29 lines
1.3 KiB
Common Lisp
29 lines
1.3 KiB
Common Lisp
(load (merge-pathnames "quicklisp/setup.lisp" (user-homedir-pathname)))
|
|
(push (truename "./") asdf:*central-registry*)
|
|
(ql:quickload '(:usocket :bordeaux-threads :opencortex))
|
|
|
|
(defun handle-client (stream)
|
|
(handler-case
|
|
(progn
|
|
(format stream "~a" (opencortex:frame-message (opencortex:make-hello-message "0.1.0")))
|
|
(finish-output stream)
|
|
(loop
|
|
(let ((msg (opencortex:read-framed-message stream)))
|
|
(when (or (eq msg :eof) (eq msg :error)) (return))
|
|
(let ((text (getf (getf msg :payload) :text)))
|
|
(format t "MOCK: Received ~s~%" text)
|
|
(let ((resp (list :TYPE :REQUEST :PAYLOAD (list :ACTION :MESSAGE :TEXT (format nil "ECHO: ~a" text)))))
|
|
(format stream "~a" (opencortex:frame-message resp))
|
|
(finish-output stream))))))
|
|
(error (c) (format t "MOCK ERROR: ~a~%" c))))
|
|
|
|
(let ((socket (usocket:socket-listen "127.0.0.1" 9105 :reuse-address t)))
|
|
(format t "MOCK DAEMON LIVE ON 9105~%")
|
|
(unwind-protect
|
|
(loop (let ((client (usocket:socket-accept socket)))
|
|
(bt:make-thread (lambda ()
|
|
(unwind-protect
|
|
(handle-client (usocket:socket-stream client))
|
|
(usocket:socket-close client))))))
|
|
(usocket:socket-close socket)))
|