v0.7.2: undo/redo — TDD
Operation-level memory undo/redo built on existing Merkle snapshot infrastructure. undo-snapshot captures state before destructive tool execution. /undo and /redo TUI commands send structured events. - core-memory: undo-snapshot, undo, redo functions + 3 tests - core-perceive: :undo/:redo sensor handlers - core-act: auto-snapshot before non-read-only tools - core-package: undo/redo symbol exports - channel-tui-main: /undo, /redo commands + 2 tests - Core: 73/73 TUI Main: 74/74
This commit is contained in:
@@ -97,7 +97,14 @@
|
||||
(setf (st :input-hpos) 0)
|
||||
(setf (st :scroll-offset) 0)
|
||||
(cond
|
||||
;; v0.7.2: HITL inline — structured approval/denial
|
||||
;; v0.7.2: undo/redo
|
||||
((string-equal text "/undo")
|
||||
(send-daemon (list :type :event :payload (list :sensor :undo)))
|
||||
(add-msg :system "Undo: restoring memory to previous state"))
|
||||
((string-equal text "/redo")
|
||||
(send-daemon (list :type :event :payload (list :sensor :redo)))
|
||||
(add-msg :system "Redo: restoring memory"))
|
||||
;; /help command
|
||||
((and (>= (length text) 9)
|
||||
(string-equal (subseq text 0 9) "/approve "))
|
||||
(let ((token (string-trim '(#\Space) (subseq text 9))))
|
||||
@@ -797,3 +804,25 @@
|
||||
(let ((m (aref (st :messages) 0)))
|
||||
(fiveam:is (eq :system (getf m :role)))
|
||||
(fiveam:is (search "Denied" (getf m :content)))))
|
||||
|
||||
;; ── v0.7.2 Undo/Redo ──
|
||||
|
||||
(fiveam:test test-undo-command
|
||||
"Contract v0.7.2: /undo sends undo event."
|
||||
(init-state)
|
||||
(dolist (ch (coerce "/undo" '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 "Undo" (getf m :content)))))
|
||||
|
||||
(fiveam:test test-redo-command
|
||||
"Contract v0.7.2: /redo sends redo event."
|
||||
(init-state)
|
||||
(dolist (ch (coerce "/redo" '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 "Redo" (getf m :content)))))
|
||||
|
||||
Reference in New Issue
Block a user