v0.7.2: gate-trace-lines + HITL inline — TDD

Gate trace visualization: gate-trace-lines converts gate-trace plists
to colored display lines (green passed, red blocked, yellow approval).
Data format: (:gate name :result :passed/:blocked/:approval :reason ...).
3 tests, 28/28 view suite.

HITL inline command handling: /approve HITL-xxxx and /deny HITL-xxxx
parsed as structured events (:action :hitl-respond), not raw text.
2 tests, 70/70 main suite.

Core: 65/65  Neuro: 13/13  All: 176/176
This commit is contained in:
2026-05-08 14:55:23 -04:00
parent 22878be710
commit b40e1e2844
6 changed files with 239 additions and 2 deletions

View File

@@ -131,6 +131,19 @@ Event handlers + daemon I/O + main loop.
(setf (st :input-hpos) 0)
(setf (st :scroll-offset) 0)
(cond
;; v0.7.2: HITL inline — structured approval/denial
((and (>= (length text) 9)
(string-equal (subseq text 0 9) "/approve "))
(let ((token (string-trim '(#\Space) (subseq text 9))))
(send-daemon (list :type :event :payload
(list :action :hitl-respond :token token :decision :approved)))
(add-msg :system (format nil "Approved: ~a" token))))
((and (>= (length text) 6)
(string-equal (subseq text 0 6) "/deny "))
(let ((token (string-trim '(#\Space) (subseq text 6))))
(send-daemon (list :type :event :payload
(list :action :hitl-respond :token token :decision :denied)))
(add-msg :system (format nil "Denied: ~a" token))))
;; /help command
((string-equal text "/help")
(add-msg :system
@@ -804,7 +817,31 @@ Event handlers + daemon I/O + main loop.
"Contract/v0.7.1: Tab on empty input with URL message extracts URL."
(init-state)
(add-msg :agent "visit https://example.com for info")
;; Tab should extract URL and set url buffer (model-level test)
(on-key 9)
(fiveam:is (string= "https://example.com" (st :url-buffer))))
;; ── v0.7.2 HITL ──
(fiveam:test test-hitl-approve-parsed
"Contract v0.7.2: /approve HITL-xxxx sends structured event, not raw text."
(init-state)
(dolist (ch (coerce "/approve HITL-abcd" 'list))
(on-key (char-code ch)))
(on-key 343)
;; Should add a system message confirming approval, not a user message
(let ((msgs (st :messages)))
(fiveam:is (>= (length msgs) 1))
(let ((m (aref msgs 0)))
(fiveam:is (eq :system (getf m :role)))
(fiveam:is (search "Approved" (getf m :content))))))
(fiveam:test test-hitl-deny-parsed
"Contract v0.7.2: /deny HITL-xxxx sends structured denial."
(init-state)
(dolist (ch (coerce "/deny HITL-xyz" 'list))
(on-key (char-code ch)))
(on-key 343)
(let ((m (aref (st :messages) 0)))
(fiveam:is (eq :system (getf m :role)))
(fiveam:is (search "Denied" (getf m :content)))))
#+end_src