v0.7.2: safe-tool read-only allowlist — TDD
Read-only cognitive tools auto-pass dispatcher-check unconditionally. Added :read-only-p slot to cognitive-tool struct, :read-only-p keyword to def-cognitive-tool macro, tool-read-only-p registry lookup. - core-package: struct + macro + tool-read-only-p function - security-dispatcher: early auto-pass in dispatcher-check, 2 new tests - programming-tools: 7 tools marked :read-only-p t (search-files, find-files, read-file, list-directory, eval-form, run-tests, org-find-headline) - Dispatcher: 38/38
This commit is contained in:
@@ -70,10 +70,11 @@
|
||||
#:hitl-approve
|
||||
#:hitl-deny
|
||||
#:hitl-handle-message
|
||||
#:dispatcher-check-secret-path
|
||||
#:dispatcher-check-shell-safety
|
||||
#:dispatcher-check-privacy-tags
|
||||
#:dispatcher-check-network-exfil
|
||||
#:dispatcher-check-secret-path
|
||||
#:dispatcher-check-shell-safety
|
||||
#:dispatcher-check-privacy-tags
|
||||
#:dispatcher-check-network-exfil
|
||||
#:dispatcher-check
|
||||
#:dispatcher-gate
|
||||
#:wildcard-match
|
||||
#:actuator-initialize
|
||||
@@ -142,6 +143,7 @@
|
||||
#:cognitive-tool-parameters
|
||||
#:cognitive-tool-guard
|
||||
#:cognitive-tool-body
|
||||
#:tool-read-only-p
|
||||
#:register-probabilistic-backend
|
||||
#:*probabilistic-backends*
|
||||
#:*provider-cascade*
|
||||
@@ -216,16 +218,18 @@
|
||||
description
|
||||
parameters
|
||||
guard
|
||||
body)
|
||||
body
|
||||
read-only-p)
|
||||
|
||||
(defmacro def-cognitive-tool (name description parameters &key guard body)
|
||||
(defmacro def-cognitive-tool (name description parameters &key guard body read-only-p)
|
||||
"Registers a cognitive tool. PARAMETERS is a list of plists, one per parameter."
|
||||
`(setf (gethash (string-downcase (string ',name)) *cognitive-tool-registry*)
|
||||
(make-cognitive-tool :name (string-downcase (string ',name))
|
||||
:description ,description
|
||||
:parameters ',parameters
|
||||
:guard ,guard
|
||||
:body ,body)))
|
||||
:body ,body
|
||||
:read-only-p ,read-only-p)))
|
||||
|
||||
(defun cognitive-tool-prompt ()
|
||||
"Serialises all registered tools into a prompt string for the LLM."
|
||||
@@ -246,6 +250,12 @@
|
||||
(defun generate-tool-belt-prompt ()
|
||||
(cognitive-tool-prompt))
|
||||
|
||||
(defun tool-read-only-p (name)
|
||||
"Returns T if the named cognitive tool is read-only, NIL otherwise."
|
||||
(let ((tool (gethash (string-downcase (string name)) *cognitive-tool-registry*)))
|
||||
(when tool
|
||||
(cognitive-tool-read-only-p tool))))
|
||||
|
||||
(defun log-message (msg &rest args)
|
||||
"Centralized, thread-safe logging for the harness."
|
||||
(let ((formatted-msg (apply #'format nil msg args)))
|
||||
|
||||
Reference in New Issue
Block a user