fix(audit): Ensure Chat Skill is Merkle-compliant and secure (Component IV)
This commit is contained in:
@@ -54,14 +54,18 @@ Interfaces for conversational event handling and UI integration. Source of truth
|
|||||||
(defun chat-archive-message (text &key (role :user) channel chat-id)
|
(defun chat-archive-message (text &key (role :user) channel chat-id)
|
||||||
"Archives a chat message into the persistent Memory and triggers a snapshot."
|
"Archives a chat message into the persistent Memory and triggers a snapshot."
|
||||||
(let* ((msg-id (org-id-new))
|
(let* ((msg-id (org-id-new))
|
||||||
|
(attributes `(:role ,role :channel ,channel :chat-id ,chat-id :timestamp ,(get-universal-time)))
|
||||||
|
(hash (compute-merkle-hash msg-id :CHAT-MESSAGE attributes text nil))
|
||||||
(obj (make-org-object
|
(obj (make-org-object
|
||||||
:id msg-id
|
:id msg-id
|
||||||
:type :CHAT-MESSAGE
|
:type :CHAT-MESSAGE
|
||||||
:attributes `(:role ,role :channel ,channel :chat-id ,chat-id :timestamp ,(get-universal-time))
|
:attributes attributes
|
||||||
:content text
|
:content text
|
||||||
|
:hash hash
|
||||||
:version (get-universal-time))))
|
:version (get-universal-time))))
|
||||||
|
(setf (gethash hash *history-store*) obj)
|
||||||
(setf (gethash msg-id *memory*) obj)
|
(setf (gethash msg-id *memory*) obj)
|
||||||
(harness-log "CHAT - Message archived: ~a (~a)" msg-id role)
|
(harness-log "CHAT - Message archived: ~a (~a) [Hash: ~a]" msg-id role (subseq hash 0 8))
|
||||||
(snapshot-memory)
|
(snapshot-memory)
|
||||||
msg-id))
|
msg-id))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user