diff --git a/harness/tui-client.org b/harness/tui-client.org index 4964260..a601fba 100644 --- a/harness/tui-client.org +++ b/harness/tui-client.org @@ -1,4 +1,4 @@ -#+PROPERTY: header-args:lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (getenv "INSTALL_DIR") ".") "/harness")) +#+PROPERTY: header-args:lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (uiop:getenv "INSTALL_DIR") ".") "/harness")) :PROPERTIES: :ID: tui-client-spec :CREATED: [2026-04-17 Fri 11:00] @@ -57,81 +57,81 @@ A simple MVP console is insufficient for a Lisp Machine. To reach v0.2.0, the TU * Phase C: Implementation (Build) ** Package Context -#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (getenv "INSTALL_DIR") ".") "/harness")) +#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (uiop:getenv "INSTALL_DIR") ".") "/harness")) (in-package :cl-user) #+end_src -#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (getenv "INSTALL_DIR") ".") "/harness")) +#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (uiop:getenv "INSTALL_DIR") ".") "/harness")) (defpackage :opencortex.tui (:use :cl :croatoan) (:export :main)) #+end_src -#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (getenv "INSTALL_DIR") ".") "/harness")) +#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (uiop:getenv "INSTALL_DIR") ".") "/harness")) (in-package :opencortex.tui) #+end_src ** Global State -#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (getenv "INSTALL_DIR") ".") "/harness")) +#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (uiop:getenv "INSTALL_DIR") ".") "/harness")) (defvar *daemon-host* "127.0.0.1") #+end_src -#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (getenv "INSTALL_DIR") ".") "/harness")) +#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (uiop:getenv "INSTALL_DIR") ".") "/harness")) (defvar *daemon-port* 9105) #+end_src -#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (getenv "INSTALL_DIR") ".") "/harness")) +#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (uiop:getenv "INSTALL_DIR") ".") "/harness")) (defvar *socket* nil) #+end_src -#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (getenv "INSTALL_DIR") ".") "/harness")) +#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (uiop:getenv "INSTALL_DIR") ".") "/harness")) (defvar *stream* nil) #+end_src -#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (getenv "INSTALL_DIR") ".") "/harness")) +#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (uiop:getenv "INSTALL_DIR") ".") "/harness")) (defvar *chat-history* (list) "Full chronological log of messages.") #+end_src -#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (getenv "INSTALL_DIR") ".") "/harness")) +#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (uiop:getenv "INSTALL_DIR") ".") "/harness")) (defvar *scroll-index* 0 "Offset for history rendering.") #+end_src -#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (getenv "INSTALL_DIR") ".") "/harness")) +#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (uiop:getenv "INSTALL_DIR") ".") "/harness")) (defvar *status-text* "Connecting...") #+end_src -#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (getenv "INSTALL_DIR") ".") "/harness")) +#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (uiop:getenv "INSTALL_DIR") ".") "/harness")) (defvar *input-buffer* (make-array 0 :element-type 'char :fill-pointer 0 :adjustable t)) #+end_src -#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (getenv "INSTALL_DIR") ".") "/harness")) +#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (uiop:getenv "INSTALL_DIR") ".") "/harness")) (defvar *command-history* (make-array 0 :element-type 't :fill-pointer 0 :adjustable t)) #+end_src -#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (getenv "INSTALL_DIR") ".") "/harness")) +#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (uiop:getenv "INSTALL_DIR") ".") "/harness")) (defvar *history-index* -1) #+end_src -#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (getenv "INSTALL_DIR") ".") "/harness")) +#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (uiop:getenv "INSTALL_DIR") ".") "/harness")) (defvar *is-running* t) #+end_src -#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (getenv "INSTALL_DIR") ".") "/harness")) +#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (uiop:getenv "INSTALL_DIR") ".") "/harness")) (defvar *queue-lock* (bt:make-lock)) #+end_src -#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (getenv "INSTALL_DIR") ".") "/harness")) +#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (uiop:getenv "INSTALL_DIR") ".") "/harness")) (defvar *incoming-msgs* nil) #+end_src ** Utilities -#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (getenv "INSTALL_DIR") ".") "/harness")) +#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (uiop:getenv "INSTALL_DIR") ".") "/harness")) (defun enqueue-msg (msg) "Thread-safe addition to incoming message queue." (bt:with-lock-held (*queue-lock*) (setf *incoming-msgs* (append *incoming-msgs* (list msg))))) -#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (getenv "INSTALL_DIR") ".") "/harness")) +#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (uiop:getenv "INSTALL_DIR") ".") "/harness")) (defun dequeue-msgs () "Thread-safe retrieval of incoming messages." (bt:with-lock-held (*queue-lock*) @@ -142,7 +142,7 @@ A simple MVP console is insufficient for a Lisp Machine. To reach v0.2.0, the TU #+end_src ** Styling Engine -#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (getenv "INSTALL_DIR") ".") "/harness")) +#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (uiop:getenv "INSTALL_DIR") ".") "/harness")) (defun get-line-style (text) "Determines croatoan attributes based on content patterns." (cond @@ -154,7 +154,7 @@ A simple MVP console is insufficient for a Lisp Machine. To reach v0.2.0, the TU #+end_src ** Rendering Orchestrator -#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (getenv "INSTALL_DIR") ".") "/harness")) +#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (uiop:getenv "INSTALL_DIR") ".") "/harness")) (defun render-chat (win) "Renders the chat history with scrolling and styling." (clear win) @@ -172,14 +172,14 @@ A simple MVP console is insufficient for a Lisp Machine. To reach v0.2.0, the TU #+end_src ** Input Handling -#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (getenv "INSTALL_DIR") ".") "/harness")) +#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (uiop:getenv "INSTALL_DIR") ".") "/harness")) (defun handle-backspace () "Deletes last character from input buffer." (when (> (fill-pointer *input-buffer*) 0) (decf (fill-pointer *input-buffer*)))) #+end_src -#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (getenv "INSTALL_DIR") ".") "/harness")) +#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (uiop:getenv "INSTALL_DIR") ".") "/harness")) (defun handle-return (stream) "Process input buffer as message or command." (let ((cmd (coerce *input-buffer* 'string))) @@ -200,7 +200,7 @@ A simple MVP console is insufficient for a Lisp Machine. To reach v0.2.0, the TU #+end_src ** Main Entry Point -#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (getenv "INSTALL_DIR") ".") "/harness")) +#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (concat (or (uiop:getenv "INSTALL_DIR") ".") "/harness")) (defun main () "Initializes ncurses and starts the TUI event loop." (handler-case