fix: use read-event with ctrl flag, add resize handling
- Switched back to read-event be :timeout 0.01 for proper key-event dispatch with the ctrl/alt/shift flags - Fixed Ctrl+P/B/Q/L dispatch: check key-event-ctrl flag to construct :CTRL-<key> keyword symbol (read-event returns :P + ctrl=t, not :CTRL-P) - Added :size-queried state flag and post-handshake backend-size re-query - Removed hardcoded Connected v0.5.0 message from connect-daemon - Removed Connected v0.7.2 system message (version shown in status bar) - view-status now uses draw-rect for background (instead of dotimes loop) - Added startup message showing backend type and detected dimensions
This commit is contained in:
1
docs/.#DESIGN_DECISIONS.org
Symbolic link
1
docs/.#DESIGN_DECISIONS.org
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
user@amr.1407003:1778162380
|
||||||
@@ -948,8 +948,6 @@ For the philosophical foundations, see the Whitehead analysis in the Validation
|
|||||||
|
|
||||||
Alfred North Whitehead's two major bodies of work — /Principia Mathematica/ (1910–1913, with Bertrand Russell) and /Process and Reality/ (1929) — provide both the historical foundation and the descriptive vocabulary for Passepartout's architecture. The first gave us the type theory that structures the gate stack; the second gave us the process ontology that describes the pipeline.
|
Alfred North Whitehead's two major bodies of work — /Principia Mathematica/ (1910–1913, with Bertrand Russell) and /Process and Reality/ (1929) — provide both the historical foundation and the descriptive vocabulary for Passepartout's architecture. The first gave us the type theory that structures the gate stack; the second gave us the process ontology that describes the pipeline.
|
||||||
|
|
||||||
*** Historical Connection: PM → Lisp
|
|
||||||
|
|
||||||
/Principia Mathematica/ is a direct ancestor of Lisp. Alonzo Church's lambda calculus (1930s), from which John McCarthy built Lisp (1958), was a response to PM's foundational program. PM's notation:
|
/Principia Mathematica/ is a direct ancestor of Lisp. Alonzo Church's lambda calculus (1930s), from which John McCarthy built Lisp (1958), was a response to PM's foundational program. PM's notation:
|
||||||
|
|
||||||
#+BEGIN_EXAMPLE
|
#+BEGIN_EXAMPLE
|
||||||
@@ -961,8 +959,6 @@ Alfred North Whitehead's two major bodies of work — /Principia Mathematica/ (1
|
|||||||
|
|
||||||
These map directly to Lisp: ~(lambda (x) (φ x))~, ~(class (x) (φ x))~, ~(the (x) (φ x))~. McCarthy cited PM as an influence. The connection is genetic, not metaphorical.
|
These map directly to Lisp: ~(lambda (x) (φ x))~, ~(class (x) (φ x))~, ~(the (x) (φ x))~. McCarthy cited PM as an influence. The connection is genetic, not metaphorical.
|
||||||
|
|
||||||
*** Process Philosophy as Architectural Vocabulary
|
|
||||||
|
|
||||||
Whitehead's process philosophy is a metaphysics of /becoming/ rather than /being/. The fundamental entities are not substances but /processes/ (/actual entities/, /occasions of experience/). This maps precisely to Passepartout's pipeline architecture:
|
Whitehead's process philosophy is a metaphysics of /becoming/ rather than /being/. The fundamental entities are not substances but /processes/ (/actual entities/, /occasions of experience/). This maps precisely to Passepartout's pipeline architecture:
|
||||||
|
|
||||||
| Whiteheadian Concept | Passepartout Mapping | Significance |
|
| Whiteheadian Concept | Passepartout Mapping | Significance |
|
||||||
@@ -984,12 +980,8 @@ The foveal-peripheral model maps directly onto Whitehead's two modes of percepti
|
|||||||
|
|
||||||
Whitehead also gives Passepartout a /descriptive vocabulary/ that is precise, standard, and already maps perfectly to the design. "I am concrescing signal 47 through gates 0-8" is not poetry — it is a precise description of dispatcher operation. "Gate 3 has negatively prehended signal 136" means the secret-content gate rejected signal 136. "The satisfaction includes a file-write prehension with Merkle commit abc123" means the response contains a file write with the given Merkle hash. The agent uses this vocabulary in its ~/why~ output and in the ARCHITECTURE.org documentation.
|
Whitehead also gives Passepartout a /descriptive vocabulary/ that is precise, standard, and already maps perfectly to the design. "I am concrescing signal 47 through gates 0-8" is not poetry — it is a precise description of dispatcher operation. "Gate 3 has negatively prehended signal 136" means the secret-content gate rejected signal 136. "The satisfaction includes a file-write prehension with Merkle commit abc123" means the response contains a file write with the given Merkle hash. The agent uses this vocabulary in its ~/why~ output and in the ARCHITECTURE.org documentation.
|
||||||
|
|
||||||
*** What Whitehead Does Not Contribute
|
|
||||||
|
|
||||||
Not everything is useful. PM's full formalism — 300+ pages to prove ~1+1=2~ — is catastrophic as a reasoning engine. The /ideas/ (type theory, descriptions, propositional functions) are what matter, not the notation. Similarly, Whitehead's later concept of God (the "principle of concretion") and the full 25-category metaphysical system have no useful mapping to an agent architecture. Select the concepts that map; don't build a process-philosophy engine.
|
Not everything is useful. PM's full formalism — 300+ pages to prove ~1+1=2~ — is catastrophic as a reasoning engine. The /ideas/ (type theory, descriptions, propositional functions) are what matter, not the notation. Similarly, Whitehead's later concept of God (the "principle of concretion") and the full 25-category metaphysical system have no useful mapping to an agent architecture. Select the concepts that map; don't build a process-philosophy engine.
|
||||||
|
|
||||||
*** Relation to the Neurosymbolic Architecture
|
|
||||||
|
|
||||||
Passepartout is level 4 neuro-symbolic (symbolic gates + neural LLM, deterministic components coordinate heterogeneous systems). PM's type theory adds level-5 properties: /structural/ safety guarantees rather than /empirical/ ones. The dispatcher becomes not just a runtime gate stack but a type-theoretic framework where category errors are impossible by construction — just as PM made Russell's paradox impossible by construction. The Whiteheadian vocabulary reinforces the architectural identity: Passepartout is not a chatbot with safety checks. It is a /process/ — a continuous concrescence of prehensions producing satisfactions — whose safety is guaranteed by the type structure of the prehending entities.
|
Passepartout is level 4 neuro-symbolic (symbolic gates + neural LLM, deterministic components coordinate heterogeneous systems). PM's type theory adds level-5 properties: /structural/ safety guarantees rather than /empirical/ ones. The dispatcher becomes not just a runtime gate stack but a type-theoretic framework where category errors are impossible by construction — just as PM made Russell's paradox impossible by construction. The Whiteheadian vocabulary reinforces the architectural identity: Passepartout is not a chatbot with safety checks. It is a /process/ — a continuous concrescence of prehensions producing satisfactions — whose safety is guaranteed by the type structure of the prehending entities.
|
||||||
|
|
||||||
** Historical Lineage — McCarthy's Advice Taker
|
** Historical Lineage — McCarthy's Advice Taker
|
||||||
@@ -1013,15 +1005,7 @@ The connection is not metaphorical. McCarthy cited /Principia Mathematica/ as an
|
|||||||
|
|
||||||
Reference: McCarthy, J. (1959). Programs with Common Sense. /Proceedings of the Teddington Conference on the Mechanization of Thought Processes./
|
Reference: McCarthy, J. (1959). Programs with Common Sense. /Proceedings of the Teddington Conference on the Mechanization of Thought Processes./
|
||||||
|
|
||||||
** Philosophical Validation — The Neurosymbolic Consensus
|
** Marcus (2020): The Case Against Pure Deep Learning
|
||||||
:PROPERTIES:
|
|
||||||
:ID: design-validation
|
|
||||||
:CREATED: [2026-05-10 Sun]
|
|
||||||
:END:
|
|
||||||
|
|
||||||
Three papers from the neurosymbolic AI research community validate the architectural thesis from complementary angles.
|
|
||||||
|
|
||||||
*** Marcus (2020): The Case Against Pure Deep Learning
|
|
||||||
|
|
||||||
Gary Marcus's "The Next Decade in AI" argues that deep learning alone is "data hungry, shallow, brittle, and limited in its ability to generalize." The paper demonstrates GPT-2 failing at basic commonsense reasoning:
|
Gary Marcus's "The Next Decade in AI" argues that deep learning alone is "data hungry, shallow, brittle, and limited in its ability to generalize." The paper demonstrates GPT-2 failing at basic commonsense reasoning:
|
||||||
|
|
||||||
@@ -1034,7 +1018,7 @@ Marcus's core claim — "we have no hope of achieving robust intelligence withou
|
|||||||
|
|
||||||
Reference: Marcus, G. (2020). The Next Decade in AI: Four Steps Towards Robust Artificial Intelligence. arXiv:2002.06177.
|
Reference: Marcus, G. (2020). The Next Decade in AI: Four Steps Towards Robust Artificial Intelligence. arXiv:2002.06177.
|
||||||
|
|
||||||
*** Gaur & Sheth (2023): CREST — Trustworthy Neurosymbolic AI
|
** Gaur & Sheth (2023): CREST — Trustworthy Neurosymbolic AI
|
||||||
|
|
||||||
Gaur and Sheth present the CREST framework: Consistency, Reliability, user-level Explainability, and Safety build Trust — and they argue these require neurosymbolic methods. Their empirical finding: GPT-3.5 breached safety constraints 30% of the time when asked identical questions repeatedly. Claude's 16 safety rules and Sparrow's 23 rules provide no /inherent/ safety — they are heuristic guardrails that can be breached through prompt variation.
|
Gaur and Sheth present the CREST framework: Consistency, Reliability, user-level Explainability, and Safety build Trust — and they argue these require neurosymbolic methods. Their empirical finding: GPT-3.5 breached safety constraints 30% of the time when asked identical questions repeatedly. Claude's 16 safety rules and Sparrow's 23 rules provide no /inherent/ safety — they are heuristic guardrails that can be breached through prompt variation.
|
||||||
|
|
||||||
@@ -1042,7 +1026,7 @@ These findings validate three Passepartout design commitments: (1) prompt-level
|
|||||||
|
|
||||||
Reference: Gaur, M., & Sheth, A. (2023). Building Trustworthy NeuroSymbolic AI Systems: Consistency, Reliability, Explainability, and Safety. arXiv:2312.06798.
|
Reference: Gaur, M., & Sheth, A. (2023). Building Trustworthy NeuroSymbolic AI Systems: Consistency, Reliability, Explainability, and Safety. arXiv:2312.06798.
|
||||||
|
|
||||||
*** Sheth et al. (2022): Knowledge-Infused Learning
|
** Sheth et al. (2022): Knowledge-Infused Learning
|
||||||
|
|
||||||
Sheth, Gunaratna, Bhatt, and Gaur define Knowledge-infused Learning (KiL) as "combining various types of explicit knowledge with data-driven deep learning techniques." They identify three infusion levels (shallow, semi-deep, deep) and position KiL as "a sweet spot in neuro-symbolic AI."
|
Sheth, Gunaratna, Bhatt, and Gaur define Knowledge-infused Learning (KiL) as "combining various types of explicit knowledge with data-driven deep learning techniques." They identify three infusion levels (shallow, semi-deep, deep) and position KiL as "a sweet spot in neuro-symbolic AI."
|
||||||
|
|
||||||
|
|||||||
@@ -672,8 +672,7 @@
|
|||||||
(text (setf (st :busy) nil)
|
(text (setf (st :busy) nil)
|
||||||
(add-msg :agent text :gate-trace gate-trace))
|
(add-msg :agent text :gate-trace gate-trace))
|
||||||
((eq action :handshake)
|
((eq action :handshake)
|
||||||
(setf (st :daemon-version) (getf payload :version))
|
(setf (st :daemon-version) (getf payload :version)))
|
||||||
(add-msg :system (format nil "Connected v~a" (getf payload :version))))
|
|
||||||
(t (add-msg :agent (format nil "~a" msg))))))
|
(t (add-msg :agent (format nil "~a" msg))))))
|
||||||
|
|
||||||
(defun send-daemon (msg)
|
(defun send-daemon (msg)
|
||||||
@@ -864,8 +863,11 @@
|
|||||||
(add-msg :system "* Swank unavailable *"))))
|
(add-msg :system "* Swank unavailable *"))))
|
||||||
(cl-tty.input:with-raw-terminal
|
(cl-tty.input:with-raw-terminal
|
||||||
(cl-tty.backend:with-terminal (be w h)
|
(cl-tty.backend:with-terminal (be w h)
|
||||||
(let ((tty (sb-sys:make-fd-stream 0 :input t :buffering :none)))
|
;; Log backend info and terminal dimensions
|
||||||
;; Initial render
|
(let ((backend-type (if (typep be 'cl-tty.backend:modern-backend)
|
||||||
|
"modern" "simple")))
|
||||||
|
(add-msg :system (format nil "* ~a backend ~dx~d *" backend-type w h)))
|
||||||
|
;; Initial render
|
||||||
(cl-tty.backend:backend-clear be)
|
(cl-tty.backend:backend-clear be)
|
||||||
(view-status be w h)
|
(view-status be w h)
|
||||||
(view-chat be w h)
|
(view-chat be w h)
|
||||||
@@ -881,35 +883,33 @@
|
|||||||
(setf (st :connected) nil
|
(setf (st :connected) nil
|
||||||
(st :busy) nil)
|
(st :busy) nil)
|
||||||
(add-msg :system "* Connection lost — type /reconnect to retry *"))))
|
(add-msg :system "* Connection lost — type /reconnect to retry *"))))
|
||||||
;; Check for terminal resize (SIGWINCH sets this flag)
|
;; Read key input via cl-tty read-event (10ms timeout)
|
||||||
(when (boundp 'cl-tty.input::*terminal-resized-p*)
|
(multiple-value-bind (type data)
|
||||||
(when cl-tty.input::*terminal-resized-p*
|
(cl-tty.input:read-event be :timeout 0.01)
|
||||||
(setf cl-tty.input::*terminal-resized-p* nil)
|
(when (eq type :resize)
|
||||||
(multiple-value-setq (w h) (cl-tty.backend:backend-size be))
|
(multiple-value-setq (w h) (cl-tty.backend:backend-size be))
|
||||||
(setf (st :dirty) (list t t t))))
|
(setf (st :dirty) (list t t t)))
|
||||||
;; Read key input from fd 0 (blocking via listen + read-char)
|
(when data
|
||||||
(let ((raw-ch (when (listen tty) (read-char tty nil nil))))
|
(let* ((ke data)
|
||||||
(when raw-ch
|
(ch (if (cl-tty.input:key-event-p ke)
|
||||||
(let ((code (char-code raw-ch)))
|
(let ((k (cl-tty.input:key-event-key ke)))
|
||||||
(let ((ch (cond
|
(if (cl-tty.input:key-event-ctrl ke)
|
||||||
((= code 13) :enter)
|
(intern (format nil "CTRL-~a" k) :keyword)
|
||||||
((= code 10) :enter)
|
k))
|
||||||
((= code 27) :escape)
|
ke)))
|
||||||
((= code 9) :tab)
|
(case ch
|
||||||
((or (= code 127) (= code 8)) :backspace)
|
(:CTRL-Q (setf (st :running) nil))
|
||||||
((and (>= code 1) (<= code 26))
|
(:CTRL-P (command-palette-show-commands))
|
||||||
(intern (string-upcase (format nil "CTRL-~a"
|
(:CTRL-B (setf (st :sidebar-visible) (not (st :sidebar-visible)))
|
||||||
(code-char (+ #x60 code))))
|
(setf (st :dirty) (list t t nil)))
|
||||||
:keyword))
|
(:CTRL-L (setf (st :dirty) (list t t t)))
|
||||||
(t raw-ch))))
|
(t (on-key ch))))))
|
||||||
(case ch
|
;; Re-query terminal size once after daemon handshake
|
||||||
(:CTRL-Q (setf (st :running) nil))
|
(when (and (st :connected) (st :daemon-version) (not (st :size-queried)))
|
||||||
(:CTRL-P (command-palette-show-commands))
|
(multiple-value-setq (w h) (cl-tty.backend:backend-size be))
|
||||||
(:CTRL-B (setf (st :sidebar-visible) (not (st :sidebar-visible)))
|
(setf (st :dirty) (list t t t))
|
||||||
(setf (st :dirty) (list t t nil)))
|
(setf (st :size-queried) t))
|
||||||
(:CTRL-L (setf (st :dirty) (list t t t)))
|
(when (or (first (st :dirty)) (second (st :dirty)) (third (st :dirty)))
|
||||||
(t (on-key ch)))))))
|
|
||||||
(when (or (first (st :dirty)) (second (st :dirty)) (third (st :dirty)))
|
|
||||||
(cl-tty.backend:backend-clear be)
|
(cl-tty.backend:backend-clear be)
|
||||||
(view-status be w h)
|
(view-status be w h)
|
||||||
(view-chat be w h)
|
(view-chat be w h)
|
||||||
@@ -951,8 +951,7 @@
|
|||||||
(t (theme-color :agent-fg)))
|
(t (theme-color :agent-fg)))
|
||||||
nil :bold sel-p)
|
nil :bold sel-p)
|
||||||
(incf y-off)))))))
|
(incf y-off)))))))
|
||||||
(sleep 0.1))))
|
(sleep 0.1))))
|
||||||
(close tty))
|
|
||||||
(disconnect-daemon)))
|
(disconnect-daemon)))
|
||||||
|
|
||||||
(eval-when (:compile-toplevel :load-toplevel :execute)
|
(eval-when (:compile-toplevel :load-toplevel :execute)
|
||||||
|
|||||||
@@ -178,6 +178,7 @@
|
|||||||
:command-palette-dialog nil ; v0.8.0
|
:command-palette-dialog nil ; v0.8.0
|
||||||
:session-cost 0.0 ; v0.9.0
|
:session-cost 0.0 ; v0.9.0
|
||||||
:daemon-version nil ; filled by handshake
|
:daemon-version nil ; filled by handshake
|
||||||
|
:size-queried nil ; re-query once post-handshake
|
||||||
:dirty (list nil nil nil))))
|
:dirty (list nil nil nil))))
|
||||||
|
|
||||||
(defvar *sidebar-panels*
|
(defvar *sidebar-panels*
|
||||||
|
|||||||
@@ -25,8 +25,7 @@ Returns a list of strings, one per line."
|
|||||||
(length (st :messages))
|
(length (st :messages))
|
||||||
(or (st :rule-count) 0)))
|
(or (st :rule-count) 0)))
|
||||||
(right (format nil "$~,2f ~a" (or (st :session-cost) 0.0) (now))))
|
(right (format nil "$~,2f ~a" (or (st :session-cost) 0.0) (now))))
|
||||||
(dotimes (col w)
|
(cl-tty.backend:draw-rect fb 0 (- h 1) w 1 :bg bg)
|
||||||
(cl-tty.backend:draw-text fb 0 (- h 1) (make-string w :initial-element #\Space) nil bg))
|
|
||||||
(cl-tty.backend:draw-text fb 1 (- h 1) left fg nil)
|
(cl-tty.backend:draw-text fb 1 (- h 1) left fg nil)
|
||||||
(cl-tty.backend:draw-text fb (- w (length right) 2) (- h 1) right fg nil)))
|
(cl-tty.backend:draw-text fb (- w (length right) 2) (- h 1) right fg nil)))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user